net/mlx5: fix metadata sharing between E-Switch and VM

Message ID 20251123101242.1090544-1-getelson@nvidia.com (mailing list archive)
State New
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix metadata sharing between E-Switch and VM |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing pending Testing pending
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/aws-unit-testing success Unit Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-intel-Functional fail Functional Testing issues

Commit Message

Gregory Etelson Nov. 23, 2025, 10:12 a.m. UTC
If metadata sharing between E-Switch and VM (multi GVMI sharing) is
enabled, PMD creates the default metadata copy rule from register A
to register C_1 on Tx.
This rule should be created in group 0, but due to an incorrect
condition, it was created in group 1.
It prevented propagation of metadata from an application.

This patch fixes the condition by adding the missing check for
external rules, so egress group translation applies only to
application rules.

Fixes: a78425ba3793 ("net/mlx5: support flow metadata between E-Switch and VM")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index c41b99746f..5932b2cd96 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -5347,7 +5347,8 @@  __translate_group(struct rte_eth_dev *dev,
 						  NULL,
 						  "group index not supported");
 		*table_group = group + 1;
-	} else if (mlx5_vport_tx_metadata_passing_enabled(priv->sh) && flow_attr->egress) {
+	} else if (mlx5_vport_tx_metadata_passing_enabled(priv->sh) &&
+		   flow_attr->egress && external) {
 		/*
 		 * If VM cross GVMI metadata Tx was enabled, PMD creates a default
 		 * flow rule in the group 0 to copy metadata value.