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;
+	}
+
+	return 0;
 }
 
 int
@@ -757,6 +771,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_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_port(dev, port_id)) {
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index fadc209..e931eb2 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -715,15 +715,29 @@ 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
+ * 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
- *   Event device identifier.
- * @return
- *   - The number of configured ports
+ * @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
  */
-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 */);
 
 /**
  * The queue depth of the port on the enqueue side
diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
index a0adde3..484a071 100644
--- a/lib/librte_eventdev/rte_eventdev_version.map
+++ b/lib/librte_eventdev/rte_eventdev_version.map
@@ -21,7 +21,6 @@ DPDK_17.05 {
 	rte_event_port_setup;
 	rte_event_port_dequeue_depth;
 	rte_event_port_enqueue_depth;
-	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
 	rte_event_port_links_get;
@@ -55,6 +54,7 @@ DPDK_17.08 {
 EXPERIMENTAL {
 	global:
 
+	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
 
 } DPDK_17.08;
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index f3ec470..a87b113 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -386,11 +386,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 +441,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 +513,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;
 }
@@ -537,7 +549,12 @@ test_eventdev_start_stop(void)
 		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);
 	}
@@ -567,7 +584,12 @@ eventdev_setup_device(void)
 		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);
 	}
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index 774d030..dfe8611 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -224,7 +224,11 @@ _eventdev_setup(int mode)
 		}
 	}
 	/* 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);
@@ -651,18 +655,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 +698,18 @@ 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));
+	nr_links = RTE_MIN(port_count, rte_event_queue_count(evdev));
 	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 +761,18 @@ 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;
 
 	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 +873,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 +1029,19 @@ 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) {
 		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);
+			nr_ports, rte_lcore_count() - 1);
 		return TEST_SUCCESS;
 	}
 
@@ -1142,14 +1168,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;
 	}
 
@@ -1288,9 +1317,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__);
