RE: [EXT] Re: [PATCH 1/1] net: fec: add initial XDP support

Shenwei Wang
2022-09-29T13:35:08Z

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, September 29, 2022 8:24 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Joakim Zhang <qiangqing.zhang@nxp.com>; 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>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; imx@lists.linux.dev
> Subject: Re: [EXT] Re: [PATCH 1/1] net: fec: add initial XDP support
>
> Caution: EXT Email
>
> > > > +struct fec_enet_xdp_stats {
> > > > + u64 xdp_pass;
> > > > + u64 xdp_drop;
> > > > + u64 xdp_xmit;
> > > > + u64 xdp_redirect;
> > > > + u64 xdp_xmit_err;
> > > > + u64 xdp_tx;
> > > > + u64 xdp_tx_err;
> > > > +};
> > > > +
> > > > + switch (act) {
> > > > + case XDP_PASS:
> > > > + rxq->stats.xdp_pass++;
> > >
> > > Since the stats are u64, and most machines using the FEC are 32 bit,
> > > you cannot just do an increment. Took a look at u64_stats_sync.h.
> > >
> >
>
> > As this increment is only executed under the NAPI kthread context, is
> > the protection still required?
>
> Are the statistics values read by ethtool under NAPI kthread context?
>

You are right. The read is not under NAPI context.

Thanks,
Shenwei

> Andrew