Skip to content

Commit

Permalink
net: ethernet: remove unused family variable
Browse files Browse the repository at this point in the history
Remove unused family variable from receive function in ethernet layer 2.
It is checked only once under such conditions, that do not allow the
variable to be different.

Signed-off-by: Cla Mattia Galliard <[email protected]>
  • Loading branch information
clamattia committed Jan 14, 2025
1 parent 0728f5d commit e3ce1ee
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions subsys/net/l2/ethernet/ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
uint8_t hdr_len = sizeof(struct net_eth_hdr);
uint16_t type;
struct net_linkaddr *lladdr;
sa_family_t family = AF_UNSPEC;
bool is_vlan_pkt = false;

/* This expects that the Ethernet header is in the first net_buf
Expand Down Expand Up @@ -315,18 +314,14 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
case NET_ETH_PTYPE_IP:
case NET_ETH_PTYPE_ARP:
net_pkt_set_family(pkt, AF_INET);
family = AF_INET;
break;
case NET_ETH_PTYPE_IPV6:
net_pkt_set_family(pkt, AF_INET6);
family = AF_INET6;
break;
case NET_ETH_PTYPE_EAPOL:
family = AF_UNSPEC;
break;
#if defined(CONFIG_NET_L2_PTP)
case NET_ETH_PTYPE_PTP:
family = AF_UNSPEC;
break;
#endif
case NET_ETH_PTYPE_LLDP:
Expand All @@ -339,7 +334,6 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
#endif
default:
if (IS_ENABLED(CONFIG_NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE)) {
family = AF_UNSPEC;
break;
}

Expand Down Expand Up @@ -398,8 +392,7 @@ static enum net_verdict ethernet_recv(struct net_if *iface,

ethernet_update_rx_stats(iface, hdr, net_pkt_get_len(pkt) + hdr_len);

if (IS_ENABLED(CONFIG_NET_ARP) &&
family == AF_INET && type == NET_ETH_PTYPE_ARP) {
if (IS_ENABLED(CONFIG_NET_ARP) && type == NET_ETH_PTYPE_ARP) {
NET_DBG("ARP packet from %s received",
net_sprint_ll_addr((uint8_t *)hdr->src.addr,
sizeof(struct net_eth_addr)));
Expand Down

0 comments on commit e3ce1ee

Please sign in to comment.