patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@nvidia.com>
To: <viacheslavo@nvidia.com>, <dev@dpdk.org>, <rasland@nvidia.com>
Cc: <orika@nvidia.com>, <dsosnowski@nvidia.com>,
	<suanmingm@nvidia.com>, <matan@nvidia.com>, <thomas@monjalon.net>,
	Gregory Etelson <getelson@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH] net/mlx5: fix MPESW PF probe
Date: Mon, 5 Jan 2026 15:29:41 +0200	[thread overview]
Message-ID: <20260105132941.72705-1-bingz@nvidia.com> (raw)

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


             reply	other threads:[~2026-01-05 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 13:29 Bing Zhao [this message]
2026-01-06 13:15 ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260105132941.72705-1-bingz@nvidia.com \
    --to=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).