[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250424184840.064657da@kernel.org>
Date: Thu, 24 Apr 2025 18:48:40 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: "Xin Tian" <tianx@...silicon.com>
Cc: <netdev@...r.kernel.org>, <leon@...nel.org>, <andrew+netdev@...n.ch>,
<pabeni@...hat.com>, <edumazet@...gle.com>, <davem@...emloft.net>,
<jeff.johnson@....qualcomm.com>, <przemyslaw.kitszel@...el.com>,
<weihg@...silicon.com>, <wanry@...silicon.com>, <jacky@...silicon.com>,
<horms@...nel.org>, <parthiban.veerasooran@...rochip.com>,
<masahiroy@...nel.org>, <kalesh-anakkur.purayil@...adcom.com>,
<geert+renesas@...der.be>, <geert@...ux-m68k.org>
Subject: Re: [PATCH net-next v11 14/14] xsc: add ndo_get_stats64
On Wed, 23 Apr 2025 18:40:01 +0800 Xin Tian wrote:
> @@ -242,11 +243,13 @@ static uint32_t xsc_eth_xmit_frame(struct sk_buff *skb,
> mss = skb_shinfo(skb)->gso_size;
> ihs = xsc_tx_get_gso_ihs(sq, skb);
> num_bytes = skb->len;
> + stats->packets += skb_shinfo(skb)->gso_segs;
> } else {
> opcode = XSC_OPCODE_RAW;
> mss = 0;
> ihs = 0;
> num_bytes = skb->len;
> + stats->packets++;
> }
>
> /*linear data in skb*/
> @@ -284,10 +287,12 @@ static uint32_t xsc_eth_xmit_frame(struct sk_buff *skb,
>
> xsc_txwqe_complete(sq, skb, opcode, ds_cnt, num_wqebbs, num_bytes,
> num_dma, wi);
> + stats->bytes += num_bytes;
For TSO packets this doesn't look right. You should count the length
after TSO, IOW the number of bytes that will reach the wire.
Also you should use helpers from include/linux/u64_stats_sync.h
to make sure there are no races when accessing the statistics
Powered by blists - more mailing lists