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
This commit is contained in:

committed by
Damjan Marion

parent
07a0f212c4
commit
e8c9f4f1c0
@ -274,6 +274,11 @@ I: geneve
|
|||||||
M: N/A
|
M: N/A
|
||||||
F: src/vnet/geneve/
|
F: src/vnet/geneve/
|
||||||
|
|
||||||
|
VNET FLOW
|
||||||
|
I: flow
|
||||||
|
M: Damjan Marion <damarion@cisco.com>
|
||||||
|
F: src/vnet/flow/
|
||||||
|
|
||||||
Plugin - Access Control List (ACL) Based Forwarding
|
Plugin - Access Control List (ACL) Based Forwarding
|
||||||
I: abf
|
I: abf
|
||||||
M: Neale Ranns <nranns@cisco.com>
|
M: Neale Ranns <nranns@cisco.com>
|
||||||
|
@ -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_action_queue queue = { 0 };
|
||||||
struct rte_flow_item *item, *items = 0;
|
struct rte_flow_item *item, *items = 0;
|
||||||
struct rte_flow_action *action, *actions = 0;
|
struct rte_flow_action *action, *actions = 0;
|
||||||
|
bool fate = false;
|
||||||
|
|
||||||
enum
|
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;
|
item->type = RTE_FLOW_ITEM_TYPE_END;
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
vec_add2 (actions, action, 1);
|
/* Only one 'fate' can be assigned */
|
||||||
action->type = RTE_FLOW_ACTION_TYPE_PASSTHRU;
|
|
||||||
|
|
||||||
if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE)
|
if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE)
|
||||||
{
|
{
|
||||||
vec_add2 (actions, action, 1);
|
vec_add2 (actions, action, 1);
|
||||||
queue.index = f->redirect_queue;
|
queue.index = f->redirect_queue;
|
||||||
action->type = RTE_FLOW_ACTION_TYPE_QUEUE;
|
action->type = RTE_FLOW_ACTION_TYPE_QUEUE;
|
||||||
action->conf = &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)
|
if (f->actions & VNET_FLOW_ACTION_MARK)
|
||||||
|
@ -323,6 +323,11 @@ test_flow (vlib_main_t * vm, unformat_input_t * input,
|
|||||||
else if (unformat (line_input, "buffer-advance %d",
|
else if (unformat (line_input, "buffer-advance %d",
|
||||||
&flow.buffer_advance))
|
&flow.buffer_advance))
|
||||||
flow.actions |= VNET_FLOW_ACTION_BUFFER_ADVANCE;
|
flow.actions |= VNET_FLOW_ACTION_BUFFER_ADVANCE;
|
||||||
|
else if (unformat (line_input, "redirect-to-queue %d",
|
||||||
|
&flow.redirect_queue))
|
||||||
|
flow.actions |= VNET_FLOW_ACTION_REDIRECT_TO_QUEUE;
|
||||||
|
else if (unformat (line_input, "drop"))
|
||||||
|
flow.actions |= VNET_FLOW_ACTION_DROP;
|
||||||
else if (unformat (line_input, "%U", unformat_vnet_hw_interface, vnm,
|
else if (unformat (line_input, "%U", unformat_vnet_hw_interface, vnm,
|
||||||
&hw_if_index))
|
&hw_if_index))
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user