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.
This commit is contained in:
Gunar Schorcht 2019-01-21 15:25:43 +01:00
parent fc1baddef8
commit 676a615996
2 changed files with 4 additions and 4 deletions

View File

@ -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)
/* 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;
} }

View File

@ -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 */