]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: octeontx2 - Initialize cptlfs device info once
authorBharat Bhushan <bbhushan2@marvell.com>
Fri, 16 May 2025 08:44:40 +0000 (14:14 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 19 May 2025 05:48:20 +0000 (13:48 +0800)
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 <bbhushan2@marvell.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c

index 12971300296d9756dd3dc18c819c3b5f4d1c1b8c..687b6c7d7674621b87fca8342b231d9323623206 100644 (file)
@@ -639,6 +639,12 @@ static int cptpf_device_init(struct otx2_cptpf_dev *cptpf)
        /* Disable all cores */
        ret = otx2_cpt_disable_all_cores(cptpf);
 
+       otx2_cptlf_set_dev_info(&cptpf->lfs, cptpf->pdev, cptpf->reg_base,
+                               &cptpf->afpf_mbox, BLKADDR_CPT0);
+       if (cptpf->has_cpt1)
+               otx2_cptlf_set_dev_info(&cptpf->cpt1_lfs, cptpf->pdev,
+                                       cptpf->reg_base, &cptpf->afpf_mbox,
+                                       BLKADDR_CPT1);
        return ret;
 }
 
index ec1ac7e836a3103de4f730c647f49fdd4eb8b313..3eb45bb91296b6a2075f3aeb7c6c0174b82c64ae 100644 (file)
@@ -264,8 +264,6 @@ static int handle_msg_rx_inline_ipsec_lf_cfg(struct otx2_cptpf_dev *cptpf,
                return -ENOENT;
        }
 
-       otx2_cptlf_set_dev_info(&cptpf->lfs, cptpf->pdev, cptpf->reg_base,
-                               &cptpf->afpf_mbox, BLKADDR_CPT0);
        cptpf->lfs.global_slot = 0;
        cptpf->lfs.ctx_ilen_ovrd = cfg_req->ctx_ilen_valid;
        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,
 
        if (cptpf->has_cpt1) {
                cptpf->rsrc_req_blkaddr = BLKADDR_CPT1;
-               otx2_cptlf_set_dev_info(&cptpf->cpt1_lfs, cptpf->pdev,
-                                       cptpf->reg_base, &cptpf->afpf_mbox,
-                                       BLKADDR_CPT1);
                cptpf->cpt1_lfs.global_slot = num_lfs;
                cptpf->cpt1_lfs.ctx_ilen_ovrd = cfg_req->ctx_ilen_valid;
                cptpf->cpt1_lfs.ctx_ilen = cfg_req->ctx_ilen;
index 42c5484ce66a34aa3f41ca2d477937f2ca7c8b69..78367849c3d5512a94223c00a7828353bbf8d1f5 100644 (file)
@@ -1513,8 +1513,6 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf)
        if (ret)
                goto delete_grps;
 
-       otx2_cptlf_set_dev_info(lfs, cptpf->pdev, cptpf->reg_base,
-                               &cptpf->afpf_mbox, BLKADDR_CPT0);
        ret = otx2_cptlf_init(lfs, OTX2_CPT_ALL_ENG_GRPS_MASK,
                              OTX2_CPT_QUEUE_HI_PRIO, 1);
        if (ret)
index d84eebdf2fa8475a809dec7ddd7196cd3a7b1f3f..11e351a48efee7a44e5e72ac8f137c41cf8ee560 100644 (file)
@@ -283,8 +283,6 @@ static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf)
 
        lfs_num = cptvf->lfs.kvf_limits;
 
-       otx2_cptlf_set_dev_info(lfs, cptvf->pdev, cptvf->reg_base,
-                               &cptvf->pfvf_mbox, cptvf->blkaddr);
        ret = otx2_cptlf_init(lfs, eng_grp_msk, OTX2_CPT_QUEUE_HI_PRIO,
                              lfs_num);
        if (ret)
@@ -396,6 +394,9 @@ static int otx2_cptvf_probe(struct pci_dev *pdev,
 
        cptvf_hw_ops_get(cptvf);
 
+       otx2_cptlf_set_dev_info(&cptvf->lfs, cptvf->pdev, cptvf->reg_base,
+                               &cptvf->pfvf_mbox, cptvf->blkaddr);
+
        ret = otx2_cptvf_send_caps_msg(cptvf);
        if (ret) {
                dev_err(&pdev->dev, "Couldn't get CPT engine capabilities.\n");