summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Zhang <yuwei1.zhang@intel.com>2019-04-10 20:05:46 +0800
committerDamjan Marion <dmarion@me.com>2019-04-16 14:11:32 +0000
commit2a24987bbaeb30801900a15a7216555b0d4b6e05 (patch)
treec2ec2c647d61c8b7d33d1e6e168aa6e8cb6910d5
parent1bde9f3a53ee7b978e56e2d27936dca1770b21ff (diff)
flow: add rte_flow check before creating by rte_flow_validate
Change-Id: Idfcf1644952d647c6e1b61216d9b365d58b77814 Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
-rw-r--r--src/plugins/dpdk/device/flow.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 63f04b8323d..3f9553105f8 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -209,6 +209,20 @@ 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)
+ {
+ 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);