[PATCH 4/4] net: dm9k: only read on packet for each call to dm9k_eth_rx()
Michael Olbrich
m.olbrich at pengutronix.de
Sun May 18 07:46:30 PDT 2014
Some users such as fs/nfs.c just save the pointer to the packet in the
handler and process it after net_poll() returns. This break when more than
one packet is received using the same buffer.
Signed-off-by: Michael Olbrich <m.olbrich at pengutronix.de>
---
drivers/net/dm9k.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index e98b8f4..3a4c6aa 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -541,7 +541,6 @@ static int dm9k_check_for_rx_packet(struct dm9k *priv)
return 0; /* no packet */
dev_dbg(dev, "Packet present\n");
- dm9k_iow(priv, DM9K_ISR, ISR_PR); /* clear PR status latched in bit 0 */
return 1; /* packet present */
}
@@ -587,8 +586,10 @@ static int dm9k_eth_rx(struct eth_device *edev)
return 0; /* no data present */
do {
- if (!dm9k_validate_entry(priv))
+ if (!dm9k_validate_entry(priv)) {
+ dm9k_iow(priv, DM9K_ISR, ISR_PR); /* clear PR status latched in bit 0 */
return 0;
+ }
/* assume this packet is valid */
p_valid = true;
@@ -634,6 +635,7 @@ static int dm9k_eth_rx(struct eth_device *edev)
dm9k_rd(priv->buswidth, priv->iodata, priv->pckt, rx_len);
dev_dbg(dev, "passing %u bytes packet to upper layer\n", rx_len);
net_receive(edev, priv->pckt, rx_len);
+ return 0;
} else {
dev_dbg(dev, "Discarding packet\n");
dm9k_dump(priv->buswidth, priv->iodata, rx_len); /* discard packet */
--
2.0.0.rc0
More information about the barebox
mailing list