eventdev: support setting queue attributes at runtime

Added a new eventdev API rte_event_queue_attr_set(), to set event queue
attributes at runtime from the values set during initialization using
rte_event_queue_setup(). PMD's supporting this feature should expose the
capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Shijith Thotton 2022-05-16 23:05:47 +05:30 committed by Jerin Jacob
parent e8594de273
commit 97b914f4e7
6 changed files with 86 additions and 1 deletions

View File

@ -17,6 +17,7 @@ runtime_port_link =
multiple_queue_port = multiple_queue_port =
carry_flow_id = carry_flow_id =
maintenance_free = maintenance_free =
runtime_queue_attr =
; ;
; Features of a default Ethernet Rx adapter. ; Features of a default Ethernet Rx adapter.

View File

@ -92,6 +92,11 @@ New Features
to quiesce any lcore-specific resources consumed by the event port, to quiesce any lcore-specific resources consumed by the event port,
when the lcore is no more associated with an event port. when the lcore is no more associated with an event port.
* **Added support for setting queue attributes at runtime in eventdev.**
Added new API ``rte_event_queue_attr_set()``, to set event queue attributes
at runtime.
Removed Items Removed Items
------------- -------------

View File

@ -341,6 +341,26 @@ typedef int (*eventdev_queue_setup_t)(struct rte_eventdev *dev,
typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev, typedef void (*eventdev_queue_release_t)(struct rte_eventdev *dev,
uint8_t queue_id); uint8_t queue_id);
/**
* Set an event queue attribute at runtime.
*
* @param dev
* Event device pointer
* @param queue_id
* Event queue index
* @param attr_id
* Event queue attribute id
* @param attr_value
* Event queue attribute value
*
* @return
* - 0: Success.
* - <0: Error code on failure.
*/
typedef int (*eventdev_queue_attr_set_t)(struct rte_eventdev *dev,
uint8_t queue_id, uint32_t attr_id,
uint64_t attr_value);
/** /**
* Retrieve the default event port configuration. * Retrieve the default event port configuration.
* *
@ -1228,6 +1248,8 @@ struct eventdev_ops {
/**< Set up an event queue. */ /**< Set up an event queue. */
eventdev_queue_release_t queue_release; eventdev_queue_release_t queue_release;
/**< Release an event queue. */ /**< Release an event queue. */
eventdev_queue_attr_set_t queue_attr_set;
/**< Set an event queue attribute. */
eventdev_port_default_conf_get_t port_def_conf; eventdev_port_default_conf_get_t port_def_conf;
/**< Get default port configuration. */ /**< Get default port configuration. */

View File

@ -863,6 +863,32 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
return 0; return 0;
} }
int
rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
uint64_t attr_value)
{
struct rte_eventdev *dev;
RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
dev = &rte_eventdevs[dev_id];
if (!is_valid_queue(dev, queue_id)) {
RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
return -EINVAL;
}
if (!(dev->data->event_dev_cap &
RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR)) {
RTE_EDEV_LOG_ERR(
"Device %" PRIu8 "does not support changing queue attributes at runtime",
dev_id);
return -ENOTSUP;
}
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_attr_set, -ENOTSUP);
return (*dev->dev_ops->queue_attr_set)(dev, queue_id, attr_id,
attr_value);
}
int int
rte_event_port_link(uint8_t dev_id, uint8_t port_id, rte_event_port_link(uint8_t dev_id, uint8_t port_id,
const uint8_t queues[], const uint8_t priorities[], const uint8_t queues[], const uint8_t priorities[],

View File

@ -225,7 +225,7 @@ struct rte_event;
/**< Event scheduling prioritization is based on the priority associated with /**< Event scheduling prioritization is based on the priority associated with
* each event queue. * each event queue.
* *
* @see rte_event_queue_setup() * @see rte_event_queue_setup(), rte_event_queue_attr_set()
*/ */
#define RTE_EVENT_DEV_CAP_EVENT_QOS (1ULL << 1) #define RTE_EVENT_DEV_CAP_EVENT_QOS (1ULL << 1)
/**< Event scheduling prioritization is based on the priority associated with /**< Event scheduling prioritization is based on the priority associated with
@ -307,6 +307,13 @@ struct rte_event;
* global pool, or process signaling related to load balancing. * global pool, or process signaling related to load balancing.
*/ */
#define RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR (1ULL << 11)
/**< Event device is capable of changing the queue attributes at runtime i.e
* after rte_event_queue_setup() or rte_event_start() call sequence. If this
* flag is not set, eventdev queue attributes can only be configured during
* rte_event_queue_setup().
*/
/* Event device priority levels */ /* Event device priority levels */
#define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0
/**< Highest priority expressed across eventdev subsystem /**< Highest priority expressed across eventdev subsystem
@ -702,6 +709,29 @@ int
rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
uint32_t *attr_value); uint32_t *attr_value);
/**
* Set an event queue attribute.
*
* @param dev_id
* Eventdev id
* @param queue_id
* Eventdev queue id
* @param attr_id
* The attribute ID to set
* @param attr_value
* The attribute value to set
*
* @return
* - 0: Successfully set attribute.
* - -EINVAL: invalid device, queue or attr_id.
* - -ENOTSUP: device does not support setting the event attribute.
* - <0: failed to set event queue attribute
*/
__rte_experimental
int
rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
uint64_t attr_value);
/* Event port specific APIs */ /* Event port specific APIs */
/* Event port configuration bitmap flags */ /* Event port configuration bitmap flags */

View File

@ -111,6 +111,7 @@ EXPERIMENTAL {
# added in 22.07 # added in 22.07
rte_event_port_quiesce; rte_event_port_quiesce;
rte_event_queue_attr_set;
}; };
INTERNAL { INTERNAL {