[v3] drivers/qat: fix failure to create PMD

Message ID 1539278045-28391-1-git-send-email-fiona.trahe@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v3] drivers/qat: fix failure to create PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Fiona Trahe Oct. 11, 2018, 5:14 p.m. UTC
  If QAT crypto pmd failed to be created due to reaching MAX
cryptodevs it prevented QAT comp PMD being created. And vice versa.
Change to warning in these cases and allow the other PMD to be created.

Fixes: c0c90bc4cade ("compress/qat: add create and destroy functions")
Cc: stable@dpdk.org

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
v3 changes:
 - moved checks up a layer to the probe fn as more appropriate place.

v2 changes:
 - clarified documentation

 drivers/common/qat/qat_device.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)
  

Comments

Cel, TomaszX Oct. 11, 2018, 5:27 p.m. UTC | #1
> -----Original Message-----
> From: Trahe, Fiona
> Sent: Thursday, October 11, 2018 7:14 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; stable@dpdk.org; Jozwiak, TomaszX
> <tomaszx.jozwiak@intel.com>; Cel, TomaszX <tomaszx.cel@intel.com>;
> Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH v3] drivers/qat: fix failure to create PMD
> 
> If QAT crypto pmd failed to be created due to reaching MAX cryptodevs it
> prevented QAT comp PMD being created. And vice versa.
> Change to warning in these cases and allow the other PMD to be created.
> 
> Fixes: c0c90bc4cade ("compress/qat: add create and destroy functions")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> ---
> v3 changes:
>  - moved checks up a layer to the probe fn as more appropriate place.
> 
> v2 changes:
>  - clarified documentation
> 
>  drivers/common/qat/qat_device.c | 33 ++++++++++++++++++++++---------
> --
>  1 file changed, 22 insertions(+), 11 deletions(-)

Acked-by: Tomasz Cel <tomaszx.cel@intel.com>
  
Akhil Goyal Oct. 16, 2018, 2:37 p.m. UTC | #2
On 10/11/2018 10:57 PM, Cel, TomaszX wrote:
>> -----Original Message-----
>> From: Trahe, Fiona
>> Sent: Thursday, October 11, 2018 7:14 PM
>> To: dev@dpdk.org
>> Cc: akhil.goyal@nxp.com; stable@dpdk.org; Jozwiak, TomaszX
>> <tomaszx.jozwiak@intel.com>; Cel, TomaszX <tomaszx.cel@intel.com>;
>> Trahe, Fiona <fiona.trahe@intel.com>
>> Subject: [PATCH v3] drivers/qat: fix failure to create PMD
>>
>> If QAT crypto pmd failed to be created due to reaching MAX cryptodevs it
>> prevented QAT comp PMD being created. And vice versa.
>> Change to warning in these cases and allow the other PMD to be created.
>>
>> Fixes: c0c90bc4cade ("compress/qat: add create and destroy functions")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
>> ---
>> v3 changes:
>>   - moved checks up a layer to the probe fn as more appropriate place.
>>
>> v2 changes:
>>   - clarified documentation
>>
>>   drivers/common/qat/qat_device.c | 33 ++++++++++++++++++++++---------
>> --
>>   1 file changed, 22 insertions(+), 11 deletions(-)
> Acked-by: Tomasz Cel <tomaszx.cel@intel.com>
Applied to dpdk-next-crypto

Thanks
  

Patch

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index b158fb9..6e64e22 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -196,6 +196,7 @@  static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		struct rte_pci_device *pci_dev)
 {
 	int ret = 0;
+	int num_pmds_created = 0;
 	struct qat_pci_device *qat_pci_dev;
 
 	QAT_LOG(DEBUG, "Found QAT device at %02x:%02x.%x",
@@ -208,23 +209,33 @@  static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		return -ENODEV;
 
 	ret = qat_sym_dev_create(qat_pci_dev);
-	if (ret != 0)
-		goto error_out;
+	if (ret == 0)
+		num_pmds_created++;
+	else
+		QAT_LOG(WARNING,
+				"Failed to create QAT SYM PMD on device %s",
+				qat_pci_dev->name);
 
 	ret = qat_comp_dev_create(qat_pci_dev);
-	if (ret != 0)
-		goto error_out;
+	if (ret == 0)
+		num_pmds_created++;
+	else
+		QAT_LOG(WARNING,
+				"Failed to create QAT COMP PMD on device %s",
+				qat_pci_dev->name);
 
 	ret = qat_asym_dev_create(qat_pci_dev);
-	if (ret != 0)
-		goto error_out;
+	if (ret == 0)
+		num_pmds_created++;
+	else
+		QAT_LOG(WARNING,
+				"Failed to create QAT ASYM PMD on device %s",
+				qat_pci_dev->name);
 
-	return 0;
-
-error_out:
-	qat_pci_dev_destroy(qat_pci_dev, pci_dev);
-	return ret;
+	if (num_pmds_created == 0)
+		qat_pci_dev_destroy(qat_pci_dev, pci_dev);
 
+	return 0;
 }
 
 static int qat_pci_remove(struct rte_pci_device *pci_dev)