Skip to content

Commit 57b1e1c

Browse files
Bharat Bhushanherbertx
authored andcommitted
crypto: octeontx2 - Initialize cptlfs device info once
Function otx2_cptlf_set_dev_info() initializes common fields of cptlfs data-struct. This function is called every time a cptlf is initialized but this needs be done once for a cptlf block. So this initialization is moved to early device probe code to avoid redundant initialization. Signed-off-by: Bharat Bhushan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 270b6f1 commit 57b1e1c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,12 @@ static int cptpf_device_init(struct otx2_cptpf_dev *cptpf)
639639
/* Disable all cores */
640640
ret = otx2_cpt_disable_all_cores(cptpf);
641641

642+
otx2_cptlf_set_dev_info(&cptpf->lfs, cptpf->pdev, cptpf->reg_base,
643+
&cptpf->afpf_mbox, BLKADDR_CPT0);
644+
if (cptpf->has_cpt1)
645+
otx2_cptlf_set_dev_info(&cptpf->cpt1_lfs, cptpf->pdev,
646+
cptpf->reg_base, &cptpf->afpf_mbox,
647+
BLKADDR_CPT1);
642648
return ret;
643649
}
644650

drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,6 @@ static int handle_msg_rx_inline_ipsec_lf_cfg(struct otx2_cptpf_dev *cptpf,
264264
return -ENOENT;
265265
}
266266

267-
otx2_cptlf_set_dev_info(&cptpf->lfs, cptpf->pdev, cptpf->reg_base,
268-
&cptpf->afpf_mbox, BLKADDR_CPT0);
269267
cptpf->lfs.global_slot = 0;
270268
cptpf->lfs.ctx_ilen_ovrd = cfg_req->ctx_ilen_valid;
271269
cptpf->lfs.ctx_ilen = cfg_req->ctx_ilen;
@@ -278,9 +276,6 @@ static int handle_msg_rx_inline_ipsec_lf_cfg(struct otx2_cptpf_dev *cptpf,
278276

279277
if (cptpf->has_cpt1) {
280278
cptpf->rsrc_req_blkaddr = BLKADDR_CPT1;
281-
otx2_cptlf_set_dev_info(&cptpf->cpt1_lfs, cptpf->pdev,
282-
cptpf->reg_base, &cptpf->afpf_mbox,
283-
BLKADDR_CPT1);
284279
cptpf->cpt1_lfs.global_slot = num_lfs;
285280
cptpf->cpt1_lfs.ctx_ilen_ovrd = cfg_req->ctx_ilen_valid;
286281
cptpf->cpt1_lfs.ctx_ilen = cfg_req->ctx_ilen;

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,8 +1513,6 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf)
15131513
if (ret)
15141514
goto delete_grps;
15151515

1516-
otx2_cptlf_set_dev_info(lfs, cptpf->pdev, cptpf->reg_base,
1517-
&cptpf->afpf_mbox, BLKADDR_CPT0);
15181516
ret = otx2_cptlf_init(lfs, OTX2_CPT_ALL_ENG_GRPS_MASK,
15191517
OTX2_CPT_QUEUE_HI_PRIO, 1);
15201518
if (ret)

drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf)
283283

284284
lfs_num = cptvf->lfs.kvf_limits;
285285

286-
otx2_cptlf_set_dev_info(lfs, cptvf->pdev, cptvf->reg_base,
287-
&cptvf->pfvf_mbox, cptvf->blkaddr);
288286
ret = otx2_cptlf_init(lfs, eng_grp_msk, OTX2_CPT_QUEUE_HI_PRIO,
289287
lfs_num);
290288
if (ret)
@@ -396,6 +394,9 @@ static int otx2_cptvf_probe(struct pci_dev *pdev,
396394

397395
cptvf_hw_ops_get(cptvf);
398396

397+
otx2_cptlf_set_dev_info(&cptvf->lfs, cptvf->pdev, cptvf->reg_base,
398+
&cptvf->pfvf_mbox, cptvf->blkaddr);
399+
399400
ret = otx2_cptvf_send_caps_msg(cptvf);
400401
if (ret) {
401402
dev_err(&pdev->dev, "Couldn't get CPT engine capabilities.\n");

0 commit comments

Comments
 (0)