eventdev: add dev attribute get function
authorHarry van Haaren <harry.van.haaren@intel.com>
Wed, 20 Sep 2017 13:36:00 +0000 (14:36 +0100)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Tue, 10 Oct 2017 16:31:04 +0000 (18:31 +0200)
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@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
lib/librte_eventdev/rte_eventdev.c
lib/librte_eventdev/rte_eventdev.h
lib/librte_eventdev/rte_eventdev_version.map
test/test/test_eventdev.c
test/test/test_eventdev_octeontx.c

index df61a19..7456213 100644 (file)
@@ -613,15 +613,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
        return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
-rte_event_queue_count(uint8_t dev_id)
-{
-       struct rte_eventdev *dev;
-
-       dev = &rte_eventdevs[dev_id];
-       return dev->data->nb_queues;
-}
-
 uint8_t
 rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
 {
@@ -747,13 +738,29 @@ 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)
 {
        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;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
 }
 
 int
@@ -761,6 +768,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
                        uint32_t *attr_value)
 {
        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_port(dev, port_id)) {
index a01510a..7acd62b 100644 (file)
@@ -399,6 +399,32 @@ struct rte_event_dev_info {
 int
 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
 
+/**
+ * The count of ports.
+ */
+#define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
+/**
+ * The count of queues.
+ */
+#define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+
+/**
+ * Get an attribute from a device.
+ *
+ * @param dev_id Eventdev 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 retrieved attribute value
+ *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
+ *         is NULL
+ */
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+                      uint32_t *attr_value);
+
+
 /* Event device configuration bitmap flags */
 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
@@ -714,17 +740,6 @@ int
 rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
                     const struct rte_event_port_conf *port_conf);
 
-/**
- * Get the number of ports on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured ports
- */
-uint8_t
-rte_event_port_count(uint8_t dev_id);
-
 /**
  * The queue depth of the port on the enqueue side
  */
index 57d0b72..1353a6d 100644 (file)
@@ -19,14 +19,12 @@ DPDK_17.05 {
 
        rte_event_port_default_conf_get;
        rte_event_port_setup;
-       rte_event_port_count;
        rte_event_port_link;
        rte_event_port_unlink;
        rte_event_port_links_get;
 
        rte_event_queue_default_conf_get;
        rte_event_queue_setup;
-       rte_event_queue_count;
        rte_event_queue_priority;
 
        rte_event_dequeue_timeout_ticks;
@@ -53,6 +51,7 @@ DPDK_17.08 {
 DPDK_17.11 {
        global:
 
+       rte_event_dev_attr_get;
        rte_event_port_attr_get;
 
 } DPDK_17.08;
index 7db9a9f..47514e6 100644 (file)
@@ -273,7 +273,12 @@ test_eventdev_queue_default_conf_get(void)
        ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, NULL);
        TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+
+       for (i = 0; i < (int)queue_count; i++) {
                ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i,
                                                 &qconf);
                TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d info", i);
@@ -318,8 +323,12 @@ test_eventdev_queue_setup(void)
        ret = rte_event_queue_setup(TEST_DEV_ID, 0, &qconf);
        TEST_ASSERT_SUCCESS(ret, "Failed to setup queue0");
 
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       for (i = 0; i < (int)queue_count; i++) {
                ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
        }
@@ -336,8 +345,12 @@ test_eventdev_queue_count(void)
        ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
        TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
-       TEST_ASSERT_EQUAL(rte_event_queue_count(TEST_DEV_ID),
-                info.max_event_queues, "Wrong queue count");
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       TEST_ASSERT_EQUAL(queue_count, info.max_event_queues,
+                         "Wrong queue count");
 
        return TEST_SUCCESS;
 }
@@ -353,7 +366,12 @@ test_eventdev_queue_priority(void)
        ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
        TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+
+       for (i = 0; i < (int)queue_count; i++) {
                ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i,
                                        &qconf);
                TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
@@ -362,8 +380,9 @@ test_eventdev_queue_priority(void)
                TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
        }
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       for (i = 0; i < (int)queue_count; i++) {
                priority =  rte_event_queue_priority(TEST_DEV_ID, i);
+
                if (info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
                        TEST_ASSERT_EQUAL(priority,
                         i %  RTE_EVENT_DEV_PRIORITY_LOWEST,
@@ -386,11 +405,16 @@ test_eventdev_port_default_conf_get(void)
        ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, NULL);
        TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+
        ret = rte_event_port_default_conf_get(TEST_DEV_ID,
-                       rte_event_port_count(TEST_DEV_ID) + 1, NULL);
+                       port_count + 1, NULL);
        TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
-       for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_default_conf_get(TEST_DEV_ID, i,
                                                        &pconf);
                TEST_ASSERT_SUCCESS(ret, "Failed to get port%d info", i);
@@ -436,8 +460,12 @@ test_eventdev_port_setup(void)
        ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
        TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
 
-       for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
        }
@@ -504,8 +532,11 @@ test_eventdev_port_count(void)
        ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
        TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
-       TEST_ASSERT_EQUAL(rte_event_port_count(TEST_DEV_ID),
-                info.max_event_ports, "Wrong port count");
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+       TEST_ASSERT_EQUAL(port_count, info.max_event_ports, "Wrong port count");
 
        return TEST_SUCCESS;
 }
@@ -532,19 +563,28 @@ test_eventdev_start_stop(void)
        ret = eventdev_configure_setup();
        TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev");
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       for (i = 0; i < (int)queue_count; i++) {
                ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
        }
 
-       for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
        }
 
        ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
-       TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID),
-                       "Failed to link port, device %d", TEST_DEV_ID);
+       TEST_ASSERT(ret == (int)queue_count, "Failed to link port, device %d",
+                   TEST_DEV_ID);
 
        ret = rte_event_dev_start(TEST_DEV_ID);
        TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID);
@@ -562,19 +602,28 @@ eventdev_setup_device(void)
        ret = eventdev_configure_setup();
        TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev");
 
-       for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) {
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       for (i = 0; i < (int)queue_count; i++) {
                ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
        }
 
-       for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
        }
 
        ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
-       TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID),
-                       "Failed to link port, device %d", TEST_DEV_ID);
+       TEST_ASSERT(ret == (int)queue_count, "Failed to link port, device %d",
+                   TEST_DEV_ID);
 
        ret = rte_event_dev_start(TEST_DEV_ID);
        TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID);
@@ -599,7 +648,11 @@ test_eventdev_link(void)
        TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d",
                                 TEST_DEV_ID);
 
-       nb_queues = rte_event_queue_count(TEST_DEV_ID);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       nb_queues = queue_count;
        for (i = 0; i < nb_queues; i++) {
                queues[i] = i;
                priorities[i] = RTE_EVENT_DEV_PRIORITY_NORMAL;
@@ -622,7 +675,11 @@ test_eventdev_unlink(void)
        TEST_ASSERT(ret >= 0, "Failed to unlink with NULL device%d",
                                 TEST_DEV_ID);
 
-       nb_queues = rte_event_queue_count(TEST_DEV_ID);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       nb_queues = queue_count;
        for (i = 0; i < nb_queues; i++)
                queues[i] = i;
 
@@ -636,7 +693,7 @@ test_eventdev_unlink(void)
 static int
 test_eventdev_link_get(void)
 {
-       int ret, nb_queues, i;
+       int ret, i;
        uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
        uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV];
 
@@ -645,7 +702,11 @@ test_eventdev_link_get(void)
        TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d",
                                 TEST_DEV_ID);
 
-       nb_queues = rte_event_queue_count(TEST_DEV_ID);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+                           "Queue count get failed");
+       const int nb_queues = queue_count;
        for (i = 0; i < nb_queues; i++)
                queues[i] = i;
 
@@ -657,7 +718,6 @@ test_eventdev_link_get(void)
        TEST_ASSERT(ret == 0, "(%d)Wrong link get=%d", TEST_DEV_ID, ret);
 
        /* link all queues and get the links */
-       nb_queues = rte_event_queue_count(TEST_DEV_ID);
        for (i = 0; i < nb_queues; i++) {
                queues[i] = i;
                priorities[i] = RTE_EVENT_DEV_PRIORITY_NORMAL;
@@ -687,8 +747,8 @@ test_eventdev_link_get(void)
        ret = rte_event_port_unlink(TEST_DEV_ID, 0, NULL, 0);
        TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d",
                                 TEST_DEV_ID, ret);
+
        /* 4links and 2 unlinks */
-       nb_queues = rte_event_queue_count(TEST_DEV_ID);
        if (nb_queues >= 4) {
                for (i = 0; i < 4; i++) {
                        queues[i] = i;
index 774d030..b88b0d2 100644 (file)
@@ -193,8 +193,13 @@ _eventdev_setup(int mode)
        ret = rte_event_dev_configure(evdev, &dev_conf);
        TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev");
 
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+
        if (mode == TEST_EVENTDEV_SETUP_PRIORITY) {
-               if (rte_event_queue_count(evdev) > 8) {
+               if (queue_count > 8) {
                        printf("test expects the unique priority per queue\n");
                        return -ENOTSUP;
                }
@@ -204,8 +209,8 @@ _eventdev_setup(int mode)
                 * RTE_EVENT_DEV_PRIORITY_LOWEST
                 */
                uint8_t step = (RTE_EVENT_DEV_PRIORITY_LOWEST + 1) /
-                               rte_event_queue_count(evdev);
-               for (i = 0; i < rte_event_queue_count(evdev); i++) {
+                               queue_count;
+               for (i = 0; i < (int)queue_count; i++) {
                        struct rte_event_queue_conf queue_conf;
 
                        ret = rte_event_queue_default_conf_get(evdev, i,
@@ -218,13 +223,17 @@ _eventdev_setup(int mode)
 
        } else {
                /* Configure event queues with default priority */
-               for (i = 0; i < rte_event_queue_count(evdev); i++) {
+               for (i = 0; i < (int)queue_count; i++) {
                        ret = rte_event_queue_setup(evdev, i, NULL);
                        TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i);
                }
        }
        /* Configure event ports */
-       for (i = 0; i < rte_event_port_count(evdev); i++) {
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_setup(evdev, i, NULL);
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i);
                ret = rte_event_port_link(evdev, i, NULL, NULL, 0);
@@ -335,6 +344,11 @@ generate_random_events(const unsigned int total_events)
        unsigned int i;
        int ret;
 
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+
        ret = rte_event_dev_info_get(evdev, &info);
        TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
        for (i = 0; i < total_events; i++) {
@@ -343,7 +357,7 @@ generate_random_events(const unsigned int total_events)
                        rte_rand() % (RTE_EVENT_TYPE_CPU + 1) /* event_type */,
                        rte_rand() % 256 /* sub_event_type */,
                        rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1),
-                       rte_rand() % rte_event_queue_count(evdev) /* queue */,
+                       rte_rand() % queue_count /* queue */,
                        0 /* port */,
                        1 /* events */);
                if (ret)
@@ -482,7 +496,7 @@ test_multi_queue_enq_single_port_deq(void)
 }
 
 /*
- * Inject 0..MAX_EVENTS events over 0..rte_event_queue_count() with modulus
+ * Inject 0..MAX_EVENTS events over 0..queue_count with modulus
  * operation
  *
  * For example, Inject 32 events over 0..7 queues
@@ -498,15 +512,19 @@ test_multi_queue_enq_single_port_deq(void)
 static int
 validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev)
 {
-       uint32_t range = MAX_EVENTS / rte_event_queue_count(evdev);
-       uint32_t expected_val = (index % range) * rte_event_queue_count(evdev);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+       uint32_t range = MAX_EVENTS / queue_count;
+       uint32_t expected_val = (index % range) * queue_count;
 
        expected_val += ev->queue_id;
        RTE_SET_USED(port);
        TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val,
        "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d",
                        ev->mbuf->seqn, index, expected_val, range,
-                       rte_event_queue_count(evdev), MAX_EVENTS);
+                       queue_count, MAX_EVENTS);
        return 0;
 }
 
@@ -518,8 +536,12 @@ test_multi_queue_priority(void)
        int i, max_evts_roundoff;
 
        /* See validate_queue_priority() comments for priority validate logic */
-       max_evts_roundoff  = MAX_EVENTS / rte_event_queue_count(evdev);
-       max_evts_roundoff *= rte_event_queue_count(evdev);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+       max_evts_roundoff  = MAX_EVENTS / queue_count;
+       max_evts_roundoff *= queue_count;
 
        for (i = 0; i < max_evts_roundoff; i++) {
                struct rte_event ev = {.event = 0, .u64 = 0};
@@ -528,7 +550,7 @@ test_multi_queue_priority(void)
                TEST_ASSERT_NOT_NULL(m, "mempool alloc failed");
 
                m->seqn = i;
-               queue = i % rte_event_queue_count(evdev);
+               queue = i % queue_count;
                update_event_and_validation_attr(m, &ev, 0, RTE_EVENT_TYPE_CPU,
                        0, RTE_SCHED_TYPE_PARALLEL, queue, 0);
                rte_event_enqueue_burst(evdev, 0, &ev, 1);
@@ -651,18 +673,21 @@ static int
 test_multi_queue_enq_multi_port_deq(void)
 {
        const unsigned int total_events = MAX_EVENTS;
-       uint8_t nr_ports;
+       uint32_t nr_ports;
        int ret;
 
        ret = generate_random_events(total_events);
        if (ret)
                return TEST_FAILED;
 
-       nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
+       nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1);
 
        if (!nr_ports) {
                printf("%s: Not enough ports=%d or workers=%d\n", __func__,
-                       rte_event_port_count(evdev), rte_lcore_count() - 1);
+                       nr_ports, rte_lcore_count() - 1);
                return TEST_SUCCESS;
        }
 
@@ -691,14 +716,23 @@ test_queue_to_port_single_link(void)
 {
        int i, nr_links, ret;
 
+       uint32_t port_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &port_count), "Port count get failed");
+
        /* Unlink all connections that created in eventdev_setup */
-       for (i = 0; i < rte_event_port_count(evdev); i++) {
+       for (i = 0; i < (int)port_count; i++) {
                ret = rte_event_port_unlink(evdev, i, NULL, 0);
                TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i);
        }
 
-       nr_links = RTE_MIN(rte_event_port_count(evdev),
-                               rte_event_queue_count(evdev));
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+
+       nr_links = RTE_MIN(port_count, queue_count);
        const unsigned int total_events = MAX_EVENTS / nr_links;
 
        /* Link queue x to port x and inject events to queue x through port x */
@@ -750,10 +784,20 @@ static int
 test_queue_to_port_multi_link(void)
 {
        int ret, port0_events = 0, port1_events = 0;
-       uint8_t nr_queues, nr_ports, queue, port;
+       uint8_t queue, port;
+       uint32_t nr_queues = 0;
+       uint32_t nr_ports = 0;
+
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &nr_queues), "Queue count get failed");
 
-       nr_queues = rte_event_queue_count(evdev);
-       nr_ports = rte_event_port_count(evdev);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                               &nr_queues), "Queue count get failed");
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
 
        if (nr_ports < 2) {
                printf("%s: Not enough ports to test ports=%d\n",
@@ -854,14 +898,17 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type,
                        uint8_t out_sched_type)
 {
        const unsigned int total_events = MAX_EVENTS;
-       uint8_t nr_ports;
+       uint32_t nr_ports;
        int ret;
 
-       nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
+       nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1);
 
        if (!nr_ports) {
                printf("%s: Not enough ports=%d or workers=%d\n", __func__,
-                       rte_event_port_count(evdev), rte_lcore_count() - 1);
+                       nr_ports, rte_lcore_count() - 1);
                return TEST_SUCCESS;
        }
 
@@ -1007,15 +1054,23 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type,
                        uint8_t out_sched_type)
 {
        const unsigned int total_events = MAX_EVENTS;
-       uint8_t nr_ports;
+       uint32_t nr_ports;
        int ret;
 
-       nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
+
+       nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1);
 
-       if (rte_event_queue_count(evdev) < 2 ||  !nr_ports) {
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+       if (queue_count < 2 ||  !nr_ports) {
                printf("%s: Not enough queues=%d ports=%d or workers=%d\n",
-                        __func__, rte_event_queue_count(evdev),
-                       rte_event_port_count(evdev), rte_lcore_count() - 1);
+                        __func__, queue_count, nr_ports,
+                        rte_lcore_count() - 1);
                return TEST_SUCCESS;
        }
 
@@ -1142,14 +1197,17 @@ worker_flow_based_pipeline_max_stages_rand_sched_type(void *arg)
 static int
 launch_multi_port_max_stages_random_sched_type(int (*fn)(void *))
 {
-       uint8_t nr_ports;
+       uint32_t nr_ports;
        int ret;
 
-       nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
+       nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1);
 
        if (!nr_ports) {
                printf("%s: Not enough ports=%d or workers=%d\n", __func__,
-                       rte_event_port_count(evdev), rte_lcore_count() - 1);
+                       nr_ports, rte_lcore_count() - 1);
                return TEST_SUCCESS;
        }
 
@@ -1184,7 +1242,11 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg)
        struct rte_event ev;
        uint16_t valid_event;
        uint8_t port = param->port;
-       uint8_t nr_queues = rte_event_queue_count(evdev);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+       uint8_t nr_queues = queue_count;
        rte_atomic32_t *total_events = param->total_events;
 
        while (rte_atomic32_read(total_events) > 0) {
@@ -1222,7 +1284,11 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg)
        struct rte_event ev;
        uint16_t valid_event;
        uint8_t port = param->port;
-       uint8_t nr_queues = rte_event_queue_count(evdev);
+       uint32_t queue_count;
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                           RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+                           &queue_count), "Queue count get failed");
+       uint8_t nr_queues = queue_count;
        rte_atomic32_t *total_events = param->total_events;
 
        while (rte_atomic32_read(total_events) > 0) {
@@ -1288,9 +1354,12 @@ worker_ordered_flow_producer(void *arg)
 static inline int
 test_producer_consumer_ingress_order_test(int (*fn)(void *))
 {
-       uint8_t nr_ports;
+       uint32_t nr_ports;
 
-       nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+       TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
+                               RTE_EVENT_DEV_ATTR_PORT_COUNT,
+                               &nr_ports), "Port count get failed");
+       nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1);
 
        if (rte_lcore_count() < 3 || nr_ports < 2) {
                printf("### Not enough cores for %s test.\n", __func__);