[dpdk-dev] [PATCH v3 2/4] eventdev: add dev attribute get function
Jerin Jacob
jerin.jacob at caviumnetworks.com
Mon Sep 11 18:51:23 CEST 2017
-----Original Message-----
> Date: Fri, 8 Sep 2017 16:36:53 +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 2/4] eventdev: add dev attribute get function
> X-Mailer: git-send-email 2.7.4
>
> This commit adds a device attribute function, allowing flexible
> fetching of device attributes, like port count or queue count.
> The unit tests and .map file are updated to the new function.
>
> Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
> ---
> lib/librte_eventdev/rte_eventdev.c | 24 ++++++++--
> lib/librte_eventdev/rte_eventdev.h | 28 ++++++++---
> lib/librte_eventdev/rte_eventdev_version.map | 2 +-
> test/test/test_eventdev.c | 36 +++++++++++---
> test/test/test_eventdev_octeontx.c | 72 ++++++++++++++++++++--------
> 5 files changed, 124 insertions(+), 38 deletions(-)
>
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index a02ff0a..4b1c0be 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -743,13 +743,27 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
> return 0;
> }
>
> -uint8_t
> -rte_event_port_count(uint8_t dev_id)
> +int
> +rte_event_dev_attr_get(uint8_t dev_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];
> - return dev->data->nb_ports;
> +
> + switch (attr_id) {
> + case RTE_EVENT_DEV_ATTR_PORT_COUNT:
> + *attr_value = dev->data->nb_ports;
> + break;
> + case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
> + *attr_value = dev->data->nb_queues;
> + break;
Same as previous "default case" comment.
> + }
> +
> + return 0;
With above change:
Acked-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
More information about the dev
mailing list