From: Michael Olbrich <m.olbrich@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Michael Olbrich <m.olbrich@pengutronix.de>
Subject: [PATCH 4/4] net: dm9k: only read on packet for each call to dm9k_eth_rx()
Date: Sun, 18 May 2014 16:46:30 +0200 [thread overview]
Message-ID: <1400424390-24736-5-git-send-email-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <1400424390-24736-1-git-send-email-m.olbrich@pengutronix.de>
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>
---
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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-05-18 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 14:46 [PATCH 0/4] some mini2440 updates Michael Olbrich
2014-05-18 14:46 ` [PATCH 1/4] ARM: mini2440: switch to env2 Michael Olbrich
2014-05-18 14:46 ` [PATCH 2/4] ARM: mini2440: update defconfig Michael Olbrich
2014-05-18 14:46 ` [PATCH 3/4] ARM Samsung: fix booting from NAND with pbl Michael Olbrich
2014-05-18 14:46 ` Michael Olbrich [this message]
2014-05-19 7:46 ` [PATCH 0/4] some mini2440 updates Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400424390-24736-5-git-send-email-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox