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

Function create_meter_rule

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

Source from the content-addressed store, hash-verified

1149}
1150
1151static void
1152create_meter_rule(int port_id, uint32_t counter)
1153{
1154 int ret;
1155 struct rte_mtr_params params;
1156 struct rte_mtr_error error;
1157
1158 memset(&params, 0, sizeof(struct rte_mtr_params));
1159 params.meter_enable = 1;
1160 params.stats_mask = 0xffff;
1161 params.use_prev_mtr_color = 0;
1162 params.dscp_table = NULL;
1163
1164 /*create meter*/
1165 params.meter_profile_id = DEFAULT_METER_PROF_ID;
1166
1167 if (!policy_mtr) {
1168 ret = rte_mtr_create(port_id, counter, &params, 1, &error);
1169 } else {
1170 params.meter_policy_id = policy_id[port_id];
1171 ret = rte_mtr_create(port_id, counter, &params, 0, &error);
1172 }
1173
1174 if (ret != 0) {
1175 printf("Port %u create meter idx(%d) error(%d) message: %s\n",
1176 port_id, counter, error.type,
1177 error.message ? error.message : "(no stated reason)");
1178 rte_exit(EXIT_FAILURE, "Error in creating meter\n");
1179 }
1180}
1181
1182static void
1183destroy_meter_rule(int port_id, uint32_t counter)

Callers 1

meters_handlerFunction · 0.85

Calls 4

memsetFunction · 0.85
rte_mtr_createFunction · 0.85
rte_exitFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected