-----Original Message----- > Date: Fri, 8 Sep 2017 16:36:53 +0100 > From: Harry van Haaren <harry.van.haa...@intel.com> > To: dev@dpdk.org > CC: jerin.ja...@caviumnetworks.com, Harry van Haaren > <harry.van.haa...@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.haa...@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.ja...@caviumnetworks.com>