DPDK
21.02.0
|
Go to the source code of this file.
Data Structures | |
struct | rte_rawdev_xstats_name |
Macros | |
#define | RTE_RAW_DEV_XSTATS_NAME_SIZE 64 |
Functions | |
uint8_t | rte_rawdev_count (void) |
uint16_t | rte_rawdev_get_dev_id (const char *name) |
int | rte_rawdev_socket_id (uint16_t dev_id) |
int | rte_rawdev_info_get (uint16_t dev_id, struct rte_rawdev_info *dev_info, size_t dev_private_size) |
int | rte_rawdev_configure (uint16_t dev_id, struct rte_rawdev_info *dev_conf, size_t dev_private_size) |
int | rte_rawdev_queue_conf_get (uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf, size_t queue_conf_size) |
int | rte_rawdev_queue_setup (uint16_t dev_id, uint16_t queue_id, rte_rawdev_obj_t queue_conf, size_t queue_conf_size) |
int | rte_rawdev_queue_release (uint16_t dev_id, uint16_t queue_id) |
uint16_t | rte_rawdev_queue_count (uint16_t dev_id) |
int | rte_rawdev_start (uint16_t dev_id) |
void | rte_rawdev_stop (uint16_t dev_id) |
int | rte_rawdev_close (uint16_t dev_id) |
int | rte_rawdev_reset (uint16_t dev_id) |
int | rte_rawdev_dump (uint16_t dev_id, FILE *f) |
int | rte_rawdev_get_attr (uint16_t dev_id, const char *attr_name, uint64_t *attr_value) |
int | rte_rawdev_set_attr (uint16_t dev_id, const char *attr_name, const uint64_t attr_value) |
int | rte_rawdev_enqueue_buffers (uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context) |
int | rte_rawdev_dequeue_buffers (uint16_t dev_id, struct rte_rawdev_buf **buffers, unsigned int count, rte_rawdev_obj_t context) |
int | rte_rawdev_xstats_names_get (uint16_t dev_id, struct rte_rawdev_xstats_name *xstats_names, unsigned int size) |
int | rte_rawdev_xstats_get (uint16_t dev_id, const unsigned int ids[], uint64_t values[], unsigned int n) |
uint64_t | rte_rawdev_xstats_by_name_get (uint16_t dev_id, const char *name, unsigned int *id) |
int | rte_rawdev_xstats_reset (uint16_t dev_id, const uint32_t ids[], uint32_t nb_ids) |
int | rte_rawdev_firmware_status_get (uint16_t dev_id, rte_rawdev_obj_t status_info) |
int | rte_rawdev_firmware_version_get (uint16_t dev_id, rte_rawdev_obj_t version_info) |
int | rte_rawdev_firmware_load (uint16_t dev_id, rte_rawdev_obj_t firmware_image) |
int | rte_rawdev_firmware_unload (uint16_t dev_id) |
int | rte_rawdev_selftest (uint16_t dev_id) |
Generic device abstraction APIs.
This API allow applications to configure and use generic devices having no specific type already available in DPDK.
Definition in file rte_rawdev.h.
#define RTE_RAW_DEV_XSTATS_NAME_SIZE 64 |
Maximum name length for extended statistics counters
Definition at line 447 of file rte_rawdev.h.
uint8_t rte_rawdev_count | ( | void | ) |
Get the total number of raw devices that have been successfully initialised.
uint16_t rte_rawdev_get_dev_id | ( | const char * | name | ) |
Get the device identifier for the named raw device.
name | Raw device name to select the raw device identifier. |
int rte_rawdev_socket_id | ( | uint16_t | dev_id | ) |
Return the NUMA socket to which a device is connected.
dev_id | The identifier of the device. |
int rte_rawdev_info_get | ( | uint16_t | dev_id, |
struct rte_rawdev_info * | dev_info, | ||
size_t | dev_private_size | ||
) |
Retrieve the contextual information of a raw device.
dev_id | The identifier of the device. | |
[out] | dev_info | A pointer to a structure of type rte_rawdev_info to be filled with the contextual information of the device. The dev_info->dev_private field should point to an appropriate buffer space for holding the device- specific info for that hardware. If the dev_private field is set to NULL, then the device-specific info function will not be called and only basic information about the device will be returned. This can be used to safely query the type of a rawdev instance without needing to know the size of the private data to return. |
dev_private_size | The length of the memory space pointed to by dev_private in dev_info. This should be set to the size of the expected private structure to be returned, and may be checked by drivers to ensure the expected struct type is provided. |
int rte_rawdev_configure | ( | uint16_t | dev_id, |
struct rte_rawdev_info * | dev_conf, | ||
size_t | dev_private_size | ||
) |
Configure a raw device.
This function must be invoked first before any other function in the API. This function can also be re-invoked when a device is in the stopped state.
The caller may use rte_rawdev_info_get() to get the capability of each resources available for this raw device.
dev_id | The identifier of the device to configure. |
dev_conf | The raw device configuration structure encapsulated into rte_rawdev_info object. It is assumed that the opaque object has enough information which the driver/implementation can use to configure the device. It is also assumed that once the configuration is done, a queue_id type field can be used to refer to some arbitrary internal representation of a queue. |
dev_private_size | The length of the memory space pointed to by dev_private in dev_info. This should be set to the size of the expected private structure to be used by the driver, and may be checked by drivers to ensure the expected struct type is provided. |
int rte_rawdev_queue_conf_get | ( | uint16_t | dev_id, |
uint16_t | queue_id, | ||
rte_rawdev_obj_t | queue_conf, | ||
size_t | queue_conf_size | ||
) |
Retrieve the current configuration information of a raw queue designated by its queue_id from the raw driver for a raw device.
This function intended to be used in conjunction with rte_raw_queue_setup() where caller needs to set up the queue by overriding few default values.
dev_id | The identifier of the device. | |
queue_id | The index of the raw queue to get the configuration information. The value must be in the range [0, nb_raw_queues - 1] previously supplied to rte_rawdev_configure(). | |
[out] | queue_conf | The pointer to the default raw queue configuration data. |
queue_conf_size | The size of the structure pointed to by queue_conf |
int rte_rawdev_queue_setup | ( | uint16_t | dev_id, |
uint16_t | queue_id, | ||
rte_rawdev_obj_t | queue_conf, | ||
size_t | queue_conf_size | ||
) |
Allocate and set up a raw queue for a raw device.
dev_id | The identifier of the device. |
queue_id | The index of the raw queue to setup. The value must be in the range [0, nb_raw_queues - 1] previously supplied to rte_rawdev_configure(). |
queue_conf | The pointer to the configuration data to be used for the raw queue. NULL value is allowed, in which case default configuration used. |
queue_conf_size | The size of the structure pointed to by queue_conf |
int rte_rawdev_queue_release | ( | uint16_t | dev_id, |
uint16_t | queue_id | ||
) |
Release and deallocate a raw queue from a raw device.
dev_id | The identifier of the device. |
queue_id | The index of the raw queue to release. The value must be in the range [0, nb_raw_queues - 1] previously supplied to rte_rawdev_configure(). |
uint16_t rte_rawdev_queue_count | ( | uint16_t | dev_id | ) |
Get the number of raw queues on a specific raw device
dev_id | Raw device identifier. |
int rte_rawdev_start | ( | uint16_t | dev_id | ) |
Start a raw device.
The device start step is the last one and consists of setting the raw queues to start accepting the raws and schedules to raw ports.
On success, all basic functions exported by the API (raw enqueue, raw dequeue and so on) can be invoked.
dev_id | Raw device identifier |
void rte_rawdev_stop | ( | uint16_t | dev_id | ) |
Stop a raw device. The device can be restarted with a call to rte_rawdev_start()
dev_id | Raw device identifier. |
int rte_rawdev_close | ( | uint16_t | dev_id | ) |
Close a raw device. The device cannot be restarted after this call.
dev_id | Raw device identifier |
int rte_rawdev_reset | ( | uint16_t | dev_id | ) |
Reset a raw device. This is different from cycle of rte_rawdev_start->rte_rawdev_stop in the sense similar to hard or soft reset.
dev_id | Raw device identifiers |
int rte_rawdev_dump | ( | uint16_t | dev_id, |
FILE * | f | ||
) |
Dump internal information about dev_id to the FILE* provided in f.
dev_id | The identifier of the device. |
f | A pointer to a file for output |
int rte_rawdev_get_attr | ( | uint16_t | dev_id, |
const char * | attr_name, | ||
uint64_t * | attr_value | ||
) |
Get an attribute value from implementation. Attribute is an opaque handle agreed upon between application and PMD.
Implementations are expected to maintain an array of attribute-value pairs based on application calls. Memory management for this structure is shared responsibility of implementation and application.
dev_id | The identifier of the device to configure. |
attr_name | Opaque object representing an attribute in implementation. |
attr_value | [out] Opaque response to the attribute value. In case of error, this remains untouched. This is double pointer of void type. |
int rte_rawdev_set_attr | ( | uint16_t | dev_id, |
const char * | attr_name, | ||
const uint64_t | attr_value | ||
) |
Set an attribute value. Attribute is an opaque handle agreed upon between application and PMD.
dev_id | The identifier of the device to configure. |
attr_name | Opaque object representing an attribute in implementation. |
attr_value | Value of the attribute represented by attr_name |
int rte_rawdev_enqueue_buffers | ( | uint16_t | dev_id, |
struct rte_rawdev_buf ** | buffers, | ||
unsigned int | count, | ||
rte_rawdev_obj_t | context | ||
) |
Enqueue a stream of buffers to the device.
Rather than specifying a queue, this API passes along an opaque object to the driver implementation. That object can be a queue or any other contextual information necessary for the device to enqueue buffers.
dev_id | The identifier of the device to configure. |
buffers | Collection of buffers for enqueuing |
count | Count of buffers to enqueue |
context | Opaque context information. |
int rte_rawdev_dequeue_buffers | ( | uint16_t | dev_id, |
struct rte_rawdev_buf ** | buffers, | ||
unsigned int | count, | ||
rte_rawdev_obj_t | context | ||
) |
Dequeue a stream of buffers from the device.
Rather than specifying a queue, this API passes along an opaque object to the driver implementation. That object can be a queue or any other contextual information necessary for the device to dequeue buffers.
Application should have allocated enough space to store count
response buffers. Releasing buffers dequeued is responsibility of the application.
dev_id | The identifier of the device to configure. |
buffers | Collection of buffers dequeued |
count | Max buffers expected to be dequeued |
context | Opaque context information. |
int rte_rawdev_xstats_names_get | ( | uint16_t | dev_id, |
struct rte_rawdev_xstats_name * | xstats_names, | ||
unsigned int | size | ||
) |
Retrieve names of extended statistics of a raw device.
dev_id | The identifier of the raw device. | |
[out] | xstats_names | Block of memory to insert names into. Must be at least size in capacity. If set to NULL, function returns required capacity. |
size | Capacity of xstats_names (number of names). |
int rte_rawdev_xstats_get | ( | uint16_t | dev_id, |
const unsigned int | ids[], | ||
uint64_t | values[], | ||
unsigned int | n | ||
) |
Retrieve extended statistics of a raw device.
dev_id | The identifier of the device. | |
ids | The id numbers of the stats to get. The ids can be got from the stat position in the stat list from rte_rawdev_get_xstats_names(), or by using rte_rawdev_get_xstats_by_name() | |
[out] | values | The values for each stats request by ID. |
n | The number of stats requested |
uint64_t rte_rawdev_xstats_by_name_get | ( | uint16_t | dev_id, |
const char * | name, | ||
unsigned int * | id | ||
) |
Retrieve the value of a single stat by requesting it by name.
dev_id | The identifier of the device | |
name | The stat name to retrieve | |
[out] | id | If non-NULL, the numerical id of the stat will be returned, so that further requests for the stat can be got using rte_rawdev_xstats_get, which will be faster as it doesn't need to scan a list of names for the stat. If the stat cannot be found, the id returned will be (unsigned)-1. |
int rte_rawdev_xstats_reset | ( | uint16_t | dev_id, |
const uint32_t | ids[], | ||
uint32_t | nb_ids | ||
) |
Reset the values of the xstats of the selected component in the device.
dev_id | The identifier of the device |
ids | Selects specific statistics to be reset. When NULL, all statistics will be reset. If non-NULL, must point to array of at least nb_ids size. |
nb_ids | The number of ids available from the ids array. Ignored when ids is NULL. |
int rte_rawdev_firmware_status_get | ( | uint16_t | dev_id, |
rte_rawdev_obj_t | status_info | ||
) |
Get Firmware status of the device.. Returns a memory allocated by driver/implementation containing status information block. It is responsibility of caller to release the buffer.
dev_id | Raw device identifier |
status_info | Pointer to status information area. Caller is responsible for releasing the memory associated. |
status_info
argument state is undefined int rte_rawdev_firmware_version_get | ( | uint16_t | dev_id, |
rte_rawdev_obj_t | version_info | ||
) |
Get Firmware version of the device. Returns a memory allocated by driver/implementation containing version information block. It is responsibility of caller to release the buffer.
dev_id | Raw device identifier |
version_info | Pointer to version information area. Caller is responsible for releasing the memory associated. |
version_info
argument state is undefined int rte_rawdev_firmware_load | ( | uint16_t | dev_id, |
rte_rawdev_obj_t | firmware_image | ||
) |
Load firmware on the device. TODO: In future, methods like directly flashing from file too can be supported.
dev_id | Raw device identifier |
firmware_image | Pointer to buffer containing image binary data |
int rte_rawdev_firmware_unload | ( | uint16_t | dev_id | ) |
Unload firmware from the device.
dev_id | Raw device identifiers |
int rte_rawdev_selftest | ( | uint16_t | dev_id | ) |
Trigger the rawdev self test.
dev_id | The identifier of the device |