All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-af: Fix limiting SRIOV VF count logic
@ 2026-08-21  6:45 nshettyj
  2026-08-21  9:21 ` Breno Leitao
  0 siblings, 1 reply; 2+ messages in thread
From: nshettyj @ 2026-08-21  6:45 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Sunil Goutham, Nitin Shetty J, Ratheesh Kannoth, Geetha sowjanya,
	Subbaraya Sundeep, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Tomasz Duszynski

From: Sunil Goutham <sgoutham@marvell.com>

When RVU PF0/AF's VFs are SDP instead of LBK, limiting the VF count
based on the LBK channel count is incorrect.

Apply LBK channel-based VF limits only when the VF device ID matches
the LBK RVU AFVF device.

Fixes: 9bd6caf33567 ("octeontx2-af: Enable sriov on AF to create VFs")
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Nitin Shetty J <nshettyj@marvell.com>
---
 .../net/ethernet/marvell/octeontx2/af/rvu.c   | 31 ++++++++++---------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index ffba56ee8a60..67a7766f000b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -3463,6 +3463,8 @@ int rvu_get_num_lbk_chans(void)
 	return ret;
 }
 
+#define PCI_DEVID_OCTEONTX2_RVU_AFVF	0xA0F8
+
 static int rvu_enable_sriov(struct rvu *rvu)
 {
 	struct pci_dev *pdev = rvu->pdev;
@@ -3481,24 +3483,25 @@ static int rvu_enable_sriov(struct rvu *rvu)
 		return 0;
 	pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, &rvu->vf_devid);
 
-	chans = rvu_get_num_lbk_chans();
-	if (chans < 0)
-		return chans;
-
 	vfs = pci_sriov_get_totalvfs(pdev);
-
-	/* Limit VFs in case we have more VFs than LBK channels available. */
-	if (vfs > chans)
-		vfs = chans;
-
 	if (!vfs)
 		return 0;
 
-	/* LBK channel number 63 is used for switching packets between
-	 * CGX mapped VFs. Hence limit LBK pairs till 62 only.
-	 */
-	if (vfs > 62)
-		vfs = 62;
+	if (rvu->vf_devid == PCI_DEVID_OCTEONTX2_RVU_AFVF) {
+		chans = rvu_get_num_lbk_chans();
+		if (chans < 0)
+			return chans;
+
+		/* Limit VFs in case VFs are more than LBK channels available */
+		if (vfs > chans)
+			vfs = chans;
+
+		/* LBK channel number 63 is used for switching packets between
+		 * CGX mapped VFs. Hence limit LBK pairs.
+		 */
+		if (vfs > (chans - 2))
+			vfs = chans - 2;
+	}
 
 	/* Save VFs number for reference in VF interrupts handlers.
 	 * Since interrupts might start arriving during SRIOV enablement
-- 
2.48.1


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

* Re: [PATCH net] octeontx2-af: Fix limiting SRIOV VF count logic
  2026-08-21  6:45 [PATCH net] octeontx2-af: Fix limiting SRIOV VF count logic nshettyj
@ 2026-08-21  9:21 ` Breno Leitao
  0 siblings, 0 replies; 2+ messages in thread
From: Breno Leitao @ 2026-08-21  9:21 UTC (permalink / raw)
  To: nshettyj
  Cc: netdev, linux-kernel, Sunil Goutham, Ratheesh Kannoth,
	Geetha sowjanya, Subbaraya Sundeep, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Tomasz Duszynski

On Fri, Aug 21, 2026 at 12:15:11PM +0530, nshettyj@marvell.com wrote:
> +		/* Limit VFs in case VFs are more than LBK channels available */
> +		if (vfs > chans)
> +			vfs = chans;

what about using min()? Something as:

	vfs = min(vfs, chans)

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

end of thread, other threads:[~2026-08-21  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  6:45 [PATCH net] octeontx2-af: Fix limiting SRIOV VF count logic nshettyj
2026-08-21  9:21 ` Breno Leitao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.