Skip to content

Commit

Permalink
net: if: Check chksum offloading properly for VLAN interfaces
Browse files Browse the repository at this point in the history
Make sure we check the checksum offloading capabilities correctly
for VLAN interfaces. Use the real Ethernet interface when doing the
check.

Fixes zephyrproject-rtos#78724

Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar authored and aescolar committed Sep 24, 2024
1 parent e75316b commit 00bb90a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -5173,7 +5173,19 @@ static bool need_calc_checksum(struct net_if *iface, enum ethernet_hw_caps caps,
enum ethernet_config_type config_type;

if (net_if_l2(iface) != &NET_L2_GET_NAME(ETHERNET)) {
return true;
/* For VLANs, figure out the main Ethernet interface and
* get the offloading capabilities from it.
*/
if (IS_ENABLED(CONFIG_NET_VLAN) && net_eth_is_vlan_interface(iface)) {
iface = net_eth_get_vlan_main(iface);
if (iface == NULL) {
return true;
}

NET_ASSERT(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET));
} else {
return true;
}
}

if (!(net_eth_get_hw_capabilities(iface) & caps)) {
Expand Down

0 comments on commit 00bb90a

Please sign in to comment.