Beispiel #1
0
static int
timed_adds(struct efd_perf_params *params)
{
	const uint64_t start_tsc = rte_rdtsc();
	unsigned int i, a;
	int32_t ret;

	for (i = 0; i < KEYS_TO_ADD; i++) {
		ret = rte_efd_update(params->efd_table, test_socket_id, keys[i],
				data[i]);
		if (ret != 0) {
			printf("Error %d in rte_efd_update - key=0x", ret);
			for (a = 0; a < params->key_size; a++)
				printf("%02x", keys[i][a]);
			printf(" value=%d\n", data[i]);

			return -1;
		}
	}

	const uint64_t end_tsc = rte_rdtsc();
	const uint64_t time_taken = end_tsc - start_tsc;

	cycles[params->cycle][ADD] = time_taken / KEYS_TO_ADD;
	return 0;
}
Beispiel #2
0
static void
populate_flow_distributor_table(void)
{
	unsigned int i;
	int32_t ret;
	uint32_t ip_dst;
	uint8_t socket_id = rte_socket_id();
	uint64_t node_id;

	/* Add flows in table */
	for (i = 0; i < num_flows; i++) {
		node_id = i % num_nodes;

		ip_dst = rte_cpu_to_be_32(i);
		ret = rte_efd_update(efd_table, socket_id,
				(void *)&ip_dst, (efd_value_t)node_id);
		if (ret < 0)
			rte_exit(EXIT_FAILURE, "Unable to add entry %u in "
					"flow distributor table\n", i);
	}

	printf("EFD table: Adding 0x%x keys\n", num_flows);
}