1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18548 from yarrick/lwip_init

pkg/lwip: Set netdev callback before driver init
This commit is contained in:
benpicco 2022-09-14 15:20:18 +02:00 committed by GitHub
commit 276195e0ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 14 deletions

View File

@ -100,19 +100,14 @@ static esp_err_t IRAM_ATTR _eth_input_callback(esp_eth_handle_t hdl,
mutex_lock(&_esp_eth_dev.dev_lock);
/* Don't overwrite other events, drop packet instead.
* Keep the latest received packet if previous has not been read. */
if (_esp_eth_dev.event == SYSTEM_EVENT_MAX ||
_esp_eth_dev.event == SYSTEM_EVENT_ETH_RX_DONE) {
memcpy(_esp_eth_dev.rx_buf, buffer, len);
/* buffer is allocated by the `emac_esp32_rx_task` upon receipt of a
* MAC frame and is forwarded to the consumer who responsible for
* freeing the buffer. */
free(buffer);
_esp_eth_dev.rx_len = len;
_esp_eth_dev.event = SYSTEM_EVENT_ETH_RX_DONE;
netdev_trigger_event_isr(&_esp_eth_dev.netdev);
}
memcpy(_esp_eth_dev.rx_buf, buffer, len);
/* buffer is allocated by the `emac_esp32_rx_task` upon receipt of a
* MAC frame and is forwarded to the consumer who responsible for
* freeing the buffer. */
free(buffer);
_esp_eth_dev.rx_len = len;
_esp_eth_dev.event = SYSTEM_EVENT_ETH_RX_DONE;
netdev_trigger_event_isr(&_esp_eth_dev.netdev);
mutex_unlock(&_esp_eth_dev.dev_lock);

View File

@ -94,8 +94,8 @@ err_t lwip_netdev_init(struct netif *netif)
netdev = netif->state;
lwip_netif_dev_acquire(netif);
netdev->driver->init(netdev);
netdev->event_callback = _event_cb;
netdev->driver->init(netdev);
if (netdev->driver->get(netdev, NETOPT_DEVICE_TYPE, &dev_type,
sizeof(dev_type)) < 0) {
res = ERR_IF;