patch 'net/mlx5: fix isolated mode if no representor matching' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:25:11 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/11/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/0680a33bc76cc4d1e5a5835d1d491191feee9ecb

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 0680a33bc76cc4d1e5a5835d1d491191feee9ecb Mon Sep 17 00:00:00 2001
From: Dariusz Sosnowski <dsosnowski at nvidia.com>
Date: Sat, 25 Feb 2023 20:18:10 +0000
Subject: [PATCH] net/mlx5: fix isolated mode if no representor matching
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 042f52ddd71926afacc67209c02486e76ec12fb5 ]

In HW steering mode, when running on an E-Switch setup,
mlx5 PMD provides an ability to enable or disable
representor matching (through `repr_matching_en` device argument).
If representor matching is enabled, any ingress or egress flow rule,
created on any port representor will match traffic related
to that specific port.
If it is disabled, flow rule created on one of the ports,
will match traffic related to all ports.

As a result, when representor matching is disabled,
PMD cannot correctly create control flow rules for receiving
default traffic according to port configuration.
Since each port representor in the same switch domain,
can have different port configuration and flow rules
do not differentiate between ports, these flow rules cannot be
correctly applied.
In that case, each port works in de facto isolated mode.

This patch makes sure that if representor matching is disabled,
port is forced into isolated mode. Disabling flow isolated is forbidden.

Fixes: 483181f7b6dd ("net/mlx5: support device control of representor matching")

Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
Acked-by: Suanming Mou <suanmingm at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 doc/guides/nics/mlx5.rst         |  3 +++
 drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++++++++++
 drivers/net/mlx5/mlx5_flow.c     |  4 ++++
 3 files changed, 23 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 51f51259e3..75ac2f19b4 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -1121,6 +1121,9 @@ for an additional list of options shared with other mlx5 drivers.
   - 0. If representor matching is disabled, then there will be no implicit
     item added. As a result, ingress flow rules will match traffic
     coming to any port, not only the port on which flow rule is created.
+    Because of that, default flow rules for ingress traffic cannot be created
+    and port starts in isolated mode by default. Port cannot be switched back
+    to non-isolated mode.
 
   - 1. If representor matching is enabled (default setting),
     then each ingress pattern template has an implicit REPRESENTED_PORT
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index a71474c90a..2cce0a7f0f 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1613,6 +1613,22 @@ err_secondary:
 			err = EINVAL;
 			goto error;
 		}
+		/*
+		 * If representor matching is disabled, PMD cannot create default flow rules
+		 * to receive traffic for all ports, since implicit source port match is not added.
+		 * Isolated mode is forced.
+		 */
+		if (priv->sh->config.dv_esw_en && !priv->sh->config.repr_matching) {
+			err = mlx5_flow_isolate(eth_dev, 1, NULL);
+			if (err < 0) {
+				err = -err;
+				goto error;
+			}
+			DRV_LOG(WARNING, "port %u ingress traffic is restricted to defined "
+					 "flow rules (isolated mode) since representor "
+					 "matching is disabled",
+				eth_dev->data->port_id);
+		}
 		return eth_dev;
 #else
 		DRV_LOG(ERR, "DV support is missing for HWS.");
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 1768ec3cdb..fd57eafe3a 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -7972,6 +7972,10 @@ mlx5_flow_isolate(struct rte_eth_dev *dev,
 				   "port must be stopped first");
 		return -rte_errno;
 	}
+	if (!enable && !priv->sh->config.repr_matching)
+		return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+					  "isolated mode cannot be disabled when "
+					  "representor matching is disabled");
 	priv->isolated = !!enable;
 	if (enable)
 		dev->dev_ops = &mlx5_dev_ops_isolate;
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:41.916309700 +0800
+++ 0123-net-mlx5-fix-isolated-mode-if-no-representor-matchin.patch	2023-04-09 21:45:38.799042200 +0800
@@ -1 +1 @@
-From 042f52ddd71926afacc67209c02486e76ec12fb5 Mon Sep 17 00:00:00 2001
+From 0680a33bc76cc4d1e5a5835d1d491191feee9ecb Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 042f52ddd71926afacc67209c02486e76ec12fb5 ]
@@ -28 +30,0 @@
-Cc: stable at dpdk.org
@@ -41 +43 @@
-index ddb33d814c..7960a42e9c 100644
+index 51f51259e3..75ac2f19b4 100644
@@ -44 +46 @@
-@@ -1166,6 +1166,9 @@ for an additional list of options shared with other mlx5 drivers.
+@@ -1121,6 +1121,9 @@ for an additional list of options shared with other mlx5 drivers.
@@ -55 +57 @@
-index 569565c727..980234e2ac 100644
+index a71474c90a..2cce0a7f0f 100644
@@ -58 +60 @@
-@@ -1622,6 +1622,22 @@ err_secondary:
+@@ -1613,6 +1613,22 @@ err_secondary:
@@ -82 +84 @@
-index 2514b33332..19f7f92717 100644
+index 1768ec3cdb..fd57eafe3a 100644
@@ -85 +87 @@
-@@ -8395,6 +8395,10 @@ mlx5_flow_isolate(struct rte_eth_dev *dev,
+@@ -7972,6 +7972,10 @@ mlx5_flow_isolate(struct rte_eth_dev *dev,


More information about the stable mailing list