1*d30ea906Sjfb8856606 /* SPDX-License-Identifier: BSD-3-Clause 2*d30ea906Sjfb8856606 * Copyright(c) 2017-2018 Intel Corporation 3*d30ea906Sjfb8856606 */ 4*d30ea906Sjfb8856606 5*d30ea906Sjfb8856606 #ifndef _RTE_COMPRESSDEV_INTERNAL_H_ 6*d30ea906Sjfb8856606 #define _RTE_COMPRESSDEV_INTERNAL_H_ 7*d30ea906Sjfb8856606 8*d30ea906Sjfb8856606 /* rte_compressdev_internal.h 9*d30ea906Sjfb8856606 * This file holds Compressdev private data structures. 10*d30ea906Sjfb8856606 */ 11*d30ea906Sjfb8856606 #include <rte_log.h> 12*d30ea906Sjfb8856606 13*d30ea906Sjfb8856606 #include "rte_comp.h" 14*d30ea906Sjfb8856606 15*d30ea906Sjfb8856606 #define RTE_COMPRESSDEV_NAME_MAX_LEN (64) 16*d30ea906Sjfb8856606 /**< Max length of name of comp PMD */ 17*d30ea906Sjfb8856606 18*d30ea906Sjfb8856606 /* Logging Macros */ 19*d30ea906Sjfb8856606 extern int compressdev_logtype; 20*d30ea906Sjfb8856606 #define COMPRESSDEV_LOG(level, fmt, args...) \ 21*d30ea906Sjfb8856606 rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): "fmt "\n", \ 22*d30ea906Sjfb8856606 __func__, ##args) 23*d30ea906Sjfb8856606 24*d30ea906Sjfb8856606 /** 25*d30ea906Sjfb8856606 * Dequeue processed packets from queue pair of a device. 26*d30ea906Sjfb8856606 * 27*d30ea906Sjfb8856606 * @param qp 28*d30ea906Sjfb8856606 * The queue pair from which to retrieve 29*d30ea906Sjfb8856606 * processed operations. 30*d30ea906Sjfb8856606 * @param ops 31*d30ea906Sjfb8856606 * The address of an array of pointers to 32*d30ea906Sjfb8856606 * *rte_comp_op* structures that must be 33*d30ea906Sjfb8856606 * large enough to store *nb_ops* pointers in it 34*d30ea906Sjfb8856606 * @param nb_ops 35*d30ea906Sjfb8856606 * The maximum number of operations to dequeue 36*d30ea906Sjfb8856606 * @return 37*d30ea906Sjfb8856606 * - The number of operations actually dequeued, which is the number 38*d30ea906Sjfb8856606 * of pointers to *rte_comp_op* structures effectively supplied to the 39*d30ea906Sjfb8856606 * *ops* array. 40*d30ea906Sjfb8856606 */ 41*d30ea906Sjfb8856606 typedef uint16_t (*compressdev_dequeue_pkt_burst_t)(void *qp, 42*d30ea906Sjfb8856606 struct rte_comp_op **ops, uint16_t nb_ops); 43*d30ea906Sjfb8856606 44*d30ea906Sjfb8856606 /** 45*d30ea906Sjfb8856606 * Enqueue a burst of operations for processing. 46*d30ea906Sjfb8856606 * 47*d30ea906Sjfb8856606 * @param qp 48*d30ea906Sjfb8856606 * The queue pair on which operations 49*d30ea906Sjfb8856606 * are to be enqueued for processing 50*d30ea906Sjfb8856606 * @param ops 51*d30ea906Sjfb8856606 * The address of an array of *nb_ops* pointers 52*d30ea906Sjfb8856606 * to *rte_comp_op* structures which contain 53*d30ea906Sjfb8856606 * the operations to be processed 54*d30ea906Sjfb8856606 * @param nb_ops 55*d30ea906Sjfb8856606 * The number of operations to process 56*d30ea906Sjfb8856606 * @return 57*d30ea906Sjfb8856606 * The number of operations actually enqueued on the device. The return 58*d30ea906Sjfb8856606 * value can be less than the value of the *nb_ops* parameter when the 59*d30ea906Sjfb8856606 * comp devices queue is full or if invalid parameters are specified in 60*d30ea906Sjfb8856606 * a *rte_comp_op*. 61*d30ea906Sjfb8856606 */ 62*d30ea906Sjfb8856606 63*d30ea906Sjfb8856606 typedef uint16_t (*compressdev_enqueue_pkt_burst_t)(void *qp, 64*d30ea906Sjfb8856606 struct rte_comp_op **ops, uint16_t nb_ops); 65*d30ea906Sjfb8856606 66*d30ea906Sjfb8856606 /** The data structure associated with each comp device. */ 67*d30ea906Sjfb8856606 struct rte_compressdev { 68*d30ea906Sjfb8856606 compressdev_dequeue_pkt_burst_t dequeue_burst; 69*d30ea906Sjfb8856606 /**< Pointer to PMD receive function */ 70*d30ea906Sjfb8856606 compressdev_enqueue_pkt_burst_t enqueue_burst; 71*d30ea906Sjfb8856606 /**< Pointer to PMD transmit function */ 72*d30ea906Sjfb8856606 73*d30ea906Sjfb8856606 struct rte_compressdev_data *data; 74*d30ea906Sjfb8856606 /**< Pointer to device data */ 75*d30ea906Sjfb8856606 struct rte_compressdev_ops *dev_ops; 76*d30ea906Sjfb8856606 /**< Functions exported by PMD */ 77*d30ea906Sjfb8856606 uint64_t feature_flags; 78*d30ea906Sjfb8856606 /**< Supported features */ 79*d30ea906Sjfb8856606 struct rte_device *device; 80*d30ea906Sjfb8856606 /**< Backing device */ 81*d30ea906Sjfb8856606 82*d30ea906Sjfb8856606 __extension__ 83*d30ea906Sjfb8856606 uint8_t attached : 1; 84*d30ea906Sjfb8856606 /**< Flag indicating the device is attached */ 85*d30ea906Sjfb8856606 } __rte_cache_aligned; 86*d30ea906Sjfb8856606 87*d30ea906Sjfb8856606 /** 88*d30ea906Sjfb8856606 * 89*d30ea906Sjfb8856606 * The data part, with no function pointers, associated with each device. 90*d30ea906Sjfb8856606 * 91*d30ea906Sjfb8856606 * This structure is safe to place in shared memory to be common among 92*d30ea906Sjfb8856606 * different processes in a multi-process configuration. 93*d30ea906Sjfb8856606 */ 94*d30ea906Sjfb8856606 struct rte_compressdev_data { 95*d30ea906Sjfb8856606 uint8_t dev_id; 96*d30ea906Sjfb8856606 /**< Compress device identifier */ 97*d30ea906Sjfb8856606 uint8_t socket_id; 98*d30ea906Sjfb8856606 /**< Socket identifier where memory is allocated */ 99*d30ea906Sjfb8856606 char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; 100*d30ea906Sjfb8856606 /**< Unique identifier name */ 101*d30ea906Sjfb8856606 102*d30ea906Sjfb8856606 __extension__ 103*d30ea906Sjfb8856606 uint8_t dev_started : 1; 104*d30ea906Sjfb8856606 /**< Device state: STARTED(1)/STOPPED(0) */ 105*d30ea906Sjfb8856606 106*d30ea906Sjfb8856606 void **queue_pairs; 107*d30ea906Sjfb8856606 /**< Array of pointers to queue pairs. */ 108*d30ea906Sjfb8856606 uint16_t nb_queue_pairs; 109*d30ea906Sjfb8856606 /**< Number of device queue pairs */ 110*d30ea906Sjfb8856606 111*d30ea906Sjfb8856606 void *dev_private; 112*d30ea906Sjfb8856606 /**< PMD-specific private data */ 113*d30ea906Sjfb8856606 } __rte_cache_aligned; 114*d30ea906Sjfb8856606 #endif 115