* [PATCH] crypto: hisilicon/qm - return failure if vfs_num exceeds total VFs
@ 2022-08-27 10:27 Weili Qian
2022-09-02 11:02 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Weili Qian @ 2022-08-27 10:27 UTC (permalink / raw)
To: herbert; +Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang
The accelerator drivers supports users to enable VFs through the
module parameter 'vfs_num'. If the number of VFs to be enabled
exceeds the total VFs, all VFs are enabled. Change it to the same
as enabling VF through the 'sriov_numvfs' file. Returns -ERANGE
if the number of VFs to be enabled exceeds total VFs.
Signed-off-by: Weili Qian <qianweili@huawei.com>
---
drivers/crypto/hisilicon/qm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index fd9fb159048f..54bbd7fa57cc 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -4766,7 +4766,13 @@ int hisi_qm_sriov_enable(struct pci_dev *pdev, int max_vfs)
goto err_put_sync;
}
- num_vfs = min_t(int, max_vfs, total_vfs);
+ if (max_vfs > total_vfs) {
+ pci_err(pdev, "%d VFs is more than total VFs %d!\n", max_vfs, total_vfs);
+ ret = -ERANGE;
+ goto err_put_sync;
+ }
+
+ num_vfs = max_vfs;
ret = qm_vf_q_assign(qm, num_vfs);
if (ret) {
pci_err(pdev, "Can't assign queues for VF!\n");
--
2.33.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: hisilicon/qm - return failure if vfs_num exceeds total VFs
2022-08-27 10:27 [PATCH] crypto: hisilicon/qm - return failure if vfs_num exceeds total VFs Weili Qian
@ 2022-09-02 11:02 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2022-09-02 11:02 UTC (permalink / raw)
To: Weili Qian; +Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang
On Sat, Aug 27, 2022 at 06:27:56PM +0800, Weili Qian wrote:
> The accelerator drivers supports users to enable VFs through the
> module parameter 'vfs_num'. If the number of VFs to be enabled
> exceeds the total VFs, all VFs are enabled. Change it to the same
> as enabling VF through the 'sriov_numvfs' file. Returns -ERANGE
> if the number of VFs to be enabled exceeds total VFs.
>
> Signed-off-by: Weili Qian <qianweili@huawei.com>
> ---
> drivers/crypto/hisilicon/qm.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-02 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-27 10:27 [PATCH] crypto: hisilicon/qm - return failure if vfs_num exceeds total VFs Weili Qian
2022-09-02 11:02 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®