* [PATCH] smsc95xx: Fix tx checksum offload for small packets
@ 2010-03-18 19:20 Steve Glendinning
2010-03-19 5:19 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Steve Glendinning @ 2010-03-18 19:20 UTC (permalink / raw)
To: netdev
TX checksum offload does not work properly when transmitting
UDP packets with 0, 1 or 2 bytes of data. This patch works
around the problem by calculating checksums for these packets
in the driver.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
---
drivers/net/usb/smsc95xx.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index d222d7e..829963f 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1189,9 +1189,21 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
}
if (csum) {
- u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
- skb_push(skb, 4);
- memcpy(skb->data, &csum_preamble, 4);
+ if (skb->len <= 45) {
+ /* workaround - hardware tx checksum does not work
+ * properly with extremely small packets */
+ long csstart = skb->csum_start - skb_headroom(skb);
+ __wsum calc = csum_partial(skb->data + csstart,
+ skb->len - csstart, 0);
+ *((__sum16 *)(skb->data + csstart
+ + skb->csum_offset)) = csum_fold(calc);
+
+ csum = false;
+ } else {
+ u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
+ skb_push(skb, 4);
+ memcpy(skb->data, &csum_preamble, 4);
+ }
}
skb_push(skb, 4);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] smsc95xx: Fix tx checksum offload for small packets
2010-03-18 19:20 [PATCH] smsc95xx: Fix tx checksum offload for small packets Steve Glendinning
@ 2010-03-19 5:19 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-03-19 5:19 UTC (permalink / raw)
To: steve.glendinning; +Cc: netdev
From: Steve Glendinning <steve.glendinning@smsc.com>
Date: Thu, 18 Mar 2010 19:20:10 +0000
> TX checksum offload does not work properly when transmitting
> UDP packets with 0, 1 or 2 bytes of data. This patch works
> around the problem by calculating checksums for these packets
> in the driver.
>
> Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Applied, but I had to fix up trailing whitespace on one of the
patch's lines. Please check for and fix up such trivial matters
before I ever have to see the patch in the future, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-19 5:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18 19:20 [PATCH] smsc95xx: Fix tx checksum offload for small packets Steve Glendinning
2010-03-19 5:19 ` David Miller
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).