From: Simon Horman <horms@kernel.org>
To: Vivian Wang <wangruikang@iscas.ac.cn>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
Jakub Kicinski <kuba@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Yixun Lan <dlan@gentoo.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Junhui Liu <junhui.liu@pigmoral.tech>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
linux-kernel@vger.kernel.org,
Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Vivian Wang <uwu@dram.page>
Subject: Re: [PATCH net-next v9 2/5] net: spacemit: Add K1 Ethernet MAC
Date: Tue, 9 Sep 2025 17:18:26 +0100 [thread overview]
Message-ID: <20250909161826.GA23218@horms.kernel.org> (raw)
In-Reply-To: <20250909161549.GC20205@horms.kernel.org>
On Tue, Sep 09, 2025 at 05:15:56PM +0100, Simon Horman wrote:
> On Sat, Sep 06, 2025 at 12:35:37AM +0800, Vivian Wang wrote:
> > On 9/6/25 00:01, Simon Horman wrote:
> >
> > > On Fri, Sep 05, 2025 at 11:45:29PM +0800, Vivian Wang wrote:
> > >
> > > ...
> > >
> > > Hi Vivian,
> > >
> > >>>> + status = emac_rx_frame_status(priv, rx_desc);
> > >>>> + if (unlikely(status == RX_FRAME_DISCARD)) {
> > >>>> + ndev->stats.rx_dropped++;
> > >>> As per the comment in struct net-device,
> > >>> ndev->stats should not be used in modern drivers.
> > >>>
> > >>> Probably you want to implement NETDEV_PCPU_STAT_TSTATS.
> > >>>
> > >>> Sorry for not mentioning this in an earlier review of
> > >>> stats in this driver.
> > >>>
> > >> On a closer look, these counters in ndev->stats seems to be redundant
> > >> with the hardware-tracked statistics, so maybe I should just not bother
> > >> with updating ndev->stats. Does that make sense?
> > > For rx/tx packets/bytes I think that makes sense.
> > > But what about rx/tx drops?
> >
> > Right... but tstats doesn't have *_dropped. It seems that tx_dropped and
> > rx_dropped are considered "slow path" for real devices. It makes sense
> > to me that those should be very rare.
> >
> > So it seems that what I should do is to just track tx_dropped and
> > rx_dropped myself in a member in emac_priv and report in the
> > ndo_get_stats64 callback, and use the hardware stuff for the rest, as
> > implemented now.
>
> Thanks, that makes sense to me.
Oops, for the 2nd time today I see I've responded where other's have
already done so. In this case, please take Jakub's advice elsewhere
in this thread.
next prev parent reply other threads:[~2025-09-09 16:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 11:09 [PATCH net-next v9 0/5] Add Ethernet MAC support for SpacemiT K1 Vivian Wang
2025-09-05 11:09 ` [PATCH net-next v9 1/5] dt-bindings: net: Add " Vivian Wang
2025-09-05 11:09 ` [PATCH net-next v9 2/5] net: spacemit: Add K1 Ethernet MAC Vivian Wang
2025-09-05 15:35 ` Simon Horman
2025-09-05 15:45 ` Vivian Wang
2025-09-05 16:01 ` Simon Horman
2025-09-05 16:35 ` Vivian Wang
2025-09-05 23:59 ` Jakub Kicinski
2025-09-06 1:46 ` Vivian Wang
2025-09-07 8:22 ` Vivian Wang
2025-09-09 0:34 ` Jakub Kicinski
2025-09-09 16:15 ` Simon Horman
2025-09-09 16:18 ` Simon Horman [this message]
2025-09-05 11:09 ` [PATCH net-next v9 3/5] riscv: dts: spacemit: Add Ethernet support for K1 Vivian Wang
2025-09-05 11:09 ` [PATCH net-next v9 4/5] riscv: dts: spacemit: Add Ethernet support for BPI-F3 Vivian Wang
2025-09-05 11:09 ` [PATCH net-next v9 5/5] riscv: dts: spacemit: Add Ethernet support for Jupiter Vivian 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=20250909161826.GA23218@horms.kernel.org \
--to=horms@kernel.org \
--cc=alex@ghiti.fr \
--cc=andrew+netdev@lunn.ch \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dlan@gentoo.org \
--cc=edumazet@google.com \
--cc=junhui.liu@pigmoral.tech \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=troy.mitchell@linux.spacemit.com \
--cc=uwu@dram.page \
--cc=vadim.fedorenko@linux.dev \
--cc=wangruikang@iscas.ac.cn \
/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;
as well as URLs for NNTP newsgroup(s).