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 B4792A0524; Tue, 13 Apr 2021 21:06:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B41A161295; Tue, 13 Apr 2021 21:06:22 +0200 (CEST) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by mails.dpdk.org (Postfix) with ESMTP id BE65016128A for ; Tue, 13 Apr 2021 21:06:20 +0200 (CEST) Received: by mail-il1-f181.google.com with SMTP id c15so15027854ilj.1 for ; Tue, 13 Apr 2021 12:06:20 -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=ph7BBRwOnJYc57Mik3YuowP0ijdFiKSPvHQJjl5wfV4=; b=bwGnBfeXJDve2lj68phyalkBqtp3IGbJye3qPYckuYvuaygdbOlDAew2jbcUau77aq QUwyVkIvxFofCzO3ZhSjXqWMcpgnmg6xE4jJBFWciovceK3L08ktL7zci2gMvPFZQuXh RMoYrXQazM+OtYRiG5Cgfr4eeZws7TkEzWm8V3DTyu3fZxy/X5isL5csTu0ZnOUg9zsn W2A/Aq+M4NJBt9YQQc5InvguWjEXBr8DWKCLJAIJjkS/HPrU8SiGQfmzOZRqJ3yvab6T GWXJXlstFzvi84M/h1pQ6fLvdtAVIbbS5+zH1pBGhnXks8LRIQbnjd9fmobgHkE+psWw TZ/Q== 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=ph7BBRwOnJYc57Mik3YuowP0ijdFiKSPvHQJjl5wfV4=; b=HRT9ix5X6iMTDkTp2yXS4ruZ/zRi/cOieDV8kCo2G3Hb/FUKObs+FIwFYzDkQs4bf4 31IBJbG4qWT1Lp447pCDMdny71L2dKs1JQVjek3AGGb2nawxYCcJ/M4bBg+zsjvjlWQP Ns7ObFItF6EMtcY6LmqhL6JEv8GbjdjI2Udu+kO/BdhsWILLXApwSBcfomqNgxsK3WT+ T0+P91jdvKwZBEnYLnvzObTz+SJKfinrnRvQNxae9FlSPR/I6qJJfbaVlv4bKw98gmgh NTnmQZizgtESLeJmVOfH3ZI8gVPjMkNCj/x/imdKZJMXPnh/iScFFQglvRPIVZynw/uJ 3LoA== X-Gm-Message-State: AOAM5336tcWQTb9TgPxGWOCxd8jB5JpYp0/N3UfeqZWu76ZyE4KILPH7 H0SecLaLCrngjAdkGNbS2Yv+0k29buF9iD5WyVo= X-Google-Smtp-Source: ABdhPJzaPDJb0GkCCzuMiVye3hsx0uchFqyIhlcoxsahA2oIjkkAM9kqNXV0W0s6U4xp4p43PdVHKdhUx0jG1RTTcvY= X-Received: by 2002:a92:c26a:: with SMTP id h10mr9118097ild.294.1618340780052; Tue, 13 Apr 2021 12:06:20 -0700 (PDT) MIME-Version: 1.0 References: <20210318102550.59265-1-ruifeng.wang@arm.com> <20210318102550.59265-5-ruifeng.wang@arm.com> In-Reply-To: <20210318102550.59265-5-ruifeng.wang@arm.com> From: Jerin Jacob Date: Wed, 14 Apr 2021 00:36:03 +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 4/4] examples/l3fwd: make data struct to be memory efficient 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: > > There are some holes in data struct lcore_conf. The holes are > due to alignment requirement. > > For struct lcore_rx_queue, there is no need to make every element > of this type to be cache line aligned, because the data is not > shared between cores. > > Member len of struct mbuf_table can be moved out. So data can be > packed and there will be no need to load an extra cache line when > mbuf table is empty. > > The change showed slight performance improvement on N1SDP platform. > > Suggested-by: Honnappa Nagarahalli > > Signed-off-by: Ruifeng Wang This change alone is OK in the octeontx2 platform.(No difference in performance) combining with 3/4 shows some regression. Probably is due to prefetch or 128B cache line tuning specifics. > --- > examples/l3fwd/l3fwd.h | 12 ++++++------ > examples/l3fwd/l3fwd_common.h | 4 ++-- > examples/l3fwd/l3fwd_em.c | 6 +++--- > examples/l3fwd/l3fwd_lpm.c | 6 +++--- > 4 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h > index 2cf06099e..f3a301e12 100644 > --- a/examples/l3fwd/l3fwd.h > +++ b/examples/l3fwd/l3fwd.h > @@ -57,22 +57,22 @@ > #define HASH_ENTRY_NUMBER_DEFAULT 4 > > struct mbuf_table { > - uint16_t len; > struct rte_mbuf *m_table[MAX_PKT_BURST]; > }; > > struct lcore_rx_queue { > uint16_t port_id; > uint8_t queue_id; > -} __rte_cache_aligned; > +}; > > struct lcore_conf { > - uint16_t n_rx_queue; > struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE]; > - uint16_t n_tx_port; > uint16_t tx_port_id[RTE_MAX_ETHPORTS]; > uint16_t tx_queue_id[RTE_MAX_ETHPORTS]; > + uint16_t tx_mbuf_len[RTE_MAX_ETHPORTS]; > struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS]; > + uint16_t n_rx_queue; > + uint16_t n_tx_port; > void *ipv4_lookup_struct; > void *ipv6_lookup_struct; > } __rte_cache_aligned; > @@ -122,7 +122,7 @@ send_single_packet(struct lcore_conf *qconf, > { > uint16_t len; > > - len = qconf->tx_mbufs[port].len; > + len = qconf->tx_mbuf_len[port]; > qconf->tx_mbufs[port].m_table[len] = m; > len++; > > @@ -132,7 +132,7 @@ send_single_packet(struct lcore_conf *qconf, > len = 0; > } > > - qconf->tx_mbufs[port].len = len; > + qconf->tx_mbuf_len[port] = len; > return 0; > } > > diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h > index 7d83ff641..05e03dbfc 100644 > --- a/examples/l3fwd/l3fwd_common.h > +++ b/examples/l3fwd/l3fwd_common.h > @@ -183,7 +183,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], > { > uint32_t len, j, n; > > - len = qconf->tx_mbufs[port].len; > + len = qconf->tx_mbuf_len[port]; > > /* > * If TX buffer for that queue is empty, and we have enough packets, > @@ -258,7 +258,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], > } > } > > - qconf->tx_mbufs[port].len = len; > + qconf->tx_mbuf_len[port] = len; > } > > #endif /* _L3FWD_COMMON_H_ */ > diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c > index 9996bfba3..1970e0376 100644 > --- a/examples/l3fwd/l3fwd_em.c > +++ b/examples/l3fwd/l3fwd_em.c > @@ -662,12 +662,12 @@ em_main_loop(__rte_unused void *dummy) > > for (i = 0; i < qconf->n_tx_port; ++i) { > portid = qconf->tx_port_id[i]; > - if (qconf->tx_mbufs[portid].len == 0) > + if (qconf->tx_mbuf_len[portid] == 0) > continue; > send_burst(qconf, > - qconf->tx_mbufs[portid].len, > + qconf->tx_mbuf_len[portid], > portid); > - qconf->tx_mbufs[portid].len = 0; > + qconf->tx_mbuf_len[portid] = 0; > } > > prev_tsc = cur_tsc; > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index d338590b9..e62139a0e 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -220,12 +220,12 @@ lpm_main_loop(__rte_unused void *dummy) > > for (i = 0; i < n_tx_p; ++i) { > portid = qconf->tx_port_id[i]; > - if (qconf->tx_mbufs[portid].len == 0) > + if (qconf->tx_mbuf_len[portid] == 0) > continue; > send_burst(qconf, > - qconf->tx_mbufs[portid].len, > + qconf->tx_mbuf_len[portid], > portid); > - qconf->tx_mbufs[portid].len = 0; > + qconf->tx_mbuf_len[portid] = 0; > } > > prev_tsc = cur_tsc; > -- > 2.25.1 >