/* * Create flow distributor table which will contain all the flows * that will be distributed among the nodes */ static void create_flow_distributor_table(void) { uint8_t socket_id = rte_socket_id(); /* create table */ efd_table = rte_efd_create("flow table", num_flows * 2, sizeof(uint32_t), 1 << socket_id, socket_id); if (efd_table == NULL) rte_exit(EXIT_FAILURE, "Problem creating the flow table\n"); }
/* * TODO: we could "error proof" these as done in test_hash_perf.c ln 165: * * The current setup may give errors if too full in some cases which we check * for. However, since EFD allows for ~99% capacity, these errors are rare for * #"KEYS_TO_ADD" which is 75% capacity. */ static int setup_keys_and_data(struct efd_perf_params *params, unsigned int cycle) { unsigned int i, j; int num_duplicates; params->key_size = hashtest_key_lens[cycle]; params->cycle = cycle; /* Reset all arrays */ for (i = 0; i < params->key_size; i++) keys[0][i] = 0; /* Generate a list of keys, some of which may be duplicates */ for (i = 0; i < KEYS_TO_ADD; i++) { for (j = 0; j < params->key_size; j++) keys[i][j] = rte_rand() & 0xFF; data[i] = rte_rand() & VALUE_BITMASK; } /* Remove duplicates from the keys array */ do { num_duplicates = 0; /* Sort the list of keys to make it easier to find duplicates */ qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare); /* Sift through the list of keys and look for duplicates */ int num_duplicates = 0; for (i = 0; i < KEYS_TO_ADD - 1; i++) { if (memcmp(keys[i], keys[i + 1], params->key_size) == 0) { /* This key already exists, try again */ num_duplicates++; for (j = 0; j < params->key_size; j++) keys[i][j] = rte_rand() & 0xFF; } } } while (num_duplicates != 0); /* Shuffle the random values again */ shuffle_input_keys(params); params->efd_table = rte_efd_create("test_efd_perf", MAX_ENTRIES, params->key_size, efd_get_all_sockets_bitmask(), test_socket_id); TEST_ASSERT_NOT_NULL(params->efd_table, "Error creating the efd table\n"); return 0; }