zephyr: net: nxp_enet: dhcpv4_client sample never finds an IP and doesn't require a cable to be connected for socket functions to pass: mimxrt1050_evk.

Describe the bug

Since the new ENET NXP driver has recently been officially released in Zephyr v3.7, I have been investigating updating from our version which is currently at commit 64f41309d104b161b1960bcc20e2ff6bd58c6355 . On our version, Ethernet works okay in regards to general use with some minor bugs that should be included in another bug report, they are irrelevant to this issue. Moving forward to today, I updated our Zephyr version to the v3.7 commit 36940db938a8f4a1e919496793ed439850a221c2 , this prompted Ethernet to not work at all. Every POSIX network related function seems to pass and return successfully (even with errno’s indicating success) when forcefully binding the socket to the Ethernet iface, even when there is no physical cable connected.

Trying the dhcpv4_client example on our RT1050 Development board prompted the PHY driver to detect the Ethernet cable successfully and decide on a MAC address, but even after leaving the board on for up to 30 minutes it never finds an IP address and it also thinks there is a cable connected when there isn’t at all. I have confirmed our Ethernet socket is live by plugging it into my Laptop which is able to use it completely fine.

To Reproduce

Steps to reproduce the behavior:

  1. Build dhcpv4_client sample for the mimxrt1050_evk
  2. Flash it
  3. See that it never gets an IP address and there is no need for an Ethernet cable for the POSIX network functions to pass

Expected behavior

I expect it to work like an Ethernet driver should, like It did on v3.6.

Impact

This bug completely breaks our network stack, as we have three different network interfaces on our board with ethernet being the highest priority in the stack. Since the socket functions pass without issue when the Ethernet is very clearly down, this breaks our whole network stack

Logs and console output

[00:00:01.001,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:00:01.102,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:00:01.103,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:00:01.103,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:00:01.103,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:00:01.103,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

[00:00:01.104,000] <dbg> eth_nxp_enet_mac: eth_nxp_enet_init: ethernet MAC 02:04:9f:94:78:98
*** Booting Zephyr OS build v3.7.0 ***
[00:00:01.104,000] <inf> net_dhcpv4_client_sample: Run dhcpv4 client
[00:00:01.104,000] <inf> net_dhcpv4_client_sample: Start on ethernet: index=1
uart:~$ net iface

Interface eth0 (0x800004e8) (Ethernet) [1]
===================================
Link addr : 02:04:9F:94:78:98
MTU       : 1500
Flags     : AUTO_START,IPv4
Device    : ethernet (0x6001dd20)
Ethernet capabilities supported:
        TX checksum offload
        RX checksum offload
        10 Mbits
        100 Mbits
        MAC address filtering
IPv4 unicast addresses (max 1):
        <none>
IPv4 multicast addresses (max 2):
        224.0.0.1
IPv4 gateway : 0.0.0.0
DHCPv4 lease time : 0
DHCPv4 renew time : 0
DHCPv4 server     : 0.0.0.0
DHCPv4 requested  : 0.0.0.0
DHCPv4 state      : selecting
DHCPv4 attempts   : 8
uart:~$

Environment (please complete the following information):

  • OS: Windows
  • Toolchain: Zephyr SDK
  • Commit SHA or Version used: 36940db938a8f4a1e919496793ed439850a221c2

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (13 by maintainers)

Most upvoted comments

no errors returned from zsock_socket, zsock_setsockopt or zsock_connect

Do you have UDP or TCP socket? If UDP, then those calls do not really send anything to peer, for TCP the connect should fail if it cannot connect.

They are TCP sockets. For example, we are opening a socket, binding it to Ethernet, connecting to it then closing the socket and this passes fine.

I am unsure if this issue is somehow related to the fact that with any other interface active while Ethernet is up, networking related functions like getaddrinfo etc do not work. But when you take one of the interfaces away, it works again. This behavior did not exist on v3.6 release, we had all of our interfaces working correctly at the same time, including Ethernet 😃