Commit 57b1e1c0 authored by Bharat Bhushan's avatar Bharat Bhushan Committed by Herbert Xu
Browse files

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: default avatarBharat Bhushan <bbhushan2@marvell.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 270b6f13
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
}

+0 −5
Original line number Diff line number Diff line
@@ -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;
+0 −2
Original line number Diff line number Diff line
@@ -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)
+3 −2
Original line number Diff line number Diff line
@@ -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");