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

Function insert_flows

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

Source from the content-addressed store, hash-verified

1376}
1377
1378static struct rte_flow **
1379insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
1380{
1381 struct rte_flow **flows_list;
1382 struct rte_flow_error error;
1383 clock_t start_batch, end_batch;
1384 double first_flow_latency;
1385 double cpu_time_used;
1386 double insertion_rate;
1387 double cpu_time_per_batch[MAX_BATCHES_COUNT] = { 0 };
1388 double delta;
1389 uint32_t flow_index;
1390 uint32_t counter, start_counter = 0, end_counter;
1391 uint64_t global_items[MAX_ITEMS_NUM] = { 0 };
1392 uint64_t global_actions[MAX_ACTIONS_NUM] = { 0 };
1393 int rules_batch_idx;
1394 int rules_count_per_core;
1395
1396 rules_count_per_core = rules_count / mc_pool.cores_count;
1397
1398 /* Set boundaries of rules for each core. */
1399 if (core_id)
1400 start_counter = core_id * rules_count_per_core;
1401 end_counter = (core_id + 1) * rules_count_per_core;
1402
1403 global_items[0] = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH);
1404 global_actions[0] = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_JUMP);
1405
1406 flows_list = rte_zmalloc("flows_list",
1407 (sizeof(struct rte_flow *) * rules_count_per_core) + 1, 0);
1408 if (flows_list == NULL)
1409 rte_exit(EXIT_FAILURE, "No Memory available!\n");
1410
1411 cpu_time_used = 0;
1412 flow_index = 0;
1413 if (flow_group > 0 && core_id == 0) {
1414 /*
1415 * Create global rule to jump into flow_group,
1416 * this way the app will avoid the default rules.
1417 *
1418 * This rule will be created only once.
1419 *
1420 * Global rule:
1421 * group 0 eth / end actions jump group <flow_group>
1422 */
1423 flow = generate_flow(port_id, 0, flow_attrs,
1424 global_items, global_actions,
1425 flow_group, 0, 0, 0, 0, dst_port_id, core_id,
1426 rx_queues_count, unique_data, max_priority, &error);
1427
1428 if (flow == NULL) {
1429 print_flow_error(error);
1430 rte_exit(EXIT_FAILURE, "Error in creating flow\n");
1431 }
1432 flows_list[flow_index++] = flow;
1433 }
1434
1435 start_batch = rte_get_timer_cycles();

Callers 1

flows_handlerFunction · 0.85

Calls 6

rte_zmallocFunction · 0.85
rte_exitFunction · 0.85
generate_flowFunction · 0.85
print_flow_errorFunction · 0.85
print_rules_batchesFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected