Re: [PATCH net-next] net: dlink: add get_ethtool_stats in ethtool
From: Andrew Lunn
Date: Mon Oct 28 2024 - 08:56:54 EST
On Sun, Oct 27, 2024 at 04:26:53AM +0900, Moon Yeounsu wrote:
> This patch implement `get_ethtool_stats` to support `ethtool -S`.
>
> Before applying the patch:
> $ ethtool -S enp36s0
> > no stats available
>
> After applying the patch:
> $ ethtool -S enp36s0
> > NIC statistics:
> tx_jumbo_frames: 0
> rx_jumbo_frames: 0
> tcp_checksum_errors: 0
> udp_checksum_errors: 0
> ip_checksum_errors: 0
> tx_packets: 0
> rx_packets: 74
> tx_bytes: 0
> rx_bytes: 14212
> single_collisions: 0
> multi_collisions: 0
> late_collisions: 0
> rx_frames_too_long_errors: 0
> rx_in_range_length_errors: 776
> rx_frames_check_seq_errors: 0
> rx_frames_lost_errors: 0
> tx_frames_abort: 0
> tx_carrier_sense_errors: 0
> tx_multicast_bytes: 0
> rx_multicast_bytes: 360
> tx_multicast_frames: 0
> rx_multicast_frames: 6
> tx_broadcast_frames: 0
> rx_broadcast_frames: 68
> tx_mac_control_frames: 0
> rx_mac_control_frames: 0
> tx_frames_deferred: 0
> tx_frames_excessive_deferral: 0
>
> Tested-on: D-Link DGE-550T Rev-A3
> Signed-off-by: Moon Yeounsu <yyyynoom@xxxxxxxxx>
> ---
> drivers/net/ethernet/dlink/dl2k.c | 229 ++++++++++++++++++------------
We can see there is a lot of code being deleted here, yet you are
adding support for stats. It would be good to explain in the commit
message what is really happening here.
> + DEFINE_STATS(rmon_collisions, EtherStatsCollisions, u32),
> + DEFINE_STATS(rmon_crc_align_errors, EtherStatsCRCAlignErrors, u32),
> + DEFINE_STATS(rmon_under_size_packets, EtherStatsUndersizePkts, u32),
> + DEFINE_STATS(rmon_fragments, EtherStatsFragments, u32),
> + DEFINE_STATS(rmon_jabbers, EtherStatsJabbers, u32),
Please report the standard RMON statistics via ethtool_rmon_stats. The
unstructured ethtool -S without groups should be used for statistics
which do not fit any of the well defined groups.
Andrew
---
pw-bot: cr