aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index ac36152c68bf..238c2ca34da6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -32,6 +32,7 @@
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/ip.h> 34#include <linux/ip.h>
35#include <net/ip.h>
35#include <linux/tcp.h> 36#include <linux/tcp.h>
36#include <linux/in.h> 37#include <linux/in.h>
37#include <linux/delay.h> 38#include <linux/delay.h>
@@ -1391,8 +1392,8 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1391 /* Check for TCP Segmentation Offload */ 1392 /* Check for TCP Segmentation Offload */
1392 mss = skb_shinfo(skb)->gso_size; 1393 mss = skb_shinfo(skb)->gso_size;
1393 if (mss != 0) { 1394 if (mss != 0) {
1394 mss += ((skb->h.th->doff - 5) * 4); /* TCP options */ 1395 mss += tcp_optlen(skb); /* TCP options */
1395 mss += (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); 1396 mss += ip_hdrlen(skb) + sizeof(struct tcphdr);
1396 mss += ETH_HLEN; 1397 mss += ETH_HLEN;
1397 1398
1398 if (mss != sky2->tx_last_mss) { 1399 if (mss != sky2->tx_last_mss) {
@@ -1420,14 +1421,14 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1420 1421
1421 /* Handle TCP checksum offload */ 1422 /* Handle TCP checksum offload */
1422 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1423 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1423 unsigned offset = skb->h.raw - skb->data; 1424 const unsigned offset = skb_transport_offset(skb);
1424 u32 tcpsum; 1425 u32 tcpsum;
1425 1426
1426 tcpsum = offset << 16; /* sum start */ 1427 tcpsum = offset << 16; /* sum start */
1427 tcpsum |= offset + skb->csum_offset; /* sum write */ 1428 tcpsum |= offset + skb->csum_offset; /* sum write */
1428 1429
1429 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; 1430 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
1430 if (skb->nh.iph->protocol == IPPROTO_UDP) 1431 if (ip_hdr(skb)->protocol == IPPROTO_UDP)
1431 ctrl |= UDPTCP; 1432 ctrl |= UDPTCP;
1432 1433
1433 if (tcpsum != sky2->tx_tcpsum) { 1434 if (tcpsum != sky2->tx_tcpsum) {
@@ -1970,7 +1971,7 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
1970 skb_reserve(skb, 2); 1971 skb_reserve(skb, 2);
1971 pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, 1972 pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr,
1972 length, PCI_DMA_FROMDEVICE); 1973 length, PCI_DMA_FROMDEVICE);
1973 memcpy(skb->data, re->skb->data, length); 1974 skb_copy_from_linear_data(re->skb, skb->data, length);
1974 skb->ip_summed = re->skb->ip_summed; 1975 skb->ip_summed = re->skb->ip_summed;
1975 skb->csum = re->skb->csum; 1976 skb->csum = re->skb->csum;
1976 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, 1977 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,