From f1bbb3232be43f63ab56cb7f35c00a8b64d4407c Mon Sep 17 00:00:00 2001 From: Easyoakland <97992568+Easyoakland@users.noreply.github.com> Date: Fri, 24 Jan 2025 00:10:30 -0700 Subject: [PATCH 1/2] ethernet frame header is 14 not 18 --- esp-wifi/src/wifi/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index 8f4e93e6f19..b05f58c040b 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -73,7 +73,7 @@ use crate::{ EspWifiController, }; -const ETHERNET_FRAME_HEADER_SIZE: usize = 18; +const ETHERNET_FRAME_HEADER_SIZE: usize = 14; const MTU: usize = crate::CONFIG.mtu; From 4744e8befc5c4e6251d5fd1cbc92eb69687eaae6 Mon Sep 17 00:00:00 2001 From: Easyoakland <97992568+Easyoakland@users.noreply.github.com> Date: Mon, 10 Feb 2025 23:21:07 -0700 Subject: [PATCH 2/2] resize buffer to match MTU. smoltcp doesn't transmit larger packets --- esp-wifi/src/wifi/mod.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index b05f58c040b..5e482a490a5 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -73,8 +73,6 @@ use crate::{ EspWifiController, }; -const ETHERNET_FRAME_HEADER_SIZE: usize = 14; - const MTU: usize = crate::CONFIG.mtu; #[cfg(feature = "utils")] @@ -947,8 +945,6 @@ impl From for wifi_mode_t { } } -const DATA_FRAME_SIZE: usize = MTU + ETHERNET_FRAME_HEADER_SIZE; - const RX_QUEUE_SIZE: usize = crate::CONFIG.rx_queue_size; const TX_QUEUE_SIZE: usize = crate::CONFIG.tx_queue_size; @@ -2712,7 +2708,7 @@ impl WifiTxToken { // (safety): creation of multiple WiFi devices with the same mode is impossible // in safe Rust, therefore only smoltcp _or_ embassy-net can be used at // one time - static mut BUFFER: [u8; DATA_FRAME_SIZE] = [0u8; DATA_FRAME_SIZE]; + static mut BUFFER: [u8; MTU] = [0u8; MTU]; let buffer = unsafe { &mut BUFFER[..len] };