octeontx2-af: Add mbox to retrieve bandwidth profile free count
Added mbox for PF/VF drivers to retrieve current ingress bandwidth profile free count. Also added current policer timeunit configuration info based on which ratelimiting decisions can be taken by PF/VF drivers. Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
18603683d7
commit
66c312ea1d
@ -279,7 +279,9 @@ M(NIX_GET_HW_INFO, 0x801c, nix_get_hw_info, msg_req, nix_hw_info) \
|
||||
M(NIX_BANDPROF_ALLOC, 0x801d, nix_bandprof_alloc, nix_bandprof_alloc_req, \
|
||||
nix_bandprof_alloc_rsp) \
|
||||
M(NIX_BANDPROF_FREE, 0x801e, nix_bandprof_free, nix_bandprof_free_req, \
|
||||
msg_rsp)
|
||||
msg_rsp) \
|
||||
M(NIX_BANDPROF_GET_HWINFO, 0x801f, nix_bandprof_get_hwinfo, msg_req, \
|
||||
nix_bandprof_get_hwinfo_rsp)
|
||||
|
||||
/* Messages initiated by AF (range 0xC00 - 0xDFF) */
|
||||
#define MBOX_UP_CGX_MESSAGES \
|
||||
@ -1101,6 +1103,12 @@ struct nix_bandprof_free_req {
|
||||
u16 prof_idx[BAND_PROF_NUM_LAYERS][MAX_BANDPROF_PER_PFFUNC];
|
||||
};
|
||||
|
||||
struct nix_bandprof_get_hwinfo_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 prof_count[BAND_PROF_NUM_LAYERS];
|
||||
u32 policer_timeunit;
|
||||
};
|
||||
|
||||
/* NPC mbox message structs */
|
||||
|
||||
#define NPC_MCAM_ENTRY_INVALID 0xFFFF
|
||||
|
@ -5173,3 +5173,36 @@ static void nix_clear_ratelimit_aggr(struct rvu *rvu, struct nix_hw *nix_hw,
|
||||
rvu_free_rsrc(&ipolicer->band_prof, mid_prof);
|
||||
}
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_bandprof_get_hwinfo(struct rvu *rvu, struct msg_req *req,
|
||||
struct nix_bandprof_get_hwinfo_rsp *rsp)
|
||||
{
|
||||
struct nix_ipolicer *ipolicer;
|
||||
int blkaddr, layer, err;
|
||||
struct nix_hw *nix_hw;
|
||||
u64 tu;
|
||||
|
||||
if (!rvu->hw->cap.ipolicer)
|
||||
return NIX_AF_ERR_IPOLICER_NOTSUPP;
|
||||
|
||||
err = nix_get_struct_ptrs(rvu, req->hdr.pcifunc, &nix_hw, &blkaddr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Return number of bandwidth profiles free at each layer */
|
||||
mutex_lock(&rvu->rsrc_lock);
|
||||
for (layer = 0; layer < BAND_PROF_NUM_LAYERS; layer++) {
|
||||
if (layer == BAND_PROF_INVAL_LAYER)
|
||||
continue;
|
||||
|
||||
ipolicer = &nix_hw->ipolicer[layer];
|
||||
rsp->prof_count[layer] = rvu_rsrc_free_count(&ipolicer->band_prof);
|
||||
}
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
|
||||
/* Set the policer timeunit in nanosec */
|
||||
tu = rvu_read64(rvu, blkaddr, NIX_AF_PL_TS) & GENMASK_ULL(9, 0);
|
||||
rsp->policer_timeunit = (tu + 1) * 100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user