DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
@ 2021-07-05 17:05 Conor Walsh
  2021-07-05 17:32 ` Ananyev, Konstantin
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Conor Walsh @ 2021-07-05 17:05 UTC (permalink / raw)
  To: konstantin.ananyev, vladimir.medvedkin, ruifeng.wang, jerinj
  Cc: dev, paulis.gributs, Conor Walsh

This patch aligns the l3fwd FIB code with the changes made to LPM in
commit 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM
main loop").
This change ensures the compiler knows that the lcore config variables
are constant values and the compiler will then optimize the code
accordingly.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
---
 examples/l3fwd/l3fwd_fib.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index 1787229942..d083ddfdd5 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -182,14 +182,16 @@ fib_main_loop(__rte_unused void *dummy)
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
 
-	if (qconf->n_rx_queue == 0) {
+	const uint16_t n_rx_q = qconf->n_rx_queue;
+	const uint16_t n_tx_p = qconf->n_tx_port;
+	if (n_rx_q == 0) {
 		RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
 		return 0;
 	}
 
 	RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id);
 
-	for (i = 0; i < qconf->n_rx_queue; i++) {
+	for (i = 0; i < n_rx_q; i++) {
 
 		portid = qconf->rx_queue_list[i].port_id;
 		queueid = qconf->rx_queue_list[i].queue_id;
@@ -207,7 +209,7 @@ fib_main_loop(__rte_unused void *dummy)
 		diff_tsc = cur_tsc - prev_tsc;
 		if (unlikely(diff_tsc > drain_tsc)) {
 
-			for (i = 0; i < qconf->n_tx_port; ++i) {
+			for (i = 0; i < n_tx_p; ++i) {
 				portid = qconf->tx_port_id[i];
 				if (qconf->tx_mbufs[portid].len == 0)
 					continue;
@@ -221,7 +223,7 @@ fib_main_loop(__rte_unused void *dummy)
 		}
 
 		/* Read packet from RX queues. */
-		for (i = 0; i < qconf->n_rx_queue; ++i) {
+		for (i = 0; i < n_rx_q; ++i) {
 			portid = qconf->rx_queue_list[i].port_id;
 			queueid = qconf->rx_queue_list[i].queue_id;
 			nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
  2021-07-05 17:05 [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop Conor Walsh
@ 2021-07-05 17:32 ` Ananyev, Konstantin
  2021-07-06  1:38 ` Ruifeng Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ananyev, Konstantin @ 2021-07-05 17:32 UTC (permalink / raw)
  To: Walsh, Conor, Medvedkin, Vladimir, ruifeng.wang, jerinj
  Cc: dev, Gributs, Paulis


> 
> This patch aligns the l3fwd FIB code with the changes made to LPM in
> commit 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM
> main loop").
> This change ensures the compiler knows that the lcore config variables
> are constant values and the compiler will then optimize the code
> accordingly.
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> ---
>  examples/l3fwd/l3fwd_fib.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
> index 1787229942..d083ddfdd5 100644
> --- a/examples/l3fwd/l3fwd_fib.c
> +++ b/examples/l3fwd/l3fwd_fib.c
> @@ -182,14 +182,16 @@ fib_main_loop(__rte_unused void *dummy)
>  	lcore_id = rte_lcore_id();
>  	qconf = &lcore_conf[lcore_id];
> 
> -	if (qconf->n_rx_queue == 0) {
> +	const uint16_t n_rx_q = qconf->n_rx_queue;
> +	const uint16_t n_tx_p = qconf->n_tx_port;
> +	if (n_rx_q == 0) {
>  		RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
>  		return 0;
>  	}
> 
>  	RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id);
> 
> -	for (i = 0; i < qconf->n_rx_queue; i++) {
> +	for (i = 0; i < n_rx_q; i++) {
> 
>  		portid = qconf->rx_queue_list[i].port_id;
>  		queueid = qconf->rx_queue_list[i].queue_id;
> @@ -207,7 +209,7 @@ fib_main_loop(__rte_unused void *dummy)
>  		diff_tsc = cur_tsc - prev_tsc;
>  		if (unlikely(diff_tsc > drain_tsc)) {
> 
> -			for (i = 0; i < qconf->n_tx_port; ++i) {
> +			for (i = 0; i < n_tx_p; ++i) {
>  				portid = qconf->tx_port_id[i];
>  				if (qconf->tx_mbufs[portid].len == 0)
>  					continue;
> @@ -221,7 +223,7 @@ fib_main_loop(__rte_unused void *dummy)
>  		}
> 
>  		/* Read packet from RX queues. */
> -		for (i = 0; i < qconf->n_rx_queue; ++i) {
> +		for (i = 0; i < n_rx_q; ++i) {
>  			portid = qconf->rx_queue_list[i].port_id;
>  			queueid = qconf->rx_queue_list[i].queue_id;
>  			nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
  2021-07-05 17:05 [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop Conor Walsh
  2021-07-05 17:32 ` Ananyev, Konstantin
@ 2021-07-06  1:38 ` Ruifeng Wang
  2021-07-06 11:29 ` David Marchand
  2021-07-07  9:57 ` David Marchand
  3 siblings, 0 replies; 6+ messages in thread
From: Ruifeng Wang @ 2021-07-06  1:38 UTC (permalink / raw)
  To: Conor Walsh, konstantin.ananyev, vladimir.medvedkin, jerinj
  Cc: dev, paulis.gributs, nd

> -----Original Message-----
> From: Conor Walsh <conor.walsh@intel.com>
> Sent: Tuesday, July 6, 2021 1:06 AM
> To: konstantin.ananyev@intel.com; vladimir.medvedkin@intel.com; Ruifeng
> Wang <Ruifeng.Wang@arm.com>; jerinj@marvell.com
> Cc: dev@dpdk.org; paulis.gributs@intel.com; Conor Walsh
> <conor.walsh@intel.com>
> Subject: [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
> 
> This patch aligns the l3fwd FIB code with the changes made to LPM in commit
> 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM main loop").
> This change ensures the compiler knows that the lcore config variables are
> constant values and the compiler will then optimize the code accordingly.
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> ---
>  examples/l3fwd/l3fwd_fib.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
  2021-07-05 17:05 [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop Conor Walsh
  2021-07-05 17:32 ` Ananyev, Konstantin
  2021-07-06  1:38 ` Ruifeng Wang
@ 2021-07-06 11:29 ` David Marchand
  2021-07-06 11:55   ` Walsh, Conor
  2021-07-07  9:57 ` David Marchand
  3 siblings, 1 reply; 6+ messages in thread
From: David Marchand @ 2021-07-06 11:29 UTC (permalink / raw)
  To: Conor Walsh
  Cc: Ananyev, Konstantin, Vladimir Medvedkin,
	Ruifeng Wang (Arm Technology China),
	Jerin Jacob Kollanukkaran, dev, paulis.gributs

On Mon, Jul 5, 2021 at 7:06 PM Conor Walsh <conor.walsh@intel.com> wrote:
>
> This patch aligns the l3fwd FIB code with the changes made to LPM in
> commit 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM
> main loop").
> This change ensures the compiler knows that the lcore config variables
> are constant values and the compiler will then optimize the code
> accordingly.

em can undergo the same change too.
Can you send a followup patch and I would take them both for rc1?

Thanks.

>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>

-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
  2021-07-06 11:29 ` David Marchand
@ 2021-07-06 11:55   ` Walsh, Conor
  0 siblings, 0 replies; 6+ messages in thread
From: Walsh, Conor @ 2021-07-06 11:55 UTC (permalink / raw)
  To: David Marchand
  Cc: Ananyev, Konstantin, Medvedkin, Vladimir,
	Ruifeng Wang (Arm Technology China),
	Jerin Jacob Kollanukkaran, dev, Gributs, Paulis

> > This patch aligns the l3fwd FIB code with the changes made to LPM in
> > commit 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM
> > main loop").
> > This change ensures the compiler knows that the lcore config variables
> > are constant values and the compiler will then optimize the code
> > accordingly.
> 
> em can undergo the same change too.
> Can you send a followup patch and I would take them both for rc1?

Thanks! I will send a patch for em now
/Conor.

> 
> Thanks.
> 
> >
> > Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop
  2021-07-05 17:05 [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop Conor Walsh
                   ` (2 preceding siblings ...)
  2021-07-06 11:29 ` David Marchand
@ 2021-07-07  9:57 ` David Marchand
  3 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2021-07-07  9:57 UTC (permalink / raw)
  To: Conor Walsh
  Cc: Ananyev, Konstantin, Vladimir Medvedkin,
	Ruifeng Wang (Arm Technology China),
	Jerin Jacob Kollanukkaran, dev, paulis.gributs

On Mon, Jul 5, 2021 at 7:06 PM Conor Walsh <conor.walsh@intel.com> wrote:
>
> This patch aligns the l3fwd FIB code with the changes made to LPM in
> commit 74fb854a3de6 ("examples/l3fwd: remove useless reloads in LPM
> main loop").
> This change ensures the compiler knows that the lcore config variables
> are constant values and the compiler will then optimize the code
> accordingly.
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-07  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 17:05 [dpdk-dev] [PATCH] examples/l3fwd: remove useless reloads in FIB main loop Conor Walsh
2021-07-05 17:32 ` Ananyev, Konstantin
2021-07-06  1:38 ` Ruifeng Wang
2021-07-06 11:29 ` David Marchand
2021-07-06 11:55   ` Walsh, Conor
2021-07-07  9:57 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).