tsec_recv() returns -1 when the receive descriptor is empty.
net_lwip_rx() only treats -EAGAIN as a non-fatal empty receive, so DHCP
can abort on an idle poll now that it checks net_lwip_poll().

Set the return value to -EAGAIN for an empty descriptor. Keep the
IEVENT_BSY receiver restart after that check, and preserve the separate
error return and descriptor rearming for a malformed frame.

Fixes: 53a0ca3757fe ("net: lwip: finish DHCP before starting autoload")
Signed-off-by: James Hilliard <[email protected]>
---
 drivers/net/tsec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index d03368b9408..b6819fd5317 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -335,6 +335,8 @@ static int tsec_recv(struct udevice *dev, int flags, uchar 
**packetp)
                        /* Rearm the packet buffer */
                        tsec_free_pkt(dev, NULL, 0);
                }
+       } else {
+               ret = -EAGAIN;
        }
 
        if (in_be32(&regs->ievent) & IEVENT_BSY) {

-- 
2.53.0

Reply via email to