Skip to content

Commit

Permalink
fix: ethernet frame header is 14 not 18 (#3025)
Browse files Browse the repository at this point in the history
* ethernet frame header is 14 not 18

* resize buffer to match MTU.
smoltcp doesn't transmit larger packets
  • Loading branch information
Easyoakland authored Feb 12, 2025
1 parent 853e3aa commit 65caa3b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ use crate::{
EspWifiController,
};

const ETHERNET_FRAME_HEADER_SIZE: usize = 18;

const MTU: usize = crate::CONFIG.mtu;

#[cfg(feature = "utils")]
Expand Down Expand Up @@ -946,8 +944,6 @@ impl From<WifiMode> 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;

Expand Down Expand Up @@ -2711,7 +2707,7 @@ impl<Dm: Sealed> WifiTxToken<Dm> {
// (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] };

Expand Down

0 comments on commit 65caa3b

Please sign in to comment.