Skip to content
Snippets Groups Projects
Commit 676a6159 authored by Gunar Schorcht's avatar Gunar Schorcht
Browse files

cpu/esp32: fix of maximum frame length in esp_eth

Since complete MAC frames are handled, ETHERNET_MAX_LEN has to be used instead of ETHERNET_DATA_LEN for buffer sizes and length checks.
parent fc1badde
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ static esp_err_t IRAM_ATTR _eth_input_callback(void *buffer, uint16_t len, void ...@@ -95,7 +95,7 @@ static esp_err_t IRAM_ATTR _eth_input_callback(void *buffer, uint16_t len, void
DEBUG("%s: buf=%p len=%d eb=%p\n", __func__, buffer, len, eb); DEBUG("%s: buf=%p len=%d eb=%p\n", __func__, buffer, len, eb);
CHECK_PARAM_RET (buffer != NULL, -EINVAL); CHECK_PARAM_RET (buffer != NULL, -EINVAL);
CHECK_PARAM_RET (len <= ETHERNET_DATA_LEN, -EINVAL); CHECK_PARAM_RET (len <= ETHERNET_MAX_LEN, -EINVAL);
mutex_lock(&_esp_eth_dev.dev_lock); mutex_lock(&_esp_eth_dev.dev_lock);
...@@ -198,7 +198,7 @@ static int _esp_eth_send(netdev_t *netdev, const iolist_t *iolist) ...@@ -198,7 +198,7 @@ static int _esp_eth_send(netdev_t *netdev, const iolist_t *iolist)
/* load packet data into TX buffer */ /* load packet data into TX buffer */
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) { for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
if (dev->tx_len + iol->iol_len > ETHERNET_DATA_LEN) { if (dev->tx_len + iol->iol_len > ETHERNET_MAX_LEN) {
mutex_unlock(&dev->dev_lock); mutex_unlock(&dev->dev_lock);
return -EOVERFLOW; return -EOVERFLOW;
} }
......
...@@ -40,8 +40,8 @@ typedef struct ...@@ -40,8 +40,8 @@ typedef struct
uint16_t rx_len; /**< number of bytes received */ uint16_t rx_len; /**< number of bytes received */
uint16_t tx_len; /**< number of bytes in transmit buffer */ uint16_t tx_len; /**< number of bytes in transmit buffer */
uint8_t rx_buf[ETHERNET_DATA_LEN]; /**< receive buffer */ uint8_t rx_buf[ETHERNET_MAX_LEN]; /**< receive buffer */
uint8_t tx_buf[ETHERNET_DATA_LEN]; /**< transmit buffer */ uint8_t tx_buf[ETHERNET_MAX_LEN]; /**< transmit buffer */
uint32_t event; /**< received event */ uint32_t event; /**< received event */
bool link_up; /**< indicates whether link is up */ bool link_up; /**< indicates whether link is up */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment