Validate flow rule. */
| 2258 | |
| 2259 | /** Validate flow rule. */ |
| 2260 | int |
| 2261 | port_flow_validate(portid_t port_id, |
| 2262 | const struct rte_flow_attr *attr, |
| 2263 | const struct rte_flow_item *pattern, |
| 2264 | const struct rte_flow_action *actions, |
| 2265 | const struct tunnel_ops *tunnel_ops) |
| 2266 | { |
| 2267 | struct rte_flow_error error; |
| 2268 | struct port_flow_tunnel *pft = NULL; |
| 2269 | int ret; |
| 2270 | |
| 2271 | /* Poisoning to make sure PMDs update it in case of error. */ |
| 2272 | memset(&error, 0x11, sizeof(error)); |
| 2273 | if (tunnel_ops->enabled) { |
| 2274 | pft = port_flow_tunnel_offload_cmd_prep(port_id, pattern, |
| 2275 | actions, tunnel_ops); |
| 2276 | if (!pft) |
| 2277 | return -ENOENT; |
| 2278 | if (pft->items) |
| 2279 | pattern = pft->items; |
| 2280 | if (pft->actions) |
| 2281 | actions = pft->actions; |
| 2282 | } |
| 2283 | ret = rte_flow_validate(port_id, attr, pattern, actions, &error); |
| 2284 | if (tunnel_ops->enabled) |
| 2285 | port_flow_tunnel_offload_cmd_release(port_id, tunnel_ops, pft); |
| 2286 | if (ret) |
| 2287 | return port_flow_complain(&error); |
| 2288 | printf("Flow rule validated\n"); |
| 2289 | return 0; |
| 2290 | } |
| 2291 | |
| 2292 | /** Return age action structure if exists, otherwise NULL. */ |
| 2293 | static struct rte_flow_action_age * |
no test coverage detected