Message ID | 20241009094208.1212555-1-jerome.forissier@linaro.org |
---|---|
State | Accepted |
Commit | 63150710e34aa9d5d7c45e142e70016b31af2c04 |
Headers | show |
Series | [v2] net: recv(): return -EAGAIN instead of 0 when no cleanup is expected | expand |
On Wed, 09 Oct 2024 11:42:08 +0200, Jerome Forissier wrote: > Some drivers do not behave properly when free_pkt() is called with a > length of zero. It is an issue I observed when developing the lwIP > series [1] (see "QEMU CI tests for r2dplus_i82557c, r2dplus_rtl8139" > in the change log) and which I fixed incorrectly by not calling > free_pkt() when recv() returns 0. That turned out to be wrong for two > reasons: > > [...] Applied to u-boot/master, thanks!
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index d18a8d577ca..f64dbb7d6a1 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -678,7 +678,7 @@ static int eepro100_recv_common(struct eepro100_priv *priv, uchar **packetp) status = le16_to_cpu(desc->status); if (!(status & RFD_STATUS_C)) - return 0; + return -EAGAIN; /* Valid frame status. */ if (status & RFD_STATUS_OK) { diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 2e0afad089f..5f4b1e2d3a0 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -433,7 +433,7 @@ static int rtl8139_recv_common(struct rtl8139_priv *priv, unsigned char *rxdata, int length = 0; if (inb(priv->ioaddr + RTL_REG_CHIPCMD) & RTL_REG_CHIPCMD_RXBUFEMPTY) - return 0; + return -EAGAIN; priv->rxstatus = inw(priv->ioaddr + RTL_REG_INTRSTATUS); /* See below for the rest of the interrupt acknowledges. */