patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 21.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode
@ 2022-03-12  7:58 Jiawei Wang
  2022-03-16 15:18 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawei Wang @ 2022-03-12  7:58 UTC (permalink / raw)
  To: ktraynor, viacheslavo, matan, orika, Yongseok Koh, Ori Kam
  Cc: stable, rasland

[ upstream commit 6d4f1066be6cd60a95f21ef07a16a3c3676c5cd9 ]

When E-Switch mode was enabled, the NIC egress flows was implicitly
appended with source vport to match on. If the metadata register C0
was used to maintain the source vport, it was initialized to zero
on packet steering engine entry, the flow could be hit only
if source vport was zero, the register C0 of the packet was not correct
to match in the TX side, this caused egress flow misses.

This patch:
 - removes the implicit source vport match for NIC egress flow.
 - rejects the NIC egress flows on the representor ports at validation.
 - allows the internal NIC egress flows containing the TX_QUEUE items in
   order to not impact hairpins.

Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/nics/mlx5.rst        |  2 ++
 drivers/net/mlx5/mlx5_flow_dv.c | 26 +++++++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index e3242a6bd4..8610ffb25a 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -508,6 +508,8 @@ Limitations
     from the reference "Clock Queue" completions,
     the scheduled send timestamps should not be specified with non-zero MSB.
 
+- The NIC egress flow rules on representor port are not supported.
+
 Statistics
 ----------
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1ed0ebb3d9..28843fe9e6 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7236,8 +7236,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 				return ret;
 			last_item = MLX5_FLOW_ITEM_TAG;
 			break;
-		case MLX5_RTE_FLOW_ITEM_TYPE_TAG:
 		case MLX5_RTE_FLOW_ITEM_TYPE_TX_QUEUE:
+			last_item = MLX5_FLOW_ITEM_TX_QUEUE;
+			break;
+		case MLX5_RTE_FLOW_ITEM_TYPE_TAG:
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTP:
 			ret = flow_dv_validate_item_gtp(dev, items, item_flags,
@@ -8071,6 +8073,18 @@ 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");
+	/*
+	 * Validation the NIC Egress flow on representor, except implicit
+	 * hairpin default egress flow with TX_QUEUE item, other flows not
+	 * work due to metadata regC0 mismatch.
+	 */
+	if ((!attr->transfer && attr->egress) && priv->representor &&
+	    !(item_flags & MLX5_FLOW_ITEM_TX_QUEUE))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM,
+					  NULL,
+					  "NIC egress rules on representors"
+					  " is not supported");
 	return 0;
 }
 
@@ -13648,12 +13662,14 @@ 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) &&
-	    (priv->representor || priv->master)) {
+	    (priv->representor || priv->master) &&
+	    !(attr->egress && !attr->transfer)) {
 		if (flow_dv_translate_item_port_id(dev, match_mask,
 						   match_value, NULL, attr))
 			return -rte_errno;
-- 
2.18.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 21.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode
  2022-03-12  7:58 [PATCH 21.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode Jiawei Wang
@ 2022-03-16 15:18 ` Kevin Traynor
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2022-03-16 15:18 UTC (permalink / raw)
  To: Jiawei Wang, viacheslavo, matan, orika, Yongseok Koh, Ori Kam
  Cc: stable, rasland

On 12/03/2022 07:58, Jiawei Wang wrote:
> [ upstream commit 6d4f1066be6cd60a95f21ef07a16a3c3676c5cd9 ]
> 
> When E-Switch mode was enabled, the NIC egress flows was implicitly
> appended with source vport to match on. If the metadata register C0
> was used to maintain the source vport, it was initialized to zero
> on packet steering engine entry, the flow could be hit only
> if source vport was zero, the register C0 of the packet was not correct
> to match in the TX side, this caused egress flow misses.
> 
> This patch:
>   - removes the implicit source vport match for NIC egress flow.
>   - rejects the NIC egress flows on the representor ports at validation.
>   - allows the internal NIC egress flows containing the TX_QUEUE items in
>     order to not impact hairpins.
> 
> Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
> ---

Thanks Jiawei. I have queued this [0] and will push to dpdk.org with the 
next batch of backports on Monday.

[0] 
https://github.com/kevintraynor/dpdk-stable/commit/82361afbedc11452986c141f97baa8867839b0c4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-16 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-12  7:58 [PATCH 21.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode Jiawei Wang
2022-03-16 15:18 ` Kevin Traynor

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).