diff mbox series

[02/10] crypto: qat - remove empty sriov_configure()

Message ID 20210527191251.6317-3-marco.chiappero@intel.com
State New
Headers show
Series crypto: qat - misc fixes | expand

Commit Message

Marco Chiappero May 27, 2021, 7:12 p.m. UTC
Remove the empty implementation of sriov_configure() and set the
sriov_configure member of the pci_driver structure to NULL.
This way, if a user tries to enable VFs on a device, when kernel and
driver are built with CONFIG_PCI_IOV=n, the kernel reports an error
message saying that the driver does not support SRIOV configuration via
sysfs.

Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
 drivers/crypto/qat/qat_4xxx/adf_drv.c          | 2 ++
 drivers/crypto/qat/qat_c3xxx/adf_drv.c         | 2 ++
 drivers/crypto/qat/qat_c62x/adf_drv.c          | 2 ++
 drivers/crypto/qat/qat_common/adf_common_drv.h | 5 -----
 drivers/crypto/qat/qat_dh895xcc/adf_drv.c      | 2 ++
 5 files changed, 8 insertions(+), 5 deletions(-)

Comments

Herbert Xu June 3, 2021, 12:15 p.m. UTC | #1
On Thu, May 27, 2021 at 08:12:43PM +0100, Marco Chiappero wrote:
> Remove the empty implementation of sriov_configure() and set the

> sriov_configure member of the pci_driver structure to NULL.

> This way, if a user tries to enable VFs on a device, when kernel and

> driver are built with CONFIG_PCI_IOV=n, the kernel reports an error

> message saying that the driver does not support SRIOV configuration via

> sysfs.

> 

> Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>

> Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

> ---

>  drivers/crypto/qat/qat_4xxx/adf_drv.c          | 2 ++

>  drivers/crypto/qat/qat_c3xxx/adf_drv.c         | 2 ++

>  drivers/crypto/qat/qat_c62x/adf_drv.c          | 2 ++

>  drivers/crypto/qat/qat_common/adf_common_drv.h | 5 -----

>  drivers/crypto/qat/qat_dh895xcc/adf_drv.c      | 2 ++

>  5 files changed, 8 insertions(+), 5 deletions(-)

> 

> diff --git a/drivers/crypto/qat/qat_4xxx/adf_drv.c b/drivers/crypto/qat/qat_4xxx/adf_drv.c

> index a8805c815d16..b77290d3da10 100644

> --- a/drivers/crypto/qat/qat_4xxx/adf_drv.c

> +++ b/drivers/crypto/qat/qat_4xxx/adf_drv.c

> @@ -309,7 +309,9 @@ static struct pci_driver adf_driver = {

>  	.name = ADF_4XXX_DEVICE_NAME,

>  	.probe = adf_probe,

>  	.remove = adf_remove,

> +#ifdef CONFIG_PCI_IOV

>  	.sriov_configure = adf_sriov_configure,

> +#endif


How about #defining adf_sriov_configure to NULL?

Cheers,
-- 
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
Marco Chiappero June 4, 2021, 9:23 a.m. UTC | #2
> -----Original Message-----

> From: Herbert Xu <herbert@gondor.apana.org.au>

> Sent: Thursday, June 3, 2021 1:16 PM

> To: Chiappero, Marco <marco.chiappero@intel.com>

> Cc: linux-crypto@vger.kernel.org; qat-linux <qat-linux@intel.com>; Cabiddu,

> Giovanni <giovanni.cabiddu@intel.com>

> Subject: Re: [PATCH 02/10] crypto: qat - remove empty sriov_configure()

> 

> On Thu, May 27, 2021 at 08:12:43PM +0100, Marco Chiappero wrote:

> > Remove the empty implementation of sriov_configure() and set the

> > sriov_configure member of the pci_driver structure to NULL.

> > This way, if a user tries to enable VFs on a device, when kernel and

> > driver are built with CONFIG_PCI_IOV=n, the kernel reports an error

> > message saying that the driver does not support SRIOV configuration

> > via sysfs.

> >

> > Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>

> > Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

> > Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

> > ---

> >  drivers/crypto/qat/qat_4xxx/adf_drv.c          | 2 ++

> >  drivers/crypto/qat/qat_c3xxx/adf_drv.c         | 2 ++

> >  drivers/crypto/qat/qat_c62x/adf_drv.c          | 2 ++

> >  drivers/crypto/qat/qat_common/adf_common_drv.h | 5 -----

> >  drivers/crypto/qat/qat_dh895xcc/adf_drv.c      | 2 ++

> >  5 files changed, 8 insertions(+), 5 deletions(-)

> >

> > diff --git a/drivers/crypto/qat/qat_4xxx/adf_drv.c

> > b/drivers/crypto/qat/qat_4xxx/adf_drv.c

> > index a8805c815d16..b77290d3da10 100644

> > --- a/drivers/crypto/qat/qat_4xxx/adf_drv.c

> > +++ b/drivers/crypto/qat/qat_4xxx/adf_drv.c

> > @@ -309,7 +309,9 @@ static struct pci_driver adf_driver = {

> >  	.name = ADF_4XXX_DEVICE_NAME,

> >  	.probe = adf_probe,

> >  	.remove = adf_remove,

> > +#ifdef CONFIG_PCI_IOV

> >  	.sriov_configure = adf_sriov_configure,

> > +#endif

> 

> How about #defining adf_sriov_configure to NULL?

 
OK, looks good to me.

Best regards,
Marco
diff mbox series

Patch

diff --git a/drivers/crypto/qat/qat_4xxx/adf_drv.c b/drivers/crypto/qat/qat_4xxx/adf_drv.c
index a8805c815d16..b77290d3da10 100644
--- a/drivers/crypto/qat/qat_4xxx/adf_drv.c
+++ b/drivers/crypto/qat/qat_4xxx/adf_drv.c
@@ -309,7 +309,9 @@  static struct pci_driver adf_driver = {
 	.name = ADF_4XXX_DEVICE_NAME,
 	.probe = adf_probe,
 	.remove = adf_remove,
+#ifdef CONFIG_PCI_IOV
 	.sriov_configure = adf_sriov_configure,
+#endif
 };
 
 module_pci_driver(adf_driver);
diff --git a/drivers/crypto/qat/qat_c3xxx/adf_drv.c b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
index 7fb3343ae8b0..70be2383dce2 100644
--- a/drivers/crypto/qat/qat_c3xxx/adf_drv.c
+++ b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
@@ -32,7 +32,9 @@  static struct pci_driver adf_driver = {
 	.name = ADF_C3XXX_DEVICE_NAME,
 	.probe = adf_probe,
 	.remove = adf_remove,
+#ifdef CONFIG_PCI_IOV
 	.sriov_configure = adf_sriov_configure,
+#endif
 };
 
 static void adf_cleanup_pci_dev(struct adf_accel_dev *accel_dev)
diff --git a/drivers/crypto/qat/qat_c62x/adf_drv.c b/drivers/crypto/qat/qat_c62x/adf_drv.c
index 1f5de442e1e6..ab03acb06365 100644
--- a/drivers/crypto/qat/qat_c62x/adf_drv.c
+++ b/drivers/crypto/qat/qat_c62x/adf_drv.c
@@ -32,7 +32,9 @@  static struct pci_driver adf_driver = {
 	.name = ADF_C62X_DEVICE_NAME,
 	.probe = adf_probe,
 	.remove = adf_remove,
+#ifdef CONFIG_PCI_IOV
 	.sriov_configure = adf_sriov_configure,
+#endif
 };
 
 static void adf_cleanup_pci_dev(struct adf_accel_dev *accel_dev)
diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h
index c61476553728..0150fce09600 100644
--- a/drivers/crypto/qat/qat_common/adf_common_drv.h
+++ b/drivers/crypto/qat/qat_common/adf_common_drv.h
@@ -205,11 +205,6 @@  void adf_exit_pf_wq(void);
 int adf_init_vf_wq(void);
 void adf_exit_vf_wq(void);
 #else
-static inline int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
-{
-	return 0;
-}
-
 static inline void adf_disable_sriov(struct adf_accel_dev *accel_dev)
 {
 }
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
index a9ec4357144c..31dd2a8e32b0 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
@@ -32,7 +32,9 @@  static struct pci_driver adf_driver = {
 	.name = ADF_DH895XCC_DEVICE_NAME,
 	.probe = adf_probe,
 	.remove = adf_remove,
+#ifdef CONFIG_PCI_IOV
 	.sriov_configure = adf_sriov_configure,
+#endif
 };
 
 static void adf_cleanup_pci_dev(struct adf_accel_dev *accel_dev)