realtek: dsa: report multicast and broadcast frame counts

The port counters hold the multicast and broadcast frame counts, and
the frame totals are already built from them, but the fields that
report them on their own are never assigned. ethtool leaves the
multicast and broadcast members of the standard MAC statistics out, and
the multicast member of the link statistics reads zero.

Assign them from the counters that are already collected.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25756
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
Quinn O'Shea authored and Markus Stockhausen committed 2026-10-10 17:12:45 +02:00
1 parent 5d9fa15647
commit 7c8ca38c76
1 file changed
+6
@@ -469,6 +469,7 @@ static void rtldsa_update_link_stat(struct rtnl_link_stats64 *s,
4 * s->tx_packets -
64 * counters->tx_pause_frames.val;
s->multicast = counters->if_in_mcast_pkts.val;
s->collisions = counters->collisions.val;
s->rx_dropped = counters->drop_events.val;
@@ -751,6 +752,11 @@ void rtldsa_get_eth_mac_stats(struct dsa_switch *ds, int port,
mac_stats->OctetsTransmittedOK = counters->if_out_octets.val -
18 * mac_stats->FramesTransmittedOK;
mac_stats->MulticastFramesXmittedOK = counters->if_out_mcast_pkts.val;
mac_stats->BroadcastFramesXmittedOK = counters->if_out_bcast_pkts.val;
mac_stats->MulticastFramesReceivedOK = counters->if_in_mcast_pkts.val;
mac_stats->BroadcastFramesReceivedOK = counters->if_in_bcast_pkts.val;
mac_stats->SingleCollisionFrames = counters->single_collisions.val;
mac_stats->MultipleCollisionFrames = counters->multiple_collisions.val;
mac_stats->FramesWithDeferredXmissions = counters->deferred_transmissions.val;