From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shahaf Shuler Subject: Re: [PATCH] net/mlx5: fix ETH and VLAN items for E-Switch flows Date: Sun, 27 Jan 2019 11:19:41 +0000 Message-ID: References: <1548429450-27678-1-git-send-email-viacheslavo@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Slava Ovsiienko , "dev@dpdk.org" Return-path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30040.outbound.protection.outlook.com [40.107.3.40]) by dpdk.org (Postfix) with ESMTP id 69A23239 for ; Sun, 27 Jan 2019 12:19:43 +0100 (CET) In-Reply-To: <1548429450-27678-1-git-send-email-viacheslavo@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Slava, Friday, January 25, 2019 5:18 PM, Viacheslav Ovsiienko: > Subject: [dpdk-dev] [PATCH] net/mlx5: fix ETH and VLAN items for E-Switch > flows >=20 > This patch fixes two issues for E-Switch Flows >=20 > - RTE_FLOW_ITEM_TYPE_ETH and RTE_FLOW_ITEM_TYPE_VLAN with NULL > in spec field caused the asserts in debug version and segfault in release= , > fixed, now empty items are allowed and treated in correctl way >=20 > - empty RTE_FLOW_ITEM_TYPE_VLAN now sets the ethernet type to > ETH_P_802.1Q, in previous version empty VLAN item was ignored w/ Verbs, for example, having VLAN spec w/o a specific match on the VLAN ID= will make packets also w/o VLAN to match the flow. The reason is the way the kernel driver build the VLAN flow item for the de= vice. Have you verified we don't hit the same case w/ TC as well?=20 >=20 > Fixes: 3d14ad9be30e ("net/mlx5: support ethernet type for tunnels on E- > Switch") >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow_tcf.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c > b/drivers/net/mlx5/mlx5_flow_tcf.c > index b8204df..916d3a0 100644 > --- a/drivers/net/mlx5/mlx5_flow_tcf.c > +++ b/drivers/net/mlx5/mlx5_flow_tcf.c > @@ -2052,7 +2052,8 @@ struct pedit_parser { > mask.eth, > "no support for partial mask on" > " \"type\" field"); > - assert(items->spec); > + if (!items->spec) > + break; > spec.eth =3D items->spec; > if (mask.eth->type && > (item_flags & MLX5_FLOW_LAYER_TUNNEL) && > @@ -2123,7 +2124,8 @@ struct pedit_parser { > "outer eth_type conflict," > " must be 802.1Q"); > outer_etype =3D RTE_BE16(ETH_P_8021Q); > - assert(items->spec); > + if (!items->spec) > + break; > spec.vlan =3D items->spec; > if (mask.vlan->inner_type && > vlan_etype !=3D RTE_BE16(ETH_P_ALL) && @@ - > 2520,10 +2522,14 @@ struct pedit_parser { > case RTE_FLOW_ITEM_TYPE_PORT_ID: > break; > case RTE_FLOW_ITEM_TYPE_ETH: > + if (!items->spec) > + break; > size +=3D SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * > 4; > /* dst/src MAC addr and mask. */ > break; > case RTE_FLOW_ITEM_TYPE_VLAN: > + if (!items->spec) > + break; > size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + > /* VLAN Ether type. */ > SZ_NLATTR_TYPE_OF(uint8_t) + /* VLAN > prio. */ @@ -3319,6 +3325,8 @@ struct pedit_parser { > assert(mask.eth); > if (mask.eth =3D=3D &flow_tcf_mask_empty.eth) > break; > + if (!items->spec) > + break; > spec.eth =3D items->spec; > if (mask.eth->type) { > if (item_flags & > MLX5_FLOW_LAYER_TUNNEL) @@ -3363,12 +3371,13 @@ struct > pedit_parser { > sizeof(flow_tcf_mask_supported.vlan), > error); > assert(mask.vlan); > - if (mask.vlan =3D=3D &flow_tcf_mask_empty.vlan) > - break; > - spec.vlan =3D items->spec; > assert(outer_etype =3D=3D RTE_BE16(ETH_P_ALL) || > outer_etype =3D=3D RTE_BE16(ETH_P_8021Q)); > outer_etype =3D RTE_BE16(ETH_P_8021Q); > + if (mask.vlan =3D=3D &flow_tcf_mask_empty.vlan) > + break; > + assert(items->spec); > + spec.vlan =3D items->spec; > if (mask.vlan->inner_type) > vlan_etype =3D spec.vlan->inner_type; > if (mask.vlan->tci & RTE_BE16(0xe000)) > -- > 1.8.3.1