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

Function cmd_pipeline_table_stats

dpdk/examples/ip_pipeline/cli.c:2484–2548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2482 "Pkts in with lookup miss dropped by others: %" PRIu64 "\n"
2483
2484static void
2485cmd_pipeline_table_stats(char **tokens,
2486 uint32_t n_tokens,
2487 char *out,
2488 size_t out_size)
2489{
2490 struct rte_pipeline_table_stats stats;
2491 char *pipeline_name;
2492 uint32_t table_id;
2493 int clear, status;
2494
2495 if ((n_tokens != 6) && (n_tokens != 7)) {
2496 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
2497 return;
2498 }
2499
2500 pipeline_name = tokens[1];
2501
2502 if (strcmp(tokens[2], "table") != 0) {
2503 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port");
2504 return;
2505 }
2506
2507 if (parser_read_uint32(&table_id, tokens[3]) != 0) {
2508 snprintf(out, out_size, MSG_ARG_INVALID, "table_id");
2509 return;
2510 }
2511
2512 if (strcmp(tokens[4], "stats") != 0) {
2513 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "stats");
2514 return;
2515 }
2516
2517 if (strcmp(tokens[5], "read") != 0) {
2518 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "read");
2519 return;
2520 }
2521
2522 clear = 0;
2523 if (n_tokens == 7) {
2524 if (strcmp(tokens[6], "clear") != 0) {
2525 snprintf(out, out_size, MSG_ARG_INVALID, "clear");
2526 return;
2527 }
2528
2529 clear = 1;
2530 }
2531
2532 status = pipeline_table_stats_read(pipeline_name,
2533 table_id,
2534 &stats,
2535 clear);
2536 if (status) {
2537 snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
2538 return;
2539 }
2540
2541 snprintf(out, out_size, MSG_PIPELINE_TABLE_STATS,

Callers 1

cli_processFunction · 0.85

Calls 4

snprintfFunction · 0.85
strcmpFunction · 0.85
parser_read_uint32Function · 0.70

Tested by

no test coverage detected