X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_rawdev%2Frte_rawdev_pmd.h;h=34dd7181b44a3253caa02b7cf984feb7bffc21fc;hb=5b38d8cd4663;hp=abc7c15c556ed084d151b54498759d0d408265e1;hpb=4d4fdc142bde73444ce330e5e1f16799815774ae;p=dpdk.git diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index abc7c15c55..34dd7181b4 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -11,9 +11,6 @@ * @note * Driver facing APIs for a raw device. These are not to be called directly by * any application. - * - * @warning - * @b EXPERIMENTAL: this API may change without prior notice */ #ifdef __cplusplus @@ -73,8 +70,6 @@ struct rte_rawdev_global { uint16_t nb_devs; }; -extern struct rte_rawdev_global *rte_rawdev_globals; -/** Pointer to global raw devices data structure. */ extern struct rte_rawdev *rte_rawdevs; /** The pool of rte_rawdev structures. */ @@ -143,12 +138,15 @@ rte_rawdev_pmd_is_valid_dev(uint8_t dev_id) * Raw device pointer * @param dev_info * Raw device information structure + * @param dev_private_size + * The size of the structure pointed to by dev_info->dev_private * * @return - * Returns 0 on success + * Returns 0 on success, negative error code on failure */ -typedef void (*rawdev_info_get_t)(struct rte_rawdev *dev, - rte_rawdev_obj_t dev_info); +typedef int (*rawdev_info_get_t)(struct rte_rawdev *dev, + rte_rawdev_obj_t dev_info, + size_t dev_private_size); /** * Configure a device. @@ -162,7 +160,8 @@ typedef void (*rawdev_info_get_t)(struct rte_rawdev *dev, * Returns 0 on success */ typedef int (*rawdev_configure_t)(const struct rte_rawdev *dev, - rte_rawdev_obj_t config); + rte_rawdev_obj_t config, + size_t config_size); /** * Start a configured device. @@ -216,10 +215,13 @@ typedef int (*rawdev_reset_t)(struct rte_rawdev *dev); * @param[out] queue_conf * Raw device queue configuration structure * + * @return + * Returns 0 on success, negative errno on failure */ -typedef void (*rawdev_queue_conf_get_t)(struct rte_rawdev *dev, +typedef int (*rawdev_queue_conf_get_t)(struct rte_rawdev *dev, uint16_t queue_id, - rte_rawdev_obj_t queue_conf); + rte_rawdev_obj_t queue_conf, + size_t queue_conf_size); /** * Setup an raw queue. @@ -236,7 +238,8 @@ typedef void (*rawdev_queue_conf_get_t)(struct rte_rawdev *dev, */ typedef int (*rawdev_queue_setup_t)(struct rte_rawdev *dev, uint16_t queue_id, - rte_rawdev_obj_t queue_conf); + rte_rawdev_obj_t queue_conf, + size_t queue_conf_size); /** * Release resources allocated by given raw queue. @@ -250,6 +253,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. * @@ -266,7 +287,7 @@ typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev, * 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). + * object containing a callback (agreed upon between application and driver). * * @return * >=0 Count of buffers successfully enqueued (0: no buffers enqueued) @@ -416,6 +437,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 firmware 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 firmware + * + * @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)(uint16_t dev_id); + /** Rawdevice operations function pointer table */ struct rte_rawdev_ops { /**< Get device info. */ @@ -437,6 +527,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 +552,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; + + /**< Obtain 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; }; /** @@ -469,13 +573,15 @@ struct rte_rawdev_ops { * @param name * Unique identifier name for each device * @param dev_private_size - * Private data allocated within rte_rawdev object. + * Size of private data memory allocated within rte_rawdev object. + * Set to 0 to disable internal memory allocation and allow for + * self-allocation. * @param socket_id * Socket to allocate resources on. * @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 +593,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 +610,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 +622,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