emaclite_recv() returns -1 when neither receive buffer has a packet.
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().

Return -EAGAIN from all three no-packet paths: an empty ping buffer
without pong support, and both orders of checking the two buffers.
Leave buffer selection, frame parsing and acknowledgment unchanged.

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

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index c25ac2e6600..ba3c4d6f68f 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -473,11 +473,11 @@ try_again:
                        debug("Data not found in rx_ping buffer\n");
                        /* Pong buffer is not available - return immediately */
                        if (!emaclite->rxpp)
-                               return -1;
+                               return -EAGAIN;
 
                        /* Try pong buffer if this is first attempt */
                        if (attempt++)
-                               return -1;
+                               return -EAGAIN;
                        emaclite->use_rx_pong_buffer_next =
                                        !emaclite->use_rx_pong_buffer_next;
                        goto try_again;
@@ -493,7 +493,7 @@ try_again:
                        debug("Data not found in rx_pong buffer\n");
                        /* Try ping buffer if this is first attempt */
                        if (attempt++)
-                               return -1;
+                               return -EAGAIN;
                        emaclite->use_rx_pong_buffer_next =
                                        !emaclite->use_rx_pong_buffer_next;
                        goto try_again;

-- 
2.53.0

Reply via email to