[v2] net/mlx5: fix the NIC egress flow mismatch in switchdev mode

Message ID 20211105085910.40212-1-jiaweiw@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series [v2] net/mlx5: fix the NIC egress flow mismatch in switchdev mode |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Jiawei Wang Nov. 5, 2021, 8:59 a.m. UTC
  When E-Switch mode was enabled, the NIC egress flows always added the
source vport in the matcher item, then cause the flows cannot be hit.
This commit fixes the issue that removes the source vport as matcher for
NIC egress flow.
Also adding the validation that rejects the NIC egress flows on the
representor ports.

Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: fix one typo
---
 doc/guides/nics/mlx5.rst        |  2 ++
 drivers/net/mlx5/mlx5_flow_dv.c | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
  

Comments

Raslan Darawsheh Nov. 11, 2021, 12:59 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Sent: Friday, November 5, 2021 10:59 AM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Ori Kam <orika@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Yongseok Koh <yskoh@mellanox.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in switchdev
> mode
> 
> When E-Switch mode was enabled, the NIC egress flows always added the
> source vport in the matcher item, then cause the flows cannot be hit.
> This commit fixes the issue that removes the source vport as matcher for
> NIC egress flow.
> Also adding the validation that rejects the NIC egress flows on the
> representor ports.
> 
> Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")
> Cc: stable@dpdk.org

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  
Jiawei Wang Nov. 11, 2021, 1:17 p.m. UTC | #2
Hello Raslan,

I need send the new  V3 patch for this change, Sorry for the late update.

Thanks.
B.R.
Jonny

> -----Original Message-----
> From: Raslan Darawsheh <rasland@nvidia.com>
> Sent: Thursday, November 11, 2021 9:00 PM
> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Ori Kam <orika@nvidia.com>; Yongseok Koh
> <yskoh@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in
> switchdev mode
> 
> Hi,
> 
> > -----Original Message-----
> > From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> > Sent: Friday, November 5, 2021 10:59 AM
> > To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> > <matan@nvidia.com>; Ori Kam <orika@nvidia.com>; Ori Kam
> > <orika@nvidia.com>; Yongseok Koh <yskoh@mellanox.com>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> > stable@dpdk.org
> > Subject: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in
> > switchdev mode
> >
> > When E-Switch mode was enabled, the NIC egress flows always added the
> > source vport in the matcher item, then cause the flows cannot be hit.
> > This commit fixes the issue that removes the source vport as matcher
> > for NIC egress flow.
> > Also adding the validation that rejects the NIC egress flows on the
> > representor ports.
> >
> > Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")
> > Cc: stable@dpdk.org
> 
> Patch applied to next-net-mlx,
> 
> Kindest regards,
> Raslan Darawsheh
  
Raslan Darawsheh Nov. 11, 2021, 1:19 p.m. UTC | #3
> -----Original Message-----
> From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Sent: Thursday, November 11, 2021 3:18 PM
> To: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Ori Kam <orika@nvidia.com>; Yongseok Koh
> <yskoh@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in
> switchdev mode
> 
> Hello Raslan,
> 
> I need send the new  V3 patch for this change, Sorry for the late update.
> 
Sure, dropping this version for now, waiting for the updated version.

Kindest regards,
Raslan Darawsheh
> Thanks.
> B.R.
> Jonny
> 
> > -----Original Message-----
> > From: Raslan Darawsheh <rasland@nvidia.com>
> > Sent: Thursday, November 11, 2021 9:00 PM
> > To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> > <orika@nvidia.com>; Ori Kam <orika@nvidia.com>; Yongseok Koh
> > <yskoh@mellanox.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in
> > switchdev mode
> >
> > Hi,
> >
> > > -----Original Message-----
> > > From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> > > Sent: Friday, November 5, 2021 10:59 AM
> > > To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> > > <matan@nvidia.com>; Ori Kam <orika@nvidia.com>; Ori Kam
> > > <orika@nvidia.com>; Yongseok Koh <yskoh@mellanox.com>
> > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> > > stable@dpdk.org
> > > Subject: [PATCH v2] net/mlx5: fix the NIC egress flow mismatch in
> > > switchdev mode
> > >
> > > When E-Switch mode was enabled, the NIC egress flows always added
> > > the source vport in the matcher item, then cause the flows cannot be hit.
> > > This commit fixes the issue that removes the source vport as matcher
> > > for NIC egress flow.
> > > Also adding the validation that rejects the NIC egress flows on the
> > > representor ports.
> > >
> > > Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port
> > > item")
> > > Cc: stable@dpdk.org
> >
> > Patch applied to next-net-mlx,
> >
> > Kindest regards,
> > Raslan Darawsheh
  

Patch

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 006896375f..0099128c98 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -479,6 +479,8 @@  Limitations
 
   - Needs OFED 5.4+.
 
+- The NIC Egress flow on representor port is not supported.
+
 Statistics
 ----------
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 842ada2ea9..58eb39d45f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7992,6 +7992,12 @@  flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 				"sample before modify action is not supported");
+	if ((!attr->transfer && attr->egress) && priv->representor)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM,
+					  NULL,
+					  "NIC egress rules on representors"
+					  " is not supported");
 	return 0;
 }
 
@@ -13556,11 +13562,13 @@  flow_dv_translate(struct rte_eth_dev *dev,
 	/*
 	 * When E-Switch mode is enabled, we have two cases where we need to
 	 * set the source port manually.
-	 * The first one, is in case of Nic steering rule, and the second is
-	 * E-Switch rule where no port_id item was found. In both cases
-	 * the source port is set according the current port in use.
+	 * The first one, is in case of NIC ingress steering rule, and the
+	 * second is E-Switch rule where no port_id item was found.
+	 * In both cases the source port is set according the current port
+	 * in use.
 	 */
 	if (!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
+	    !(attr->egress && !attr->transfer) &&
 	    (priv->representor || priv->master)) {
 		if (flow_dv_translate_item_port_id(dev, match_mask,
 						   match_value, NULL, attr))