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

Function create_meter_policy

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

Source from the content-addressed store, hash-verified

1094}
1095
1096static void
1097create_meter_policy(void)
1098{
1099 struct rte_mtr_error error;
1100 int ret, port_id;
1101 struct rte_mtr_meter_policy_params policy;
1102 uint16_t nr_ports;
1103 struct rte_flow_action actions[RTE_COLORS][MAX_ACTIONS_NUM];
1104 int i;
1105
1106 memset(actions, 0, sizeof(actions));
1107 memset(&policy, 0, sizeof(policy));
1108 nr_ports = rte_eth_dev_count_avail();
1109 for (port_id = 0; port_id < nr_ports; port_id++) {
1110 for (i = 0; i < RTE_COLORS; i++)
1111 fill_actions(actions[i], all_actions[i], 0, 0, 0,
1112 0, 0, 0, unique_data, rx_queues_count,
1113 dst_ports[port_id]);
1114 policy.actions[RTE_COLOR_GREEN] = actions[RTE_COLOR_GREEN];
1115 policy.actions[RTE_COLOR_YELLOW] = actions[RTE_COLOR_YELLOW];
1116 policy.actions[RTE_COLOR_RED] = actions[RTE_COLOR_RED];
1117 policy_id[port_id] = port_id + 10;
1118 ret = rte_mtr_meter_policy_add(port_id, policy_id[port_id],
1119 &policy, &error);
1120 if (ret) {
1121 fprintf(stderr, "port %d: failed to create meter policy\n",
1122 port_id);
1123 policy_id[port_id] = UINT32_MAX;
1124 }
1125 memset(actions, 0, sizeof(actions));
1126 }
1127}
1128
1129static void
1130destroy_meter_policy(void)

Callers 1

mainFunction · 0.85

Calls 4

memsetFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
fill_actionsFunction · 0.85
rte_mtr_meter_policy_addFunction · 0.85

Tested by

no test coverage detected