[v7,1/4] eventdev/eth_rx: change eventdev reconfig logic

Message ID 20230112163035.1970151-1-s.v.naga.harish.k@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v7,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 Jan. 12, 2023, 4:30 p.m. UTC
  When rte_event_eth_rx_adapter_create() or
rte_event_eth_rx_adapter_create_with_params() 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 no longer need to configure the
eventdev with ``rte_event_dev_config::nb_single_link_event_port_queues``
parameter required for eth_rx adapter when the adapter is created
using above mentioned apis.

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
v3:
* update doxygen
v5:
* update doxygen as per review comments
v6:
* no update in rxa
---
---
 .../prog_guide/event_ethernet_rx_adapter.rst  | 19 +++++++++++++++++++
 lib/eventdev/rte_event_eth_rx_adapter.c       |  3 +++
 lib/eventdev/rte_event_eth_rx_adapter.h       | 14 ++++++++++++++
 3 files changed, 36 insertions(+)
  

Patch

diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index 116c0a27c6..bbe278f7db 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -71,6 +71,25 @@  set to true. The function is passed the event device to be associated with
 the adapter and port configuration for the adapter to setup an event port
 if the adapter needs to use a service function.
 
+Event device configuration for service based adapter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When rte_event_eth_rx_adapter_create() or
+rte_event_eth_rx_adapter_create_with_params() is used for creating
+adapter instance, ``rte_event_dev_config::nb_event_ports`` is
+automatically incremented and the event device is reconfigured with
+the additional event port during service initialization. This event
+device reconfigure logic also increments 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 the
+``rte_event_dev_config::nb_event_ports`` and
+``rte_event_dev_config::nb_single_link_event_port_queues``
+parameters required for eth Rx adapter in the event device configuration,
+when the adapter is created using the above-mentioned APIs.
+
 Adding Rx Queues to the Adapter Instance
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index cf7bbd4d69..34aa87379e 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1532,6 +1532,9 @@  rxa_default_conf_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",
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
index d0e7d0092c..f4652f40e8 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/eventdev/rte_event_eth_rx_adapter.h
@@ -382,6 +382,20 @@  int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
  * control in configuration of the service, it should use the
  * rte_event_eth_rx_adapter_create_ext() version.
  *
+ * When this API 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 increments 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 eth Rx adapter in the event device configuration
+ * when the adapter is created with this API.
+ *
  * @param id
  *  The identifier of the ethernet Rx event adapter.
  *