octeontx2-af: Fix truncation of smq in CN10K NIX AQ enqueue mbox handler
Geetha sowjanya
maintainerPATCH 1/1 octeontx2-af: Fix truncation of smq in CN10K NIX AQ enqueue mbox handler
The smq value used in the CN10K NIX AQ instruction enqueue mailbox handler was truncated to 9-bit value from 10-bit value because of typecasting the CN10K mbox request structure to the CN9K structure. Though this hasn't caused any problems when programming the NIX SQ context to the HW because the context structure is the same size. However, this causes a problem when accessing the structure parameters. This patch reads the right smq value for each platform.
--- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +19 -2
@@ -846,6 +846,21 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,return 0 ; } +static void nix_get_aq_req_smq (struct rvu *rvu,struct nix_aq_enq_req *req, +u16 *smq,u16 *smq_mask) +{ +struct nix_cn10k_aq_enq_req *aq_req; + +if (!is_rvu_otx2 (rvu)) { + aq_req = (struct nix_cn10k_aq_enq_req *)req; + *smq = aq_req->sq.smq; + *smq_mask = aq_req->sq_mask.smq; + }else { + *smq = req->sq.smq; + *smq_mask = req->sq_mask.smq; + } +} +static int rvu_nix_blk_aq_enq_inst (struct rvu *rvu,struct nix_hw *nix_hw,struct nix_aq_enq_req *req,struct nix_aq_enq_rsp *rsp)
@@ -857,6 +872,7 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,struct rvu_block *block;struct admin_queue *aq;struct rvu_pfvf *pfvf; +u16 smq, smq_mask;void *ctx, *mask;bool ena;u64 cfg;
@@ -928,13 +944,14 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,if (rc)return rc; +nix_get_aq_req_smq (rvu, req, &smq, &smq_mask);/* Check if SQ pointed SMQ belongs to this PF/VF or not */ if (req->ctype ==NIX_AQ_CTYPE_SQ && ((req->op ==NIX_AQ_INSTOP_INIT && req->sq.ena) || (req->op ==NIX_AQ_INSTOP_WRITE && - req->sq_mask.ena && req->sq_mask.smq && req->sq.ena))) { + req->sq_mask.ena && req->sq.ena && smq_mask))) {if (!is_valid_txschq (rvu, blkaddr,NIX_TXSCH_LVL_SMQ , - pcifunc, req->sq.smq)) + pcifunc, smq))return NIX_AF_ERR_AQ_ENQUEUE ; }
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Tue, 5 Sep 2023 12:18:16 +0530 you wrote:
The smq value used in the CN10K NIX AQ instruction enqueue mailbox handler was truncated to 9-bit value from 10-bit value because of typecasting the CN10K mbox request structure to the CN9K structure. Though this hasn't caused any problems when programming the NIX SQ context to the HW because the context structure is the same size. However, this causes a problem when accessing the structure parameters. This patch reads the right smq value for each platform.
[...]
Here is the summary with links:
- [net] octeontx2-af: Fix truncation of smq in CN10K NIX AQ enqueue mbox handler
https://git.kernel.org/netdev/net/c/29fe7a1b6271
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html