* [dpdk-dev] [PATCH] eventdev: add rx queue info get api
@ 2021-09-07 5:36 Ganapati Kundapura
2021-09-07 6:25 ` Jayatheerthan, Jay
2021-09-07 6:45 ` [dpdk-dev] [PATCH v3 1/3] " Ganapati Kundapura
0 siblings, 2 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 5:36 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Added rte_event_eth_rx_adapter_queue_info_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_info structure
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v2:
* build failed due to missing entry in version.map
* added entry in version.map
---
app/test/test_event_eth_rx_adapter.c | 22 +++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 8 +++
lib/eventdev/eventdev_pmd.h | 31 +++++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 76 ++++++++++++++++++++++
lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++
lib/eventdev/version.map | 1 +
6 files changed, 209 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..c642e1b 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_info(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_info queue_info;
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_info);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_info),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index c01e5a9..9897985 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 info
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``rte_event_eth_rx_adapter_queue_info_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_info``.
+
Interrupt Based Rx Queues
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac..20cc0a7 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
const struct rte_eth_dev *eth_dev,
int32_t rx_queue_id);
+struct rte_event_eth_rx_adapter_queue_info;
+
+/**
+ * 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] info
+ * Pointer to rte_event_eth_rx_adapter_queue_info structure
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
+
/**
* Start ethernet Rx adapter. This callback is invoked if
* the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
@@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
return 0;
}
+
+int
+rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info)
+{
+ 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 (info == NULL) {
+ RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
+ -ENOTSUP);
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ info);
+ 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(info, 0, sizeof(*info));
+ info->servicing_weight = queue_info->wt;
+ info->event_queue_id = qi_ev->queue_id;
+ info->sched_type = qi_ev->sched_type;
+ info->priority = qi_ev->priority;
+ info->rx_queue_flags = 0;
+ if (queue_info->flow_id_mask != 0) {
+ info->rx_queue_flags |=
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ info->flow_id = qi_ev->flow_id;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 182dd2e..75c0010 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_info_get()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
void *arg);
/**
+ * Rx queue info
+ */
+struct rte_event_eth_rx_adapter_queue_info {
+ uint32_t rx_queue_flags;
+ /**< Flags for handling received packets
+ * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
+ */
+ uint16_t servicing_weight;
+ /**< Relative polling frequency of ethernet receive queue when the
+ * adapter uses a service core function for ethernet to event device
+ * transfers. If it is set to zero, the Rx queue is interrupt driven
+ * (unless rx queue interrupts are not enabled for the ethernet
+ * device).
+ */
+
+ uint8_t event_queue_id;
+ /**< Targeted event queue identifier for the enqueue or
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queues - 1] which previously supplied to
+ * rte_event_dev_configure().
+ */
+
+ uint8_t sched_type;
+ /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
+ * associated with flow id on a given event queue
+ * for the enqueue and dequeue operation.
+ */
+
+ uint8_t priority;
+ /**< Event priority relative to other events in the
+ * event queue. The requested priority should in the
+ * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
+ * RTE_EVENT_DEV_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested
+ * priority to supported priority value.
+ * Valid when the device has
+ * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
+ */
+
+ uint32_t flow_id;
+ /**< Targeted flow identifier for the enqueue and
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queue_flows - 1] which
+ * previously supplied to rte_event_dev_configure().
+ */
+};
+
+/**
* Rx queue configuration structure
*/
struct rte_event_eth_rx_adapter_queue_conf {
@@ -575,6 +626,26 @@ 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 information about Rx queue.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Port identifier of Ethernet device.
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ * @param info
+ * Pointer to struct rte_event_eth_rx_adapter_queue_info
+ * @return
+ * - 0: Success, Receive queue added correctly.
+ * - <0: Error code on failure.
+ */
+int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
+ uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 8862562..258affd 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_info_get;
__rte_eventdev_trace_crypto_adapter_enqueue;
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev: add rx queue info get api
2021-09-07 5:36 [dpdk-dev] [PATCH] eventdev: add rx queue info get api 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
1 sibling, 1 reply; 34+ messages in thread
From: Jayatheerthan, Jay @ 2021-09-07 6:25 UTC (permalink / raw)
To: Kundapura, Ganapati, jerinjacobk; +Cc: dev
Hi Ganapati,
Could you split these patches to logical units to make it easy to review ? In addition, add patch version in subject field.
-Jay
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Tuesday, September 7, 2021 11:07 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinjacobk@gmail.com
> Cc: dev@dpdk.org
> Subject: [PATCH] eventdev: add rx queue info get api
>
> Added rte_event_eth_rx_adapter_queue_info_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_info structure
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> ---
> v2:
> * build failed due to missing entry in version.map
> * added entry in version.map
> ---
> app/test/test_event_eth_rx_adapter.c | 22 +++++++
> .../prog_guide/event_ethernet_rx_adapter.rst | 8 +++
> lib/eventdev/eventdev_pmd.h | 31 +++++++++
> lib/eventdev/rte_event_eth_rx_adapter.c | 76 ++++++++++++++++++++++
> lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++
> lib/eventdev/version.map | 1 +
> 6 files changed, 209 insertions(+)
>
> diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
> index 9198767..c642e1b 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -750,6 +750,27 @@ adapter_stats(void)
> return TEST_SUCCESS;
> }
>
> +static int
> +adapter_queue_info(void)
> +{
> + int err;
> + struct rte_event_eth_rx_adapter_queue_info queue_info;
> +
> + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
> + 0, &queue_info);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
> + -1, &queue_info);
> + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> +
> + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
> + 0, NULL);
> + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> +
> + return TEST_SUCCESS;
> +}
> +
> static struct unit_test_suite event_eth_rx_tests = {
> .suite_name = "rx event eth adapter test suite",
> .setup = testsuite_setup,
> @@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
> adapter_multi_eth_add_del),
> TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
> TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
> + TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_info),
> TEST_CASES_END() /**< NULL terminate unit test array */
> }
> };
> diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> index c01e5a9..9897985 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 info
> +~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The ``rte_event_eth_rx_adapter_queue_info_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_info``.
> +
> Interrupt Based Rx Queues
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 0f724ac..20cc0a7 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
> const struct rte_eth_dev *eth_dev,
> int32_t rx_queue_id);
>
> +struct rte_event_eth_rx_adapter_queue_info;
> +
> +/**
> + * 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] info
> + * Pointer to rte_event_eth_rx_adapter_queue_info structure
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure.
> + */
> +typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
> +
> /**
> * Start ethernet Rx adapter. This callback is invoked if
> * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
> @@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
>
> return 0;
> }
> +
> +int
> +rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
> + uint16_t rx_queue_id,
> + struct rte_event_eth_rx_adapter_queue_info *info)
> +{
> + 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 (info == NULL) {
> + RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
> + -ENOTSUP);
> + ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
> + &rte_eth_devices[eth_dev_id],
> + rx_queue_id,
> + info);
> + 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(info, 0, sizeof(*info));
> + info->servicing_weight = queue_info->wt;
> + info->event_queue_id = qi_ev->queue_id;
> + info->sched_type = qi_ev->sched_type;
> + info->priority = qi_ev->priority;
> + info->rx_queue_flags = 0;
> + if (queue_info->flow_id_mask != 0) {
> + info->rx_queue_flags |=
> + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> + info->flow_id = qi_ev->flow_id;
> + }
> +
> + return 0;
> +}
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index 182dd2e..75c0010 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_info_get()
> *
> * The application creates an ethernet to event adapter using
> * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
> @@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> void *arg);
>
> /**
> + * Rx queue info
> + */
> +struct rte_event_eth_rx_adapter_queue_info {
> + uint32_t rx_queue_flags;
> + /**< Flags for handling received packets
> + * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
> + */
> + uint16_t servicing_weight;
> + /**< Relative polling frequency of ethernet receive queue when the
> + * adapter uses a service core function for ethernet to event device
> + * transfers. If it is set to zero, the Rx queue is interrupt driven
> + * (unless rx queue interrupts are not enabled for the ethernet
> + * device).
> + */
> +
> + uint8_t event_queue_id;
> + /**< Targeted event queue identifier for the enqueue or
> + * dequeue operation.
> + * The value must be in the range of
> + * [0, nb_event_queues - 1] which previously supplied to
> + * rte_event_dev_configure().
> + */
> +
> + uint8_t sched_type;
> + /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
> + * associated with flow id on a given event queue
> + * for the enqueue and dequeue operation.
> + */
> +
> + uint8_t priority;
> + /**< Event priority relative to other events in the
> + * event queue. The requested priority should in the
> + * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
> + * RTE_EVENT_DEV_PRIORITY_LOWEST].
> + * The implementation shall normalize the requested
> + * priority to supported priority value.
> + * Valid when the device has
> + * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
> + */
> +
> + uint32_t flow_id;
> + /**< Targeted flow identifier for the enqueue and
> + * dequeue operation.
> + * The value must be in the range of
> + * [0, nb_event_queue_flows - 1] which
> + * previously supplied to rte_event_dev_configure().
> + */
> +};
> +
> +/**
> * Rx queue configuration structure
> */
> struct rte_event_eth_rx_adapter_queue_conf {
> @@ -575,6 +626,26 @@ 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 information about Rx queue.
> + *
> + * @param id
> + * Adapter identifier.
> + * @param eth_dev_id
> + * Port identifier of Ethernet device.
> + * @param rx_queue_id
> + * Ethernet device receive queue index.
> + * @param info
> + * Pointer to struct rte_event_eth_rx_adapter_queue_info
> + * @return
> + * - 0: Success, Receive queue added correctly.
> + * - <0: Error code on failure.
> + */
> +int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
> + uint16_t eth_dev_id,
> + uint16_t rx_queue_id,
> + struct rte_event_eth_rx_adapter_queue_info *info);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index 8862562..258affd 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_info_get;
> __rte_eventdev_trace_crypto_adapter_enqueue;
> };
>
> --
> 2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev: add rx queue info get api
2021-09-07 6:25 ` Jayatheerthan, Jay
@ 2021-09-07 6:39 ` Kundapura, Ganapati
0 siblings, 0 replies; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-07 6:39 UTC (permalink / raw)
To: Jayatheerthan, Jay, jerinjacobk; +Cc: dev
> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: 07 September 2021 11:56
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>;
> jerinjacobk@gmail.com
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] eventdev: add rx queue info get api
>
> Hi Ganapati,
> Could you split these patches to logical units to make it easy to review ? In
> addition, add patch version in subject field.
>
> -Jay
Patch is split into 3 patches having implementation, test and document update separately
>
>
> > -----Original Message-----
> > From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Sent: Tuesday, September 7, 2021 11:07 AM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> > jerinjacobk@gmail.com
> > Cc: dev@dpdk.org
> > Subject: [PATCH] eventdev: add rx queue info get api
> >
> > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> >
> > ---
> > v2:
> > * build failed due to missing entry in version.map
> > * added entry in version.map
> > ---
> > app/test/test_event_eth_rx_adapter.c | 22 +++++++
> > .../prog_guide/event_ethernet_rx_adapter.rst | 8 +++
> > lib/eventdev/eventdev_pmd.h | 31 +++++++++
> > lib/eventdev/rte_event_eth_rx_adapter.c | 76
> ++++++++++++++++++++++
> > lib/eventdev/rte_event_eth_rx_adapter.h | 71
> ++++++++++++++++++++
> > lib/eventdev/version.map | 1 +
> > 6 files changed, 209 insertions(+)
> >
> > diff --git a/app/test/test_event_eth_rx_adapter.c
> > b/app/test/test_event_eth_rx_adapter.c
> > index 9198767..c642e1b 100644
> > --- a/app/test/test_event_eth_rx_adapter.c
> > +++ b/app/test/test_event_eth_rx_adapter.c
> > @@ -750,6 +750,27 @@ adapter_stats(void)
> > return TEST_SUCCESS;
> > }
> >
> > +static int
> > +adapter_queue_info(void)
> > +{
> > + int err;
> > + struct rte_event_eth_rx_adapter_queue_info queue_info;
> > +
> > + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID,
> TEST_DEV_ID,
> > + 0, &queue_info);
> > + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> > +
> > + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID,
> TEST_DEV_ID,
> > + -1, &queue_info);
> > + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> > +
> > + err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID,
> TEST_DEV_ID,
> > + 0, NULL);
> > + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> > +
> > + return TEST_SUCCESS;
> > +}
> > +
> > static struct unit_test_suite event_eth_rx_tests = {
> > .suite_name = "rx event eth adapter test suite",
> > .setup = testsuite_setup,
> > @@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
> > adapter_multi_eth_add_del),
> > TEST_CASE_ST(adapter_create, adapter_free,
> adapter_start_stop),
> > TEST_CASE_ST(adapter_create, adapter_free,
> adapter_stats),
> > + TEST_CASE_ST(adapter_create, adapter_free,
> adapter_queue_info),
> > TEST_CASES_END() /**< NULL terminate unit test array */
> > }
> > };
> > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > index c01e5a9..9897985 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 info
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +The ``rte_event_eth_rx_adapter_queue_info_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_info``.
> > +
> > Interrupt Based Rx Queues
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > diff --git a/lib/eventdev/eventdev_pmd.h
> b/lib/eventdev/eventdev_pmd.h
> > index 0f724ac..20cc0a7 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -561,6 +561,35 @@ typedef int
> (*eventdev_eth_rx_adapter_queue_del_t)
> > const struct rte_eth_dev *eth_dev,
> > int32_t rx_queue_id);
> >
> > +struct rte_event_eth_rx_adapter_queue_info;
> > +
> > +/**
> > + * 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] info
> > + * Pointer to rte_event_eth_rx_adapter_queue_info structure
> > + *
> > + * @return
> > + * - 0: Success
> > + * - <0: Error code on failure.
> > + */
> > +typedef int (*eventdev_eth_rx_adapter_queue_info_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_info
> *info);
> > +
> > /**
> > * Start ethernet Rx adapter. This callback is invoked if
> > * the caps returned from eventdev_eth_rx_adapter_caps_get(..,
> > eth_port_id) @@ -1107,6 +1136,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_info_get_t
> eth_rx_adapter_queue_info_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..98184fb 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t
> > id,
> >
> > return 0;
> > }
> > +
> > +int
> > +rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t
> eth_dev_id,
> > + uint16_t rx_queue_id,
> > + struct rte_event_eth_rx_adapter_queue_info *info)
> {
> > + 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 (info == NULL) {
> > + RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
> > + -ENOTSUP);
> > + ret = (*dev->dev_ops-
> >eth_rx_adapter_queue_info_get)(dev,
> > +
> &rte_eth_devices[eth_dev_id],
> > + rx_queue_id,
> > + info);
> > + 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(info, 0, sizeof(*info));
> > + info->servicing_weight = queue_info->wt;
> > + info->event_queue_id = qi_ev->queue_id;
> > + info->sched_type = qi_ev->sched_type;
> > + info->priority = qi_ev->priority;
> > + info->rx_queue_flags = 0;
> > + if (queue_info->flow_id_mask != 0) {
> > + info->rx_queue_flags |=
> > +
> RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> > + info->flow_id = qi_ev->flow_id;
> > + }
> > +
> > + return 0;
> > +}
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > index 182dd2e..75c0010 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_info_get()
> > *
> > * The application creates an ethernet to event adapter using
> > * rte_event_eth_rx_adapter_create_ext() or
> > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@ typedef int
> (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > void *arg);
> >
> > /**
> > + * Rx queue info
> > + */
> > +struct rte_event_eth_rx_adapter_queue_info {
> > + uint32_t rx_queue_flags;
> > + /**< Flags for handling received packets
> > + * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
> > + */
> > + uint16_t servicing_weight;
> > + /**< Relative polling frequency of ethernet receive queue when the
> > + * adapter uses a service core function for ethernet to event device
> > + * transfers. If it is set to zero, the Rx queue is interrupt driven
> > + * (unless rx queue interrupts are not enabled for the ethernet
> > + * device).
> > + */
> > +
> > + uint8_t event_queue_id;
> > + /**< Targeted event queue identifier for the enqueue or
> > + * dequeue operation.
> > + * The value must be in the range of
> > + * [0, nb_event_queues - 1] which previously supplied to
> > + * rte_event_dev_configure().
> > + */
> > +
> > + uint8_t sched_type;
> > + /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
> > + * associated with flow id on a given event queue
> > + * for the enqueue and dequeue operation.
> > + */
> > +
> > + uint8_t priority;
> > + /**< Event priority relative to other events in the
> > + * event queue. The requested priority should in the
> > + * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
> > + * RTE_EVENT_DEV_PRIORITY_LOWEST].
> > + * The implementation shall normalize the requested
> > + * priority to supported priority value.
> > + * Valid when the device has
> > + * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
> > + */
> > +
> > + uint32_t flow_id;
> > + /**< Targeted flow identifier for the enqueue and
> > + * dequeue operation.
> > + * The value must be in the range of
> > + * [0, nb_event_queue_flows - 1] which
> > + * previously supplied to rte_event_dev_configure().
> > + */
> > +};
> > +
> > +/**
> > * Rx queue configuration structure
> > */
> > struct rte_event_eth_rx_adapter_queue_conf { @@ -575,6 +626,26 @@
> 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 information about Rx queue.
> > + *
> > + * @param id
> > + * Adapter identifier.
> > + * @param eth_dev_id
> > + * Port identifier of Ethernet device.
> > + * @param rx_queue_id
> > + * Ethernet device receive queue index.
> > + * @param info
> > + * Pointer to struct rte_event_eth_rx_adapter_queue_info
> > + * @return
> > + * - 0: Success, Receive queue added correctly.
> > + * - <0: Error code on failure.
> > + */
> > +int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
> > + uint16_t eth_dev_id,
> > + uint16_t rx_queue_id,
> > + struct rte_event_eth_rx_adapter_queue_info *info);
> > +
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index
> > 8862562..258affd 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_info_get;
> > __rte_eventdev_trace_crypto_adapter_enqueue;
> > };
> >
> > --
> > 2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-07 5:36 [dpdk-dev] [PATCH] eventdev: add rx queue info get api Ganapati Kundapura
2021-09-07 6:25 ` Jayatheerthan, Jay
@ 2021-09-07 6:45 ` 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
` (3 more replies)
1 sibling, 4 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 6:45 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Added rte_event_eth_rx_adapter_queue_info_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_info structure
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
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
---
lib/eventdev/eventdev_pmd.h | 31 ++++++++++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 76 +++++++++++++++++++++++++++++++++
lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++++++++++++
lib/eventdev/version.map | 1 +
4 files changed, 179 insertions(+)
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac..20cc0a7 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
const struct rte_eth_dev *eth_dev,
int32_t rx_queue_id);
+struct rte_event_eth_rx_adapter_queue_info;
+
+/**
+ * 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] info
+ * Pointer to rte_event_eth_rx_adapter_queue_info structure
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
+
/**
* Start ethernet Rx adapter. This callback is invoked if
* the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
@@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
return 0;
}
+
+int
+rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info)
+{
+ 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 (info == NULL) {
+ RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
+ -ENOTSUP);
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ info);
+ 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(info, 0, sizeof(*info));
+ info->servicing_weight = queue_info->wt;
+ info->event_queue_id = qi_ev->queue_id;
+ info->sched_type = qi_ev->sched_type;
+ info->priority = qi_ev->priority;
+ info->rx_queue_flags = 0;
+ if (queue_info->flow_id_mask != 0) {
+ info->rx_queue_flags |=
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ info->flow_id = qi_ev->flow_id;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 182dd2e..75c0010 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_info_get()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
void *arg);
/**
+ * Rx queue info
+ */
+struct rte_event_eth_rx_adapter_queue_info {
+ uint32_t rx_queue_flags;
+ /**< Flags for handling received packets
+ * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
+ */
+ uint16_t servicing_weight;
+ /**< Relative polling frequency of ethernet receive queue when the
+ * adapter uses a service core function for ethernet to event device
+ * transfers. If it is set to zero, the Rx queue is interrupt driven
+ * (unless rx queue interrupts are not enabled for the ethernet
+ * device).
+ */
+
+ uint8_t event_queue_id;
+ /**< Targeted event queue identifier for the enqueue or
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queues - 1] which previously supplied to
+ * rte_event_dev_configure().
+ */
+
+ uint8_t sched_type;
+ /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
+ * associated with flow id on a given event queue
+ * for the enqueue and dequeue operation.
+ */
+
+ uint8_t priority;
+ /**< Event priority relative to other events in the
+ * event queue. The requested priority should in the
+ * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
+ * RTE_EVENT_DEV_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested
+ * priority to supported priority value.
+ * Valid when the device has
+ * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
+ */
+
+ uint32_t flow_id;
+ /**< Targeted flow identifier for the enqueue and
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queue_flows - 1] which
+ * previously supplied to rte_event_dev_configure().
+ */
+};
+
+/**
* Rx queue configuration structure
*/
struct rte_event_eth_rx_adapter_queue_conf {
@@ -575,6 +626,26 @@ 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 information about Rx queue.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Port identifier of Ethernet device.
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ * @param info
+ * Pointer to struct rte_event_eth_rx_adapter_queue_info
+ * @return
+ * - 0: Success, Receive queue added correctly.
+ * - <0: Error code on failure.
+ */
+int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
+ uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 8862562..258affd 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_info_get;
__rte_eventdev_trace_crypto_adapter_enqueue;
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] test/event: Add rx queue info get test in rx adapter autotest
2021-09-07 6:45 ` [dpdk-dev] [PATCH v3 1/3] " Ganapati Kundapura
@ 2021-09-07 6:45 ` 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
` (2 subsequent siblings)
3 siblings, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 6:45 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Add unit tests for rte_event_eth_rx_adapter_queue_info_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..c642e1b 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_info(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_info queue_info;
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_info);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_info),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] doc: add rx queue get api detail in rx adapter guide
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 ` 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:49 ` [dpdk-dev] [PATCH v4 1/2] " Ganapati Kundapura
3 siblings, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 6:45 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
rte_event_eth_rx_adapter_queue_info_get() api details are added
in rx adapter guide
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
doc/guides/prog_guide/event_ethernet_rx_adapter.rst | 8 ++++++++
1 file changed, 8 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..9897985 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 info
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``rte_event_eth_rx_adapter_queue_info_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_info``.
+
Interrupt Based Rx Queues
~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
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 ` Jerin Jacob
2021-09-07 8:50 ` Kundapura, Ganapati
2021-09-07 8:49 ` [dpdk-dev] [PATCH v4 1/2] " Ganapati Kundapura
3 siblings, 1 reply; 34+ messages in thread
From: Jerin Jacob @ 2021-09-07 8:12 UTC (permalink / raw)
To: Ganapati Kundapura; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
in
On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> Added rte_event_eth_rx_adapter_queue_info_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_info structure
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> ---
> v3:
> * Split single patch into implementaion, test and document updation
> patches separately
Please squash 1/3 and 3/3.
>
> v2:
> * Fixed build issue due to missing entry in version.map
>
> v1:
> * Initial patch with implementaion, test and doc together
> ---
> lib/eventdev/eventdev_pmd.h | 31 ++++++++++++++
> lib/eventdev/rte_event_eth_rx_adapter.c | 76 +++++++++++++++++++++++++++++++++
> lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++++++++++++
> lib/eventdev/version.map | 1 +
> 4 files changed, 179 insertions(+)
>
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index 0f724ac..20cc0a7 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
> const struct rte_eth_dev *eth_dev,
> int32_t rx_queue_id);
>
> +struct rte_event_eth_rx_adapter_queue_info;
> +
> +/**
> + * 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.
It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case too.
> + *
> + * @param dev
> + * Event device pointer
> + *
> + * @param eth_dev
> + * Ethernet device pointer
> + *
> + * @param rx_queue_id
> + * Ethernet device receive queue index.
> + *
> + * @param[out] info
> + * Pointer to rte_event_eth_rx_adapter_queue_info structure
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure.
> + */
> +typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
> +
> /**
> * Start ethernet Rx adapter. This callback is invoked if
> * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
> @@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
>
> return 0;
> }
> +
> +int
> +rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
> + uint16_t rx_queue_id,
> + struct rte_event_eth_rx_adapter_queue_info *info)
> +{
> + 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 (info == NULL) {
> + RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
> + -ENOTSUP);
> + ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
> + &rte_eth_devices[eth_dev_id],
> + rx_queue_id,
> + info);
> + 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(info, 0, sizeof(*info));
> + info->servicing_weight = queue_info->wt;
> + info->event_queue_id = qi_ev->queue_id;
> + info->sched_type = qi_ev->sched_type;
> + info->priority = qi_ev->priority;
> + info->rx_queue_flags = 0;
> + if (queue_info->flow_id_mask != 0) {
> + info->rx_queue_flags |=
> + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> + info->flow_id = qi_ev->flow_id;
> + }
> +
> + return 0;
> +}
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index 182dd2e..75c0010 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_info_get()
> *
> * The application creates an ethernet to event adapter using
> * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
> @@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> void *arg);
>
> /**
> + * Rx queue info
> + */
> +struct rte_event_eth_rx_adapter_queue_info {
Can we avoid the duplication of this structure and use
rte_event_eth_rx_adapter_queue_conf instead.
API can be rte_event_eth_rx_adapter_queue_conf_get() to align the
structure.
Also instead of every driver duplicating this code,
How about
- common code stores the config in rte_event_eth_rx_adapter_queue_add()
- common code stores the config in rte_event_eth_rx_adapter_queue_conf_get()
- Addtional PMD level API can be given incase, something needs to overridden by
Adapter.
> + uint32_t rx_queue_flags;
> + /**< Flags for handling received packets
> + * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
> + */
> + uint16_t servicing_weight;
> + /**< Relative polling frequency of ethernet receive queue when the
> + * adapter uses a service core function for ethernet to event device
> + * transfers. If it is set to zero, the Rx queue is interrupt driven
> + * (unless rx queue interrupts are not enabled for the ethernet
> + * device).
> + */
> +
> + uint8_t event_queue_id;
> + /**< Targeted event queue identifier for the enqueue or
> + * dequeue operation.
> + * The value must be in the range of
> + * [0, nb_event_queues - 1] which previously supplied to
> + * rte_event_dev_configure().
> + */
> +
> + uint8_t sched_type;
> + /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
> + * associated with flow id on a given event queue
> + * for the enqueue and dequeue operation.
> + */
> +
> + uint8_t priority;
> + /**< Event priority relative to other events in the
> + * event queue. The requested priority should in the
> + * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
> + * RTE_EVENT_DEV_PRIORITY_LOWEST].
> + * The implementation shall normalize the requested
> + * priority to supported priority value.
> + * Valid when the device has
> + * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
> + */
> +
> + uint32_t flow_id;
> + /**< Targeted flow identifier for the enqueue and
> + * dequeue operation.
> + * The value must be in the range of
> + * [0, nb_event_queue_flows - 1] which
> + * previously supplied to rte_event_dev_configure().
> + */
> +};
> +
> +/**
> * Rx queue configuration structure
> */
> struct rte_event_eth_rx_adapter_queue_conf {
> @@ -575,6 +626,26 @@ 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 information about Rx queue.
> + *
> + * @param id
> + * Adapter identifier.
> + * @param eth_dev_id
> + * Port identifier of Ethernet device.
> + * @param rx_queue_id
> + * Ethernet device receive queue index.
> + * @param info
> + * Pointer to struct rte_event_eth_rx_adapter_queue_info
> + * @return
> + * - 0: Success, Receive queue added correctly.
> + * - <0: Error code on failure.
> + */
> +int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
> + uint16_t eth_dev_id,
> + uint16_t rx_queue_id,
> + struct rte_event_eth_rx_adapter_queue_info *info);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index 8862562..258affd 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_info_get;
> __rte_eventdev_trace_crypto_adapter_enqueue;
> };
>
> --
> 2.6.4
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue info get api
2021-09-07 6:45 ` [dpdk-dev] [PATCH v3 1/3] " Ganapati Kundapura
` (2 preceding siblings ...)
2021-09-07 8:12 ` [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api Jerin Jacob
@ 2021-09-07 8:49 ` 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
3 siblings, 2 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 8:49 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Added rte_event_eth_rx_adapter_queue_info_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_info structure
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v4:
* squashed 1/3 and 3/3
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
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
.../prog_guide/event_ethernet_rx_adapter.rst | 8 +++
lib/eventdev/eventdev_pmd.h | 31 +++++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 76 ++++++++++++++++++++++
lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++
lib/eventdev/version.map | 1 +
5 files changed, 187 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..9897985 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 info
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``rte_event_eth_rx_adapter_queue_info_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_info``.
+
Interrupt Based Rx Queues
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac..20cc0a7 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
const struct rte_eth_dev *eth_dev,
int32_t rx_queue_id);
+struct rte_event_eth_rx_adapter_queue_info;
+
+/**
+ * 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] info
+ * Pointer to rte_event_eth_rx_adapter_queue_info structure
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
+
/**
* Start ethernet Rx adapter. This callback is invoked if
* the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
@@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
return 0;
}
+
+int
+rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info)
+{
+ 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 (info == NULL) {
+ RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
+ -ENOTSUP);
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ info);
+ 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(info, 0, sizeof(*info));
+ info->servicing_weight = queue_info->wt;
+ info->event_queue_id = qi_ev->queue_id;
+ info->sched_type = qi_ev->sched_type;
+ info->priority = qi_ev->priority;
+ info->rx_queue_flags = 0;
+ if (queue_info->flow_id_mask != 0) {
+ info->rx_queue_flags |=
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ info->flow_id = qi_ev->flow_id;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 182dd2e..75c0010 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_info_get()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
void *arg);
/**
+ * Rx queue info
+ */
+struct rte_event_eth_rx_adapter_queue_info {
+ uint32_t rx_queue_flags;
+ /**< Flags for handling received packets
+ * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
+ */
+ uint16_t servicing_weight;
+ /**< Relative polling frequency of ethernet receive queue when the
+ * adapter uses a service core function for ethernet to event device
+ * transfers. If it is set to zero, the Rx queue is interrupt driven
+ * (unless rx queue interrupts are not enabled for the ethernet
+ * device).
+ */
+
+ uint8_t event_queue_id;
+ /**< Targeted event queue identifier for the enqueue or
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queues - 1] which previously supplied to
+ * rte_event_dev_configure().
+ */
+
+ uint8_t sched_type;
+ /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
+ * associated with flow id on a given event queue
+ * for the enqueue and dequeue operation.
+ */
+
+ uint8_t priority;
+ /**< Event priority relative to other events in the
+ * event queue. The requested priority should in the
+ * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
+ * RTE_EVENT_DEV_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested
+ * priority to supported priority value.
+ * Valid when the device has
+ * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
+ */
+
+ uint32_t flow_id;
+ /**< Targeted flow identifier for the enqueue and
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queue_flows - 1] which
+ * previously supplied to rte_event_dev_configure().
+ */
+};
+
+/**
* Rx queue configuration structure
*/
struct rte_event_eth_rx_adapter_queue_conf {
@@ -575,6 +626,26 @@ 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 information about Rx queue.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Port identifier of Ethernet device.
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ * @param info
+ * Pointer to struct rte_event_eth_rx_adapter_queue_info
+ * @return
+ * - 0: Success, Receive queue added correctly.
+ * - <0: Error code on failure.
+ */
+int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
+ uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 8862562..258affd 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_info_get;
__rte_eventdev_trace_crypto_adapter_enqueue;
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue info get test in rx adapter autotest
2021-09-07 8:49 ` [dpdk-dev] [PATCH v4 1/2] " Ganapati Kundapura
@ 2021-09-07 8:49 ` Ganapati Kundapura
2021-09-07 8:59 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue info get api Ganapati Kundapura
1 sibling, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 8:49 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Add unit tests for rte_event_eth_rx_adapter_queue_info_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..c642e1b 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_info(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_info queue_info;
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_info);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_info),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
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
0 siblings, 1 reply; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-07 8:50 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 07 September 2021 13:42
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
>
> in
>
> On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> <ganapati.kundapura@intel.com> wrote:
> >
> > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> >
> > ---
> > v3:
> > * Split single patch into implementaion, test and document updation
> > patches separately
>
> Please squash 1/3 and 3/3.
>
Squashed 1/3 and 3/3
> >
> > v2:
> > * Fixed build issue due to missing entry in version.map
> >
> > v1:
> > * Initial patch with implementaion, test and doc together
> > ---
> > lib/eventdev/eventdev_pmd.h | 31 ++++++++++++++
> > lib/eventdev/rte_event_eth_rx_adapter.c | 76
> > +++++++++++++++++++++++++++++++++
> lib/eventdev/rte_event_eth_rx_adapter.h | 71
> ++++++++++++++++++++++++++++++
> > lib/eventdev/version.map | 1 +
> > 4 files changed, 179 insertions(+)
> >
> > diff --git a/lib/eventdev/eventdev_pmd.h
> b/lib/eventdev/eventdev_pmd.h
> > index 0f724ac..20cc0a7 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -561,6 +561,35 @@ typedef int
> (*eventdev_eth_rx_adapter_queue_del_t)
> > const struct rte_eth_dev *eth_dev,
> > int32_t rx_queue_id);
> >
> > +struct rte_event_eth_rx_adapter_queue_info;
> > +
> > +/**
> > + * 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.
>
> It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case
> too.
>
>
>
> > + *
> > + * @param dev
> > + * Event device pointer
> > + *
> > + * @param eth_dev
> > + * Ethernet device pointer
> > + *
> > + * @param rx_queue_id
> > + * Ethernet device receive queue index.
> > + *
> > + * @param[out] info
> > + * Pointer to rte_event_eth_rx_adapter_queue_info structure
> > + *
> > + * @return
> > + * - 0: Success
> > + * - <0: Error code on failure.
> > + */
> > +typedef int (*eventdev_eth_rx_adapter_queue_info_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_info
> > +*info);
> > +
> > /**
> > * Start ethernet Rx adapter. This callback is invoked if
> > * the caps returned from eventdev_eth_rx_adapter_caps_get(..,
> > eth_port_id) @@ -1107,6 +1136,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_info_get_t
> eth_rx_adapter_queue_info_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..98184fb 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t
> > id,
> >
> > return 0;
> > }
> > +
> > +int
> > +rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t
> eth_dev_id,
> > + uint16_t rx_queue_id,
> > + struct rte_event_eth_rx_adapter_queue_info
> > +*info) {
> > + 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 (info == NULL) {
> > + RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
> > + -ENOTSUP);
> > + ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
> > + &rte_eth_devices[eth_dev_id],
> > + rx_queue_id,
> > + info);
> > + 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(info, 0, sizeof(*info));
> > + info->servicing_weight = queue_info->wt;
> > + info->event_queue_id = qi_ev->queue_id;
> > + info->sched_type = qi_ev->sched_type;
> > + info->priority = qi_ev->priority;
> > + info->rx_queue_flags = 0;
> > + if (queue_info->flow_id_mask != 0) {
> > + info->rx_queue_flags |=
> > + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> > + info->flow_id = qi_ev->flow_id;
> > + }
> > +
> > + return 0;
> > +}
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > index 182dd2e..75c0010 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_info_get()
> > *
> > * The application creates an ethernet to event adapter using
> > * rte_event_eth_rx_adapter_create_ext() or
> > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@ typedef int
> (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > void *arg);
> >
> > /**
> > + * Rx queue info
> > + */
> > +struct rte_event_eth_rx_adapter_queue_info {
>
> Can we avoid the duplication of this structure and use
> rte_event_eth_rx_adapter_queue_conf instead.
>
> API can be rte_event_eth_rx_adapter_queue_conf_get() to align the
> structure.
>
> Also instead of every driver duplicating this code, How about
> - common code stores the config in
> rte_event_eth_rx_adapter_queue_add()
> - common code stores the config in
> rte_event_eth_rx_adapter_queue_conf_get()
> - Addtional PMD level API can be given incase, something needs to
> overridden by Adapter.
>
>
>
> > + uint32_t rx_queue_flags;
> > + /**< Flags for handling received packets
> > + * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
> > + */
> > + uint16_t servicing_weight;
> > + /**< Relative polling frequency of ethernet receive queue when the
> > + * adapter uses a service core function for ethernet to event device
> > + * transfers. If it is set to zero, the Rx queue is interrupt driven
> > + * (unless rx queue interrupts are not enabled for the ethernet
> > + * device).
> > + */
> > +
> > + uint8_t event_queue_id;
> > + /**< Targeted event queue identifier for the enqueue or
> > + * dequeue operation.
> > + * The value must be in the range of
> > + * [0, nb_event_queues - 1] which previously supplied to
> > + * rte_event_dev_configure().
> > + */
> > +
> > + uint8_t sched_type;
> > + /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
> > + * associated with flow id on a given event queue
> > + * for the enqueue and dequeue operation.
> > + */
> > +
> > + uint8_t priority;
> > + /**< Event priority relative to other events in the
> > + * event queue. The requested priority should in the
> > + * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
> > + * RTE_EVENT_DEV_PRIORITY_LOWEST].
> > + * The implementation shall normalize the requested
> > + * priority to supported priority value.
> > + * Valid when the device has
> > + * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
> > + */
> > +
> > + uint32_t flow_id;
> > + /**< Targeted flow identifier for the enqueue and
> > + * dequeue operation.
> > + * The value must be in the range of
> > + * [0, nb_event_queue_flows - 1] which
> > + * previously supplied to rte_event_dev_configure().
> > + */
> > +};
> > +
> > +/**
> > * Rx queue configuration structure
> > */
> > struct rte_event_eth_rx_adapter_queue_conf { @@ -575,6 +626,26 @@
> 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 information about Rx queue.
> > + *
> > + * @param id
> > + * Adapter identifier.
> > + * @param eth_dev_id
> > + * Port identifier of Ethernet device.
> > + * @param rx_queue_id
> > + * Ethernet device receive queue index.
> > + * @param info
> > + * Pointer to struct rte_event_eth_rx_adapter_queue_info
> > + * @return
> > + * - 0: Success, Receive queue added correctly.
> > + * - <0: Error code on failure.
> > + */
> > +int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
> > + uint16_t eth_dev_id,
> > + uint16_t rx_queue_id,
> > + struct rte_event_eth_rx_adapter_queue_info
> > +*info);
> > +
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index
> > 8862562..258affd 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_info_get;
> > __rte_eventdev_trace_crypto_adapter_enqueue;
> > };
> >
> > --
> > 2.6.4
> >
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue info get api
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 ` 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 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
1 sibling, 2 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 8:59 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Added rte_event_eth_rx_adapter_queue_info_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_info structure
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v4:
* squashed 1/3 and 3/3
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 | 31 +++++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 76 ++++++++++++++++++++++
lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++
lib/eventdev/version.map | 1 +
5 files changed, 187 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..9897985 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 info
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``rte_event_eth_rx_adapter_queue_info_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_info``.
+
Interrupt Based Rx Queues
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac..20cc0a7 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
const struct rte_eth_dev *eth_dev,
int32_t rx_queue_id);
+struct rte_event_eth_rx_adapter_queue_info;
+
+/**
+ * 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] info
+ * Pointer to rte_event_eth_rx_adapter_queue_info structure
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info);
+
/**
* Start ethernet Rx adapter. This callback is invoked if
* the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id)
@@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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..98184fb 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id,
return 0;
}
+
+int
+rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info)
+{
+ 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 (info == NULL) {
+ RTE_EDEV_LOG_ERR("Rx queue info 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_info_get,
+ -ENOTSUP);
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ info);
+ 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(info, 0, sizeof(*info));
+ info->servicing_weight = queue_info->wt;
+ info->event_queue_id = qi_ev->queue_id;
+ info->sched_type = qi_ev->sched_type;
+ info->priority = qi_ev->priority;
+ info->rx_queue_flags = 0;
+ if (queue_info->flow_id_mask != 0) {
+ info->rx_queue_flags |=
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ info->flow_id = qi_ev->flow_id;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 182dd2e..75c0010 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_info_get()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
void *arg);
/**
+ * Rx queue info
+ */
+struct rte_event_eth_rx_adapter_queue_info {
+ uint32_t rx_queue_flags;
+ /**< Flags for handling received packets
+ * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID
+ */
+ uint16_t servicing_weight;
+ /**< Relative polling frequency of ethernet receive queue when the
+ * adapter uses a service core function for ethernet to event device
+ * transfers. If it is set to zero, the Rx queue is interrupt driven
+ * (unless rx queue interrupts are not enabled for the ethernet
+ * device).
+ */
+
+ uint8_t event_queue_id;
+ /**< Targeted event queue identifier for the enqueue or
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queues - 1] which previously supplied to
+ * rte_event_dev_configure().
+ */
+
+ uint8_t sched_type;
+ /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
+ * associated with flow id on a given event queue
+ * for the enqueue and dequeue operation.
+ */
+
+ uint8_t priority;
+ /**< Event priority relative to other events in the
+ * event queue. The requested priority should in the
+ * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
+ * RTE_EVENT_DEV_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested
+ * priority to supported priority value.
+ * Valid when the device has
+ * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
+ */
+
+ uint32_t flow_id;
+ /**< Targeted flow identifier for the enqueue and
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queue_flows - 1] which
+ * previously supplied to rte_event_dev_configure().
+ */
+};
+
+/**
* Rx queue configuration structure
*/
struct rte_event_eth_rx_adapter_queue_conf {
@@ -575,6 +626,26 @@ 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 information about Rx queue.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Port identifier of Ethernet device.
+ * @param rx_queue_id
+ * Ethernet device receive queue index.
+ * @param info
+ * Pointer to struct rte_event_eth_rx_adapter_queue_info
+ * @return
+ * - 0: Success, Receive queue added correctly.
+ * - <0: Error code on failure.
+ */
+int rte_event_eth_rx_adapter_queue_info_get(uint8_t id,
+ uint16_t eth_dev_id,
+ uint16_t rx_queue_id,
+ struct rte_event_eth_rx_adapter_queue_info *info);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 8862562..258affd 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_info_get;
__rte_eventdev_trace_crypto_adapter_enqueue;
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue info get test in rx adapter autotest
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 ` Ganapati Kundapura
2021-09-12 15:01 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
1 sibling, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-07 8:59 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Add unit tests for rte_event_eth_rx_adapter_queue_info_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..c642e1b 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_info(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_info queue_info;
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_info);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_info_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_info),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-07 8:50 ` Kundapura, Ganapati
@ 2021-09-07 9:37 ` Jerin Jacob
2021-09-08 8:21 ` Kundapura, Ganapati
0 siblings, 1 reply; 34+ messages in thread
From: Jerin Jacob @ 2021-09-07 9:37 UTC (permalink / raw)
To: Kundapura, Ganapati; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
<ganapati.kundapura@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 07 September 2021 13:42
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> >
> > in
> >
> > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > >
> > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > >
> > > ---
> > > v3:
> > > * Split single patch into implementaion, test and document updation
> > > patches separately
> >
> > > +struct rte_event_eth_rx_adapter_queue_info;
> > > +
> > > +/**
> > > + * 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.
> >
> > It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case
> > too.
> >
Missed this comment in v4
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > index 182dd2e..75c0010 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_info_get()
> > > *
> > > * The application creates an ethernet to event adapter using
> > > * rte_event_eth_rx_adapter_create_ext() or
> > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@ typedef int
> > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > > void *arg);
> > >
> > > /**
> > > + * Rx queue info
> > > + */
> > > +struct rte_event_eth_rx_adapter_queue_info {
> >
> > Can we avoid the duplication of this structure and use
> > rte_event_eth_rx_adapter_queue_conf instead.
> >
> > API can be rte_event_eth_rx_adapter_queue_conf_get() to align the
> > structure.
> >
> > Also instead of every driver duplicating this code, How about
> > - common code stores the config in
> > rte_event_eth_rx_adapter_queue_add()
> > - common code stores the config in
> > rte_event_eth_rx_adapter_queue_conf_get()
> > - Addtional PMD level API can be given incase, something needs to
> > overridden by Adapter.
Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-07 9:37 ` Jerin Jacob
@ 2021-09-08 8:21 ` Kundapura, Ganapati
2021-09-16 4:42 ` Jerin Jacob
0 siblings, 1 reply; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-08 8:21 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 07 September 2021 15:07
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
>
> On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
> <ganapati.kundapura@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: 07 September 2021 13:42
> > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > >
> > > in
> > >
> > > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > > <ganapati.kundapura@intel.com> wrote:
> > > >
> > > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > > >
> > > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > > >
> > > > ---
> > > > v3:
> > > > * Split single patch into implementaion, test and document updation
> > > > patches separately
> > >
> > > > +struct rte_event_eth_rx_adapter_queue_info;
> > > > +
> > > > +/**
> > > > + * 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.
> > >
> > > It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
> case
> > > too.
> > >
>
>
>
> Missed this comment in v4
Sorry I missed these comments
rte_event_eth_rx_adapter_queue_info_get() calls PMD callback if internal port cap is set,
otherwise it implements to return the queue_info.
PMD callback is for internal port and queue_info_get() api implements for non internal port
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > index 182dd2e..75c0010 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_info_get()
> > > > *
> > > > * The application creates an ethernet to event adapter using
> > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@ typedef
> int
> > > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > > > void *arg);
> > > >
> > > > /**
> > > > + * Rx queue info
> > > > + */
> > > > +struct rte_event_eth_rx_adapter_queue_info {
> > >
> > > Can we avoid the duplication of this structure and use
> > > rte_event_eth_rx_adapter_queue_conf instead.
> > >
Agree
> > > API can be rte_event_eth_rx_adapter_queue_conf_get() to align the
> > > structure.
Agree
> > >
> > > Also instead of every driver duplicating this code, How about
> > > - common code stores the config in
> > > rte_event_eth_rx_adapter_queue_add()
> > > - common code stores the config in
> > > rte_event_eth_rx_adapter_queue_conf_get()
queue_add() stores the config in dev_info and queue_conf_get() retrieves the config from dev_info.
Please clarify on common code to store and retrieve queue conf?
> > > - Addtional PMD level API can be given incase, something needs to
> > > overridden by Adapter.
>
Existing PMD callbacks like queue_add, queue_del, adapter_start, adapter_stop etc
doesn't have any additional PMD level api.
queue_info_get PMD callback is also similar.
>
> Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api
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
2021-09-12 15:01 ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest Ganapati Kundapura
1 sibling, 1 reply; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-12 15:01 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
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
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest
2021-09-12 15:01 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
@ 2021-09-12 15:01 ` Ganapati Kundapura
2021-09-12 15:58 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
0 siblings, 1 reply; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-12 15:01 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..ac6cb18 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_conf(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_conf);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_conf);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api
2021-09-12 15:01 ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest Ganapati Kundapura
@ 2021-09-12 15:58 ` 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
` (2 more replies)
0 siblings, 3 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-12 15:58 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler 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..62f6413 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, scheduler 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
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest
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 ` 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 12:51 ` [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
2 siblings, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-12 15:58 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev
Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 9198767..ac6cb18 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -750,6 +750,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_conf(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_conf);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_conf);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -762,6 +783,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-08 8:21 ` Kundapura, Ganapati
@ 2021-09-16 4:42 ` Jerin Jacob
2021-09-16 8:35 ` Kundapura, Ganapati
0 siblings, 1 reply; 34+ messages in thread
From: Jerin Jacob @ 2021-09-16 4:42 UTC (permalink / raw)
To: Kundapura, Ganapati; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
()
On Wed, Sep 8, 2021 at 1:51 PM Kundapura, Ganapati
<ganapati.kundapura@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 07 September 2021 15:07
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> >
> > On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: 07 September 2021 13:42
> > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > > >
> > > > in
> > > >
> > > > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > > > <ganapati.kundapura@intel.com> wrote:
> > > > >
> > > > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > > > >
> > > > > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> > > > >
> > > > > ---
> > > > > v3:
> > > > > * Split single patch into implementaion, test and document updation
> > > > > patches separately
> > > >
> > > > > +struct rte_event_eth_rx_adapter_queue_info;
> > > > > +
> > > > > +/**
> > > > > + * 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.
> > > >
> > > > It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
> > case
> > > > too.
> > > >
> >
> >
> >
> > Missed this comment in v4
> Sorry I missed these comments
>
> rte_event_eth_rx_adapter_queue_info_get() calls PMD callback if internal port cap is set,
> otherwise it implements to return the queue_info.
> PMD callback is for internal port and queue_info_get() api implements for non internal port
This API will be useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case
too. In order to use this in a generic way, I suggest in following way,
In the rte_event_eth_rx_adapter_queue_add() stores this config in
common code(i.e
file: ./lib/eventdev/rte_event_eth_rx_adapter.c and
rte_event_eth_rx_adapter_queue_add() function)
as named memzone or so.
Later when rte_event_eth_rx_adapter_queue_conf_get() called, the
config can be retrived
through named memzone lookup and have PMD specific callback like your patch
for overriding any parameter as neeed. i.e If PMD callback is NULL,
Application should
get the config struct as provided in rte_event_eth_rx_adapter_queue_add() with
rte_event_eth_rx_adapter_queue_conf_get().
>
> > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > index 182dd2e..75c0010 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_info_get()
> > > > > *
> > > > > * The application creates an ethernet to event adapter using
> > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@ typedef
> > int
> > > > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > > > > void *arg);
> > > > >
> > > > > /**
> > > > > + * Rx queue info
> > > > > + */
> > > > > +struct rte_event_eth_rx_adapter_queue_info {
> > > >
> > > > Can we avoid the duplication of this structure and use
> > > > rte_event_eth_rx_adapter_queue_conf instead.
> > > >
> Agree
> > > > API can be rte_event_eth_rx_adapter_queue_conf_get() to align the
> > > > structure.
> Agree
> > > >
> > > > Also instead of every driver duplicating this code, How about
> > > > - common code stores the config in
> > > > rte_event_eth_rx_adapter_queue_add()
> > > > - common code stores the config in
> > > > rte_event_eth_rx_adapter_queue_conf_get()
>
> queue_add() stores the config in dev_info and queue_conf_get() retrieves the config from dev_info.
> Please clarify on common code to store and retrieve queue conf?
See above.
> > > > - Addtional PMD level API can be given incase, something needs to
> > > > overridden by Adapter.
> >
> Existing PMD callbacks like queue_add, queue_del, adapter_start, adapter_stop etc
> doesn't have any additional PMD level api.
> queue_info_get PMD callback is also similar.
See above.
>
> >
> > Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-16 4:42 ` Jerin Jacob
@ 2021-09-16 8:35 ` Kundapura, Ganapati
2021-09-16 8:47 ` Jerin Jacob
0 siblings, 1 reply; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-16 8:35 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 16 September 2021 10:13
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
>
> ()
>
> On Wed, Sep 8, 2021 at 1:51 PM Kundapura, Ganapati
> <ganapati.kundapura@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: 07 September 2021 15:07
> > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > >
> > > On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
> > > <ganapati.kundapura@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: 07 September 2021 13:42
> > > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > > > >
> > > > > in
> > > > >
> > > > > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > > > > <ganapati.kundapura@intel.com> wrote:
> > > > > >
> > > > > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > > > > >
> > > > > > Signed-off-by: Ganapati Kundapura
> > > > > > <ganapati.kundapura@intel.com>
> > > > > >
> > > > > > ---
> > > > > > v3:
> > > > > > * Split single patch into implementaion, test and document
> updation
> > > > > > patches separately
> > > > >
> > > > > > +struct rte_event_eth_rx_adapter_queue_info;
> > > > > > +
> > > > > > +/**
> > > > > > + * 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.
> > > > >
> > > > > It will useful for
> !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
> > > case
> > > > > too.
> > > > >
> > >
> > >
> > >
> > > Missed this comment in v4
> > Sorry I missed these comments
> >
> > rte_event_eth_rx_adapter_queue_info_get() calls PMD callback if
> > internal port cap is set, otherwise it implements to return the queue_info.
> > PMD callback is for internal port and queue_info_get() api implements
> > for non internal port
>
> This API will be useful for
> !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case too. In order to
> use this in a generic way, I suggest in following way,
>
> In the rte_event_eth_rx_adapter_queue_add() stores this config in
> common code(i.e
> file: ./lib/eventdev/rte_event_eth_rx_adapter.c and
> rte_event_eth_rx_adapter_queue_add() function) as named memzone or
> so.
>
> Later when rte_event_eth_rx_adapter_queue_conf_get() called, the config
> can be retrived through named memzone lookup and have PMD specific
> callback like your patch for overriding any parameter as neeed. i.e If PMD
> callback is NULL, Application should get the config struct as provided in
> rte_event_eth_rx_adapter_queue_add() with
> rte_event_eth_rx_adapter_queue_conf_get().
>
See below updated implementation
que_conf_get() {
memzone lookup
return error on failure
Fill queue config info in queue conf structure
if CAP_INTERNAL_PORT set and PMD call back is non NULL
call the PMD callback which overrides the info in queue conf structure
return 0; // queue config info is returned in passed queue_conf structure
}
rx adapter structures are allocated in memzone, rx_queue_add() stores
the queue config info in named memzone and queue_conf_get() returns queue config
info from the named memzone.
Please let me know your inputs on this
>
>
> >
> > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > index 182dd2e..75c0010 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_info_get()
> > > > > > *
> > > > > > * The application creates an ethernet to event adapter using
> > > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@
> typedef
> > > int
> > > > > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > > > > > void *arg);
> > > > > >
> > > > > > /**
> > > > > > + * Rx queue info
> > > > > > + */
> > > > > > +struct rte_event_eth_rx_adapter_queue_info {
> > > > >
> > > > > Can we avoid the duplication of this structure and use
> > > > > rte_event_eth_rx_adapter_queue_conf instead.
> > > > >
> > Agree
> > > > > API can be rte_event_eth_rx_adapter_queue_conf_get() to align
> > > > > the structure.
> > Agree
> > > > >
> > > > > Also instead of every driver duplicating this code, How about
> > > > > - common code stores the config in
> > > > > rte_event_eth_rx_adapter_queue_add()
> > > > > - common code stores the config in
> > > > > rte_event_eth_rx_adapter_queue_conf_get()
> >
> > queue_add() stores the config in dev_info and queue_conf_get() retrieves
> the config from dev_info.
> > Please clarify on common code to store and retrieve queue conf?
>
>
> See above.
>
>
> > > > > - Addtional PMD level API can be given incase, something needs
> > > > > to overridden by Adapter.
> > >
> > Existing PMD callbacks like queue_add, queue_del, adapter_start,
> > adapter_stop etc doesn't have any additional PMD level api.
> > queue_info_get PMD callback is also similar.
>
>
> See above.
>
>
>
> >
> > >
> > > Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-16 8:35 ` Kundapura, Ganapati
@ 2021-09-16 8:47 ` Jerin Jacob
2021-09-16 10:31 ` Kundapura, Ganapati
0 siblings, 1 reply; 34+ messages in thread
From: Jerin Jacob @ 2021-09-16 8:47 UTC (permalink / raw)
To: Kundapura, Ganapati; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
On Thu, Sep 16, 2021 at 2:05 PM Kundapura, Ganapati
<ganapati.kundapura@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 16 September 2021 10:13
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> >
> > ()
> >
> > On Wed, Sep 8, 2021 at 1:51 PM Kundapura, Ganapati
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > > Hi Jerin,
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: 07 September 2021 15:07
> > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > > >
> > > > On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
> > > > <ganapati.kundapura@intel.com> wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > Sent: 07 September 2021 13:42
> > > > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > > > > >
> > > > > > in
> > > > > >
> > > > > > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > > > > > <ganapati.kundapura@intel.com> wrote:
> > > > > > >
> > > > > > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > > > > > >
> > > > > > > Signed-off-by: Ganapati Kundapura
> > > > > > > <ganapati.kundapura@intel.com>
> > > > > > >
> > > > > > > ---
> > > > > > > v3:
> > > > > > > * Split single patch into implementaion, test and document
> > updation
> > > > > > > patches separately
> > > > > >
> > > > > > > +struct rte_event_eth_rx_adapter_queue_info;
> > > > > > > +
> > > > > > > +/**
> > > > > > > + * 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.
> > > > > >
> > > > > > It will useful for
> > !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
> > > > case
> > > > > > too.
> > > > > >
> > > >
> > > >
> > > >
> > > > Missed this comment in v4
> > > Sorry I missed these comments
> > >
> > > rte_event_eth_rx_adapter_queue_info_get() calls PMD callback if
> > > internal port cap is set, otherwise it implements to return the queue_info.
> > > PMD callback is for internal port and queue_info_get() api implements
> > > for non internal port
> >
> > This API will be useful for
> > !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case too. In order to
> > use this in a generic way, I suggest in following way,
> >
> > In the rte_event_eth_rx_adapter_queue_add() stores this config in
> > common code(i.e
> > file: ./lib/eventdev/rte_event_eth_rx_adapter.c and
> > rte_event_eth_rx_adapter_queue_add() function) as named memzone or
> > so.
> >
> > Later when rte_event_eth_rx_adapter_queue_conf_get() called, the config
> > can be retrived through named memzone lookup and have PMD specific
> > callback like your patch for overriding any parameter as neeed. i.e If PMD
> > callback is NULL, Application should get the config struct as provided in
> > rte_event_eth_rx_adapter_queue_add() with
> > rte_event_eth_rx_adapter_queue_conf_get().
> >
> See below updated implementation
>
> que_conf_get() {
> memzone lookup
> return error on failure
>
> Fill queue config info in queue conf structure
> if CAP_INTERNAL_PORT set and PMD call back is non NULL
IMO, We don't need to check CAP_INTERNAL_PORT. Rest looks good to me.
Also update the test case check this path(case where PMD callback is NULL)
> call the PMD callback which overrides the info in queue conf structure
>
> return 0; // queue config info is returned in passed queue_conf structure
> }
>
> rx adapter structures are allocated in memzone, rx_queue_add() stores
> the queue config info in named memzone and queue_conf_get() returns queue config
> info from the named memzone.
>
> Please let me know your inputs on this
> >
> >
> > >
> > > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > > index 182dd2e..75c0010 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_info_get()
> > > > > > > *
> > > > > > > * The application creates an ethernet to event adapter using
> > > > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > > > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@
> > typedef
> > > > int
> > > > > > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
> > > > > > > void *arg);
> > > > > > >
> > > > > > > /**
> > > > > > > + * Rx queue info
> > > > > > > + */
> > > > > > > +struct rte_event_eth_rx_adapter_queue_info {
> > > > > >
> > > > > > Can we avoid the duplication of this structure and use
> > > > > > rte_event_eth_rx_adapter_queue_conf instead.
> > > > > >
> > > Agree
> > > > > > API can be rte_event_eth_rx_adapter_queue_conf_get() to align
> > > > > > the structure.
> > > Agree
> > > > > >
> > > > > > Also instead of every driver duplicating this code, How about
> > > > > > - common code stores the config in
> > > > > > rte_event_eth_rx_adapter_queue_add()
> > > > > > - common code stores the config in
> > > > > > rte_event_eth_rx_adapter_queue_conf_get()
> > >
> > > queue_add() stores the config in dev_info and queue_conf_get() retrieves
> > the config from dev_info.
> > > Please clarify on common code to store and retrieve queue conf?
> >
> >
> > See above.
> >
> >
> > > > > > - Addtional PMD level API can be given incase, something needs
> > > > > > to overridden by Adapter.
> > > >
> > > Existing PMD callbacks like queue_add, queue_del, adapter_start,
> > > adapter_stop etc doesn't have any additional PMD level api.
> > > queue_info_get PMD callback is also similar.
> >
> >
> > See above.
> >
> >
> >
> > >
> > > >
> > > > Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info get api
2021-09-16 8:47 ` Jerin Jacob
@ 2021-09-16 10:31 ` Kundapura, Ganapati
0 siblings, 0 replies; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-16 10:31 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Pavan Nikhilesh
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 16 September 2021 14:18
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
>
> On Thu, Sep 16, 2021 at 2:05 PM Kundapura, Ganapati
> <ganapati.kundapura@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: 16 September 2021 10:13
> > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > >
> > > ()
> > >
> > > On Wed, Sep 8, 2021 at 1:51 PM Kundapura, Ganapati
> > > <ganapati.kundapura@intel.com> wrote:
> > > >
> > > > Hi Jerin,
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: 07 September 2021 15:07
> > > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > > > <dev@dpdk.org>; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get api
> > > > >
> > > > > On Tue, Sep 7, 2021 at 2:20 PM Kundapura, Ganapati
> > > > > <ganapati.kundapura@intel.com> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > Sent: 07 September 2021 13:42
> > > > > > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > > > > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> > > > > > > dpdk-dev <dev@dpdk.org>; Pavan Nikhilesh
> > > > > > > <pbhagavatula@marvell.com>
> > > > > > > Subject: Re: [PATCH v3 1/3] eventdev: add rx queue info get
> > > > > > > api
> > > > > > >
> > > > > > > in
> > > > > > >
> > > > > > > On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura
> > > > > > > <ganapati.kundapura@intel.com> wrote:
> > > > > > > >
> > > > > > > > Added rte_event_eth_rx_adapter_queue_info_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_info structure
> > > > > > > >
> > > > > > > > Signed-off-by: Ganapati Kundapura
> > > > > > > > <ganapati.kundapura@intel.com>
> > > > > > > >
> > > > > > > > ---
> > > > > > > > v3:
> > > > > > > > * Split single patch into implementaion, test and document
> > > updation
> > > > > > > > patches separately
> > > > > > >
> > > > > > > > +struct rte_event_eth_rx_adapter_queue_info;
> > > > > > > > +
> > > > > > > > +/**
> > > > > > > > + * 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.
> > > > > > >
> > > > > > > It will useful for
> > > !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
> > > > > case
> > > > > > > too.
> > > > > > >
> > > > >
> > > > >
> > > > >
> > > > > Missed this comment in v4
> > > > Sorry I missed these comments
> > > >
> > > > rte_event_eth_rx_adapter_queue_info_get() calls PMD callback if
> > > > internal port cap is set, otherwise it implements to return the
> queue_info.
> > > > PMD callback is for internal port and queue_info_get() api
> > > > implements for non internal port
> > >
> > > This API will be useful for
> > > !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case too. In order
> to
> > > use this in a generic way, I suggest in following way,
> > >
> > > In the rte_event_eth_rx_adapter_queue_add() stores this config in
> > > common code(i.e
> > > file: ./lib/eventdev/rte_event_eth_rx_adapter.c and
> > > rte_event_eth_rx_adapter_queue_add() function) as named memzone
> or
> > > so.
> > >
> > > Later when rte_event_eth_rx_adapter_queue_conf_get() called, the
> > > config can be retrived through named memzone lookup and have PMD
> > > specific callback like your patch for overriding any parameter as
> > > neeed. i.e If PMD callback is NULL, Application should get the
> > > config struct as provided in
> > > rte_event_eth_rx_adapter_queue_add() with
> > > rte_event_eth_rx_adapter_queue_conf_get().
> > >
> > See below updated implementation
> >
> > que_conf_get() {
> > memzone lookup
> > return error on failure
> >
> > Fill queue config info in queue conf structure
> > if CAP_INTERNAL_PORT set and PMD call back is non NULL
>
> IMO, We don't need to check CAP_INTERNAL_PORT. Rest looks good to me.
OK
>
> Also update the test case check this path(case where PMD callback is NULL)
>
Added test case already covers this
>
> > call the PMD callback which overrides the info in queue conf
> > structure
> >
> > return 0; // queue config info is returned in passed queue_conf
> > structure }
> >
> > rx adapter structures are allocated in memzone, rx_queue_add() stores
> > the queue config info in named memzone and queue_conf_get() returns
> > queue config info from the named memzone.
> >
> > Please let me know your inputs on this
> > >
> > >
> > > >
> > > > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > > > index 182dd2e..75c0010 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_info_get()
> > > > > > > > *
> > > > > > > > * The application creates an ethernet to event adapter using
> > > > > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > > > > > rte_event_eth_rx_adapter_create() @@ -140,6 +141,56 @@
> > > typedef
> > > > > int
> > > > > > > (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t
> > > > > > > dev_id,
> > > > > > > > void *arg);
> > > > > > > >
> > > > > > > > /**
> > > > > > > > + * Rx queue info
> > > > > > > > + */
> > > > > > > > +struct rte_event_eth_rx_adapter_queue_info {
> > > > > > >
> > > > > > > Can we avoid the duplication of this structure and use
> > > > > > > rte_event_eth_rx_adapter_queue_conf instead.
> > > > > > >
> > > > Agree
> > > > > > > API can be rte_event_eth_rx_adapter_queue_conf_get() to
> > > > > > > align the structure.
> > > > Agree
> > > > > > >
> > > > > > > Also instead of every driver duplicating this code, How
> > > > > > > about
> > > > > > > - common code stores the config in
> > > > > > > rte_event_eth_rx_adapter_queue_add()
> > > > > > > - common code stores the config in
> > > > > > > rte_event_eth_rx_adapter_queue_conf_get()
> > > >
> > > > queue_add() stores the config in dev_info and queue_conf_get()
> > > > retrieves
> > > the config from dev_info.
> > > > Please clarify on common code to store and retrieve queue conf?
> > >
> > >
> > > See above.
> > >
> > >
> > > > > > > - Addtional PMD level API can be given incase, something
> > > > > > > needs to overridden by Adapter.
> > > > >
> > > > Existing PMD callbacks like queue_add, queue_del, adapter_start,
> > > > adapter_stop etc doesn't have any additional PMD level api.
> > > > queue_info_get PMD callback is also similar.
> > >
> > >
> > > See above.
> > >
> > >
> > >
> > > >
> > > > >
> > > > > Missed addressing this comment in v4.
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
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 ` 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
2 siblings, 1 reply; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-16 11:56 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit
Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler 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>
---
v5:
* Filled queue_conf after memzone lookup
* PMD callback if not NULL, invoked to override queue_conf struct
* Added memzone lookup for stats_get(), stats_reset(), service_id_get()
api's called by secondary applications.
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 | 91 +++++++++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
lib/eventdev/version.map | 1 +
5 files changed, 155 insertions(+), 1 deletion(-)
diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..5c26a6c 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
@@ -1081,6 +1108,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 f2dc695..6cc4210 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -40,6 +40,8 @@
/* Sentinel value to detect initialized file handle */
#define INIT_FD -1
+#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
+
/*
* Used to store port and queue ID of interrupting Rx queue
*/
@@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
static int
rte_event_eth_rx_adapter_init(void)
{
- const char *name = "rte_event_eth_rx_adapter_array";
+ const char *name = RXA_ADAPTER_ARRAY;
const struct rte_memzone *mz;
unsigned int sz;
@@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
return 0;
}
+static int
+rxa_memzone_lookup(void)
+{
+ const struct rte_memzone *mz;
+
+ if (event_eth_rx_adapter == NULL) {
+ mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
+ if (mz == NULL)
+ return -ENOMEM;
+ event_eth_rx_adapter = mz->addr;
+ }
+
+ return 0;
+}
+
static inline struct rte_event_eth_rx_adapter *
rxa_id_to_adapter(uint8_t id)
{
@@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
uint32_t i;
int ret;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
struct eth_device_info *dev_info;
uint32_t i;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
struct rte_event_eth_rx_adapter *rx_adapter;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
+ struct eth_device_info *dev_info;
+ struct eth_rx_queue_info *queue_info;
+ struct rte_event *qi_ev;
+ int ret;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ 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_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));
+
+ dev = &rte_eventdevs[rx_adapter->eventdev_id];
+ if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ queue_conf);
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 3f8b362..470543e 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()
@@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
uint8_t dev_id, uint16_t eth_port_id,
struct rte_event_eth_rx_adapter_vector_limits *limits);
+/**
+ * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
+ rte_event_eth_rx_adapter_queue_conf_get;
};
INTERNAL {
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest
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 ` Ganapati Kundapura
0 siblings, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-16 11:56 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit
Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index add4d8a..13664a3 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -747,6 +747,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_conf(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_conf);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_conf);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -759,6 +780,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
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 12:51 ` 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
` (2 more replies)
2 siblings, 3 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-16 12:51 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit
Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler 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>
---
v5:
* Filled queue_conf after memzone lookup
* PMD callback if not NULL, invoked to override queue_conf struct
* Added memzone lookup for stats_get(), stats_reset(), service_id_get()
api's called by secondary applications.
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 | 28 +++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
lib/eventdev/version.map | 1 +
5 files changed, 154 insertions(+), 1 deletion(-)
diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..e69644b 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
int32_t rx_queue_id);
/**
+ * Retrieve Rx adapter queue config information for the specified
+ * rx queue ID.
+ *
+ * @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
@@ -1081,6 +1107,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 f2dc695..6cc4210 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -40,6 +40,8 @@
/* Sentinel value to detect initialized file handle */
#define INIT_FD -1
+#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
+
/*
* Used to store port and queue ID of interrupting Rx queue
*/
@@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
static int
rte_event_eth_rx_adapter_init(void)
{
- const char *name = "rte_event_eth_rx_adapter_array";
+ const char *name = RXA_ADAPTER_ARRAY;
const struct rte_memzone *mz;
unsigned int sz;
@@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
return 0;
}
+static int
+rxa_memzone_lookup(void)
+{
+ const struct rte_memzone *mz;
+
+ if (event_eth_rx_adapter == NULL) {
+ mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
+ if (mz == NULL)
+ return -ENOMEM;
+ event_eth_rx_adapter = mz->addr;
+ }
+
+ return 0;
+}
+
static inline struct rte_event_eth_rx_adapter *
rxa_id_to_adapter(uint8_t id)
{
@@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
uint32_t i;
int ret;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
struct eth_device_info *dev_info;
uint32_t i;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
struct rte_event_eth_rx_adapter *rx_adapter;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
+ struct eth_device_info *dev_info;
+ struct eth_rx_queue_info *queue_info;
+ struct rte_event *qi_ev;
+ int ret;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ 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_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));
+
+ dev = &rte_eventdevs[rx_adapter->eventdev_id];
+ if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ queue_conf);
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 3f8b362..470543e 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()
@@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
uint8_t dev_id, uint16_t eth_port_id,
struct rte_event_eth_rx_adapter_vector_limits *limits);
+/**
+ * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
+ rte_event_eth_rx_adapter_queue_conf_get;
};
INTERNAL {
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest
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 ` 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-28 9:34 ` Jayatheerthan, Jay
2 siblings, 1 reply; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-16 12:51 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit
Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index add4d8a..13664a3 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -747,6 +747,27 @@ adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+adapter_queue_conf(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, &queue_conf);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ -1, &queue_conf);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
+ 0, NULL);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static struct unit_test_suite event_eth_rx_tests = {
.suite_name = "rx event eth adapter test suite",
.setup = testsuite_setup,
@@ -759,6 +780,7 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
+ TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
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-20 6:30 ` Jerin Jacob
2021-09-20 9:13 ` Kundapura, Ganapati
2021-09-28 9:34 ` Jayatheerthan, Jay
2 siblings, 1 reply; 34+ messages in thread
From: Jerin Jacob @ 2021-09-20 6:30 UTC (permalink / raw)
To: Ganapati Kundapura; +Cc: Jayatheerthan, Jay, dpdk-dev, Ferruh Yigit
On Thu, Sep 16, 2021 at 6:21 PM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
> information - event queue identifier, flags for handling received packets,
> scheduler 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>
>
> ---
> v5:
> * Filled queue_conf after memzone lookup
> * PMD callback if not NULL, invoked to override queue_conf struct
> * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> api's called by secondary applications.
>
> 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 | 28 +++++++
> lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++-
> lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> lib/eventdev/version.map | 1 +
> 5 files changed, 154 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..e69644b 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
> int32_t rx_queue_id);
>
> /**
> + * Retrieve Rx adapter queue config information for the specified
> + * rx queue ID.
> + *
> + * @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
> @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -40,6 +40,8 @@
> /* Sentinel value to detect initialized file handle */
> #define INIT_FD -1
>
> +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> +
> /*
> * Used to store port and queue ID of interrupting Rx queue
> */
> @@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
> static int
> rte_event_eth_rx_adapter_init(void)
> {
> - const char *name = "rte_event_eth_rx_adapter_array";
> + const char *name = RXA_ADAPTER_ARRAY;
> const struct rte_memzone *mz;
> unsigned int sz;
>
> @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> return 0;
> }
>
> +static int
> +rxa_memzone_lookup(void)
> +{
> + const struct rte_memzone *mz;
> +
> + if (event_eth_rx_adapter == NULL) {
> + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
Should this be global? There can be different config based on id and
dev_id. Right?
If so, we need to store memzone per unique space by appending
additional items in
this base string via sprintf or so.
> + if (mz == NULL)
> + return -ENOMEM;
> + event_eth_rx_adapter = mz->addr;
> + }
> +
> + return 0;
> +}
> +
> static inline struct rte_event_eth_rx_adapter *
> rxa_id_to_adapter(uint8_t id)
> {
> @@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
> uint32_t i;
> int ret;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> struct eth_device_info *dev_info;
> uint32_t i;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
> {
> struct rte_event_eth_rx_adapter *rx_adapter;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
> + struct eth_device_info *dev_info;
> + struct eth_rx_queue_info *queue_info;
> + struct rte_event *qi_ev;
> + int ret;
> +
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> + 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_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));
> +
> + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> + &rte_eth_devices[eth_dev_id],
> + rx_queue_id,
> + queue_conf);
> + return ret;
> + }
> +
> + return 0;
> +}
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index 3f8b362..470543e 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()
> @@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
> uint8_t dev_id, uint16_t eth_port_id,
> struct rte_event_eth_rx_adapter_vector_limits *limits);
>
> +/**
> + * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> + rte_event_eth_rx_adapter_queue_conf_get;
> };
>
> INTERNAL {
> --
> 2.6.4
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
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
0 siblings, 1 reply; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-20 9:13 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Yigit, Ferruh
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: 20 September 2021 12:00
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH v5 1/2] eventdev: add rx queue conf get api
>
> On Thu, Sep 16, 2021 at 6:21 PM Ganapati Kundapura
> <ganapati.kundapura@intel.com> wrote:
> >
> > Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
> > information - event queue identifier, flags for handling received
> > packets, scheduler 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>
> >
> > ---
> > v5:
> > * Filled queue_conf after memzone lookup
> > * PMD callback if not NULL, invoked to override queue_conf struct
> > * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> > api's called by secondary applications.
> >
> > 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 | 28 +++++++
> > lib/eventdev/rte_event_eth_rx_adapter.c | 91
> +++++++++++++++++++++-
> > lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> > lib/eventdev/version.map | 1 +
> > 5 files changed, 154 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > index 0780b6f..ce23d8a 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,
> > +scheduler 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 63b3bc4..e69644b 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -562,6 +562,32 @@ typedef int
> (*eventdev_eth_rx_adapter_queue_del_t)
> > int32_t rx_queue_id);
> >
> > /**
> > + * Retrieve Rx adapter queue config information for the specified
> > + * rx queue ID.
> > + *
> > + * @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
> > @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -40,6 +40,8 @@
> > /* Sentinel value to detect initialized file handle */
> > #define INIT_FD -1
> >
> > +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> > +
> > /*
> > * Used to store port and queue ID of interrupting Rx queue
> > */
> > @@ -1347,7 +1349,7 @@ rxa_service_func(void *args) static int
> > rte_event_eth_rx_adapter_init(void)
> > {
> > - const char *name = "rte_event_eth_rx_adapter_array";
> > + const char *name = RXA_ADAPTER_ARRAY;
> > const struct rte_memzone *mz;
> > unsigned int sz;
> >
> > @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> > return 0;
> > }
> >
> > +static int
> > +rxa_memzone_lookup(void)
> > +{
> > + const struct rte_memzone *mz;
> > +
> > + if (event_eth_rx_adapter == NULL) {
> > + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
>
>
>
> Should this be global? There can be different config based on id and dev_id.
> Right?
> If so, we need to store memzone per unique space by appending additional
> items in this base string via sprintf or so.
>
event_eth_rx_adapter is global array and allocated on memzone in rte_event_eth_rx_adapter_init()
static struct rte_event_eth_rx_adapter **event_eth_rx_adapter;
Each rx adapter instance is allocated on heap using rte_zmalloc_socket() and stored in global memzone
array and hence global array lookup.
event_eth_rx_adapter[id] = rx_adapter;
In queue_conf() api, memzone lookup for global array and rx_adapter instance is retrieved from the global array
from adapter id.
>
> > + if (mz == NULL)
> > + return -ENOMEM;
> > + event_eth_rx_adapter = mz->addr;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static inline struct rte_event_eth_rx_adapter *
> > rxa_id_to_adapter(uint8_t id) { @@ -2631,6 +2648,9 @@
> > rte_event_eth_rx_adapter_stats_get(uint8_t id,
> > uint32_t i;
> > int ret;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id); @@ -2669,6 +2689,9 @@
> > rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> > struct eth_device_info *dev_info;
> > uint32_t i;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id); @@ -2694,6 +2717,9 @@
> > rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t
> > *service_id) {
> > struct rte_event_eth_rx_adapter *rx_adapter;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id); @@ -2750,3 +2776,66 @@
> > 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 rte_event_eth_rx_adapter *rx_adapter;
> > + struct eth_device_info *dev_info;
> > + struct eth_rx_queue_info *queue_info;
> > + struct rte_event *qi_ev;
> > + int ret;
> > +
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > + 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_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));
> > +
> > + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> > + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> > + &rte_eth_devices[eth_dev_id],
> > + rx_queue_id,
> > + queue_conf);
> > + return ret;
> > + }
> > +
> > + return 0;
> > +}
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > index 3f8b362..470543e 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() @@ -545,6 +546,32 @@ int
> rte_event_eth_rx_adapter_vector_limits_get(
> > uint8_t dev_id, uint16_t eth_port_id,
> > struct rte_event_eth_rx_adapter_vector_limits *limits);
> >
> > +/**
> > + * 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
> > cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> > + rte_event_eth_rx_adapter_queue_conf_get;
> > };
> >
> > INTERNAL {
> > --
> > 2.6.4
> >
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
2021-09-20 9:13 ` Kundapura, Ganapati
@ 2021-09-22 11:18 ` Kundapura, Ganapati
2021-09-24 7:49 ` Jayatheerthan, Jay
0 siblings, 1 reply; 34+ messages in thread
From: Kundapura, Ganapati @ 2021-09-22 11:18 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Jayatheerthan, Jay, dpdk-dev, Yigit, Ferruh
Hi Jerin,
> -----Original Message-----
> From: Kundapura, Ganapati
> Sent: 20 September 2021 14:44
> To: Jerin Jacob <jerinjacobk@gmail.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: RE: [PATCH v5 1/2] eventdev: add rx queue conf get api
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: 20 September 2021 12:00
> > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> > Subject: Re: [PATCH v5 1/2] eventdev: add rx queue conf get api
> >
> > On Thu, Sep 16, 2021 at 6:21 PM Ganapati Kundapura
> > <ganapati.kundapura@intel.com> wrote:
> > >
> > > Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx
> queue
> > > information - event queue identifier, flags for handling received
> > > packets, scheduler 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>
> > >
> > > ---
> > > v5:
> > > * Filled queue_conf after memzone lookup
> > > * PMD callback if not NULL, invoked to override queue_conf struct
> > > * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> > > api's called by secondary applications.
> > >
> > > 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 | 28 +++++++
> > > lib/eventdev/rte_event_eth_rx_adapter.c | 91
> > +++++++++++++++++++++-
> > > lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> > > lib/eventdev/version.map | 1 +
> > > 5 files changed, 154 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > index 0780b6f..ce23d8a 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,
> > > +scheduler 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 63b3bc4..e69644b 100644
> > > --- a/lib/eventdev/eventdev_pmd.h
> > > +++ b/lib/eventdev/eventdev_pmd.h
> > > @@ -562,6 +562,32 @@ typedef int
> > (*eventdev_eth_rx_adapter_queue_del_t)
> > > int32_t rx_queue_id);
> > >
> > > /**
> > > + * Retrieve Rx adapter queue config information for the specified
> > > + * rx queue ID.
> > > + *
> > > + * @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
> > > @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > @@ -40,6 +40,8 @@
> > > /* Sentinel value to detect initialized file handle */
> > > #define INIT_FD -1
> > >
> > > +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> > > +
> > > /*
> > > * Used to store port and queue ID of interrupting Rx queue
> > > */
> > > @@ -1347,7 +1349,7 @@ rxa_service_func(void *args) static int
> > > rte_event_eth_rx_adapter_init(void)
> > > {
> > > - const char *name = "rte_event_eth_rx_adapter_array";
> > > + const char *name = RXA_ADAPTER_ARRAY;
> > > const struct rte_memzone *mz;
> > > unsigned int sz;
> > >
> > > @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> > > return 0;
> > > }
> > >
> > > +static int
> > > +rxa_memzone_lookup(void)
> > > +{
> > > + const struct rte_memzone *mz;
> > > +
> > > + if (event_eth_rx_adapter == NULL) {
> > > + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
> >
> >
> >
> > Should this be global? There can be different config based on id and
> dev_id.
> > Right?
> > If so, we need to store memzone per unique space by appending
> > additional items in this base string via sprintf or so.
> >
> event_eth_rx_adapter is global array and allocated on memzone in
> rte_event_eth_rx_adapter_init() static struct rte_event_eth_rx_adapter
> **event_eth_rx_adapter;
>
> Each rx adapter instance is allocated on heap using rte_zmalloc_socket() and
> stored in global memzone array and hence global array lookup.
>
> event_eth_rx_adapter[id] = rx_adapter;
>
> In queue_conf() api, memzone lookup for global array and rx_adapter
> instance is retrieved from the global array from adapter id.
>
A gentle ping to review this
>
> >
> > > + if (mz == NULL)
> > > + return -ENOMEM;
> > > + event_eth_rx_adapter = mz->addr;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > static inline struct rte_event_eth_rx_adapter *
> > > rxa_id_to_adapter(uint8_t id) { @@ -2631,6 +2648,9 @@
> > > rte_event_eth_rx_adapter_stats_get(uint8_t id,
> > > uint32_t i;
> > > int ret;
> > >
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> > > +
> > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> EINVAL);
> > >
> > > rx_adapter = rxa_id_to_adapter(id); @@ -2669,6 +2689,9 @@
> > > rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> > > struct eth_device_info *dev_info;
> > > uint32_t i;
> > >
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> > > +
> > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> EINVAL);
> > >
> > > rx_adapter = rxa_id_to_adapter(id); @@ -2694,6 +2717,9 @@
> > > rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t
> > > *service_id) {
> > > struct rte_event_eth_rx_adapter *rx_adapter;
> > >
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> > > +
> > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> EINVAL);
> > >
> > > rx_adapter = rxa_id_to_adapter(id); @@ -2750,3 +2776,66 @@
> > > 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 rte_event_eth_rx_adapter *rx_adapter;
> > > + struct eth_device_info *dev_info;
> > > + struct eth_rx_queue_info *queue_info;
> > > + struct rte_event *qi_ev;
> > > + int ret;
> > > +
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> > > +
> > > + 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_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));
> > > +
> > > + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > > + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> > > + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> > > + &rte_eth_devices[eth_dev_id],
> > > + rx_queue_id,
> > > + queue_conf);
> > > + return ret;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > index 3f8b362..470543e 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() @@ -545,6 +546,32 @@ int
> > rte_event_eth_rx_adapter_vector_limits_get(
> > > uint8_t dev_id, uint16_t eth_port_id,
> > > struct rte_event_eth_rx_adapter_vector_limits *limits);
> > >
> > > +/**
> > > + * 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
> > > cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> > > + rte_event_eth_rx_adapter_queue_conf_get;
> > > };
> > >
> > > INTERNAL {
> > > --
> > > 2.6.4
> > >
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
2021-09-22 11:18 ` Kundapura, Ganapati
@ 2021-09-24 7:49 ` Jayatheerthan, Jay
0 siblings, 0 replies; 34+ messages in thread
From: Jayatheerthan, Jay @ 2021-09-24 7:49 UTC (permalink / raw)
To: Kundapura, Ganapati, Jerin Jacob; +Cc: dpdk-dev, Yigit, Ferruh
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, September 22, 2021 4:49 PM
> To: Jerin Jacob <jerinjacobk@gmail.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: RE: [PATCH v5 1/2] eventdev: add rx queue conf get api
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Kundapura, Ganapati
> > Sent: 20 September 2021 14:44
> > To: Jerin Jacob <jerinjacobk@gmail.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> > Subject: RE: [PATCH v5 1/2] eventdev: add rx queue conf get api
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: 20 September 2021 12:00
> > > To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dpdk-dev
> > > <dev@dpdk.org>; Yigit, Ferruh <ferruh.yigit@intel.com>
> > > Subject: Re: [PATCH v5 1/2] eventdev: add rx queue conf get api
> > >
> > > On Thu, Sep 16, 2021 at 6:21 PM Ganapati Kundapura
> > > <ganapati.kundapura@intel.com> wrote:
> > > >
> > > > Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx
> > queue
> > > > information - event queue identifier, flags for handling received
> > > > packets, scheduler 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>
> > > >
> > > > ---
> > > > v5:
> > > > * Filled queue_conf after memzone lookup
> > > > * PMD callback if not NULL, invoked to override queue_conf struct
> > > > * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> > > > api's called by secondary applications.
> > > >
> > > > 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 | 28 +++++++
> > > > lib/eventdev/rte_event_eth_rx_adapter.c | 91
> > > +++++++++++++++++++++-
> > > > lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> > > > lib/eventdev/version.map | 1 +
> > > > 5 files changed, 154 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > index 0780b6f..ce23d8a 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,
> > > > +scheduler 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 63b3bc4..e69644b 100644
> > > > --- a/lib/eventdev/eventdev_pmd.h
> > > > +++ b/lib/eventdev/eventdev_pmd.h
> > > > @@ -562,6 +562,32 @@ typedef int
> > > (*eventdev_eth_rx_adapter_queue_del_t)
> > > > int32_t rx_queue_id);
> > > >
> > > > /**
> > > > + * Retrieve Rx adapter queue config information for the specified
> > > > + * rx queue ID.
> > > > + *
> > > > + * @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
> > > > @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > @@ -40,6 +40,8 @@
> > > > /* Sentinel value to detect initialized file handle */
> > > > #define INIT_FD -1
> > > >
> > > > +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> > > > +
> > > > /*
> > > > * Used to store port and queue ID of interrupting Rx queue
> > > > */
> > > > @@ -1347,7 +1349,7 @@ rxa_service_func(void *args) static int
> > > > rte_event_eth_rx_adapter_init(void)
> > > > {
> > > > - const char *name = "rte_event_eth_rx_adapter_array";
> > > > + const char *name = RXA_ADAPTER_ARRAY;
> > > > const struct rte_memzone *mz;
> > > > unsigned int sz;
> > > >
> > > > @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> > > > return 0;
> > > > }
> > > >
> > > > +static int
> > > > +rxa_memzone_lookup(void)
> > > > +{
> > > > + const struct rte_memzone *mz;
> > > > +
> > > > + if (event_eth_rx_adapter == NULL) {
> > > > + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
> > >
> > >
> > >
> > > Should this be global? There can be different config based on id and
> > dev_id.
> > > Right?
> > > If so, we need to store memzone per unique space by appending
> > > additional items in this base string via sprintf or so.
> > >
> > event_eth_rx_adapter is global array and allocated on memzone in
> > rte_event_eth_rx_adapter_init() static struct rte_event_eth_rx_adapter
> > **event_eth_rx_adapter;
> >
> > Each rx adapter instance is allocated on heap using rte_zmalloc_socket() and
> > stored in global memzone array and hence global array lookup.
> >
> > event_eth_rx_adapter[id] = rx_adapter;
> >
> > In queue_conf() api, memzone lookup for global array and rx_adapter
> > instance is retrieved from the global array from adapter id.
> >
> A gentle ping to review this
@Jerin, do you have further comments on this ?
> >
> > >
> > > > + if (mz == NULL)
> > > > + return -ENOMEM;
> > > > + event_eth_rx_adapter = mz->addr;
> > > > + }
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > static inline struct rte_event_eth_rx_adapter *
> > > > rxa_id_to_adapter(uint8_t id) { @@ -2631,6 +2648,9 @@
> > > > rte_event_eth_rx_adapter_stats_get(uint8_t id,
> > > > uint32_t i;
> > > > int ret;
> > > >
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > > > +
> > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> > EINVAL);
> > > >
> > > > rx_adapter = rxa_id_to_adapter(id); @@ -2669,6 +2689,9 @@
> > > > rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> > > > struct eth_device_info *dev_info;
> > > > uint32_t i;
> > > >
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > > > +
> > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> > EINVAL);
> > > >
> > > > rx_adapter = rxa_id_to_adapter(id); @@ -2694,6 +2717,9 @@
> > > > rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t
> > > > *service_id) {
> > > > struct rte_event_eth_rx_adapter *rx_adapter;
> > > >
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > > > +
> > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -
> > EINVAL);
> > > >
> > > > rx_adapter = rxa_id_to_adapter(id); @@ -2750,3 +2776,66 @@
> > > > 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 rte_event_eth_rx_adapter *rx_adapter;
> > > > + struct eth_device_info *dev_info;
> > > > + struct eth_rx_queue_info *queue_info;
> > > > + struct rte_event *qi_ev;
> > > > + int ret;
> > > > +
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > > > +
> > > > + 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_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));
> > > > +
> > > > + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > > > + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> > > > + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> > > > + &rte_eth_devices[eth_dev_id],
> > > > + rx_queue_id,
> > > > + queue_conf);
> > > > + return ret;
> > > > + }
> > > > +
> > > > + return 0;
> > > > +}
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > index 3f8b362..470543e 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() @@ -545,6 +546,32 @@ int
> > > rte_event_eth_rx_adapter_vector_limits_get(
> > > > uint8_t dev_id, uint16_t eth_port_id,
> > > > struct rte_event_eth_rx_adapter_vector_limits *limits);
> > > >
> > > > +/**
> > > > + * 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
> > > > cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> > > > + rte_event_eth_rx_adapter_queue_conf_get;
> > > > };
> > > >
> > > > INTERNAL {
> > > > --
> > > > 2.6.4
> > > >
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
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-20 6:30 ` [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api Jerin Jacob
@ 2021-09-28 9:34 ` Jayatheerthan, Jay
2021-09-29 7:36 ` Jerin Jacob
2 siblings, 1 reply; 34+ messages in thread
From: Jayatheerthan, Jay @ 2021-09-28 9:34 UTC (permalink / raw)
To: Kundapura, Ganapati, jerinjacobk; +Cc: dev, Yigit, Ferruh
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Thursday, September 16, 2021 6:21 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinjacobk@gmail.com
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [PATCH v5 1/2] eventdev: add rx queue conf get api
>
> Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
> information - event queue identifier, flags for handling received packets,
> scheduler 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>
>
> ---
> v5:
> * Filled queue_conf after memzone lookup
> * PMD callback if not NULL, invoked to override queue_conf struct
> * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> api's called by secondary applications.
>
> 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 | 28 +++++++
> lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++-
> lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> lib/eventdev/version.map | 1 +
> 5 files changed, 154 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..e69644b 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
> int32_t rx_queue_id);
>
> /**
> + * Retrieve Rx adapter queue config information for the specified
> + * rx queue ID.
> + *
> + * @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
> @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -40,6 +40,8 @@
> /* Sentinel value to detect initialized file handle */
> #define INIT_FD -1
>
> +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> +
> /*
> * Used to store port and queue ID of interrupting Rx queue
> */
> @@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
> static int
> rte_event_eth_rx_adapter_init(void)
> {
> - const char *name = "rte_event_eth_rx_adapter_array";
> + const char *name = RXA_ADAPTER_ARRAY;
> const struct rte_memzone *mz;
> unsigned int sz;
>
> @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> return 0;
> }
>
> +static int
> +rxa_memzone_lookup(void)
> +{
> + const struct rte_memzone *mz;
> +
> + if (event_eth_rx_adapter == NULL) {
> + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
> + if (mz == NULL)
> + return -ENOMEM;
> + event_eth_rx_adapter = mz->addr;
> + }
> +
> + return 0;
> +}
> +
> static inline struct rte_event_eth_rx_adapter *
> rxa_id_to_adapter(uint8_t id)
> {
> @@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
> uint32_t i;
> int ret;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> struct eth_device_info *dev_info;
> uint32_t i;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
> {
> struct rte_event_eth_rx_adapter *rx_adapter;
>
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
>
> rx_adapter = rxa_id_to_adapter(id);
> @@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
> + struct eth_device_info *dev_info;
> + struct eth_rx_queue_info *queue_info;
> + struct rte_event *qi_ev;
> + int ret;
> +
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
> +
> + 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_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));
> +
> + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> + &rte_eth_devices[eth_dev_id],
> + rx_queue_id,
> + queue_conf);
> + return ret;
> + }
> +
> + return 0;
> +}
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index 3f8b362..470543e 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()
> @@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
> uint8_t dev_id, uint16_t eth_port_id,
> struct rte_event_eth_rx_adapter_vector_limits *limits);
>
> +/**
> + * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> + rte_event_eth_rx_adapter_queue_conf_get;
> };
>
> INTERNAL {
> --
> 2.6.4
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest
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
0 siblings, 0 replies; 34+ messages in thread
From: Jayatheerthan, Jay @ 2021-09-28 9:35 UTC (permalink / raw)
To: Kundapura, Ganapati, jerinjacobk; +Cc: dev, Yigit, Ferruh
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Thursday, September 16, 2021 6:21 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinjacobk@gmail.com
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [PATCH v5 2/2] test/event: Add rx queue conf get test in rx adapter autotest
>
> Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
> in rx adapter autotest
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> app/test/test_event_eth_rx_adapter.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
> index add4d8a..13664a3 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -747,6 +747,27 @@ adapter_stats(void)
> return TEST_SUCCESS;
> }
>
> +static int
> +adapter_queue_conf(void)
> +{
> + int err;
> + struct rte_event_eth_rx_adapter_queue_conf queue_conf;
> +
> + err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
> + 0, &queue_conf);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
> + -1, &queue_conf);
> + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> +
> + err = rte_event_eth_rx_adapter_queue_conf_get(TEST_INST_ID, TEST_DEV_ID,
> + 0, NULL);
> + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
> +
> + return TEST_SUCCESS;
> +}
> +
> static struct unit_test_suite event_eth_rx_tests = {
> .suite_name = "rx event eth adapter test suite",
> .setup = testsuite_setup,
> @@ -759,6 +780,7 @@ static struct unit_test_suite event_eth_rx_tests = {
> adapter_multi_eth_add_del),
> TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
> TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
> + TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
> TEST_CASES_END() /**< NULL terminate unit test array */
> }
> };
> --
> 2.6.4
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
2021-09-28 9:34 ` Jayatheerthan, Jay
@ 2021-09-29 7:36 ` Jerin Jacob
0 siblings, 0 replies; 34+ messages in thread
From: Jerin Jacob @ 2021-09-29 7:36 UTC (permalink / raw)
To: Jayatheerthan, Jay; +Cc: Kundapura, Ganapati, dev, Yigit, Ferruh
On Tue, Sep 28, 2021 at 3:04 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> > -----Original Message-----
> > From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Sent: Thursday, September 16, 2021 6:21 PM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinjacobk@gmail.com
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
> > Subject: [PATCH v5 1/2] eventdev: add rx queue conf get api
> >
> > Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
> > information - event queue identifier, flags for handling received packets,
> > scheduler 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>
> >
> > ---
> > v5:
> > * Filled queue_conf after memzone lookup
> > * PMD callback if not NULL, invoked to override queue_conf struct
> > * Added memzone lookup for stats_get(), stats_reset(), service_id_get()
> > api's called by secondary applications.
> >
> > 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 | 28 +++++++
> > lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++-
> > lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
> > lib/eventdev/version.map | 1 +
> > 5 files changed, 154 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..e69644b 100644
> > --- a/lib/eventdev/eventdev_pmd.h
> > +++ b/lib/eventdev/eventdev_pmd.h
> > @@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
> > int32_t rx_queue_id);
> >
> > /**
> > + * Retrieve Rx adapter queue config information for the specified
> > + * rx queue ID.
> > + *
> > + * @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
> > @@ -1081,6 +1107,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 f2dc695..6cc4210 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -40,6 +40,8 @@
> > /* Sentinel value to detect initialized file handle */
> > #define INIT_FD -1
> >
> > +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
> > +
> > /*
> > * Used to store port and queue ID of interrupting Rx queue
> > */
> > @@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
> > static int
> > rte_event_eth_rx_adapter_init(void)
> > {
> > - const char *name = "rte_event_eth_rx_adapter_array";
> > + const char *name = RXA_ADAPTER_ARRAY;
> > const struct rte_memzone *mz;
> > unsigned int sz;
> >
> > @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
> > return 0;
> > }
> >
> > +static int
> > +rxa_memzone_lookup(void)
> > +{
> > + const struct rte_memzone *mz;
> > +
> > + if (event_eth_rx_adapter == NULL) {
> > + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
> > + if (mz == NULL)
> > + return -ENOMEM;
> > + event_eth_rx_adapter = mz->addr;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static inline struct rte_event_eth_rx_adapter *
> > rxa_id_to_adapter(uint8_t id)
> > {
> > @@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
> > uint32_t i;
> > int ret;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id);
> > @@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
> > struct eth_device_info *dev_info;
> > uint32_t i;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id);
> > @@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
> > {
> > struct rte_event_eth_rx_adapter *rx_adapter;
> >
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> >
> > rx_adapter = rxa_id_to_adapter(id);
> > @@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
> > + struct eth_device_info *dev_info;
> > + struct eth_rx_queue_info *queue_info;
> > + struct rte_event *qi_ev;
> > + int ret;
> > +
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> > +
> > + 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_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));
> > +
> > + dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> > + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
> > + &rte_eth_devices[eth_dev_id],
> > + rx_queue_id,
> > + queue_conf);
> > + return ret;
> > + }
> > +
> > + return 0;
> > +}
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> > index 3f8b362..470543e 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()
> > @@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
> > uint8_t dev_id, uint16_t eth_port_id,
> > struct rte_event_eth_rx_adapter_vector_limits *limits);
> >
> > +/**
> > + * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
> > + rte_event_eth_rx_adapter_queue_conf_get;
> > };
> >
> > INTERNAL {
> > --
> > 2.6.4
>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Fixed check-gitlog issues as below.
Applied to dpdk-next-net-eventdev/for-main. Thanks
commit c3d905eadaa8d1e04e22e494d31c3708cf9c53fc (HEAD -> for-main,
origin/for-main, origin/HEAD)
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Thu Sep 16 07:51:07 2021 -0500
test/event: add Rx adapter queue config get test cases
Add unit tests for rte_event_eth_rx_adapter_queue_conf_get()
in rx adapter autotest
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
commit b36879759b7f3ce27c137db863806de513fe4d44
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Thu Sep 16 07:51:06 2021 -0500
eventdev/rx_adapter: support Rx queue config get
Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler 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>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api
@ 2021-09-16 12:46 Ganapati Kundapura
0 siblings, 0 replies; 34+ messages in thread
From: Ganapati Kundapura @ 2021-09-16 12:46 UTC (permalink / raw)
To: jay.jayatheerthan, jerinjacobk; +Cc: dev, ferruh.yigit
Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler 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>
---
v5:
* Filled queue_conf after memzone lookup
* PMD callback if not NULL, invoked to override queue_conf struct
* Added memzone lookup for stats_get(), stats_reset(), service_id_get()
api's called by secondary applications.
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 | 28 +++++++
lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++
lib/eventdev/version.map | 1 +
5 files changed, 154 insertions(+), 1 deletion(-)
diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index 0780b6f..ce23d8a 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, scheduler 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 63b3bc4..e69644b 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t)
int32_t rx_queue_id);
/**
+ * Retrieve Rx adapter queue config information for the specified
+ * rx queue ID.
+ *
+ * @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
@@ -1081,6 +1107,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 f2dc695..6cc4210 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -40,6 +40,8 @@
/* Sentinel value to detect initialized file handle */
#define INIT_FD -1
+#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array"
+
/*
* Used to store port and queue ID of interrupting Rx queue
*/
@@ -1347,7 +1349,7 @@ rxa_service_func(void *args)
static int
rte_event_eth_rx_adapter_init(void)
{
- const char *name = "rte_event_eth_rx_adapter_array";
+ const char *name = RXA_ADAPTER_ARRAY;
const struct rte_memzone *mz;
unsigned int sz;
@@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void)
return 0;
}
+static int
+rxa_memzone_lookup(void)
+{
+ const struct rte_memzone *mz;
+
+ if (event_eth_rx_adapter == NULL) {
+ mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY);
+ if (mz == NULL)
+ return -ENOMEM;
+ event_eth_rx_adapter = mz->addr;
+ }
+
+ return 0;
+}
+
static inline struct rte_event_eth_rx_adapter *
rxa_id_to_adapter(uint8_t id)
{
@@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id,
uint32_t i;
int ret;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id)
struct eth_device_info *dev_info;
uint32_t i;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
struct rte_event_eth_rx_adapter *rx_adapter;
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
@@ -2750,3 +2776,66 @@ 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 rte_event_eth_rx_adapter *rx_adapter;
+ struct eth_device_info *dev_info;
+ struct eth_rx_queue_info *queue_info;
+ struct rte_event *qi_ev;
+ int ret;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ 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_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));
+
+ dev = &rte_eventdevs[rx_adapter->eventdev_id];
+ if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
+ ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev,
+ &rte_eth_devices[eth_dev_id],
+ rx_queue_id,
+ queue_conf);
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index 3f8b362..470543e 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()
@@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get(
uint8_t dev_id, uint16_t eth_port_id,
struct rte_event_eth_rx_adapter_vector_limits *limits);
+/**
+ * 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 cd86d2d..9f28016 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_eventdev_trace_crypto_adapter_enqueue;
+ rte_event_eth_rx_adapter_queue_conf_get;
};
INTERNAL {
--
2.6.4
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2021-09-29 7:36 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 5:36 [dpdk-dev] [PATCH] eventdev: add rx queue info get api 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 ` [dpdk-dev] [PATCH v4 1/2] eventdev: add rx queue conf get api Ganapati Kundapura
2021-09-12 15:01 ` [dpdk-dev] [PATCH v4 2/2] test/event: Add rx queue conf get test in rx adapter autotest 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
2021-09-16 12:46 Ganapati Kundapura
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).