Skip to content

Commit

Permalink
r8169: fix rx checksum offload
Browse files Browse the repository at this point in the history
commit adea1ac upstream.

While porting GRO to r8169, I found this driver has a bug in its rx
path.

All skbs given to network stack had their ip_summed set to
CHECKSUM_NONE, while hardware said they had correct TCP/UDP checksums.

The reason is driver sets skb->ip_summed on the original skb before the
copy eventually done by copybreak. The fresh skb gets the ip_summed =
CHECKSUM_NONE value, forcing network stack to recompute checksum, and
preventing my GRO patch to work.

Fix is to make the ip_summed setting after skb copy.

Note : rx_copybreak current value is 16383, so all frames are copied...

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Eric Dumazet authored and Greg Kroah-Hartman committed Dec 9, 2010
1 parent 3f4e9a3 commit 1f72786
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -4455,9 +4455,8 @@ static inline int rtl8169_fragmented_frame(u32 status)
return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag);
}

static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc)
static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
{
u32 opts1 = le32_to_cpu(desc->opts1);
u32 status = opts1 & RxProtoMask;

if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
Expand Down Expand Up @@ -4551,8 +4550,6 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
continue;
}

rtl8169_rx_csum(skb, desc);

if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) {
dma_sync_single_for_device(&pdev->dev, addr,
pkt_size, PCI_DMA_FROMDEVICE);
Expand All @@ -4563,6 +4560,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
tp->Rx_skbuff[entry] = NULL;
}

rtl8169_rx_csum(skb, status);
skb_put(skb, pkt_size);
skb->protocol = eth_type_trans(skb, dev);

Expand Down

0 comments on commit 1f72786

Please sign in to comment.