diff mbox series

crypto/octeontx2: By default allocate one CPT LF per CPT VF

Message ID 20231129154133.1529898-1-bbhushan2@marvell.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto/octeontx2: By default allocate one CPT LF per CPT VF | expand

Commit Message

Bharat Bhushan Nov. 29, 2023, 3:41 p.m. UTC
There are limited number CPT LFs (example 64 LFs on cn10k) and
these LFs are allocated/attached to CPT VF on its creation.
cptpf sysfs parameter "kvf_limits" defines number of CPT LFs
per CPT VF. Default "kvf_limits" is initialized to zero and if
kvf_limits is zero then number of LF allocated are equal to
online cpus in system.

For example on 24 core system, 24 CPT LFs will be attached per VF.
That means no CPT LF available when creating more than 2 CPT VFs
on system which have total 64 LFs. Although VFs gets created but
no LF attached to it.

There seems no reason to default allocate as many LFs as many
online cpus in system. This patch initializes "kvf_limits" to
one to limit one LF allocated per CPT VF. "kvf_limits" can
be changed in range of 1 to number-of-online-cpus via sysfs.

Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 1 +
 drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Herbert Xu Dec. 8, 2023, 4:08 a.m. UTC | #1
On Wed, Nov 29, 2023 at 09:11:33PM +0530, Bharat Bhushan wrote:
> There are limited number CPT LFs (example 64 LFs on cn10k) and
> these LFs are allocated/attached to CPT VF on its creation.
> cptpf sysfs parameter "kvf_limits" defines number of CPT LFs
> per CPT VF. Default "kvf_limits" is initialized to zero and if
> kvf_limits is zero then number of LF allocated are equal to
> online cpus in system.
> 
> For example on 24 core system, 24 CPT LFs will be attached per VF.
> That means no CPT LF available when creating more than 2 CPT VFs
> on system which have total 64 LFs. Although VFs gets created but
> no LF attached to it.
> 
> There seems no reason to default allocate as many LFs as many
> online cpus in system. This patch initializes "kvf_limits" to
> one to limit one LF allocated per CPT VF. "kvf_limits" can
> be changed in range of 1 to number-of-online-cpus via sysfs.
> 
> Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
> ---
>  drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 1 +
>  drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
index e34223daa327..b13df6a49644 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
@@ -797,6 +797,7 @@  static int otx2_cptpf_probe(struct pci_dev *pdev,
 		goto destroy_afpf_mbox;
 
 	cptpf->max_vfs = pci_sriov_get_totalvfs(pdev);
+	cptpf->kvf_limits = 1;
 
 	err = cn10k_cptpf_lmtst_init(cptpf);
 	if (err)
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
index bac729c885f9..69a447d3702c 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
@@ -277,8 +277,7 @@  static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf)
 	if (ret)
 		return ret;
 
-	lfs_num = cptvf->lfs.kvf_limits ? cptvf->lfs.kvf_limits :
-		  num_online_cpus();
+	lfs_num = cptvf->lfs.kvf_limits;
 
 	otx2_cptlf_set_dev_info(lfs, cptvf->pdev, cptvf->reg_base,
 				&cptvf->pfvf_mbox, cptvf->blkaddr);