From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED6FAA0561 for ; Thu, 27 Feb 2020 18:39:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2B902C02; Thu, 27 Feb 2020 18:39:43 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 385AE1BFA9 for ; Thu, 27 Feb 2020 18:39:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582825181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OeT6YGsvSXeCo2Ph+WLsKjy9WRWn8tJS+YYuYEJ0cmM=; b=hrorJqf5tymEbJAH0o9vPqF0izKbo0i/4IEwAwKRbJSn/x/97cRhKopIN0+1MTGL5uVYZK XS73i1pZvz5cE+rc0icLWkGxqyVTmiB6P1RHJExQuISMhMXoAqgeYC6XXcOlYmagzKt3Uj dhk2uHyLpkSrpERpVxDwaKknhJ793ZI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-rOvHo8xXPkWSyh7tCVyIDA-1; Thu, 27 Feb 2020 12:39:36 -0500 X-MC-Unique: rOvHo8xXPkWSyh7tCVyIDA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 126F21005514; Thu, 27 Feb 2020 17:39:35 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECD7B8C089; Thu, 27 Feb 2020 17:39:27 +0000 (UTC) From: Kevin Traynor To: Dekel Peled Cc: Matan Azrad , Raslan Darawsheh , dpdk stable Date: Thu, 27 Feb 2020 17:38:06 +0000 Message-Id: <20200227173807.28004-15-ktraynor@redhat.com> In-Reply-To: <20200227173807.28004-1-ktraynor@redhat.com> References: <20200227173807.28004-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'net/mlx5: fix match on ethertype and CVLAN tag' has been queued to LTS release 18.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/02/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/b55eb609d7cb2a7c2d= d0951c9b341847252ef77f Thanks. Kevin. --- >From b55eb609d7cb2a7c2dd0951c9b341847252ef77f Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Thu, 20 Feb 2020 13:33:25 +0200 Subject: [PATCH] net/mlx5: fix match on ethertype and CVLAN tag [ upstream commit 797329d6c4a1d054a6fce38c960811cb7878283d ] HW supports match on one Ethertype, the Ethertype following the last VLAN tag of the packet (see PRM). Previous patch added specific handling for packets with VLAN tag, after setting match on Ethertype. This patch moves the handling of packets with VLAN tag, to be done before and instead of setting match on Ethertype. Previous patch also added, as part of specific handling for packets with VLAN tag, the setting of cvlan_tag mask bit in translation of L3 items. In case of L3 tunnel there is no inner L2 header, so setting this mask bit is wrong and causes match failures. This patch adds check to make sure L2 header exists before setting cvlan_tag mask bit for L3 items. Fixes: 00f75a40576b ("net/mlx5: fix VLAN match for DV mode") Signed-off-by: Dekel Peled Acked-by: Matan Azrad Tested-by: Raslan Darawsheh --- drivers/net/mlx5/mlx5_flow_dv.c | 44 ++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_d= v.c index bc24c7cd56..18b37b7f6e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1185,8 +1185,4 @@ flow_dv_translate_item_eth(void *matcher, void *key, =09for (i =3D 0; i < sizeof(eth_m->dst); ++i) =09=09l24_v[i] =3D eth_m->src.addr_bytes[i] & eth_v->src.addr_bytes[i]; -=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, ethertype, -=09=09 rte_be_to_cpu_16(eth_m->type)); -=09l24_v =3D MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, ethertype); -=09*(uint16_t *)(l24_v) =3D eth_m->type & eth_v->type; =09if (eth_v->type) { =09=09/* When ethertype is present set mask for tagged VLAN. */ @@ -1194,8 +1190,20 @@ flow_dv_translate_item_eth(void *matcher, void *key, =09=09/* Set value for tagged VLAN if ethertype is 802.1Q. */ =09=09if (eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_VLAN) || -=09=09 eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_QINQ)) +=09=09 eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_QINQ)) { =09=09=09MLX5_SET(fte_match_set_lyr_2_4, headers_v, cvlan_tag, =09=09=09=09 1); +=09=09=09/* Return here to avoid setting match on ethertype. */ +=09=09=09return; +=09=09} =09} +=09/* +=09 * HW supports match on one Ethertype, the Ethertype following the last +=09 * VLAN tag of the packet (see PRM). +=09 * Set match on ethertype only if ETH header is not followed by VLAN. +=09 */ +=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, ethertype, +=09=09 rte_be_to_cpu_16(eth_m->type)); +=09l24_v =3D MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, ethertype); +=09*(uint16_t *)(l24_v) =3D eth_m->type & eth_v->type; } =20 @@ -1262,4 +1270,6 @@ flow_dv_translate_item_vlan(void *matcher, void *key, * @param[in] item * Flow pattern to translate. + * @param[in] item_flags + * Bit-fields that holds the items detected until now. * @param[in] inner * Item is inner pattern. @@ -1268,4 +1278,5 @@ static void flow_dv_translate_item_ipv4(void *matcher, void *key, =09=09=09 const struct rte_flow_item *item, +=09=09=09 const uint64_t item_flags, =09=09=09 int inner) { @@ -1324,5 +1335,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *key= , =09MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, =09=09 ipv4_v->hdr.next_proto_id & ipv4_m->hdr.next_proto_id); -=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1); +=09/* +=09 * On outer header (which must contains L2), or inner header with L2, +=09 * set cvlan_tag mask bit to mark this packet as untagged. +=09 */ +=09if (!inner || item_flags & MLX5_FLOW_LAYER_INNER_L2) +=09=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1); } =20 @@ -1336,4 +1352,6 @@ flow_dv_translate_item_ipv4(void *matcher, void *key, * @param[in] item * Flow pattern to translate. + * @param[in] item_flags + * Bit-fields that holds the items detected until now. * @param[in] inner * Item is inner pattern. @@ -1342,4 +1360,5 @@ static void flow_dv_translate_item_ipv6(void *matcher, void *key, =09=09=09 const struct rte_flow_item *item, +=09=09=09 const uint64_t item_flags, =09=09=09 int inner) { @@ -1424,5 +1443,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *key= , =09MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, =09=09 ipv6_v->hdr.proto & ipv6_m->hdr.proto); -=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1); +=09/* +=09 * On outer header (which must contains L2), or inner header with L2, +=09 * set cvlan_tag mask bit to mark this packet as untagged. +=09 */ +=09if (!inner || item_flags & MLX5_FLOW_LAYER_INNER_L2) +=09=09MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1); } =20 @@ -2170,5 +2194,6 @@ flow_dv_translate(struct rte_eth_dev *dev, =09=09case RTE_FLOW_ITEM_TYPE_IPV4: =09=09=09flow_dv_translate_item_ipv4(match_mask, match_value, -=09=09=09=09=09=09 items, tunnel); +=09=09=09=09=09=09 items, item_flags, +=09=09=09=09=09=09 tunnel); =09=09=09matcher.priority =3D MLX5_PRIORITY_MAP_L3; =09=09=09dev_flow->dv.hash_fields |=3D @@ -2182,5 +2207,6 @@ flow_dv_translate(struct rte_eth_dev *dev, =09=09case RTE_FLOW_ITEM_TYPE_IPV6: =09=09=09flow_dv_translate_item_ipv6(match_mask, match_value, -=09=09=09=09=09=09 items, tunnel); +=09=09=09=09=09=09 items, item_flags, +=09=09=09=09=09=09 tunnel); =09=09=09matcher.priority =3D MLX5_PRIORITY_MAP_L3; =09=09=09dev_flow->dv.hash_fields |=3D --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-27 17:26:24.609380356 +0000 +++ 0015-net-mlx5-fix-match-on-ethertype-and-CVLAN-tag.patch=092020-02-27 1= 7:26:23.689830288 +0000 @@ -1 +1 @@ -From 797329d6c4a1d054a6fce38c960811cb7878283d Mon Sep 17 00:00:00 2001 +From b55eb609d7cb2a7c2dd0951c9b341847252ef77f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 797329d6c4a1d054a6fce38c960811cb7878283d ] + @@ -24 +25,0 @@ -Cc: stable@dpdk.org @@ -30,2 +31,2 @@ - drivers/net/mlx5/mlx5_flow_dv.c | 42 ++++++++++++++++++++++++++------- - 1 file changed, 33 insertions(+), 9 deletions(-) + drivers/net/mlx5/mlx5_flow_dv.c | 44 ++++++++++++++++++++++++++------- + 1 file changed, 35 insertions(+), 9 deletions(-) @@ -34 +35 @@ -index 3c6d90e349..06592b5340 100644 +index bc24c7cd56..18b37b7f6e 100644 @@ -37 +38 @@ -@@ -5307,8 +5307,4 @@ flow_dv_translate_item_eth(void *matcher, void *key, +@@ -1185,8 +1185,4 @@ flow_dv_translate_item_eth(void *matcher, void *key, @@ -46 +47 @@ -@@ -5316,8 +5312,20 @@ flow_dv_translate_item_eth(void *matcher, void *key= , +@@ -1194,8 +1190,20 @@ flow_dv_translate_item_eth(void *matcher, void *key= , @@ -48,3 +49,3 @@ - =09=09if (eth_v->type =3D=3D RTE_BE16(RTE_ETHER_TYPE_VLAN) || --=09=09 eth_v->type =3D=3D RTE_BE16(RTE_ETHER_TYPE_QINQ)) -+=09=09 eth_v->type =3D=3D RTE_BE16(RTE_ETHER_TYPE_QINQ)) { + =09=09if (eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_VLAN) || +-=09=09 eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_QINQ)) ++=09=09 eth_v->type =3D=3D RTE_BE16(ETHER_TYPE_QINQ)) { @@ -68 +69 @@ -@@ -5393,4 +5401,6 @@ flow_dv_translate_item_vlan(struct mlx5_flow *dev_fl= ow, +@@ -1262,4 +1270,6 @@ flow_dv_translate_item_vlan(void *matcher, void *key= , @@ -75 +76 @@ -@@ -5401,4 +5411,5 @@ static void +@@ -1268,4 +1278,5 @@ static void @@ -79 +80 @@ - =09=09=09 int inner, uint32_t group) + =09=09=09 int inner) @@ -81 +82 @@ -@@ -5460,5 +5471,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *ke= y, +@@ -1324,5 +1335,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *ke= y, @@ -93 +94 @@ -@@ -5472,4 +5488,6 @@ flow_dv_translate_item_ipv4(void *matcher, void *key= , +@@ -1336,4 +1352,6 @@ flow_dv_translate_item_ipv4(void *matcher, void *key= , @@ -100 +101 @@ -@@ -5480,4 +5498,5 @@ static void +@@ -1342,4 +1360,5 @@ static void @@ -104 +105 @@ - =09=09=09 int inner, uint32_t group) + =09=09=09 int inner) @@ -106 +107 @@ -@@ -5565,5 +5584,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *ke= y, +@@ -1424,5 +1443,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *ke= y, @@ -118,2 +119,2 @@ -@@ -7672,5 +7696,5 @@ cnt_err: - =09=09=09=09=09=09 &item_flags, &tunnel); +@@ -2170,5 +2194,6 @@ flow_dv_translate(struct rte_eth_dev *dev, + =09=09case RTE_FLOW_ITEM_TYPE_IPV4: @@ -121,3 +122,3 @@ --=09=09=09=09=09=09 items, tunnel, -+=09=09=09=09=09=09 items, item_flags, tunnel, - =09=09=09=09=09=09 dev_flow->group); +-=09=09=09=09=09=09 items, tunnel); ++=09=09=09=09=09=09 items, item_flags, ++=09=09=09=09=09=09 tunnel); @@ -125,2 +126,3 @@ -@@ -7695,5 +7719,5 @@ cnt_err: - =09=09=09=09=09=09 &item_flags, &tunnel); + =09=09=09dev_flow->dv.hash_fields |=3D +@@ -2182,5 +2207,6 @@ flow_dv_translate(struct rte_eth_dev *dev, + =09=09case RTE_FLOW_ITEM_TYPE_IPV6: @@ -128,3 +130,3 @@ --=09=09=09=09=09=09 items, tunnel, -+=09=09=09=09=09=09 items, item_flags, tunnel, - =09=09=09=09=09=09 dev_flow->group); +-=09=09=09=09=09=09 items, tunnel); ++=09=09=09=09=09=09 items, item_flags, ++=09=09=09=09=09=09 tunnel); @@ -131,0 +134 @@ + =09=09=09dev_flow->dv.hash_fields |=3D