net/sfc: check mbufs allocated using mempool API for Rx
[dpdk.git] / lib / librte_rawdev / rte_rawdev_pmd.h
index abc7c15..bb9bbc3 100644 (file)
@@ -250,6 +250,24 @@ typedef int (*rawdev_queue_setup_t)(struct rte_rawdev *dev,
 typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev,
                                      uint16_t queue_id);
 
+/**
+ * Get the count of number of queues configured on this device.
+ *
+ * Another way to fetch this information is to fetch the device configuration.
+ * But, that assumes that the device configuration managed by the driver has
+ * that kind of information.
+ *
+ * This function helps in getting queue count supported, independently. It
+ * can help in cases where iterator needs to be implemented.
+ *
+ * @param
+ *   Raw device pointer
+ * @return
+ *   Number of queues; 0 is assumed to be a valid response.
+ *
+ */
+typedef uint16_t (*rawdev_queue_count_t)(struct rte_rawdev *dev);
+
 /**
  * Enqueue an array of raw buffers to the device.
  *
@@ -416,6 +434,75 @@ typedef int (*rawdev_xstats_get_names_t)(const struct rte_rawdev *dev,
 typedef uint64_t (*rawdev_xstats_get_by_name_t)(const struct rte_rawdev *dev,
                                                const char *name,
                                                unsigned int *id);
+
+/**
+ * Get firmware/device-stack status.
+ * Implementation to allocate buffer for returning information.
+ *
+ * @param dev
+ *   Raw device pointer
+ * @param status
+ *   void block containing device specific status information
+ * @return
+ *   0 for success,
+ *   !0 for failure, with undefined value in `status_info`
+ */
+typedef int (*rawdev_firmware_status_get_t)(struct rte_rawdev *dev,
+                                           rte_rawdev_obj_t status_info);
+
+/**
+ * Get firmware version information
+ *
+ * @param dev
+ *   Raw device pointer
+ * @param version_info
+ *   void pointer to version information returned by device
+ * @return
+ *   0 for success,
+ *   !0 for failure, with undefined value in `version_info`
+ */
+typedef int (*rawdev_firmware_version_get_t)(struct rte_rawdev *dev,
+                                            rte_rawdev_obj_t version_info);
+
+/**
+ * Load firwmare from a buffer (DMA'able)
+ *
+ * @param dev
+ *   Raw device pointer
+ * @param firmware_file
+ *   file pointer to firmware area
+ * @return
+ *   >0, ~0: for successful load
+ *   <0: for failure
+ *
+ * @see Application may use 'firmware_version_get` for ascertaining successful
+ * load
+ */
+typedef int (*rawdev_firmware_load_t)(struct rte_rawdev *dev,
+                                     rte_rawdev_obj_t firmware_buf);
+
+/**
+ * Unload firwmare
+ *
+ * @param dev
+ *   Raw device pointer
+ * @return
+ *   >0, ~0 for successful unloading
+ *   <0 for failure in unloading
+ *
+ * Note: Application can use the `firmware_status_get` or
+ * `firmware_version_get` to get result of unload.
+ */
+typedef int (*rawdev_firmware_unload_t)(struct rte_rawdev *dev);
+
+/**
+ * Start rawdev selftest
+ *
+ * @return
+ *   Return 0 on success
+ */
+typedef int (*rawdev_selftest_t)(void);
+
 /** Rawdevice operations function pointer table */
 struct rte_rawdev_ops {
        /**< Get device info. */
@@ -437,6 +524,8 @@ struct rte_rawdev_ops {
        rawdev_queue_setup_t queue_setup;
        /**< Release an raw queue. */
        rawdev_queue_release_t queue_release;
+       /**< Get the number of queues attached to the device */
+       rawdev_queue_count_t queue_count;
 
        /**< Enqueue an array of raw buffers to device. */
        rawdev_enqueue_bufs_t enqueue_bufs;
@@ -460,6 +549,18 @@ struct rte_rawdev_ops {
        rawdev_xstats_get_by_name_t xstats_get_by_name;
        /**< Reset the statistics values in xstats. */
        rawdev_xstats_reset_t xstats_reset;
+
+       /**< Obtainer firmware status */
+       rawdev_firmware_status_get_t firmware_status_get;
+       /**< Obtain firmware version information */
+       rawdev_firmware_version_get_t firmware_version_get;
+       /**< Load firmware */
+       rawdev_firmware_load_t firmware_load;
+       /**< Unload firmware */
+       rawdev_firmware_unload_t firmware_unload;
+
+       /**< Device selftest function */
+       rawdev_selftest_t dev_selftest;
 };
 
 /**
@@ -475,7 +576,7 @@ struct rte_rawdev_ops {
  * @return
  *   - Slot in the rte_dev_devices array for a new device;
  */
-struct rte_rawdev * __rte_experimental
+struct rte_rawdev *
 rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size,
                        int socket_id);
 
@@ -487,7 +588,7 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size,
  * @return
  *   - 0 on success, negative on error
  */
-int __rte_experimental
+int
 rte_rawdev_pmd_release(struct rte_rawdev *rawdev);
 
 /**
@@ -504,7 +605,7 @@ rte_rawdev_pmd_release(struct rte_rawdev *rawdev);
  *   - Raw device pointer if device is successfully created.
  *   - NULL if device cannot be created.
  */
-struct rte_rawdev * __rte_experimental
+struct rte_rawdev *
 rte_rawdev_pmd_init(const char *name, size_t dev_private_size,
                    int socket_id);
 
@@ -516,7 +617,7 @@ rte_rawdev_pmd_init(const char *name, size_t dev_private_size,
  * @return
  *   - 0 on success, negative on error
  */
-int __rte_experimental
+int
 rte_rawdev_pmd_uninit(const char *name);
 
 #ifdef __cplusplus