Skip to content

Commit f24975f

Browse files
committed
net: ethernet: cleanup net-stats calls
There is no need to if-def away the net-stats function since there is a shim available now. Signed-off-by: Cla Mattia Galliard <[email protected]>
1 parent d9c5210 commit f24975f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

subsys/net/l2/ethernet/ethernet.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ static inline void ethernet_update_length(struct net_if *iface,
152152
static void ethernet_update_rx_stats(struct net_if *iface,
153153
struct net_eth_hdr *hdr, size_t length)
154154
{
155-
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
155+
if (!IS_ENABLED(CONFIG_NET_STATISTICS_ETHERNET)) {
156+
return;
157+
}
158+
156159
eth_stats_update_bytes_rx(iface, length);
157160
eth_stats_update_pkts_rx(iface);
158161

@@ -161,7 +164,6 @@ static void ethernet_update_rx_stats(struct net_if *iface,
161164
} else if (net_eth_is_addr_multicast(&hdr->dst)) {
162165
eth_stats_update_multicast_rx(iface);
163166
}
164-
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
165167
}
166168

167169
static inline bool eth_is_vlan_tag_stripped(struct net_if *iface)
@@ -653,11 +655,14 @@ static struct net_buf *ethernet_fill_header(struct ethernet_context *ctx,
653655
return hdr_frag;
654656
}
655657

656-
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
657658
static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
658659
{
659660
struct net_eth_hdr *hdr = NET_ETH_HDR(pkt);
660661

662+
if (!IS_ENABLED(CONFIG_NET_STATISTICS_ETHERNET)) {
663+
return;
664+
}
665+
661666
eth_stats_update_bytes_tx(iface, net_pkt_get_len(pkt));
662667
eth_stats_update_pkts_tx(iface);
663668

@@ -667,9 +672,6 @@ static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
667672
eth_stats_update_broadcast_tx(iface);
668673
}
669674
}
670-
#else
671-
#define ethernet_update_tx_stats(...)
672-
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
673675

674676
static int ethernet_send(struct net_if *iface, struct net_pkt *pkt)
675677
{

0 commit comments

Comments
 (0)