Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits
@ 2026-11-18  4:26 Vadluri Mukunda
  2026-11-18  4:32 ` netdev-bot+sinfo
  2026-11-22  4:40 ` netdev-bot+sashiko
  0 siblings, 2 replies; 3+ messages in thread
From: Vadluri Mukunda @ 2026-11-18  4:26 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Sunil Goutham, Ratheesh Kannoth, Geetha sowjanya,
	Subbaraya Sundeep, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Satha Rao, Vadluri Mukunda

From: Satha Rao <skoteshwar@marvell.com>

The scheduler queue number packed above the 16-bit register offset
was masked to 10 bits ([25:16]). Queue indices of 1024 and above
were truncated, so configuration and readback used the wrong TX
scheduler queue. The queue number is 11 bits ([26:16]).

The SMQ field of the CN20K SQ context is 11 bits wide, so queue
indices of 1024 and above first became reachable with the CN20K NIX
contexts.

Widen TXSCHQ_IDX_MASK to 11 bits and NIX_TX_SCHQ_MASK through bit 26.

Compile tested only; not tested on real hardware.

Fixes: b5dcdde074d5 ("octeontx2-af: Add cn20k NIX block contexts")
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Signed-off-by: Vadluri Mukunda <vmukunda@marvell.com>
---
v2:
  - Fixes tag now points to an upstream commit
  - Use full name in Signed-off-by
  - Add test status to the commit message
v1: https://lore.kernel.org/netdev/20261026062316.754904-1-vmukunda@marvell.com/

 drivers/net/ethernet/marvell/octeontx2/af/mbox.h    | 2 +-
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
index cece197d1074..1b62f9d7f00a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
@@ -1164,7 +1164,7 @@ struct nix_txschq_config {
 	u8 lvl;	/* SMQ/MDQ/TL4/TL3/TL2/TL1 */
 	u8 read;
 #define TXSCHQ_IDX_SHIFT	16
-#define TXSCHQ_IDX_MASK		(BIT_ULL(10) - 1)
+#define TXSCHQ_IDX_MASK		(BIT_ULL(11) - 1)
 #define TXSCHQ_IDX(reg, shift)	(((reg) >> (shift)) & TXSCHQ_IDX_MASK)
 	u8 num_regs;
 #define MAX_REGS_PER_MBOX_MSG	20
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 153eb57bad06..68cf730a8372 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -2850,9 +2850,9 @@ static void nix_tl1_default_cfg(struct rvu *rvu, struct nix_hw *nix_hw,
 }
 
 /* Register offset - [15:0]
- * Scheduler Queue number - [25:16]
+ * Scheduler Queue number - [26:16]
  */
-#define NIX_TX_SCHQ_MASK	GENMASK_ULL(25, 0)
+#define NIX_TX_SCHQ_MASK	GENMASK_ULL(26, 0)
 
 static int nix_txschq_cfg_read(struct rvu *rvu, struct nix_hw *nix_hw,
 			       int blkaddr, struct nix_txschq_config *req,
-- 
2.25.1


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

* Re: [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits
  2026-11-18  4:26 [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits Vadluri Mukunda
@ 2026-11-18  4:32 ` netdev-bot+sinfo
  2026-11-22  4:40 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-18  4:32 UTC (permalink / raw)
  To: Vadluri Mukunda
  Cc: netdev, linux-kernel, Sunil Goutham, Ratheesh Kannoth,
	Geetha sowjanya, Subbaraya Sundeep, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Satha Rao

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

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

* Re: [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits
  2026-11-18  4:26 [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits Vadluri Mukunda
  2026-11-18  4:32 ` netdev-bot+sinfo
@ 2026-11-22  4:40 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22  4:40 UTC (permalink / raw)
  To: vmukunda
  Cc: netdev, linux-kernel, sgoutham, rkannoth, gakula, sbhatta,
	andrew+netdev, davem, edumazet, kuba, pabeni, skoteshwar

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] This patch fixes 11-bit SMQ indices only on the NIX_TXSCHQ_CFG
  register path, by widening TXSCHQ_IDX_MASK and NIX_TX_SCHQ_MASK.

--

octeontx2-af: widen TX scheduler queue index to 11 bits

This commit widens TXSCHQ_IDX_MASK from 10 to 11 bits and extends
NIX_TX_SCHQ_MASK through bit 26. With that, scheduler queue indices of
1024 and above are no longer truncated on the NIX_TXSCHQ_CFG register
path. The target is CN20K, where the SMQ field of the SQ context is 11
bits wide.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> index cece197d1074b..1b62f9d7f00a0 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> @@ -1164,7 +1164,7 @@ struct nix_txschq_config {
>  	u8 lvl;	/* SMQ/MDQ/TL4/TL3/TL2/TL1 */
>  	u8 read;
>  #define TXSCHQ_IDX_SHIFT	16
> -#define TXSCHQ_IDX_MASK		(BIT_ULL(10) - 1)
> +#define TXSCHQ_IDX_MASK		(BIT_ULL(11) - 1)

[Severity: High]
This fixes the txschq register path. Is there still another place on
CN20K where an SMQ index of 1024 or above is cut down to 10 bits?

otx2_setup_dev_hw_settings() sets CN10K_LMTST on every !is_dev_otx2()
device, and that includes CN20K. As a result,
otx2_pfc_update_sq_smq_mapping() in nic/otx2_dcbnl.c takes the cn10k
request branch:

drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c:otx2_pfc_update_sq_smq_mapping() {
    ...
	if (test_bit(CN10K_LMTST, &pfvf->hw.cap_flag)) {
		cn10k_sq_aq = otx2_mbox_alloc_msg_nix_cn10k_aq_enq(&pfvf->mbox);
    ...
		cn10k_sq_aq->sq_mask.smq = GENMASK(9, 0);
		cn10k_sq_aq->sq.smq = otx2_get_smq_idx(pfvf, prio);
    ...
}

nix_cn10k_sq_ctx_s.smq is a 10-bit field, so bit 10 of the SMQ index is
dropped. The mask also covers only bits 9:0.

On the AF side, when is_cn20k() is true, nix_get_aq_req_smq() reads
every request with the 11-bit cn20k layout:

drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c:nix_get_aq_req_smq() {
	if (is_cn20k(rvu->pdev)) {
		*smq = ((struct nix_cn20k_aq_enq_req *)req)->sq.smq;
		*smq_mask = ((struct nix_cn20k_aq_enq_req *)req)->sq_mask.smq;
		return;
	}
    ...
}

In the cn20k layout, bit 10 sits where the cn10k layout has cq_ena, and
that bit is 0 in both the value and the mask. So
rvu_nix_blk_aq_enq_inst() calls is_valid_txschq() with (smq & 0x3ff).
The masked AQ write then leaves bit 10 of the existing hardware SQ
context unchanged.

Depending on the old and new SMQ, would this give the following?

  old < 1024, new >= 1024: the SQ is programmed to new & 0x3ff, which is
  the wrong SMQ, or the ownership check rejects the request.

  old >= 1024, new >= 1024: the ownership check runs on an SMQ the
  function probably doesn't own, so PFC configuration fails.

  old >= 1024, new < 1024: the AF approves SMQ X, but the hardware is
  set to X | 0x400, which may belong to another PF or VF.

The CN20K SQ init path in cn20k.c uses nix_cn20k_aq_enq_req and
programs all 11 bits. The PFC path does not, and it is reachable through
dcbnl ieee_setpfc -> otx2_pfc_txschq_update() ->
otx2_pfc_update_sq_smq_mapping().

The Fixes: tag points at b5dcdde074d5, which also added the cn20k
decoding in nix_get_aq_req_smq(). Should the PFC remap be updated as
part of this fix too?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118042614.878448-1-vmukunda%40marvell.com

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

end of thread, other threads:[~2026-11-22  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18  4:26 [PATCH net v2] octeontx2-af: widen TX scheduler queue index to 11 bits Vadluri Mukunda
2026-11-18  4:32 ` netdev-bot+sinfo
2026-11-22  4:40 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox