Add direct packets to specific flow action in dpdk flow
Change-Id: I48cd8052f9509efdf13f64ab279edb66a2d4a0a9
Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 3f95531..1b8b590 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -41,6 +41,7 @@
struct rte_flow_item_udp udp[2] = { };
struct rte_flow_item_tcp tcp[2] = { };
struct rte_flow_action_mark mark = { 0 };
+ struct rte_flow_action_queue queue = { 0 };
struct rte_flow_item *item, *items = 0;
struct rte_flow_action *action, *actions = 0;
@@ -201,10 +202,21 @@
vec_add2 (actions, action, 1);
action->type = RTE_FLOW_ACTION_TYPE_PASSTHRU;
- vec_add2 (actions, action, 1);
- mark.id = fe->mark;
- action->type = RTE_FLOW_ACTION_TYPE_MARK;
- action->conf = &mark;
+ 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;
+ }
+
+ if (f->actions & VNET_FLOW_ACTION_MARK)
+ {
+ vec_add2 (actions, action, 1);
+ mark.id = fe->mark;
+ action->type = RTE_FLOW_ACTION_TYPE_MARK;
+ action->conf = &mark;
+ }
vec_add2 (actions, action, 1);
action->type = RTE_FLOW_ACTION_TYPE_END;
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index eaeda32..13dc7de 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -392,6 +392,7 @@
xd->port_type = port_type_from_speed_capa (&dev_info);
xd->supported_flow_actions = VNET_FLOW_ACTION_MARK |
VNET_FLOW_ACTION_REDIRECT_TO_NODE |
+ VNET_FLOW_ACTION_REDIRECT_TO_QUEUE |
VNET_FLOW_ACTION_BUFFER_ADVANCE |
VNET_FLOW_ACTION_COUNT | VNET_FLOW_ACTION_DROP;