MCPcopy Create free account
hub / github.com/F-Stack/f-stack / destroy_flows

Function destroy_flows

dpdk/app/test-flow-perf/main.c:1319–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319static inline void
1320destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
1321{
1322 struct rte_flow_error error;
1323 clock_t start_batch, end_batch;
1324 double cpu_time_used = 0;
1325 double deletion_rate;
1326 double cpu_time_per_batch[MAX_BATCHES_COUNT] = { 0 };
1327 double delta;
1328 uint32_t i;
1329 int rules_batch_idx;
1330 int rules_count_per_core;
1331
1332 rules_count_per_core = rules_count / mc_pool.cores_count;
1333 /* If group > 0 , should add 1 flow which created in group 0 */
1334 if (flow_group > 0 && core_id == 0)
1335 rules_count_per_core++;
1336
1337 start_batch = rte_get_timer_cycles();
1338 for (i = 0; i < (uint32_t) rules_count_per_core; i++) {
1339 if (flows_list[i] == 0)
1340 break;
1341
1342 memset(&error, 0x33, sizeof(error));
1343 if (rte_flow_destroy(port_id, flows_list[i], &error)) {
1344 print_flow_error(error);
1345 rte_exit(EXIT_FAILURE, "Error in deleting flow\n");
1346 }
1347
1348 /*
1349 * Save the deletion rate for rules batch.
1350 * Check if the deletion reached the rules
1351 * patch counter, then save the deletion rate
1352 * for this batch.
1353 */
1354 if (!((i + 1) % rules_batch)) {
1355 end_batch = rte_get_timer_cycles();
1356 delta = (double) (end_batch - start_batch);
1357 rules_batch_idx = ((i + 1) / rules_batch) - 1;
1358 cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz();
1359 cpu_time_used += cpu_time_per_batch[rules_batch_idx];
1360 start_batch = rte_get_timer_cycles();
1361 }
1362 }
1363
1364 /* Print deletion rates for all batches */
1365 if (dump_iterations)
1366 print_rules_batches(cpu_time_per_batch);
1367
1368 /* Deletion rate for all rules */
1369 deletion_rate = ((double) (rules_count_per_core / cpu_time_used) / 1000);
1370 printf(":: Port %d :: Core %d :: Rules deletion rate -> %f K Rule/Sec\n",
1371 port_id, core_id, deletion_rate);
1372 printf(":: Port %d :: Core %d :: The time for deleting %d rules is %f seconds\n",
1373 port_id, core_id, rules_count_per_core, cpu_time_used);
1374
1375 mc_pool.flows_record.deletion[port_id][core_id] = cpu_time_used;
1376}

Callers 1

flows_handlerFunction · 0.85

Calls 6

memsetFunction · 0.85
rte_flow_destroyFunction · 0.85
print_flow_errorFunction · 0.85
rte_exitFunction · 0.85
print_rules_batchesFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected