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

Function cmd_pipeline_meter_reset

dpdk/examples/pipeline/cli.c:2178–2293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2176 " | table <table_name> match <field0> ...\n";
2177
2178static void
2179cmd_pipeline_meter_reset(char **tokens,
2180 uint32_t n_tokens,
2181 char *out,
2182 size_t out_size,
2183 void *obj __rte_unused)
2184{
2185 struct rte_swx_pipeline *p;
2186 struct rte_swx_ctl_pipeline *ctl;
2187 const char *pipeline_name, *name;
2188
2189 if (n_tokens < 6) {
2190 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
2191 return;
2192 }
2193
2194 pipeline_name = tokens[1];
2195 p = rte_swx_pipeline_find(pipeline_name);
2196 ctl = rte_swx_ctl_pipeline_find(pipeline_name);
2197 if (!p || !ctl) {
2198 snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
2199 return;
2200 }
2201
2202 if (strcmp(tokens[2], "meter")) {
2203 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "meter");
2204 return;
2205 }
2206
2207 name = tokens[3];
2208
2209 if (strcmp(tokens[4], "reset")) {
2210 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "reset");
2211 return;
2212 }
2213
2214 /* index. */
2215 if (!strcmp(tokens[5], "index")) {
2216 uint32_t idx0 = 0, idx1 = 0;
2217
2218 if (n_tokens != 10) {
2219 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
2220 return;
2221 }
2222
2223 if (strcmp(tokens[6], "from")) {
2224 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "from");
2225 return;
2226 }
2227
2228 if (parser_read_uint32(&idx0, tokens[7])) {
2229 snprintf(out, out_size, MSG_ARG_INVALID, "index0");
2230 return;
2231 }
2232
2233 if (strcmp(tokens[8], "to")) {
2234 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "to");
2235 return;

Callers 1

cli_processFunction · 0.85

Calls 9

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

Tested by

no test coverage detected