From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [NET] [BUG-FIX] [Patch 1/1]: Revert use of skb_padto
Date: Fri, 16 May 2008 18:17:02 +0100 [thread overview]
Message-ID: <20080516171702.GA1615@gerrit.erg.abdn.ac.uk> (raw)
In-Reply-To: <20080502144503.4ef2a430@extreme>
[SC92031]: Using padto turned driver into an IPv6-only interface
IPv4 would work with this driver only with static arp table entries,
the patch reverts a padto introduced in
commit 26a17b7bbb36a8552d531bc1ad08472fb5aa3007
sc92031: start transmit return value bugfix
The padto does not work because the driver code evaluates `len' later on and
there are cases where skb->len is not updated accordingly.
This was observed with ARP frames (skb->len = 42 bytes, !skb_cloned(),
skb_tailroom = 84 bytes). Then in skb_pad(), the first condition is true, where
skb->len is not updated. As a consequence, the driver uses 42 bytes instead of
the 60 bytes, and the ARP frame never makes it onto the wire.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
drivers/net/sc92031.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -953,9 +953,6 @@ static int sc92031_start_xmit(struct sk_
unsigned entry;
u32 tx_status;
- if (skb_padto(skb, ETH_ZLEN))
- return NETDEV_TX_OK;
-
if (unlikely(skb->len > TX_BUF_SIZE)) {
dev->stats.tx_dropped++;
goto out;
@@ -975,6 +972,11 @@ static int sc92031_start_xmit(struct sk_
skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
len = skb->len;
+ if (unlikely(len < ETH_ZLEN)) {
+ memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
+ 0, ETH_ZLEN - len);
+ len = ETH_ZLEN;
+ }
wmb();
next prev parent reply other threads:[~2008-05-16 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 20:29 [SC92031] [BUG-FIX] [Patch 1/1]: Revert use of skb_padto Gerrit Renker
2008-05-02 21:45 ` Stephen Hemminger
2008-05-16 17:17 ` Gerrit Renker [this message]
2008-05-16 20:09 ` [NET] " 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=20080516171702.GA1615@gerrit.erg.abdn.ac.uk \
--to=gerrit@erg.abdn.ac.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).