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

Function port_flow_pattern_template_destroy

dpdk/app/test-pmd/config.c:2340–2384  ·  view source on GitHub ↗

Destroy pattern template */

Source from the content-addressed store, hash-verified

2338
2339/** Destroy pattern template */
2340int
2341port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
2342 const uint32_t *template)
2343{
2344 struct rte_port *port;
2345 struct port_template **tmp;
2346 int ret = 0;
2347
2348 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
2349 port_id == (portid_t)RTE_PORT_ALL)
2350 return -EINVAL;
2351 port = &ports[port_id];
2352 tmp = &port->pattern_templ_list;
2353 while (*tmp) {
2354 uint32_t i;
2355
2356 for (i = 0; i != n; ++i) {
2357 struct rte_flow_error error;
2358 struct port_template *pit = *tmp;
2359
2360 if (template[i] != pit->id)
2361 continue;
2362 /*
2363 * Poisoning to make sure PMDs update it in case
2364 * of error.
2365 */
2366 memset(&error, 0x33, sizeof(error));
2367
2368 if (pit->template.pattern_template &&
2369 rte_flow_pattern_template_destroy(port_id,
2370 pit->template.pattern_template,
2371 &error)) {
2372 ret = port_flow_complain(&error);
2373 continue;
2374 }
2375 *tmp = pit->next;
2376 printf("Pattern template #%u destroyed\n", pit->id);
2377 free(pit);
2378 break;
2379 }
2380 if (i == n)
2381 tmp = &(*tmp)->next;
2382 }
2383 return ret;
2384}
2385
2386/** Flush pattern template */
2387int

Callers 2

cmd_flow_parsedFunction · 0.85

Calls 6

port_id_is_invalidFunction · 0.85
memsetFunction · 0.85
port_flow_complainFunction · 0.70
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected