From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 866BBA0524; Tue, 13 Apr 2021 19:43:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C4EF161235; Tue, 13 Apr 2021 19:43:46 +0200 (CEST) Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by mails.dpdk.org (Postfix) with ESMTP id 57C55161232 for ; Tue, 13 Apr 2021 19:43:44 +0200 (CEST) Received: by mail-il1-f176.google.com with SMTP id c15so14817562ilj.1 for ; Tue, 13 Apr 2021 10:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5oq651yiW79TZbyOReoiTF1ha2UDCkEkGb9j7151ox8=; b=g/T5GasVlVSRwkiktdFqaAzxi09xri2fokkECkCwuvz1YGY6WaBJO+KL3UWdvGdJ6G xyc9Ncg00nSg/k//8O7frJKaSRAhbafz7If1mHOvCI57VEGC0jz04lY8Kv75WypNvdA6 u2FfqSTgVhIKntFOwNyuVzZ1fqc7+WoTqcW151rJheP5ASrujCRqqmbi6jO4LLoYRtdB MniGrNqfPyGldb/wb3OF/z1txQvtuuAU1IyRU+25G7BY/ob2vcaspn8WZ/y7z6PFmeEL MkvGkRjqKR6u5wKZPIFriEsSGDvm9crcl1rXA5/h2/e5AR9YX+8THei8et8X7OY+AdTG mdTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5oq651yiW79TZbyOReoiTF1ha2UDCkEkGb9j7151ox8=; b=O+9ocWBuTSD5cDPjpvbvE0xY7sNqkRWh/LztretfTx38spZobrF7y1b68YVSUiP5Am qsn6NyApotjQ6p+8CA16WYAf0dUMpmnx7tRLr+B/FphRcrACwxql14BBm+A7Iy0wC2Bg DpYI5p15yzHJAxV9vp0Gkyb49HTTJfNIvuq8DV6wqImUfFwx8zWWxMK7Anvlw2DVJMb4 gvN9SctYJtHbNY4GsDgMZGbTokU3X7MGwlK6AK9IbwlazuwgE3d83qZ6cjMb/EyIqbHc KyKfERtEza0h1tjiHEOS2p6PK+1n5fV20ZFqTAYFW6I5h77ablUMQiEoSr8fV6YJQHBo ZMjw== X-Gm-Message-State: AOAM533qKDuPkEpgtXtYKxiGa7murpnv9KD/pouNSvoZAFZosltIJCRF V3nYVqSPMtiyyof+ahBrWt2WzJcnUVm/PYkoCAs= X-Google-Smtp-Source: ABdhPJzRqWbu02TwFiiJ+vx2lfJ/k3uT7g+tJsNlVvOgJXf4Smo/NHOqK4d6viPrKQUqiztjRAXsbXR3AJWudZ/qemQ= X-Received: by 2002:a92:c566:: with SMTP id b6mr27191349ilj.162.1618335823292; Tue, 13 Apr 2021 10:43:43 -0700 (PDT) MIME-Version: 1.0 References: <20210318102550.59265-1-ruifeng.wang@arm.com> <20210318102550.59265-4-ruifeng.wang@arm.com> In-Reply-To: <20210318102550.59265-4-ruifeng.wang@arm.com> From: Jerin Jacob Date: Tue, 13 Apr 2021 23:13:27 +0530 Message-ID: To: Ruifeng Wang Cc: Jerin Jacob , Hemant Agrawal , Ferruh Yigit , Thomas Monjalon , David Marchand , dpdk-dev , nd , Honnappa Nagarahalli Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 3/4] examples/l3fwd: eliminate unnecessary reloads in loop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Mar 18, 2021 at 3:56 PM Ruifeng Wang 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. At least, in octeontx2, I dont see any performance improvement. But change looks good. Please find below a comment. > > Signed-off-by: Ruifeng Wang > --- > 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 3dcf1fef1..d338590b9 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -190,14 +190,16 @@ lpm_main_loop(__rte_unused void *dummy) > lcore_id = rte_lcore_id(); > qconf = &lcore_conf[lcore_id]; > > - if (qconf->n_rx_queue == 0) { > + uint16_t n_rx_q = qconf->n_rx_queue; > + uint16_t n_tx_p = qconf->n_tx_port; How about adding const?