patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Dekel Peled <dekelp@mellanox.com>
Cc: Matan Azrad <matan@mellanox.com>,
	Raslan Darawsheh <rasland@mellanox.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/mlx5: fix match on ethertype and CVLAN tag' has been queued to LTS release 18.11.7
Date: Thu, 27 Feb 2020 17:38:06 +0000	[thread overview]
Message-ID: <20200227173807.28004-15-ktraynor@redhat.com> (raw)
In-Reply-To: <20200227173807.28004-1-ktraynor@redhat.com>

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 rebasing
(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/b55eb609d7cb2a7c2dd0951c9b341847252ef77f

Thanks.

Kevin.

---
From b55eb609d7cb2a7c2dd0951c9b341847252ef77f Mon Sep 17 00:00:00 2001
From: Dekel Peled <dekelp@mellanox.com>
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 <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
---
 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_dv.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,
 	for (i = 0; i < sizeof(eth_m->dst); ++i)
 		l24_v[i] = eth_m->src.addr_bytes[i] & eth_v->src.addr_bytes[i];
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ethertype,
-		 rte_be_to_cpu_16(eth_m->type));
-	l24_v = MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, ethertype);
-	*(uint16_t *)(l24_v) = eth_m->type & eth_v->type;
 	if (eth_v->type) {
 		/* When ethertype is present set mask for tagged VLAN. */
@@ -1194,8 +1190,20 @@ flow_dv_translate_item_eth(void *matcher, void *key,
 		/* Set value for tagged VLAN if ethertype is 802.1Q. */
 		if (eth_v->type == RTE_BE16(ETHER_TYPE_VLAN) ||
-		    eth_v->type == RTE_BE16(ETHER_TYPE_QINQ))
+		    eth_v->type == RTE_BE16(ETHER_TYPE_QINQ)) {
 			MLX5_SET(fte_match_set_lyr_2_4, headers_v, cvlan_tag,
 				 1);
+			/* Return here to avoid setting match on ethertype. */
+			return;
+		}
 	}
+	/*
+	 * HW supports match on one Ethertype, the Ethertype following the last
+	 * VLAN tag of the packet (see PRM).
+	 * Set match on ethertype only if ETH header is not followed by VLAN.
+	 */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ethertype,
+		 rte_be_to_cpu_16(eth_m->type));
+	l24_v = MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, ethertype);
+	*(uint16_t *)(l24_v) = eth_m->type & eth_v->type;
 }
 
@@ -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,
 			    const struct rte_flow_item *item,
+			    const uint64_t item_flags,
 			    int inner)
 {
@@ -1324,5 +1335,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *key,
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
 		 ipv4_v->hdr.next_proto_id & ipv4_m->hdr.next_proto_id);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1);
+	/*
+	 * On outer header (which must contains L2), or inner header with L2,
+	 * set cvlan_tag mask bit to mark this packet as untagged.
+	 */
+	if (!inner || item_flags & MLX5_FLOW_LAYER_INNER_L2)
+		MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1);
 }
 
@@ -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,
 			    const struct rte_flow_item *item,
+			    const uint64_t item_flags,
 			    int inner)
 {
@@ -1424,5 +1443,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *key,
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
 		 ipv6_v->hdr.proto & ipv6_m->hdr.proto);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1);
+	/*
+	 * On outer header (which must contains L2), or inner header with L2,
+	 * set cvlan_tag mask bit to mark this packet as untagged.
+	 */
+	if (!inner || item_flags & MLX5_FLOW_LAYER_INNER_L2)
+		MLX5_SET(fte_match_set_lyr_2_4, headers_m, cvlan_tag, 1);
 }
 
@@ -2170,5 +2194,6 @@ flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			flow_dv_translate_item_ipv4(match_mask, match_value,
-						    items, tunnel);
+						    items, item_flags,
+						    tunnel);
 			matcher.priority = MLX5_PRIORITY_MAP_L3;
 			dev_flow->dv.hash_fields |=
@@ -2182,5 +2207,6 @@ flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			flow_dv_translate_item_ipv6(match_mask, match_value,
-						    items, tunnel);
+						    items, item_flags,
+						    tunnel);
 			matcher.priority = MLX5_PRIORITY_MAP_L3;
 			dev_flow->dv.hash_fields |=
-- 
2.21.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-27 17:26:24.609380356 +0000
+++ 0015-net-mlx5-fix-match-on-ethertype-and-CVLAN-tag.patch	2020-02-27 17: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 @@
- 		if (eth_v->type == RTE_BE16(RTE_ETHER_TYPE_VLAN) ||
--		    eth_v->type == RTE_BE16(RTE_ETHER_TYPE_QINQ))
-+		    eth_v->type == RTE_BE16(RTE_ETHER_TYPE_QINQ)) {
+ 		if (eth_v->type == RTE_BE16(ETHER_TYPE_VLAN) ||
+-		    eth_v->type == RTE_BE16(ETHER_TYPE_QINQ))
++		    eth_v->type == RTE_BE16(ETHER_TYPE_QINQ)) {
@@ -68 +69 @@
-@@ -5393,4 +5401,6 @@ flow_dv_translate_item_vlan(struct mlx5_flow *dev_flow,
+@@ -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 @@
- 			    int inner, uint32_t group)
+ 			    int inner)
@@ -81 +82 @@
-@@ -5460,5 +5471,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *key,
+@@ -1324,5 +1335,10 @@ flow_dv_translate_item_ipv4(void *matcher, void *key,
@@ -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 @@
- 			    int inner, uint32_t group)
+ 			    int inner)
@@ -106 +107 @@
-@@ -5565,5 +5584,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *key,
+@@ -1424,5 +1443,10 @@ flow_dv_translate_item_ipv6(void *matcher, void *key,
@@ -118,2 +119,2 @@
-@@ -7672,5 +7696,5 @@ cnt_err:
- 						  &item_flags, &tunnel);
+@@ -2170,5 +2194,6 @@ flow_dv_translate(struct rte_eth_dev *dev,
+ 		case RTE_FLOW_ITEM_TYPE_IPV4:
@@ -121,3 +122,3 @@
--						    items, tunnel,
-+						    items, item_flags, tunnel,
- 						    dev_flow->group);
+-						    items, tunnel);
++						    items, item_flags,
++						    tunnel);
@@ -125,2 +126,3 @@
-@@ -7695,5 +7719,5 @@ cnt_err:
- 						  &item_flags, &tunnel);
+ 			dev_flow->dv.hash_fields |=
+@@ -2182,5 +2207,6 @@ flow_dv_translate(struct rte_eth_dev *dev,
+ 		case RTE_FLOW_ITEM_TYPE_IPV6:
@@ -128,3 +130,3 @@
--						    items, tunnel,
-+						    items, item_flags, tunnel,
- 						    dev_flow->group);
+-						    items, tunnel);
++						    items, item_flags,
++						    tunnel);
@@ -131,0 +134 @@
+ 			dev_flow->dv.hash_fields |=


  parent reply	other threads:[~2020-02-27 17:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 17:37 [dpdk-stable] patch 'examples/fips_validation: fix AES-GCM cipher length parsing' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'examples/fips_validation: fix string token for CT length' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/qede: fix VF reload' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/qede: do not stop vport if not started' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/ixgbe: check for illegal Tx packets' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/mlx5: fix tunnel flow priority' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/ixgbe: fix flow control mode setting' " Kevin Traynor
2020-02-27 17:37 ` [dpdk-stable] patch 'net/vhost: allocate interface name from heap' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'net/vhost: fix probing in secondary process' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'net/mlx5: fix L3 VXLAN RSS expansion' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'net/sfc: fix log format specifiers' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'net/fm10k: fix non-x86 build' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'examples/tep_term: remove redundant info get' " Kevin Traynor
2020-02-27 17:38 ` [dpdk-stable] patch 'app/testpmd: fix identifier size for port attach' " Kevin Traynor
2020-02-27 17:38 ` Kevin Traynor [this message]
2020-02-27 17:38 ` [dpdk-stable] patch 'doc: fix multi-producer enqueue figure in ring guide' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200227173807.28004-15-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dekelp@mellanox.com \
    --cc=matan@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).