diff mbox series

[v3,1/2] examples/l3fwd: use single set of variables throughout the code

Message ID 20220223060931.2661907-1-honnappa.nagarahalli@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v3,1/2] examples/l3fwd: use single set of variables throughout the code | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Honnappa Nagarahalli Feb. 23, 2022, 6:09 a.m. UTC
nb_rxd and nb_txd are used in polling mode and event mode of
operation. nb_rxd and nb_txd are already global in polling mode
but are not visible to event mode code. Make them visible to all
parts of the application.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
DTS test cases require changing the RX and TX queue depths.
Currently, this is achieved by patching the DPDK code. This patch set
provides a mechanism to configure the queue depths while launching
the application. With this change DTS test cases do not need
to modify the DPDK code.

v2 - Single parse function, additional validation on input (Stephen)

v2 - Fixed typo (Ruifeng) and adjusted the commit msg (Kathleen).

 examples/l3fwd/l3fwd.h       | 4 ++++
 examples/l3fwd/l3fwd_event.c | 2 --
 examples/l3fwd/main.c        | 5 ++---
 3 files changed, 6 insertions(+), 5 deletions(-)

Comments

Honnappa Nagarahalli Feb. 23, 2022, 6:13 a.m. UTC | #1
Question for stable maintainers. 

DTS WG would like this patch to be merged in 21.11 and 20.11 stable releases even though it is not a bug fix. This allows for a single DTS version to be used with both those stable releases and master.

Do you have any objections?

Thank you,
Honnappa


> -----Original Message-----
> From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Sent: Wednesday, February 23, 2022 12:10 AM
> To: dev@dpdk.org; Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> lijuan.tu@intel.com; juraj.linkes@pantheon.tech; ohilyard@iol.unh.edu;
> david.marchand@redhat.com; thomas@monjalon.net; jerinj@marvell.com;
> bruce.richardson@intel.com; stephen@networkplumber.org;
> bluca@debian.org; ktraynor@redhat.com; christian.ehrhardt@canonical.com;
> xuemingl@nvidia.com
> Cc: Kathleen Capella <Kathleen.Capella@arm.com>; nd <nd@arm.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>
> Subject: [PATCH v3 1/2] examples/l3fwd: use single set of variables throughout
> the code
> 
> nb_rxd and nb_txd are used in polling mode and event mode of operation.
> nb_rxd and nb_txd are already global in polling mode but are not visible to
> event mode code. Make them visible to all parts of the application.
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Kathleen Capella <kathleen.capella@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> DTS test cases require changing the RX and TX queue depths.
> Currently, this is achieved by patching the DPDK code. This patch set provides a
> mechanism to configure the queue depths while launching the application. With
> this change DTS test cases do not need to modify the DPDK code.
> 
> v2 - Single parse function, additional validation on input (Stephen)
> 
> v2 - Fixed typo (Ruifeng) and adjusted the commit msg (Kathleen).
> 
>  examples/l3fwd/l3fwd.h       | 4 ++++
>  examples/l3fwd/l3fwd_event.c | 2 --
>  examples/l3fwd/main.c        | 5 ++---
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index
> 38ca19133c..4ccdb28b4a 100644
> --- a/examples/l3fwd/l3fwd.h
> +++ b/examples/l3fwd/l3fwd.h
> @@ -81,6 +81,10 @@ struct lcore_conf {
> 
>  extern volatile bool force_quit;
> 
> +/* RX and TX queue depths */
> +extern uint16_t nb_rxd;
> +extern uint16_t nb_txd;
> +
>  /* ethernet addresses of ports */
>  extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];  extern struct
> rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; diff --git
> a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c index
> dd9eafa9b9..7a401290f8 100644
> --- a/examples/l3fwd/l3fwd_event.c
> +++ b/examples/l3fwd/l3fwd_event.c
> @@ -43,8 +43,6 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf
> *port_conf)  {
>  	struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
>  	uint16_t nb_ports = rte_eth_dev_count_avail();
> -	uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
> -	uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
>  	unsigned int nb_lcores = rte_lcore_count();
>  	struct rte_eth_conf local_port_conf;
>  	struct rte_eth_dev_info dev_info;
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> eb68ffc5aa..acd186ab7d 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -53,9 +53,8 @@
> 
>  #define MAX_LCORE_PARAMS 1024
> 
> -/* Static global variables used within this file. */ -static uint16_t nb_rxd =
> RTE_TEST_RX_DESC_DEFAULT; -static uint16_t nb_txd =
> RTE_TEST_TX_DESC_DEFAULT;
> +uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; uint16_t nb_txd =
> +RTE_TEST_TX_DESC_DEFAULT;
> 
>  /**< Ports set in promiscuous mode off by default. */  static int
> promiscuous_on;
> --
> 2.25.1
Kevin Traynor Feb. 23, 2022, 9:22 a.m. UTC | #2
Hi Honnappa,

On 23/02/2022 06:13, Honnappa Nagarahalli wrote:
> Question for stable maintainers.
> 
> DTS WG would like this patch to be merged in 21.11 and 20.11 stable releases even though it is not a bug fix. This allows for a single DTS version to be used with both those stable releases and master.
> 
> Do you have any objections?
> 

No objection for 21.11. It is example code and just a minor addition 
that is not changing defaults. Please add the stable tag in the commit 
message on merge (or next rev) so it will be found by our scripts.

thanks,
Kevin.

> Thank you,
> Honnappa
> 
> 
>> -----Original Message-----
>> From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> Sent: Wednesday, February 23, 2022 12:10 AM
>> To: dev@dpdk.org; Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
>> lijuan.tu@intel.com; juraj.linkes@pantheon.tech; ohilyard@iol.unh.edu;
>> david.marchand@redhat.com; thomas@monjalon.net; jerinj@marvell.com;
>> bruce.richardson@intel.com; stephen@networkplumber.org;
>> bluca@debian.org; ktraynor@redhat.com; christian.ehrhardt@canonical.com;
>> xuemingl@nvidia.com
>> Cc: Kathleen Capella <Kathleen.Capella@arm.com>; nd <nd@arm.com>;
>> Ruifeng Wang <Ruifeng.Wang@arm.com>
>> Subject: [PATCH v3 1/2] examples/l3fwd: use single set of variables throughout
>> the code
>>
>> nb_rxd and nb_txd are used in polling mode and event mode of operation.
>> nb_rxd and nb_txd are already global in polling mode but are not visible to
>> event mode code. Make them visible to all parts of the application.
>>
>> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> Reviewed-by: Kathleen Capella <kathleen.capella@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>> ---
>> DTS test cases require changing the RX and TX queue depths.
>> Currently, this is achieved by patching the DPDK code. This patch set provides a
>> mechanism to configure the queue depths while launching the application. With
>> this change DTS test cases do not need to modify the DPDK code.
>>
>> v2 - Single parse function, additional validation on input (Stephen)
>>
>> v2 - Fixed typo (Ruifeng) and adjusted the commit msg (Kathleen).
>>
>>   examples/l3fwd/l3fwd.h       | 4 ++++
>>   examples/l3fwd/l3fwd_event.c | 2 --
>>   examples/l3fwd/main.c        | 5 ++---
>>   3 files changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index
>> 38ca19133c..4ccdb28b4a 100644
>> --- a/examples/l3fwd/l3fwd.h
>> +++ b/examples/l3fwd/l3fwd.h
>> @@ -81,6 +81,10 @@ struct lcore_conf {
>>
>>   extern volatile bool force_quit;
>>
>> +/* RX and TX queue depths */
>> +extern uint16_t nb_rxd;
>> +extern uint16_t nb_txd;
>> +
>>   /* ethernet addresses of ports */
>>   extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];  extern struct
>> rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; diff --git
>> a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c index
>> dd9eafa9b9..7a401290f8 100644
>> --- a/examples/l3fwd/l3fwd_event.c
>> +++ b/examples/l3fwd/l3fwd_event.c
>> @@ -43,8 +43,6 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf
>> *port_conf)  {
>>   	struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
>>   	uint16_t nb_ports = rte_eth_dev_count_avail();
>> -	uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
>> -	uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
>>   	unsigned int nb_lcores = rte_lcore_count();
>>   	struct rte_eth_conf local_port_conf;
>>   	struct rte_eth_dev_info dev_info;
>> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
>> eb68ffc5aa..acd186ab7d 100644
>> --- a/examples/l3fwd/main.c
>> +++ b/examples/l3fwd/main.c
>> @@ -53,9 +53,8 @@
>>
>>   #define MAX_LCORE_PARAMS 1024
>>
>> -/* Static global variables used within this file. */ -static uint16_t nb_rxd =
>> RTE_TEST_RX_DESC_DEFAULT; -static uint16_t nb_txd =
>> RTE_TEST_TX_DESC_DEFAULT;
>> +uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; uint16_t nb_txd =
>> +RTE_TEST_TX_DESC_DEFAULT;
>>
>>   /**< Ports set in promiscuous mode off by default. */  static int
>> promiscuous_on;
>> --
>> 2.25.1
>
Han, YingyaX March 1, 2022, 1:56 a.m. UTC | #3
-----Original Message-----
From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> 
Sent: Wednesday, February 23, 2022 2:10 PM
To: dev@dpdk.org; honnappa.nagarahalli@arm.com; Tu, Lijuan <lijuan.tu@intel.com>; juraj.linkes@pantheon.tech; ohilyard@iol.unh.edu; david.marchand@redhat.com; thomas@monjalon.net; jerinj@marvell.com; Richardson, Bruce <bruce.richardson@intel.com>; stephen@networkplumber.org; bluca@debian.org; ktraynor@redhat.com; christian.ehrhardt@canonical.com; xuemingl@nvidia.com
Cc: kathleen.capella@arm.com; nd@arm.com; Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [PATCH v3 1/2] examples/l3fwd: use single set of variables throughout the code

nb_rxd and nb_txd are used in polling mode and event mode of operation. nb_rxd and nb_txd are already global in polling mode but are not visible to event mode code. Make them visible to all parts of the application.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Tested-by: Yingya Han < yingyax.han@intel.com>
Thomas Monjalon March 8, 2022, 9:22 a.m. UTC | #4
> nb_rxd and nb_txd are used in polling mode and event mode of operation. nb_rxd and nb_txd are already global in polling mode but are not visible to event mode code. Make them visible to all parts of the application.
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Kathleen Capella <kathleen.capella@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Tested-by: Yingya Han < yingyax.han@intel.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index 38ca19133c..4ccdb28b4a 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -81,6 +81,10 @@  struct lcore_conf {
 
 extern volatile bool force_quit;
 
+/* RX and TX queue depths */
+extern uint16_t nb_rxd;
+extern uint16_t nb_txd;
+
 /* ethernet addresses of ports */
 extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS];
 extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
index dd9eafa9b9..7a401290f8 100644
--- a/examples/l3fwd/l3fwd_event.c
+++ b/examples/l3fwd/l3fwd_event.c
@@ -43,8 +43,6 @@  l3fwd_eth_dev_port_setup(struct rte_eth_conf *port_conf)
 {
 	struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
 	uint16_t nb_ports = rte_eth_dev_count_avail();
-	uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
-	uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
 	unsigned int nb_lcores = rte_lcore_count();
 	struct rte_eth_conf local_port_conf;
 	struct rte_eth_dev_info dev_info;
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index eb68ffc5aa..acd186ab7d 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -53,9 +53,8 @@ 
 
 #define MAX_LCORE_PARAMS 1024
 
-/* Static global variables used within this file. */
-static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
-static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
+uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
+uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
 
 /**< Ports set in promiscuous mode off by default. */
 static int promiscuous_on;