Commit 9adb04ff authored by Srujana Challa's avatar Srujana Challa Committed by David S. Miller

octeontx2-af: optimize cpt pf identification

Optimize CPT PF identification in mbox handling for faster
mbox response by doing it at AF driver probe instead of
every mbox message.
Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1286c50a
...@@ -1164,8 +1164,16 @@ static int rvu_setup_hw_resources(struct rvu *rvu) ...@@ -1164,8 +1164,16 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
goto nix_err; goto nix_err;
} }
err = rvu_cpt_init(rvu);
if (err) {
dev_err(rvu->dev, "%s: Failed to initialize cpt\n", __func__);
goto mcs_err;
}
return 0; return 0;
mcs_err:
rvu_mcs_exit(rvu);
nix_err: nix_err:
rvu_nix_freemem(rvu); rvu_nix_freemem(rvu);
npa_err: npa_err:
......
...@@ -511,6 +511,7 @@ struct rvu { ...@@ -511,6 +511,7 @@ struct rvu {
struct ptp *ptp; struct ptp *ptp;
int mcs_blk_cnt; int mcs_blk_cnt;
int cpt_pf_num;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct rvu_debugfs rvu_dbg; struct rvu_debugfs rvu_dbg;
...@@ -877,6 +878,7 @@ void rvu_cpt_unregister_interrupts(struct rvu *rvu); ...@@ -877,6 +878,7 @@ void rvu_cpt_unregister_interrupts(struct rvu *rvu);
int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf,
int slot); int slot);
int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc); int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc);
int rvu_cpt_init(struct rvu *rvu);
/* CN10K RVU */ /* CN10K RVU */
int rvu_set_channels_base(struct rvu *rvu); int rvu_set_channels_base(struct rvu *rvu);
......
...@@ -340,7 +340,7 @@ static int get_cpt_pf_num(struct rvu *rvu) ...@@ -340,7 +340,7 @@ static int get_cpt_pf_num(struct rvu *rvu)
static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc) static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc)
{ {
int cpt_pf_num = get_cpt_pf_num(rvu); int cpt_pf_num = rvu->cpt_pf_num;
if (rvu_get_pf(pcifunc) != cpt_pf_num) if (rvu_get_pf(pcifunc) != cpt_pf_num)
return false; return false;
...@@ -352,7 +352,7 @@ static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc) ...@@ -352,7 +352,7 @@ static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc)
static bool is_cpt_vf(struct rvu *rvu, u16 pcifunc) static bool is_cpt_vf(struct rvu *rvu, u16 pcifunc)
{ {
int cpt_pf_num = get_cpt_pf_num(rvu); int cpt_pf_num = rvu->cpt_pf_num;
if (rvu_get_pf(pcifunc) != cpt_pf_num) if (rvu_get_pf(pcifunc) != cpt_pf_num)
return false; return false;
...@@ -1015,7 +1015,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int s ...@@ -1015,7 +1015,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int s
static int cpt_inline_inb_lf_cmd_send(struct rvu *rvu, int blkaddr, static int cpt_inline_inb_lf_cmd_send(struct rvu *rvu, int blkaddr,
int nix_blkaddr) int nix_blkaddr)
{ {
int cpt_pf_num = get_cpt_pf_num(rvu); int cpt_pf_num = rvu->cpt_pf_num;
struct cpt_inst_lmtst_req *req; struct cpt_inst_lmtst_req *req;
dma_addr_t res_daddr; dma_addr_t res_daddr;
int timeout = 3000; int timeout = 3000;
...@@ -1159,3 +1159,10 @@ int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc) ...@@ -1159,3 +1159,10 @@ int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc)
return 0; return 0;
} }
int rvu_cpt_init(struct rvu *rvu)
{
/* Retrieve CPT PF number */
rvu->cpt_pf_num = get_cpt_pf_num(rvu);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment