W5500 first message is not sent

At start up, I reset the W5500 chip by pulling it low for 1s, and pull it high again and wait for another 1s, then set the memory size and poll the LNK bit (0th bit) of the PHYCFGR register and wait for it to become 1.
When the LNK bit is 1, I call dhcp_init() then dhcp_run().
However, the first discovery frame is not sent, although the sendto() call in send_DHCP_DISCOVER() return the correct number of bytes sent. I monitor the traffic with WireShark and cannot see this first frame.
After DHCP_WAIT_TIME (10s), dhcp_run() sends the discovery frame again and this time I can see it on WireShark and I receive my IP address.
This makes the start-up of my device longer because I have to wait 10s for the second frame to be sent.
Does this mean the chip was not ready when the first frame is sent? Did I miss something here?

You can troubleshoot it further by putting delay between link up and trying DHCP. And the cause could be well outside of the W5500 - in hub/router’s port not being ready receiving data from the port just went up. Thus what you have may be normal, that’s why DHCP client performs several tries on the live link before giving up.

Thank you for the answer.

I insert a delay of 1s between the link up and the first dhcp message and it seems to work reliably. My device now sends the DHCP discover message right after this 1s delay. I tried it a few times and it worked every time.
Is there any standard wait time from link up to start sending message?

I also want to find out if this is because of the router’s port not being ready, but can’t seem to find a way. I tried to monitor the SEND_OK bit of the Sn_IR register so that I know if the W5500 does try to send out the message, but it is always 0. Maybe this bit only works for TCP sockets?

I believe SEND_OK must be employed in any case when data is being attempted to be sent for any protocol.
To see if it is router you need router’s logs if they are available.
You may put PC in bridged mode between W5500 and the router to see, using Wireshark, what is going on between the W5500 and router, but it will also be subject to chicken-egg issue because you must know how quick PC gets its port ready to accept the messages after link-up.
You seem have done it right - the only matter to decide how many attempts and what is the delay for retries - this heavily depends on the networking environment you run device in.