X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_rawdev%2Frte_rawdev_pmd.h;h=408adf0fdbe26c9bc0505eaedf1f4fc9622c0b43;hb=5feecc57d90b97c579b16d1083ea167f7564530b;hp=3e643691d31c71eca9ee65d2d186f261170868a3;hpb=919be8321e1ad80fc2f9e52100a8a65037196028;p=dpdk.git diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index 3e643691d3..408adf0fdb 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -250,6 +250,58 @@ typedef int (*rawdev_queue_setup_t)(struct rte_rawdev *dev, typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev, uint16_t queue_id); +/** + * Enqueue an array of raw buffers to the device. + * + * Buffer being used is opaque - it can be obtained from mempool or from + * any other source. Interpretation of buffer is responsibility of driver. + * + * @param dev + * Raw device pointer + * @param bufs + * array of buffers + * @param count + * number of buffers passed + * @param context + * an opaque object representing context of the call; for example, an + * application can pass information about the queues on which enqueue needs + * to be done. Or, the enqueue operation might be passed reference to an + * object containing a callback (agreed upon between applicatio and driver). + * + * @return + * >=0 Count of buffers successfully enqueued (0: no buffers enqueued) + * <0 Error count in case of error + */ +typedef int (*rawdev_enqueue_bufs_t)(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + +/** + * Dequeue an array of raw buffers from the device. + * + * @param dev + * Raw device pointer + * @param bufs + * array of buffers + * @param count + * Max buffers expected to be dequeued + * @param context + * an opaque object representing context of the call. Based on this object, + * the application and driver can coordinate for dequeue operation involving + * agreed upon semantics. For example, queue information/id on which Dequeue + * needs to be performed. + * @return + * >0, ~0: Count of buffers returned + * <0: Error + * Whether short dequeue is success or failure is decided between app and + * driver. + */ +typedef int (*rawdev_dequeue_bufs_t)(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + /** * Dump internal information * @@ -301,6 +353,138 @@ typedef int (*rawdev_set_attr_t)(struct rte_rawdev *dev, const char *attr_name, const uint64_t attr_value); +/** + * Retrieve a set of statistics from device. + * Note: Being a raw device, the stats are specific to the device being + * implemented thus represented as xstats. + * + * @param dev + * Raw device pointer + * @param ids + * The stat ids to retrieve + * @param values + * The returned stat values + * @param n + * The number of id values and entries in the values array + * @return + * The number of stat values successfully filled into the values array + */ +typedef int (*rawdev_xstats_get_t)(const struct rte_rawdev *dev, + const unsigned int ids[], uint64_t values[], unsigned int n); + +/** + * Resets the statistic values in xstats for the device. + */ +typedef int (*rawdev_xstats_reset_t)(struct rte_rawdev *dev, + const uint32_t ids[], + uint32_t nb_ids); + +/** + * Get names of extended stats of an raw device + * + * @param dev + * Raw device pointer + * @param xstats_names + * Array of name values to be filled in + * @param size + * Number of values in the xstats_names array + * @return + * When size >= the number of stats, return the number of stat values filled + * into the array. + * When size < the number of available stats, return the number of stats + * values, and do not fill in any data into xstats_names. + */ +typedef int (*rawdev_xstats_get_names_t)(const struct rte_rawdev *dev, + struct rte_rawdev_xstats_name *xstats_names, + unsigned int size); + +/** + * Get value of one stats and optionally return its id + * + * @param dev + * Raw device pointer + * @param name + * The name of the stat to retrieve + * @param id + * Pointer to an unsigned int where we store the stat-id. + * This pointer may be null if the id is not required. + * @return + * The value of the stat, or (uint64_t)-1 if the stat is not found. + * If the stat is not found, the id value will be returned as (unsigned)-1, + * if id pointer is non-NULL + */ +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. */ @@ -323,6 +507,12 @@ struct rte_rawdev_ops { /**< Release an raw queue. */ rawdev_queue_release_t queue_release; + /**< Enqueue an array of raw buffers to device. */ + rawdev_enqueue_bufs_t enqueue_bufs; + /**< Dequeue an array of raw buffers from device. */ + /** TODO: Callback based enqueue and dequeue support */ + rawdev_dequeue_bufs_t dequeue_bufs; + /* Dump internal information */ rawdev_dump_t dump; @@ -330,6 +520,27 @@ struct rte_rawdev_ops { rawdev_get_attr_t attr_get; /**< Set an attribute managed by the implementation */ rawdev_set_attr_t attr_set; + + /**< Get extended device statistics. */ + rawdev_xstats_get_t xstats_get; + /**< Get names of extended stats. */ + rawdev_xstats_get_names_t xstats_get_names; + /**< Get one value by name. */ + 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; }; /**