From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Shenwei Wang <shenwei.wang@nxp.com>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Wei Fang <wei.fang@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v3 1/1] net: fec: add xdp and page pool statistics
Date: Wed, 16 Nov 2022 15:33:36 +0100 [thread overview]
Message-ID: <20221116143336.3385874-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <PAXPR04MB918589D35F8B10307D4D430E89059@PAXPR04MB9185.eurprd04.prod.outlook.com>
From: Shenwei Wang <shenwei.wang@nxp.com>
Date: Mon, 14 Nov 2022 21:17:48 +0000
> > -----Original Message-----
> > From: Alexander Lobakin <alexandr.lobakin@intel.com>
> > Sent: Monday, November 14, 2022 9:23 AM
> > To: Shenwei Wang <shenwei.wang@nxp.com>
> > Cc: Alexander Lobakin <alexandr.lobakin@intel.com>; Andrew Lunn
> > <andrew@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> > <pabeni@redhat.com>; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> > <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John
> > Fastabend <john.fastabend@gmail.com>; Wei Fang <wei.fang@nxp.com>;
> > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; imx@lists.linux.dev;
> > kernel test robot <lkp@intel.com>
> > Subject: [EXT] Re: [PATCH v3 1/1] net: fec: add xdp and page pool statistics
[...]
> Did some testing with the atomic64_t counter, with the following codes to update
> the u64 counter in the end of every NAPI poll cycle.
>
> @@ -1764,7 +1768,13 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
>
> if (xdp_result & FEC_ENET_XDP_REDIR)
> xdp_do_flush_map();
> +#if 1
> + if (xdp_prog) {
> + int i;
> + for(i = 0; i < XDP_STATS_TOTAL; i++)
> + atomic64_add(xdp_stats[i], &rxq->stats[i]);
> + }
> +#endif
> return pkt_received;
> }
>
> With the codes above, the testing result is below:
> root@imx8qxpc0mek:~/bpf# ./xdpsock -i eth0
> sock0@eth0:0 rxdrop xdp-drv
> pps pkts 1.00
> rx 349399 1035008
> tx 0 0
>
> sock0@eth0:0 rxdrop xdp-drv
> pps pkts 1.00
> rx 349407 1384640
> tx 0 0
>
> Without the atomic_add codes above, the testing result is below:
> root@imx8qxpc0mek:~/bpf# ./xdpsock -i eth0
> sock0@eth0:0 rxdrop xdp-drv
> pps pkts 1.00
> rx 350109 1989130
> tx 0 0
>
> sock0@eth0:0 rxdrop xdp-drv
> pps pkts 1.00
> rx 350425 2339786
> tx 0 0
>
> And regarding the u32 counter solution, the testing result is below:
> root@imx8qxpc0mek:~/bpf# ./xdpsock -i eth0
> sock0@eth0:0 rxdrop xdp-drv
> pps pkts 1.00
> rx 361347 2637796
> tx 0 0
>
> There are about 10K pkts/s difference here. Do we really want the u64 counters?
Where did those atomic64_t come from? u64_stats_t use either plain
u64 for 32-bit platforms or local64_t for 64-bit ones. Take a look
at [0] for the example of how x86_64 does this, it is far from
atomic64_t.
>
> Regards,
> Shenwei
>
> >>
> >> Thanks,
> >> Shenwei
> >>
> >>>
> >>> Andrew
> >
> > Thanks,
> > Olek
[0] https://elixir.bootlin.com/linux/v6.1-rc5/source/arch/x86/include/asm/local.h#L31
Thanks,
Olek
next prev parent reply other threads:[~2022-11-16 14:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 15:35 Shenwei Wang
2022-11-14 13:45 ` Alexander Lobakin
2022-11-14 14:08 ` Andrew Lunn
2022-11-14 15:06 ` [EXT] " Shenwei Wang
2022-11-14 15:23 ` Alexander Lobakin
2022-11-14 21:17 ` [EXT] " Shenwei Wang
2022-11-14 21:46 ` Andrew Lunn
2022-11-16 14:33 ` Alexander Lobakin [this message]
2022-11-16 16:00 ` Shenwei Wang
2022-11-14 14:53 ` Shenwei Wang
2022-11-14 15:27 ` Alexander Lobakin
2022-11-14 15:31 ` [EXT] " Shenwei Wang
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=20221116143336.3385874-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=imx@lists.linux.dev \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
/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
all inboxes | Powered by JetHome®