Skip to content

Commit bc35e28

Browse files
nithind1988davem330
authored andcommitted
octeontx2-af: replace cpt slot with lf id on reg write
Replace slot id with global CPT lf id on reg read/write as CPTPF/VF driver would send slot number instead of global lf id in the reg offset. And also update the mailbox response with the global lf's register offset. Fixes: ae45408 ("octeontx2-af: add mailbox interface for CPT") Signed-off-by: Nithin Dabilpuram <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8b9b59e commit bc35e28

File tree

1 file changed

+16
-7
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,8 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu,
696696
struct cpt_rd_wr_reg_msg *req,
697697
struct cpt_rd_wr_reg_msg *rsp)
698698
{
699-
int blkaddr;
699+
u64 offset = req->reg_offset;
700+
int blkaddr, lf;
700701

701702
blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr);
702703
if (blkaddr < 0)
@@ -707,17 +708,25 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu,
707708
!is_cpt_vf(rvu, req->hdr.pcifunc))
708709
return CPT_AF_ERR_ACCESS_DENIED;
709710

710-
rsp->reg_offset = req->reg_offset;
711-
rsp->ret_val = req->ret_val;
712-
rsp->is_write = req->is_write;
713-
714711
if (!is_valid_offset(rvu, req))
715712
return CPT_AF_ERR_ACCESS_DENIED;
716713

714+
/* Translate local LF used by VFs to global CPT LF */
715+
lf = rvu_get_lf(rvu, &rvu->hw->block[blkaddr], req->hdr.pcifunc,
716+
(offset & 0xFFF) >> 3);
717+
718+
/* Translate local LF's offset to global CPT LF's offset */
719+
offset &= 0xFF000;
720+
offset += lf << 3;
721+
722+
rsp->reg_offset = offset;
723+
rsp->ret_val = req->ret_val;
724+
rsp->is_write = req->is_write;
725+
717726
if (req->is_write)
718-
rvu_write64(rvu, blkaddr, req->reg_offset, req->val);
727+
rvu_write64(rvu, blkaddr, offset, req->val);
719728
else
720-
rsp->val = rvu_read64(rvu, blkaddr, req->reg_offset);
729+
rsp->val = rvu_read64(rvu, blkaddr, offset);
721730

722731
return 0;
723732
}

0 commit comments

Comments
 (0)