#define MAX_ITERATIONS 100
#define DEFAULT_RULES_COUNT 4000000
-#define DEFAULT_ITERATION 100000
+#define DEFAULT_RULES_BATCH 100000
+#define DEFAULT_GROUP 0
struct rte_flow *flow;
static uint8_t flow_group;
static struct rte_mempool *mbuf_mp;
static uint32_t nb_lcores;
-static uint32_t flows_count;
-static uint32_t iterations_number;
+static uint32_t rules_count;
+static uint32_t rules_batch;
static uint32_t hairpin_queues_num; /* total hairpin q number - default: 0 */
static uint32_t nb_lcores;
{
printf("\nusage: %s\n", progname);
printf("\nControl configurations:\n");
- printf(" --flows-count=N: to set the number of needed"
- " flows to insert, default is 4,000,000\n");
+ printf(" --rules-count=N: to set the number of needed"
+ " rules to insert, default is %d\n", DEFAULT_RULES_COUNT);
+ printf(" --rules-batch=N: set number of batched rules,"
+ " default is %d\n", DEFAULT_RULES_BATCH);
printf(" --dump-iterations: To print rates for each"
" iteration\n");
printf(" --deletion-rate: Enable deletion rate"
printf(" --egress: set egress attribute in flows\n");
printf(" --transfer: set transfer attribute in flows\n");
printf(" --group=N: set group for all flows,"
- " default is 0\n");
+ " default is %d\n", DEFAULT_GROUP);
printf("To set flow items:\n");
printf(" --ether: add ether layer in flow items\n");
static const struct option lgopts[] = {
/* Control */
{ "help", 0, 0, 0 },
- { "flows-count", 1, 0, 0 },
+ { "rules-count", 1, 0, 0 },
+ { "rules-batch", 1, 0, 0 },
{ "dump-iterations", 0, 0, 0 },
{ "deletion-rate", 0, 0, 0 },
{ "dump-socket-mem", 0, 0, 0 },
}
/* Control */
if (strcmp(lgopts[opt_idx].name,
- "flows-count") == 0) {
+ "rules-batch") == 0) {
n = atoi(optarg);
- if (n > (int) iterations_number)
- flows_count = n;
+ if (n >= DEFAULT_RULES_BATCH)
+ rules_batch = n;
else {
- printf("\n\nflows_count should be > %d\n",
- iterations_number);
+ printf("\n\nrules_batch should be >= %d\n",
+ DEFAULT_RULES_BATCH);
rte_exit(EXIT_SUCCESS, " ");
}
}
+ if (strcmp(lgopts[opt_idx].name,
+ "rules-count") == 0) {
+ n = atoi(optarg);
+ if (n >= (int) rules_batch)
+ rules_count = n;
+ else {
+ printf("\n\nrules_count should be >= %d\n",
+ rules_batch);
+ }
+ }
if (strcmp(lgopts[opt_idx].name,
"dump-iterations") == 0)
dump_iterations = true;
for (i = 0; i < MAX_ITERATIONS; i++)
cpu_time_per_iter[i] = -1;
- if (iterations_number > flows_count)
- iterations_number = flows_count;
+ if (rules_batch > rules_count)
+ rules_batch = rules_count;
/* Deletion Rate */
printf("Flows Deletion on port = %d\n", port_id);
start_iter = clock();
- for (i = 0; i < flows_count; i++) {
+ for (i = 0; i < rules_count; i++) {
if (flow_list[i] == 0)
break;
rte_exit(EXIT_FAILURE, "Error in deleting flow");
}
- if (i && !((i + 1) % iterations_number)) {
+ if (i && !((i + 1) % rules_batch)) {
/* Save the deletion rate of each iter */
end_iter = clock();
delta = (double) (end_iter - start_iter);
- iter_id = ((i + 1) / iterations_number) - 1;
+ iter_id = ((i + 1) / rules_batch) - 1;
cpu_time_per_iter[iter_id] =
delta / CLOCKS_PER_SEC;
cpu_time_used += cpu_time_per_iter[iter_id];
for (i = 0; i < MAX_ITERATIONS; i++) {
if (cpu_time_per_iter[i] == -1)
continue;
- delta = (double)(iterations_number /
+ delta = (double)(rules_batch /
cpu_time_per_iter[i]);
flows_rate = delta / 1000;
printf(":: Iteration #%d: %d flows "
"in %f sec[ Rate = %f K/Sec ]\n",
- i, iterations_number,
+ i, rules_batch,
cpu_time_per_iter[i], flows_rate);
}
/* Deletion rate for all flows */
- flows_rate = ((double) (flows_count / cpu_time_used) / 1000);
+ flows_rate = ((double) (rules_count / cpu_time_used) / 1000);
printf("\n:: Total flow deletion rate -> %f K/Sec\n",
flows_rate);
printf(":: The time for deleting %d in flows %f seconds\n",
- flows_count, cpu_time_used);
+ rules_count, cpu_time_used);
}
static inline void
for (i = 0; i < MAX_ITERATIONS; i++)
cpu_time_per_iter[i] = -1;
- if (iterations_number > flows_count)
- iterations_number = flows_count;
+ if (rules_batch > rules_count)
+ rules_batch = rules_count;
- printf(":: Flows Count per port: %d\n", flows_count);
+ printf(":: Flows Count per port: %d\n", rules_count);
flow_list = rte_zmalloc("flow_list",
- (sizeof(struct rte_flow *) * flows_count) + 1, 0);
+ (sizeof(struct rte_flow *) * rules_count) + 1, 0);
if (flow_list == NULL)
rte_exit(EXIT_FAILURE, "No Memory available!");
/* Insertion Rate */
printf("Flows insertion on port = %d\n", port_id);
start_iter = clock();
- for (i = 0; i < flows_count; i++) {
+ for (i = 0; i < rules_count; i++) {
flow = generate_flow(port_id, flow_group,
flow_attrs, flow_items, flow_actions,
JUMP_ACTION_TABLE, i,
&error);
if (force_quit)
- i = flows_count;
+ i = rules_count;
if (!flow) {
print_flow_error(error);
flow_list[flow_index++] = flow;
- if (i && !((i + 1) % iterations_number)) {
+ if (i && !((i + 1) % rules_batch)) {
/* Save the insertion rate of each iter */
end_iter = clock();
delta = (double) (end_iter - start_iter);
- iter_id = ((i + 1) / iterations_number) - 1;
+ iter_id = ((i + 1) / rules_batch) - 1;
cpu_time_per_iter[iter_id] =
delta / CLOCKS_PER_SEC;
cpu_time_used += cpu_time_per_iter[iter_id];
for (i = 0; i < MAX_ITERATIONS; i++) {
if (cpu_time_per_iter[i] == -1)
continue;
- delta = (double)(iterations_number /
+ delta = (double)(rules_batch /
cpu_time_per_iter[i]);
flows_rate = delta / 1000;
printf(":: Iteration #%d: %d flows "
"in %f sec[ Rate = %f K/Sec ]\n",
- i, iterations_number,
+ i, rules_batch,
cpu_time_per_iter[i], flows_rate);
}
/* Insertion rate for all flows */
- flows_rate = ((double) (flows_count / cpu_time_used) / 1000);
+ flows_rate = ((double) (rules_count / cpu_time_used) / 1000);
printf("\n:: Total flow insertion rate -> %f K/Sec\n",
flows_rate);
printf(":: The time for creating %d in flows %f seconds\n",
- flows_count, cpu_time_used);
+ rules_count, cpu_time_used);
if (delete_flag)
destroy_flows(port_id, flow_list);
force_quit = false;
dump_iterations = false;
- flows_count = DEFAULT_RULES_COUNT;
- iterations_number = DEFAULT_ITERATION;
+ rules_count = DEFAULT_RULES_COUNT;
+ rules_batch = DEFAULT_RULES_BATCH;
delete_flag = false;
dump_socket_mem_flag = false;
- flow_group = 0;
+ flow_group = DEFAULT_GROUP;
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
=====================
Application for rte_flow performance testing.
-The application provide the ability to test insertion rate of specific
-rte_flow rule, by stressing it to the NIC, and calculate the insertion
-rate.
+The application provides the ability to test insertion rate of specific
+rte_flow rule, by stressing it to the NIC, and calculates the insertion
+and deletion rates.
-The application offers some options in the command line, to configure
-which rule to apply.
+The application allows to configure which rule to apply through several
+options of the command line.
After that the application will start producing rules with same pattern
but increasing the outer IP source address by 1 each time, thus it will
give different flow each time, and all other items will have open masks.
-The application also provide the ability to measure rte flow deletion rate,
-in addition to memory consumption before and after the flows creation.
+To assess the rule insertion rate, the flow performance tool breaks
+down the entire number of flow rule operations into windows of fixed size
+(defaults to 100000 flow rule operations per window, but can be configured).
+Then, the flow performance tool measures the total time per window and
+computes an average time across all windows.
+
+The application also provides the ability to measure rte flow deletion rate,
+in addition to memory consumption before and after the flow rules' creation.
The app supports single and multi core performance measurements.
.. code-block:: console
- sudo ./dpdk-test-flow_perf -n 4 -w 08:00.0 -- --ingress --ether --ipv4 --queue --flows-count=1000000
+ sudo ./dpdk-test-flow_perf -n 4 -w 08:00.0 -- --ingress --ether --ipv4 --queue --rules-count=1000000
The command line options are:
* ``--help``
Display a help message and quit.
-* ``--flows-count=N``
- Set the number of needed flows to insert,
- where 1 <= N <= "number of flows".
+* ``--rules-count=N``
+ Set the total number of flow rules to insert,
+ where 1 <= N <= "number of flow rules".
The default value is 4,000,000.
+* ``--rules-batch=N``
+ Set the number of flow rules to insert per iteration window,
+ where 1 <= N <= "number of flow rules per iteration window".
+ The default value is 100,000 flow rules per iteration window.
+ For a total of --rules-count=1000000 flow rules to be inserted
+ and an iteration window size of --rules-batch=100000 flow rules,
+ the application will measure the insertion rate 10 times
+ (i.e., once every 100000 flow rules) and then report an average
+ insertion rate across the 10 measurements.
+
* ``--dump-iterations``
- Print rates for each iteration of flows.
- Default iteration is 1,00,000.
+ Print rates for each iteration window.
+ Default iteration window equals to the rules-batch size (i.e., 100,000).
* ``--deletion-rate``
Enable deletion rate calculations.