199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2017-2018 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_COMPRESSDEV_INTERNAL_H_ 699a2dd95SBruce Richardson #define _RTE_COMPRESSDEV_INTERNAL_H_ 799a2dd95SBruce Richardson 8ef64c2f3SBrian Dooley #ifdef __cplusplus 9ef64c2f3SBrian Dooley extern "C" { 10ef64c2f3SBrian Dooley #endif 11ef64c2f3SBrian Dooley 1299a2dd95SBruce Richardson /* rte_compressdev_internal.h 1399a2dd95SBruce Richardson * This file holds Compressdev private data structures. 1499a2dd95SBruce Richardson */ 1599a2dd95SBruce Richardson #include <rte_log.h> 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson #include "rte_comp.h" 1899a2dd95SBruce Richardson 1999a2dd95SBruce Richardson #define RTE_COMPRESSDEV_NAME_MAX_LEN (64) 2099a2dd95SBruce Richardson /**< Max length of name of comp PMD */ 2199a2dd95SBruce Richardson 2299a2dd95SBruce Richardson /* Logging Macros */ 2399a2dd95SBruce Richardson extern int compressdev_logtype; 2499a2dd95SBruce Richardson #define COMPRESSDEV_LOG(level, fmt, args...) \ 2599a2dd95SBruce Richardson rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \ 2699a2dd95SBruce Richardson __func__, ##args) 2799a2dd95SBruce Richardson 2899a2dd95SBruce Richardson /** 2999a2dd95SBruce Richardson * Dequeue processed packets from queue pair of a device. 3099a2dd95SBruce Richardson * 3199a2dd95SBruce Richardson * @param qp 3299a2dd95SBruce Richardson * The queue pair from which to retrieve 3399a2dd95SBruce Richardson * processed operations. 3499a2dd95SBruce Richardson * @param ops 3599a2dd95SBruce Richardson * The address of an array of pointers to 3699a2dd95SBruce Richardson * *rte_comp_op* structures that must be 3799a2dd95SBruce Richardson * large enough to store *nb_ops* pointers in it 3899a2dd95SBruce Richardson * @param nb_ops 3999a2dd95SBruce Richardson * The maximum number of operations to dequeue 4099a2dd95SBruce Richardson * @return 4199a2dd95SBruce Richardson * - The number of operations actually dequeued, which is the number 4299a2dd95SBruce Richardson * of pointers to *rte_comp_op* structures effectively supplied to the 4399a2dd95SBruce Richardson * *ops* array. 4499a2dd95SBruce Richardson */ 4599a2dd95SBruce Richardson typedef uint16_t (*compressdev_dequeue_pkt_burst_t)(void *qp, 4699a2dd95SBruce Richardson struct rte_comp_op **ops, uint16_t nb_ops); 4799a2dd95SBruce Richardson 4899a2dd95SBruce Richardson /** 4999a2dd95SBruce Richardson * Enqueue a burst of operations for processing. 5099a2dd95SBruce Richardson * 5199a2dd95SBruce Richardson * @param qp 5299a2dd95SBruce Richardson * The queue pair on which operations 5399a2dd95SBruce Richardson * are to be enqueued for processing 5499a2dd95SBruce Richardson * @param ops 5599a2dd95SBruce Richardson * The address of an array of *nb_ops* pointers 5699a2dd95SBruce Richardson * to *rte_comp_op* structures which contain 5799a2dd95SBruce Richardson * the operations to be processed 5899a2dd95SBruce Richardson * @param nb_ops 5999a2dd95SBruce Richardson * The number of operations to process 6099a2dd95SBruce Richardson * @return 6199a2dd95SBruce Richardson * The number of operations actually enqueued on the device. The return 6299a2dd95SBruce Richardson * value can be less than the value of the *nb_ops* parameter when the 6399a2dd95SBruce Richardson * comp devices queue is full or if invalid parameters are specified in 6499a2dd95SBruce Richardson * a *rte_comp_op*. 6599a2dd95SBruce Richardson */ 6699a2dd95SBruce Richardson 6799a2dd95SBruce Richardson typedef uint16_t (*compressdev_enqueue_pkt_burst_t)(void *qp, 6899a2dd95SBruce Richardson struct rte_comp_op **ops, uint16_t nb_ops); 6999a2dd95SBruce Richardson 7099a2dd95SBruce Richardson /** The data structure associated with each comp device. */ 7199a2dd95SBruce Richardson struct rte_compressdev { 7299a2dd95SBruce Richardson compressdev_dequeue_pkt_burst_t dequeue_burst; 7399a2dd95SBruce Richardson /**< Pointer to PMD receive function */ 7499a2dd95SBruce Richardson compressdev_enqueue_pkt_burst_t enqueue_burst; 7599a2dd95SBruce Richardson /**< Pointer to PMD transmit function */ 7699a2dd95SBruce Richardson 7799a2dd95SBruce Richardson struct rte_compressdev_data *data; 7899a2dd95SBruce Richardson /**< Pointer to device data */ 7999a2dd95SBruce Richardson struct rte_compressdev_ops *dev_ops; 8099a2dd95SBruce Richardson /**< Functions exported by PMD */ 8199a2dd95SBruce Richardson uint64_t feature_flags; 8299a2dd95SBruce Richardson /**< Supported features */ 8399a2dd95SBruce Richardson struct rte_device *device; 8499a2dd95SBruce Richardson /**< Backing device */ 8599a2dd95SBruce Richardson 8699a2dd95SBruce Richardson __extension__ 8799a2dd95SBruce Richardson uint8_t attached : 1; 8899a2dd95SBruce Richardson /**< Flag indicating the device is attached */ 8999a2dd95SBruce Richardson } __rte_cache_aligned; 9099a2dd95SBruce Richardson 9199a2dd95SBruce Richardson /** 9299a2dd95SBruce Richardson * 9399a2dd95SBruce Richardson * The data part, with no function pointers, associated with each device. 9499a2dd95SBruce Richardson * 9599a2dd95SBruce Richardson * This structure is safe to place in shared memory to be common among 9699a2dd95SBruce Richardson * different processes in a multi-process configuration. 9799a2dd95SBruce Richardson */ 9899a2dd95SBruce Richardson struct rte_compressdev_data { 9999a2dd95SBruce Richardson uint8_t dev_id; 10099a2dd95SBruce Richardson /**< Compress device identifier */ 101*c0941508SRaja Zidane int socket_id; 10299a2dd95SBruce Richardson /**< Socket identifier where memory is allocated */ 10399a2dd95SBruce Richardson char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; 10499a2dd95SBruce Richardson /**< Unique identifier name */ 10599a2dd95SBruce Richardson 10699a2dd95SBruce Richardson __extension__ 10799a2dd95SBruce Richardson uint8_t dev_started : 1; 10899a2dd95SBruce Richardson /**< Device state: STARTED(1)/STOPPED(0) */ 10999a2dd95SBruce Richardson 11099a2dd95SBruce Richardson void **queue_pairs; 11199a2dd95SBruce Richardson /**< Array of pointers to queue pairs. */ 11299a2dd95SBruce Richardson uint16_t nb_queue_pairs; 11399a2dd95SBruce Richardson /**< Number of device queue pairs */ 11499a2dd95SBruce Richardson 11599a2dd95SBruce Richardson void *dev_private; 11699a2dd95SBruce Richardson /**< PMD-specific private data */ 11799a2dd95SBruce Richardson } __rte_cache_aligned; 118ef64c2f3SBrian Dooley 119ef64c2f3SBrian Dooley #ifdef __cplusplus 120ef64c2f3SBrian Dooley } 121ef64c2f3SBrian Dooley #endif 122ef64c2f3SBrian Dooley 12399a2dd95SBruce Richardson #endif 124