Re: [EXT] Re: [PATCH v3 1/1] net: fec: add xdp and page pool statistics

From: Andrew Lunn
Date: Mon Nov 14 2022 - 16:46:50 EST


> @@ -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

Atomic operations are expensive. You should not use them unless you
really do need them.

What driver are you copying here? There is nothing particularly new
here, so you should just be copying code from another driver, and hope
you picked a good example.

Andrew