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:
parent
0e5df7a67b
commit
f3cd029cce
2 changed files with 15 additions and 0 deletions
|
@ -270,10 +270,22 @@ static void e1000_iface_init(struct net_if *iface)
|
||||||
LOG_DBG("done");
|
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 = {
|
static const struct ethernet_api e1000_api = {
|
||||||
.iface_api.init = e1000_iface_init,
|
.iface_api.init = e1000_iface_init,
|
||||||
#if defined(CONFIG_ETH_E1000_PTP_CLOCK)
|
#if defined(CONFIG_ETH_E1000_PTP_CLOCK)
|
||||||
.get_ptp_clock = e1000_get_ptp_clock,
|
.get_ptp_clock = e1000_get_ptp_clock,
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
|
||||||
|
.get_stats = get_stats,
|
||||||
#endif
|
#endif
|
||||||
.get_capabilities = e1000_caps,
|
.get_capabilities = e1000_caps,
|
||||||
.send = e1000_send,
|
.send = e1000_send,
|
||||||
|
|
|
@ -94,6 +94,9 @@ struct e1000_dev {
|
||||||
const struct device *ptp_clock;
|
const struct device *ptp_clock;
|
||||||
double clk_ratio;
|
double clk_ratio;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
|
||||||
|
struct net_stats_eth stats;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct e1000_config {
|
struct e1000_config {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue