DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Ruifeng Wang <ruifeng.wang@arm.com>
Cc: Jerin Jacob <jerinj@marvell.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	 Ferruh Yigit <ferruh.yigit@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	 David Marchand <david.marchand@redhat.com>,
	dpdk-dev <dev@dpdk.org>, nd <nd@arm.com>,
	Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	Ola Liljedahl <ola.liljedahl@arm.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/3] examples/l3fwd: eliminate unnecessary reloads in loop
Date: Mon, 7 Jun 2021 00:09:16 +0530	[thread overview]
Message-ID: <CALBAE1NztSQ-SsCozJFpycRG1WBFb7Vg17=eLyw+uu2V=+W5BQ@mail.gmail.com> (raw)
In-Reply-To: <20210601075653.84927-4-ruifeng.wang@arm.com>

On Tue, Jun 1, 2021 at 1:27 PM Ruifeng Wang <ruifeng.wang@arm.com> wrote:
>
> Number of rx queue and number of rx port in lcore config are constants
> during the period of l3 forward application running. But compiler has
> no this information.
>
> Copied values from lcore config to local variables and used the local
> variables for iteration. Compiler can see that the local variables are
> not changed, so qconf reloads at each iteration can be eliminated.
>
> The change showed 1.8% performance uplift in single core, single port,
> single queue test on N1SDP platform with MLX5 NIC.
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

No performance regression with octeontx2.

Acked-by: Jerin Jacob <jerinj@marvell.com>




> ---
>  examples/l3fwd/l3fwd_lpm.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
> index 427c72b1d2..ff1c18a442 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -154,14 +154,16 @@ lpm_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;
> @@ -181,7 +183,7 @@ lpm_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;
> @@ -197,7 +199,7 @@ lpm_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
>

  reply	other threads:[~2021-06-06 18:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 10:25 [dpdk-dev] [PATCH 0/4] l3fwd improvements Ruifeng Wang
2021-03-18 10:25 ` [dpdk-dev] [PATCH 1/4] examples/l3fwd: tune prefetch for better performance Ruifeng Wang
2021-04-13 18:50   ` Jerin Jacob
2021-04-13 20:00     ` Honnappa Nagarahalli
2021-05-19  7:52     ` Ruifeng Wang
2021-03-18 10:25 ` [dpdk-dev] [PATCH 2/4] examples/l3fwd: eliminate unnecessary calculations Ruifeng Wang
2021-04-13 18:40   ` Jerin Jacob
2021-03-18 10:25 ` [dpdk-dev] [PATCH 3/4] examples/l3fwd: eliminate unnecessary reloads in loop Ruifeng Wang
2021-04-13 17:43   ` Jerin Jacob
2021-04-14  6:02     ` Ruifeng Wang
2021-03-18 10:25 ` [dpdk-dev] [PATCH 4/4] examples/l3fwd: make data struct to be memory efficient Ruifeng Wang
2021-04-13 19:06   ` Jerin Jacob
2021-04-21  5:22     ` Hemant Agrawal
2021-04-26 10:55       ` Walsh, Conor
2021-04-27  1:19         ` Ruifeng Wang
2021-04-13  8:24 ` [dpdk-dev] [PATCH 0/4] l3fwd improvements Ruifeng Wang
2021-04-13 17:33   ` Jerin Jacob
2021-04-16  9:39 ` Ling, WeiX
2021-06-01  7:56 ` [dpdk-dev] [PATCH v2 0/3] " Ruifeng Wang
2021-06-01  7:56   ` [dpdk-dev] [PATCH v2 1/3] examples/l3fwd: reorganize code for better performance Ruifeng Wang
2021-06-06 18:34     ` Jerin Jacob
2021-06-01  7:56   ` [dpdk-dev] [PATCH v2 2/3] examples/l3fwd: eliminate unnecessary calculations Ruifeng Wang
2021-06-01  7:56   ` [dpdk-dev] [PATCH v2 3/3] examples/l3fwd: eliminate unnecessary reloads in loop Ruifeng Wang
2021-06-06 18:39     ` Jerin Jacob [this message]
2021-06-10  6:57 ` [dpdk-dev] [PATCH v3 0/2] l3fwd improvements Ruifeng Wang
2021-06-10  6:57   ` [dpdk-dev] [PATCH v3 1/2] examples/l3fwd: eliminate unnecessary calculations Ruifeng Wang
2021-06-10  6:57   ` [dpdk-dev] [PATCH v3 2/2] examples/l3fwd: eliminate unnecessary reloads in loop Ruifeng Wang
2021-07-05  8:36   ` [dpdk-dev] [PATCH v3 0/2] l3fwd improvements David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALBAE1NztSQ-SsCozJFpycRG1WBFb7Vg17=eLyw+uu2V=+W5BQ@mail.gmail.com' \
    --to=jerinjacobk@gmail.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=jerinj@marvell.com \
    --cc=nd@arm.com \
    --cc=ola.liljedahl@arm.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).