-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ethernet driver deinitialization (IDFGH-12421) #13443
Comments
Debugging more into this, it seems I can't get the glue reference via Storing the glue works (although it's a bit unfortunate that we have to story so many things, if they can be get by traversing the structures), but the next problem is then in ESP_GOTO_ON_ERROR(phy->deinit(phy), err, TAG, "deinit phy failed");
ESP_GOTO_ON_ERROR(mac->deinit(mac), err, TAG, "deinit mac failed");
free(eth_driver); however this doesn't lead to (in my case) |
Augmenting the deinit sequence in ESP_GOTO_ON_ERROR(phy->deinit(phy), err, TAG, "deinit phy failed");
ESP_GOTO_ON_ERROR(phy->del(phy), err, TAG, "del phy failed"); // new
ESP_GOTO_ON_ERROR(mac->deinit(mac), err, TAG, "deinit mac failed");
ESP_GOTO_ON_ERROR(mac->del(mac), err, TAG, "del mac failed"); // new Together with the following new function in the void example_eth_deinit(esp_eth_handle_t *eth_handles, uint8_t eth_cnt) {
for (int i = 0; i < eth_cnt; i++) {
esp_eth_driver_uninstall(eth_handles[i]);
}
free(eth_handles);
#ifdef CONFIG_EXAMPLE_USE_SPI_ETHERNET
spi_bus_free(CONFIG_EXAMPLE_ETH_SPI_HOST);
#endif
} seems to be a step in the right direction. I can bring up / bring down Ethernet a couple of times, before it crashes in pdhcps_pool = pback_node->pnode; Is it possible that the DHCP server does not get properly shutdown, hence multiple servers are stepping on its others toes? |
Ok, stopping the DHCP server manually before stopping the state machine on the drivers seems to be the missing link. I can now bring down and bring up the Ethernet example multiple times -- seemingly without any memory leaks. Before tackling the more complicated bridge example, I'd like to ask how we can proceed from here. It looks like there is little missing to make this work reliably, in particular calling Is there a special reason why the |
Yes, I'm currently in process of Ethernet driver update. The current issue with using |
Very good, thanks! I'll keep the aforementioned diff in my fork for now, but will wait for a proper solution then. And – perhaps – if I'm not asking too much… it would be great, if you could also extend the |
This is only a temporary workaround until a proper solution comes. See espressif#13443 for a discussion.
That's good to hear. I also tried my hand at Since you touched on the subject of update/refactor of the esp_eth component, there's something I'd like to ask risking hijacking the issue. The W5100 doesn't expose its PHY by means of registers, only pins, which realistically, just get connected to GND or Vcc instead of traced elsewhere. Would it make sense to make the PHY layer implementation optional, either by having some default implementation stubs or something? This function alone is the only reason I have to implement this component. Of course, I'm assuming there are other SPI Ethernet uC's out there that don't expose their PHY in a useful way like this one, but I could be wrong, and this request may make no sense, so let me know. |
@KaeLL would espressif/esp-eth-drivers#21 help you solve your problem? The original intention of the PR was different, but it's |
I skimmed over it and seems like that is what I was looking for. I'll take a deeper look the next time I update my code. |
Following up on a message by @kostaond in #5697 (comment) where we discussed a missing deinit for the bridge example, I want to help getting this fixed.
To simplify things, I first want to get this working without the bridge functionality. Inversing the following init:
I figured I'd start w/
But this crashes in
esp_eth_del_netif_glue
duringesp_eth_decrease
like that:The text was updated successfully, but these errors were encountered: