Skip to content

Commit f58cf76

Browse files
SruChalladavem330
authored andcommitted
octeontx2-af: add mbox for CPT LF reset
On OcteonTX2 SoC, the admin function (AF) is the only one with all priviliges to configure HW and alloc resources, PFs and it's VFs have to request AF via mailbox for all their needs. This patch adds a new mailbox for CPT VFs to request for CPT LF reset. Signed-off-by: Srujana Challa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 07ea567 commit f58cf76

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/af/mbox.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ M(CPT_STATS, 0xA05, cpt_sts, cpt_sts_req, cpt_sts_rsp) \
195195
M(CPT_RXC_TIME_CFG, 0xA06, cpt_rxc_time_cfg, cpt_rxc_time_cfg_req, \
196196
msg_rsp) \
197197
M(CPT_CTX_CACHE_SYNC, 0xA07, cpt_ctx_cache_sync, msg_req, msg_rsp) \
198+
M(CPT_LF_RESET, 0xA08, cpt_lf_reset, cpt_lf_rst_req, msg_rsp) \
198199
/* SDP mbox IDs (range 0x1000 - 0x11FF) */ \
199200
M(SET_SDP_CHAN_INFO, 0x1000, set_sdp_chan_info, sdp_chan_info_msg, msg_rsp) \
200201
M(GET_SDP_CHAN_INFO, 0x1001, get_sdp_chan_info, msg_req, sdp_get_chan_info_msg) \
@@ -1692,6 +1693,13 @@ struct cpt_inst_lmtst_req {
16921693
u64 rsvd;
16931694
};
16941695

1696+
/* Mailbox message format to request for CPT LF reset */
1697+
struct cpt_lf_rst_req {
1698+
struct mbox_msghdr hdr;
1699+
u32 slot;
1700+
u32 rsvd;
1701+
};
1702+
16951703
struct sdp_node_info {
16961704
/* Node to which this PF belons to */
16971705
u8 node_id;

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,39 @@ int rvu_mbox_handler_cpt_ctx_cache_sync(struct rvu *rvu, struct msg_req *req,
851851
return rvu_cpt_ctx_flush(rvu, req->hdr.pcifunc);
852852
}
853853

854+
int rvu_mbox_handler_cpt_lf_reset(struct rvu *rvu, struct cpt_lf_rst_req *req,
855+
struct msg_rsp *rsp)
856+
{
857+
u16 pcifunc = req->hdr.pcifunc;
858+
struct rvu_block *block;
859+
int cptlf, blkaddr, ret;
860+
u16 actual_slot;
861+
u64 ctl, ctl2;
862+
863+
blkaddr = rvu_get_blkaddr_from_slot(rvu, BLKTYPE_CPT, pcifunc,
864+
req->slot, &actual_slot);
865+
if (blkaddr < 0)
866+
return CPT_AF_ERR_LF_INVALID;
867+
868+
block = &rvu->hw->block[blkaddr];
869+
870+
cptlf = rvu_get_lf(rvu, block, pcifunc, actual_slot);
871+
if (cptlf < 0)
872+
return CPT_AF_ERR_LF_INVALID;
873+
ctl = rvu_read64(rvu, blkaddr, CPT_AF_LFX_CTL(cptlf));
874+
ctl2 = rvu_read64(rvu, blkaddr, CPT_AF_LFX_CTL2(cptlf));
875+
876+
ret = rvu_lf_reset(rvu, block, cptlf);
877+
if (ret)
878+
dev_err(rvu->dev, "Failed to reset blkaddr %d LF%d\n",
879+
block->addr, cptlf);
880+
881+
rvu_write64(rvu, blkaddr, CPT_AF_LFX_CTL(cptlf), ctl);
882+
rvu_write64(rvu, blkaddr, CPT_AF_LFX_CTL2(cptlf), ctl2);
883+
884+
return 0;
885+
}
886+
854887
static void cpt_rxc_teardown(struct rvu *rvu, int blkaddr)
855888
{
856889
struct cpt_rxc_time_cfg_req req;

0 commit comments

Comments
 (0)