summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2019-10-15 20:36:16 +0800
committerDamjan Marion <dmarion@me.com>2019-10-16 18:34:51 +0000
commite8c9f4f1c07f41986c50a744eee8ed4897178fda (patch)
treecaedaaa216d833d559c6b0ec3bb4ac0a3042e53b /src/plugins/dpdk
parent07a0f212c4fed965928c311227067add8e39dc91 (diff)
flow: Add 'drop' and 'redirect-to-queue' actions support
Type: feature Add 'drop' and 'redirect-to-queue' support in 'test-flow' command and DPDK plugin Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: I567bb77cb401c9bd1309ecabe802fe9de88c746b
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r--src/plugins/dpdk/device/flow.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 1b8b5906b1c..cea96fd82b2 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -44,6 +44,7 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
struct rte_flow_action_queue queue = { 0 };
struct rte_flow_item *item, *items = 0;
struct rte_flow_action *action, *actions = 0;
+ bool fate = false;
enum
{
@@ -199,15 +200,31 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
item->type = RTE_FLOW_ITEM_TYPE_END;
/* Actions */
- vec_add2 (actions, action, 1);
- action->type = RTE_FLOW_ACTION_TYPE_PASSTHRU;
-
+ /* Only one 'fate' can be assigned */
if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE)
{
vec_add2 (actions, action, 1);
queue.index = f->redirect_queue;
action->type = RTE_FLOW_ACTION_TYPE_QUEUE;
action->conf = &queue;
+ fate = true;
+ }
+ if (f->actions & VNET_FLOW_ACTION_DROP)
+ {
+ vec_add2 (actions, action, 1);
+ action->type = RTE_FLOW_ACTION_TYPE_DROP;
+ if (fate == true)
+ {
+ rv = VNET_FLOW_ERROR_INTERNAL;
+ goto done;
+ }
+ else
+ fate = true;
+ }
+ if (fate == false)
+ {
+ vec_add2 (actions, action, 1);
+ action->type = RTE_FLOW_ACTION_TYPE_PASSTHRU;
}
if (f->actions & VNET_FLOW_ACTION_MARK)