compress/qat: fix lacking memzone lookup
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Wed, 8 Jul 2020 09:44:01 +0000 (11:44 +0200)
committerAkhil Goyal <akhil.goyal@nxp.com>
Sat, 18 Jul 2020 21:09:01 +0000 (23:09 +0200)
Because capability memzone of compression does not have lookup
call, second and subsequent devices cannot be created.

Fixes: 7788dceccb80 ("common/qat: add multi-process handling of capabilities")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
drivers/compress/qat/qat_comp_pmd.c

index ecf972a..034abad 100644 (file)
@@ -726,9 +726,12 @@ qat_comp_dev_create(struct qat_pci_device *qat_pci_dev,
                break;
        }
 
-       comp_dev->capa_mz = rte_memzone_reserve(capa_memz_name,
-               capa_size,
-               rte_socket_id(), 0);
+       comp_dev->capa_mz = rte_memzone_lookup(capa_memz_name);
+       if (comp_dev->capa_mz == NULL) {
+               comp_dev->capa_mz = rte_memzone_reserve(capa_memz_name,
+                       capa_size,
+                       rte_socket_id(), 0);
+       }
        if (comp_dev->capa_mz == NULL) {
                QAT_LOG(DEBUG,
                        "Error allocating memzone for capabilities, destroying PMD for %s",