Skip to content

Commit

Permalink
octeontx2-af: Mailbox changes for 98xx CPT block
Browse files Browse the repository at this point in the history
This patch changes CPT mailbox message format to
support new block CPT1 in 98xx silicon.

cpt_rd_wr_reg ->
    Modify cpt_rd_wr_reg mailbox and its handler to
    accommodate new block CPT1.
cpt_lf_alloc ->
    Modify cpt_lf_alloc mailbox and its handler to
    configure LFs from a block address out of multiple
    blocks of same type. If a PF/VF needs to configure
    LFs from both the blocks then this mbox should be
    called twice.

Signed-off-by: Mahipal Challa <mchalla@marvell.com>
Signed-off-by: Srujana Challa <schalla@marvell.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Srujana Challa authored and Jakub Kicinski committed Feb 4, 2021
1 parent e0183b9 commit de2854c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/mbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -1073,13 +1073,15 @@ struct cpt_rd_wr_reg_msg {
u64 *ret_val;
u64 val;
u8 is_write;
int blkaddr;
};

struct cpt_lf_alloc_req_msg {
struct mbox_msghdr hdr;
u16 nix_pf_func;
u16 sso_pf_func;
u16 eng_grpmsk;
int blkaddr;
};

#endif /* MBOX_H */
41 changes: 25 additions & 16 deletions drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ int rvu_mbox_handler_cpt_lf_alloc(struct rvu *rvu,
int num_lfs, slot;
u64 val;

blkaddr = req->blkaddr ? req->blkaddr : BLKADDR_CPT0;
if (blkaddr != BLKADDR_CPT0 && blkaddr != BLKADDR_CPT1)
return -ENODEV;

if (req->eng_grpmsk == 0x0)
return CPT_AF_ERR_GRP_INVALID;

blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
if (blkaddr < 0)
return blkaddr;

block = &rvu->hw->block[blkaddr];
num_lfs = rvu_get_rsrc_mapcount(rvu_get_pfvf(rvu, pcifunc),
block->addr);
Expand Down Expand Up @@ -114,23 +114,17 @@ int rvu_mbox_handler_cpt_lf_alloc(struct rvu *rvu,
return 0;
}

int rvu_mbox_handler_cpt_lf_free(struct rvu *rvu, struct msg_req *req,
struct msg_rsp *rsp)
static int cpt_lf_free(struct rvu *rvu, struct msg_req *req, int blkaddr)
{
u16 pcifunc = req->hdr.pcifunc;
int num_lfs, cptlf, slot;
struct rvu_block *block;
int cptlf, blkaddr;
int num_lfs, slot;

blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
if (blkaddr < 0)
return blkaddr;

block = &rvu->hw->block[blkaddr];
num_lfs = rvu_get_rsrc_mapcount(rvu_get_pfvf(rvu, pcifunc),
block->addr);
if (!num_lfs)
return CPT_AF_ERR_LF_INVALID;
return 0;

for (slot = 0; slot < num_lfs; slot++) {
cptlf = rvu_get_lf(rvu, block, pcifunc, slot);
Expand All @@ -146,6 +140,21 @@ int rvu_mbox_handler_cpt_lf_free(struct rvu *rvu, struct msg_req *req,
return 0;
}

int rvu_mbox_handler_cpt_lf_free(struct rvu *rvu, struct msg_req *req,
struct msg_rsp *rsp)
{
int ret;

ret = cpt_lf_free(rvu, req, BLKADDR_CPT0);
if (ret)
return ret;

if (is_block_implemented(rvu->hw, BLKADDR_CPT1))
ret = cpt_lf_free(rvu, req, BLKADDR_CPT1);

return ret;
}

static bool is_valid_offset(struct rvu *rvu, struct cpt_rd_wr_reg_msg *req)
{
u64 offset = req->reg_offset;
Expand Down Expand Up @@ -208,9 +217,9 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu,
{
int blkaddr;

blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_CPT, 0);
if (blkaddr < 0)
return blkaddr;
blkaddr = req->blkaddr ? req->blkaddr : BLKADDR_CPT0;
if (blkaddr != BLKADDR_CPT0 && blkaddr != BLKADDR_CPT1)
return -ENODEV;

/* This message is accepted only if sent from CPT PF/VF */
if (!is_cpt_pf(rvu, req->hdr.pcifunc) &&
Expand Down

0 comments on commit de2854c

Please sign in to comment.