Thread (16 messages) 16 messages, 3 authors, 2025-09-09

Re: [PATCH net-next v9 2/5] net: spacemit: Add K1 Ethernet MAC

From: Simon Horman <horms@kernel.org>
Date: 2025-09-09 16:18:33
Also in: linux-devicetree, linux-riscv, lkml, spacemit

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:
quoted
On 9/6/25 00:01, Simon Horman wrote:
quoted
On Fri, Sep 05, 2025 at 11:45:29PM +0800, Vivian Wang wrote:

...

Hi Vivian,
quoted
quoted
quoted
+		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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help