drivers: eth: e1000: Add Ethernet statistics support

Support e1000 driver Ethernet statistics if relevant config
options are enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2025-04-22 17:47:40 +03:00 committed by Benjamin Cabé
commit f3cd029cce
2 changed files with 15 additions and 0 deletions

View file

@ -270,10 +270,22 @@ static void e1000_iface_init(struct net_if *iface)
LOG_DBG("done");
}
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
static struct net_stats_eth *get_stats(const struct device *dev)
{
struct e1000_dev *ctx = dev->data;
return &ctx->stats;
}
#endif
static const struct ethernet_api e1000_api = {
.iface_api.init = e1000_iface_init,
#if defined(CONFIG_ETH_E1000_PTP_CLOCK)
.get_ptp_clock = e1000_get_ptp_clock,
#endif
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
.get_stats = get_stats,
#endif
.get_capabilities = e1000_caps,
.send = e1000_send,

View file

@ -94,6 +94,9 @@ struct e1000_dev {
const struct device *ptp_clock;
double clk_ratio;
#endif
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
struct net_stats_eth stats;
#endif
};
struct e1000_config {