* [PATCH v2 2/3] eventdev/eth_tx: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
@ 2023-01-23 18:04 ` Naga Harish K S V
2023-01-23 18:04 ` [PATCH v2 3/3] eventdev/crypto: " Naga Harish K S V
` (4 subsequent siblings)
5 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-01-23 18:04 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_tx_adapter_runtime_params`` can be
configured and retrieved using
``rte_event_eth_tx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 110 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 23 ++++
lib/eventdev/rte_event_eth_tx_adapter.c | 90 +++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 66 +++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 290 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..437f09bef7 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,112 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx, "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx, "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx, "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx, "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +964,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..b843f5a3a2 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,26 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/read are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
+
+``rte_event_eth_tx_adapter_create()`` configures the adapter with
+default value of maximum packets processed per request to 128.
+``rte_event_eth_tx_adapter_runtime_params_set()`` function allows to reconfigure
+maximum number of packets processed by adapter per service request.
+This is alternative to configuring the maximum packets processed per request by
+adapter by using ``rte_event_eth_tx_adapter_create_ext()`` with parameter
+rte_event_eth_tx_adapter_conf::max_nb_tx
+
+The adapter flush threshold also can be configured using
+``rte_event_eth_tx_adapter_runtime_params_set()``.
+
+``rte_event_eth_tx_adapter_runtime_params_get()`` function retrieves the adapter
+params that are defined in ``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index 6e9bcb1b79..0899e16f4c 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -124,6 +124,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +667,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1281,6 +1285,90 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ eth_dev = txa->txa_ethdev[0].dev;
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..cb5db6781c 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,8 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +105,23 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+/**
+ * Adapter configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +535,53 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params()
+ * and modify the required parameters and then call
+ * rte_event_eth_tx_adapter_set_params().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index da97db794f..38dfbb1f41 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -123,6 +123,8 @@ EXPERIMENTAL {
# added in 23.03
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v2 3/3] eventdev/crypto: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
2023-01-23 18:04 ` [PATCH v2 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-01-23 18:04 ` Naga Harish K S V
2023-01-24 4:29 ` [PATCH v2 1/3] eventdev/eth_rx: " Jerin Jacob
` (3 subsequent siblings)
5 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-01-23 18:04 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
``struct rte_event_crypto_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_crypto_adapter_runtime_params_set``
and ``rte_event_eth_rx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 93 +++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 19 ++++
lib/eventdev/rte_event_crypto_adapter.c | 88 ++++++++++++++++++
lib/eventdev/rte_event_crypto_adapter.h | 59 ++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 261 insertions(+)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..9bcbf79e57 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,95 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to create add queue pair\n");
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID, &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID, &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1543,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..2177e441c3 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,22 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_crypto_adapter_runtime_params``.
+
+``rte_event_crypto_adapter_create()`` configures the adapter with
+default value for maximum packets processed per request to 128.
+``rte_event_crypto_adapter_runtime_params_set()`` function allows to reconfigure
+maximum number of packets processed by adapter per service request. This is
+alternative to configuring the maximum packets processed per request by adapter
+by using ``rte_event_crypto_adapter_create_ext()`` with parameter
+``rte_event_crypto_adapter_conf::max_nb``.
+
+``rte_event_crypto_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index bb782208f0..ace931eddd 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -1327,6 +1327,94 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..9de267443b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,8 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +255,19 @@ struct rte_event_crypto_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +623,50 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 38dfbb1f41..60e5e3a593 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
rte_event_eth_tx_adapter_runtime_params_get;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
2023-01-23 18:04 ` [PATCH v2 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-01-23 18:04 ` [PATCH v2 3/3] eventdev/crypto: " Naga Harish K S V
@ 2023-01-24 4:29 ` Jerin Jacob
2023-01-24 13:07 ` Naga Harish K, S V
2023-02-09 16:57 ` [PATCH v3 " Naga Harish K S V
` (2 subsequent siblings)
5 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-01-24 4:29 UTC (permalink / raw)
To: Naga Harish K S V
Cc: jerinj, erik.g.carrillo, abhinandan.gujjar, dev, jay.jayatheerthan
On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter configuration parameters defined in the
> ``struct rte_event_eth_rx_adapter_runtime_params`` can be configured
> and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
> ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> index 461eca566f..2207d6ffc3 100644
> --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> @@ -185,6 +185,26 @@ 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``.
>
> +Set/Get adapter runtime configuration parameters
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The runtime configuration parameters of adapter can be set/read using
> +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
> +can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
Good.
> +
> +``rte_event_eth_rx_adapter_create()`` or
> +``rte_event_eth_rx_adapter_create_with_params()`` configures the adapter with
> +default value for maximum packets processed per request to 128.
> +``rte_event_eth_rx_adapter_runtime_params_set()`` function allows to reconfigure
> +maximum number of packets processed by adapter per service request. This is
> +alternative to configuring the maximum packets processed per request by adapter
> +by using ``rte_event_eth_rx_adapter_create_ext()`` with parameter
> +``rte_event_eth_rx_adapter_conf::max_nb_rx``.
This paragraph is not needed IMO. As it is specific to a driver, and
we can keep Doxygen comment only.
> +
> +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
> +parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
Good.
> +
> Getting and resetting Adapter queue stats
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index 34aa87379e..d8f3e750b7 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -35,6 +35,8 @@
> #define MAX_VECTOR_NS 1E9
> #define MIN_VECTOR_NS 1E5
>
> +#define RXA_NB_RX_WORK_DEFAULT 128
> +
> #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
>
> @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
> }
>
> conf->event_port_id = port_id;
> - conf->max_nb_rx = 128;
> + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> if (started)
> ret = rte_event_dev_start(dev_id);
> rx_adapter->default_cb_arg = 1;
> @@ -3436,6 +3438,90 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> return -EINVAL;
> }
> +
> +int
> +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_eth_rx_adapter_runtime_params *params)
> +{
> + struct event_eth_rx_adapter *rxa;
> + int ret;
> +
> + if (params == NULL)
> + return -EINVAL;
> +
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
Introduce an adapter callback and move SW adapter related logic under
callback handler.
> +
> + rxa = rxa_id_to_adapter(id);
> + if (rxa == NULL)
> + return -EINVAL;
> +
> + ret = rxa_caps_check(rxa);
> + if (ret)
> + return ret;
> +
> + rte_spinlock_lock(&rxa->rx_lock);
> + rxa->max_nb_rx = params->max_nb_rx;
> + rte_spinlock_unlock(&rxa->rx_lock);
> +
> + return 0;
> +}
> +
> +int
> +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_eth_rx_adapter_runtime_params *params)
> +{
> + struct event_eth_rx_adapter *rxa;
> + int ret;
> +
> + if (params == NULL)
> + return -EINVAL;
Introduce an adapter callback and move SW adapter related logic under
callback handler.
> +
> + if (rxa_memzone_lookup())
> + return -ENOMEM;
+
> + rxa = rxa_id_to_adapter(id);
> + if (rxa == NULL)
> + return -EINVAL;
> +
> + ret = rxa_caps_check(rxa);
> + if (ret)
> + return ret;
> +
> + params->max_nb_rx = rxa->max_nb_rx;
> +
> + return 0;
> +}
> +
> +/* RX-adapter telemetry callbacks */
> #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s)
>
> static int
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index f4652f40e8..214ffd018c 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> @@ -39,10 +39,21 @@
> * - rte_event_eth_rx_adapter_queue_stats_reset()
> * - rte_event_eth_rx_adapter_event_port_get()
> * - rte_event_eth_rx_adapter_instance_get()
> + * - rte_event_eth_rx_adapter_runtime_params_get()
> + * - rte_event_eth_rx_adapter_runtime_params_set()
> *
> * The application creates an ethernet to event adapter using
> * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
> * or rte_event_eth_rx_adapter_create_with_params() functions.
> + *
> + * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
> + * configures the adapter with default value of maximum packets processed per
> + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> + * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
> + * packets processed per iteration. This is alternative to using
> + * rte_event_eth_rx_adapter_create_ext() with parameter
> + * rte_event_eth_rx_adapter_conf::max_nb_rx
Move this to Doxygen comment against max_nb_rx
> + *
> * The adapter needs to know which ethernet rx queues to poll for mbufs as well
> * as event device parameters such as the event queue identifier, event
> * priority and scheduling type that the adapter should use when constructing
> @@ -299,6 +310,19 @@ struct rte_event_eth_rx_adapter_params {
> /**< flag to indicate that event buffer is separate for each queue */
> };
>
> +/**
> + * Adapter configuration parameters
> + */
> +struct rte_event_eth_rx_adapter_runtime_params {
> + uint32_t max_nb_rx;
> + /**< The adapter can return early if it has processed at least
> + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> + * cause the adapter to process more than max_nb_rx mbufs.
Also tell it is valid only for INTERNAL PORT capablity is set.
> + */
> + uint32_t rsvd[15];
> + /**< Reserved fields for future use */
Introduce rte_event_eth_rx_adapter_runtime_params_init() to make sure
rsvd is zero.
> +};
> +
> /**
> *
> * Callback function invoked by the SW adapter before it continues
> @@ -377,7 +401,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> * Create a new ethernet Rx event adapter with the specified identifier.
> * This function uses an internal configuration function that creates an event
> * port. This default function reconfigures the event device with an
> - * additional event port and setups up the event port using the port_config
> + * additional event port and setup the event port using the port_config
> * parameter passed into this function. In case the application needs more
> * control in configuration of the service, it should use the
> * rte_event_eth_rx_adapter_create_ext() version.
> @@ -743,6 +767,50 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> uint16_t rx_queue_id,
> uint8_t *rxa_inst_id);
>
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-24 4:29 ` [PATCH v2 1/3] eventdev/eth_rx: " Jerin Jacob
@ 2023-01-24 13:07 ` Naga Harish K, S V
2023-01-25 4:12 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-01-24 13:07 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, January 24, 2023 10:00 AM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan,
> Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > The adapter configuration parameters defined in the ``struct
> > rte_event_eth_rx_adapter_runtime_params`` can be configured and
> > retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
> > ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
>
> > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > index 461eca566f..2207d6ffc3 100644
> > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > @@ -185,6 +185,26 @@ 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``.
> >
> > +Set/Get adapter runtime configuration parameters
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +The runtime configuration parameters of adapter can be set/read using
> > +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> > +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The
> > +parameters that can be set/read are defined in ``struct
> rte_event_eth_rx_adapter_runtime_params``.
>
> Good.
>
> > +
> > +``rte_event_eth_rx_adapter_create()`` or
> > +``rte_event_eth_rx_adapter_create_with_params()`` configures the
> > +adapter with default value for maximum packets processed per request to
> 128.
> > +``rte_event_eth_rx_adapter_runtime_params_set()`` function allows to
> > +reconfigure maximum number of packets processed by adapter per
> > +service request. This is alternative to configuring the maximum
> > +packets processed per request by adapter by using
> > +``rte_event_eth_rx_adapter_create_ext()`` with parameter
> ``rte_event_eth_rx_adapter_conf::max_nb_rx``.
>
> This paragraph is not needed IMO. As it is specific to a driver, and we can keep
> Doxygen comment only.
>
>
> > +
> > +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves
> > +the configuration parameters that are defined in ``struct
> rte_event_eth_rx_adapter_runtime_params``.
>
> Good.
>
> > +
> > Getting and resetting Adapter queue stats
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index 34aa87379e..d8f3e750b7 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -35,6 +35,8 @@
> > #define MAX_VECTOR_NS 1E9
> > #define MIN_VECTOR_NS 1E5
> >
> > +#define RXA_NB_RX_WORK_DEFAULT 128
> > +
> > #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> > #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
> >
> > @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
> > }
> >
> > conf->event_port_id = port_id;
> > - conf->max_nb_rx = 128;
> > + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> > if (started)
> > ret = rte_event_dev_start(dev_id);
> > rx_adapter->default_cb_arg = 1; @@ -3436,6 +3438,90 @@
> > rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> > return -EINVAL;
> > }
>
> > +
> > +int
> > +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> > + struct rte_event_eth_rx_adapter_runtime_params
> > +*params) {
> > + struct event_eth_rx_adapter *rxa;
> > + int ret;
> > +
> > + if (params == NULL)
> > + return -EINVAL;
> > +
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
>
> Introduce an adapter callback and move SW adapter related logic under callback
> handler.
>
>
Do you mean introducing eventdev PMD callback for HW implementation?
There are no adapter callback currently for service based SW Implementation.
> > +
> > + rxa = rxa_id_to_adapter(id);
> > + if (rxa == NULL)
> > + return -EINVAL;
> > +
> > + ret = rxa_caps_check(rxa);
> > + if (ret)
> > + return ret;
> > +
> > + rte_spinlock_lock(&rxa->rx_lock);
> > + rxa->max_nb_rx = params->max_nb_rx;
> > + rte_spinlock_unlock(&rxa->rx_lock);
> > +
> > + return 0;
> > +}
> > +
> > +int
> > +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> > + struct rte_event_eth_rx_adapter_runtime_params
> > +*params) {
> > + struct event_eth_rx_adapter *rxa;
> > + int ret;
> > +
> > + if (params == NULL)
> > + return -EINVAL;
>
>
> Introduce an adapter callback and move SW adapter related logic under callback
> handler.
>
>
Same as above
> > +
> > + if (rxa_memzone_lookup())
> > + return -ENOMEM;
> +
> > + rxa = rxa_id_to_adapter(id);
> > + if (rxa == NULL)
> > + return -EINVAL;
> > +
> > + ret = rxa_caps_check(rxa);
> > + if (ret)
> > + return ret;
> > +
> > + params->max_nb_rx = rxa->max_nb_rx;
> > +
> > + return 0;
> > +}
> > +
> > +/* RX-adapter telemetry callbacks */
> > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s,
> > stats.s)
> >
> > static int
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > index f4652f40e8..214ffd018c 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> > @@ -39,10 +39,21 @@
> > * - rte_event_eth_rx_adapter_queue_stats_reset()
> > * - rte_event_eth_rx_adapter_event_port_get()
> > * - rte_event_eth_rx_adapter_instance_get()
> > + * - rte_event_eth_rx_adapter_runtime_params_get()
> > + * - rte_event_eth_rx_adapter_runtime_params_set()
> > *
> > * The application creates an ethernet to event adapter using
> > * rte_event_eth_rx_adapter_create_ext() or
> rte_event_eth_rx_adapter_create()
> > * or rte_event_eth_rx_adapter_create_with_params() functions.
> > + *
> > + * rte_event_eth_rx_adapter_create() or
> > + rte_event_eth_adapter_create_with_params()
> > + * configures the adapter with default value of maximum packets
> > + processed per
> > + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> > + * rte_event_eth_rx_adapter_runtime_params_set() allows to
> > + re-configure maximum
> > + * packets processed per iteration. This is alternative to using
> > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > + * rte_event_eth_rx_adapter_conf::max_nb_rx
>
> Move this to Doxygen comment against max_nb_rx
>
> > + *
> > * The adapter needs to know which ethernet rx queues to poll for mbufs as
> well
> > * as event device parameters such as the event queue identifier, event
> > * priority and scheduling type that the adapter should use when
> > constructing @@ -299,6 +310,19 @@ struct
> rte_event_eth_rx_adapter_params {
> > /**< flag to indicate that event buffer is separate for each
> > queue */ };
> >
> > +/**
> > + * Adapter configuration parameters
> > + */
> > +struct rte_event_eth_rx_adapter_runtime_params {
> > + uint32_t max_nb_rx;
> > + /**< The adapter can return early if it has processed at least
> > + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> > + * cause the adapter to process more than max_nb_rx mbufs.
>
> Also tell it is valid only for INTERNAL PORT capablity is set.
>
Do you mean, it is valid only for INTERNAL PORT capability is 'not' set?
> > + */
> > + uint32_t rsvd[15];
> > + /**< Reserved fields for future use */
>
> Introduce rte_event_eth_rx_adapter_runtime_params_init() to make sure rsvd is
> zero.
>
The reserved fields are not used by the adapter or application. Not sure Is it necessary to Introduce
a new API to clear reserved fields.
> > +};
> > +
> > /**
> > *
> > * Callback function invoked by the SW adapter before it continues @@
> > -377,7 +401,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id,
> uint8_t dev_id,
> > * Create a new ethernet Rx event adapter with the specified identifier.
> > * This function uses an internal configuration function that creates an event
> > * port. This default function reconfigures the event device with an
> > - * additional event port and setups up the event port using the
> > port_config
> > + * additional event port and setup the event port using the
> > + port_config
> > * parameter passed into this function. In case the application needs more
> > * control in configuration of the service, it should use the
> > * rte_event_eth_rx_adapter_create_ext() version.
> > @@ -743,6 +767,50 @@ rte_event_eth_rx_adapter_instance_get(uint16_t
> eth_dev_id,
> > uint16_t rx_queue_id,
> > uint8_t *rxa_inst_id);
> >
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-24 13:07 ` Naga Harish K, S V
@ 2023-01-25 4:12 ` Jerin Jacob
2023-01-25 9:52 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-01-25 4:12 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Tue, Jan 24, 2023 at 6:37 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Tuesday, January 24, 2023 10:00 AM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan,
> > Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> >
> > On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > > The adapter configuration parameters defined in the ``struct
> > > rte_event_eth_rx_adapter_runtime_params`` can be configured and
> > > retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
> > > ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
> > >
> > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> >
> > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > index 461eca566f..2207d6ffc3 100644
> > > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > @@ -185,6 +185,26 @@ 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``.
> > >
> > > +Set/Get adapter runtime configuration parameters
> > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > +
> > > +The runtime configuration parameters of adapter can be set/read using
> > > +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> > > +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The
> > > +parameters that can be set/read are defined in ``struct
> > rte_event_eth_rx_adapter_runtime_params``.
> >
> > Good.
> >
> > > +
> > > +``rte_event_eth_rx_adapter_create()`` or
> > > +``rte_event_eth_rx_adapter_create_with_params()`` configures the
> > > +adapter with default value for maximum packets processed per request to
> > 128.
> > > +``rte_event_eth_rx_adapter_runtime_params_set()`` function allows to
> > > +reconfigure maximum number of packets processed by adapter per
> > > +service request. This is alternative to configuring the maximum
> > > +packets processed per request by adapter by using
> > > +``rte_event_eth_rx_adapter_create_ext()`` with parameter
> > ``rte_event_eth_rx_adapter_conf::max_nb_rx``.
> >
> > This paragraph is not needed IMO. As it is specific to a driver, and we can keep
> > Doxygen comment only.
> >
> >
> > > +
> > > +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves
> > > +the configuration parameters that are defined in ``struct
> > rte_event_eth_rx_adapter_runtime_params``.
> >
> > Good.
> >
> > > +
> > > Getting and resetting Adapter queue stats
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > index 34aa87379e..d8f3e750b7 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > @@ -35,6 +35,8 @@
> > > #define MAX_VECTOR_NS 1E9
> > > #define MIN_VECTOR_NS 1E5
> > >
> > > +#define RXA_NB_RX_WORK_DEFAULT 128
> > > +
> > > #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> > > #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
> > >
> > > @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
> > > }
> > >
> > > conf->event_port_id = port_id;
> > > - conf->max_nb_rx = 128;
> > > + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> > > if (started)
> > > ret = rte_event_dev_start(dev_id);
> > > rx_adapter->default_cb_arg = 1; @@ -3436,6 +3438,90 @@
> > > rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> > > return -EINVAL;
> > > }
> >
> > > +
> > > +int
> > > +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> > > + struct rte_event_eth_rx_adapter_runtime_params
> > > +*params) {
> > > + struct event_eth_rx_adapter *rxa;
> > > + int ret;
> > > +
> > > + if (params == NULL)
> > > + return -EINVAL;
> > > +
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> >
> > Introduce an adapter callback and move SW adapter related logic under callback
> > handler.
> >
> >
> Do you mean introducing eventdev PMD callback for HW implementation?
Yes.
> There are no adapter callback currently for service based SW Implementation.
>
> > > +
> > > + rxa = rxa_id_to_adapter(id);
> > > + if (rxa == NULL)
> > > + return -EINVAL;
> > > +
> > > + ret = rxa_caps_check(rxa);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + rte_spinlock_lock(&rxa->rx_lock);
> > > + rxa->max_nb_rx = params->max_nb_rx;
> > > + rte_spinlock_unlock(&rxa->rx_lock);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +int
> > > +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> > > + struct rte_event_eth_rx_adapter_runtime_params
> > > +*params) {
> > > + struct event_eth_rx_adapter *rxa;
> > > + int ret;
> > > +
> > > + if (params == NULL)
> > > + return -EINVAL;
> >
> >
> > Introduce an adapter callback and move SW adapter related logic under callback
> > handler.
> >
> >
>
> Same as above
>
> > > +
> > > + if (rxa_memzone_lookup())
> > > + return -ENOMEM;
> > +
> > > + rxa = rxa_id_to_adapter(id);
> > > + if (rxa == NULL)
> > > + return -EINVAL;
> > > +
> > > + ret = rxa_caps_check(rxa);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + params->max_nb_rx = rxa->max_nb_rx;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +/* RX-adapter telemetry callbacks */
> > > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s,
> > > stats.s)
> > >
> > > static int
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > index f4652f40e8..214ffd018c 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > @@ -39,10 +39,21 @@
> > > * - rte_event_eth_rx_adapter_queue_stats_reset()
> > > * - rte_event_eth_rx_adapter_event_port_get()
> > > * - rte_event_eth_rx_adapter_instance_get()
> > > + * - rte_event_eth_rx_adapter_runtime_params_get()
> > > + * - rte_event_eth_rx_adapter_runtime_params_set()
> > > *
> > > * The application creates an ethernet to event adapter using
> > > * rte_event_eth_rx_adapter_create_ext() or
> > rte_event_eth_rx_adapter_create()
> > > * or rte_event_eth_rx_adapter_create_with_params() functions.
> > > + *
> > > + * rte_event_eth_rx_adapter_create() or
> > > + rte_event_eth_adapter_create_with_params()
> > > + * configures the adapter with default value of maximum packets
> > > + processed per
> > > + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> > > + * rte_event_eth_rx_adapter_runtime_params_set() allows to
> > > + re-configure maximum
> > > + * packets processed per iteration. This is alternative to using
> > > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > > + * rte_event_eth_rx_adapter_conf::max_nb_rx
> >
> > Move this to Doxygen comment against max_nb_rx
> >
> > > + *
> > > * The adapter needs to know which ethernet rx queues to poll for mbufs as
> > well
> > > * as event device parameters such as the event queue identifier, event
> > > * priority and scheduling type that the adapter should use when
> > > constructing @@ -299,6 +310,19 @@ struct
> > rte_event_eth_rx_adapter_params {
> > > /**< flag to indicate that event buffer is separate for each
> > > queue */ };
> > >
> > > +/**
> > > + * Adapter configuration parameters
> > > + */
> > > +struct rte_event_eth_rx_adapter_runtime_params {
> > > + uint32_t max_nb_rx;
> > > + /**< The adapter can return early if it has processed at least
> > > + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> > > + * cause the adapter to process more than max_nb_rx mbufs.
> >
> > Also tell it is valid only for INTERNAL PORT capablity is set.
> >
>
> Do you mean, it is valid only for INTERNAL PORT capability is 'not' set?
Yes.
>
> > > + */
> > > + uint32_t rsvd[15];
> > > + /**< Reserved fields for future use */
> >
> > Introduce rte_event_eth_rx_adapter_runtime_params_init() to make sure rsvd is
> > zero.
> >
>
> The reserved fields are not used by the adapter or application. Not sure Is it necessary to Introduce
> a new API to clear reserved fields.
When adapter starts using new fileds(when we add new fieds in future),
the old applicaiton which
is not using rte_event_eth_rx_adapter_runtime_params_init() may have
junk value and then adapter
implementation will behave bad.
>
> > > +};
> > > +
> > > /**
> > > *
> > > * Callback function invoked by the SW adapter before it continues @@
> > > -377,7 +401,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id,
> > uint8_t dev_id,
> > > * Create a new ethernet Rx event adapter with the specified identifier.
> > > * This function uses an internal configuration function that creates an event
> > > * port. This default function reconfigures the event device with an
> > > - * additional event port and setups up the event port using the
> > > port_config
> > > + * additional event port and setup the event port using the
> > > + port_config
> > > * parameter passed into this function. In case the application needs more
> > > * control in configuration of the service, it should use the
> > > * rte_event_eth_rx_adapter_create_ext() version.
> > > @@ -743,6 +767,50 @@ rte_event_eth_rx_adapter_instance_get(uint16_t
> > eth_dev_id,
> > > uint16_t rx_queue_id,
> > > uint8_t *rxa_inst_id);
> > >
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-25 4:12 ` Jerin Jacob
@ 2023-01-25 9:52 ` Naga Harish K, S V
2023-01-25 10:38 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-01-25 9:52 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, January 25, 2023 9:42 AM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Tue, Jan 24, 2023 at 6:37 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Tuesday, January 24, 2023 10:00 AM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > >
> > > On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > > The adapter configuration parameters defined in the ``struct
> > > > rte_event_eth_rx_adapter_runtime_params`` can be configured and
> > > > retrieved using ``rte_event_eth_rx_adapter_runtime_params_set``
> > > > and ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
> > > >
> > > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > >
> > > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > index 461eca566f..2207d6ffc3 100644
> > > > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > @@ -185,6 +185,26 @@ 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``.
> > > >
> > > > +Set/Get adapter runtime configuration parameters
> > > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > +
> > > > +The runtime configuration parameters of adapter can be set/read
> > > > +using ``rte_event_eth_rx_adapter_runtime_params_set()`` and
> > > > +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively.
> > > > +The parameters that can be set/read are defined in ``struct
> > > rte_event_eth_rx_adapter_runtime_params``.
> > >
> > > Good.
> > >
> > > > +
> > > > +``rte_event_eth_rx_adapter_create()`` or
> > > > +``rte_event_eth_rx_adapter_create_with_params()`` configures the
> > > > +adapter with default value for maximum packets processed per
> > > > +request to
> > > 128.
> > > > +``rte_event_eth_rx_adapter_runtime_params_set()`` function allows
> > > > +to reconfigure maximum number of packets processed by adapter per
> > > > +service request. This is alternative to configuring the maximum
> > > > +packets processed per request by adapter by using
> > > > +``rte_event_eth_rx_adapter_create_ext()`` with parameter
> > > ``rte_event_eth_rx_adapter_conf::max_nb_rx``.
> > >
> > > This paragraph is not needed IMO. As it is specific to a driver, and
> > > we can keep Doxygen comment only.
> > >
> > >
> > > > +
> > > > +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function
> > > > +retrieves the configuration parameters that are defined in
> > > > +``struct
> > > rte_event_eth_rx_adapter_runtime_params``.
> > >
> > > Good.
> > >
> > > > +
> > > > Getting and resetting Adapter queue stats
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > index 34aa87379e..d8f3e750b7 100644
> > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > @@ -35,6 +35,8 @@
> > > > #define MAX_VECTOR_NS 1E9
> > > > #define MIN_VECTOR_NS 1E5
> > > >
> > > > +#define RXA_NB_RX_WORK_DEFAULT 128
> > > > +
> > > > #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> > > > #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
> > > >
> > > > @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t
> dev_id,
> > > > }
> > > >
> > > > conf->event_port_id = port_id;
> > > > - conf->max_nb_rx = 128;
> > > > + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> > > > if (started)
> > > > ret = rte_event_dev_start(dev_id);
> > > > rx_adapter->default_cb_arg = 1; @@ -3436,6 +3438,90 @@
> > > > rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> > > > return -EINVAL;
> > > > }
> > >
> > > > +
> > > > +int
> > > > +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > +*params) {
> > > > + struct event_eth_rx_adapter *rxa;
> > > > + int ret;
> > > > +
> > > > + if (params == NULL)
> > > > + return -EINVAL;
> > > > +
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > >
> > > Introduce an adapter callback and move SW adapter related logic
> > > under callback handler.
> > >
> > >
> > Do you mean introducing eventdev PMD callback for HW implementation?
>
> Yes.
>
Can this be taken care as and when the HW implementation is required?
> > There are no adapter callback currently for service based SW
> Implementation.
> >
> > > > +
> > > > + rxa = rxa_id_to_adapter(id);
> > > > + if (rxa == NULL)
> > > > + return -EINVAL;
> > > > +
> > > > + ret = rxa_caps_check(rxa);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > > > + rte_spinlock_lock(&rxa->rx_lock);
> > > > + rxa->max_nb_rx = params->max_nb_rx;
> > > > + rte_spinlock_unlock(&rxa->rx_lock);
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > +*params) {
> > > > + struct event_eth_rx_adapter *rxa;
> > > > + int ret;
> > > > +
> > > > + if (params == NULL)
> > > > + return -EINVAL;
> > >
> > >
> > > Introduce an adapter callback and move SW adapter related logic
> > > under callback handler.
> > >
> > >
> >
> > Same as above
> >
> > > > +
> > > > + if (rxa_memzone_lookup())
> > > > + return -ENOMEM;
> > > +
> > > > + rxa = rxa_id_to_adapter(id);
> > > > + if (rxa == NULL)
> > > > + return -EINVAL;
> > > > +
> > > > + ret = rxa_caps_check(rxa);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > > > + params->max_nb_rx = rxa->max_nb_rx;
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > +/* RX-adapter telemetry callbacks */
> > > > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s,
> > > > stats.s)
> > > >
> > > > static int
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > index f4652f40e8..214ffd018c 100644
> > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > @@ -39,10 +39,21 @@
> > > > * - rte_event_eth_rx_adapter_queue_stats_reset()
> > > > * - rte_event_eth_rx_adapter_event_port_get()
> > > > * - rte_event_eth_rx_adapter_instance_get()
> > > > + * - rte_event_eth_rx_adapter_runtime_params_get()
> > > > + * - rte_event_eth_rx_adapter_runtime_params_set()
> > > > *
> > > > * The application creates an ethernet to event adapter using
> > > > * rte_event_eth_rx_adapter_create_ext() or
> > > rte_event_eth_rx_adapter_create()
> > > > * or rte_event_eth_rx_adapter_create_with_params() functions.
> > > > + *
> > > > + * rte_event_eth_rx_adapter_create() or
> > > > + rte_event_eth_adapter_create_with_params()
> > > > + * configures the adapter with default value of maximum packets
> > > > + processed per
> > > > + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> > > > + * rte_event_eth_rx_adapter_runtime_params_set() allows to
> > > > + re-configure maximum
> > > > + * packets processed per iteration. This is alternative to using
> > > > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > > > + * rte_event_eth_rx_adapter_conf::max_nb_rx
> > >
> > > Move this to Doxygen comment against max_nb_rx
> > >
> > > > + *
> > > > * The adapter needs to know which ethernet rx queues to poll for
> > > > mbufs as
> > > well
> > > > * as event device parameters such as the event queue identifier,
> event
> > > > * priority and scheduling type that the adapter should use when
> > > > constructing @@ -299,6 +310,19 @@ struct
> > > rte_event_eth_rx_adapter_params {
> > > > /**< flag to indicate that event buffer is separate for
> > > > each queue */ };
> > > >
> > > > +/**
> > > > + * Adapter configuration parameters */ struct
> > > > +rte_event_eth_rx_adapter_runtime_params {
> > > > + uint32_t max_nb_rx;
> > > > + /**< The adapter can return early if it has processed at least
> > > > + * max_nb_rx mbufs. This isn't treated as a requirement; batching
> may
> > > > + * cause the adapter to process more than max_nb_rx mbufs.
> > >
> > > Also tell it is valid only for INTERNAL PORT capablity is set.
> > >
> >
> > Do you mean, it is valid only for INTERNAL PORT capability is 'not' set?
>
> Yes.
>
> >
> > > > + */
> > > > + uint32_t rsvd[15];
> > > > + /**< Reserved fields for future use */
> > >
> > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to make
> > > sure rsvd is zero.
> > >
> >
> > The reserved fields are not used by the adapter or application. Not
> > sure Is it necessary to Introduce a new API to clear reserved fields.
>
> When adapter starts using new fileds(when we add new fieds in future), the
> old applicaiton which is not using
> rte_event_eth_rx_adapter_runtime_params_init() may have junk value and
> then adapter implementation will behave bad.
>
>
does it mean, the application doesn't re-compile for the new DPDK?
When some of the reserved fields are used in the future, the application also may need to be recompiled along with DPDK right?
As the application also may need to use the newly consumed reserved fields?
> >
> > > > +};
> > > > +
> > > > /**
> > > > *
> > > > * Callback function invoked by the SW adapter before it
> > > > continues @@
> > > > -377,7 +401,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t
> > > > id,
> > > uint8_t dev_id,
> > > > * Create a new ethernet Rx event adapter with the specified
> identifier.
> > > > * This function uses an internal configuration function that creates an
> event
> > > > * port. This default function reconfigures the event device with
> > > > an
> > > > - * additional event port and setups up the event port using the
> > > > port_config
> > > > + * additional event port and setup the event port using the
> > > > + port_config
> > > > * parameter passed into this function. In case the application needs
> more
> > > > * control in configuration of the service, it should use the
> > > > * rte_event_eth_rx_adapter_create_ext() version.
> > > > @@ -743,6 +767,50 @@
> > > > rte_event_eth_rx_adapter_instance_get(uint16_t
> > > eth_dev_id,
> > > > uint16_t rx_queue_id,
> > > > uint8_t *rxa_inst_id);
> > > >
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-25 9:52 ` Naga Harish K, S V
@ 2023-01-25 10:38 ` Jerin Jacob
2023-01-25 16:32 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-01-25 10:38 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Wed, Jan 25, 2023 at 3:22 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Wednesday, January 25, 2023 9:42 AM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> > Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> >
> > On Tue, Jan 24, 2023 at 6:37 PM Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > > Hi Jerin,
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: Tuesday, January 24, 2023 10:00 AM
> > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > <jay.jayatheerthan@intel.com>
> > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > > >
> > > > On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
> > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > >
> > > > > The adapter configuration parameters defined in the ``struct
> > > > > rte_event_eth_rx_adapter_runtime_params`` can be configured and
> > > > > retrieved using ``rte_event_eth_rx_adapter_runtime_params_set``
> > > > > and ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
> > > > >
> > > > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > > >
> > > > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > index 461eca566f..2207d6ffc3 100644
> > > > > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > @@ -185,6 +185,26 @@ 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``.
> > > > >
> > > > > +Set/Get adapter runtime configuration parameters
> > > > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > +
> > > > > +The runtime configuration parameters of adapter can be set/read
> > > > > +using ``rte_event_eth_rx_adapter_runtime_params_set()`` and
> > > > > +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively.
> > > > > +The parameters that can be set/read are defined in ``struct
> > > > rte_event_eth_rx_adapter_runtime_params``.
> > > >
> > > > Good.
> > > >
> > > > > +
> > > > > +``rte_event_eth_rx_adapter_create()`` or
> > > > > +``rte_event_eth_rx_adapter_create_with_params()`` configures the
> > > > > +adapter with default value for maximum packets processed per
> > > > > +request to
> > > > 128.
> > > > > +``rte_event_eth_rx_adapter_runtime_params_set()`` function allows
> > > > > +to reconfigure maximum number of packets processed by adapter per
> > > > > +service request. This is alternative to configuring the maximum
> > > > > +packets processed per request by adapter by using
> > > > > +``rte_event_eth_rx_adapter_create_ext()`` with parameter
> > > > ``rte_event_eth_rx_adapter_conf::max_nb_rx``.
> > > >
> > > > This paragraph is not needed IMO. As it is specific to a driver, and
> > > > we can keep Doxygen comment only.
> > > >
> > > >
> > > > > +
> > > > > +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function
> > > > > +retrieves the configuration parameters that are defined in
> > > > > +``struct
> > > > rte_event_eth_rx_adapter_runtime_params``.
> > > >
> > > > Good.
> > > >
> > > > > +
> > > > > Getting and resetting Adapter queue stats
> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > >
> > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > index 34aa87379e..d8f3e750b7 100644
> > > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > @@ -35,6 +35,8 @@
> > > > > #define MAX_VECTOR_NS 1E9
> > > > > #define MIN_VECTOR_NS 1E5
> > > > >
> > > > > +#define RXA_NB_RX_WORK_DEFAULT 128
> > > > > +
> > > > > #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> > > > > #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
> > > > >
> > > > > @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t
> > dev_id,
> > > > > }
> > > > >
> > > > > conf->event_port_id = port_id;
> > > > > - conf->max_nb_rx = 128;
> > > > > + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> > > > > if (started)
> > > > > ret = rte_event_dev_start(dev_id);
> > > > > rx_adapter->default_cb_arg = 1; @@ -3436,6 +3438,90 @@
> > > > > rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> > > > > return -EINVAL;
> > > > > }
> > > >
> > > > > +
> > > > > +int
> > > > > +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> > > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > > +*params) {
> > > > > + struct event_eth_rx_adapter *rxa;
> > > > > + int ret;
> > > > > +
> > > > > + if (params == NULL)
> > > > > + return -EINVAL;
> > > > > +
> > > > > + if (rxa_memzone_lookup())
> > > > > + return -ENOMEM;
> > > >
> > > > Introduce an adapter callback and move SW adapter related logic
> > > > under callback handler.
> > > >
> > > >
> > > Do you mean introducing eventdev PMD callback for HW implementation?
> >
> > Yes.
> >
>
> Can this be taken care as and when the HW implementation is required?
OK. As long as when case INTERNAL PORT it return -ENOSUP now.
>
> > > There are no adapter callback currently for service based SW
> > Implementation.
> > >
> > > > > +
> > > > > + rxa = rxa_id_to_adapter(id);
> > > > > + if (rxa == NULL)
> > > > > + return -EINVAL;
> > > > > +
> > > > > + ret = rxa_caps_check(rxa);
> > > > > + if (ret)
> > > > > + return ret;
> > > > > +
> > > > > + rte_spinlock_lock(&rxa->rx_lock);
> > > > > + rxa->max_nb_rx = params->max_nb_rx;
> > > > > + rte_spinlock_unlock(&rxa->rx_lock);
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +int
> > > > > +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> > > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > > +*params) {
> > > > > + struct event_eth_rx_adapter *rxa;
> > > > > + int ret;
> > > > > +
> > > > > + if (params == NULL)
> > > > > + return -EINVAL;
> > > >
> > > >
> > > > Introduce an adapter callback and move SW adapter related logic
> > > > under callback handler.
> > > >
> > > >
> > >
> > > Same as above
> > >
> > > > > +
> > > > > + if (rxa_memzone_lookup())
> > > > > + return -ENOMEM;
> > > > +
> > > > > + rxa = rxa_id_to_adapter(id);
> > > > > + if (rxa == NULL)
> > > > > + return -EINVAL;
> > > > > +
> > > > > + ret = rxa_caps_check(rxa);
> > > > > + if (ret)
> > > > > + return ret;
> > > > > +
> > > > > + params->max_nb_rx = rxa->max_nb_rx;
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +/* RX-adapter telemetry callbacks */
> > > > > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s,
> > > > > stats.s)
> > > > >
> > > > > static int
> > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > index f4652f40e8..214ffd018c 100644
> > > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > @@ -39,10 +39,21 @@
> > > > > * - rte_event_eth_rx_adapter_queue_stats_reset()
> > > > > * - rte_event_eth_rx_adapter_event_port_get()
> > > > > * - rte_event_eth_rx_adapter_instance_get()
> > > > > + * - rte_event_eth_rx_adapter_runtime_params_get()
> > > > > + * - rte_event_eth_rx_adapter_runtime_params_set()
> > > > > *
> > > > > * The application creates an ethernet to event adapter using
> > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > rte_event_eth_rx_adapter_create()
> > > > > * or rte_event_eth_rx_adapter_create_with_params() functions.
> > > > > + *
> > > > > + * rte_event_eth_rx_adapter_create() or
> > > > > + rte_event_eth_adapter_create_with_params()
> > > > > + * configures the adapter with default value of maximum packets
> > > > > + processed per
> > > > > + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> > > > > + * rte_event_eth_rx_adapter_runtime_params_set() allows to
> > > > > + re-configure maximum
> > > > > + * packets processed per iteration. This is alternative to using
> > > > > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > > > > + * rte_event_eth_rx_adapter_conf::max_nb_rx
> > > >
> > > > Move this to Doxygen comment against max_nb_rx
> > > >
> > > > > + *
> > > > > * The adapter needs to know which ethernet rx queues to poll for
> > > > > mbufs as
> > > > well
> > > > > * as event device parameters such as the event queue identifier,
> > event
> > > > > * priority and scheduling type that the adapter should use when
> > > > > constructing @@ -299,6 +310,19 @@ struct
> > > > rte_event_eth_rx_adapter_params {
> > > > > /**< flag to indicate that event buffer is separate for
> > > > > each queue */ };
> > > > >
> > > > > +/**
> > > > > + * Adapter configuration parameters */ struct
> > > > > +rte_event_eth_rx_adapter_runtime_params {
> > > > > + uint32_t max_nb_rx;
> > > > > + /**< The adapter can return early if it has processed at least
> > > > > + * max_nb_rx mbufs. This isn't treated as a requirement; batching
> > may
> > > > > + * cause the adapter to process more than max_nb_rx mbufs.
> > > >
> > > > Also tell it is valid only for INTERNAL PORT capablity is set.
> > > >
> > >
> > > Do you mean, it is valid only for INTERNAL PORT capability is 'not' set?
> >
> > Yes.
> >
> > >
> > > > > + */
> > > > > + uint32_t rsvd[15];
> > > > > + /**< Reserved fields for future use */
> > > >
> > > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to make
> > > > sure rsvd is zero.
> > > >
> > >
> > > The reserved fields are not used by the adapter or application. Not
> > > sure Is it necessary to Introduce a new API to clear reserved fields.
> >
> > When adapter starts using new fileds(when we add new fieds in future), the
> > old applicaiton which is not using
> > rte_event_eth_rx_adapter_runtime_params_init() may have junk value and
> > then adapter implementation will behave bad.
> >
> >
>
> does it mean, the application doesn't re-compile for the new DPDK?
Yes. No need recompile if ABI not breaking.
> When some of the reserved fields are used in the future, the application also may need to be recompiled along with DPDK right?
> As the application also may need to use the newly consumed reserved fields?
The problematic case is:
Adapter implementation of 23.07(Assuming there is change params) field
needs to work with application of 23.03.
rte_event_eth_rx_adapter_runtime_params_init() will sove that.
>
> > >
> > > > > +};
> > > > > +
> > > > > /**
> > > > > *
> > > > > * Callback function invoked by the SW adapter before it
> > > > > continues @@
> > > > > -377,7 +401,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t
> > > > > id,
> > > > uint8_t dev_id,
> > > > > * Create a new ethernet Rx event adapter with the specified
> > identifier.
> > > > > * This function uses an internal configuration function that creates an
> > event
> > > > > * port. This default function reconfigures the event device with
> > > > > an
> > > > > - * additional event port and setups up the event port using the
> > > > > port_config
> > > > > + * additional event port and setup the event port using the
> > > > > + port_config
> > > > > * parameter passed into this function. In case the application needs
> > more
> > > > > * control in configuration of the service, it should use the
> > > > > * rte_event_eth_rx_adapter_create_ext() version.
> > > > > @@ -743,6 +767,50 @@
> > > > > rte_event_eth_rx_adapter_instance_get(uint16_t
> > > > eth_dev_id,
> > > > > uint16_t rx_queue_id,
> > > > > uint8_t *rxa_inst_id);
> > > > >
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-25 10:38 ` Jerin Jacob
@ 2023-01-25 16:32 ` Naga Harish K, S V
2023-01-28 10:53 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-01-25 16:32 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, January 25, 2023 4:08 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Wed, Jan 25, 2023 at 3:22 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Wednesday, January 25, 2023 9:42 AM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > >
> > > On Tue, Jan 24, 2023 at 6:37 PM Naga Harish K, S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > > Hi Jerin,
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: Tuesday, January 24, 2023 10:00 AM
> > > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > > <jay.jayatheerthan@intel.com>
> > > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get
> > > > > APIs
> > > > >
> > > > > On Mon, Jan 23, 2023 at 11:35 PM Naga Harish K S V
> > > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > > >
> > > > > > The adapter configuration parameters defined in the ``struct
> > > > > > rte_event_eth_rx_adapter_runtime_params`` can be configured
> > > > > > and retrieved using
> > > > > > ``rte_event_eth_rx_adapter_runtime_params_set``
> > > > > > and ``rte_event_eth_tx_adapter_runtime_params_get``
> respectively.
> > > > > >
> > > > > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > > > >
> > > > > > diff --git
> > > > > > a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > > b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > > index 461eca566f..2207d6ffc3 100644
> > > > > > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
> > > > > > @@ -185,6 +185,26 @@ 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``.
> > > > > >
> > > > > > +Set/Get adapter runtime configuration parameters
> > > > > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > +
> > > > > > +The runtime configuration parameters of adapter can be
> > > > > > +set/read using
> > > > > > +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> ``rte_event_eth_rx_adapter_runtime_params_get()`` respectively.
> > > > > > +The parameters that can be set/read are defined in ``struct
> > > > > rte_event_eth_rx_adapter_runtime_params``.
> > > > >
> > > > > Good.
> > > > >
> > > > > > +
> > > > > > +``rte_event_eth_rx_adapter_create()`` or
> > > > > > +``rte_event_eth_rx_adapter_create_with_params()`` configures
> > > > > > +the adapter with default value for maximum packets processed
> > > > > > +per request to
> > > > > 128.
> > > > > > +``rte_event_eth_rx_adapter_runtime_params_set()`` function
> > > > > > +allows to reconfigure maximum number of packets processed by
> > > > > > +adapter per service request. This is alternative to
> > > > > > +configuring the maximum packets processed per request by
> > > > > > +adapter by using ``rte_event_eth_rx_adapter_create_ext()``
> > > > > > +with parameter
> > > > > ``rte_event_eth_rx_adapter_conf::max_nb_rx``.
> > > > >
> > > > > This paragraph is not needed IMO. As it is specific to a driver,
> > > > > and we can keep Doxygen comment only.
> > > > >
> > > > >
> > > > > > +
> > > > > > +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function
> > > > > > +retrieves the configuration parameters that are defined in
> > > > > > +``struct
> > > > > rte_event_eth_rx_adapter_runtime_params``.
> > > > >
> > > > > Good.
> > > > >
> > > > > > +
> > > > > > Getting and resetting Adapter queue stats
> > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > >
> > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > > index 34aa87379e..d8f3e750b7 100644
> > > > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > > > @@ -35,6 +35,8 @@
> > > > > > #define MAX_VECTOR_NS 1E9
> > > > > > #define MIN_VECTOR_NS 1E5
> > > > > >
> > > > > > +#define RXA_NB_RX_WORK_DEFAULT 128
> > > > > > +
> > > > > > #define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
> > > > > > #define ETH_RX_ADAPTER_MEM_NAME_LEN 32
> > > > > >
> > > > > > @@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t
> > > dev_id,
> > > > > > }
> > > > > >
> > > > > > conf->event_port_id = port_id;
> > > > > > - conf->max_nb_rx = 128;
> > > > > > + conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> > > > > > if (started)
> > > > > > ret = rte_event_dev_start(dev_id);
> > > > > > rx_adapter->default_cb_arg = 1; @@ -3436,6 +3438,90 @@
> > > > > > rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> > > > > > return -EINVAL;
> > > > > > }
> > > > >
> > > > > > +
> > > > > > +int
> > > > > > +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> > > > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > > > +*params) {
> > > > > > + struct event_eth_rx_adapter *rxa;
> > > > > > + int ret;
> > > > > > +
> > > > > > + if (params == NULL)
> > > > > > + return -EINVAL;
> > > > > > +
> > > > > > + if (rxa_memzone_lookup())
> > > > > > + return -ENOMEM;
> > > > >
> > > > > Introduce an adapter callback and move SW adapter related logic
> > > > > under callback handler.
> > > > >
> > > > >
> > > > Do you mean introducing eventdev PMD callback for HW
> implementation?
> > >
> > > Yes.
> > >
> >
> > Can this be taken care as and when the HW implementation is required?
>
> OK. As long as when case INTERNAL PORT it return -ENOSUP now.
>
> >
> > > > There are no adapter callback currently for service based SW
> > > Implementation.
> > > >
> > > > > > +
> > > > > > + rxa = rxa_id_to_adapter(id);
> > > > > > + if (rxa == NULL)
> > > > > > + return -EINVAL;
> > > > > > +
> > > > > > + ret = rxa_caps_check(rxa);
> > > > > > + if (ret)
> > > > > > + return ret;
> > > > > > +
> > > > > > + rte_spinlock_lock(&rxa->rx_lock);
> > > > > > + rxa->max_nb_rx = params->max_nb_rx;
> > > > > > + rte_spinlock_unlock(&rxa->rx_lock);
> > > > > > +
> > > > > > + return 0;
> > > > > > +}
> > > > > > +
> > > > > > +int
> > > > > > +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> > > > > > + struct rte_event_eth_rx_adapter_runtime_params
> > > > > > +*params) {
> > > > > > + struct event_eth_rx_adapter *rxa;
> > > > > > + int ret;
> > > > > > +
> > > > > > + if (params == NULL)
> > > > > > + return -EINVAL;
> > > > >
> > > > >
> > > > > Introduce an adapter callback and move SW adapter related logic
> > > > > under callback handler.
> > > > >
> > > > >
> > > >
> > > > Same as above
> > > >
> > > > > > +
> > > > > > + if (rxa_memzone_lookup())
> > > > > > + return -ENOMEM;
> > > > > +
> > > > > > + rxa = rxa_id_to_adapter(id);
> > > > > > + if (rxa == NULL)
> > > > > > + return -EINVAL;
> > > > > > +
> > > > > > + ret = rxa_caps_check(rxa);
> > > > > > + if (ret)
> > > > > > + return ret;
> > > > > > +
> > > > > > + params->max_nb_rx = rxa->max_nb_rx;
> > > > > > +
> > > > > > + return 0;
> > > > > > +}
> > > > > > +
> > > > > > +/* RX-adapter telemetry callbacks */
> > > > > > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d,
> > > > > > #s,
> > > > > > stats.s)
> > > > > >
> > > > > > static int
> > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > index f4652f40e8..214ffd018c 100644
> > > > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> > > > > > @@ -39,10 +39,21 @@
> > > > > > * - rte_event_eth_rx_adapter_queue_stats_reset()
> > > > > > * - rte_event_eth_rx_adapter_event_port_get()
> > > > > > * - rte_event_eth_rx_adapter_instance_get()
> > > > > > + * - rte_event_eth_rx_adapter_runtime_params_get()
> > > > > > + * - rte_event_eth_rx_adapter_runtime_params_set()
> > > > > > *
> > > > > > * The application creates an ethernet to event adapter using
> > > > > > * rte_event_eth_rx_adapter_create_ext() or
> > > > > rte_event_eth_rx_adapter_create()
> > > > > > * or rte_event_eth_rx_adapter_create_with_params() functions.
> > > > > > + *
> > > > > > + * rte_event_eth_rx_adapter_create() or
> > > > > > + rte_event_eth_adapter_create_with_params()
> > > > > > + * configures the adapter with default value of maximum
> > > > > > + packets processed per
> > > > > > + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> > > > > > + * rte_event_eth_rx_adapter_runtime_params_set() allows to
> > > > > > + re-configure maximum
> > > > > > + * packets processed per iteration. This is alternative to
> > > > > > + using
> > > > > > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > > > > > + * rte_event_eth_rx_adapter_conf::max_nb_rx
> > > > >
> > > > > Move this to Doxygen comment against max_nb_rx
> > > > >
> > > > > > + *
> > > > > > * The adapter needs to know which ethernet rx queues to poll
> > > > > > for mbufs as
> > > > > well
> > > > > > * as event device parameters such as the event queue
> > > > > > identifier,
> > > event
> > > > > > * priority and scheduling type that the adapter should use
> > > > > > when constructing @@ -299,6 +310,19 @@ struct
> > > > > rte_event_eth_rx_adapter_params {
> > > > > > /**< flag to indicate that event buffer is separate
> > > > > > for each queue */ };
> > > > > >
> > > > > > +/**
> > > > > > + * Adapter configuration parameters */ struct
> > > > > > +rte_event_eth_rx_adapter_runtime_params {
> > > > > > + uint32_t max_nb_rx;
> > > > > > + /**< The adapter can return early if it has processed at least
> > > > > > + * max_nb_rx mbufs. This isn't treated as a
> > > > > > +requirement; batching
> > > may
> > > > > > + * cause the adapter to process more than max_nb_rx mbufs.
> > > > >
> > > > > Also tell it is valid only for INTERNAL PORT capablity is set.
> > > > >
> > > >
> > > > Do you mean, it is valid only for INTERNAL PORT capability is 'not' set?
> > >
> > > Yes.
> > >
> > > >
> > > > > > + */
> > > > > > + uint32_t rsvd[15];
> > > > > > + /**< Reserved fields for future use */
> > > > >
> > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to
> make
> > > > > sure rsvd is zero.
> > > > >
> > > >
> > > > The reserved fields are not used by the adapter or application.
> > > > Not sure Is it necessary to Introduce a new API to clear reserved fields.
> > >
> > > When adapter starts using new fileds(when we add new fieds in
> > > future), the old applicaiton which is not using
> > > rte_event_eth_rx_adapter_runtime_params_init() may have junk value
> > > and then adapter implementation will behave bad.
> > >
> > >
> >
> > does it mean, the application doesn't re-compile for the new DPDK?
>
> Yes. No need recompile if ABI not breaking.
>
> > When some of the reserved fields are used in the future, the application
> also may need to be recompiled along with DPDK right?
> > As the application also may need to use the newly consumed reserved
> fields?
>
> The problematic case is:
>
> Adapter implementation of 23.07(Assuming there is change params) field
> needs to work with application of 23.03.
> rte_event_eth_rx_adapter_runtime_params_init() will sove that.
>
As rte_event_eth_rx_adapter_runtime_params_init() initializes only reserved fields to zero, it may not solve the issue in this case.
The old application only tries to set/get previous valid fields and the newly used fields may still contain junk value.
If the application wants to make use of any the newly used params, the application changes are required anyway.
> >
> > > >
> > > > > > +};
> > > > > > +
> > > > > > /**
> > > > > > *
> > > > > > * Callback function invoked by the SW adapter before it
> > > > > > continues @@
> > > > > > -377,7 +401,7 @@ int
> > > > > > rte_event_eth_rx_adapter_create_ext(uint8_t
> > > > > > id,
> > > > > uint8_t dev_id,
> > > > > > * Create a new ethernet Rx event adapter with the specified
> > > identifier.
> > > > > > * This function uses an internal configuration function that
> > > > > > creates an
> > > event
> > > > > > * port. This default function reconfigures the event device
> > > > > > with an
> > > > > > - * additional event port and setups up the event port using
> > > > > > the port_config
> > > > > > + * additional event port and setup the event port using the
> > > > > > + port_config
> > > > > > * parameter passed into this function. In case the
> > > > > > application needs
> > > more
> > > > > > * control in configuration of the service, it should use the
> > > > > > * rte_event_eth_rx_adapter_create_ext() version.
> > > > > > @@ -743,6 +767,50 @@
> > > > > > rte_event_eth_rx_adapter_instance_get(uint16_t
> > > > > eth_dev_id,
> > > > > > uint16_t rx_queue_id,
> > > > > > uint8_t *rxa_inst_id);
> > > > > >
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-25 16:32 ` Naga Harish K, S V
@ 2023-01-28 10:53 ` Jerin Jacob
2023-01-28 17:21 ` Stephen Hemminger
2023-01-30 9:56 ` Naga Harish K, S V
0 siblings, 2 replies; 53+ messages in thread
From: Jerin Jacob @ 2023-01-28 10:53 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > >
> > > > > > > + */
> > > > > > > + uint32_t rsvd[15];
> > > > > > > + /**< Reserved fields for future use */
> > > > > >
> > > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to
> > make
> > > > > > sure rsvd is zero.
> > > > > >
> > > > >
> > > > > The reserved fields are not used by the adapter or application.
> > > > > Not sure Is it necessary to Introduce a new API to clear reserved fields.
> > > >
> > > > When adapter starts using new fileds(when we add new fieds in
> > > > future), the old applicaiton which is not using
> > > > rte_event_eth_rx_adapter_runtime_params_init() may have junk value
> > > > and then adapter implementation will behave bad.
> > > >
> > > >
> > >
> > > does it mean, the application doesn't re-compile for the new DPDK?
> >
> > Yes. No need recompile if ABI not breaking.
> >
> > > When some of the reserved fields are used in the future, the application
> > also may need to be recompiled along with DPDK right?
> > > As the application also may need to use the newly consumed reserved
> > fields?
> >
> > The problematic case is:
> >
> > Adapter implementation of 23.07(Assuming there is change params) field
> > needs to work with application of 23.03.
> > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> >
>
> As rte_event_eth_rx_adapter_runtime_params_init() initializes only reserved fields to zero, it may not solve the issue in this case.
rte_event_eth_rx_adapter_runtime_params_init() needs to zero all
fields, not just reserved field.
The application calling sequence is
struct my_config c;
rte_event_eth_rx_adapter_runtime_params_init(&c)
c.interseted_filed_to_be_updated = val;
Let me share an example and you can tell where is the issue
1)Assume parameter structure is 64B and for 22.03 8B are used.
2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
3)There is an application written based on 22.03 which using only 8B
after calling rte_event_eth_rx_adapter_runtime_params_init()
4)Assume, in 22.07 another 8B added to structure.
5)Now, the application (3) needs to run on 22.07. Since the
application is calling rte_event_eth_rx_adapter_runtime_params_init()
and 9 to 15B are zero, the implementation will not go bad.
> The old application only tries to set/get previous valid fields and the newly used fields may still contain junk value.
> If the application wants to make use of any the newly used params, the application changes are required anyway.
Yes. If application wants to make use of newly added features. No need
to change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-28 10:53 ` Jerin Jacob
@ 2023-01-28 17:21 ` Stephen Hemminger
2023-01-30 9:56 ` Naga Harish K, S V
1 sibling, 0 replies; 53+ messages in thread
From: Stephen Hemminger @ 2023-01-28 17:21 UTC (permalink / raw)
To: Jerin Jacob
Cc: Naga Harish K, S V, jerinj, Carrillo, Erik G, Gujjar,
Abhinandan S, dev, Jayatheerthan, Jay
On Sat, 28 Jan 2023 16:23:45 +0530
Jerin Jacob <jerinjacobk@gmail.com> wrote:
> > >
> > > Yes. No need recompile if ABI not breaking.
> > >
> > > > When some of the reserved fields are used in the future, the application
> > > also may need to be recompiled along with DPDK right?
> > > > As the application also may need to use the newly consumed reserved
> > > fields?
> > >
> > > The problematic case is:
> > >
> > > Adapter implementation of 23.07(Assuming there is change params) field
> > > needs to work with application of 23.03.
> > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > >
> >
First off, reserved fields are a problematic design choice IMHO (see YAGNI).
Second. any reserved fields can not be used in future unless the
original code enforced that all reserved fields are zero.
Same is true for holes in structs which some times get reused.
You can't use a reserved field without breaking ABI unless the previous
code enforced that the field must be zero.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-28 10:53 ` Jerin Jacob
2023-01-28 17:21 ` Stephen Hemminger
@ 2023-01-30 9:56 ` Naga Harish K, S V
2023-01-30 14:43 ` Jerin Jacob
1 sibling, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-01-30 9:56 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Saturday, January 28, 2023 4:24 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
>
> > > > > >
> > > > > > > > + */
> > > > > > > > + uint32_t rsvd[15];
> > > > > > > > + /**< Reserved fields for future use */
> > > > > > >
> > > > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to
> > > make
> > > > > > > sure rsvd is zero.
> > > > > > >
> > > > > >
> > > > > > The reserved fields are not used by the adapter or application.
> > > > > > Not sure Is it necessary to Introduce a new API to clear reserved
> fields.
> > > > >
> > > > > When adapter starts using new fileds(when we add new fieds in
> > > > > future), the old applicaiton which is not using
> > > > > rte_event_eth_rx_adapter_runtime_params_init() may have junk
> > > > > value and then adapter implementation will behave bad.
> > > > >
> > > > >
> > > >
> > > > does it mean, the application doesn't re-compile for the new DPDK?
> > >
> > > Yes. No need recompile if ABI not breaking.
> > >
> > > > When some of the reserved fields are used in the future, the
> > > > application
> > > also may need to be recompiled along with DPDK right?
> > > > As the application also may need to use the newly consumed
> > > > reserved
> > > fields?
> > >
> > > The problematic case is:
> > >
> > > Adapter implementation of 23.07(Assuming there is change params)
> > > field needs to work with application of 23.03.
> > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > >
> >
> > As rte_event_eth_rx_adapter_runtime_params_init() initializes only
> reserved fields to zero, it may not solve the issue in this case.
>
> rte_event_eth_rx_adapter_runtime_params_init() needs to zero all fields,
> not just reserved field.
> The application calling sequence is
>
> struct my_config c;
> rte_event_eth_rx_adapter_runtime_params_init(&c)
> c.interseted_filed_to_be_updated = val;
>
Can it be done like
struct my_config c = {0};
c.interseted_filed_to_be_updated = val;
and update Doxygen comments to recommend above usage to reset all fields?
This way, rte_event_eth_rx_adapter_runtime_params_init() can be avoided.
> Let me share an example and you can tell where is the issue
>
> 1)Assume parameter structure is 64B and for 22.03 8B are used.
> 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> 3)There is an application written based on 22.03 which using only 8B after
> calling rte_event_eth_rx_adapter_runtime_params_init()
> 4)Assume, in 22.07 another 8B added to structure.
> 5)Now, the application (3) needs to run on 22.07. Since the application is
> calling rte_event_eth_rx_adapter_runtime_params_init()
> and 9 to 15B are zero, the implementation will not go bad.
>
> > The old application only tries to set/get previous valid fields and the newly
> used fields may still contain junk value.
> > If the application wants to make use of any the newly used params, the
> application changes are required anyway.
>
> Yes. If application wants to make use of newly added features. No need to
> change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-30 9:56 ` Naga Harish K, S V
@ 2023-01-30 14:43 ` Jerin Jacob
2023-02-02 16:12 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-01-30 14:43 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Saturday, January 28, 2023 4:24 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> > Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> >
> > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> >
> > > > > > >
> > > > > > > > > + */
> > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > >
> > > > > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init() to
> > > > make
> > > > > > > > sure rsvd is zero.
> > > > > > > >
> > > > > > >
> > > > > > > The reserved fields are not used by the adapter or application.
> > > > > > > Not sure Is it necessary to Introduce a new API to clear reserved
> > fields.
> > > > > >
> > > > > > When adapter starts using new fileds(when we add new fieds in
> > > > > > future), the old applicaiton which is not using
> > > > > > rte_event_eth_rx_adapter_runtime_params_init() may have junk
> > > > > > value and then adapter implementation will behave bad.
> > > > > >
> > > > > >
> > > > >
> > > > > does it mean, the application doesn't re-compile for the new DPDK?
> > > >
> > > > Yes. No need recompile if ABI not breaking.
> > > >
> > > > > When some of the reserved fields are used in the future, the
> > > > > application
> > > > also may need to be recompiled along with DPDK right?
> > > > > As the application also may need to use the newly consumed
> > > > > reserved
> > > > fields?
> > > >
> > > > The problematic case is:
> > > >
> > > > Adapter implementation of 23.07(Assuming there is change params)
> > > > field needs to work with application of 23.03.
> > > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > > >
> > >
> > > As rte_event_eth_rx_adapter_runtime_params_init() initializes only
> > reserved fields to zero, it may not solve the issue in this case.
> >
> > rte_event_eth_rx_adapter_runtime_params_init() needs to zero all fields,
> > not just reserved field.
> > The application calling sequence is
> >
> > struct my_config c;
> > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > c.interseted_filed_to_be_updated = val;
> >
> Can it be done like
> struct my_config c = {0};
> c.interseted_filed_to_be_updated = val;
> and update Doxygen comments to recommend above usage to reset all fields?
> This way, rte_event_eth_rx_adapter_runtime_params_init() can be avoided.
Better to have a function for documentation clarity. Similar scheme
already there
in DPDK. See rte_eth_cman_config_init()
>
> > Let me share an example and you can tell where is the issue
> >
> > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> > 3)There is an application written based on 22.03 which using only 8B after
> > calling rte_event_eth_rx_adapter_runtime_params_init()
> > 4)Assume, in 22.07 another 8B added to structure.
> > 5)Now, the application (3) needs to run on 22.07. Since the application is
> > calling rte_event_eth_rx_adapter_runtime_params_init()
> > and 9 to 15B are zero, the implementation will not go bad.
> >
> > > The old application only tries to set/get previous valid fields and the newly
> > used fields may still contain junk value.
> > > If the application wants to make use of any the newly used params, the
> > application changes are required anyway.
> >
> > Yes. If application wants to make use of newly added features. No need to
> > change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-30 14:43 ` Jerin Jacob
@ 2023-02-02 16:12 ` Naga Harish K, S V
2023-02-03 9:44 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-02 16:12 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, January 30, 2023 8:13 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Saturday, January 28, 2023 4:24 PM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > >
> > > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > >
> > > > > > > >
> > > > > > > > > > + */
> > > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > > >
> > > > > > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > > to
> > > > > make
> > > > > > > > > sure rsvd is zero.
> > > > > > > > >
> > > > > > > >
> > > > > > > > The reserved fields are not used by the adapter or application.
> > > > > > > > Not sure Is it necessary to Introduce a new API to clear
> > > > > > > > reserved
> > > fields.
> > > > > > >
> > > > > > > When adapter starts using new fileds(when we add new fieds
> > > > > > > in future), the old applicaiton which is not using
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init() may have
> junk
> > > > > > > value and then adapter implementation will behave bad.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > does it mean, the application doesn't re-compile for the new DPDK?
> > > > >
> > > > > Yes. No need recompile if ABI not breaking.
> > > > >
> > > > > > When some of the reserved fields are used in the future, the
> > > > > > application
> > > > > also may need to be recompiled along with DPDK right?
> > > > > > As the application also may need to use the newly consumed
> > > > > > reserved
> > > > > fields?
> > > > >
> > > > > The problematic case is:
> > > > >
> > > > > Adapter implementation of 23.07(Assuming there is change params)
> > > > > field needs to work with application of 23.03.
> > > > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > > > >
> > > >
> > > > As rte_event_eth_rx_adapter_runtime_params_init() initializes only
> > > reserved fields to zero, it may not solve the issue in this case.
> > >
> > > rte_event_eth_rx_adapter_runtime_params_init() needs to zero all
> > > fields, not just reserved field.
> > > The application calling sequence is
> > >
> > > struct my_config c;
> > > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > > c.interseted_filed_to_be_updated = val;
> > >
> > Can it be done like
> > struct my_config c = {0};
> > c.interseted_filed_to_be_updated = val; and update Doxygen
> > comments to recommend above usage to reset all fields?
> > This way, rte_event_eth_rx_adapter_runtime_params_init() can be
> avoided.
>
> Better to have a function for documentation clarity. Similar scheme already
> there in DPDK. See rte_eth_cman_config_init()
>
>
The reference function rte_eth_cman_config_init() is resetting the params struct and initializing the required params with default values in the pmd cb.
The proposed rte_event_eth_rx_adapter_runtime_params_init () API just needs to reset the params struct. There are no pmd CBs involved.
Having an API just to reset the struct seems overkill. What do you think?
> >
> > > Let me share an example and you can tell where is the issue
> > >
> > > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> > > 3)There is an application written based on 22.03 which using only 8B
> > > after calling rte_event_eth_rx_adapter_runtime_params_init()
> > > 4)Assume, in 22.07 another 8B added to structure.
> > > 5)Now, the application (3) needs to run on 22.07. Since the
> > > application is calling
> > > rte_event_eth_rx_adapter_runtime_params_init()
> > > and 9 to 15B are zero, the implementation will not go bad.
> > >
> > > > The old application only tries to set/get previous valid fields
> > > > and the newly
> > > used fields may still contain junk value.
> > > > If the application wants to make use of any the newly used params,
> > > > the
> > > application changes are required anyway.
> > >
> > > Yes. If application wants to make use of newly added features. No
> > > need to change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-02 16:12 ` Naga Harish K, S V
@ 2023-02-03 9:44 ` Jerin Jacob
2023-02-06 6:21 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-02-03 9:44 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Thu, Feb 2, 2023 at 9:42 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Monday, January 30, 2023 8:13 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> > Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> >
> > On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: Saturday, January 28, 2023 4:24 PM
> > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > <jay.jayatheerthan@intel.com>
> > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > > >
> > > > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > >
> > > > > > > > >
> > > > > > > > > > > + */
> > > > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > > > >
> > > > > > > > > > Introduce rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > > > to
> > > > > > make
> > > > > > > > > > sure rsvd is zero.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > The reserved fields are not used by the adapter or application.
> > > > > > > > > Not sure Is it necessary to Introduce a new API to clear
> > > > > > > > > reserved
> > > > fields.
> > > > > > > >
> > > > > > > > When adapter starts using new fileds(when we add new fieds
> > > > > > > > in future), the old applicaiton which is not using
> > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() may have
> > junk
> > > > > > > > value and then adapter implementation will behave bad.
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > does it mean, the application doesn't re-compile for the new DPDK?
> > > > > >
> > > > > > Yes. No need recompile if ABI not breaking.
> > > > > >
> > > > > > > When some of the reserved fields are used in the future, the
> > > > > > > application
> > > > > > also may need to be recompiled along with DPDK right?
> > > > > > > As the application also may need to use the newly consumed
> > > > > > > reserved
> > > > > > fields?
> > > > > >
> > > > > > The problematic case is:
> > > > > >
> > > > > > Adapter implementation of 23.07(Assuming there is change params)
> > > > > > field needs to work with application of 23.03.
> > > > > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > > > > >
> > > > >
> > > > > As rte_event_eth_rx_adapter_runtime_params_init() initializes only
> > > > reserved fields to zero, it may not solve the issue in this case.
> > > >
> > > > rte_event_eth_rx_adapter_runtime_params_init() needs to zero all
> > > > fields, not just reserved field.
> > > > The application calling sequence is
> > > >
> > > > struct my_config c;
> > > > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > > > c.interseted_filed_to_be_updated = val;
> > > >
> > > Can it be done like
> > > struct my_config c = {0};
> > > c.interseted_filed_to_be_updated = val; and update Doxygen
> > > comments to recommend above usage to reset all fields?
> > > This way, rte_event_eth_rx_adapter_runtime_params_init() can be
> > avoided.
> >
> > Better to have a function for documentation clarity. Similar scheme already
> > there in DPDK. See rte_eth_cman_config_init()
> >
> >
>
>
> The reference function rte_eth_cman_config_init() is resetting the params struct and initializing the required params with default values in the pmd cb.
No need for PMD cb.
> The proposed rte_event_eth_rx_adapter_runtime_params_init () API just needs to reset the params struct. There are no pmd CBs involved.
> Having an API just to reset the struct seems overkill. What do you think?
It is slow path API. Keeping it as function is better. Also, it helps
the documentations of config parm in
rte_event_eth_rx_adapter_runtime_params_config()
like, This structure must be initialized with
rte_event_eth_rx_adapter_runtime_params_init() or so.
>
> > >
> > > > Let me share an example and you can tell where is the issue
> > > >
> > > > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > > > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> > > > 3)There is an application written based on 22.03 which using only 8B
> > > > after calling rte_event_eth_rx_adapter_runtime_params_init()
> > > > 4)Assume, in 22.07 another 8B added to structure.
> > > > 5)Now, the application (3) needs to run on 22.07. Since the
> > > > application is calling
> > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > and 9 to 15B are zero, the implementation will not go bad.
> > > >
> > > > > The old application only tries to set/get previous valid fields
> > > > > and the newly
> > > > used fields may still contain junk value.
> > > > > If the application wants to make use of any the newly used params,
> > > > > the
> > > > application changes are required anyway.
> > > >
> > > > Yes. If application wants to make use of newly added features. No
> > > > need to change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-03 9:44 ` Jerin Jacob
@ 2023-02-06 6:21 ` Naga Harish K, S V
2023-02-06 16:38 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-06 6:21 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
Hi Jerin,
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, February 3, 2023 3:15 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Thu, Feb 2, 2023 at 9:42 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Monday, January 30, 2023 8:13 PM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > >
> > > On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: Saturday, January 28, 2023 4:24 PM
> > > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > > <jay.jayatheerthan@intel.com>
> > > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get
> > > > > APIs
> > > > >
> > > > > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > >
> > > > > > > > > >
> > > > > > > > > > > > + */
> > > > > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > > > > >
> > > > > > > > > > > Introduce
> > > > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > > > > to
> > > > > > > make
> > > > > > > > > > > sure rsvd is zero.
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > The reserved fields are not used by the adapter or
> application.
> > > > > > > > > > Not sure Is it necessary to Introduce a new API to
> > > > > > > > > > clear reserved
> > > > > fields.
> > > > > > > > >
> > > > > > > > > When adapter starts using new fileds(when we add new
> > > > > > > > > fieds in future), the old applicaiton which is not using
> > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() may have
> > > junk
> > > > > > > > > value and then adapter implementation will behave bad.
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > does it mean, the application doesn't re-compile for the new
> DPDK?
> > > > > > >
> > > > > > > Yes. No need recompile if ABI not breaking.
> > > > > > >
> > > > > > > > When some of the reserved fields are used in the future,
> > > > > > > > the application
> > > > > > > also may need to be recompiled along with DPDK right?
> > > > > > > > As the application also may need to use the newly consumed
> > > > > > > > reserved
> > > > > > > fields?
> > > > > > >
> > > > > > > The problematic case is:
> > > > > > >
> > > > > > > Adapter implementation of 23.07(Assuming there is change
> > > > > > > params) field needs to work with application of 23.03.
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > > > > > >
> > > > > >
> > > > > > As rte_event_eth_rx_adapter_runtime_params_init() initializes
> > > > > > only
> > > > > reserved fields to zero, it may not solve the issue in this case.
> > > > >
> > > > > rte_event_eth_rx_adapter_runtime_params_init() needs to zero all
> > > > > fields, not just reserved field.
> > > > > The application calling sequence is
> > > > >
> > > > > struct my_config c;
> > > > > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > > > > c.interseted_filed_to_be_updated = val;
> > > > >
> > > > Can it be done like
> > > > struct my_config c = {0};
> > > > c.interseted_filed_to_be_updated = val; and update Doxygen
> > > > comments to recommend above usage to reset all fields?
> > > > This way, rte_event_eth_rx_adapter_runtime_params_init() can be
> > > avoided.
> > >
> > > Better to have a function for documentation clarity. Similar scheme
> > > already there in DPDK. See rte_eth_cman_config_init()
> > >
> > >
> >
> >
> > The reference function rte_eth_cman_config_init() is resetting the params
> struct and initializing the required params with default values in the pmd cb.
>
> No need for PMD cb.
>
> > The proposed rte_event_eth_rx_adapter_runtime_params_init () API just
> needs to reset the params struct. There are no pmd CBs involved.
> > Having an API just to reset the struct seems overkill. What do you think?
>
> It is slow path API. Keeping it as function is better. Also, it helps the
> documentations of config parm in
> rte_event_eth_rx_adapter_runtime_params_config()
> like, This structure must be initialized with
> rte_event_eth_rx_adapter_runtime_params_init() or so.
>
>
Are there any other reasons to have this API (*params_init()) other than documentation?
>
> >
> > > >
> > > > > Let me share an example and you can tell where is the issue
> > > > >
> > > > > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > > > > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> > > > > 3)There is an application written based on 22.03 which using
> > > > > only 8B after calling
> > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > 4)Assume, in 22.07 another 8B added to structure.
> > > > > 5)Now, the application (3) needs to run on 22.07. Since the
> > > > > application is calling
> > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > and 9 to 15B are zero, the implementation will not go bad.
> > > > >
> > > > > > The old application only tries to set/get previous valid
> > > > > > fields and the newly
> > > > > used fields may still contain junk value.
> > > > > > If the application wants to make use of any the newly used
> > > > > > params, the
> > > > > application changes are required anyway.
> > > > >
> > > > > Yes. If application wants to make use of newly added features.
> > > > > No need to change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-06 6:21 ` Naga Harish K, S V
@ 2023-02-06 16:38 ` Jerin Jacob
2023-02-09 17:00 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-02-06 16:38 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Mon, Feb 6, 2023 at 11:52 AM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
> Hi Jerin,
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Friday, February 3, 2023 3:15 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> > Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> >
> > On Thu, Feb 2, 2023 at 9:42 PM Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > > Hi Jerin,
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > Sent: Monday, January 30, 2023 8:13 PM
> > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > <jay.jayatheerthan@intel.com>
> > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > > >
> > > > On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
> > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > Sent: Saturday, January 28, 2023 4:24 PM
> > > > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > > > <jay.jayatheerthan@intel.com>
> > > > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get
> > > > > > APIs
> > > > > >
> > > > > > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > > > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > > + */
> > > > > > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > > > > > >
> > > > > > > > > > > > Introduce
> > > > > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > > > > > to
> > > > > > > > make
> > > > > > > > > > > > sure rsvd is zero.
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > The reserved fields are not used by the adapter or
> > application.
> > > > > > > > > > > Not sure Is it necessary to Introduce a new API to
> > > > > > > > > > > clear reserved
> > > > > > fields.
> > > > > > > > > >
> > > > > > > > > > When adapter starts using new fileds(when we add new
> > > > > > > > > > fieds in future), the old applicaiton which is not using
> > > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() may have
> > > > junk
> > > > > > > > > > value and then adapter implementation will behave bad.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > does it mean, the application doesn't re-compile for the new
> > DPDK?
> > > > > > > >
> > > > > > > > Yes. No need recompile if ABI not breaking.
> > > > > > > >
> > > > > > > > > When some of the reserved fields are used in the future,
> > > > > > > > > the application
> > > > > > > > also may need to be recompiled along with DPDK right?
> > > > > > > > > As the application also may need to use the newly consumed
> > > > > > > > > reserved
> > > > > > > > fields?
> > > > > > > >
> > > > > > > > The problematic case is:
> > > > > > > >
> > > > > > > > Adapter implementation of 23.07(Assuming there is change
> > > > > > > > params) field needs to work with application of 23.03.
> > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() will sove that.
> > > > > > > >
> > > > > > >
> > > > > > > As rte_event_eth_rx_adapter_runtime_params_init() initializes
> > > > > > > only
> > > > > > reserved fields to zero, it may not solve the issue in this case.
> > > > > >
> > > > > > rte_event_eth_rx_adapter_runtime_params_init() needs to zero all
> > > > > > fields, not just reserved field.
> > > > > > The application calling sequence is
> > > > > >
> > > > > > struct my_config c;
> > > > > > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > > > > > c.interseted_filed_to_be_updated = val;
> > > > > >
> > > > > Can it be done like
> > > > > struct my_config c = {0};
> > > > > c.interseted_filed_to_be_updated = val; and update Doxygen
> > > > > comments to recommend above usage to reset all fields?
> > > > > This way, rte_event_eth_rx_adapter_runtime_params_init() can be
> > > > avoided.
> > > >
> > > > Better to have a function for documentation clarity. Similar scheme
> > > > already there in DPDK. See rte_eth_cman_config_init()
> > > >
> > > >
> > >
> > >
> > > The reference function rte_eth_cman_config_init() is resetting the params
> > struct and initializing the required params with default values in the pmd cb.
> >
> > No need for PMD cb.
> >
> > > The proposed rte_event_eth_rx_adapter_runtime_params_init () API just
> > needs to reset the params struct. There are no pmd CBs involved.
> > > Having an API just to reset the struct seems overkill. What do you think?
> >
> > It is slow path API. Keeping it as function is better. Also, it helps the
> > documentations of config parm in
> > rte_event_eth_rx_adapter_runtime_params_config()
> > like, This structure must be initialized with
> > rte_event_eth_rx_adapter_runtime_params_init() or so.
> >
> >
>
> Are there any other reasons to have this API (*params_init()) other than documentation?
Initialization code is segregated for tracking.
>
> >
> > >
> > > > >
> > > > > > Let me share an example and you can tell where is the issue
> > > > > >
> > > > > > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > > > > > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all 64B.
> > > > > > 3)There is an application written based on 22.03 which using
> > > > > > only 8B after calling
> > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > 4)Assume, in 22.07 another 8B added to structure.
> > > > > > 5)Now, the application (3) needs to run on 22.07. Since the
> > > > > > application is calling
> > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > and 9 to 15B are zero, the implementation will not go bad.
> > > > > >
> > > > > > > The old application only tries to set/get previous valid
> > > > > > > fields and the newly
> > > > > > used fields may still contain junk value.
> > > > > > > If the application wants to make use of any the newly used
> > > > > > > params, the
> > > > > > application changes are required anyway.
> > > > > >
> > > > > > Yes. If application wants to make use of newly added features.
> > > > > > No need to change if new features are not needed for old application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-06 16:38 ` Jerin Jacob
@ 2023-02-09 17:00 ` Naga Harish K, S V
0 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-09 17:00 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, February 6, 2023 10:08 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Mon, Feb 6, 2023 at 11:52 AM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > Hi Jerin,
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Friday, February 3, 2023 3:15 PM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get APIs
> > >
> > > On Thu, Feb 2, 2023 at 9:42 PM Naga Harish K, S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > > Hi Jerin,
> > > >
> > > > > -----Original Message-----
> > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > Sent: Monday, January 30, 2023 8:13 PM
> > > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > > > <jay.jayatheerthan@intel.com>
> > > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params set/get
> > > > > APIs
> > > > >
> > > > > On Mon, Jan 30, 2023 at 3:26 PM Naga Harish K, S V
> > > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > > Sent: Saturday, January 28, 2023 4:24 PM
> > > > > > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > > > > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > > > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > > > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan,
> > > > > > > Jay <jay.jayatheerthan@intel.com>
> > > > > > > Subject: Re: [PATCH v2 1/3] eventdev/eth_rx: add params
> > > > > > > set/get APIs
> > > > > > >
> > > > > > > On Wed, Jan 25, 2023 at 10:02 PM Naga Harish K, S V
> > > > > > > <s.v.naga.harish.k@intel.com> wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > > > + */
> > > > > > > > > > > > > > + uint32_t rsvd[15];
> > > > > > > > > > > > > > + /**< Reserved fields for future use */
> > > > > > > > > > > > >
> > > > > > > > > > > > > Introduce
> > > > > > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > > > > > > to
> > > > > > > > > make
> > > > > > > > > > > > > sure rsvd is zero.
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > The reserved fields are not used by the adapter or
> > > application.
> > > > > > > > > > > > Not sure Is it necessary to Introduce a new API to
> > > > > > > > > > > > clear reserved
> > > > > > > fields.
> > > > > > > > > > >
> > > > > > > > > > > When adapter starts using new fileds(when we add new
> > > > > > > > > > > fieds in future), the old applicaiton which is not
> > > > > > > > > > > using
> > > > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() may
> > > > > > > > > > > have
> > > > > junk
> > > > > > > > > > > value and then adapter implementation will behave bad.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > does it mean, the application doesn't re-compile for
> > > > > > > > > > the new
> > > DPDK?
> > > > > > > > >
> > > > > > > > > Yes. No need recompile if ABI not breaking.
> > > > > > > > >
> > > > > > > > > > When some of the reserved fields are used in the
> > > > > > > > > > future, the application
> > > > > > > > > also may need to be recompiled along with DPDK right?
> > > > > > > > > > As the application also may need to use the newly
> > > > > > > > > > consumed reserved
> > > > > > > > > fields?
> > > > > > > > >
> > > > > > > > > The problematic case is:
> > > > > > > > >
> > > > > > > > > Adapter implementation of 23.07(Assuming there is change
> > > > > > > > > params) field needs to work with application of 23.03.
> > > > > > > > > rte_event_eth_rx_adapter_runtime_params_init() will sove
> that.
> > > > > > > > >
> > > > > > > >
> > > > > > > > As rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > > initializes only
> > > > > > > reserved fields to zero, it may not solve the issue in this case.
> > > > > > >
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init() needs to zero
> > > > > > > all fields, not just reserved field.
> > > > > > > The application calling sequence is
> > > > > > >
> > > > > > > struct my_config c;
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init(&c)
> > > > > > > c.interseted_filed_to_be_updated = val;
> > > > > > >
> > > > > > Can it be done like
> > > > > > struct my_config c = {0};
> > > > > > c.interseted_filed_to_be_updated = val; and update
> > > > > > Doxygen comments to recommend above usage to reset all fields?
> > > > > > This way, rte_event_eth_rx_adapter_runtime_params_init() can
> > > > > > be
> > > > > avoided.
> > > > >
> > > > > Better to have a function for documentation clarity. Similar
> > > > > scheme already there in DPDK. See rte_eth_cman_config_init()
> > > > >
> > > > >
> > > >
> > > >
> > > > The reference function rte_eth_cman_config_init() is resetting the
> > > > params
> > > struct and initializing the required params with default values in the pmd
> cb.
> > >
> > > No need for PMD cb.
> > >
> > > > The proposed rte_event_eth_rx_adapter_runtime_params_init () API
> > > > just
> > > needs to reset the params struct. There are no pmd CBs involved.
> > > > Having an API just to reset the struct seems overkill. What do you
> think?
> > >
> > > It is slow path API. Keeping it as function is better. Also, it
> > > helps the documentations of config parm in
> > > rte_event_eth_rx_adapter_runtime_params_config()
> > > like, This structure must be initialized with
> > > rte_event_eth_rx_adapter_runtime_params_init() or so.
> > >
> > >
> >
> > Are there any other reasons to have this API (*params_init()) other than
> documentation?
>
> Initialization code is segregated for tracking.
>
The discussed changes are updated in the v3 patchset.
> >
> > >
> > > >
> > > > > >
> > > > > > > Let me share an example and you can tell where is the issue
> > > > > > >
> > > > > > > 1)Assume parameter structure is 64B and for 22.03 8B are used.
> > > > > > > 2)rte_event_eth_rx_adapter_runtime_params_init() will clear all
> 64B.
> > > > > > > 3)There is an application written based on 22.03 which using
> > > > > > > only 8B after calling
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > 4)Assume, in 22.07 another 8B added to structure.
> > > > > > > 5)Now, the application (3) needs to run on 22.07. Since the
> > > > > > > application is calling
> > > > > > > rte_event_eth_rx_adapter_runtime_params_init()
> > > > > > > and 9 to 15B are zero, the implementation will not go bad.
> > > > > > >
> > > > > > > > The old application only tries to set/get previous valid
> > > > > > > > fields and the newly
> > > > > > > used fields may still contain junk value.
> > > > > > > > If the application wants to make use of any the newly used
> > > > > > > > params, the
> > > > > > > application changes are required anyway.
> > > > > > >
> > > > > > > Yes. If application wants to make use of newly added features.
> > > > > > > No need to change if new features are not needed for old
> application.
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
` (2 preceding siblings ...)
2023-01-24 4:29 ` [PATCH v2 1/3] eventdev/eth_rx: " Jerin Jacob
@ 2023-02-09 16:57 ` Naga Harish K S V
2023-02-09 16:57 ` [PATCH v3 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-09 16:57 ` [PATCH v3 3/3] eventdev/crypto: " Naga Harish K S V
2023-02-10 1:55 ` [PATCH v3 1/3] eventdev/eth_rx: " Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
5 siblings, 2 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-09 16:57 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_rx_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 11 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 86 ++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 104 +++++++++++++++-
lib/eventdev/version.map | 2 +
5 files changed, 314 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..aefc61f326 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,17 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
+``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..425d768e02 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1554,7 +1554,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3461,90 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..ae2d1f1ddc 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,21 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
+ * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
+ * configures the adapter with default value of maximum packets processed per
+ * iteration to RXA_NB_RX_WORK_DEFAULT(128).
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
+ * packets processed per iteration. This is alternative to using
+ * rte_event_eth_rx_adapter_create_ext() with parameter
+ * rte_event_eth_rx_adapter_conf::max_nb_rx
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -121,6 +132,11 @@ struct rte_event_eth_rx_adapter_conf {
*/
};
+#define RXA_NB_RX_WORK_DEFAULT 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_rx_adapter_conf, this
@@ -299,6 +315,19 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +772,79 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..da97db794f 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-09 16:57 ` [PATCH v3 " Naga Harish K S V
@ 2023-02-09 16:57 ` Naga Harish K S V
2023-02-09 16:57 ` [PATCH v3 3/3] eventdev/crypto: " Naga Harish K S V
1 sibling, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-09 16:57 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_tx_adapter_runtime_params`` can be
configured and retrieved using
``rte_event_eth_tx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 132 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 15 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 103 +++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 106 ++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 355 insertions(+), 3 deletions(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..4e1d821bf9 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +986,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..a48680e9bc 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,18 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/read are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
+
+The adapter flush threshold also can be configured using
+``rte_event_eth_tx_adapter_runtime_params_set()``.
+
+``rte_event_eth_tx_adapter_runtime_params_get()`` function retrieves the adapter
+params that are defined in ``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..323bc45765 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -12,9 +12,7 @@
#define TXA_BATCH_SIZE 32
#define TXA_SERVICE_NAME_LEN 32
#define TXA_MEM_NAME_LEN 32
-#define TXA_FLUSH_THRESHOLD 1024
#define TXA_RETRY_CNT 100
-#define TXA_MAX_NB_TX 128
#define TXA_INVALID_DEV_ID INT32_C(-1)
#define TXA_INVALID_SERVICE_ID INT64_C(-1)
@@ -124,6 +122,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +665,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +770,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1293,101 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..b35bba490f 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,8 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +105,33 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+#define TXA_FLUSH_THRESHOLD 1024
+/**< The default value of flush threshold for service
+ * based adapter.
+ */
+
+#define TXA_MAX_NB_TX 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +545,83 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params(),
+ * modify the required parameters and then call
+ * rte_event_eth_tx_adapter_runtime_params_set().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index da97db794f..38dfbb1f41 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -123,6 +123,8 @@ EXPERIMENTAL {
# added in 23.03
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 3/3] eventdev/crypto: add params set/get APIs
2023-02-09 16:57 ` [PATCH v3 " Naga Harish K S V
2023-02-09 16:57 ` [PATCH v3 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-09 16:57 ` Naga Harish K S V
1 sibling, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-09 16:57 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
``struct rte_event_crypto_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_crypto_adapter_runtime_params_set``
and ``rte_event_eth_rx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 11 ++
lib/eventdev/rte_event_crypto_adapter.c | 89 +++++++++++++-
lib/eventdev/rte_event_crypto_adapter.h | 93 +++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 303 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..877a406c5f 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,14 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_crypto_adapter_runtime_params``.
+
+``rte_event_crypto_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..77d84c04ed 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -20,7 +20,6 @@
#include "rte_event_crypto_adapter.h"
#define BATCH_SIZE 32
-#define DEFAULT_MAX_NB 128
#define CRYPTO_ADAPTER_NAME_LEN 32
#define CRYPTO_ADAPTER_MEM_NAME_LEN 32
#define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
@@ -1335,6 +1334,94 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..f92963519b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,8 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +255,24 @@ struct rte_event_crypto_adapter_conf {
*/
};
+#define DEFAULT_MAX_NB 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +628,79 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 38dfbb1f41..60e5e3a593 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
rte_event_eth_tx_adapter_runtime_params_get;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
` (3 preceding siblings ...)
2023-02-09 16:57 ` [PATCH v3 " Naga Harish K S V
@ 2023-02-10 1:55 ` Naga Harish K S V
2023-02-10 1:55 ` [PATCH v3 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-10 1:55 ` [PATCH v3 3/3] eventdev/crypto: " Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
5 siblings, 2 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 1:55 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_rx_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 11 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 86 ++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 101 +++++++++++++++-
lib/eventdev/version.map | 2 +
5 files changed, 311 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..aefc61f326 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,17 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
+``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..425d768e02 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1554,7 +1554,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3461,90 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..9f781a5f69 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,21 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
+ * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
+ * configures the adapter with default value of maximum packets processed per
+ * iteration to RXA_NB_RX_WORK_DEFAULT(128).
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
+ * packets processed per iteration. This is alternative to using
+ * rte_event_eth_rx_adapter_create_ext() with parameter
+ * rte_event_eth_rx_adapter_conf::max_nb_rx
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -121,6 +132,11 @@ struct rte_event_eth_rx_adapter_conf {
*/
};
+#define RXA_NB_RX_WORK_DEFAULT 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_rx_adapter_conf, this
@@ -299,6 +315,19 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +772,76 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..da97db794f 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 1:55 ` [PATCH v3 1/3] eventdev/eth_rx: " Naga Harish K S V
@ 2023-02-10 1:55 ` Naga Harish K S V
2023-02-10 1:55 ` [PATCH v3 3/3] eventdev/crypto: " Naga Harish K S V
1 sibling, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 1:55 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_tx_adapter_runtime_params`` can be
configured and retrieved using
``rte_event_eth_tx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 132 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 15 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 103 +++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 103 ++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 352 insertions(+), 3 deletions(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..4e1d821bf9 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +986,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..a48680e9bc 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,18 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/read are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
+
+The adapter flush threshold also can be configured using
+``rte_event_eth_tx_adapter_runtime_params_set()``.
+
+``rte_event_eth_tx_adapter_runtime_params_get()`` function retrieves the adapter
+params that are defined in ``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..323bc45765 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -12,9 +12,7 @@
#define TXA_BATCH_SIZE 32
#define TXA_SERVICE_NAME_LEN 32
#define TXA_MEM_NAME_LEN 32
-#define TXA_FLUSH_THRESHOLD 1024
#define TXA_RETRY_CNT 100
-#define TXA_MAX_NB_TX 128
#define TXA_INVALID_DEV_ID INT32_C(-1)
#define TXA_INVALID_SERVICE_ID INT64_C(-1)
@@ -124,6 +122,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +665,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +770,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1293,101 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..f3ac6efc07 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,8 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +105,33 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+#define TXA_FLUSH_THRESHOLD 1024
+/**< The default value of flush threshold for service
+ * based adapter.
+ */
+
+#define TXA_MAX_NB_TX 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +545,80 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params(),
+ * modify the required parameters and then call
+ * rte_event_eth_tx_adapter_runtime_params_set().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index da97db794f..38dfbb1f41 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -123,6 +123,8 @@ EXPERIMENTAL {
# added in 23.03
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v3 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 1:55 ` [PATCH v3 1/3] eventdev/eth_rx: " Naga Harish K S V
2023-02-10 1:55 ` [PATCH v3 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 1:55 ` Naga Harish K S V
1 sibling, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 1:55 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
``struct rte_event_crypto_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_crypto_adapter_runtime_params_set``
and ``rte_event_eth_rx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 11 ++
lib/eventdev/rte_event_crypto_adapter.c | 89 +++++++++++++-
lib/eventdev/rte_event_crypto_adapter.h | 90 +++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 300 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..877a406c5f 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,14 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_crypto_adapter_runtime_params``.
+
+``rte_event_crypto_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..77d84c04ed 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -20,7 +20,6 @@
#include "rte_event_crypto_adapter.h"
#define BATCH_SIZE 32
-#define DEFAULT_MAX_NB 128
#define CRYPTO_ADAPTER_NAME_LEN 32
#define CRYPTO_ADAPTER_MEM_NAME_LEN 32
#define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
@@ -1335,6 +1334,94 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..106e83102f 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,8 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +255,24 @@ struct rte_event_crypto_adapter_conf {
*/
};
+#define DEFAULT_MAX_NB 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +628,76 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 38dfbb1f41..60e5e3a593 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
rte_event_eth_tx_adapter_runtime_params_get;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v4 1/3] eventdev/eth_rx: add params set/get APIs
2023-01-23 18:04 ` [PATCH v2 " Naga Harish K S V
` (4 preceding siblings ...)
2023-02-10 1:55 ` [PATCH v3 1/3] eventdev/eth_rx: " Naga Harish K S V
@ 2023-02-10 4:58 ` Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 2/3] eventdev/eth_tx: " Naga Harish K S V
` (4 more replies)
5 siblings, 5 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 4:58 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_rx_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 11 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 86 ++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 101 +++++++++++++++-
lib/eventdev/version.map | 2 +
5 files changed, 311 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..aefc61f326 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,17 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
+``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..425d768e02 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1554,7 +1554,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3461,90 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..9f781a5f69 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,21 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
+ * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
+ * configures the adapter with default value of maximum packets processed per
+ * iteration to RXA_NB_RX_WORK_DEFAULT(128).
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
+ * packets processed per iteration. This is alternative to using
+ * rte_event_eth_rx_adapter_create_ext() with parameter
+ * rte_event_eth_rx_adapter_conf::max_nb_rx
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -121,6 +132,11 @@ struct rte_event_eth_rx_adapter_conf {
*/
};
+#define RXA_NB_RX_WORK_DEFAULT 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_rx_adapter_conf, this
@@ -299,6 +315,19 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +772,76 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..da97db794f 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v4 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
@ 2023-02-10 4:58 ` Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 3/3] eventdev/crypto: " Naga Harish K S V
` (3 subsequent siblings)
4 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 4:58 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
``struct rte_event_eth_tx_adapter_runtime_params`` can be
configured and retrieved using
``rte_event_eth_tx_adapter_runtime_params_set`` and
``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 130 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 15 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 103 +++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 103 ++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 350 insertions(+), 3 deletions(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..a093ee0efc 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -795,6 +795,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == TXA_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ TXA_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_MAX_NB_TX,
+ "Expected %u got %u",
+ TXA_MAX_NB_TX, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +984,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..a48680e9bc 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,18 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/read are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
+
+The adapter flush threshold also can be configured using
+``rte_event_eth_tx_adapter_runtime_params_set()``.
+
+``rte_event_eth_tx_adapter_runtime_params_get()`` function retrieves the adapter
+params that are defined in ``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..323bc45765 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -12,9 +12,7 @@
#define TXA_BATCH_SIZE 32
#define TXA_SERVICE_NAME_LEN 32
#define TXA_MEM_NAME_LEN 32
-#define TXA_FLUSH_THRESHOLD 1024
#define TXA_RETRY_CNT 100
-#define TXA_MAX_NB_TX 128
#define TXA_INVALID_DEV_ID INT32_C(-1)
#define TXA_INVALID_SERVICE_ID INT64_C(-1)
@@ -124,6 +122,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +665,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +770,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1293,101 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..e0332910eb 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,8 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +105,33 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+#define TXA_FLUSH_THRESHOLD 1024
+/**< The default value of flush threshold for service
+ * based adapter.
+ */
+
+#define TXA_MAX_NB_TX 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +545,80 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param txa_params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params(),
+ * modify the required parameters and then call
+ * rte_event_eth_tx_adapter_runtime_params_set().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index da97db794f..38dfbb1f41 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -123,6 +123,8 @@ EXPERIMENTAL {
# added in 23.03
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v4 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 4:58 ` Naga Harish K S V
2023-02-10 6:30 ` [PATCH v4 1/3] eventdev/eth_rx: " Jerin Jacob
` (2 subsequent siblings)
4 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 4:58 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
``struct rte_event_crypto_adapter_runtime_params`` can be configured
and retrieved using ``rte_event_crypto_adapter_runtime_params_set``
and ``rte_event_eth_rx_adapter_runtime_params_get`` respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 11 ++
lib/eventdev/rte_event_crypto_adapter.c | 89 +++++++++++++-
lib/eventdev/rte_event_crypto_adapter.h | 90 +++++++++++++++
lib/eventdev/version.map | 2 +
5 files changed, 300 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..877a406c5f 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,14 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_crypto_adapter_runtime_params``.
+
+``rte_event_crypto_adapter_runtime_parmas_get()`` function retrieves the configuration
+parameters that are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..77d84c04ed 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -20,7 +20,6 @@
#include "rte_event_crypto_adapter.h"
#define BATCH_SIZE 32
-#define DEFAULT_MAX_NB 128
#define CRYPTO_ADAPTER_NAME_LEN 32
#define CRYPTO_ADAPTER_MEM_NAME_LEN 32
#define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
@@ -1335,6 +1334,94 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..106e83102f 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,8 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +255,24 @@ struct rte_event_crypto_adapter_conf {
*/
};
+#define DEFAULT_MAX_NB 128
+/**< The default value for maximum number of packets processed by service
+ * based adapter per each call.
+ */
+
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +628,76 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+static inline int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 38dfbb1f41..60e5e3a593 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,8 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_set;
rte_event_eth_tx_adapter_runtime_params_get;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v4 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-10 4:58 ` [PATCH v4 3/3] eventdev/crypto: " Naga Harish K S V
@ 2023-02-10 6:30 ` Jerin Jacob
2023-02-10 13:33 ` [PATCH v5 " Naga Harish K S V
2023-02-10 13:46 ` Naga Harish K S V
4 siblings, 0 replies; 53+ messages in thread
From: Jerin Jacob @ 2023-02-10 6:30 UTC (permalink / raw)
To: Naga Harish K S V
Cc: jerinj, erik.g.carrillo, abhinandan.gujjar, dev, jay.jayatheerthan
On Fri, Feb 10, 2023 at 10:28 AM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter configuration parameters defined in the
> ``struct rte_event_eth_rx_adapter_runtime_params`` can be configured
`` character you can remove in git commit.
> and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
> ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
>
> +Set/Get adapter runtime configuration parameters
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The runtime configuration parameters of adapter can be set/read using
read->get
> +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
> +can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
read->get
> +
> +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
> +parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
This is duplicate. Please remove.
>
> static int
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index f4652f40e8..9f781a5f69 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> @@ -39,10 +39,21 @@
> * - rte_event_eth_rx_adapter_queue_stats_reset()
> * - rte_event_eth_rx_adapter_event_port_get()
> * - rte_event_eth_rx_adapter_instance_get()
> + * - rte_event_eth_rx_adapter_runtime_params_get()
> + * - rte_event_eth_rx_adapter_runtime_params_set()
> *
> * The application creates an ethernet to event adapter using
> * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
> * or rte_event_eth_rx_adapter_create_with_params() functions.
> + *
> + * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
> + * configures the adapter with default value of maximum packets processed per
> + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> + * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
> + * packets processed per iteration. This is alternative to using
> + * rte_event_eth_rx_adapter_create_ext() with parameter
> + * rte_event_eth_rx_adapter_conf::max_nb_rx
This session is only valid for SW driver. Let's move this as Doxgen comment
struct rte_event_eth_rx_adapter_runtime_params::max_nb_rx
> + *
> * The adapter needs to know which ethernet rx queues to poll for mbufs as well
> * as event device parameters such as the event queue identifier, event
> * priority and scheduling type that the adapter should use when constructing
> @@ -121,6 +132,11 @@ struct rte_event_eth_rx_adapter_conf {
> */
> };
>
> +#define RXA_NB_RX_WORK_DEFAULT 128
> +/**< The default value for maximum number of packets processed by service
> + * based adapter per each call.
Don't expose internal symbols to public header file. Fix it by moving
rte_event_eth_rx_adapter_runtime_params_init() implementation .c file.
Since it is slow path function, there is no reason to be kept as
inline funciton.
> + */
> +
> /**
> * Function type used for adapter configuration callback. The callback is
> * used to fill in members of the struct rte_event_eth_rx_adapter_conf, this
> @@ -299,6 +315,19 @@ struct rte_event_eth_rx_adapter_params {
> /**< flag to indicate that event buffer is separate for each queue */
> };
>
> +/**
> + * Adapter configuration parameters
> + */
> +struct rte_event_eth_rx_adapter_runtime_params {
> + uint32_t max_nb_rx;
> + /**< The adapter can return early if it has processed at least
> + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> + * cause the adapter to process more than max_nb_rx mbufs.
Also mention, valid only when !INTERNAL_PORT
> + */
> + uint32_t rsvd[15];
> + /**< Reserved fields for future use */
> +};
> +
> /**
> *
> * Callback function invoked by the SW adapter before it continues
> @@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
> * Create a new ethernet Rx event adapter with the specified identifier.
> * This function uses an internal configuration function that creates an event
> * port. This default function reconfigures the event device with an
> - * additional event port and setups up the event port using the port_config
> + * additional event port and setup the event port using the port_config
> * parameter passed into this function. In case the application needs more
> * control in configuration of the service, it should use the
> * rte_event_eth_rx_adapter_create_ext() version.
> @@ -743,6 +772,76 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
> uint16_t rx_queue_id,
> uint8_t *rxa_inst_id);
>
> +/**
> + * Initialize the adapter runtime configuration parameters with default values
> + *
> + * @param params
> + * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +static inline int
Slowpath function, move to .c file.
> +rte_event_eth_rx_adapter_runtime_params_init(
> + struct rte_event_eth_rx_adapter_runtime_params *params)
> +{
> + if (params == NULL)
> + return -EINVAL;
> +
> + memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
> + params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> +
> + return 0;
> +}
> +
> +/**
> + * Set the adapter runtime configuration parameters
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
> + *
> + * @param id
> + * Adapter identifier
> + *
> + * @param params
> + * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + * with configuration parameter values. This structure can be initialized using
> + * rte_event_eth_rx_adapter_runtime_params_init() to default values or
> + * application may reset this structure and update the required fields.
I would suggest:
The structure must be initialized to default values.
rte_event_eth_rx_adapter_runtime_params_init() can be used to
initialize the default values
or application must reset this structure and update the required fields.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_eth_rx_adapter_runtime_params *params);
> +
> +/**
> + * Get the adapter runtime configuration parameters
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
> + *
> + * @param id
> + * Adapter identifier
> + *
> + * @param[out] params
> + * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + * containing valid adapter parameters when return value is 0.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_eth_rx_adapter_runtime_params *params);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index 3add5e3088..da97db794f 100644
> --- a/lib/eventdev/version.map
> +++ b/lib/eventdev/version.map
> @@ -121,6 +121,8 @@ EXPERIMENTAL {
> rte_event_eth_tx_adapter_queue_stop;
>
> # added in 23.03
Add rte_event_eth_rx_adapter_runtime_params_init() to version.map
Not reviewed other patches. Similar comments apply in other patches.
> + rte_event_eth_rx_adapter_runtime_params_get;
> + rte_event_eth_rx_adapter_runtime_params_set;
> rte_event_timer_remaining_ticks_get;
> };
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
` (2 preceding siblings ...)
2023-02-10 6:30 ` [PATCH v4 1/3] eventdev/eth_rx: " Jerin Jacob
@ 2023-02-10 13:33 ` Naga Harish K S V
2023-02-10 13:33 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
` (2 more replies)
2023-02-10 13:46 ` Naga Harish K S V
4 siblings, 3 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:33 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
struct rte_event_eth_rx_adapter_runtime_params can be configured
and retrieved using rte_event_eth_rx_adapter_runtime_params_set and
rte_event_eth_tx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 8 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 101 +++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 93 +++++++++++++-
lib/eventdev/version.map | 3 +
5 files changed, 316 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..72614ce714 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,14 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/get are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..c1cd124002 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -35,6 +35,8 @@
#define MAX_VECTOR_NS 1E9
#define MIN_VECTOR_NS 1E5
+#define RXA_NB_RX_WORK_DEFAULT 128
+
#define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
#define ETH_RX_ADAPTER_MEM_NAME_LEN 32
@@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3463,103 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..ff08df25e8 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,14 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_init()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -299,6 +303,30 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ *
+ * rte_event_eth_rx_adapter_create() or
+ * rte_event_eth_adapter_create_with_params() configures the
+ * adapter with default value of maximum packets processed per
+ * iteration to 128.
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure
+ * maximum packets processed per iteration. This is alternative to using
+ * rte_event_eth_rx_adapter_create_ext() with parameter
+ * rte_event_eth_rx_adapter_conf::max_nb_rx
+ *
+ * This is valid for service based SW adapter only
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +405,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +771,69 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of the structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..ef9c3b86b2 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_init;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 13:33 ` [PATCH v5 " Naga Harish K S V
@ 2023-02-10 13:33 ` Naga Harish K S V
2023-02-10 13:33 ` [PATCH v5 3/3] eventdev/crypto: " Naga Harish K S V
2023-02-10 13:58 ` [PATCH v5 1/3] eventdev/eth_rx: " Jerin Jacob
2 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:33 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_eth_tx_adapter_runtime_params can be
configured and retrieved using
rte_event_eth_tx_adapter_runtime_params_set and
rte_event_eth_tx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 132 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 12 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 115 ++++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 86 ++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 347 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..4e1d821bf9 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +986,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..187978b19b 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,15 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/read are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
+
+The adapter flush threshold also can be configured using
+``rte_event_eth_tx_adapter_runtime_params_set()``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..131e11e01d 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -124,6 +124,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +667,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1295,115 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..b6720dbe0a 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,9 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_init()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +106,23 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +536,72 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param txa_params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params);
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params(),
+ * modify the required parameters and then call
+ * rte_event_eth_tx_adapter_runtime_params_set().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index ef9c3b86b2..7b93736dff 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -124,6 +124,9 @@ EXPERIMENTAL {
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_init;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 13:33 ` [PATCH v5 " Naga Harish K S V
2023-02-10 13:33 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 13:33 ` Naga Harish K S V
2023-02-10 13:58 ` [PATCH v5 1/3] eventdev/eth_rx: " Jerin Jacob
2 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:33 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_crypto_adapter_runtime_params can be configured
and retrieved using rte_event_crypto_adapter_runtime_params_set
and rte_event_eth_rx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 8 ++
lib/eventdev/rte_event_crypto_adapter.c | 101 ++++++++++++++++
lib/eventdev/rte_event_crypto_adapter.h | 79 +++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 300 insertions(+)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..00ec249d35 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,11 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/read using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/read are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..f6c1e5380d 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -1335,6 +1335,107 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..ca5c434aab 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,9 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_init()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +256,19 @@ struct rte_event_crypto_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +624,69 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. The reserved fiels of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 7b93736dff..3b17c84eae 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_init;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 13:33 ` [PATCH v5 " Naga Harish K S V
2023-02-10 13:33 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-10 13:33 ` [PATCH v5 3/3] eventdev/crypto: " Naga Harish K S V
@ 2023-02-10 13:58 ` Jerin Jacob
2023-02-10 17:42 ` Naga Harish K, S V
2 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-02-10 13:58 UTC (permalink / raw)
To: Naga Harish K S V
Cc: jerinj, erik.g.carrillo, abhinandan.gujjar, dev, jay.jayatheerthan
On Fri, Feb 10, 2023 at 7:03 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter configuration parameters defined in the
> struct rte_event_eth_rx_adapter_runtime_params can be configured
> and retrieved using rte_event_eth_rx_adapter_runtime_params_set and
rte_event_eth_rx_adapter_runtime_params_set()
> rte_event_eth_tx_adapter_runtime_params_get respectively.
rte_event_eth_tx_adapter_runtime_params_get()
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
> +/**
> + * Adapter runtime configuration parameters
> + */
> +struct rte_event_eth_rx_adapter_runtime_params {
> + uint32_t max_nb_rx;
> + /**< The adapter can return early if it has processed at least
> + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> + * cause the adapter to process more than max_nb_rx mbufs.
> + *
> + * rte_event_eth_rx_adapter_create() or
> + * rte_event_eth_adapter_create_with_params() configures the
> + * adapter with default value of maximum packets processed per
> + * iteration to 128.
> + * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure
> + * maximum packets processed per iteration. This is alternative to using
> + * rte_event_eth_rx_adapter_create_ext() with parameter
> + * rte_event_eth_rx_adapter_conf::max_nb_rx
> + *
> + * This is valid for service based SW adapter only
This is valid for the devices without
RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT capability.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v5 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 13:58 ` [PATCH v5 1/3] eventdev/eth_rx: " Jerin Jacob
@ 2023-02-10 17:42 ` Naga Harish K, S V
0 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-10 17:42 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, February 10, 2023 7:28 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v5 1/3] eventdev/eth_rx: add params set/get APIs
>
> On Fri, Feb 10, 2023 at 7:03 PM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > The adapter configuration parameters defined in the struct
> > rte_event_eth_rx_adapter_runtime_params can be configured and
> > retrieved using rte_event_eth_rx_adapter_runtime_params_set and
>
> rte_event_eth_rx_adapter_runtime_params_set()
>
Done
> > rte_event_eth_tx_adapter_runtime_params_get respectively.
>
> rte_event_eth_tx_adapter_runtime_params_get()
>
Done
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > ---
>
> > +/**
> > + * Adapter runtime configuration parameters */ struct
> > +rte_event_eth_rx_adapter_runtime_params {
> > + uint32_t max_nb_rx;
> > + /**< The adapter can return early if it has processed at least
> > + * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> > + * cause the adapter to process more than max_nb_rx mbufs.
> > + *
> > + * rte_event_eth_rx_adapter_create() or
> > + * rte_event_eth_adapter_create_with_params() configures the
> > + * adapter with default value of maximum packets processed per
> > + * iteration to 128.
> > + * rte_event_eth_rx_adapter_runtime_params_set() allows to re-
> configure
> > + * maximum packets processed per iteration. This is alternative to
> using
> > + * rte_event_eth_rx_adapter_create_ext() with parameter
> > + * rte_event_eth_rx_adapter_conf::max_nb_rx
> > + *
> > + * This is valid for service based SW adapter only
>
> This is valid for the devices without
> RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT capability.
Done, Updated in v6 patchset.
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 4:58 ` [PATCH v4 1/3] eventdev/eth_rx: " Naga Harish K S V
` (3 preceding siblings ...)
2023-02-10 13:33 ` [PATCH v5 " Naga Harish K S V
@ 2023-02-10 13:46 ` Naga Harish K S V
2023-02-10 13:46 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
` (2 more replies)
4 siblings, 3 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:46 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter configuration parameters defined in the
struct rte_event_eth_rx_adapter_runtime_params can be configured
and retrieved using rte_event_eth_rx_adapter_runtime_params_set and
rte_event_eth_tx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 8 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 101 +++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 93 +++++++++++++-
lib/eventdev/version.map | 3 +
5 files changed, 316 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..72614ce714 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,14 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/get are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..c1cd124002 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -35,6 +35,8 @@
#define MAX_VECTOR_NS 1E9
#define MIN_VECTOR_NS 1E5
+#define RXA_NB_RX_WORK_DEFAULT 128
+
#define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
#define ETH_RX_ADAPTER_MEM_NAME_LEN 32
@@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3463,103 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..ff08df25e8 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,14 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_init()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -299,6 +303,30 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ *
+ * rte_event_eth_rx_adapter_create() or
+ * rte_event_eth_adapter_create_with_params() configures the
+ * adapter with default value of maximum packets processed per
+ * iteration to 128.
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure
+ * maximum packets processed per iteration. This is alternative to using
+ * rte_event_eth_rx_adapter_create_ext() with parameter
+ * rte_event_eth_rx_adapter_conf::max_nb_rx
+ *
+ * This is valid for service based SW adapter only
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +405,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +771,69 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of the structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..ef9c3b86b2 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_init;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 13:46 ` Naga Harish K S V
@ 2023-02-10 13:46 ` Naga Harish K S V
2023-02-10 14:05 ` Jerin Jacob
2023-02-10 13:46 ` [PATCH v5 3/3] eventdev/crypto: " Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 1/3] eventdev/eth_rx: " Naga Harish K S V
2 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:46 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_eth_tx_adapter_runtime_params can be
configured and retrieved using
rte_event_eth_tx_adapter_runtime_params_set and
rte_event_eth_tx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_eth_tx_adapter.c | 132 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 9 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 115 ++++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 88 ++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 346 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..4e1d821bf9 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +986,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..02726115f0 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,12 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/get are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..131e11e01d 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -124,6 +124,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +667,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1295,115 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..9b1ac2055e 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,9 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_init()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +106,25 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ * This is valid for service based SW adapter only.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ * This is valid for service based SW adapter only.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +538,72 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param txa_params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params);
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * In case not all fields are to be updated, the suggested way to use this
+ * api is read the current values using rte_event_eth_tx_adapter_get_params(),
+ * modify the required parameters and then call
+ * rte_event_eth_tx_adapter_runtime_params_set().
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * This API is to be used after adding at least one queue to the adapter
+ * and is supported only for service based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index ef9c3b86b2..7b93736dff 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -124,6 +124,9 @@ EXPERIMENTAL {
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_init;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 13:46 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 14:05 ` Jerin Jacob
2023-02-10 15:01 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-02-10 14:05 UTC (permalink / raw)
To: Naga Harish K S V
Cc: jerinj, erik.g.carrillo, abhinandan.gujjar, dev, jay.jayatheerthan
On Fri, Feb 10, 2023 at 7:17 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter runtime configuration parameters defined in the
> struct rte_event_eth_tx_adapter_runtime_params can be
> configured and retrieved using
> rte_event_eth_tx_adapter_runtime_params_set and
rte_event_eth_tx_adapter_runtime_params_set()
> rte_event_eth_tx_adapter_runtime_params_get respectively.
rte_event_eth_tx_adapter_runtime_params_get()
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> @@ -225,3 +225,12 @@ Stop function stops the adapter runtime function from enqueueing any
> packets to the associated Tx queue. This API also frees any packets that
> may have been buffered for this queue. All inflight packets destined to the
> queue are freed by the adapter runtime until the queue is started again.
> +
> +Set/Get adapter runtime configuration parameters
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The runtime configuration parameters of adapter can be set/get using
> +``rte_event_eth_tx_adapter_runtime_params_set()`` and
> +``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
> +that can be set/get are defined in
> +``struct rte_event_eth_tx_adapter_runtime_params``.
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index cce50c3c18..131e11e01d 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -124,6 +124,8 @@ struct txa_service_data {
> uint16_t dev_count;
> /* Loop count to flush Tx buffers */
> int loop_cnt;
> + /* Loop count threshold to flush Tx buffers */
> + uint16_t flush_threshold;
> /* Per ethernet device structure */
> struct txa_service_ethdev *txa_ethdev;
> /* Statistics */
> @@ -665,13 +667,14 @@ txa_service_func(void *args)
> ret = 0;
> }
>
> - if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
> + if (txa->loop_cnt++ == txa->flush_threshold) {
>
> struct txa_service_ethdev *tdi;
> struct txa_service_queue_info *tqi;
> struct rte_eth_dev *dev;
> uint16_t i;
>
> + txa->loop_cnt = 0;
> tdi = txa->txa_ethdev;
> nb_tx = 0;
>
> @@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
> txa->service_id = TXA_INVALID_SERVICE_ID;
> rte_spinlock_init(&txa->tx_lock);
> txa_service_data_array[id] = txa;
> + txa->flush_threshold = TXA_FLUSH_THRESHOLD;
>
> return 0;
> }
> @@ -1291,6 +1295,115 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
> return ret;
> }
>
> +int
> +rte_event_eth_tx_adapter_runtime_params_init(
> + struct rte_event_eth_tx_adapter_runtime_params *txa_params)
> +{
> + if (txa_params == NULL)
> + return -EINVAL;
> +
> + memset(txa_params, 0, sizeof(*txa_params));
> + txa_params->max_nb_tx = TXA_MAX_NB_TX;
> + txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
> +
> + return 0;
> +}
> +
> +static int
> +txa_caps_check(uint8_t id, struct txa_service_data *txa)
> +{
> + uint32_t caps = 0;
> + struct rte_eth_dev *eth_dev = NULL;
> + struct txa_service_ethdev *tdi;
> + int i;
> +
> + if (!txa->dev_count)
> + return -EINVAL;
> +
> + /* The eth_dev used is always the same type.
> + * Hence first valid eth_dev is taken.
> + */
> + for (i = 0; i < txa->dev_count; i++) {
> + tdi = &txa->txa_ethdev[i];
> + if (tdi->nb_queues) {
> + eth_dev = tdi->dev;
> + break;
> + }
> + }
> + if (eth_dev == NULL)
> + return -EINVAL;
> +
> + if (txa_dev_caps_get(id))
> + txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
> +
> + if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> + return -ENOTSUP;
> +
> + return 0;
> +}
> +
> +int
> +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_eth_tx_adapter_runtime_params *txa_params)
> +{
> + struct txa_service_data *txa;
> + int ret;
> +
> + if (txa_lookup())
> + return -ENOMEM;
> +
> + TXA_CHECK_OR_ERR_RET(id);
> +
> + if (txa_params == NULL)
> + return -EINVAL;
> +
> + txa = txa_service_id_to_data(id);
> + if (txa == NULL)
> + return -EINVAL;
> +
> + ret = txa_caps_check(id, txa);
> + if (ret)
> + return ret;
> +
> + rte_spinlock_lock(&txa->tx_lock);
> + txa->flush_threshold = txa_params->flush_threshold;
> + txa->max_nb_tx = txa_params->max_nb_tx;
> + rte_spinlock_unlock(&txa->tx_lock);
> +
> + return 0;
> +}
> +
> +int
> +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_eth_tx_adapter_runtime_params *txa_params)
> +{
> + struct txa_service_data *txa;
> + int ret;
> +
> + if (txa_lookup())
> + return -ENOMEM;
> +
> + TXA_CHECK_OR_ERR_RET(id);
> +
> + if (txa_params == NULL)
> + return -EINVAL;
> +
> + txa = txa_service_id_to_data(id);
> + if (txa == NULL)
> + return -EINVAL;
> +
> + ret = txa_caps_check(id, txa);
> + if (ret)
> + return ret;
> +
> + rte_spinlock_lock(&txa->tx_lock);
> + txa_params->flush_threshold = txa->flush_threshold;
> + txa_params->max_nb_tx = txa->max_nb_tx;
> + rte_spinlock_unlock(&txa->tx_lock);
> +
> + return 0;
> +}
> +
> int
> rte_event_eth_tx_adapter_stop(uint8_t id)
> {
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
> index cd539af7ef..9b1ac2055e 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.h
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.h
> @@ -37,6 +37,9 @@
> * - rte_event_eth_tx_adapter_instance_get()
> * - rte_event_eth_tx_adapter_queue_start()
> * - rte_event_eth_tx_adapter_queue_stop()
> + * - rte_event_eth_tx_adapter_runtime_params_get()
> + * - rte_event_eth_tx_adapter_runtime_params_init()
> + * - rte_event_eth_tx_adapter_runtime_params_set()
> *
> * The application creates the adapter using
> * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
> @@ -103,6 +106,25 @@ struct rte_event_eth_tx_adapter_conf {
> */
> };
>
> +/**
> + * Adapter runtime configuration parameters
> + */
> +struct rte_event_eth_tx_adapter_runtime_params {
> + uint32_t max_nb_tx;
> + /**< The adapter can return early if it has processed at least
> + * max_nb_tx mbufs. This isn't treated as a requirement; batching may
> + * cause the adapter to process more than max_nb_tx mbufs.
> + * This is valid for service based SW adapter only.
express with RTE_EVENT_*CAP_INTERNAL_PORT
> + */
> + uint16_t flush_threshold;
> + /**< the number of service function iteration count to
> + * flush buffered packets.
> + * This is valid for service based SW adapter only.
express with RTE_EVENT_*CAP_INTERNAL_PORT
> + */
> + uint16_t rsvd[29];
> + /**< Reserved fields for future expansion */
> +};
> +
> /**
> * Function type used for adapter configuration callback. The callback is
> * used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
> @@ -516,6 +538,72 @@ __rte_experimental
> int
> rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
>
> +/**
> + * Initialize the adapter runtime configuration parameters with default values
> + *
> + * @param txa_params
> + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_tx_adapter_runtime_params_init(
> + struct rte_event_eth_tx_adapter_runtime_params *txa_params);
> +
> +/**
> + * Set the runtime configuration parameters for adapter.
> + *
> + * In case not all fields are to be updated, the suggested way to use this
> + * api is read the current values using rte_event_eth_tx_adapter_get_params(),
api -> API
Not relevent any more. Use rte_event_eth_tx_adapter_runtime_params_init().
i.e This sentence can be removed.
> + * modify the required parameters and then call
> + * rte_event_eth_tx_adapter_runtime_params_set().
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
This paragraph we can removed here as it is not generic API description.
> + *
> + * @param id
> + * Adapter identifier
> + * @param params
> + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
> + * with configuration parameter values. The reserved fields of this structure
> + * must be initialized to zero and the valid fields need to be set appropriately.
> + * This structure can be initialized using
> + * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
> + * application may reset this structure and update required fields.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_eth_tx_adapter_runtime_params *params);
> +
> +/**
> + * Get the runtime configuration parameters of adapter.
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
This paragraph we can removed here as it is not generic API description.
Similar comment to 3/3 patch. Also add chnagelog when sending next version
to know what is changed.
> + *
> + * @param id
> + * Adapter identifier
> + * @param[out] params
> + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
> + * containing valid Tx adapter parameters when return value is 0.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_eth_tx_adapter_runtime_params *params);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index ef9c3b86b2..7b93736dff 100644
> --- a/lib/eventdev/version.map
> +++ b/lib/eventdev/version.map
> @@ -124,6 +124,9 @@ EXPERIMENTAL {
> rte_event_eth_rx_adapter_runtime_params_get;
> rte_event_eth_rx_adapter_runtime_params_init;
> rte_event_eth_rx_adapter_runtime_params_set;
> + rte_event_eth_tx_adapter_runtime_params_get;
> + rte_event_eth_tx_adapter_runtime_params_init;
> + rte_event_eth_tx_adapter_runtime_params_set;
> rte_event_timer_remaining_ticks_get;
> };
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 14:05 ` Jerin Jacob
@ 2023-02-10 15:01 ` Naga Harish K, S V
2023-02-10 15:24 ` Jerin Jacob
0 siblings, 1 reply; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-10 15:01 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, February 10, 2023 7:36 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
>
> On Fri, Feb 10, 2023 at 7:17 PM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > The adapter runtime configuration parameters defined in the struct
> > rte_event_eth_tx_adapter_runtime_params can be configured and
> > retrieved using rte_event_eth_tx_adapter_runtime_params_set and
> rte_event_eth_tx_adapter_runtime_params_set()
>
> > rte_event_eth_tx_adapter_runtime_params_get respectively.
>
> rte_event_eth_tx_adapter_runtime_params_get()
>
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
>
> > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
> > @@ -225,3 +225,12 @@ Stop function stops the adapter runtime function
> > from enqueueing any packets to the associated Tx queue. This API also
> > frees any packets that may have been buffered for this queue. All
> > inflight packets destined to the queue are freed by the adapter runtime
> until the queue is started again.
> > +
> > +Set/Get adapter runtime configuration parameters
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +The runtime configuration parameters of adapter can be set/get using
> > +``rte_event_eth_tx_adapter_runtime_params_set()`` and
> > +``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The
> > +parameters that can be set/get are defined in ``struct
> > +rte_event_eth_tx_adapter_runtime_params``.
> > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > index cce50c3c18..131e11e01d 100644
> > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > @@ -124,6 +124,8 @@ struct txa_service_data {
> > uint16_t dev_count;
> > /* Loop count to flush Tx buffers */
> > int loop_cnt;
> > + /* Loop count threshold to flush Tx buffers */
> > + uint16_t flush_threshold;
> > /* Per ethernet device structure */
> > struct txa_service_ethdev *txa_ethdev;
> > /* Statistics */
> > @@ -665,13 +667,14 @@ txa_service_func(void *args)
> > ret = 0;
> > }
> >
> > - if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
> > + if (txa->loop_cnt++ == txa->flush_threshold) {
> >
> > struct txa_service_ethdev *tdi;
> > struct txa_service_queue_info *tqi;
> > struct rte_eth_dev *dev;
> > uint16_t i;
> >
> > + txa->loop_cnt = 0;
> > tdi = txa->txa_ethdev;
> > nb_tx = 0;
> >
> > @@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct
> rte_eventdev *dev,
> > txa->service_id = TXA_INVALID_SERVICE_ID;
> > rte_spinlock_init(&txa->tx_lock);
> > txa_service_data_array[id] = txa;
> > + txa->flush_threshold = TXA_FLUSH_THRESHOLD;
> >
> > return 0;
> > }
> > @@ -1291,6 +1295,115 @@
> rte_event_eth_tx_adapter_stats_reset(uint8_t id)
> > return ret;
> > }
> >
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_init(
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*txa_params) {
> > + if (txa_params == NULL)
> > + return -EINVAL;
> > +
> > + memset(txa_params, 0, sizeof(*txa_params));
> > + txa_params->max_nb_tx = TXA_MAX_NB_TX;
> > + txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +txa_caps_check(uint8_t id, struct txa_service_data *txa) {
> > + uint32_t caps = 0;
> > + struct rte_eth_dev *eth_dev = NULL;
> > + struct txa_service_ethdev *tdi;
> > + int i;
> > +
> > + if (!txa->dev_count)
> > + return -EINVAL;
> > +
> > + /* The eth_dev used is always the same type.
> > + * Hence first valid eth_dev is taken.
> > + */
> > + for (i = 0; i < txa->dev_count; i++) {
> > + tdi = &txa->txa_ethdev[i];
> > + if (tdi->nb_queues) {
> > + eth_dev = tdi->dev;
> > + break;
> > + }
> > + }
> > + if (eth_dev == NULL)
> > + return -EINVAL;
> > +
> > + if (txa_dev_caps_get(id))
> > + txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
> > +
> > + if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> > + return -ENOTSUP;
> > +
> > + return 0;
> > +}
> > +
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*txa_params) {
> > + struct txa_service_data *txa;
> > + int ret;
> > +
> > + if (txa_lookup())
> > + return -ENOMEM;
> > +
> > + TXA_CHECK_OR_ERR_RET(id);
> > +
> > + if (txa_params == NULL)
> > + return -EINVAL;
> > +
> > + txa = txa_service_id_to_data(id);
> > + if (txa == NULL)
> > + return -EINVAL;
> > +
> > + ret = txa_caps_check(id, txa);
> > + if (ret)
> > + return ret;
> > +
> > + rte_spinlock_lock(&txa->tx_lock);
> > + txa->flush_threshold = txa_params->flush_threshold;
> > + txa->max_nb_tx = txa_params->max_nb_tx;
> > + rte_spinlock_unlock(&txa->tx_lock);
> > +
> > + return 0;
> > +}
> > +
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*txa_params) {
> > + struct txa_service_data *txa;
> > + int ret;
> > +
> > + if (txa_lookup())
> > + return -ENOMEM;
> > +
> > + TXA_CHECK_OR_ERR_RET(id);
> > +
> > + if (txa_params == NULL)
> > + return -EINVAL;
> > +
> > + txa = txa_service_id_to_data(id);
> > + if (txa == NULL)
> > + return -EINVAL;
> > +
> > + ret = txa_caps_check(id, txa);
> > + if (ret)
> > + return ret;
> > +
> > + rte_spinlock_lock(&txa->tx_lock);
> > + txa_params->flush_threshold = txa->flush_threshold;
> > + txa_params->max_nb_tx = txa->max_nb_tx;
> > + rte_spinlock_unlock(&txa->tx_lock);
> > +
> > + return 0;
> > +}
> > +
> > int
> > rte_event_eth_tx_adapter_stop(uint8_t id) { diff --git
> > a/lib/eventdev/rte_event_eth_tx_adapter.h
> > b/lib/eventdev/rte_event_eth_tx_adapter.h
> > index cd539af7ef..9b1ac2055e 100644
> > --- a/lib/eventdev/rte_event_eth_tx_adapter.h
> > +++ b/lib/eventdev/rte_event_eth_tx_adapter.h
> > @@ -37,6 +37,9 @@
> > * - rte_event_eth_tx_adapter_instance_get()
> > * - rte_event_eth_tx_adapter_queue_start()
> > * - rte_event_eth_tx_adapter_queue_stop()
> > + * - rte_event_eth_tx_adapter_runtime_params_get()
> > + * - rte_event_eth_tx_adapter_runtime_params_init()
> > + * - rte_event_eth_tx_adapter_runtime_params_set()
> > *
> > * The application creates the adapter using
> > * rte_event_eth_tx_adapter_create() or
> rte_event_eth_tx_adapter_create_ext().
> > @@ -103,6 +106,25 @@ struct rte_event_eth_tx_adapter_conf {
> > */
> > };
> >
> > +/**
> > + * Adapter runtime configuration parameters */ struct
> > +rte_event_eth_tx_adapter_runtime_params {
> > + uint32_t max_nb_tx;
> > + /**< The adapter can return early if it has processed at least
> > + * max_nb_tx mbufs. This isn't treated as a requirement; batching may
> > + * cause the adapter to process more than max_nb_tx mbufs.
> > + * This is valid for service based SW adapter only.
>
> express with RTE_EVENT_*CAP_INTERNAL_PORT
>
> > + */
> > + uint16_t flush_threshold;
> > + /**< the number of service function iteration count to
> > + * flush buffered packets.
> > + * This is valid for service based SW adapter only.
>
> express with RTE_EVENT_*CAP_INTERNAL_PORT
>
>
> > + */
> > + uint16_t rsvd[29];
> > + /**< Reserved fields for future expansion */ };
> > +
> > /**
> > * Function type used for adapter configuration callback. The callback is
> > * used to fill in members of the struct
> > rte_event_eth_tx_adapter_conf, this @@ -516,6 +538,72 @@
> > __rte_experimental int rte_event_eth_tx_adapter_queue_stop(uint16_t
> > eth_dev_id, uint16_t tx_queue_id);
> >
> > +/**
> > + * Initialize the adapter runtime configuration parameters with
> > +default values
> > + *
> > + * @param txa_params
> > + * A pointer to structure of type struct
> > +rte_event_eth_tx_adapter_runtime_params
> > + *
> > + * @return
> > + * - 0: Success
> > + * - <0: Error code on failure
> > + */
> > +__rte_experimental
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_init(
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*txa_params);
> > +
> > +/**
> > + * Set the runtime configuration parameters for adapter.
> > + *
> > + * In case not all fields are to be updated, the suggested way to use
> > +this
> > + * api is read the current values using
> > +rte_event_eth_tx_adapter_get_params(),
>
> api -> API
>
> Not relevent any more. Use
> rte_event_eth_tx_adapter_runtime_params_init().
> i.e This sentence can be removed.
>
>
> > + * modify the required parameters and then call
> > + * rte_event_eth_tx_adapter_runtime_params_set().
>
>
>
> > + *
> > + * This API is to be used after adding at least one queue to the
> > + adapter
> > + * and is supported only for service based adapter.
>
> This paragraph we can removed here as it is not generic API description.
>
This sequence is still needed as the "max_nb_tx" parameter of the adapter is configured
during the addition of first queue to the adapter with the default value. If params_set() is
called before adding the first queue, the params of the adapter will be overwritten to the
default value later during the first queue add.
> > + *
> > + * @param id
> > + * Adapter identifier
> > + * @param params
> > + * A pointer to structure of type struct
> > +rte_event_eth_tx_adapter_runtime_params
> > + * with configuration parameter values. The reserved fields of this
> > +structure
> > + * must be initialized to zero and the valid fields need to be set
> appropriately.
> > + * This structure can be initialized using
> > + * rte_event_eth_tx_adapter_runtime_params_init() API to default
> > +values or
> > + * application may reset this structure and update required fields.
> > + *
> > + * @return
> > + * - 0: Success
> > + * - <0: Error code on failure
> > + */
> > +__rte_experimental
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*params);
> > +
> > +/**
> > + * Get the runtime configuration parameters of adapter.
> > + *
> > + * This API is to be used after adding at least one queue to the
> > +adapter
> > + * and is supported only for service based adapter.
>
> This paragraph we can removed here as it is not generic API description.
>
Same as above.
> Similar comment to 3/3 patch. Also add chnagelog when sending next version
> to know what is changed.
>
> > + *
> > + * @param id
> > + * Adapter identifier
> > + * @param[out] params
> > + * A pointer to structure of type struct
> > +rte_event_eth_tx_adapter_runtime_params
> > + * containing valid Tx adapter parameters when return value is 0.
> > + *
> > + * @return
> > + * - 0: Success
> > + * - <0: Error code on failure
> > + */
> > +__rte_experimental
> > +int
> > +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
> > + struct rte_event_eth_tx_adapter_runtime_params
> > +*params);
> > +
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index
> > ef9c3b86b2..7b93736dff 100644
> > --- a/lib/eventdev/version.map
> > +++ b/lib/eventdev/version.map
> > @@ -124,6 +124,9 @@ EXPERIMENTAL {
> > rte_event_eth_rx_adapter_runtime_params_get;
> > rte_event_eth_rx_adapter_runtime_params_init;
> > rte_event_eth_rx_adapter_runtime_params_set;
> > + rte_event_eth_tx_adapter_runtime_params_get;
> > + rte_event_eth_tx_adapter_runtime_params_init;
> > + rte_event_eth_tx_adapter_runtime_params_set;
> > rte_event_timer_remaining_ticks_get;
> > };
> >
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 15:01 ` Naga Harish K, S V
@ 2023-02-10 15:24 ` Jerin Jacob
2023-02-10 17:41 ` Naga Harish K, S V
0 siblings, 1 reply; 53+ messages in thread
From: Jerin Jacob @ 2023-02-10 15:24 UTC (permalink / raw)
To: Naga Harish K, S V
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
On Fri, Feb 10, 2023 at 8:32 PM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Friday, February 10, 2023 7:36 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> > Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> > Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
> >
> > On Fri, Feb 10, 2023 at 7:17 PM Naga Harish K S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > > The adapter runtime configuration parameters defined in the struct
> > > rte_event_eth_tx_adapter_runtime_params can be configured and
> > > retrieved using rte_event_eth_tx_adapter_runtime_params_set and
> > rte_event_eth_tx_adapter_runtime_params_set()
> >
> > > rte_event_eth_tx_adapter_runtime_params_get respectively.
> >
> > rte_event_eth_tx_adapter_runtime_params_get()
> >
> > >
> > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> >
> > Not relevent any more. Use
> > rte_event_eth_tx_adapter_runtime_params_init().
> > i.e This sentence can be removed.
> >
> >
> > > + * modify the required parameters and then call
> > > + * rte_event_eth_tx_adapter_runtime_params_set().
> >
> >
> >
> > > + *
> > > + * This API is to be used after adding at least one queue to the
> > > + adapter
> > > + * and is supported only for service based adapter.
> >
> > This paragraph we can removed here as it is not generic API description.
> >
>
> This sequence is still needed as the "max_nb_tx" parameter of the adapter is configured
A specific parameter specific constrain can go in the parameter
Doxygen comments.
i.e comment for "max_nb_tx" parameter.
> during the addition of first queue to the adapter with the default value. If params_set() is
> called before adding the first queue, the params of the adapter will be overwritten to the
> default value later during the first queue add.
^ permalink raw reply [flat|nested] 53+ messages in thread
* RE: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 15:24 ` Jerin Jacob
@ 2023-02-10 17:41 ` Naga Harish K, S V
0 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K, S V @ 2023-02-10 17:41 UTC (permalink / raw)
To: Jerin Jacob
Cc: jerinj, Carrillo, Erik G, Gujjar, Abhinandan S, dev, Jayatheerthan, Jay
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Friday, February 10, 2023 8:55 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org;
> Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
>
> On Fri, Feb 10, 2023 at 8:32 PM Naga Harish K, S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jerin Jacob <jerinjacobk@gmail.com>
> > > Sent: Friday, February 10, 2023 7:36 PM
> > > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: jerinj@marvell.com; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; dev@dpdk.org; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Subject: Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs
> > >
> > > On Fri, Feb 10, 2023 at 7:17 PM Naga Harish K S V
> > > <s.v.naga.harish.k@intel.com> wrote:
> > > >
> > > > The adapter runtime configuration parameters defined in the struct
> > > > rte_event_eth_tx_adapter_runtime_params can be configured and
> > > > retrieved using rte_event_eth_tx_adapter_runtime_params_set and
> > > rte_event_eth_tx_adapter_runtime_params_set()
> > >
> > > > rte_event_eth_tx_adapter_runtime_params_get respectively.
> > >
> > > rte_event_eth_tx_adapter_runtime_params_get()
> > >
> > > >
> > > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > >
> > > Not relevent any more. Use
> > > rte_event_eth_tx_adapter_runtime_params_init().
> > > i.e This sentence can be removed.
> > >
> > >
> > > > + * modify the required parameters and then call
> > > > + * rte_event_eth_tx_adapter_runtime_params_set().
> > >
> > >
> > >
> > > > + *
> > > > + * This API is to be used after adding at least one queue to the
> > > > + adapter
> > > > + * and is supported only for service based adapter.
> > >
> > > This paragraph we can removed here as it is not generic API description.
> > >
> >
> > This sequence is still needed as the "max_nb_tx" parameter of the
> > adapter is configured
>
> A specific parameter specific constrain can go in the parameter Doxygen
> comments.
> i.e comment for "max_nb_tx" parameter.
>
>
Done. Updated max_nb_tx parameter doxygen in v6 patchset.
> > during the addition of first queue to the adapter with the default
> > value. If params_set() is called before adding the first queue, the
> > params of the adapter will be overwritten to the default value later during
> the first queue add.
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 13:46 ` Naga Harish K S V
2023-02-10 13:46 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 13:46 ` Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 1/3] eventdev/eth_rx: " Naga Harish K S V
2 siblings, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 13:46 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_crypto_adapter_runtime_params can be configured
and retrieved using rte_event_crypto_adapter_runtime_params_set
and rte_event_eth_rx_adapter_runtime_params_get respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 8 ++
lib/eventdev/rte_event_crypto_adapter.c | 101 ++++++++++++++++
lib/eventdev/rte_event_crypto_adapter.h | 80 +++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 301 insertions(+)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..1b6d4a0966 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,11 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/get are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..f6c1e5380d 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -1335,6 +1335,107 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..c1c4c62ef7 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,9 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_init()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +256,20 @@ struct rte_event_crypto_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ * This is valid for service based SW adapter only.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +625,69 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * This API needs to be called after adding at least one qp to the adapter
+ * and is supported only for the service-based adapter.
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 7b93736dff..3b17c84eae 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_init;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v6 1/3] eventdev/eth_rx: add params set/get APIs
2023-02-10 13:46 ` Naga Harish K S V
2023-02-10 13:46 ` [PATCH v5 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-10 13:46 ` [PATCH v5 3/3] eventdev/crypto: " Naga Harish K S V
@ 2023-02-10 17:37 ` Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 2/3] eventdev/eth_tx: " Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 3/3] eventdev/crypto: " Naga Harish K S V
2 siblings, 2 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 17:37 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_eth_rx_adapter_runtime_params can be configured
and retrieved using rte_event_eth_rx_adapter_runtime_params_set() and
rte_event_eth_tx_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
v6:
* updated doxygen comments as per review comments
---
---
app/test/test_event_eth_rx_adapter.c | 113 ++++++++++++++++++
.../prog_guide/event_ethernet_rx_adapter.rst | 8 ++
lib/eventdev/rte_event_eth_rx_adapter.c | 101 +++++++++++++++-
lib/eventdev/rte_event_eth_rx_adapter.h | 88 +++++++++++++-
lib/eventdev/version.map | 3 +
5 files changed, 311 insertions(+), 2 deletions(-)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1da7782560..cfe6052d7e 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1198,6 +1198,117 @@ adapter_intrq_instance_get(void)
return TEST_SUCCESS;
}
+static int
+adapter_get_set_params(void)
+{
+ int err;
+ struct rte_event_eth_rx_adapter_runtime_params in_params;
+ struct rte_event_eth_rx_adapter_runtime_params out_params;
+ struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+ struct rte_event ev;
+
+ ev.queue_id = 0;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.priority = 0;
+ ev.flow_id = 1;
+
+ queue_config.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ queue_config.ev = ev;
+ queue_config.servicing_weight = 1;
+
+ err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0,
+ &queue_config);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_rx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by Rx adapter */
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
+ in_params.max_nb_rx = 32;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 3: Set max_nb_rx = 192 */
+ in_params.max_nb_rx = 192;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 4: Set max_nb_rx = 256 */
+ in_params.max_nb_rx = 256;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 5: Set max_nb_rx = 30(<BATCH_SIZE) */
+ in_params.max_nb_rx = 30;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ /* Case 6: Set max_nb_rx = 512 */
+ in_params.max_nb_rx = 512;
+
+ err = rte_event_eth_rx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_rx == out_params.max_nb_rx,
+ "Expected %u got %u",
+ in_params.max_nb_rx, out_params.max_nb_rx);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, 0);
+ TEST_ASSERT(err == 0, "Expected 0 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,
@@ -1218,6 +1329,8 @@ static struct unit_test_suite event_eth_rx_tests = {
adapter_queue_stats_test),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_pollq_instance_get),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_get_set_params),
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 461eca566f..72614ce714 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -185,6 +185,14 @@ 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``.
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_eth_rx_adapter_runtime_params_set()`` and
+``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/get are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.
+
Getting and resetting Adapter queue stats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index b5b4ffebd3..c1cd124002 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -35,6 +35,8 @@
#define MAX_VECTOR_NS 1E9
#define MIN_VECTOR_NS 1E5
+#define RXA_NB_RX_WORK_DEFAULT 128
+
#define ETH_RX_ADAPTER_SERVICE_NAME_LEN 32
#define ETH_RX_ADAPTER_MEM_NAME_LEN 32
@@ -1554,7 +1556,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
}
conf->event_port_id = port_id;
- conf->max_nb_rx = 128;
+ conf->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
if (started)
ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
@@ -3461,6 +3463,103 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
return -EINVAL;
}
+static int
+rxa_caps_check(struct event_eth_rx_adapter *rxa)
+{
+ uint16_t eth_dev_id;
+ uint32_t caps = 0;
+ int ret;
+
+ if (!rxa->nb_queues)
+ return -EINVAL;
+
+ /* The eth_dev used is always of same type.
+ * Hence eth_dev_id is taken from first entry of poll array.
+ */
+ eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
+ ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
+ eth_dev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
+ "eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
+ return ret;
+ }
+
+ if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
+ params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&rxa->rx_lock);
+ rxa->max_nb_rx = params->max_nb_rx;
+ rte_spinlock_unlock(&rxa->rx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params)
+{
+ struct event_eth_rx_adapter *rxa;
+ int ret;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (rxa_memzone_lookup())
+ return -ENOMEM;
+
+ rxa = rxa_id_to_adapter(id);
+ if (rxa == NULL)
+ return -EINVAL;
+
+ ret = rxa_caps_check(rxa);
+ if (ret)
+ return ret;
+
+ params->max_nb_rx = rxa->max_nb_rx;
+
+ return 0;
+}
+
+/* RX-adapter telemetry callbacks */
#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_uint(d, #s, stats.s)
static int
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index f4652f40e8..fe2a6bdd2c 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -39,10 +39,14 @@
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
* - rte_event_eth_rx_adapter_instance_get()
+ * - rte_event_eth_rx_adapter_runtime_params_get()
+ * - rte_event_eth_rx_adapter_runtime_params_init()
+ * - rte_event_eth_rx_adapter_runtime_params_set()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
* or rte_event_eth_rx_adapter_create_with_params() functions.
+ *
* The adapter needs to know which ethernet rx queues to poll for mbufs as well
* as event device parameters such as the event queue identifier, event
* priority and scheduling type that the adapter should use when constructing
@@ -299,6 +303,31 @@ struct rte_event_eth_rx_adapter_params {
/**< flag to indicate that event buffer is separate for each queue */
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_rx_adapter_runtime_params {
+ uint32_t max_nb_rx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_rx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_rx mbufs.
+ *
+ * rte_event_eth_rx_adapter_create() or
+ * rte_event_eth_adapter_create_with_params() configures the
+ * adapter with default value of max_nb_rx.
+ * rte_event_eth_rx_adapter_create_ext() configures the adapter with
+ * user provided value of max_nb_rx through
+ * rte_event_eth_rx_adapter_conf::max_nb_rx parameter.
+ * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure
+ * max_nb_rx during runtime (after adding at least one queue)
+ *
+ * This is valid for the devices without
+ * RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT capability.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future use */
+};
+
/**
*
* Callback function invoked by the SW adapter before it continues
@@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
* Create a new ethernet Rx event adapter with the specified identifier.
* This function uses an internal configuration function that creates an event
* port. This default function reconfigures the event device with an
- * additional event port and setups up the event port using the port_config
+ * additional event port and setup the event port using the port_config
* parameter passed into this function. In case the application needs more
* control in configuration of the service, it should use the
* rte_event_eth_rx_adapter_create_ext() version.
@@ -743,6 +772,63 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
uint16_t rx_queue_id,
uint8_t *rxa_inst_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_init(
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of the structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_rx_adapter_runtime_params_init() to default values or
+ * application may reset this structure and update the required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_rx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 3add5e3088..ef9c3b86b2 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_eth_rx_adapter_runtime_params_get;
+ rte_event_eth_rx_adapter_runtime_params_init;
+ rte_event_eth_rx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v6 2/3] eventdev/eth_tx: add params set/get APIs
2023-02-10 17:37 ` [PATCH v6 1/3] eventdev/eth_rx: " Naga Harish K S V
@ 2023-02-10 17:37 ` Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 3/3] eventdev/crypto: " Naga Harish K S V
1 sibling, 0 replies; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 17:37 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_eth_tx_adapter_runtime_params can be
configured and retrieved using
rte_event_eth_tx_adapter_runtime_params_set() and
rte_event_eth_tx_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
v6:
* updated doxygen comments as per review comments
---
---
app/test/test_event_eth_tx_adapter.c | 132 ++++++++++++++++++
.../prog_guide/event_ethernet_tx_adapter.rst | 9 ++
lib/eventdev/rte_event_eth_tx_adapter.c | 115 ++++++++++++++-
lib/eventdev/rte_event_eth_tx_adapter.h | 89 ++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 347 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index c19a87a86a..4e1d821bf9 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -40,6 +40,8 @@ test_event_eth_tx_adapter_common(void)
#define PORT(p) default_params.port[(p)]
#define TEST_ETHDEV_ID PORT(0)
#define TEST_ETHDEV_PAIR_ID PORT(PAIR_PORT_INDEX(0))
+#define DEFAULT_FLUSH_THRESHOLD 1024
+#define TXA_NB_TX_WORK_DEFAULT 128
#define EDEV_RETRY 0xffff
@@ -795,6 +797,134 @@ tx_adapter_queue_start_stop(void)
return TEST_SUCCESS;
}
+static int
+tx_adapter_set_get_params(void)
+{
+ int err;
+ struct rte_event_eth_tx_adapter_runtime_params in_params;
+ struct rte_event_eth_tx_adapter_runtime_params out_params;
+
+ err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_eth_tx_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default values of adapter */
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(out_params.flush_threshold == DEFAULT_FLUSH_THRESHOLD,
+ "Expected %u got %u",
+ DEFAULT_FLUSH_THRESHOLD, out_params.flush_threshold);
+ TEST_ASSERT(out_params.max_nb_tx == TXA_NB_TX_WORK_DEFAULT,
+ "Expected %u got %u",
+ TXA_NB_TX_WORK_DEFAULT, out_params.max_nb_tx);
+
+ /* Case 2: Set max_nb_tx = 32 (=TXA_BATCH_SEIZE) */
+ in_params.max_nb_tx = 32;
+ in_params.flush_threshold = DEFAULT_FLUSH_THRESHOLD;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ /* Case 3: Set max_nb_tx = 192 */
+ in_params.max_nb_tx = 192;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 4: Set max_nb_tx = 256 */
+ in_params.max_nb_tx = 256;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 5: Set max_nb_tx = 30(<TXA_BATCH_SIZE) */
+ in_params.max_nb_tx = 30;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 6: Set max_nb_tx = 512 */
+ in_params.max_nb_tx = 512;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+
+ /* Case 7: Set flush_threshold = 10 */
+ in_params.max_nb_tx = 128;
+ in_params.flush_threshold = 10;
+
+ err = rte_event_eth_tx_adapter_runtime_params_set(TEST_INST_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_tx_adapter_runtime_params_get(TEST_INST_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb_tx == out_params.max_nb_tx,
+ "Expected %u got %u",
+ in_params.max_nb_tx, out_params.max_nb_tx);
+ TEST_ASSERT(in_params.flush_threshold == out_params.flush_threshold,
+ "Expected %u got %u",
+ in_params.flush_threshold, out_params.flush_threshold);
+
+ err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID,
+ 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ return TEST_SUCCESS;
+}
+
static int
tx_adapter_dynamic_device(void)
{
@@ -856,6 +986,8 @@ static struct unit_test_suite event_eth_tx_tests = {
tx_adapter_instance_get),
TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
tx_adapter_queue_start_stop),
+ TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+ tx_adapter_set_get_params),
TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
TEST_CASES_END() /**< NULL terminate unit test array */
}
diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
index d8f9a58571..02726115f0 100644
--- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst
@@ -225,3 +225,12 @@ Stop function stops the adapter runtime function from enqueueing any
packets to the associated Tx queue. This API also frees any packets that
may have been buffered for this queue. All inflight packets destined to the
queue are freed by the adapter runtime until the queue is started again.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_eth_tx_adapter_runtime_params_set()`` and
+``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters
+that can be set/get are defined in
+``struct rte_event_eth_tx_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index cce50c3c18..131e11e01d 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -124,6 +124,8 @@ struct txa_service_data {
uint16_t dev_count;
/* Loop count to flush Tx buffers */
int loop_cnt;
+ /* Loop count threshold to flush Tx buffers */
+ uint16_t flush_threshold;
/* Per ethernet device structure */
struct txa_service_ethdev *txa_ethdev;
/* Statistics */
@@ -665,13 +667,14 @@ txa_service_func(void *args)
ret = 0;
}
- if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
+ if (txa->loop_cnt++ == txa->flush_threshold) {
struct txa_service_ethdev *tdi;
struct txa_service_queue_info *tqi;
struct rte_eth_dev *dev;
uint16_t i;
+ txa->loop_cnt = 0;
tdi = txa->txa_ethdev;
nb_tx = 0;
@@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev,
txa->service_id = TXA_INVALID_SERVICE_ID;
rte_spinlock_init(&txa->tx_lock);
txa_service_data_array[id] = txa;
+ txa->flush_threshold = TXA_FLUSH_THRESHOLD;
return 0;
}
@@ -1291,6 +1295,115 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id)
return ret;
}
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ memset(txa_params, 0, sizeof(*txa_params));
+ txa_params->max_nb_tx = TXA_MAX_NB_TX;
+ txa_params->flush_threshold = TXA_FLUSH_THRESHOLD;
+
+ return 0;
+}
+
+static int
+txa_caps_check(uint8_t id, struct txa_service_data *txa)
+{
+ uint32_t caps = 0;
+ struct rte_eth_dev *eth_dev = NULL;
+ struct txa_service_ethdev *tdi;
+ int i;
+
+ if (!txa->dev_count)
+ return -EINVAL;
+
+ /* The eth_dev used is always the same type.
+ * Hence first valid eth_dev is taken.
+ */
+ for (i = 0; i < txa->dev_count; i++) {
+ tdi = &txa->txa_ethdev[i];
+ if (tdi->nb_queues) {
+ eth_dev = tdi->dev;
+ break;
+ }
+ }
+ if (eth_dev == NULL)
+ return -EINVAL;
+
+ if (txa_dev_caps_get(id))
+ txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps);
+
+ if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa->flush_threshold = txa_params->flush_threshold;
+ txa->max_nb_tx = txa_params->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params)
+{
+ struct txa_service_data *txa;
+ int ret;
+
+ if (txa_lookup())
+ return -ENOMEM;
+
+ TXA_CHECK_OR_ERR_RET(id);
+
+ if (txa_params == NULL)
+ return -EINVAL;
+
+ txa = txa_service_id_to_data(id);
+ if (txa == NULL)
+ return -EINVAL;
+
+ ret = txa_caps_check(id, txa);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&txa->tx_lock);
+ txa_params->flush_threshold = txa->flush_threshold;
+ txa_params->max_nb_tx = txa->max_nb_tx;
+ rte_spinlock_unlock(&txa->tx_lock);
+
+ return 0;
+}
+
int
rte_event_eth_tx_adapter_stop(uint8_t id)
{
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index cd539af7ef..1ea9a15316 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -37,6 +37,9 @@
* - rte_event_eth_tx_adapter_instance_get()
* - rte_event_eth_tx_adapter_queue_start()
* - rte_event_eth_tx_adapter_queue_stop()
+ * - rte_event_eth_tx_adapter_runtime_params_get()
+ * - rte_event_eth_tx_adapter_runtime_params_init()
+ * - rte_event_eth_tx_adapter_runtime_params_set()
*
* The application creates the adapter using
* rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
@@ -103,6 +106,37 @@ struct rte_event_eth_tx_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_eth_tx_adapter_runtime_params {
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ *
+ * rte_event_eth_tx_adapter_create() configures the
+ * adapter with default value of max_nb_tx.
+ * rte_event_eth_tx_adapter_create_ext() configures the adapter with
+ * user provided value of max_nb_tx through
+ * rte_event_eth_tx_adapter_conf::max_nb_tx parameter.
+ * rte_event_eth_tx_adapter_runtime_params_set() allows to re-configure
+ * max_nb_tx during runtime (after adding at least one queue)
+ *
+ * This is valid for the devices without
+ * RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT capability.
+ */
+ uint16_t flush_threshold;
+ /**< the number of service function iteration count to
+ * flush buffered packets.
+ *
+ * This is valid for the devices without
+ * RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT capability.
+ */
+ uint16_t rsvd[29];
+ /**< Reserved fields for future expansion */
+};
+
/**
* Function type used for adapter configuration callback. The callback is
* used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
@@ -516,6 +550,61 @@ __rte_experimental
int
rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id);
+/**
+ * Initialize the adapter runtime configuration parameters with default values
+ *
+ * @param txa_params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_init(
+ struct rte_event_eth_tx_adapter_runtime_params *txa_params);
+
+/**
+ * Set the runtime configuration parameters for adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This structure can be initialized using
+ * rte_event_eth_tx_adapter_runtime_params_init() API to default values or
+ * application may reset this structure and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
+/**
+ * Get the runtime configuration parameters of adapter.
+ *
+ * @param id
+ * Adapter identifier
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params
+ * containing valid Tx adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_eth_tx_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_runtime_params *params);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index ef9c3b86b2..7b93736dff 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -124,6 +124,9 @@ EXPERIMENTAL {
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
+ rte_event_eth_tx_adapter_runtime_params_get;
+ rte_event_eth_tx_adapter_runtime_params_init;
+ rte_event_eth_tx_adapter_runtime_params_set;
rte_event_timer_remaining_ticks_get;
};
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v6 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 17:37 ` [PATCH v6 1/3] eventdev/eth_rx: " Naga Harish K S V
2023-02-10 17:37 ` [PATCH v6 2/3] eventdev/eth_tx: " Naga Harish K S V
@ 2023-02-10 17:37 ` Naga Harish K S V
2023-02-13 5:08 ` Jerin Jacob
1 sibling, 1 reply; 53+ messages in thread
From: Naga Harish K S V @ 2023-02-10 17:37 UTC (permalink / raw)
To: jerinj, erik.g.carrillo, abhinandan.gujjar; +Cc: dev, jay.jayatheerthan
The adapter runtime configuration parameters defined in the
struct rte_event_crypto_adapter_runtime_params can be configured
and retrieved using rte_event_crypto_adapter_runtime_params_set()
and rte_event_eth_rx_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
v6:
* updated doxygen comments as per review comments
---
---
app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
.../prog_guide/event_crypto_adapter.rst | 8 ++
lib/eventdev/rte_event_crypto_adapter.c | 101 ++++++++++++++++
lib/eventdev/rte_event_crypto_adapter.h | 85 ++++++++++++++
lib/eventdev/version.map | 3 +
5 files changed, 306 insertions(+)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index a38e389abd..264d6f731e 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
return TEST_SUCCESS;
}
+static int
+test_crypto_adapter_params(void)
+{
+ int err;
+ struct rte_event_crypto_adapter_runtime_params in_params;
+ struct rte_event_crypto_adapter_runtime_params out_params;
+ uint32_t cap;
+ struct rte_event_crypto_adapter_queue_conf queue_conf = {
+ .ev = response_info,
+ };
+
+ err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
+ TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
+
+ if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
+ } else
+ err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
+
+ TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
+
+ err = rte_event_crypto_adapter_runtime_params_init(&in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ err = rte_event_crypto_adapter_runtime_params_init(&out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 1: Get the default value of mbufs processed by adapter */
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
+ in_params.max_nb = 32;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 3: Set max_nb = 192 */
+ in_params.max_nb = 192;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 4: Set max_nb = 256 */
+ in_params.max_nb = 256;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
+ in_params.max_nb = 30;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ /* Case 6: Set max_nb = 512 */
+ in_params.max_nb = 512;
+
+ err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
+ &in_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
+ &out_params);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
+ in_params.max_nb, out_params.max_nb);
+
+ err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ TEST_CDEV_ID, TEST_CDEV_QP_ID);
+ TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
static int
test_op_forward_mode(uint8_t session_less)
{
@@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
test_crypto_adapter_free,
test_crypto_adapter_stats),
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_params),
+
TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
test_crypto_adapter_stop,
test_session_with_op_forward_mode),
diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 46b3dc2f1c..1b6d4a0966 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -350,3 +350,11 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
enqueued event counts are a sum of the counts from the eventdev PMD callbacks
if the callback is supported, and the counts maintained by the service function,
if one exists.
+
+Set/Get adapter runtime configuration parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The runtime configuration parameters of adapter can be set/get using
+``rte_event_crypto_adapter_runtime_params_set()`` and
+``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
+can be set/get are defined in ``struct rte_event_crypto_adapter_runtime_params``.
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 7f0a25a4cc..f6c1e5380d 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -1335,6 +1335,107 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
return 0;
}
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ if (params == NULL)
+ return -EINVAL;
+
+ memset(params, 0, sizeof(*params));
+ params->max_nb = DEFAULT_MAX_NB;
+
+ return 0;
+}
+
+static int
+crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
+{
+ int ret;
+ uint32_t caps;
+
+ if (!adapter->nb_qps)
+ return -EINVAL;
+ ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
+ adapter->next_cdev_id,
+ &caps);
+ if (ret) {
+ RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
+ " cdev %" PRIu8, adapter->eventdev_id,
+ adapter->next_cdev_id);
+ return ret;
+ }
+
+ if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
+ (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ rte_spinlock_lock(&adapter->lock);
+ adapter->max_nb = params->max_nb;
+ rte_spinlock_unlock(&adapter->lock);
+
+ return 0;
+}
+
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params)
+{
+ struct event_crypto_adapter *adapter;
+ int ret;
+
+ if (eca_memzone_lookup())
+ return -ENOMEM;
+
+
+ EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
+
+ if (params == NULL) {
+ RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+ return -EINVAL;
+ }
+
+ adapter = eca_id_to_adapter(id);
+ if (adapter == NULL)
+ return -EINVAL;
+
+ ret = crypto_adapter_cap_check(adapter);
+ if (ret)
+ return ret;
+
+ params->max_nb = adapter->max_nb;
+
+ return 0;
+}
+
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index fad4543506..4e1f1bb3a8 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -138,6 +138,9 @@
* - rte_event_crypto_adapter_stop()
* - rte_event_crypto_adapter_stats_get()
* - rte_event_crypto_adapter_stats_reset()
+ * - rte_event_crypto_adapter_runtime_params_get()
+ * - rte_event_crypto_adapter_runtime_params_init()
+ * - rte_event_crypto_adapter_runtime_params_set()
* The application creates an instance using rte_event_crypto_adapter_create()
* or rte_event_crypto_adapter_create_ext().
@@ -253,6 +256,31 @@ struct rte_event_crypto_adapter_conf {
*/
};
+/**
+ * Adapter runtime configuration parameters
+ */
+struct rte_event_crypto_adapter_runtime_params {
+ uint32_t max_nb;
+ /**< The adapter can return early if it has processed at least
+ * max_nb crypto ops. This isn't treated as a requirement; batching
+ * may cause the adapter to process more than max_nb crypto ops.
+ *
+ * rte_event_crypto_adapter_create() configures the
+ * adapter with default value of max_nb.
+ * rte_event_crypto_adapter_create_ext() configures the adapter with
+ * user provided value of max_nb through
+ * rte_event_crypto_adapter_conf::max_nb parameter.
+ * rte_event_cryptoadapter_runtime_params_set() allows to re-configure
+ * max_nb during runtime (after adding at least one queue pair)
+ *
+ * This is valid for the devices without
+ * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD or
+ * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW capability.
+ */
+ uint32_t rsvd[15];
+ /**< Reserved fields for future expansion */
+};
+
#define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
/**< This flag indicates that crypto operations processed on the crypto
* adapter need to be vectorized
@@ -608,6 +636,63 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+/**
+ * Initialize the adapter runtime configuration parameters
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_init(
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Set the adapter runtime configuration parameters
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * with configuration parameter values. The reserved fields of this structure
+ * must be initialized to zero and the valid fields need to be set appropriately.
+ * This struct can be initialized using
+ * rte_event_crypto_adapter_runtime_params_init() API to default values or
+ * application may reset this struct and update required fields.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_set(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
+/**
+ * Get the adapter runtime configuration parameters
+ *
+ * @param id
+ * Adapter identifier
+ *
+ * @param[out] params
+ * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
+ * containing valid adapter parameters when return value is 0.
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+__rte_experimental
+int
+rte_event_crypto_adapter_runtime_params_get(uint8_t id,
+ struct rte_event_crypto_adapter_runtime_params *params);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
index 7b93736dff..3b17c84eae 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -121,6 +121,9 @@ EXPERIMENTAL {
rte_event_eth_tx_adapter_queue_stop;
# added in 23.03
+ rte_event_crypto_adapter_runtime_params_get;
+ rte_event_crypto_adapter_runtime_params_init;
+ rte_event_crypto_adapter_runtime_params_set;
rte_event_eth_rx_adapter_runtime_params_get;
rte_event_eth_rx_adapter_runtime_params_init;
rte_event_eth_rx_adapter_runtime_params_set;
--
2.25.1
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v6 3/3] eventdev/crypto: add params set/get APIs
2023-02-10 17:37 ` [PATCH v6 3/3] eventdev/crypto: " Naga Harish K S V
@ 2023-02-13 5:08 ` Jerin Jacob
0 siblings, 0 replies; 53+ messages in thread
From: Jerin Jacob @ 2023-02-13 5:08 UTC (permalink / raw)
To: Naga Harish K S V
Cc: jerinj, erik.g.carrillo, abhinandan.gujjar, dev, jay.jayatheerthan
On Fri, Feb 10, 2023 at 11:08 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter runtime configuration parameters defined in the
> struct rte_event_crypto_adapter_runtime_params can be configured
> and retrieved using rte_event_crypto_adapter_runtime_params_set()
> and rte_event_eth_rx_adapter_runtime_params_get() respectively.
Typo: rte_event_crypto_adapter_runtime_params_get()
Series-Acked-by: Jerin Jacob <jerinj@marvell.com>
Updated the git commit as follows and series applied to
dpdk-next-net-eventdev/for-main. Thanks
commit 44fe1187305af8ac6d31c46113c1ca35405de77b (HEAD -> for-main,
origin/for-main, origin/HEAD)
Author: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Date: Fri Feb 10 11:37:44 2023 -0600
eventdev/crypto: support runtime set/get parameters
The adapter runtime configuration parameters defined in the
struct rte_event_crypto_adapter_runtime_params can be configured
and retrieved using rte_event_crypto_adapter_runtime_params_set()
and rte_event_crypto_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
commit 122812d1586437a6a09da132c23b6b6b41e90bef
Author: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Date: Fri Feb 10 11:37:43 2023 -0600
eventdev/eth_tx: support runtime set/get parameters
The adapter runtime configuration parameters defined in the
struct rte_event_eth_tx_adapter_runtime_params can be
configured and retrieved using
rte_event_eth_tx_adapter_runtime_params_set() and
rte_event_eth_tx_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
commit 496f7d5567ecb3c480ede0a90a3b4e987f6c7359
Author: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Date: Fri Feb 10 11:37:42 2023 -0600
eventdev/eth_rx: support runtime set/get parameters
The adapter runtime configuration parameters defined in the
struct rte_event_eth_rx_adapter_runtime_params can be configured
and retrieved using rte_event_eth_rx_adapter_runtime_params_set() and
rte_event_eth_rx_adapter_runtime_params_get() respectively.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
> v6:
> * updated doxygen comments as per review comments
> ---
> ---
> app/test/test_event_crypto_adapter.c | 109 ++++++++++++++++++
> .../prog_guide/event_crypto_adapter.rst | 8 ++
> lib/eventdev/rte_event_crypto_adapter.c | 101 ++++++++++++++++
> lib/eventdev/rte_event_crypto_adapter.h | 85 ++++++++++++++
> lib/eventdev/version.map | 3 +
> 5 files changed, 306 insertions(+)
>
> diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
> index a38e389abd..264d6f731e 100644
> --- a/app/test/test_event_crypto_adapter.c
> +++ b/app/test/test_event_crypto_adapter.c
> @@ -272,6 +272,111 @@ test_crypto_adapter_stats(void)
> return TEST_SUCCESS;
> }
>
> +static int
> +test_crypto_adapter_params(void)
> +{
> + int err;
> + struct rte_event_crypto_adapter_runtime_params in_params;
> + struct rte_event_crypto_adapter_runtime_params out_params;
> + uint32_t cap;
> + struct rte_event_crypto_adapter_queue_conf queue_conf = {
> + .ev = response_info,
> + };
> +
> + err = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
> + TEST_ASSERT_SUCCESS(err, "Failed to get adapter capabilities\n");
> +
> + if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
> + err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
> + TEST_CDEV_ID, TEST_CDEV_QP_ID, &queue_conf);
> + } else
> + err = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
> + TEST_CDEV_ID, TEST_CDEV_QP_ID, NULL);
> +
> + TEST_ASSERT_SUCCESS(err, "Failed to add queue pair\n");
> +
> + err = rte_event_crypto_adapter_runtime_params_init(&in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + err = rte_event_crypto_adapter_runtime_params_init(&out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + /* Case 1: Get the default value of mbufs processed by adapter */
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + /* Case 2: Set max_nb = 32 (=BATCH_SEIZE) */
> + in_params.max_nb = 32;
> +
> + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
> + &in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
> + in_params.max_nb, out_params.max_nb);
> +
> + /* Case 3: Set max_nb = 192 */
> + in_params.max_nb = 192;
> +
> + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
> + &in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
> + in_params.max_nb, out_params.max_nb);
> +
> + /* Case 4: Set max_nb = 256 */
> + in_params.max_nb = 256;
> +
> + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
> + &in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
> + in_params.max_nb, out_params.max_nb);
> +
> + /* Case 5: Set max_nb = 30(<BATCH_SIZE) */
> + in_params.max_nb = 30;
> +
> + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
> + &in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
> + in_params.max_nb, out_params.max_nb);
> +
> + /* Case 6: Set max_nb = 512 */
> + in_params.max_nb = 512;
> +
> + err = rte_event_crypto_adapter_runtime_params_set(TEST_ADAPTER_ID,
> + &in_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +
> + err = rte_event_crypto_adapter_runtime_params_get(TEST_ADAPTER_ID,
> + &out_params);
> + TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> + TEST_ASSERT(in_params.max_nb == out_params.max_nb, "Expected %u got %u",
> + in_params.max_nb, out_params.max_nb);
> +
> + err = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
> + TEST_CDEV_ID, TEST_CDEV_QP_ID);
> + TEST_ASSERT_SUCCESS(err, "Failed to delete add queue pair\n");
> +
> + return TEST_SUCCESS;
> +}
> +
> static int
> test_op_forward_mode(uint8_t session_less)
> {
> @@ -1454,6 +1559,10 @@ static struct unit_test_suite functional_testsuite = {
> test_crypto_adapter_free,
> test_crypto_adapter_stats),
>
> + TEST_CASE_ST(test_crypto_adapter_create,
> + test_crypto_adapter_free,
> + test_crypto_adapter_params),
> +
> TEST_CASE_ST(test_crypto_adapter_conf_op_forward_mode,
> test_crypto_adapter_stop,
> test_session_with_op_forward_mode),
> diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
> index 46b3dc2f1c..1b6d4a0966 100644
> --- a/doc/guides/prog_guide/event_crypto_adapter.rst
> +++ b/doc/guides/prog_guide/event_crypto_adapter.rst
> @@ -350,3 +350,11 @@ in struct ``rte_event_crypto_adapter_stats``. The received packet and
> enqueued event counts are a sum of the counts from the eventdev PMD callbacks
> if the callback is supported, and the counts maintained by the service function,
> if one exists.
> +
> +Set/Get adapter runtime configuration parameters
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The runtime configuration parameters of adapter can be set/get using
> +``rte_event_crypto_adapter_runtime_params_set()`` and
> +``rte_event_crypto_adapter_runtime_params_get()`` respectively. The parameters that
> +can be set/get are defined in ``struct rte_event_crypto_adapter_runtime_params``.
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
> index 7f0a25a4cc..f6c1e5380d 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -1335,6 +1335,107 @@ rte_event_crypto_adapter_stats_reset(uint8_t id)
> return 0;
> }
>
> +int
> +rte_event_crypto_adapter_runtime_params_init(
> + struct rte_event_crypto_adapter_runtime_params *params)
> +{
> + if (params == NULL)
> + return -EINVAL;
> +
> + memset(params, 0, sizeof(*params));
> + params->max_nb = DEFAULT_MAX_NB;
> +
> + return 0;
> +}
> +
> +static int
> +crypto_adapter_cap_check(struct event_crypto_adapter *adapter)
> +{
> + int ret;
> + uint32_t caps;
> +
> + if (!adapter->nb_qps)
> + return -EINVAL;
> + ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
> + adapter->next_cdev_id,
> + &caps);
> + if (ret) {
> + RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8
> + " cdev %" PRIu8, adapter->eventdev_id,
> + adapter->next_cdev_id);
> + return ret;
> + }
> +
> + if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||
> + (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW))
> + return -ENOTSUP;
> +
> + return 0;
> +}
> +
> +int
> +rte_event_crypto_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_crypto_adapter_runtime_params *params)
> +{
> + struct event_crypto_adapter *adapter;
> + int ret;
> +
> + if (eca_memzone_lookup())
> + return -ENOMEM;
> +
> + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> +
> + if (params == NULL) {
> + RTE_EDEV_LOG_ERR("params pointer is NULL\n");
> + return -EINVAL;
> + }
> +
> + adapter = eca_id_to_adapter(id);
> + if (adapter == NULL)
> + return -EINVAL;
> +
> + ret = crypto_adapter_cap_check(adapter);
> + if (ret)
> + return ret;
> +
> + rte_spinlock_lock(&adapter->lock);
> + adapter->max_nb = params->max_nb;
> + rte_spinlock_unlock(&adapter->lock);
> +
> + return 0;
> +}
> +
> +int
> +rte_event_crypto_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_crypto_adapter_runtime_params *params)
> +{
> + struct event_crypto_adapter *adapter;
> + int ret;
> +
> + if (eca_memzone_lookup())
> + return -ENOMEM;
> +
> +
> + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> +
> + if (params == NULL) {
> + RTE_EDEV_LOG_ERR("params pointer is NULL\n");
> + return -EINVAL;
> + }
> +
> + adapter = eca_id_to_adapter(id);
> + if (adapter == NULL)
> + return -EINVAL;
> +
> + ret = crypto_adapter_cap_check(adapter);
> + if (ret)
> + return ret;
> +
> + params->max_nb = adapter->max_nb;
> +
> + return 0;
> +}
> +
> int
> rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
> {
> diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
> index fad4543506..4e1f1bb3a8 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.h
> +++ b/lib/eventdev/rte_event_crypto_adapter.h
> @@ -138,6 +138,9 @@
> * - rte_event_crypto_adapter_stop()
> * - rte_event_crypto_adapter_stats_get()
> * - rte_event_crypto_adapter_stats_reset()
> + * - rte_event_crypto_adapter_runtime_params_get()
> + * - rte_event_crypto_adapter_runtime_params_init()
> + * - rte_event_crypto_adapter_runtime_params_set()
>
> * The application creates an instance using rte_event_crypto_adapter_create()
> * or rte_event_crypto_adapter_create_ext().
> @@ -253,6 +256,31 @@ struct rte_event_crypto_adapter_conf {
> */
> };
>
> +/**
> + * Adapter runtime configuration parameters
> + */
> +struct rte_event_crypto_adapter_runtime_params {
> + uint32_t max_nb;
> + /**< The adapter can return early if it has processed at least
> + * max_nb crypto ops. This isn't treated as a requirement; batching
> + * may cause the adapter to process more than max_nb crypto ops.
> + *
> + * rte_event_crypto_adapter_create() configures the
> + * adapter with default value of max_nb.
> + * rte_event_crypto_adapter_create_ext() configures the adapter with
> + * user provided value of max_nb through
> + * rte_event_crypto_adapter_conf::max_nb parameter.
> + * rte_event_cryptoadapter_runtime_params_set() allows to re-configure
> + * max_nb during runtime (after adding at least one queue pair)
> + *
> + * This is valid for the devices without
> + * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD or
> + * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW capability.
> + */
> + uint32_t rsvd[15];
> + /**< Reserved fields for future expansion */
> +};
> +
> #define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1
> /**< This flag indicates that crypto operations processed on the crypto
> * adapter need to be vectorized
> @@ -608,6 +636,63 @@ rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id);
> int
> rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
>
> +/**
> + * Initialize the adapter runtime configuration parameters
> + *
> + * @param params
> + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_crypto_adapter_runtime_params_init(
> + struct rte_event_crypto_adapter_runtime_params *params);
> +
> +/**
> + * Set the adapter runtime configuration parameters
> + *
> + * @param id
> + * Adapter identifier
> + *
> + * @param params
> + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
> + * with configuration parameter values. The reserved fields of this structure
> + * must be initialized to zero and the valid fields need to be set appropriately.
> + * This struct can be initialized using
> + * rte_event_crypto_adapter_runtime_params_init() API to default values or
> + * application may reset this struct and update required fields.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_crypto_adapter_runtime_params_set(uint8_t id,
> + struct rte_event_crypto_adapter_runtime_params *params);
> +
> +/**
> + * Get the adapter runtime configuration parameters
> + *
> + * @param id
> + * Adapter identifier
> + *
> + * @param[out] params
> + * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params
> + * containing valid adapter parameters when return value is 0.
> + *
> + * @return
> + * - 0: Success
> + * - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_crypto_adapter_runtime_params_get(uint8_t id,
> + struct rte_event_crypto_adapter_runtime_params *params);
> +
> /**
> * @warning
> * @b EXPERIMENTAL: this API may change without prior notice
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index 7b93736dff..3b17c84eae 100644
> --- a/lib/eventdev/version.map
> +++ b/lib/eventdev/version.map
> @@ -121,6 +121,9 @@ EXPERIMENTAL {
> rte_event_eth_tx_adapter_queue_stop;
>
> # added in 23.03
> + rte_event_crypto_adapter_runtime_params_get;
> + rte_event_crypto_adapter_runtime_params_init;
> + rte_event_crypto_adapter_runtime_params_set;
> rte_event_eth_rx_adapter_runtime_params_get;
> rte_event_eth_rx_adapter_runtime_params_init;
> rte_event_eth_rx_adapter_runtime_params_set;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 53+ messages in thread