DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ganapati Kundapura <ganapati.kundapura@intel.com>
To: jay.jayatheerthan@intel.com, jerinjacobk@gmail.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api
Date: Sun, 12 Sep 2021 10:01:51 -0500	[thread overview]
Message-ID: <20210912150152.1386089-1-ganapati.kundapura@intel.com> (raw)
In-Reply-To: <20210907085904.1034167-1-ganapati.kundapura@intel.com>

Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
schedular type, event priority, polling frequency of the receive queue
and flow identifier in rte_event_eth_rx_adapter_queue_conf structure

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

---
v4:
* squashed 1/3 and 3/3
* reused rte_event_eth_rx_adapter_queue_conf structure in place of
  rte_event_eth_rx_adapter_queue_info
* renamed to rte_event_eth_rx_adapter_queue_info_get() to
  rte_event_eth_rx_adapter_queue_conf_get to align with
  rte_event_eth_rx_adapter_queue_conf structure

v3:
* Split single patch into implementaion, test and document updation
  patches separately

v2:
* Fixed build issue due to missing entry in version.map

v1:
* Initial patch with implementaion, test and doc together
---
 .../prog_guide/event_ethernet_rx_adapter.rst       |  8 +++
 lib/eventdev/eventdev_pmd.h                        | 29 +++++++++
 lib/eventdev/rte_event_eth_rx_adapter.c            | 75 ++++++++++++++++++++++
 lib/eventdev/rte_event_eth_rx_adapter.h            | 26 ++++++++
 lib/eventdev/version.map                           |  1 +
 5 files changed, 139 insertions(+)

diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index c01e5a9..a6b14b9 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -146,6 +146,14 @@ if the callback is supported, and the counts maintained by the service function,
 if one exists. The service function also maintains a count of cycles for which
 it was not able to enqueue to the event device.
 
+Getting Adapter queue config
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The  ``rte_event_eth_rx_adapter_queue_conf_get()`` function reports
+flags for handling received packets, event queue identifier, scheduar type,
+event priority, polling frequency of the receive queue and flow identifier
+in struct ``rte_event_eth_rx_adapter_queue_conf``.
+
 Interrupt Based Rx Queues
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac..5b58385 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -562,6 +562,33 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
 					int32_t rx_queue_id);
 
 /**
+ * Retrieve information about Rx queue. This callback is invoked if
+ * the caps returned from the eventdev_eth_rx_adapter_caps_get(, eth_port_id)
+ * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set.
+ *
+ * @param dev
+ *  Event device pointer
+ *
+ * @param eth_dev
+ *  Ethernet device pointer
+ *
+ * @param rx_queue_id
+ *  Ethernet device receive queue index.
+ *
+ * @param[out] queue_conf
+ *  Pointer to rte_event_eth_rx_adapter_queue_conf structure
+ *
+ * @return
+ *  - 0: Success
+ *  - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_rx_adapter_queue_conf_get_t)
+			(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev,
+			uint16_t rx_queue_id,
+			struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+/**
  * Start ethernet Rx adapter. This callback is invoked if
  * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
  * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues
@@ -1107,6 +1134,8 @@ struct rte_eventdev_ops {
 	/**< Add Rx queues to ethernet Rx adapter */
 	eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del;
 	/**< Delete Rx queues from ethernet Rx adapter */
+	eventdev_eth_rx_adapter_queue_conf_get_t eth_rx_adapter_queue_conf_get;
+	/**< Get Rx adapter queue info */
 	eventdev_eth_rx_adapter_start_t eth_rx_adapter_start;
 	/**< Start ethernet Rx adapter */
 	eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop;
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 7c94c73..de8ab05 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2811,3 +2811,78 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
 
 	return 0;
 }
+
+int
+rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
+			uint16_t eth_dev_id,
+			uint16_t rx_queue_id,
+			struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct rte_eventdev *dev;
+	struct eth_device_info *dev_info;
+	struct rte_event_eth_rx_adapter *rx_adapter;
+	struct eth_rx_queue_info *queue_info;
+	struct rte_event *qi_ev;
+	int ret;
+	uint32_t cap;
+
+	RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL);
+
+	if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) {
+		RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id);
+		return -EINVAL;
+	}
+
+	if (queue_conf == NULL) {
+		RTE_EDEV_LOG_ERR("Rx queue conf struct cannot be NULL");
+		return -EINVAL;
+	}
+
+	rx_adapter = rxa_id_to_adapter(id);
+	if (rx_adapter == NULL)
+		return -EINVAL;
+
+	dev = &rte_eventdevs[rx_adapter->eventdev_id];
+	ret = rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id,
+						eth_dev_id,
+						&cap);
+	if (ret) {
+		RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+				 "eth port %" PRIu16, id, eth_dev_id);
+		return ret;
+	}
+
+	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
+		RTE_FUNC_PTR_OR_ERR_RET(
+				*dev->dev_ops->eth_rx_adapter_queue_conf_get,
+				-ENOTSUP);
+		ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
+						&rte_eth_devices[eth_dev_id],
+						rx_queue_id,
+						queue_conf);
+		return ret;
+	}
+
+	dev_info = &rx_adapter->eth_devices[eth_dev_id];
+
+	queue_info = &dev_info->rx_queue[rx_queue_id];
+	if (!queue_info->queue_enabled) {
+		RTE_EDEV_LOG_ERR("Rx queue %u not added", rx_queue_id);
+		return -EINVAL;
+	}
+
+	qi_ev = (struct rte_event *)&queue_info->event;
+
+	memset(queue_conf, 0, sizeof(*queue_conf));
+	queue_conf->rx_queue_flags = 0;
+	if (queue_info->flow_id_mask != 0)
+		queue_conf->rx_queue_flags |=
+			RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+
+	queue_conf->servicing_weight = queue_info->wt;
+
+	memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev));
+
+	return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 182dd2e..2f24c34 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -33,6 +33,7 @@
  *  - rte_event_eth_rx_adapter_stop()
  *  - rte_event_eth_rx_adapter_stats_get()
  *  - rte_event_eth_rx_adapter_stats_reset()
+ *  - rte_event_eth_rx_adapter_queue_conf_get()
  *
  * The application creates an ethernet to event adapter using
  * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@@ -575,6 +576,31 @@ int rte_event_eth_rx_adapter_queue_event_vector_config(
 	uint8_t id, uint16_t eth_dev_id, int32_t rx_queue_id,
 	struct rte_event_eth_rx_adapter_event_vector_config *config);
 
+/**
+ * Retrieve Rx queue config information.
+ *
+ * @param id
+ *  Adapter identifier.
+
+ * @param eth_dev_id
+ *  Port identifier of Ethernet device.
+
+ * @param rx_queue_id
+ *  Ethernet device receive queue index.
+
+ * @param[out] queue_conf
+ *  Pointer to struct rte_event_eth_rx_adapter_queue_conf
+
+ * @return
+ *  - 0: Success, Receive queue added correctly.
+ *  - <0: Error code on failure.
+ */
+__rte_experimental
+int rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
+		     uint16_t eth_dev_id,
+		     uint16_t rx_queue_id,
+		     struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 8862562..5562c78 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -143,6 +143,7 @@ EXPERIMENTAL {
 	rte_event_vector_pool_create;
 	rte_event_eth_rx_adapter_vector_limits_get;
 	rte_event_eth_rx_adapter_queue_event_vector_config;
+	rte_event_eth_rx_adapter_queue_conf_get;
 	__rte_eventdev_trace_crypto_adapter_enqueue;
 };
 
-- 
2.6.4


  parent reply	other threads:[~2021-09-12 15:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  5:36 [dpdk-dev] [PATCH] eventdev: add rx queue info " Ganapati Kundapura
2021-09-07  6:25 ` Jayatheerthan, Jay
2021-09-07  6:39   ` Kundapura, Ganapati
2021-09-07  6:45 ` [dpdk-dev] [PATCH v3 1/3] " Ganapati Kundapura
2021-09-07  6:45   ` [dpdk-dev] [PATCH v3 2/3] test/event: Add rx queue info get test in rx adapter autotest Ganapati Kundapura
2021-09-07  6:45   ` [dpdk-dev] [PATCH v3 3/3] doc: add rx queue get api detail in rx adapter guide Ganapati Kundapura
2021-09-07  8:12   ` [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api Jerin Jacob
2021-09-07  8:50     ` Kundapura, Ganapati
2021-09-07  9:37       ` Jerin Jacob
2021-09-08  8:21         ` Kundapura, Ganapati
2021-09-16  4:42           ` Jerin Jacob
2021-09-16  8:35             ` Kundapura, Ganapati
2021-09-16  8:47               ` Jerin Jacob
2021-09-16 10:31                 ` Kundapura, Ganapati
2021-09-07  8:49   ` [dpdk-dev] [PATCH v4 1/2] " Ganapati Kundapura
2021-09-07  8:49     ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue info get test in rx adapter autotest Ganapati Kundapura
2021-09-07  8:59     ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue info get api Ganapati Kundapura
2021-09-07  8:59       ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue info get test in rx adapter autotest Ganapati Kundapura
2021-09-12 15:01       ` Ganapati Kundapura [this message]
2021-09-12 15:01         ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf " Ganapati Kundapura
2021-09-12 15:58           ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
2021-09-12 15:58             ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest Ganapati Kundapura
2021-09-16 11:56             ` [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
2021-09-16 11:56               ` [dpdk-dev] [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest Ganapati Kundapura
2021-09-16 12:51             ` [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
2021-09-16 12:51               ` [dpdk-dev] [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest Ganapati Kundapura
2021-09-28  9:35                 ` Jayatheerthan, Jay
2021-09-20  6:30               ` [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api Jerin Jacob
2021-09-20  9:13                 ` Kundapura, Ganapati
2021-09-22 11:18                   ` Kundapura, Ganapati
2021-09-24  7:49                     ` Jayatheerthan, Jay
2021-09-28  9:34               ` Jayatheerthan, Jay
2021-09-29  7:36                 ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210912150152.1386089-1-ganapati.kundapura@intel.com \
    --to=ganapati.kundapura@intel.com \
    --cc=dev@dpdk.org \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinjacobk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).