Add zsda compressdev driver interface skeleton<br /> <br />Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn> <br />---<br /> MAINTAINERS                               |   3 +<br /> doc/guides/compressdevs/features/zsda.ini |   6 +<br /> doc/guides/compressdevs/index.rst         |   1 +<br /> doc/guides/compressdevs/zsda.rst          | 178 ++++++++++++++++++++++<br /> drivers/common/zsda/meson.build           |  12 +-<br /> drivers/common/zsda/zsda_device.h         |  12 +-<br /> drivers/common/zsda/zsda_qp.c             |  30 +++-<br /> drivers/common/zsda/zsda_qp.h             |  14 +-<br /> drivers/common/zsda/zsda_qp_common.h      |   7 +<br /> drivers/compress/zsda/zsda_comp_pmd.c     | 128 ++++++++++++++++<br /> drivers/compress/zsda/zsda_comp_pmd.h     |  37 +++++<br /> 11 files changed, 416 insertions(+), 12 deletions(-)<br /> create mode 100644 doc/guides/compressdevs/features/zsda.ini<br /> create mode 100644 doc/guides/compressdevs/zsda.rst<br /> create mode 100644 drivers/compress/zsda/zsda_comp_pmd.c<br /> create mode 100644 drivers/compress/zsda/zsda_comp_pmd.h<br /> <br />diff --git a/MAINTAINERS b/MAINTAINERS<br />index 0318d7357c..dc3fa2097a 100644<br />--- a/MAINTAINERS<br />+++ b/MAINTAINERS<br />@@ -1271,6 +1271,9 @@ F: doc/guides/compressdevs/features/zlib.ini<br /> ZTE Storage Data Accelerator(ZSDA)<br /> M: Hanxiao Li <li.hanxiao@zte.com.cn> <br /> F: drivers/common/zsda/<br />+F: drivers/compress/zsda/<br />+F: doc/guides/compressdevs/zsda.rst<br />+F: doc/guides/compressdevs/features/zsda.ini<br />  <br /> DMAdev Drivers<br /> --------------<br />diff --git a/doc/guides/compressdevs/features/zsda.ini b/doc/guides/compressdevs/features/zsda.ini<br />new file mode 100644<br />index 0000000000..5cc9a3b1a6<br />--- /dev/null<br />+++ b/doc/guides/compressdevs/features/zsda.ini<br />@@ -0,0 +1,6 @@<br />+;<br />+; Refer to default.ini for the full list of available PMD features.<br />+;<br />+; Supported features of 'ZSDA' compression driver.<br />+;<br />+[Features]<br />diff --git a/doc/guides/compressdevs/index.rst b/doc/guides/compressdevs/index.rst<br />index 87ed4f72a4..bab226ffbc 100644<br />--- a/doc/guides/compressdevs/index.rst<br />+++ b/doc/guides/compressdevs/index.rst<br />@@ -17,3 +17,4 @@ Compression Device Drivers<br />     qat_comp<br />     uadk<br />     zlib<br />+    zsda<br />diff --git a/doc/guides/compressdevs/zsda.rst b/doc/guides/compressdevs/zsda.rst<br />new file mode 100644<br />index 0000000000..c02423d650<br />--- /dev/null<br />+++ b/doc/guides/compressdevs/zsda.rst<br />@@ -0,0 +1,178 @@<br />+..  SPDX-License-Identifier: BSD-3-Clause<br />+    Copyright(c) 2024 ZTE Corporation.<br />+<br />+ZTE Storage Data Accelerator (ZSDA) Poll Mode Driver<br />+=======================================================<br />+<br />+The ZSDA compression PMD provides poll mode compression & decompression driver<br />+support for the following hardware accelerator devices:<br />+<br />+* ``ZTE Processing accelerators 1cf2``<br />+<br />+<br />+Features<br />+--------<br />+<br />+<br />+Installation<br />+------------<br />+<br />+The ZSDA compression PMD is built by default with a standard DPDK build.<br />+<br />+It depends on a ZSDA kernel driver, see :ref:`building_zsda`.<br />+<br />+<br />+.. _building_zsda:<br />+<br />+Building PMDs on ZSDA<br />+---------------------<br />+<br />+A ZSDA device can host multiple acceleration services:<br />+<br />+* data compression<br />+<br />+These services are provided to DPDK applications via PMDs which register to<br />+implement the compressdev APIs. The PMDs use common ZSDA driver code<br />+which manages the ZSDA PCI device.<br />+<br />+<br />+Configuring and Building the DPDK ZSDA PMDs<br />+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />+<br />+Further information on configuring, building and installing DPDK is described<br />+:doc:`here <../linux_gsg/build_dpdk>`.<br />+<br />+.. _building_zsda_config:<br />+<br />+Build Configuration<br />+~~~~~~~~~~~~~~~~~~~<br />+These is the build configuration options affecting ZSDA, and its default values:<br />+<br />+.. code-block:: console<br />+<br />+    RTE_PMD_ZSDA_MAX_PCI_DEVICES=256<br />+<br />+<br />+Device and driver naming<br />+~~~~~~~~~~~~~~~~~~~~~~~~<br />+<br />+* The zsda compressdev driver name is "compress_zsda".<br />+  The rte_compressdev_devices_get() returns the devices exposed by this driver.<br />+<br />+* Each zsda compression device has a unique name, in format<br />+  <pci bdf>, e.g. "0000:cc:00.3_zsda".<br />+  This name can be passed to rte_compressdev_get_dev_id() to get the device_id.<br />+<br />+<br />+Enable VFs<br />+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />+<br />+Instructions for installation are below, but first an explanation of the<br />+relationships between the PF/VF devices and the PMDs visible to<br />+DPDK applications.<br />+<br />+Each ZSDA PF device exposes a number of VF devices. Each VF device can<br />+enable one compressdev PMD.<br />+<br />+These ZSDA PMDs share the same underlying device and pci-mgmt code, but are<br />+enumerated independently on their respective APIs and appear as independent<br />+devices to applications.<br />+<br />+.. Note::<br />+<br />+   Each VF can only be used by one DPDK process. It is not possible to share<br />+   the same VF across multiple processes, even if these processes are using<br />+   different acceleration services.<br />+   Conversely one DPDK process can use one or more ZSDA VFs and can expose<br />+   compressdev instances on each of those VFs.<br />+<br />+<br />+The examples below are based on the 1cf2 device, if you have a different device<br />+use the corresponding values in the above table.<br />+<br />+In BIOS ensure that SRIOV is enabled and either:<br />+<br />+* Disable VT-d or<br />+* Enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file.<br />+<br />+you need to expose the Virtual Functions (VFs) using the sysfs file system.<br />+<br />+First find the BDFs (Bus-Device-Function) of the physical functions (PFs) of<br />+your device, e.g.::<br />+<br />+    lspci -d:8050<br />+<br />+You should see output similar to::<br />+<br />+<br />+    cc:00.4 Processing accelerators: Device 1cf2:8050 (rev 01)<br />+    ce:00.3 Processing accelerators: Device 1cf2:8050 (rev 01)<br />+    d0:00.3 Processing accelerators: Device 1cf2:8050 (rev 01)<br />+    d2:00.3 Processing accelerators: Device 1cf2:8050 (rev 01)<br />+<br />+Enable the VFs for each PF by echoing the number of VFs per PF to the pci driver::<br />+<br />+     echo 31 > /sys/bus/pci/device/0000:cc:00.4/sriov_numvfs<br />+     echo 31 > /sys/bus/pci/device/0000:ce:00.3/sriov_numvfs<br />+     echo 31 > /sys/bus/pci/device/0000:d0:00.3/sriov_numvfs<br />+     echo 31 > /sys/bus/pci/device/0000:d2:00.3/sriov_numvfs<br />+<br />+Check that the VFs are available for use. For example ``lspci -d:8051`` should<br />+list 124 VF devices available.<br />+<br />+To complete the installation follow the instructions in<br />+`Binding the available VFs to the vfio-pci driver`_.<br />+<br />+.. Note::<br />+<br />+   If you see the following warning in ``/var/log/messages`` it can be ignored:<br />+   ``IOMMU should be enabled for SR-IOV to work correctly``.<br />+<br />+<br />+Binding the available VFs to the vfio-pci driver<br />+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />+<br />+Note:<br />+<br />+* Please note that due to security issues, the usage of older DPDK igb_uio<br />+  driver is not recommended. This document shows how to use the more secure<br />+  vfio-pci driver.<br />+<br />+Unbind the VFs from the stock driver so they can be bound to the vfio-pci driver.<br />+<br />+<br />+Bind to the vfio-pci driver<br />+^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />+<br />+Load the vfio-pci driver, bind the VF PCI Device id to it using the<br />+``dpdk-devbind.py`` script then use the ``--status`` option<br />+to confirm the VF devices are now in use by vfio-pci kernel driver,<br />+e.g. for the 1cf2 device::<br />+<br />+    cd to the top-level DPDK directory<br />+    modprobe vfio-pci<br />+    usertools/dpdk-devbind.py -b vfio-pci 0000:cc:01.4<br />+    usertools/dpdk-devbind.py --status<br />+<br />+Use ``modprobe vfio-pci disable_denylist=1`` from kernel 5.9 onwards.<br />+See note in the section `Binding the available VFs to the vfio-pci driver`_<br />+above.<br />+<br />+<br />+Testing<br />+~~~~~~~<br />+<br />+ZSDA compression PMD can be tested by running the test application::<br />+<br />+    cd ./<build_dir>/app/test<br />+    ./dpdk-test -l1 -n1 -a <your zsda bdf> <br />+    RTE>>compressdev_autotest<br />+<br />+<br />+Debugging<br />+~~~~~~~~~<br />+<br />+ZSDA logging feature can be enabled using the log-level option (where 8=maximum<br />+log level) on the process cmdline, e.g. using any of the following::<br />+<br />+    --log-level="gen,8" <br />diff --git a/drivers/common/zsda/meson.build b/drivers/common/zsda/meson.build<br />index 4c910d7e7d..6ee2a68f4b 100644<br />--- a/drivers/common/zsda/meson.build<br />+++ b/drivers/common/zsda/meson.build<br />@@ -7,9 +7,19 @@ if is_windows<br />     subdir_done()<br /> endif<br />  <br />-deps += ['bus_pci', 'mbuf']<br />+deps += ['bus_pci', 'mbuf', 'compressdev']<br /> sources += files(<br />         'zsda_device.c',<br />         'zsda_logs.c',<br />         'zsda_qp.c',<br />         )<br />+<br />+zsda_compress = true<br />+zsda_compress_path = 'compress/zsda' <br />+zsda_compress_relpath = '../../' + zsda_compress_path<br />+includes += include_directories(zsda_compress_relpath)<br />+if zsda_compress<br />+    foreach f: ['zsda_comp_pmd.c']<br />+        sources += files(join_paths(zsda_compress_relpath, f))<br />+    endforeach<br />+endif<br />diff --git a/drivers/common/zsda/zsda_device.h b/drivers/common/zsda/zsda_device.h<br />index 33a7fb0d9c..b744e8df2d 100644<br />--- a/drivers/common/zsda/zsda_device.h<br />+++ b/drivers/common/zsda/zsda_device.h<br />@@ -7,10 +7,10 @@<br />  <br /> #include <rte_memzone.h> <br /> #include "bus_pci_driver.h" <br />+#include "zsda_qp_common.h" <br />  <br /> #define MAX_QPS_ON_FUNCTION        128<br /> #define ZSDA_DEV_NAME_MAX_LEN    64<br />-#define ZSDA_MAX_SERVICES (0)<br /> #define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES<br />  <br /> struct zsda_device_info {<br />@@ -18,7 +18,11 @@ struct zsda_device_info {<br />     /**< mz to store the:  struct zsda_pci_device ,    so it can be<br />      * shared across processes<br />      */<br />-<br />+    struct rte_device comp_rte_dev;<br />+    /**< This represents the compression subset of this pci device.<br />+     * Register with this rather than with the one in<br />+     * pci_dev so that its driver can have a compression-specific name<br />+     */<br />     struct rte_pci_device *pci_dev;<br /> };<br />  <br />@@ -46,6 +50,10 @@ struct zsda_pci_device {<br />  <br />     struct rte_pci_device *pci_dev;<br />  <br />+    /* Data relating to compression service */<br />+    struct zsda_comp_dev_private *comp_dev;<br />+    /**< link back to compressdev private data */<br />+<br />     struct zsda_qp_hw zsda_hw_qps[ZSDA_MAX_SERVICES];<br />     uint16_t zsda_qp_hw_num[ZSDA_MAX_SERVICES];<br /> };<br />diff --git a/drivers/common/zsda/zsda_qp.c b/drivers/common/zsda/zsda_qp.c<br />index 0bb0f598b7..7e000d5b3f 100644<br />--- a/drivers/common/zsda/zsda_qp.c<br />+++ b/drivers/common/zsda/zsda_qp.c<br />@@ -3,15 +3,12 @@<br />  */<br />  <br /> #include <stdint.h> <br />-<br />-#include <rte_malloc.h> <br />+#include <rte_mempool.h> <br />  <br /> #include "zsda_logs.h" <br />-#include "zsda_device.h" <br /> #include "zsda_qp.h" <br /> #include "zsda_qp_common.h" <br />  <br />-<br /> #define MAGIC_SEND 0xab<br /> #define MAGIC_RECV 0xcd<br /> #define ADMIN_VER 1<br />@@ -400,7 +397,8 @@ zsda_get_queue_cfg_by_id(const struct zsda_pci_device *zsda_pci_dev,<br /> }<br />  <br /> static struct ring_size zsda_qp_hw_ring_size[ZSDA_MAX_SERVICES] = {<br />-<br />+    [ZSDA_SERVICE_ENCOMPRESSION] = {32, 16},<br />+    [ZSDA_SERVICE_DECOMPRESSION] = {32, 16},<br /> };<br />  <br /> static int<br />@@ -468,6 +466,26 @@ zsda_unmask_flr(const struct zsda_pci_device *zsda_pci_dev)<br />     return ZSDA_SUCCESS;<br /> }<br />  <br />+static uint16_t<br />+zsda_qps_per_service(const struct zsda_pci_device *zsda_pci_dev,<br />+             const enum zsda_service_type service)<br />+{<br />+    uint16_t qp_hw_num = 0;<br />+<br />+    if (service < ZSDA_SERVICE_INVALID)<br />+        qp_hw_num = zsda_pci_dev->zsda_qp_hw_num[service];<br />+    return qp_hw_num;<br />+}<br />+<br />+struct zsda_num_qps zsda_nb_qps;<br />+static void<br />+zsda_get_nb_qps(const struct zsda_pci_device *zsda_pci_dev)<br />+{<br />+    zsda_nb_qps.encomp =<br />+        zsda_qps_per_service(zsda_pci_dev, ZSDA_SERVICE_ENCOMPRESSION);<br />+    zsda_nb_qps.decomp =<br />+        zsda_qps_per_service(zsda_pci_dev, ZSDA_SERVICE_DECOMPRESSION);<br />+}<br />  <br /> int<br /> zsda_queue_init(struct zsda_pci_device *zsda_pci_dev)<br />@@ -501,5 +519,7 @@ zsda_queue_init(struct zsda_pci_device *zsda_pci_dev)<br />         return ret;<br />     }<br />  <br />+    zsda_get_nb_qps(zsda_pci_dev);<br />+<br />     return ret;<br /> }<br />diff --git a/drivers/common/zsda/zsda_qp.h b/drivers/common/zsda/zsda_qp.h<br />index 1eb193e99c..194adbc1fa 100644<br />--- a/drivers/common/zsda/zsda_qp.h<br />+++ b/drivers/common/zsda/zsda_qp.h<br />@@ -5,6 +5,8 @@<br /> #ifndef _ZSDA_QP_H_<br /> #define _ZSDA_QP_H_<br />  <br />+#include "zsda_device.h" <br />+<br /> #define ZSDA_ADMIN_Q_START        0x100<br /> #define ZSDA_ADMIN_Q_STOP        0x100<br /> #define ZSDA_ADMIN_Q_STOP_RESP    0x104<br />@@ -72,10 +74,6 @@ enum zsda_admin_msg_id {<br />     ZSDA_ADMIN_INT_TEST<br /> };<br />  <br />-enum zsda_service_type {<br />-    ZSDA_SERVICE_INVALID,<br />-};<br />-<br /> struct ring_size {<br />     uint16_t tx_msg_size;<br />     uint16_t rx_msg_size;<br />@@ -118,7 +116,15 @@ struct zsda_admin_resp_qcfg {<br />     uint8_t data[14];<br /> } __rte_packed;<br />  <br />+struct zsda_num_qps {<br />+    uint16_t encomp;<br />+    uint16_t decomp;<br />+    uint16_t encrypt;<br />+    uint16_t decrypt;<br />+    uint16_t hash;<br />+};<br />  <br />+extern struct zsda_num_qps zsda_nb_qps;<br />  <br /> int zsda_queue_start(const struct rte_pci_device *pci_dev);<br /> int zsda_queue_stop(const struct rte_pci_device *pci_dev);<br />diff --git a/drivers/common/zsda/zsda_qp_common.h b/drivers/common/zsda/zsda_qp_common.h<br />index 9c09a227a3..a867268840 100644<br />--- a/drivers/common/zsda/zsda_qp_common.h<br />+++ b/drivers/common/zsda/zsda_qp_common.h<br />@@ -17,6 +17,13 @@<br /> #define ZSDA_SUCCESS            0<br /> #define ZSDA_FAILED                (-1)<br />  <br />+enum zsda_service_type {<br />+    ZSDA_SERVICE_ENCOMPRESSION = 0,<br />+    ZSDA_SERVICE_DECOMPRESSION = 1,<br />+    ZSDA_SERVICE_INVALID,<br />+};<br />+#define ZSDA_MAX_SERVICES (2)<br />+<br /> #define ZSDA_CSR_READ32(addr)          rte_read32((addr))<br /> #define ZSDA_CSR_WRITE32(addr, value) rte_write32((value), (addr))<br /> #define ZSDA_CSR_READ16(addr)          rte_read16((addr))<br />diff --git a/drivers/compress/zsda/zsda_comp_pmd.c b/drivers/compress/zsda/zsda_comp_pmd.c<br />new file mode 100644<br />index 0000000000..d1c33f448c<br />--- /dev/null<br />+++ b/drivers/compress/zsda/zsda_comp_pmd.c<br />@@ -0,0 +1,128 @@<br />+/* SPDX-License-Identifier: BSD-3-Clause<br />+ * Copyright(c) 2024 ZTE Corporation<br />+ */<br />+<br />+#include <rte_malloc.h> <br />+<br />+#include "zsda_logs.h" <br />+#include "zsda_qp_common.h" <br />+#include "zsda_comp_pmd.h" <br />+<br />+static struct rte_compressdev_ops compress_zsda_ops = {<br />+<br />+    .dev_configure = NULL,<br />+    .dev_start = NULL,<br />+    .dev_stop = NULL,<br />+    .dev_close = NULL,<br />+    .dev_infos_get = NULL,<br />+<br />+    .stats_get = NULL,<br />+    .stats_reset = NULL,<br />+    .queue_pair_setup = NULL,<br />+    .queue_pair_release = NULL,<br />+<br />+    .private_xform_create = NULL,<br />+    .private_xform_free = NULL<br />+};<br />+<br />+/* An rte_driver is needed in the registration of the device with compressdev.<br />+ * The actual zsda pci's rte_driver can't be used as its name represents<br />+ * the whole pci device with all services. Think of this as a holder for a name<br />+ * for the compression part of the pci device.<br />+ */<br />+static const char zsda_comp_drv_name[] = RTE_STR(COMPRESSDEV_NAME_ZSDA_PMD);<br />+static const struct rte_driver compdev_zsda_driver = {<br />+    .name = zsda_comp_drv_name, .alias = zsda_comp_drv_name};<br />+<br />+int<br />+zsda_comp_dev_create(struct zsda_pci_device *zsda_pci_dev)<br />+{<br />+    struct zsda_device_info *dev_info =<br />+        &zsda_devs[zsda_pci_dev->zsda_dev_id];<br />+<br />+    struct rte_compressdev_pmd_init_params init_params = {<br />+        .name = "",<br />+        .socket_id = (int)rte_socket_id(),<br />+    };<br />+<br />+    char name[RTE_COMPRESSDEV_NAME_MAX_LEN];<br />+    char capa_memz_name[RTE_COMPRESSDEV_NAME_MAX_LEN];<br />+    struct rte_compressdev *compressdev;<br />+    struct zsda_comp_dev_private *comp_dev;<br />+    const struct rte_compressdev_capabilities *capabilities;<br />+    uint16_t capa_size = sizeof(struct rte_compressdev_capabilities);<br />+<br />+    snprintf(name, RTE_COMPRESSDEV_NAME_MAX_LEN, "%s_%s",<br />+         zsda_pci_dev->name, "comp");<br />+<br />+    if (rte_eal_process_type() != RTE_PROC_PRIMARY)<br />+        return 0;<br />+<br />+    dev_info->comp_rte_dev.driver = &compdev_zsda_driver;<br />+    dev_info->comp_rte_dev.numa_node = dev_info->pci_dev->device.numa_node;<br />+    dev_info->comp_rte_dev.devargs = NULL;<br />+<br />+    compressdev = rte_compressdev_pmd_create(<br />+        name, &(dev_info->comp_rte_dev),<br />+        sizeof(struct zsda_comp_dev_private), &init_params);<br />+<br />+    if (compressdev == NULL)<br />+        return -ENODEV;<br />+<br />+    compressdev->dev_ops = &compress_zsda_ops;<br />+<br />+    compressdev->enqueue_burst = NULL;<br />+    compressdev->dequeue_burst = NULL;<br />+<br />+    compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED;<br />+<br />+    snprintf(capa_memz_name, RTE_COMPRESSDEV_NAME_MAX_LEN,<br />+         "ZSDA_COMP_CAPA");<br />+<br />+    comp_dev = compressdev->data->dev_private;<br />+    comp_dev->zsda_pci_dev = zsda_pci_dev;<br />+    comp_dev->compressdev = compressdev;<br />+<br />+    capabilities = NULL;<br />+<br />+    comp_dev->capa_mz = rte_memzone_lookup(capa_memz_name);<br />+    if (comp_dev->capa_mz == NULL) {<br />+        comp_dev->capa_mz = rte_memzone_reserve(<br />+            capa_memz_name, capa_size, rte_socket_id(), 0);<br />+    }<br />+    if (comp_dev->capa_mz == NULL) {<br />+        ZSDA_LOG(DEBUG, "Failed! comp_dev->capa_mz is NULL");<br />+        memset(&dev_info->comp_rte_dev, 0,<br />+               sizeof(dev_info->comp_rte_dev));<br />+        rte_compressdev_pmd_destroy(compressdev);<br />+        return -EFAULT;<br />+    }<br />+<br />+    memcpy(comp_dev->capa_mz->addr, capabilities, capa_size);<br />+    comp_dev->zsda_dev_capabilities = comp_dev->capa_mz->addr;<br />+<br />+    zsda_pci_dev->comp_dev = comp_dev;<br />+<br />+    return ZSDA_SUCCESS;<br />+}<br />+<br />+int<br />+zsda_comp_dev_destroy(struct zsda_pci_device *zsda_pci_dev)<br />+{<br />+    struct zsda_comp_dev_private *comp_dev;<br />+<br />+    if (zsda_pci_dev == NULL)<br />+        return -ENODEV;<br />+<br />+    comp_dev = zsda_pci_dev->comp_dev;<br />+    if (comp_dev == NULL)<br />+        return ZSDA_SUCCESS;<br />+<br />+    if (rte_eal_process_type() == RTE_PROC_PRIMARY)<br />+        rte_memzone_free(zsda_pci_dev->comp_dev->capa_mz);<br />+<br />+    rte_compressdev_pmd_destroy(comp_dev->compressdev);<br />+    zsda_pci_dev->comp_dev = NULL;<br />+<br />+    return ZSDA_SUCCESS;<br />+}<br />diff --git a/drivers/compress/zsda/zsda_comp_pmd.h b/drivers/compress/zsda/zsda_comp_pmd.h<br />new file mode 100644<br />index 0000000000..ef2c80ded4<br />--- /dev/null<br />+++ b/drivers/compress/zsda/zsda_comp_pmd.h<br />@@ -0,0 +1,37 @@<br />+/* SPDX-License-Identifier: BSD-3-Clause<br />+ * Copyright(c) 2024 ZTE Corporation<br />+ */<br />+<br />+#ifndef _ZSDA_COMP_PMD_H_<br />+#define _ZSDA_COMP_PMD_H_<br />+<br />+#include <rte_compressdev_pmd.h> <br />+<br />+#include "zsda_qp.h" <br />+#include "zsda_device.h" <br />+<br />+/**< ZSDA Compression PMD driver name */<br />+#define COMPRESSDEV_NAME_ZSDA_PMD compress_zsda<br />+<br />+/** private data structure for a ZSDA compression device.<br />+ * This ZSDA device is a device offering only a compression service,<br />+ * there can be one of these on each zsda_pci_device (VF).<br />+ */<br />+struct zsda_comp_dev_private {<br />+    struct zsda_pci_device *zsda_pci_dev;<br />+    /**< The zsda pci device hosting the service */<br />+    struct rte_compressdev *compressdev;<br />+    /**< The pointer to this compression device structure */<br />+    const struct rte_compressdev_capabilities *zsda_dev_capabilities;<br />+    /* ZSDA device compression capabilities */<br />+    struct rte_mempool *xformpool;<br />+    /**< The device's pool for zsda_comp_xforms */<br />+    const struct rte_memzone *capa_mz;<br />+    /* Shared memzone for storing capabilities */<br />+};<br />+<br />+int zsda_comp_dev_create(struct zsda_pci_device *zsda_pci_dev);<br />+<br />+int zsda_comp_dev_destroy(struct zsda_pci_device *zsda_pci_dev);<br />+<br />+#endif /* _ZSDA_COMP_PMD_H_ */<br />--  <br />2.27.0<br />