mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: qat - add check for adf_cfg_add_key_value_param
@ 2024-06-05  3:18 Chen Ni
  2024-06-11 11:23 ` Cabiddu, Giovanni
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2024-06-05  3:18 UTC (permalink / raw)
  To: giovanni.cabiddu, herbert, davem, markas.rapoportas, ahsan.atta,
	mun.chun.yep, xin.zeng
  Cc: qat-linux, linux-crypto, linux-kernel, Chen Ni

Add check for the return value of adf_cfg_add_key_value_param() and
return the error if it fails in order to catch the error.

Fixes: 4469f9b23468 ("crypto: qat - re-enable sriov after pf reset")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/crypto/intel/qat/qat_common/adf_sriov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c
index 8d645e7e04aa..30ff9097f527 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c
@@ -228,8 +228,10 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
 		return ret;
 
 	val = 1;
-	adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED,
+	ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED,
 				    &val, ADF_DEC);
+	if (ret)
+		return ret;
 
 	return numvfs;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: qat - add check for adf_cfg_add_key_value_param
  2024-06-05  3:18 [PATCH] crypto: qat - add check for adf_cfg_add_key_value_param Chen Ni
@ 2024-06-11 11:23 ` Cabiddu, Giovanni
  0 siblings, 0 replies; 2+ messages in thread
From: Cabiddu, Giovanni @ 2024-06-11 11:23 UTC (permalink / raw)
  To: Chen Ni
  Cc: herbert, davem, markas.rapoportas, ahsan.atta, mun.chun.yep,
	xin.zeng, qat-linux, linux-crypto, linux-kernel

On Wed, Jun 05, 2024 at 11:18:35AM +0800, Chen Ni wrote:
> Add check for the return value of adf_cfg_add_key_value_param() and
> return the error if it fails in order to catch the error.
> 
> Fixes: 4469f9b23468 ("crypto: qat - re-enable sriov after pf reset")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/crypto/intel/qat/qat_common/adf_sriov.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c
> index 8d645e7e04aa..30ff9097f527 100644
> --- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c
> +++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c
> @@ -228,8 +228,10 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
>  		return ret;
>  
>  	val = 1;
> -	adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED,
> +	ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED,
>  				    &val, ADF_DEC);
> +	if (ret)
> +		return ret;
This has the side effect of failing the enablement of VFs for QAT GEN2 as
ADF_GENERAL_SEC is not present.

For GEN4, where ADF_GENERAL_SEC is used, if this function fails, the recovery
paths is not going to re-enable SRIOV VFs after reset.
It is ok to omit this check.

Regards,

-- 
Giovanni

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-11 11:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05  3:18 [PATCH] crypto: qat - add check for adf_cfg_add_key_value_param Chen Ni
2024-06-11 11:23 ` Cabiddu, Giovanni

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®