diff options
author | Simon Zhang <yuwei1.zhang@intel.com> | 2019-03-28 16:38:49 +0800 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-05-17 12:57:27 +0000 |
commit | 84a53bc5fed2b0343a672e62b4790d5e5c1e1430 (patch) | |
tree | d136e63e288d589a71f6da4cf15d6916bcfe3796 /src | |
parent | cfd30860fb1db3add1a2548d758eb72362416bbc (diff) |
Add rte_flow_validate to verify the flow before calling rte_flow_create.
Change-Id: I817580963e38bafcc53cc6502b9c58f567070244
Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/dpdk/device/flow.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c index 63f04b8323d..fe52bcb5ac8 100644 --- a/src/plugins/dpdk/device/flow.c +++ b/src/plugins/dpdk/device/flow.c @@ -209,12 +209,23 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe) vec_add2 (actions, action, 1); action->type = RTE_FLOW_ACTION_TYPE_END; + rv = rte_flow_validate (xd->device_index, &ingress, items, actions, + &xd->last_flow_error); + if (rv != 0) + { + if (rv == -EINVAL) + rv = VNET_FLOW_ERROR_NOT_SUPPORTED; + else if (rv == -EEXIST) + rv = VNET_FLOW_ERROR_ALREADY_EXISTS; + else + rv = VNET_FLOW_ERROR_INTERNAL; + + goto done; + } + fe->handle = rte_flow_create (xd->device_index, &ingress, items, actions, &xd->last_flow_error); - if (!fe->handle) - rv = VNET_FLOW_ERROR_NOT_SUPPORTED; - done: vec_free (items); vec_free (actions); |