From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, jcmvbkbc@gmail.com,
colin.king@canonical.com, tklauser@distanz.ch,
thierry.reding@gmail.com, andrew@lunn.ch,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net v3 2/2] net: ethoc: Correctly pad short packets
Date: Tue, 12 Jul 2016 16:04:36 -0700 [thread overview]
Message-ID: <1468364676-19242-3-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1468364676-19242-1-git-send-email-f.fainelli@gmail.com>
Even though the hardware can be doing zero padding, we want the SKB to
be going out on the wire with the appropriate size. This fixes packet
truncations observed with e.g: ARP packets.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/ethoc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 06ae14a8e946..4466a1187110 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -860,6 +860,11 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned int entry;
void *dest;
+ if (skb_put_padto(skb, ETHOC_ZLEN)) {
+ dev->stats.tx_errors++;
+ goto out_no_free;
+ }
+
if (unlikely(skb->len > ETHOC_BUFSIZ)) {
dev->stats.tx_errors++;
goto out;
@@ -894,6 +899,7 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
skb_tx_timestamp(skb);
out:
dev_kfree_skb(skb);
+out_no_free:
return NETDEV_TX_OK;
}
--
2.7.4
next prev parent reply other threads:[~2016-07-12 23:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-12 23:04 [PATCH net v3 0/2] net: ethoc: Error path and transmit fixes Florian Fainelli
2016-07-12 23:04 ` [PATCH net v3 1/2] net: ethoc: Fix early error paths Florian Fainelli
2016-07-12 23:04 ` Florian Fainelli [this message]
2016-07-13 6:13 ` [PATCH net v3 0/2] net: ethoc: Error path and transmit fixes 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=1468364676-19242-3-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=jcmvbkbc@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tklauser@distanz.ch \
/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).