[v4,4/4] eventdev/timer: change eventdev reconfig logic

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

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Naga Harish K, S V Dec. 19, 2022, 6:28 a.m. UTC
  When rte_event_timer_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 timer 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
v4:
* fix programmer guide
---
---
 doc/guides/prog_guide/event_timer_adapter.rst | 17 ++++++++++++++
 lib/eventdev/rte_event_timer_adapter.c        | 23 +++++++++++--------
 lib/eventdev/rte_event_timer_adapter.h        | 13 +++++++++++
 3 files changed, 43 insertions(+), 10 deletions(-)
  

Comments

Carrillo, Erik G Dec. 19, 2022, 5:18 p.m. UTC | #1
Hi Harish,

Adding a couple of comments inline:

> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Monday, December 19, 2022 12:29 AM
> To: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar,
> Abhinandan S <abhinandan.gujjar@intel.com>
> Cc: dev@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: [PATCH v4 4/4] eventdev/timer: change eventdev reconfig logic
> 
> When rte_event_timer_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 timer 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
> v4:
> * fix programmer guide
> ---
> ---
>  doc/guides/prog_guide/event_timer_adapter.rst | 17 ++++++++++++++
>  lib/eventdev/rte_event_timer_adapter.c        | 23 +++++++++++--------
>  lib/eventdev/rte_event_timer_adapter.h        | 13 +++++++++++
>  3 files changed, 43 insertions(+), 10 deletions(-)
> 
> diff --git a/doc/guides/prog_guide/event_timer_adapter.rst
> b/doc/guides/prog_guide/event_timer_adapter.rst
> index d7307a29bb..b457c879b0 100644
> --- a/doc/guides/prog_guide/event_timer_adapter.rst
> +++ b/doc/guides/prog_guide/event_timer_adapter.rst
> @@ -139,6 +139,23 @@ This function is passed a callback function that will be
> invoked if the  adapter needs to create an event port, giving the application
> the opportunity  to control how it is done.
> 
> +Event device configuration for service based adapter
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We can use '^' instead of '~' here to make it a subsection.

> +
> +When rte_event_timer_adapter_create() is used for creating adapter
> +instance, eventdev is reconfigured with additional
> +``rte_event_dev_config::nb_event_ports`` parameter.

How about something along the lines of:

"When rte_event_timer_adapter_create() is used to create an adapter instance, ``rte_event_dev_config::nb_event_ports`` is automatically incremented, and the eventdev is reconfigured with the additional port."

> +This eventdev reconfig logic also increment the

"increments"

> +``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``.
> +
> +So the application is no longer need to configure the event device with

"application no longer needs"

> +``rte_event_dev_config::nb_event_ports`` and
> +``rte_event_dev_config::nb_single_link_event_port_queues``
> +parameters required for timer adapter when the adapter is created using
> +above mentioned api.
> +
>  Adapter modes
>  ^^^^^^^^^^^^^
>  An event timer adapter can be configured in either periodic or non-periodic
> mode diff --git a/lib/eventdev/rte_event_timer_adapter.c
> b/lib/eventdev/rte_event_timer_adapter.c
> index a0f14bf861..5ed233db00 100644
> --- a/lib/eventdev/rte_event_timer_adapter.c
> +++ b/lib/eventdev/rte_event_timer_adapter.c
> @@ -88,7 +88,20 @@ default_port_conf_cb(uint16_t id, uint8_t
> event_dev_id, uint8_t *event_port_id,
>  		rte_event_dev_stop(dev_id);
> 
>  	port_id = dev_conf.nb_event_ports;
> +	if (conf_arg != NULL)
> +		port_conf = conf_arg;
> +	else {
> +		port_conf = &def_port_conf;
> +		ret = rte_event_port_default_conf_get(dev_id, port_id,
> +						      port_conf);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
>  	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 < 0) {
>  		EVTIM_LOG_ERR("failed to configure event dev %u\n",
> dev_id); @@ -99,16 +112,6 @@ default_port_conf_cb(uint16_t id, uint8_t
> event_dev_id, uint8_t *event_port_id,
>  		return ret;
>  	}
> 
> -	if (conf_arg != NULL)
> -		port_conf = conf_arg;
> -	else {
> -		port_conf = &def_port_conf;
> -		ret = rte_event_port_default_conf_get(dev_id, port_id,
> -						      port_conf);
> -		if (ret < 0)
> -			return ret;
> -	}
> -
>  	ret = rte_event_port_setup(dev_id, port_id, port_conf);
>  	if (ret < 0) {
>  		EVTIM_LOG_ERR("failed to setup event port %u on event
> dev %u\n", diff --git a/lib/eventdev/rte_event_timer_adapter.h
> b/lib/eventdev/rte_event_timer_adapter.h
> index cd10db19e4..4b757773db 100644
> --- a/lib/eventdev/rte_event_timer_adapter.h
> +++ b/lib/eventdev/rte_event_timer_adapter.h
> @@ -212,6 +212,19 @@ typedef int
> (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
>   *
>   * This function must be invoked first before any other function in the API.
>   *
> + * When this API is used for creating adapter instance, eventdev is
> + * reconfigured with additional
> + ``rte_event_dev_config::nb_event_ports``
> + * parameter during service initialization. This eventdev reconfig
> + 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``.

We can update the comment here in the same way that the .rst files above get updated.

Thanks,
Gabriel

> + *
> + * So the application is no longer need to account for
> + * ``rte_event_dev_config::nb_event_ports`` and
> + * ``rte_event_dev_config::nb_single_link_event_port_queues``
> + * parameters required for Timer adapter in eventdev configure when
> + * the adapter is created with this api.
> + *
>   * @param conf
>   *   The event timer adapter configuration structure.
>   *
> --
> 2.25.1
  
Naga Harish K, S V Dec. 20, 2022, 9:14 a.m. UTC | #2
Hi Gabe,

> -----Original Message-----
> From: Carrillo, Erik G <erik.g.carrillo@intel.com>
> Sent: Monday, December 19, 2022 10:48 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; jerinj@marvell.com;
> Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Cc: dev@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: RE: [PATCH v4 4/4] eventdev/timer: change eventdev reconfig logic
> 
> Hi Harish,
> 
> Adding a couple of comments inline:
> 
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Monday, December 19, 2022 12:29 AM
> > To: jerinj@marvell.com; Carrillo, Erik G <erik.g.carrillo@intel.com>;
> > Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> > Cc: dev@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Subject: [PATCH v4 4/4] eventdev/timer: change eventdev reconfig logic
> >
> > When rte_event_timer_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 timer 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
> > v4:
> > * fix programmer guide
> > ---
> > ---
> >  doc/guides/prog_guide/event_timer_adapter.rst | 17 ++++++++++++++
> >  lib/eventdev/rte_event_timer_adapter.c        | 23 +++++++++++--------
> >  lib/eventdev/rte_event_timer_adapter.h        | 13 +++++++++++
> >  3 files changed, 43 insertions(+), 10 deletions(-)
> >
> > diff --git a/doc/guides/prog_guide/event_timer_adapter.rst
> > b/doc/guides/prog_guide/event_timer_adapter.rst
> > index d7307a29bb..b457c879b0 100644
> > --- a/doc/guides/prog_guide/event_timer_adapter.rst
> > +++ b/doc/guides/prog_guide/event_timer_adapter.rst
> > @@ -139,6 +139,23 @@ This function is passed a callback function that
> > will be invoked if the  adapter needs to create an event port, giving
> > the application the opportunity  to control how it is done.
> >
> > +Event device configuration for service based adapter
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> We can use '^' instead of '~' here to make it a subsection.
> 

Updated in v5 of the patch set.

> > +
> > +When rte_event_timer_adapter_create() is used for creating adapter
> > +instance, eventdev is reconfigured with additional
> > +``rte_event_dev_config::nb_event_ports`` parameter.
> 
> How about something along the lines of:
> 
> "When rte_event_timer_adapter_create() is used to create an adapter
> instance, ``rte_event_dev_config::nb_event_ports`` is automatically
> incremented, and the eventdev is reconfigured with the additional port."
> 
> > +This eventdev reconfig logic also increment the
> 
> "increments"
> 
Done 

> > +``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``.
> > +
> > +So the application is no longer need to configure the event device
> > +with
> 
> "application no longer needs"
> 
Done

> > +``rte_event_dev_config::nb_event_ports`` and
> > +``rte_event_dev_config::nb_single_link_event_port_queues``
> > +parameters required for timer adapter when the adapter is created
> > +using above mentioned api.
> > +
> >  Adapter modes
> >  ^^^^^^^^^^^^^
> >  An event timer adapter can be configured in either periodic or
> > non-periodic mode diff --git a/lib/eventdev/rte_event_timer_adapter.c
> > b/lib/eventdev/rte_event_timer_adapter.c
> > index a0f14bf861..5ed233db00 100644
> > --- a/lib/eventdev/rte_event_timer_adapter.c
> > +++ b/lib/eventdev/rte_event_timer_adapter.c
> > @@ -88,7 +88,20 @@ default_port_conf_cb(uint16_t id, uint8_t
> > event_dev_id, uint8_t *event_port_id,
> >  		rte_event_dev_stop(dev_id);
> >
> >  	port_id = dev_conf.nb_event_ports;
> > +	if (conf_arg != NULL)
> > +		port_conf = conf_arg;
> > +	else {
> > +		port_conf = &def_port_conf;
> > +		ret = rte_event_port_default_conf_get(dev_id, port_id,
> > +						      port_conf);
> > +		if (ret < 0)
> > +			return ret;
> > +	}
> > +
> >  	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 < 0) {
> >  		EVTIM_LOG_ERR("failed to configure event dev %u\n",
> dev_id); @@
> > -99,16 +112,6 @@ default_port_conf_cb(uint16_t id, uint8_t
> > event_dev_id, uint8_t *event_port_id,
> >  		return ret;
> >  	}
> >
> > -	if (conf_arg != NULL)
> > -		port_conf = conf_arg;
> > -	else {
> > -		port_conf = &def_port_conf;
> > -		ret = rte_event_port_default_conf_get(dev_id, port_id,
> > -						      port_conf);
> > -		if (ret < 0)
> > -			return ret;
> > -	}
> > -
> >  	ret = rte_event_port_setup(dev_id, port_id, port_conf);
> >  	if (ret < 0) {
> >  		EVTIM_LOG_ERR("failed to setup event port %u on event
> dev %u\n",
> > diff --git a/lib/eventdev/rte_event_timer_adapter.h
> > b/lib/eventdev/rte_event_timer_adapter.h
> > index cd10db19e4..4b757773db 100644
> > --- a/lib/eventdev/rte_event_timer_adapter.h
> > +++ b/lib/eventdev/rte_event_timer_adapter.h
> > @@ -212,6 +212,19 @@ typedef int
> > (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
> >   *
> >   * This function must be invoked first before any other function in the API.
> >   *
> > + * When this API is used for creating adapter instance, eventdev is
> > + * reconfigured with additional
> > + ``rte_event_dev_config::nb_event_ports``
> > + * parameter during service initialization. This eventdev reconfig
> > + 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``.
> 
> We can update the comment here in the same way that the .rst files above
> get updated.
> 

Done in V5 patch set

> Thanks,
> Gabriel
> 
> > + *
> > + * So the application is no longer need to account for
> > + * ``rte_event_dev_config::nb_event_ports`` and
> > + * ``rte_event_dev_config::nb_single_link_event_port_queues``
> > + * parameters required for Timer adapter in eventdev configure when
> > + * the adapter is created with this api.
> > + *
> >   * @param conf
> >   *   The event timer adapter configuration structure.
> >   *
> > --
> > 2.25.1
  

Patch

diff --git a/doc/guides/prog_guide/event_timer_adapter.rst b/doc/guides/prog_guide/event_timer_adapter.rst
index d7307a29bb..b457c879b0 100644
--- a/doc/guides/prog_guide/event_timer_adapter.rst
+++ b/doc/guides/prog_guide/event_timer_adapter.rst
@@ -139,6 +139,23 @@  This function is passed a callback function that will be invoked if the
 adapter needs to create an event port, giving the application the opportunity
 to control how it is done.
 
+Event device configuration for service based adapter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When rte_event_timer_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 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``.
+
+So the application is no longer need 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 timer adapter when the adapter is created
+using above mentioned api.
+
 Adapter modes
 ^^^^^^^^^^^^^
 An event timer adapter can be configured in either periodic or non-periodic mode
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index a0f14bf861..5ed233db00 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -88,7 +88,20 @@  default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 		rte_event_dev_stop(dev_id);
 
 	port_id = dev_conf.nb_event_ports;
+	if (conf_arg != NULL)
+		port_conf = conf_arg;
+	else {
+		port_conf = &def_port_conf;
+		ret = rte_event_port_default_conf_get(dev_id, port_id,
+						      port_conf);
+		if (ret < 0)
+			return ret;
+	}
+
 	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 < 0) {
 		EVTIM_LOG_ERR("failed to configure event dev %u\n", dev_id);
@@ -99,16 +112,6 @@  default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 		return ret;
 	}
 
-	if (conf_arg != NULL)
-		port_conf = conf_arg;
-	else {
-		port_conf = &def_port_conf;
-		ret = rte_event_port_default_conf_get(dev_id, port_id,
-						      port_conf);
-		if (ret < 0)
-			return ret;
-	}
-
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret < 0) {
 		EVTIM_LOG_ERR("failed to setup event port %u on event dev %u\n",
diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
index cd10db19e4..4b757773db 100644
--- a/lib/eventdev/rte_event_timer_adapter.h
+++ b/lib/eventdev/rte_event_timer_adapter.h
@@ -212,6 +212,19 @@  typedef int (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
  *
  * This function must be invoked first before any other function in the API.
  *
+ * When this API is used for creating adapter instance, eventdev is
+ * reconfigured with additional ``rte_event_dev_config::nb_event_ports``
+ * parameter during service initialization. This eventdev reconfig 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``.
+ *
+ * So the application is no longer need to account for
+ * ``rte_event_dev_config::nb_event_ports`` and
+ * ``rte_event_dev_config::nb_single_link_event_port_queues``
+ * parameters required for Timer adapter in eventdev configure when
+ * the adapter is created with this api.
+ *
  * @param conf
  *   The event timer adapter configuration structure.
  *