Skip to content

Commit 7a487db

Browse files
Robert LubosChromeos LUCI
authored andcommitted
net: ethernet: Remove L2 header stripping after TX
It seems that this change was solely added to address issues with old TCP stack, which blindly queued packets intended for TX for potential further retransmission, expecting that the packet would remain intact during transmission. I think this assumption was wrong, as it's natural that lower layers append respective headers to the packet, and this "header stripping" behavior was specific for Ethernet L2 only. If an upper layer expects that the packet would need to be retransmitted at some point, it should clone it instead. Therefore, remove the L2 header stripping from the Ethernet L2 to avoid any potential issues in zero-copy case. (cherry picked from commit 21b7122) Original-Signed-off-by: Robert Lubos <[email protected]> GitOrigin-RevId: 21b7122 Cr-Build-Id: 8724909411128659441 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8724909411128659441 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I1c2421576ecab8bd23a0cb3fefafab8bff669c23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6196365 Bot-Commit: ChromeOS Prod (Robot) <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]> Commit-Queue: ChromeOS Prod (Robot) <[email protected]>
1 parent 8b0f48b commit 7a487db

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

subsys/net/l2/ethernet/ethernet.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -671,23 +671,6 @@ static void ethernet_update_tx_stats(struct net_if *iface, struct net_pkt *pkt)
671671
#define ethernet_update_tx_stats(...)
672672
#endif /* CONFIG_NET_STATISTICS_ETHERNET */
673673

674-
static void ethernet_remove_l2_header(struct net_pkt *pkt)
675-
{
676-
size_t reserve = get_reserve_ll_header_size(net_pkt_iface(pkt));
677-
struct net_buf *buf;
678-
679-
/* Remove the buffer added in ethernet_fill_header() */
680-
if (reserve == 0U) {
681-
buf = pkt->buffer;
682-
pkt->buffer = buf->frags;
683-
buf->frags = NULL;
684-
685-
net_pkt_frag_unref(buf);
686-
} else {
687-
net_buf_pull(pkt->buffer, reserve);
688-
}
689-
}
690-
691674
static int ethernet_send(struct net_if *iface, struct net_pkt *pkt)
692675
{
693676
const struct ethernet_api *api = net_if_get_device(iface)->api;
@@ -794,14 +777,12 @@ static int ethernet_send(struct net_if *iface, struct net_pkt *pkt)
794777
ret = net_l2_send(api->send, net_if_get_device(iface), iface, pkt);
795778
if (ret != 0) {
796779
eth_stats_update_errors_tx(iface);
797-
ethernet_remove_l2_header(pkt);
798780
goto arp_error;
799781
}
800782

801783
ethernet_update_tx_stats(iface, pkt);
802784

803785
ret = net_pkt_get_len(pkt);
804-
ethernet_remove_l2_header(pkt);
805786

806787
net_pkt_unref(pkt);
807788
error:

0 commit comments

Comments
 (0)