diff options
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index b28a915bd980..48e2ade704d3 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2887,33 +2887,30 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2887 | return err; | 2887 | return err; |
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 2890 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
2891 | mss = skb_shinfo(skb)->gso_size; | 2891 | mss = skb_shinfo(skb)->gso_size; |
2892 | if (skb->protocol == htons(ETH_P_IP)) { | 2892 | if (skb->protocol == htons(ETH_P_IP)) { |
2893 | skb->nh.iph->tot_len = 0; | 2893 | struct iphdr *iph = ip_hdr(skb); |
2894 | skb->nh.iph->check = 0; | 2894 | iph->tot_len = 0; |
2895 | skb->h.th->check = | 2895 | iph->check = 0; |
2896 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 2896 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
2897 | skb->nh.iph->daddr, | 2897 | iph->daddr, 0, |
2898 | 0, | 2898 | IPPROTO_TCP, |
2899 | IPPROTO_TCP, | 2899 | 0); |
2900 | 0); | ||
2901 | cmd_length = E1000_TXD_CMD_IP; | 2900 | cmd_length = E1000_TXD_CMD_IP; |
2902 | ipcse = skb->h.raw - skb->data - 1; | 2901 | ipcse = skb_transport_offset(skb) - 1; |
2903 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2902 | } else if (skb->protocol == htons(ETH_P_IPV6)) { |
2904 | skb->nh.ipv6h->payload_len = 0; | 2903 | ipv6_hdr(skb)->payload_len = 0; |
2905 | skb->h.th->check = | 2904 | tcp_hdr(skb)->check = |
2906 | ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, | 2905 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
2907 | &skb->nh.ipv6h->daddr, | 2906 | &ipv6_hdr(skb)->daddr, |
2908 | 0, | 2907 | 0, IPPROTO_TCP, 0); |
2909 | IPPROTO_TCP, | ||
2910 | 0); | ||
2911 | ipcse = 0; | 2908 | ipcse = 0; |
2912 | } | 2909 | } |
2913 | ipcss = skb->nh.raw - skb->data; | 2910 | ipcss = skb_network_offset(skb); |
2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 2911 | ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; |
2915 | tucss = skb->h.raw - skb->data; | 2912 | tucss = skb_transport_offset(skb); |
2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 2913 | tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; |
2917 | tucse = 0; | 2914 | tucse = 0; |
2918 | 2915 | ||
2919 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | | 2916 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
@@ -2954,7 +2951,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2954 | uint8_t css; | 2951 | uint8_t css; |
2955 | 2952 | ||
2956 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 2953 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
2957 | css = skb->h.raw - skb->data; | 2954 | css = skb_transport_offset(skb); |
2958 | 2955 | ||
2959 | i = tx_ring->next_to_use; | 2956 | i = tx_ring->next_to_use; |
2960 | buffer_info = &tx_ring->buffer_info[i]; | 2957 | buffer_info = &tx_ring->buffer_info[i]; |
@@ -2962,7 +2959,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2962 | 2959 | ||
2963 | context_desc->lower_setup.ip_config = 0; | 2960 | context_desc->lower_setup.ip_config = 0; |
2964 | context_desc->upper_setup.tcp_fields.tucss = css; | 2961 | context_desc->upper_setup.tcp_fields.tucss = css; |
2965 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; | 2962 | context_desc->upper_setup.tcp_fields.tucso = |
2963 | css + skb->csum_offset; | ||
2966 | context_desc->upper_setup.tcp_fields.tucse = 0; | 2964 | context_desc->upper_setup.tcp_fields.tucse = 0; |
2967 | context_desc->tcp_seg_setup.data = 0; | 2965 | context_desc->tcp_seg_setup.data = 0; |
2968 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); | 2966 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); |
@@ -3296,7 +3294,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3296 | /* TSO Workaround for 82571/2/3 Controllers -- if skb->data | 3294 | /* TSO Workaround for 82571/2/3 Controllers -- if skb->data |
3297 | * points to just header, pull a few bytes of payload from | 3295 | * points to just header, pull a few bytes of payload from |
3298 | * frags into skb->data */ | 3296 | * frags into skb->data */ |
3299 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | 3297 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
3300 | if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { | 3298 | if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { |
3301 | switch (adapter->hw.mac_type) { | 3299 | switch (adapter->hw.mac_type) { |
3302 | unsigned int pull_size; | 3300 | unsigned int pull_size; |
@@ -3307,7 +3305,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3307 | * NOTE: this is a TSO only workaround | 3305 | * NOTE: this is a TSO only workaround |
3308 | * if end byte alignment not correct move us | 3306 | * if end byte alignment not correct move us |
3309 | * into the next dword */ | 3307 | * into the next dword */ |
3310 | if ((unsigned long)(skb->tail - 1) & 4) | 3308 | if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4) |
3311 | break; | 3309 | break; |
3312 | /* fall through */ | 3310 | /* fall through */ |
3313 | case e1000_82571: | 3311 | case e1000_82571: |
@@ -4227,9 +4225,12 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
4227 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 4225 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
4228 | if (new_skb) { | 4226 | if (new_skb) { |
4229 | skb_reserve(new_skb, NET_IP_ALIGN); | 4227 | skb_reserve(new_skb, NET_IP_ALIGN); |
4230 | memcpy(new_skb->data - NET_IP_ALIGN, | 4228 | skb_copy_to_linear_data_offset(new_skb, |
4231 | skb->data - NET_IP_ALIGN, | 4229 | -NET_IP_ALIGN, |
4232 | length + NET_IP_ALIGN); | 4230 | (skb->data - |
4231 | NET_IP_ALIGN), | ||
4232 | (length + | ||
4233 | NET_IP_ALIGN)); | ||
4233 | /* save the skb in buffer_info as good */ | 4234 | /* save the skb in buffer_info as good */ |
4234 | buffer_info->skb = skb; | 4235 | buffer_info->skb = skb; |
4235 | skb = new_skb; | 4236 | skb = new_skb; |
@@ -4391,7 +4392,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
4391 | PCI_DMA_FROMDEVICE); | 4392 | PCI_DMA_FROMDEVICE); |
4392 | vaddr = kmap_atomic(ps_page->ps_page[0], | 4393 | vaddr = kmap_atomic(ps_page->ps_page[0], |
4393 | KM_SKB_DATA_SOFTIRQ); | 4394 | KM_SKB_DATA_SOFTIRQ); |
4394 | memcpy(skb->tail, vaddr, l1); | 4395 | memcpy(skb_tail_pointer(skb), vaddr, l1); |
4395 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 4396 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
4396 | pci_dma_sync_single_for_device(pdev, | 4397 | pci_dma_sync_single_for_device(pdev, |
4397 | ps_page_dma->ps_page_dma[0], | 4398 | ps_page_dma->ps_page_dma[0], |