Skip to content

Commit 29fe7a1

Browse files
Geetha sowjanyadavem330
authored andcommitted
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. Fixes: 30077d2 ("octeontx2-af: cn10k: Update NIX/NPA context structure") Signed-off-by: Geetha sowjanya <gakula@marvell.com> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c3b704d commit 29fe7a1

File tree

1 file changed

+19
-2
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+19
-2
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,21 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,
846846
return 0;
847847
}
848848

849+
static void nix_get_aq_req_smq(struct rvu *rvu, struct nix_aq_enq_req *req,
850+
u16 *smq, u16 *smq_mask)
851+
{
852+
struct nix_cn10k_aq_enq_req *aq_req;
853+
854+
if (!is_rvu_otx2(rvu)) {
855+
aq_req = (struct nix_cn10k_aq_enq_req *)req;
856+
*smq = aq_req->sq.smq;
857+
*smq_mask = aq_req->sq_mask.smq;
858+
} else {
859+
*smq = req->sq.smq;
860+
*smq_mask = req->sq_mask.smq;
861+
}
862+
}
863+
849864
static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,
850865
struct nix_aq_enq_req *req,
851866
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,
857872
struct rvu_block *block;
858873
struct admin_queue *aq;
859874
struct rvu_pfvf *pfvf;
875+
u16 smq, smq_mask;
860876
void *ctx, *mask;
861877
bool ena;
862878
u64 cfg;
@@ -928,13 +944,14 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,
928944
if (rc)
929945
return rc;
930946

947+
nix_get_aq_req_smq(rvu, req, &smq, &smq_mask);
931948
/* Check if SQ pointed SMQ belongs to this PF/VF or not */
932949
if (req->ctype == NIX_AQ_CTYPE_SQ &&
933950
((req->op == NIX_AQ_INSTOP_INIT && req->sq.ena) ||
934951
(req->op == NIX_AQ_INSTOP_WRITE &&
935-
req->sq_mask.ena && req->sq_mask.smq && req->sq.ena))) {
952+
req->sq_mask.ena && req->sq.ena && smq_mask))) {
936953
if (!is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_SMQ,
937-
pcifunc, req->sq.smq))
954+
pcifunc, smq))
938955
return NIX_AF_ERR_AQ_ENQUEUE;
939956
}
940957

0 commit comments

Comments
 (0)