@@ -152,7 +152,10 @@ static inline void ethernet_update_length(struct net_if *iface,
152
152
static void ethernet_update_rx_stats (struct net_if * iface ,
153
153
struct net_eth_hdr * hdr , size_t length )
154
154
{
155
- #if defined(CONFIG_NET_STATISTICS_ETHERNET )
155
+ if (!IS_ENABLED (CONFIG_NET_STATISTICS_ETHERNET )) {
156
+ return ;
157
+ }
158
+
156
159
eth_stats_update_bytes_rx (iface , length );
157
160
eth_stats_update_pkts_rx (iface );
158
161
@@ -161,7 +164,6 @@ static void ethernet_update_rx_stats(struct net_if *iface,
161
164
} else if (net_eth_is_addr_multicast (& hdr -> dst )) {
162
165
eth_stats_update_multicast_rx (iface );
163
166
}
164
- #endif /* CONFIG_NET_STATISTICS_ETHERNET */
165
167
}
166
168
167
169
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,
653
655
return hdr_frag ;
654
656
}
655
657
656
- #if defined(CONFIG_NET_STATISTICS_ETHERNET )
657
658
static void ethernet_update_tx_stats (struct net_if * iface , struct net_pkt * pkt )
658
659
{
659
660
struct net_eth_hdr * hdr = NET_ETH_HDR (pkt );
660
661
662
+ if (!IS_ENABLED (CONFIG_NET_STATISTICS_ETHERNET )) {
663
+ return ;
664
+ }
665
+
661
666
eth_stats_update_bytes_tx (iface , net_pkt_get_len (pkt ));
662
667
eth_stats_update_pkts_tx (iface );
663
668
@@ -667,9 +672,6 @@ static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
667
672
eth_stats_update_broadcast_tx (iface );
668
673
}
669
674
}
670
- #else
671
- #define ethernet_update_tx_stats (...)
672
- #endif /* CONFIG_NET_STATISTICS_ETHERNET */
673
675
674
676
static int ethernet_send (struct net_if * iface , struct net_pkt * pkt )
675
677
{
0 commit comments