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

Function cmd_pipeline_meter_set

dpdk/examples/pipeline/cli.c:2300–2426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2298 " | table <table_name> match <field0> ...\n";
2299
2300static void
2301cmd_pipeline_meter_set(char **tokens,
2302 uint32_t n_tokens,
2303 char *out,
2304 size_t out_size,
2305 void *obj __rte_unused)
2306{
2307 struct rte_swx_pipeline *p;
2308 struct rte_swx_ctl_pipeline *ctl;
2309 const char *pipeline_name, *name, *profile_name;
2310
2311 if (n_tokens < 8) {
2312 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
2313 return;
2314 }
2315
2316 pipeline_name = tokens[1];
2317 p = rte_swx_pipeline_find(pipeline_name);
2318 ctl = rte_swx_ctl_pipeline_find(pipeline_name);
2319 if (!p || !ctl) {
2320 snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
2321 return;
2322 }
2323
2324 if (strcmp(tokens[2], "meter")) {
2325 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meter");
2326 return;
2327 }
2328
2329 name = tokens[3];
2330
2331 if (strcmp(tokens[4], "set")) {
2332 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "set");
2333 return;
2334 }
2335
2336 if (strcmp(tokens[5], "profile")) {
2337 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
2338 return;
2339 }
2340
2341 profile_name = tokens[6];
2342
2343 /* index. */
2344 if (!strcmp(tokens[7], "index")) {
2345 uint32_t idx0 = 0, idx1 = 0;
2346
2347 if (n_tokens != 12) {
2348 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
2349 return;
2350 }
2351
2352 if (strcmp(tokens[8], "from")) {
2353 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "from");
2354 return;
2355 }
2356
2357 if (parser_read_uint32(&idx0, tokens[9])) {

Callers 1

cli_processFunction · 0.85

Calls 9

snprintfFunction · 0.85
rte_swx_pipeline_findFunction · 0.85
strcmpFunction · 0.85
rte_swx_ctl_meter_setFunction · 0.85
parse_table_entryFunction · 0.85
parser_read_uint32Function · 0.70
table_entry_freeFunction · 0.70

Tested by

no test coverage detected