Organize the format of zsda compress, including the location of macros and the format of some code comments, etc. Signed-off-by: Hanxiao Li --- drivers/common/zsda/zsda_device.h | 4 +-- drivers/common/zsda/zsda_qp.h | 48 +++++++++++++-------------- drivers/common/zsda/zsda_qp_common.h | 43 +++++++++++------------- drivers/compress/zsda/zsda_comp_pmd.c | 5 +-- drivers/compress/zsda/zsda_comp_pmd.h | 11 ++++-- 5 files changed, 56 insertions(+), 55 deletions(-) diff --git a/drivers/common/zsda/zsda_device.h b/drivers/common/zsda/zsda_device.h index dd0fa35ba6..245579359d 100644 --- a/drivers/common/zsda/zsda_device.h +++ b/drivers/common/zsda/zsda_device.h @@ -8,7 +8,7 @@ #include "zsda_qp_common.h" #include "zsda_comp_pmd.h" -#define MAX_QPS_ON_FUNCTION 128 +#define MAX_QPS_ON_FUNCTION 128 #define ZSDA_DEV_NAME_MAX_LEN 64 struct zsda_device_info { @@ -39,8 +39,8 @@ struct zsda_qp_hw { struct zsda_qp_hw_data data[MAX_QPS_ON_FUNCTION]; }; +/* Data used by all services */ struct zsda_pci_device { - /* Data used by all services */ char name[ZSDA_DEV_NAME_MAX_LEN]; /**< Name of zsda pci device */ uint8_t zsda_dev_id; diff --git a/drivers/common/zsda/zsda_qp.h b/drivers/common/zsda/zsda_qp.h index 486474ee70..4dbefe7bbd 100644 --- a/drivers/common/zsda/zsda_qp.h +++ b/drivers/common/zsda/zsda_qp.h @@ -9,43 +9,43 @@ #include "zsda_device.h" -#define ZSDA_ADMIN_Q_START 0x100 -#define ZSDA_ADMIN_Q_STOP 0x100 +#define ZSDA_ADMIN_Q_START 0x100 +#define ZSDA_ADMIN_Q_STOP 0x100 #define ZSDA_ADMIN_Q_STOP_RESP 0x104 -#define ZSDA_ADMIN_Q_CLR 0x108 +#define ZSDA_ADMIN_Q_CLR 0x108 #define ZSDA_ADMIN_Q_CLR_RESP 0x10C -#define ZSDA_IO_Q_START 0x200 -#define ZSDA_IO_Q_STOP 0x200 -#define ZSDA_IO_Q_STOP_RESP 0x400 -#define ZSDA_IO_Q_CLR 0x600 -#define ZSDA_IO_Q_CLR_RESP 0x800 +#define ZSDA_IO_Q_START 0x200 +#define ZSDA_IO_Q_STOP 0x200 +#define ZSDA_IO_Q_STOP_RESP 0x400 +#define ZSDA_IO_Q_CLR 0x600 +#define ZSDA_IO_Q_CLR_RESP 0x800 -#define ZSDA_ADMIN_WQ 0x40 -#define ZSDA_ADMIN_WQ_BASE7 0x5C -#define ZSDA_ADMIN_WQ_CRC 0x5C +#define ZSDA_ADMIN_WQ 0x40 +#define ZSDA_ADMIN_WQ_BASE7 0x5C +#define ZSDA_ADMIN_WQ_CRC 0x5C #define ZSDA_ADMIN_WQ_VERSION 0x5D -#define ZSDA_ADMIN_WQ_FLAG 0x5E -#define ZSDA_ADMIN_CQ 0x60 -#define ZSDA_ADMIN_CQ_BASE7 0x7C -#define ZSDA_ADMIN_CQ_CRC 0x7C +#define ZSDA_ADMIN_WQ_FLAG 0x5E +#define ZSDA_ADMIN_CQ 0x60 +#define ZSDA_ADMIN_CQ_BASE7 0x7C +#define ZSDA_ADMIN_CQ_CRC 0x7C #define ZSDA_ADMIN_CQ_VERSION 0x7D -#define ZSDA_ADMIN_CQ_FLAG 0x7E -#define ZSDA_ADMIN_WQ_TAIL 0x80 -#define ZSDA_ADMIN_CQ_HEAD 0x84 +#define ZSDA_ADMIN_CQ_FLAG 0x7E +#define ZSDA_ADMIN_WQ_TAIL 0x80 +#define ZSDA_ADMIN_CQ_HEAD 0x84 #define ZSDA_Q_START 0x1 -#define ZSDA_Q_STOP 0x0 +#define ZSDA_Q_STOP 0x0 #define ZSDA_CLEAR_VALID 0x1 #define ZSDA_CLEAR_INVALID 0x0 #define ZSDA_RESP_VALID 0x1 #define ZSDA_RESP_INVALID 0x0 -#define ADMIN_BUF_DATA_LEN 0x1C -#define ADMIN_BUF_TOTAL_LEN 0x20 +#define ADMIN_BUF_DATA_LEN 0x1C +#define ADMIN_BUF_TOTAL_LEN 0x20 #define IO_DB_INITIAL_CONFIG 0x1C00 -#define SET_CYCLE 0xff +#define SET_CYCLE 0xff #define SET_HEAD_INTI 0x0 #define ZSDA_TIME_SLEEP_US 100 @@ -55,8 +55,8 @@ #define WQ_CSR_UBASE 0x1004 #define CQ_CSR_LBASE 0x1400 #define CQ_CSR_UBASE 0x1404 -#define WQ_TAIL 0x1800 -#define CQ_HEAD 0x1804 +#define WQ_TAIL 0x1800 +#define CQ_HEAD 0x1804 /* CSR write macro */ #define ZSDA_CSR_WR(csrAddr, csrOffset, val) \ diff --git a/drivers/common/zsda/zsda_qp_common.h b/drivers/common/zsda/zsda_qp_common.h index 941278c6d2..ffa1959c78 100644 --- a/drivers/common/zsda/zsda_qp_common.h +++ b/drivers/common/zsda/zsda_qp_common.h @@ -16,10 +16,10 @@ #include "bus_pci_driver.h" #include "zsda_logs.h" -#define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES +#define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES -#define ZSDA_SUCCESS 0 -#define ZSDA_FAILED (-1) +#define ZSDA_SUCCESS 0 +#define ZSDA_FAILED (-1) enum zsda_service_type { ZSDA_SERVICE_COMPRESSION = 0, @@ -33,21 +33,16 @@ enum zsda_service_type { #define ZSDA_CSR_READ8(addr) rte_read8((addr)) #define ZSDA_CSR_WRITE8(addr, value) rte_write8_relaxed((value), (addr)) -#define NB_DES 512 -#define ZSDA_SGL_MAX_NUMBER 512 -#define COMP_REMOVE_SPACE_LEN 16 +#define NB_DES 512 +#define ZSDA_SGL_MAX_NUMBER 512 +#define COMP_REMOVE_SPACE_LEN 16 #define ZSDA_MAX_DESC 512 #define ZSDA_MAX_CYCLE 256 #define ZSDA_MAX_DEV RTE_PMD_ZSDA_MAX_PCI_DEVICES -#define MAX_NUM_OPS 0x1FF +#define MAX_NUM_OPS 0x1FF #define ZSDA_SGL_FRAGMENT_SIZE 32 - -#define ZSDA_OPC_COMP_GZIP 0x10 /* Encomp deflate-Gzip */ -#define ZSDA_OPC_COMP_ZLIB 0x11 /* Encomp deflate-Zlib */ -#define ZSDA_OPC_DECOMP_GZIP 0x18 /* Decomp inflate-Gzip */ -#define ZSDA_OPC_DECOMP_ZLIB 0x19 /* Decomp inflate-Zlib */ -#define ZSDA_OPC_INVALID 0xff +#define ZSDA_OPC_INVALID 0xFF #define CQE_VALID(value) (value & 0x8000) #define CQE_ERR0(value) (value & 0xFFFF) @@ -96,10 +91,10 @@ struct __rte_packed_begin zsda_admin_resp_qcfg { struct zsda_queue { char memz_name[RTE_MEMZONE_NAMESIZE]; uint8_t *io_addr; - uint8_t *base_addr; /* Base address */ - rte_iova_t base_phys_addr; /* Queue physical address */ - uint16_t head; /* Shadow copy of the head */ - uint16_t tail; /* Shadow copy of the tail */ + uint8_t *base_addr; /**< Base address */ + rte_iova_t base_phys_addr; /**< Queue physical address */ + uint16_t head; /**< Shadow copy of the head */ + uint16_t tail; /**< Shadow copy of the tail */ uint16_t modulo_mask; uint16_t msg_size; uint16_t queue_size; @@ -107,27 +102,27 @@ struct zsda_queue { uint16_t pushed_wqe; uint8_t hw_queue_number; - uint32_t csr_head; /* last written head value */ - uint32_t csr_tail; /* last written tail value */ + uint32_t csr_head; /**< last written head value */ + uint32_t csr_tail; /**< last written tail value */ uint8_t valid; uint16_t sid; }; struct zsda_qp_stat { - /**< Count of all operations enqueued */ uint64_t enqueued_count; - /**< Count of all operations dequeued */ + /**< Count of all operations enqueued */ uint64_t dequeued_count; + /**< Count of all operations dequeued */ - /**< Total error count on operations enqueued */ uint64_t enqueue_err_count; - /**< Total error count on operations dequeued */ + /**< Total error count on operations enqueued */ uint64_t dequeue_err_count; + /**< Total error count on operations dequeued */ }; struct __rte_packed_begin zsda_cqe { - uint8_t valid; /* cqe_cycle */ + uint8_t valid; /**< cqe_cycle */ uint8_t op_code; uint16_t sid; uint8_t state; diff --git a/drivers/compress/zsda/zsda_comp_pmd.c b/drivers/compress/zsda/zsda_comp_pmd.c index e4d0600c0b..88dab9b3e5 100644 --- a/drivers/compress/zsda/zsda_comp_pmd.c +++ b/drivers/compress/zsda/zsda_comp_pmd.c @@ -282,7 +282,6 @@ zsda_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, } static struct rte_compressdev_ops compress_zsda_ops = { - .dev_configure = zsda_comp_dev_config, .dev_start = zsda_comp_dev_start, .dev_stop = zsda_comp_dev_stop, @@ -305,7 +304,9 @@ static struct rte_compressdev_ops compress_zsda_ops = { */ static const char zsda_comp_drv_name[] = RTE_STR(COMPRESSDEV_NAME_ZSDA_PMD); static const struct rte_driver compdev_zsda_driver = { - .name = zsda_comp_drv_name, .alias = zsda_comp_drv_name}; + .name = zsda_comp_drv_name, + .alias = zsda_comp_drv_name +}; static uint16_t zsda_comp_pmd_enqueue_op_burst(void *qp, struct rte_comp_op **ops, diff --git a/drivers/compress/zsda/zsda_comp_pmd.h b/drivers/compress/zsda/zsda_comp_pmd.h index 1e691d7cc6..92c44079ef 100644 --- a/drivers/compress/zsda/zsda_comp_pmd.h +++ b/drivers/compress/zsda/zsda_comp_pmd.h @@ -9,9 +9,14 @@ #include "zsda_qp.h" -/**< ZSDA Compression PMD driver name */ +/* ZSDA Compression PMD driver name */ #define COMPRESSDEV_NAME_ZSDA_PMD compress_zsda +#define ZSDA_OPC_COMP_GZIP 0x10 /**< Encomp deflate-Gzip */ +#define ZSDA_OPC_COMP_ZLIB 0x11 /**< Encomp deflate-Zlib */ +#define ZSDA_OPC_DECOMP_GZIP 0x18 /**< Decomp inflate-Gzip */ +#define ZSDA_OPC_DECOMP_ZLIB 0x19 /**< Decomp inflate-Zlib */ + /** private data structure for a ZSDA compression device. * This ZSDA device is a device offering only a compression service, * there can be one of these on each zsda_pci_device (VF). @@ -22,11 +27,11 @@ struct zsda_comp_dev_private { struct rte_compressdev *compressdev; /**< The pointer to this compression device structure */ const struct rte_compressdev_capabilities *zsda_dev_capabilities; - /* ZSDA device compression capabilities */ + /**< ZSDA device compression capabilities */ struct rte_mempool *xformpool; /**< The device's pool for zsda_comp_xforms */ const struct rte_memzone *capa_mz; - /* Shared memzone for storing capabilities */ + /**< Shared memzone for storing capabilities */ }; struct zsda_comp_xform { -- 2.27.0