examples/fips_validation: fix buffer overflow
[dpdk.git] / lib / librte_bbdev / rte_bbdev.h
index c5175cc..5729137 100644 (file)
@@ -11,7 +11,8 @@
  * Wireless base band device abstraction APIs.
  *
  * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
  *
  * This API allows an application to discover, configure and use a device to
  * process operations. An asynchronous API (enqueue, followed by later dequeue)
@@ -167,7 +168,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
 
 /**
  * Start a device.
- * This is the last step needed before enqueuing operations is possible.
+ * This is the last step needed before enqueueing operations is possible.
  *
  * @param dev_id
  *   The identifier of the device.
@@ -307,6 +308,8 @@ struct rte_bbdev_driver_info {
        bool queue_intr_supported;
        /** Minimum alignment of buffers, in bytes */
        uint16_t min_alignment;
+       /** HARQ memory available in kB */
+       uint32_t harq_buffer_size;
        /** Default queue configuration used if none is supplied  */
        struct rte_bbdev_queue_conf default_queue_conf;
        /** Device operation capabilities */
@@ -326,7 +329,7 @@ struct rte_bbdev_driver_info {
 struct rte_bbdev_info {
        int socket_id;  /**< NUMA socket that device is on */
        const char *dev_name;  /**< Unique device name */
-       const struct rte_bus *bus;  /**< Bus information */
+       const struct rte_device *device; /**< Device Information */
        uint16_t num_queues;  /**< Number of queues currently configured */
        bool started;  /**< Set if device is currently started */
        struct rte_bbdev_driver_info drv;  /**< Info from device driver */
@@ -440,14 +443,22 @@ TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
  * these fields, but should only write to the *_ops fields.
  */
 struct __rte_cache_aligned rte_bbdev {
-       /**< Enqueue encode function */
+       /** Enqueue encode function */
        rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
-       /**< Enqueue decode function */
+       /** Enqueue decode function */
        rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
-       /**< Dequeue encode function */
+       /** Dequeue encode function */
        rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
-       /**< Dequeue decode function */
+       /** Dequeue decode function */
        rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
+       /** Enqueue encode function */
+       rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
+       /** Enqueue decode function */
+       rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
+       /** Dequeue encode function */
+       rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
+       /** Dequeue decode function */
+       rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
        const struct rte_bbdev_ops *dev_ops;  /**< Functions exported by PMD */
        struct rte_bbdev_data *data;  /**< Pointer to device data */
        enum rte_bbdev_state state;  /**< If device is currently used or not */
@@ -522,6 +533,69 @@ rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
        return dev->enqueue_dec_ops(q_data, ops, num_ops);
 }
 
+/**
+ * Enqueue a burst of processed encode operations to a queue of the device.
+ * This functions only enqueues as many operations as currently possible and
+ * does not block until @p num_ops entries in the queue are available.
+ * This function does not provide any error notification to avoid the
+ * corresponding overhead.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param queue_id
+ *   The index of the queue.
+ * @param ops
+ *   Pointer array containing operations to be enqueued Must have at least
+ *   @p num_ops entries
+ * @param num_ops
+ *   The maximum number of operations to enqueue.
+ *
+ * @return
+ *   The number of operations actually enqueued (this is the number of processed
+ *   entries in the @p ops array).
+ */
+__rte_experimental
+static inline uint16_t
+rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
+               struct rte_bbdev_enc_op **ops, uint16_t num_ops)
+{
+       struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+       struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+       return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
+}
+
+/**
+ * Enqueue a burst of processed decode operations to a queue of the device.
+ * This functions only enqueues as many operations as currently possible and
+ * does not block until @p num_ops entries in the queue are available.
+ * This function does not provide any error notification to avoid the
+ * corresponding overhead.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param queue_id
+ *   The index of the queue.
+ * @param ops
+ *   Pointer array containing operations to be enqueued Must have at least
+ *   @p num_ops entries
+ * @param num_ops
+ *   The maximum number of operations to enqueue.
+ *
+ * @return
+ *   The number of operations actually enqueued (this is the number of processed
+ *   entries in the @p ops array).
+ */
+__rte_experimental
+static inline uint16_t
+rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
+               struct rte_bbdev_dec_op **ops, uint16_t num_ops)
+{
+       struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+       struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+       return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
+}
+
+
 /**
  * Dequeue a burst of processed encode operations from a queue of the device.
  * This functions returns only the current contents of the queue, and does not
@@ -536,6 +610,7 @@ rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
  * @param ops
  *   Pointer array where operations will be dequeued to. Must have at least
  *   @p num_ops entries
+ *   ie. A pointer to a table of void * pointers (ops) that will be filled.
  * @param num_ops
  *   The maximum number of operations to dequeue.
  *
@@ -567,6 +642,7 @@ rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
  * @param ops
  *   Pointer array where operations will be dequeued to. Must have at least
  *   @p num_ops entries
+ *   ie. A pointer to a table of void * pointers (ops) that will be filled.
  * @param num_ops
  *   The maximum number of operations to dequeue.
  *
@@ -585,6 +661,69 @@ rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
        return dev->dequeue_dec_ops(q_data, ops, num_ops);
 }
 
+
+/**
+ * Dequeue a burst of processed encode operations from a queue of the device.
+ * This functions returns only the current contents of the queue, and does not
+ * block until @ num_ops is available.
+ * This function does not provide any error notification to avoid the
+ * corresponding overhead.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param queue_id
+ *   The index of the queue.
+ * @param ops
+ *   Pointer array where operations will be dequeued to. Must have at least
+ *   @p num_ops entries
+ * @param num_ops
+ *   The maximum number of operations to dequeue.
+ *
+ * @return
+ *   The number of operations actually dequeued (this is the number of entries
+ *   copied into the @p ops array).
+ */
+__rte_experimental
+static inline uint16_t
+rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
+               struct rte_bbdev_enc_op **ops, uint16_t num_ops)
+{
+       struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+       struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+       return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
+}
+
+/**
+ * Dequeue a burst of processed decode operations from a queue of the device.
+ * This functions returns only the current contents of the queue, and does not
+ * block until @ num_ops is available.
+ * This function does not provide any error notification to avoid the
+ * corresponding overhead.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param queue_id
+ *   The index of the queue.
+ * @param ops
+ *   Pointer array where operations will be dequeued to. Must have at least
+ *   @p num_ops entries
+ * @param num_ops
+ *   The maximum number of operations to dequeue.
+ *
+ * @return
+ *   The number of operations actually dequeued (this is the number of entries
+ *   copied into the @p ops array).
+ */
+__rte_experimental
+static inline uint16_t
+rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
+               struct rte_bbdev_dec_op **ops, uint16_t num_ops)
+{
+       struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
+       struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+       return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
+}
+
 /** Definitions of device event types */
 enum rte_bbdev_event_type {
        RTE_BBDEV_EVENT_UNKNOWN,  /**< unknown event type */