9
0
Fork 0

net: dm9k: only read on packet for each call to dm9k_eth_rx()

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@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Michael Olbrich 2014-05-18 16:46:30 +02:00 committed by Sascha Hauer
parent 558d72dc51
commit f104f55c04
1 changed files with 4 additions and 2 deletions

View File

@ -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(priv->pckt, rx_len);
return 0;
} else {
dev_dbg(dev, "Discarding packet\n");
dm9k_dump(priv->buswidth, priv->iodata, rx_len); /* discard packet */