Skip to content

Commit 9adb04f

Browse files
SruChalladavem330
authored andcommitted
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: Srujana Challa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1286c50 commit 9adb04f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,16 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
11641164
goto nix_err;
11651165
}
11661166

1167+
err = rvu_cpt_init(rvu);
1168+
if (err) {
1169+
dev_err(rvu->dev, "%s: Failed to initialize cpt\n", __func__);
1170+
goto mcs_err;
1171+
}
1172+
11671173
return 0;
11681174

1175+
mcs_err:
1176+
rvu_mcs_exit(rvu);
11691177
nix_err:
11701178
rvu_nix_freemem(rvu);
11711179
npa_err:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ struct rvu {
511511
struct ptp *ptp;
512512

513513
int mcs_blk_cnt;
514+
int cpt_pf_num;
514515

515516
#ifdef CONFIG_DEBUG_FS
516517
struct rvu_debugfs rvu_dbg;
@@ -877,6 +878,7 @@ void rvu_cpt_unregister_interrupts(struct rvu *rvu);
877878
int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf,
878879
int slot);
879880
int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc);
881+
int rvu_cpt_init(struct rvu *rvu);
880882

881883
/* CN10K RVU */
882884
int rvu_set_channels_base(struct rvu *rvu);

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int get_cpt_pf_num(struct rvu *rvu)
340340

341341
static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc)
342342
{
343-
int cpt_pf_num = get_cpt_pf_num(rvu);
343+
int cpt_pf_num = rvu->cpt_pf_num;
344344

345345
if (rvu_get_pf(pcifunc) != cpt_pf_num)
346346
return false;
@@ -352,7 +352,7 @@ static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc)
352352

353353
static bool is_cpt_vf(struct rvu *rvu, u16 pcifunc)
354354
{
355-
int cpt_pf_num = get_cpt_pf_num(rvu);
355+
int cpt_pf_num = rvu->cpt_pf_num;
356356

357357
if (rvu_get_pf(pcifunc) != cpt_pf_num)
358358
return false;
@@ -1015,7 +1015,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int s
10151015
static int cpt_inline_inb_lf_cmd_send(struct rvu *rvu, int blkaddr,
10161016
int nix_blkaddr)
10171017
{
1018-
int cpt_pf_num = get_cpt_pf_num(rvu);
1018+
int cpt_pf_num = rvu->cpt_pf_num;
10191019
struct cpt_inst_lmtst_req *req;
10201020
dma_addr_t res_daddr;
10211021
int timeout = 3000;
@@ -1159,3 +1159,10 @@ int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc)
11591159

11601160
return 0;
11611161
}
1162+
1163+
int rvu_cpt_init(struct rvu *rvu)
1164+
{
1165+
/* Retrieve CPT PF number */
1166+
rvu->cpt_pf_num = get_cpt_pf_num(rvu);
1167+
return 0;
1168+
}

0 commit comments

Comments
 (0)