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

Function port_flow_pattern_template_create

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

Create pattern template */

Source from the content-addressed store, hash-verified

2307
2308/** Create pattern template */
2309int
2310port_flow_pattern_template_create(portid_t port_id, uint32_t id,
2311 const struct rte_flow_pattern_template_attr *attr,
2312 const struct rte_flow_item *pattern)
2313{
2314 struct rte_port *port;
2315 struct port_template *pit;
2316 int ret;
2317 struct rte_flow_error error;
2318
2319 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
2320 port_id == (portid_t)RTE_PORT_ALL)
2321 return -EINVAL;
2322 port = &ports[port_id];
2323 ret = template_alloc(id, &pit, &port->pattern_templ_list);
2324 if (ret)
2325 return ret;
2326 /* Poisoning to make sure PMDs update it in case of error. */
2327 memset(&error, 0x22, sizeof(error));
2328 pit->template.pattern_template = rte_flow_pattern_template_create(port_id,
2329 attr, pattern, &error);
2330 if (!pit->template.pattern_template) {
2331 uint32_t destroy_id = pit->id;
2332 port_flow_pattern_template_destroy(port_id, 1, &destroy_id);
2333 return port_flow_complain(&error);
2334 }
2335 printf("Pattern template #%u created\n", pit->id);
2336 return 0;
2337}
2338
2339/** Destroy pattern template */
2340int

Callers 1

cmd_flow_parsedFunction · 0.85

Calls 7

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

Tested by

no test coverage detected