diff options
Diffstat (limited to 'drivers/net/atl1/atl1_main.c')
-rw-r--r-- | drivers/net/atl1/atl1_main.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 8606eac5bec8..4b1d4d153ecf 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -408,7 +408,6 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter, | |||
408 | static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | 408 | static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) |
409 | { | 409 | { |
410 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; | 410 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; |
411 | struct net_device *netdev = adapter->netdev; | ||
412 | struct pci_dev *pdev = adapter->pdev; | 411 | struct pci_dev *pdev = adapter->pdev; |
413 | struct page *page; | 412 | struct page *page; |
414 | unsigned long offset; | 413 | unsigned long offset; |
@@ -444,7 +443,6 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | |||
444 | * the 14 byte MAC header is removed | 443 | * the 14 byte MAC header is removed |
445 | */ | 444 | */ |
446 | skb_reserve(skb, NET_IP_ALIGN); | 445 | skb_reserve(skb, NET_IP_ALIGN); |
447 | skb->dev = netdev; | ||
448 | 446 | ||
449 | buffer_info->alloced = 1; | 447 | buffer_info->alloced = 1; |
450 | buffer_info->skb = skb; | 448 | buffer_info->skb = skb; |
@@ -1296,19 +1294,21 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1296 | } | 1294 | } |
1297 | 1295 | ||
1298 | if (skb->protocol == ntohs(ETH_P_IP)) { | 1296 | if (skb->protocol == ntohs(ETH_P_IP)) { |
1299 | skb->nh.iph->tot_len = 0; | 1297 | struct iphdr *iph = ip_hdr(skb); |
1300 | skb->nh.iph->check = 0; | 1298 | |
1301 | skb->h.th->check = | 1299 | iph->tot_len = 0; |
1302 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1300 | iph->check = 0; |
1303 | skb->nh.iph->daddr, 0, | 1301 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1304 | IPPROTO_TCP, 0); | 1302 | iph->daddr, 0, |
1305 | ipofst = skb->nh.raw - skb->data; | 1303 | IPPROTO_TCP, |
1304 | 0); | ||
1305 | ipofst = skb_network_offset(skb); | ||
1306 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1306 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ |
1307 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1307 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
1308 | 1308 | ||
1309 | tso->tsopl |= (skb->nh.iph->ihl & | 1309 | tso->tsopl |= (iph->ihl & |
1310 | CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT; | 1310 | CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT; |
1311 | tso->tsopl |= ((skb->h.th->doff << 2) & | 1311 | tso->tsopl |= (tcp_hdrlen(skb) & |
1312 | TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT; | 1312 | TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT; |
1313 | tso->tsopl |= (skb_shinfo(skb)->gso_size & | 1313 | tso->tsopl |= (skb_shinfo(skb)->gso_size & |
1314 | TSO_PARAM_MSS_MASK) << TSO_PARAM_MSS_SHIFT; | 1314 | TSO_PARAM_MSS_MASK) << TSO_PARAM_MSS_SHIFT; |
@@ -1327,8 +1327,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1327 | u8 css, cso; | 1327 | u8 css, cso; |
1328 | 1328 | ||
1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
1330 | cso = skb->h.raw - skb->data; | 1330 | cso = skb_transport_offset(skb); |
1331 | css = (skb->h.raw + skb->csum_offset) - skb->data; | 1331 | css = cso + skb->csum_offset; |
1332 | if (unlikely(cso & 0x1)) { | 1332 | if (unlikely(cso & 0x1)) { |
1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", | 1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", |
1334 | atl1_driver_name); | 1334 | atl1_driver_name); |
@@ -1370,8 +1370,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, | |||
1370 | 1370 | ||
1371 | if (tcp_seg) { | 1371 | if (tcp_seg) { |
1372 | /* TSO/GSO */ | 1372 | /* TSO/GSO */ |
1373 | proto_hdr_len = | 1373 | proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1374 | ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | ||
1375 | buffer_info->length = proto_hdr_len; | 1374 | buffer_info->length = proto_hdr_len; |
1376 | page = virt_to_page(skb->data); | 1375 | page = virt_to_page(skb->data); |
1377 | offset = (unsigned long)skb->data & ~PAGE_MASK; | 1376 | offset = (unsigned long)skb->data & ~PAGE_MASK; |
@@ -1563,8 +1562,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1563 | mss = skb_shinfo(skb)->gso_size; | 1562 | mss = skb_shinfo(skb)->gso_size; |
1564 | if (mss) { | 1563 | if (mss) { |
1565 | if (skb->protocol == htons(ETH_P_IP)) { | 1564 | if (skb->protocol == htons(ETH_P_IP)) { |
1566 | proto_hdr_len = ((skb->h.raw - skb->data) + | 1565 | proto_hdr_len = (skb_transport_offset(skb) + |
1567 | (skb->h.th->doff << 2)); | 1566 | tcp_hdrlen(skb)); |
1568 | if (unlikely(proto_hdr_len > len)) { | 1567 | if (unlikely(proto_hdr_len > len)) { |
1569 | dev_kfree_skb_any(skb); | 1568 | dev_kfree_skb_any(skb); |
1570 | return NETDEV_TX_OK; | 1569 | return NETDEV_TX_OK; |