patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix MPESW PF probe
@ 2026-01-05 13:29 Bing Zhao
  2026-01-06 13:15 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2026-01-05 13:29 UTC (permalink / raw)
  To: viacheslavo, dev, rasland
  Cc: orika, dsosnowski, suanmingm, matan, thomas, Gregory Etelson, stable

From: Gregory Etelson <getelson@nvidia.com>

Current MPESW PF probe was designed for interfaces with up to 2 ports.

The patch can handle interfaces with any number of ports.

Fixes: 11c73de9ef63 ("net/mlx5: probe multi-port E-Switch device")
Cc: dsosnowski@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 47 +++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 7747b0c869..c93a7ac4f2 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -493,8 +493,9 @@ mlx5_representor_info_get(struct rte_eth_dev *dev,
 			  struct rte_eth_representor_info *info)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	int n_type = 5; /* Representor types: PF, VF, HPF@VF, SF and HPF@SF. */
-	int n_pf = 2; /* Number of PFs. */
+	/* Representor types: PF, VF, HPF@VF, SF and HPF@SF, total 5. */
+	int n_type = RTE_ETH_REPRESENTOR_PF + 2; /* Maximal type + 2 for HPFs. */
+	int n_pf = 8; /* Maximal number of PFs. */
 	int i = 0, pf;
 	int n_entries;
 
@@ -509,25 +510,29 @@ mlx5_representor_info_get(struct rte_eth_dev *dev,
 	info->pf = 0;
 	if (mlx5_is_port_on_mpesw_device(priv)) {
 		info->pf = priv->mpesw_port;
-		/* PF range, both ports will show the same information. */
-		info->ranges[i].type = RTE_ETH_REPRESENTOR_PF;
-		info->ranges[i].controller = 0;
-		info->ranges[i].pf = priv->mpesw_owner + 1;
-		info->ranges[i].vf = 0;
-		/*
-		 * The representor indexes should be the values set of "priv->mpesw_port".
-		 * In the real case now, only 1 PF/UPLINK representor is supported.
-		 * The port index will always be the value of "owner + 1".
-		 */
-		info->ranges[i].id_base =
-			MLX5_REPRESENTOR_ID(priv->mpesw_owner, info->ranges[i].type,
-					    info->ranges[i].pf);
-		info->ranges[i].id_end =
-			MLX5_REPRESENTOR_ID(priv->mpesw_owner, info->ranges[i].type,
-					    info->ranges[i].pf);
-		snprintf(info->ranges[i].name, sizeof(info->ranges[i].name),
-			 "pf%d", info->ranges[i].pf);
-		i++;
+		for (i = 0; i < n_pf; i++) {
+			/* PF range, both ports will show the same information. */
+			info->ranges[i].type = RTE_ETH_REPRESENTOR_PF;
+			info->ranges[i].controller = 0;
+			info->ranges[i].pf = priv->mpesw_owner + i + 1;
+			info->ranges[i].vf = 0;
+			/*
+			 * The representor indexes should be the values set of "priv->mpesw_port".
+			 * In the real case now, only 1 PF/UPLINK representor is supported.
+			 * The port index will always be the value of "owner + 1".
+			 */
+			info->ranges[i].id_base =
+				MLX5_REPRESENTOR_ID(priv->mpesw_owner,
+						    info->ranges[i].type,
+						    info->ranges[i].pf);
+			info->ranges[i].id_end =
+				MLX5_REPRESENTOR_ID(priv->mpesw_owner,
+						    info->ranges[i].type,
+						    info->ranges[i].pf);
+			snprintf(info->ranges[i].name,
+				 sizeof(info->ranges[i].name),
+				 "pf%d", info->ranges[i].pf);
+		}
 	} else if (priv->pf_bond >= 0)
 		info->pf = priv->pf_bond;
 	for (pf = 0; pf < n_pf; ++pf) {
-- 
2.34.1


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

* Re: [PATCH] net/mlx5: fix MPESW PF probe
  2026-01-05 13:29 [PATCH] net/mlx5: fix MPESW PF probe Bing Zhao
@ 2026-01-06 13:15 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2026-01-06 13:15 UTC (permalink / raw)
  To: Bing Zhao, viacheslavo, dev
  Cc: orika, dsosnowski, suanmingm, matan, thomas, Gregory Etelson, stable

Hi,


On 05/01/2026 3:29 PM, Bing Zhao wrote:
> From: Gregory Etelson <getelson@nvidia.com>
> 
> Current MPESW PF probe was designed for interfaces with up to 2 ports.
> 
> The patch can handle interfaces with any number of ports.
> 
> Fixes: 11c73de9ef63 ("net/mlx5: probe multi-port E-Switch device")
> Cc: dsosnowski@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Reviewed-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>

patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh


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

end of thread, other threads:[~2026-01-06 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-05 13:29 [PATCH] net/mlx5: fix MPESW PF probe Bing Zhao
2026-01-06 13:15 ` Raslan Darawsheh

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