@@ -153,15 +153,17 @@ static inline void ethernet_update_length(struct net_if *iface,
153
153
static void ethernet_update_rx_stats (struct net_if * iface , size_t length ,
154
154
bool dst_broadcast , bool dst_eth_multicast )
155
155
{
156
- #if defined(CONFIG_NET_STATISTICS_ETHERNET )
156
+ if (!IS_ENABLED (CONFIG_NET_STATISTICS_ETHERNET )) {
157
+ return ;
158
+ }
159
+
157
160
eth_stats_update_bytes_rx (iface , length );
158
161
eth_stats_update_pkts_rx (iface );
159
162
if (dst_broadcast ) {
160
163
eth_stats_update_broadcast_rx (iface );
161
164
} else if (dst_eth_multicast ) {
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 )
@@ -662,11 +664,14 @@ static struct net_buf *ethernet_fill_header(struct ethernet_context *ctx,
662
664
return hdr_frag ;
663
665
}
664
666
665
- #if defined(CONFIG_NET_STATISTICS_ETHERNET )
666
667
static void ethernet_update_tx_stats (struct net_if * iface , struct net_pkt * pkt )
667
668
{
668
669
struct net_eth_hdr * hdr = NET_ETH_HDR (pkt );
669
670
671
+ if (!IS_ENABLED (CONFIG_NET_STATISTICS_ETHERNET )) {
672
+ return ;
673
+ }
674
+
670
675
eth_stats_update_bytes_tx (iface , net_pkt_get_len (pkt ));
671
676
eth_stats_update_pkts_tx (iface );
672
677
@@ -676,9 +681,6 @@ static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
676
681
eth_stats_update_broadcast_tx (iface );
677
682
}
678
683
}
679
- #else
680
- #define ethernet_update_tx_stats (...)
681
- #endif /* CONFIG_NET_STATISTICS_ETHERNET */
682
684
683
685
static int ethernet_send (struct net_if * iface , struct net_pkt * pkt )
684
686
{
0 commit comments