netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: netdev@vger.kernel.org
Cc: Will Deacon <will.deacon@arm.com>,
	Steve Glendinning <steve.glendinning@smsc.com>
Subject: [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets
Date: Thu, 12 Apr 2012 10:07:24 +0100	[thread overview]
Message-ID: <1334221644-16056-1-git-send-email-will.deacon@arm.com> (raw)

The SMSC911x ethernet controller provides a mechanism for quickly
skipping to the start of the next frame in the receive FIFO, however
the current code passes the number of words to a function that expects
the number of bytes. This can corrupt the FIFO head in the case that
the fastforward mechanism is not used.

This patch fixes the callers of smsc911x_rx_fastforward to pass the
correct data size.

Cc: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 drivers/net/ethernet/smsc/smsc911x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 4a69710..b5599bc 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1228,7 +1228,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
 				  "Discarding packet with error bit set");
 			/* Packet has an error, discard it and continue with
 			 * the next */
-			smsc911x_rx_fastforward(pdata, pktwords);
+			smsc911x_rx_fastforward(pdata, pktlength);
 			dev->stats.rx_dropped++;
 			continue;
 		}
@@ -1238,7 +1238,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
 			SMSC_WARN(pdata, rx_err,
 				  "Unable to allocate skb for rx packet");
 			/* Drop the packet and stop this polling iteration */
-			smsc911x_rx_fastforward(pdata, pktwords);
+			smsc911x_rx_fastforward(pdata, pktlength);
 			dev->stats.rx_dropped++;
 			break;
 		}
-- 
1.7.4.1

             reply	other threads:[~2012-04-12  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12  9:07 Will Deacon [this message]
2012-04-12  9:20 ` [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets Eric Dumazet
2012-04-12 12:53   ` Will Deacon
2012-04-12 13:06     ` Eric Dumazet
2012-04-12 13:47       ` Will Deacon
2012-04-12 14:01         ` Eric Dumazet
2012-04-12 15:54           ` Will Deacon
2012-04-12 16:08             ` Eric Dumazet
2012-04-12 17:03               ` Will Deacon
2012-04-12 17:41                 ` Eric Dumazet
2012-04-13 18:08                 ` David Miller

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=1334221644-16056-1-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=steve.glendinning@smsc.com \
    /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;
as well as URLs for NNTP newsgroup(s).