eventdev: add capabilities API

The caps API allows application to retrieve capability information
needed to configure the ethernet Rx adapter for the eventdev and
ethdev pair.

For e.g., the ethdev, eventdev pairing maybe such that all of the
ethdev Rx queues can only be connected to a single event queue, in
this case the application is required to pass in -1 as the queue id
when adding a receive queue to the adapter.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
This commit is contained in:
Nikhil Rao 2017-10-11 03:51:31 +05:30 committed by Jerin Jacob
parent be1bf6077e
commit 2b5c7409ec
5 changed files with 94 additions and 1 deletions

View File

@ -51,7 +51,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
DEPDIRS-librte_cryptodev := librte_eal librte_mempool librte_ring librte_mbuf
DEPDIRS-librte_cryptodev += librte_kvargs
DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += librte_eventdev
DEPDIRS-librte_eventdev := librte_eal librte_ring
DEPDIRS-librte_eventdev := librte_eal librte_ring librte_ether
DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether
DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash

View File

@ -56,6 +56,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
#include <rte_errno.h>
#include <rte_ethdev.h>
#include "rte_eventdev.h"
#include "rte_eventdev_pmd.h"
@ -128,6 +129,28 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
return 0;
}
int
rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id,
uint32_t *caps)
{
struct rte_eventdev *dev;
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_port_id, -EINVAL);
dev = &rte_eventdevs[dev_id];
if (caps == NULL)
return -EINVAL;
*caps = 0;
return dev->dev_ops->eth_rx_adapter_caps_get ?
(*dev->dev_ops->eth_rx_adapter_caps_get)(dev,
&rte_eth_devices[eth_port_id],
caps)
: 0;
}
static inline int
rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
{

View File

@ -1019,6 +1019,45 @@ struct rte_event {
};
};
/* Ethdev Rx adapter capability bitmap flags */
#define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1
/**< This flag is sent when the packet transfer mechanism is in HW.
* Ethdev can send packets to the event device using internal event port.
*/
#define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ 0x2
/**< Adapter supports multiple event queues per ethdev. Every ethdev
* Rx queue can be connected to a unique event queue.
*/
#define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID 0x4
/**< The application can override the adapter generated flow ID in the
* event. This flow ID can be specified when adding an ethdev Rx queue
* to the adapter using the ev member of struct rte_event_eth_rx_adapter
* @see struct rte_event_eth_rx_adapter_queue_conf::ev
* @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
*/
/**
* Retrieve the event device's ethdev Rx adapter capabilities for the
* specified ethernet port
*
* @param dev_id
* The identifier of the device.
*
* @param eth_port_id
* The identifier of the ethernet device.
*
* @param[out] caps
* A pointer to memory filled with Rx event adapter capabilities.
*
* @return
* - 0: Success, driver provides Rx event adapter capabilities for the
* ethernet device.
* - <0: Error code returned by the driver function.
*
*/
int
rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id,
uint32_t *caps);
struct rte_eventdev_driver;
struct rte_eventdev_ops;

View File

@ -86,6 +86,8 @@ extern "C" {
#define RTE_EVENTDEV_DETACHED (0)
#define RTE_EVENTDEV_ATTACHED (1)
struct rte_eth_dev;
/** Global structure used for maintaining state of allocated event devices */
struct rte_eventdev_global {
uint8_t nb_devs; /**< Number of devices found */
@ -429,6 +431,30 @@ typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev,
const char *name, unsigned int *id);
/**
* Retrieve the event device's ethdev Rx adapter capabilities for the
* specified ethernet port
*
* @param dev
* Event device pointer
*
* @param eth_dev
* Ethernet device pointer
*
* @param[out] caps
* A pointer to memory filled with Rx event adapter capabilities.
*
* @return
* - 0: Success, driver provides Rx event adapter capabilities for the
* ethernet device.
* - <0: Error code returned by the driver function.
*
*/
typedef int (*eventdev_eth_rx_adapter_caps_get_t)
(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev,
uint32_t *caps);
/** Event device operations function pointer table */
struct rte_eventdev_ops {
eventdev_info_get_t dev_infos_get; /**< Get device info. */
@ -468,6 +494,9 @@ struct rte_eventdev_ops {
/**< Get one value by name. */
eventdev_xstats_reset_t xstats_reset;
/**< Reset the statistics values in xstats. */
eventdev_eth_rx_adapter_caps_get_t eth_rx_adapter_caps_get;
/**< Get ethernet Rx adapter capabilities */
};
/**

View File

@ -54,4 +54,6 @@ DPDK_17.11 {
rte_event_port_attr_get;
rte_event_queue_attr_get;
rte_event_eth_rx_adapter_caps_get;
} DPDK_17.08;