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 BC14CA0C46; Fri, 17 Sep 2021 13:24:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB104410FA; Fri, 17 Sep 2021 13:24:37 +0200 (CEST) Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by mails.dpdk.org (Postfix) with ESMTP id 46A53410E9 for ; Fri, 17 Sep 2021 13:24:34 +0200 (CEST) Received: by mail-il1-f179.google.com with SMTP id a20so9914692ilq.7 for ; Fri, 17 Sep 2021 04:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RgXQKDUKvZoHilqwnVX0+rkInbv5FA78W+IXfMrle2w=; b=ekfaCKyVQVJl89py7CoU5WDyePQscwpwBGgMDYPS1WtAVR8wwsTPjP7sWnT4/yjaub aqaEkTSQVnVydCSBG1lN0iPWGeLasSulXae1vT3esKByu0Mg2w2zhq98ivSUNOEA4+jc FjrUCjaYa/q+O5E20Ei2Dd4fNyU6MGjsEUfSSI3oeT1FgrnzvL1Q4pZQ5TcpXHq+5ZJf IHTkicCX6/E0rCP+nKvHzC7Se4yp2tWIRXnXkjD3dNtCkxjVSeFO1h9tPsxw5RF9rCY0 klpN4x0B0fDeIBra0EYSCVuNmZ7/4OGX9/XTjtN5V2c6Z7CT0QUfkNEU99pC3IEWybs9 VmQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RgXQKDUKvZoHilqwnVX0+rkInbv5FA78W+IXfMrle2w=; b=Ri9MH/JzIG9n5dfLPmjpeL5+TW0PT89C3otv8jreLWlJcLh/kqjAqFrVwfCOLvUjsv 7uJVislgid1zp4vfEhXVYQ/KontO7Uhv/3s14olCkUkL4lm3rZXg9RHMD7PdyimsUiWw v94Nuklaa3C93uR4PAnGzxhLB+wKnoJptPWP9jhLf/EIPpbagv4VnCl3XCGQDdB9lOck B0tSQjOfQAcBpCs6tSp4IAIAPK0BNjM7lkSAGHoet1coibGDisuO65688BXr8t1hCApw fsL7e/xq3GxLoOelSttYhWl+w7EVlifOKPb2NYMjioL0EEf68JAJKh6SDt72EmlgVmoo VfVA== X-Gm-Message-State: AOAM531tEc8a2YGVULv60f537YrGi/JLHDnVJpZYdvRuFUknT5z3mD7G aR/JwylnpnhuYUy42YZaLU8ama1g+eWYeTsGVz0= X-Google-Smtp-Source: ABdhPJwaOJyRHgwv9jDa9my8Ha0JjzuxNWORRRXP2E7fbieUda1TvEVBC2STZOVqfLc5YqK/KRkrmrR7uinjY49KmBY= X-Received: by 2002:a92:6e12:: with SMTP id j18mr7637773ilc.243.1631877873507; Fri, 17 Sep 2021 04:24:33 -0700 (PDT) MIME-Version: 1.0 References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210917080121.329373-1-xuemingl@nvidia.com> <20210917080121.329373-7-xuemingl@nvidia.com> In-Reply-To: <20210917080121.329373-7-xuemingl@nvidia.com> From: Jerin Jacob Date: Fri, 17 Sep 2021 16:54:07 +0530 Message-ID: To: Xueming Li Cc: dpdk-dev , Xiaoyu Min , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , Xiaoyun Li Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3 6/8] app/testpmd: add common fwd wrapper 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 Fri, Sep 17, 2021 at 1:33 PM Xueming Li wrote: > > From: Xiaoyu Min > > Added common forwarding wrapper function for all fwd engines > which do the following in common: > > - record core cycles > - call rte_eth_rx_burst(...,nb_pkt_per_burst) > - update received packets > - handle received mbufs with callback function > > For better performance, the function is defined as macro. > > Signed-off-by: Xiaoyu Min > Signed-off-by: Xueming Li > --- > app/test-pmd/5tswap.c | 25 +++++-------------------- > app/test-pmd/csumonly.c | 25 ++++++------------------- > app/test-pmd/flowgen.c | 20 +++++--------------- > app/test-pmd/icmpecho.c | 30 ++++++++---------------------- > app/test-pmd/iofwd.c | 24 +++++------------------- > app/test-pmd/macfwd.c | 24 +++++------------------- > app/test-pmd/macswap.c | 23 +++++------------------ > app/test-pmd/rxonly.c | 32 ++++++++------------------------ > app/test-pmd/testpmd.h | 19 +++++++++++++++++++ > 9 files changed, 66 insertions(+), 156 deletions(-) > > diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c > index e8cef9623b..8fe940294f 100644 > --- a/app/test-pmd/5tswap.c > +++ b/app/test-pmd/5tswap.c > @@ -82,18 +82,16 @@ swap_udp(struct rte_udp_hdr *udp_hdr) > * Parses each layer and swaps it. When the next layer doesn't match it stops. > */ > +PKT_BURST_FWD(_5tuple_swap_stream); Please make _5tuple_swap_stream aka "cb" as inline function to make sure compiler doesn't generate yet another function pointer. > struct fwd_engine mac_swap_engine = { > .fwd_mode_name = "macswap", > .port_fwd_begin = NULL, > .port_fwd_end = NULL, > - .packet_fwd = pkt_burst_mac_swap, See below > + .packet_fwd = pkt_burst_fwd, > > +#define PKT_BURST_FWD(cb) \ Probably it can pass prefix too like PKT_BURST_FWD(cb, prefix) to make a unique function and call PKT_BURST_FWD(_5tuple_swap_stream, mac_swap) for better readability and avoid diff above section. > +static void \ > +pkt_burst_fwd(struct fwd_stream *fs) pkt_burst_fwd##prefix(struct fwd_stream *fs) \ > +{ \ > + struct rte_mbuf *pkts_burst[nb_pkt_per_burst]; \ > + uint16_t nb_rx; \ > + uint64_t start_tsc = 0; \ > + \ > + get_start_cycles(&start_tsc); \ > + nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, \ > + pkts_burst, nb_pkt_per_burst); \ > + inc_rx_burst_stats(fs, nb_rx); \ > + if (unlikely(nb_rx == 0)) \ > + return; \ > + fs->rx_packets += nb_rx; \ > + cb(fs, nb_rx, pkts_burst); \ > + get_end_cycles(fs, start_tsc); \ > +} > + > /* > * Work-around of a compilation error with ICC on invocations of the > * rte_be_to_cpu_16() function. > -- > 2.33.0 >