net/ethernet: Cleanup a bit on the usage of ifdefs

ARP, LLDP and GPTP functions have dummies in case of being disabled so
let's use IS_ENABLED() accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-05-28 13:42:57 +02:00 committed by Jukka Rissanen
commit 845f070c1e
2 changed files with 13 additions and 13 deletions

View file

@ -268,26 +268,24 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
ethernet_update_rx_stats(iface, pkt, net_pkt_get_len(pkt) + hdr_len);
#ifdef CONFIG_NET_ARP
if (family == AF_INET && type == NET_ETH_PTYPE_ARP) {
if (IS_ENABLED(CONFIG_NET_ARP) &&
family == AF_INET && type == NET_ETH_PTYPE_ARP) {
NET_DBG("ARP packet from %s received",
log_strdup(net_sprint_ll_addr(
(u8_t *)hdr->src.addr,
sizeof(struct net_eth_addr))));
#ifdef CONFIG_NET_IPV4_AUTO
if (net_ipv4_autoconf_input(iface, pkt) == NET_DROP) {
if (IS_ENABLED(CONFIG_NET_IPV4_AUTO) &&
net_ipv4_autoconf_input(iface, pkt) == NET_DROP) {
return NET_DROP;
}
#endif
return net_arp_input(pkt, hdr);
}
#endif
#if defined(CONFIG_NET_GPTP)
if (type == NET_ETH_PTYPE_PTP) {
if (IS_ENABLED(CONFIG_NET_GPTP) && type == NET_ETH_PTYPE_PTP) {
return net_gptp_recv(iface, pkt);
}
#endif
ethernet_update_length(iface, pkt);
@ -531,6 +529,8 @@ static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
eth_stats_update_broadcast_tx(iface);
}
}
#else
#define ethernet_update_tx_stats(...)
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
static void ethernet_remove_l2_header(struct net_pkt *pkt)
@ -634,9 +634,9 @@ send:
ethernet_remove_l2_header(pkt);
goto error;
}
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
ethernet_update_tx_stats(iface, pkt);
#endif
ret = net_pkt_get_len(pkt);
ethernet_remove_l2_header(pkt);
@ -911,7 +911,7 @@ int net_eth_vlan_disable(struct net_if *iface, u16_t tag)
return 0;
}
#endif
#endif /* CONFIG_NET_VLAN */
NET_L2_INIT(ETHERNET_L2, ethernet_recv, ethernet_send, ethernet_enable,
ethernet_flags);