flow: fix several crash issues

Type: fix

This patch fixes crash issues(marked in brackets) in the below test cases

test flow enable index 0 1/1 -> [crash]
test flow disable index 0 1/1 -> [crash]

test flow add src-ip 192.168.8.8 proto udp redirect-to-queue 8
test flow enable index 0 1/1
test flow disable index 0 1/1 - [crash]

test flow add src-ip 192.168.8.8 proto udp redirect-to-queue 8
test flow enable index 0 1/1
test flow enable index 0 1/2
test flow del index 0 -> [crash]

Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Change-Id: I84bc6faa3d93a2cab4c82e8a876a8b1067257b62
(cherry picked from commit be2ad0b4743ed8a3875a5b6039c10c66eb07614c)
This commit is contained in:
Chenmin Sun
2019-11-22 05:33:40 +08:00
committed by Andrew Yourtchenko
parent cd3a7c9646
commit cb3edd53e8
3 changed files with 11 additions and 2 deletions

View File

@ -275,6 +275,11 @@ I: syslog
M: Matus Fabian <matfabia@cisco.com>
F: src/vnet/syslog
VNET FLOW
I: flow
M: Damjan Marion <damarion@cisco.com>
F: src/vnet/flow/
Plugin - Access Control List (ACL) Based Forwarding
I: abf
M: Neale Ranns <nranns@cisco.com>

View File

@ -272,8 +272,6 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
if (op == VNET_FLOW_DEV_OP_DEL_FLOW)
{
ASSERT (*private_data >= vec_len (xd->flow_entries));
fe = vec_elt_at_index (xd->flow_entries, *private_data);
if ((rv = rte_flow_destroy (xd->device_index, fe->handle,

View File

@ -96,6 +96,9 @@ vnet_flow_enable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index)
uword private_data;
int rv;
if (f == 0)
return VNET_FLOW_ERROR_NO_SUCH_ENTRY;
if (!vnet_hw_interface_is_valid (vnm, hw_if_index))
return VNET_FLOW_ERROR_NO_SUCH_INTERFACE;
@ -137,6 +140,9 @@ vnet_flow_disable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index)
uword *p;
int rv;
if (f == 0)
return VNET_FLOW_ERROR_NO_SUCH_ENTRY;
if (!vnet_hw_interface_is_valid (vnm, hw_if_index))
return VNET_FLOW_ERROR_NO_SUCH_INTERFACE;