[dpdk-dev] [PATCH v3 3/4] eventdev: add queue attribute function
Jerin Jacob
jerin.jacob at caviumnetworks.com
Mon Sep 11 19:36:17 CEST 2017
-----Original Message-----
> Date: Fri, 8 Sep 2017 16:36:54 +0100
> From: Harry van Haaren <harry.van.haaren at intel.com>
> To: dev at dpdk.org
> CC: jerin.jacob at caviumnetworks.com, Harry van Haaren
> <harry.van.haaren at intel.com>
> Subject: [PATCH v3 3/4] eventdev: add queue attribute function
> X-Mailer: git-send-email 2.7.4
>
> This commit adds a generic queue attribute function. It also removes
> the previous rte_event_queue_priority() and priority() functions, and
> updates the map files and unit tests to use the new attr functions.
>
> Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
> ---
> lib/librte_eventdev/rte_eventdev.c | 47 ++++++++--------
> lib/librte_eventdev/rte_eventdev.h | 49 ++++++++---------
> lib/librte_eventdev/rte_eventdev_version.map | 3 +-
> test/test/test_eventdev.c | 80 +++++++++++++++++++++-------
> test/test/test_eventdev_octeontx.c | 75 +++++++++++++++++++-------
> 5 files changed, 166 insertions(+), 88 deletions(-)
>
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index 4b1c0be..3756ec7 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -609,27 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
> return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
> }
>
> static inline int
> is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
> {
> @@ -794,6 +773,32 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
> }
>
> int
> +rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
> + uint32_t *attr_value /*out */)
> +{
> + struct rte_eventdev *dev;
> +
> + if (!attr_value)
> + return -EINVAL;
> +
> + 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;
> + }
> +
> + switch (attr_id) {
> + case RTE_EVENT_QUEUE_ATTR_PRIORITY:
> + *attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
> + if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
> + *attr_value = dev->data->queues_prio[queue_id];
> + break;
The same switch case comment.
> + };
> + return 0;
> +}
> +
> +int
> rte_event_port_link(uint8_t dev_id, uint8_t port_id,
> const uint8_t queues[], const uint8_t priorities[],
> uint16_t nb_links)
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index e931eb2..cd3026d 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -606,33 +606,6 @@ int
> rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
> const struct rte_event_queue_conf *queue_conf);
>
> -/**
> - * Get the number of event queues on a specific event device
> - *
> - * @param dev_id
> - * Event device identifier.
> - * @return
> - * - The number of configured event queues
> - */
> -uint8_t
> -rte_event_queue_count(uint8_t dev_id);
> -
> -/**
> - * Get the priority of the event queue on a specific event device
> - *
> - * @param dev_id
> - * Event device identifier.
> - * @param queue_id
> - * Event queue identifier.
> - * @return
> - * - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
> - * configured priority of the event queue in
> - * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST] range
> - * else the value RTE_EVENT_DEV_PRIORITY_NORMAL
> - */
> -uint8_t
> -rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
> -
> /* Event port specific APIs */
>
> /** Event port configuration structure */
> @@ -765,6 +738,28 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
> uint32_t *attr_value /*out */);
We can remove explicit /* out */.
>
> /**
> + * The priority of the queue.
> + */
> +#define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
> +
> +/**
> + * Get an attribute from a queue.
> + *
> + * @param dev_id Eventdev id
> + * @param queue_id Eventdev queue id
> + * @param attr_id The attribute ID to retrieve
> + * @param[out] attr_value A pointer that will be filled in with the attribute
> + * value if successful
> + *
> + * @retval 0 Successfully returned value
> + * -EINVAL invalid device, queue or attr_id provided, or attr_value
> + * was NULL
> + */
> +int
> +rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
> + uint32_t *attr_value /*out */);
> +
We can remove explicit /* out */.
More information about the dev
mailing list