aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/atl1/atl1_main.c10
-rw-r--r--drivers/net/cassini.c6
-rw-r--r--drivers/net/cxgb3/sge.c7
-rw-r--r--drivers/net/e1000/e1000_main.c10
-rw-r--r--drivers/net/ixgb/ixgb_main.c8
-rw-r--r--drivers/net/myri10ge/myri10ge.c5
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c2
-rw-r--r--drivers/net/sk98lin/skge.c4
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/sungem.c6
-rw-r--r--drivers/net/sunhme.c6
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/net/udplite.h6
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/ipv4/esp4.c2
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/esp6.c9
-rw-r--r--net/ipv6/exthdrs.c12
-rw-r--r--net/ipv6/ip6_input.c2
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/mip6.c5
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/reassembly.c3
-rw-r--r--net/sctp/input.c2
26 files changed, 64 insertions, 64 deletions
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index d2be79a30f8a..c26f8ce320e6 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1326,8 +1326,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
1326 u8 css, cso; 1326 u8 css, cso;
1327 1327
1328 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1328 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1329 cso = skb->h.raw - skb->data; 1329 cso = skb_transport_offset(skb);
1330 css = (skb->h.raw + skb->csum_offset) - skb->data; 1330 css = cso + skb->csum;
1331 if (unlikely(cso & 0x1)) { 1331 if (unlikely(cso & 0x1)) {
1332 printk(KERN_DEBUG "%s: payload offset != even number\n", 1332 printk(KERN_DEBUG "%s: payload offset != even number\n",
1333 atl1_driver_name); 1333 atl1_driver_name);
@@ -1369,8 +1369,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter,
1369 1369
1370 if (tcp_seg) { 1370 if (tcp_seg) {
1371 /* TSO/GSO */ 1371 /* TSO/GSO */
1372 proto_hdr_len = 1372 proto_hdr_len = (skb_transport_offset(skb) +
1373 ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 1373 (skb->h.th->doff << 2));
1374 buffer_info->length = proto_hdr_len; 1374 buffer_info->length = proto_hdr_len;
1375 page = virt_to_page(skb->data); 1375 page = virt_to_page(skb->data);
1376 offset = (unsigned long)skb->data & ~PAGE_MASK; 1376 offset = (unsigned long)skb->data & ~PAGE_MASK;
@@ -1562,7 +1562,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1562 mss = skb_shinfo(skb)->gso_size; 1562 mss = skb_shinfo(skb)->gso_size;
1563 if (mss) { 1563 if (mss) {
1564 if (skb->protocol == htons(ETH_P_IP)) { 1564 if (skb->protocol == htons(ETH_P_IP)) {
1565 proto_hdr_len = ((skb->h.raw - skb->data) + 1565 proto_hdr_len = (skb_transport_offset(skb) +
1566 (skb->h.th->doff << 2)); 1566 (skb->h.th->doff << 2));
1567 if (unlikely(proto_hdr_len > len)) { 1567 if (unlikely(proto_hdr_len > len)) {
1568 dev_kfree_skb_any(skb); 1568 dev_kfree_skb_any(skb);
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 68e37a655fe2..bd3ab6493e39 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2821,10 +2821,8 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2821 2821
2822 ctrl = 0; 2822 ctrl = 0;
2823 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2823 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2824 u64 csum_start_off, csum_stuff_off; 2824 const u64 csum_start_off = skb_transport_offset(skb);
2825 2825 const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
2826 csum_start_off = (u64) (skb->h.raw - skb->data);
2827 csum_stuff_off = csum_start_off + skb->csum_offset;
2828 2826
2829 ctrl = TX_DESC_CSUM_EN | 2827 ctrl = TX_DESC_CSUM_EN |
2830 CAS_BASE(TX_DESC_CSUM_START, csum_start_off) | 2828 CAS_BASE(TX_DESC_CSUM_START, csum_start_off) |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a891f6f81527..d38b1bcd138e 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1319,9 +1319,10 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
1319 /* Only TX_DATA builds SGLs */ 1319 /* Only TX_DATA builds SGLs */
1320 1320
1321 from = (struct work_request_hdr *)skb->data; 1321 from = (struct work_request_hdr *)skb->data;
1322 memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from)); 1322 memcpy(&d->flit[1], &from[1],
1323 skb_transport_offset(skb) - sizeof(*from));
1323 1324
1324 flits = (skb->h.raw - skb->data) / 8; 1325 flits = skb_transport_offset(skb) / 8;
1325 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1326 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1326 sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw, 1327 sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw,
1327 adap->pdev); 1328 adap->pdev);
@@ -1349,7 +1350,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
1349 if (skb->len <= WR_LEN && cnt == 0) 1350 if (skb->len <= WR_LEN && cnt == 0)
1350 return 1; /* packet fits as immediate data */ 1351 return 1; /* packet fits as immediate data */
1351 1352
1352 flits = (skb->h.raw - skb->data) / 8; /* headers */ 1353 flits = skb_transport_offset(skb) / 8; /* headers */
1353 if (skb->tail != skb->h.raw) 1354 if (skb->tail != skb->h.raw)
1354 cnt++; 1355 cnt++;
1355 return flits_to_desc(flits + sgl_len(cnt)); 1356 return flits_to_desc(flits + sgl_len(cnt));
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index a3d9986b4170..78cf417cf236 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2887,7 +2887,7 @@ 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) + (skb->h.th->doff << 2));
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 struct iphdr *iph = ip_hdr(skb); 2893 struct iphdr *iph = ip_hdr(skb);
@@ -2897,7 +2897,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2897 iph->daddr, 0, 2897 iph->daddr, 0,
2898 IPPROTO_TCP, 0); 2898 IPPROTO_TCP, 0);
2899 cmd_length = E1000_TXD_CMD_IP; 2899 cmd_length = E1000_TXD_CMD_IP;
2900 ipcse = skb->h.raw - skb->data - 1; 2900 ipcse = skb_transport_offset(skb) - 1;
2901 } else if (skb->protocol == htons(ETH_P_IPV6)) { 2901 } else if (skb->protocol == htons(ETH_P_IPV6)) {
2902 ipv6_hdr(skb)->payload_len = 0; 2902 ipv6_hdr(skb)->payload_len = 0;
2903 skb->h.th->check = 2903 skb->h.th->check =
@@ -2908,7 +2908,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2908 } 2908 }
2909 ipcss = skb_network_offset(skb); 2909 ipcss = skb_network_offset(skb);
2910 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; 2910 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
2911 tucss = skb->h.raw - skb->data; 2911 tucss = skb_transport_offset(skb);
2912 tucso = (void *)&(skb->h.th->check) - (void *)skb->data; 2912 tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
2913 tucse = 0; 2913 tucse = 0;
2914 2914
@@ -2950,7 +2950,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2950 uint8_t css; 2950 uint8_t css;
2951 2951
2952 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 2952 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
2953 css = skb->h.raw - skb->data; 2953 css = skb_transport_offset(skb);
2954 2954
2955 i = tx_ring->next_to_use; 2955 i = tx_ring->next_to_use;
2956 buffer_info = &tx_ring->buffer_info[i]; 2956 buffer_info = &tx_ring->buffer_info[i];
@@ -3292,7 +3292,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3292 /* TSO Workaround for 82571/2/3 Controllers -- if skb->data 3292 /* TSO Workaround for 82571/2/3 Controllers -- if skb->data
3293 * points to just header, pull a few bytes of payload from 3293 * points to just header, pull a few bytes of payload from
3294 * frags into skb->data */ 3294 * frags into skb->data */
3295 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 3295 hdr_len = (skb_transport_offset(skb) + (skb->h.th->doff << 2));
3296 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { 3296 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {
3297 switch (adapter->hw.mac_type) { 3297 switch (adapter->hw.mac_type) {
3298 unsigned int pull_size; 3298 unsigned int pull_size;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index bba4dcaf92e9..ceea6e45792d 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1190,7 +1190,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1190 return err; 1190 return err;
1191 } 1191 }
1192 1192
1193 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 1193 hdr_len = (skb_transport_offset(skb) + (skb->h.th->doff << 2));
1194 mss = skb_shinfo(skb)->gso_size; 1194 mss = skb_shinfo(skb)->gso_size;
1195 iph = ip_hdr(skb); 1195 iph = ip_hdr(skb);
1196 iph->tot_len = 0; 1196 iph->tot_len = 0;
@@ -1199,8 +1199,8 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1199 0, IPPROTO_TCP, 0); 1199 0, IPPROTO_TCP, 0);
1200 ipcss = skb_network_offset(skb); 1200 ipcss = skb_network_offset(skb);
1201 ipcso = (void *)&(iph->check) - (void *)skb->data; 1201 ipcso = (void *)&(iph->check) - (void *)skb->data;
1202 ipcse = skb->h.raw - skb->data - 1; 1202 ipcse = skb_transport_offset(skb) - 1;
1203 tucss = skb->h.raw - skb->data; 1203 tucss = skb_transport_offset(skb);
1204 tucso = (void *)&(skb->h.th->check) - (void *)skb->data; 1204 tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
1205 tucse = 0; 1205 tucse = 0;
1206 1206
@@ -1245,7 +1245,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
1245 1245
1246 if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1246 if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1247 struct ixgb_buffer *buffer_info; 1247 struct ixgb_buffer *buffer_info;
1248 css = skb->h.raw - skb->data; 1248 css = skb_transport_offset(skb);
1249 cso = css + skb->csum_offset; 1249 cso = css + skb->csum_offset;
1250 1250
1251 i = adapter->tx_ring.next_to_use; 1251 i = adapter->tx_ring.next_to_use;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 7c04179c7b13..e04228c7b14f 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -2029,7 +2029,7 @@ again:
2029 odd_flag = 0; 2029 odd_flag = 0;
2030 flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST); 2030 flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
2031 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 2031 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
2032 cksum_offset = (skb->h.raw - skb->data); 2032 cksum_offset = skb_transport_offset(skb);
2033 pseudo_hdr_offset = cksum_offset + skb->csum_offset; 2033 pseudo_hdr_offset = cksum_offset + skb->csum_offset;
2034 /* If the headers are excessively large, then we must 2034 /* If the headers are excessively large, then we must
2035 * fall back to a software checksum */ 2035 * fall back to a software checksum */
@@ -2054,7 +2054,8 @@ again:
2054 * send loop that we are still in the 2054 * send loop that we are still in the
2055 * header portion of the TSO packet. 2055 * header portion of the TSO packet.
2056 * TSO header must be at most 134 bytes long */ 2056 * TSO header must be at most 134 bytes long */
2057 cum_len = -((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 2057 cum_len = -(skb_transport_offset(skb) +
2058 (skb->h.th->doff << 2));
2058 2059
2059 /* for TSO, pseudo_hdr_offset holds mss. 2060 /* for TSO, pseudo_hdr_offset holds mss.
2060 * The firmware figures out where to put 2061 * The firmware figures out where to put
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 28d68c3550ef..09ca2192cbfa 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -387,7 +387,7 @@ void netxen_tso_check(struct netxen_adapter *adapter,
387 } 387 }
388 } 388 }
389 adapter->stats.xmitcsummed++; 389 adapter->stats.xmitcsummed++;
390 desc->tcp_hdr_offset = skb->h.raw - skb->data; 390 desc->tcp_hdr_offset = skb_transport_offset(skb);
391 desc->ip_hdr_offset = skb_network_offset(skb); 391 desc->ip_hdr_offset = skb_network_offset(skb);
392} 392}
393 393
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 9ac1fe659dc9..e4ab7a8acc1a 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -1562,7 +1562,7 @@ struct sk_buff *pMessage) /* pointer to send-message */
1562 pTxd->pMBuf = pMessage; 1562 pTxd->pMBuf = pMessage;
1563 1563
1564 if (pMessage->ip_summed == CHECKSUM_PARTIAL) { 1564 if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
1565 u16 hdrlen = pMessage->h.raw - pMessage->data; 1565 u16 hdrlen = skb_transport_offset(pMessage);
1566 u16 offset = hdrlen + pMessage->csum_offset; 1566 u16 offset = hdrlen + pMessage->csum_offset;
1567 1567
1568 if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && 1568 if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) &&
@@ -1681,7 +1681,7 @@ struct sk_buff *pMessage) /* pointer to send-message */
1681 ** Does the HW need to evaluate checksum for TCP or UDP packets? 1681 ** Does the HW need to evaluate checksum for TCP or UDP packets?
1682 */ 1682 */
1683 if (pMessage->ip_summed == CHECKSUM_PARTIAL) { 1683 if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
1684 u16 hdrlen = pMessage->h.raw - pMessage->data; 1684 u16 hdrlen = skb_transport_offset(pMessage);
1685 u16 offset = hdrlen + pMessage->csum_offset; 1685 u16 offset = hdrlen + pMessage->csum_offset;
1686 1686
1687 Control = BMU_STFWD; 1687 Control = BMU_STFWD;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index d476a3cc2e94..ca7a0e039849 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2654,7 +2654,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2654 td->dma_hi = map >> 32; 2654 td->dma_hi = map >> 32;
2655 2655
2656 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2656 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2657 int offset = skb->h.raw - skb->data; 2657 const int offset = skb_transport_offset(skb);
2658 2658
2659 /* This seems backwards, but it is what the sk98lin 2659 /* This seems backwards, but it is what the sk98lin
2660 * does. Looks like hardware is wrong? 2660 * does. Looks like hardware is wrong?
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a37bb205f3d3..a35f2f2784ae 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1421,7 +1421,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1421 1421
1422 /* Handle TCP checksum offload */ 1422 /* Handle TCP checksum offload */
1423 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1423 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1424 unsigned offset = skb->h.raw - skb->data; 1424 const unsigned offset = skb_transport_offset(skb);
1425 u32 tcpsum; 1425 u32 tcpsum;
1426 1426
1427 tcpsum = offset << 16; /* sum start */ 1427 tcpsum = offset << 16; /* sum start */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index db2e1a6b7231..4bb89dec5650 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1028,10 +1028,8 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
1028 1028
1029 ctrl = 0; 1029 ctrl = 0;
1030 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1030 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1031 u64 csum_start_off, csum_stuff_off; 1031 const u64 csum_start_off = skb_transport_offset(skb);
1032 1032 const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
1033 csum_start_off = (u64) (skb->h.raw - skb->data);
1034 csum_stuff_off = csum_start_off + skb->csum_offset;
1035 1033
1036 ctrl = (TXDCTRL_CENAB | 1034 ctrl = (TXDCTRL_CENAB |
1037 (csum_start_off << 15) | 1035 (csum_start_off << 15) |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index aca592bc0329..4b69c1deb9f3 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2269,10 +2269,8 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev)
2269 2269
2270 tx_flags = TXFLAG_OWN; 2270 tx_flags = TXFLAG_OWN;
2271 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2271 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2272 u32 csum_start_off, csum_stuff_off; 2272 const u32 csum_start_off = skb_transport_offset(skb);
2273 2273 const u32 csum_stuff_off = csum_start_off + skb->csum_offset;
2274 csum_start_off = (u32) (skb->h.raw - skb->data);
2275 csum_stuff_off = csum_start_off + skb->csum_offset;
2276 2274
2277 tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE | 2275 tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE |
2278 ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) | 2276 ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7c1f1756e482..64c3c1687e49 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -962,6 +962,11 @@ static inline void skb_reset_transport_header(struct sk_buff *skb)
962 skb->h.raw = skb->data; 962 skb->h.raw = skb->data;
963} 963}
964 964
965static inline int skb_transport_offset(const struct sk_buff *skb)
966{
967 return skb->h.raw - skb->data;
968}
969
965static inline unsigned char *skb_network_header(const struct sk_buff *skb) 970static inline unsigned char *skb_network_header(const struct sk_buff *skb)
966{ 971{
967 return skb->nh.raw; 972 return skb->nh.raw;
diff --git a/include/net/udplite.h b/include/net/udplite.h
index d99df75fe54c..765032036657 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -101,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
101 101
102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
103{ 103{
104 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
105 __wsum csum = 0; 105 __wsum csum = 0;
106 106
107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
108 108
109 skb_queue_walk(&sk->sk_write_queue, skb) { 109 skb_queue_walk(&sk->sk_write_queue, skb) {
110 off = skb->h.raw - skb->data; 110 const int off = skb_transport_offset(skb);
111 len = skb->len - off; 111 const int len = skb->len - off;
112 112
113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); 113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
114 114
diff --git a/net/core/dev.c b/net/core/dev.c
index 99f15728d9cb..f7f7e5687e46 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1156,7 +1156,7 @@ EXPORT_SYMBOL(netif_device_attach);
1156int skb_checksum_help(struct sk_buff *skb) 1156int skb_checksum_help(struct sk_buff *skb)
1157{ 1157{
1158 __wsum csum; 1158 __wsum csum;
1159 int ret = 0, offset = skb->h.raw - skb->data; 1159 int ret = 0, offset = skb_transport_offset(skb);
1160 1160
1161 if (skb->ip_summed == CHECKSUM_COMPLETE) 1161 if (skb->ip_summed == CHECKSUM_COMPLETE)
1162 goto out_set_summed; 1162 goto out_set_summed;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1493c95f633e..b242020c02f7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1348,7 +1348,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
1348 long csstart; 1348 long csstart;
1349 1349
1350 if (skb->ip_summed == CHECKSUM_PARTIAL) 1350 if (skb->ip_summed == CHECKSUM_PARTIAL)
1351 csstart = skb->h.raw - skb->data; 1351 csstart = skb_transport_offset(skb);
1352 else 1352 else
1353 csstart = skb_headlen(skb); 1353 csstart = skb_headlen(skb);
1354 1354
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index ed3deed66445..957674562801 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -27,7 +27,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
27 int nfrags; 27 int nfrags;
28 28
29 /* Strip IP+ESP header. */ 29 /* Strip IP+ESP header. */
30 __skb_pull(skb, skb->h.raw - skb->data); 30 __skb_pull(skb, skb_transport_offset(skb));
31 /* Now skb is pure payload to encrypt */ 31 /* Now skb is pure payload to encrypt */
32 32
33 err = -ENOMEM; 33 err = -ENOMEM;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 13739cd8206f..13875e8419a7 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -435,7 +435,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
435 * fragments on the socket so that all csums of sk_buffs 435 * fragments on the socket so that all csums of sk_buffs
436 * should be together 436 * should be together
437 */ 437 */
438 offset = skb->h.raw - skb->data; 438 offset = skb_transport_offset(skb);
439 skb->csum = skb_checksum(skb, offset, skb->len - offset, 0); 439 skb->csum = skb_checksum(skb, offset, skb->len - offset, 0);
440 440
441 skb->ip_summed = CHECKSUM_NONE; 441 skb->ip_summed = CHECKSUM_NONE;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 7aff380e74ef..35905867ded1 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -42,21 +42,18 @@
42static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) 42static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
43{ 43{
44 int err; 44 int err;
45 int hdr_len;
46 struct ipv6hdr *top_iph; 45 struct ipv6hdr *top_iph;
47 struct ipv6_esp_hdr *esph; 46 struct ipv6_esp_hdr *esph;
48 struct crypto_blkcipher *tfm; 47 struct crypto_blkcipher *tfm;
49 struct blkcipher_desc desc; 48 struct blkcipher_desc desc;
50 struct esp_data *esp;
51 struct sk_buff *trailer; 49 struct sk_buff *trailer;
52 int blksize; 50 int blksize;
53 int clen; 51 int clen;
54 int alen; 52 int alen;
55 int nfrags; 53 int nfrags;
56 54 struct esp_data *esp = x->data;
57 esp = x->data; 55 int hdr_len = (skb_transport_offset(skb) +
58 hdr_len = skb->h.raw - skb->data + 56 sizeof(*esph) + esp->conf.ivlen);
59 sizeof(*esph) + esp->conf.ivlen;
60 57
61 /* Strip IP+ESP header. */ 58 /* Strip IP+ESP header. */
62 __skb_pull(skb, hdr_len); 59 __skb_pull(skb, hdr_len);
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index dab069b0b3f6..1bda0299890e 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -146,7 +146,7 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
146 int off = skb->h.raw - skb->nh.raw; 146 int off = skb->h.raw - skb->nh.raw;
147 int len = ((skb->h.raw[1]+1)<<3); 147 int len = ((skb->h.raw[1]+1)<<3);
148 148
149 if ((skb->h.raw + len) - skb->data > skb_headlen(skb)) 149 if (skb_transport_offset(skb) + len > skb_headlen(skb))
150 goto bad; 150 goto bad;
151 151
152 off += 2; 152 off += 2;
@@ -288,8 +288,9 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp)
288#endif 288#endif
289 struct dst_entry *dst; 289 struct dst_entry *dst;
290 290
291 if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || 291 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
292 !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { 292 !pskb_may_pull(skb, (skb_transport_offset(skb) +
293 ((skb->h.raw[1] + 1) << 3)))) {
293 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 294 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
294 IPSTATS_MIB_INHDRERRORS); 295 IPSTATS_MIB_INHDRERRORS);
295 kfree_skb(skb); 296 kfree_skb(skb);
@@ -387,8 +388,9 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
387 388
388 in6_dev_put(idev); 389 in6_dev_put(idev);
389 390
390 if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || 391 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
391 !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { 392 !pskb_may_pull(skb, (skb_transport_offset(skb) +
393 ((skb->h.raw[1] + 1) << 3)))) {
392 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 394 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
393 IPSTATS_MIB_INHDRERRORS); 395 IPSTATS_MIB_INHDRERRORS);
394 kfree_skb(skb); 396 kfree_skb(skb);
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 2dd32a2ca056..44275411d1a8 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -160,7 +160,7 @@ static inline int ip6_input_finish(struct sk_buff *skb)
160 rcu_read_lock(); 160 rcu_read_lock();
161resubmit: 161resubmit:
162 idev = ip6_dst_idev(skb->dst); 162 idev = ip6_dst_idev(skb->dst);
163 if (!pskb_pull(skb, skb->h.raw - skb->data)) 163 if (!pskb_pull(skb, skb_transport_offset(skb)))
164 goto discard; 164 goto discard;
165 nhoff = IP6CB(skb)->nhoff; 165 nhoff = IP6CB(skb)->nhoff;
166 nexthdr = skb_network_header(skb)[nhoff]; 166 nexthdr = skb_network_header(skb)[nhoff];
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index e2404a629680..4a6501695e98 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -124,15 +124,13 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
124{ 124{
125 int err; 125 int err;
126 struct ipv6hdr *top_iph; 126 struct ipv6hdr *top_iph;
127 int hdr_len;
128 struct ipv6_comp_hdr *ipch; 127 struct ipv6_comp_hdr *ipch;
129 struct ipcomp_data *ipcd = x->data; 128 struct ipcomp_data *ipcd = x->data;
130 int plen, dlen; 129 int plen, dlen;
131 u8 *start, *scratch; 130 u8 *start, *scratch;
132 struct crypto_comp *tfm; 131 struct crypto_comp *tfm;
133 int cpu; 132 int cpu;
134 133 int hdr_len = skb_transport_offset(skb);
135 hdr_len = skb->h.raw - skb->data;
136 134
137 /* check whether datagram len is larger than threshold */ 135 /* check whether datagram len is larger than threshold */
138 if ((skb->len - hdr_len) < ipcd->threshold) { 136 if ((skb->len - hdr_len) < ipcd->threshold) {
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 7b5f9d82e801..85202891644e 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -90,8 +90,9 @@ int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
90{ 90{
91 struct ip6_mh *mh; 91 struct ip6_mh *mh;
92 92
93 if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || 93 if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) ||
94 !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3))) 94 !pskb_may_pull(skb, (skb_transport_offset(skb) +
95 ((skb->h.raw[1] + 1) << 3))))
95 return -1; 96 return -1;
96 97
97 mh = (struct ip6_mh *)skb->h.raw; 98 mh = (struct ip6_mh *)skb->h.raw;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 0e2b56ce0a56..bb049f1c2679 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -513,7 +513,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
513 if (csum_skb) 513 if (csum_skb)
514 continue; 514 continue;
515 515
516 len = skb->len - (skb->h.raw - skb->data); 516 len = skb->len - skb_transport_offset(skb);
517 if (offset >= len) { 517 if (offset >= len) {
518 offset -= len; 518 offset -= len;
519 continue; 519 continue;
@@ -525,7 +525,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
525 skb = csum_skb; 525 skb = csum_skb;
526 } 526 }
527 527
528 offset += skb->h.raw - skb->data; 528 offset += skb_transport_offset(skb);
529 if (skb_copy_bits(skb, offset, &csum, 2)) 529 if (skb_copy_bits(skb, offset, &csum, 2))
530 BUG(); 530 BUG();
531 531
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 2594f0fb290d..ef29a7bb97ce 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -718,7 +718,8 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
718 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); 718 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
719 return -1; 719 return -1;
720 } 720 }
721 if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) { 721 if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
722 sizeof(struct frag_hdr)))) {
722 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); 723 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
723 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); 724 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
724 return -1; 725 return -1;
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 595fe32b3d41..9311b5ddf5c0 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -141,7 +141,7 @@ int sctp_rcv(struct sk_buff *skb)
141 sh = (struct sctphdr *) skb->h.raw; 141 sh = (struct sctphdr *) skb->h.raw;
142 142
143 /* Pull up the IP and SCTP headers. */ 143 /* Pull up the IP and SCTP headers. */
144 __skb_pull(skb, skb->h.raw - skb->data); 144 __skb_pull(skb, skb_transport_offset(skb));
145 if (skb->len < sizeof(struct sctphdr)) 145 if (skb->len < sizeof(struct sctphdr))
146 goto discard_it; 146 goto discard_it;
147 if ((skb->ip_summed != CHECKSUM_UNNECESSARY) && 147 if ((skb->ip_summed != CHECKSUM_UNNECESSARY) &&