History

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.

Nithin Dabilpuram committed 2 years ago

Commit bc35e281 parent 8b9b59e1 file · +16 −7Browse files

Unified · Split

drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c+16−7
@@ -696,7 +696,8 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu, · 695 unmodified lines
696 struct cpt_rd_wr_reg_msg *req,696 struct cpt_rd_wr_reg_msg *req,
697 struct cpt_rd_wr_reg_msg *rsp)697 struct cpt_rd_wr_reg_msg *rsp)
698{698{
699 int blkaddr;699 u64 offset = req->reg_offset;
700 int blkaddr, lf;
700 701
701 blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr);702 blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr);
702 if (blkaddr < 0)703 if (blkaddr < 0)
@@ -707,17 +708,25 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu, · 4 unmodified lines
707 !is_cpt_vf(rvu, req->hdr.pcifunc))708 !is_cpt_vf(rvu, req->hdr.pcifunc))
708 return CPT_AF_ERR_ACCESS_DENIED;709 return CPT_AF_ERR_ACCESS_DENIED;
709 710
710 rsp->reg_offset = req->reg_offset;
711 rsp->ret_val = req->ret_val;
712 rsp->is_write = req->is_write;
713
714 if (!is_valid_offset(rvu, req))711 if (!is_valid_offset(rvu, req))
715 return CPT_AF_ERR_ACCESS_DENIED;712 return CPT_AF_ERR_ACCESS_DENIED;
716 713
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
717 if (req->is_write)726 if (req->is_write)
718 rvu_write64(rvu, blkaddr, req->reg_offset, req->val);727 rvu_write64(rvu, blkaddr, offset, req->val);
719 else728 else
720 rsp->val = rvu_read64(rvu, blkaddr, req->reg_offset);729 rsp->val = rvu_read64(rvu, blkaddr, offset);
721 730
722 return 0;731 return 0;
723}732}