[v5,3/4] eventdev/crypto: change eventdev reconfig logic

Message ID 20221220081216.3131695-3-s.v.naga.harish.k@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series [v5,1/4] eventdev/eth_rx: change eventdev reconfig logic |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Naga Harish K, S V Dec. 20, 2022, 8:12 a.m. UTC
  When rte_event_crypto_adapter_create() is used for creating adapter
instance, eventdev is reconfigured with additional
``rte_event_dev_config::nb_event_ports`` parameter.

This eventdev reconfig logic is enhanced to increment the
``rte_event_dev_config::nb_single_link_event_port_queues``
parameter if the adapter event port config is of type
``RTE_EVENT_PORT_CFG_SINGLE_LINK``.

With this change the application is no longer need to configure the
eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues``
parameter required for crypto adapter when the adapter is created
using above mentioned api.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
---
v2:
* fix build error in documentation
v3:
* update doxygen
v5:
* update doxygen as per review comments
---
---
 doc/guides/prog_guide/event_crypto_adapter.rst | 17 +++++++++++++++++
 lib/eventdev/rte_event_crypto_adapter.c        |  3 +++
 lib/eventdev/rte_event_crypto_adapter.h        | 14 ++++++++++++++
 3 files changed, 34 insertions(+)
  

Patch

diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst
index 554df7e358..5108502cde 100644
--- a/doc/guides/prog_guide/event_crypto_adapter.rst
+++ b/doc/guides/prog_guide/event_crypto_adapter.rst
@@ -159,6 +159,23 @@  which it enqueues events towards the crypto adapter using
                                               nb_events);
         }
 
+Event device configuration for service based adapter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When rte_event_crypto_adapter_create() is used for creating
+adapter instance, ``rte_event_dev_config::nb_event_ports`` is
+automatically incremented, and event device is reconfigured with additional
+event port during service initialization. This event device reconfigure
+logic also increment the
+``rte_event_dev_config::nb_single_link_event_port_queues``
+parameter if the adapter event port config is of type
+``RTE_EVENT_PORT_CFG_SINGLE_LINK``.
+
+Application no longer needs to configure the
+event device with ``rte_event_dev_config::nb_event_ports`` and
+``rte_event_dev_config::nb_single_link_event_port_queues``
+parameters required for crypto adapter when the adapter is created
+using the above-mentioned API.
 
 Querying adapter capabilities
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 3c585d7b0d..5620a36dd3 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -287,6 +287,9 @@  eca_default_config_cb(uint8_t id, uint8_t dev_id,
 		rte_event_dev_stop(dev_id);
 	port_id = dev_conf.nb_event_ports;
 	dev_conf.nb_event_ports += 1;
+	if (port_conf->event_port_cfg & RTE_EVENT_PORT_CFG_SINGLE_LINK)
+		dev_conf.nb_single_link_event_port_queues += 1;
+
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret) {
 		RTE_EDEV_LOG_ERR("failed to configure event dev %u\n", dev_id);
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index 83d154a6ce..74a614cf54 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -414,6 +414,20 @@  rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
  * control in configuration of the service, it should use the
  * rte_event_crypto_adapter_create_ext() version.
  *
+ * When this API is used for creating adapter instance,
+ * ``rte_event_dev_config::nb_event_ports`` is automatically incremented,
+ * and the event device is reconfigured with additional event port during
+ * service initialization. This event device reconfigure logic also increment
+ * the ``rte_event_dev_config::nb_single_link_event_port_queues``
+ * parameter if the adapter event port config is of type
+ * ``RTE_EVENT_PORT_CFG_SINGLE_LINK``.
+ *
+ * Application no longer needs to account for
+ * ``rte_event_dev_config::nb_event_ports`` and
+ * ``rte_event_dev_config::nb_single_link_event_port_queues``
+ * parameters required for crypto adapter in event device configuration
+ * when the adapter is created with this API.
+ *
  * @param id
  *  Adapter identifier.
  *