[SK_BUFF]: Introduce skb_transport_offset()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 Apr 2007 00:55:53 +0000 (17:55 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:16 +0000 (22:25 -0700)
For the quite common 'skb->h.raw - skb->data' sequence.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
26 files changed:
drivers/net/atl1/atl1_main.c
drivers/net/cassini.c
drivers/net/cxgb3/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/ixgb/ixgb_main.c
drivers/net/myri10ge/myri10ge.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/sk98lin/skge.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/sungem.c
drivers/net/sunhme.c
include/linux/skbuff.h
include/net/udplite.h
net/core/dev.c
net/core/skbuff.c
net/ipv4/esp4.c
net/ipv4/udp.c
net/ipv6/esp6.c
net/ipv6/exthdrs.c
net/ipv6/ip6_input.c
net/ipv6/ipcomp6.c
net/ipv6/mip6.c
net/ipv6/raw.c
net/ipv6/reassembly.c
net/sctp/input.c

index d2be79a30f8abde7bd00f894da1f821238c7bc29..c26f8ce320e6db74ce27e7bd8c776135808b3667 100644 (file)
@@ -1326,8 +1326,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
        u8 css, cso;
 
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-               cso = skb->h.raw - skb->data;
-               css = (skb->h.raw + skb->csum_offset) - skb->data;
+               cso = skb_transport_offset(skb);
+               css = cso + skb->csum;
                if (unlikely(cso & 0x1)) {
                        printk(KERN_DEBUG "%s: payload offset != even number\n",
                                atl1_driver_name);
@@ -1369,8 +1369,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter,
 
        if (tcp_seg) {
                /* TSO/GSO */
-               proto_hdr_len =
-                   ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
+               proto_hdr_len = (skb_transport_offset(skb) +
+                                (skb->h.th->doff << 2));
                buffer_info->length = proto_hdr_len;
                page = virt_to_page(skb->data);
                offset = (unsigned long)skb->data & ~PAGE_MASK;
@@ -1562,7 +1562,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        mss = skb_shinfo(skb)->gso_size;
        if (mss) {
                if (skb->protocol == htons(ETH_P_IP)) {
-                       proto_hdr_len = ((skb->h.raw - skb->data) +
+                       proto_hdr_len = (skb_transport_offset(skb) +
                                         (skb->h.th->doff << 2));
                        if (unlikely(proto_hdr_len > len)) {
                                dev_kfree_skb_any(skb);
index 68e37a655fe2ee61ebd821508488aa2c33632641..bd3ab6493e393cad862e1b1da34c3d9b8b13e0ab 100644 (file)
@@ -2821,10 +2821,8 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
 
        ctrl = 0;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               u64 csum_start_off, csum_stuff_off;
-
-               csum_start_off = (u64) (skb->h.raw - skb->data);
-               csum_stuff_off = csum_start_off + skb->csum_offset;
+               const u64 csum_start_off = skb_transport_offset(skb);
+               const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl =  TX_DESC_CSUM_EN |
                        CAS_BASE(TX_DESC_CSUM_START, csum_start_off) |
index a891f6f81527536c15a7083b0bb18c4e7eb99252..d38b1bcd138e852c092f7d46501e6a5705fa7771 100644 (file)
@@ -1319,9 +1319,10 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
        /* Only TX_DATA builds SGLs */
 
        from = (struct work_request_hdr *)skb->data;
-       memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from));
+       memcpy(&d->flit[1], &from[1],
+              skb_transport_offset(skb) - sizeof(*from));
 
-       flits = (skb->h.raw - skb->data) / 8;
+       flits = skb_transport_offset(skb) / 8;
        sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
        sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw,
                             adap->pdev);
@@ -1349,7 +1350,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
        if (skb->len <= WR_LEN && cnt == 0)
                return 1;       /* packet fits as immediate data */
 
-       flits = (skb->h.raw - skb->data) / 8;   /* headers */
+       flits = skb_transport_offset(skb) / 8;  /* headers */
        if (skb->tail != skb->h.raw)
                cnt++;
        return flits_to_desc(flits + sgl_len(cnt));
index a3d9986b4170526f4deffa92c99e88a24fee7c10..78cf417cf236b4f732c7b6d4e048604432e03776 100644 (file)
@@ -2887,7 +2887,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                                return err;
                }
 
-               hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
+               hdr_len = (skb_transport_offset(skb) + (skb->h.th->doff << 2));
                mss = skb_shinfo(skb)->gso_size;
                if (skb->protocol == htons(ETH_P_IP)) {
                        struct iphdr *iph = ip_hdr(skb);
@@ -2897,7 +2897,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                                                              iph->daddr, 0,
                                                              IPPROTO_TCP, 0);
                        cmd_length = E1000_TXD_CMD_IP;
-                       ipcse = skb->h.raw - skb->data - 1;
+                       ipcse = skb_transport_offset(skb) - 1;
                } else if (skb->protocol == htons(ETH_P_IPV6)) {
                        ipv6_hdr(skb)->payload_len = 0;
                        skb->h.th->check =
@@ -2908,7 +2908,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                }
                ipcss = skb_network_offset(skb);
                ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
-               tucss = skb->h.raw - skb->data;
+               tucss = skb_transport_offset(skb);
                tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
                tucse = 0;
 
@@ -2950,7 +2950,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
        uint8_t css;
 
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-               css = skb->h.raw - skb->data;
+               css = skb_transport_offset(skb);
 
                i = tx_ring->next_to_use;
                buffer_info = &tx_ring->buffer_info[i];
@@ -3292,7 +3292,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                /* TSO Workaround for 82571/2/3 Controllers -- if skb->data
                * points to just header, pull a few bytes of payload from
                * frags into skb->data */
-               hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
+               hdr_len = (skb_transport_offset(skb) + (skb->h.th->doff << 2));
                if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {
                        switch (adapter->hw.mac_type) {
                                unsigned int pull_size;
index bba4dcaf92e9998cdc281a0e099e95fbeef2c82f..ceea6e45792d9cb492c2fc7a0d0c55e9075560c2 100644 (file)
@@ -1190,7 +1190,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
                                return err;
                }
 
-               hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
+               hdr_len = (skb_transport_offset(skb) + (skb->h.th->doff << 2));
                mss = skb_shinfo(skb)->gso_size;
                iph = ip_hdr(skb);
                iph->tot_len = 0;
@@ -1199,8 +1199,8 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
                                                      0, IPPROTO_TCP, 0);
                ipcss = skb_network_offset(skb);
                ipcso = (void *)&(iph->check) - (void *)skb->data;
-               ipcse = skb->h.raw - skb->data - 1;
-               tucss = skb->h.raw - skb->data;
+               ipcse = skb_transport_offset(skb) - 1;
+               tucss = skb_transport_offset(skb);
                tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
                tucse = 0;
 
@@ -1245,7 +1245,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 
        if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                struct ixgb_buffer *buffer_info;
-               css = skb->h.raw - skb->data;
+               css = skb_transport_offset(skb);
                cso = css + skb->csum_offset;
 
                i = adapter->tx_ring.next_to_use;
index 7c04179c7b1349795c2cd23842f7fc33ef2ab035..e04228c7b14f32a9bf8a35d2fb844a58dcde7a38 100644 (file)
@@ -2029,7 +2029,7 @@ again:
        odd_flag = 0;
        flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-               cksum_offset = (skb->h.raw - skb->data);
+               cksum_offset = skb_transport_offset(skb);
                pseudo_hdr_offset = cksum_offset + skb->csum_offset;
                /* If the headers are excessively large, then we must
                 * fall back to a software checksum */
@@ -2054,7 +2054,8 @@ again:
                 * send loop that we are still in the
                 * header portion of the TSO packet.
                 * TSO header must be at most 134 bytes long */
-               cum_len = -((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
+               cum_len = -(skb_transport_offset(skb) +
+                           (skb->h.th->doff << 2));
 
                /* for TSO, pseudo_hdr_offset holds mss.
                 * The firmware figures out where to put
index 28d68c3550efe0722a512492fd944cc4bd260fdb..09ca2192cbfa26c3d4130734b4ccc5d748e462c9 100644 (file)
@@ -387,7 +387,7 @@ void netxen_tso_check(struct netxen_adapter *adapter,
                }
        }
        adapter->stats.xmitcsummed++;
-       desc->tcp_hdr_offset = skb->h.raw - skb->data;
+       desc->tcp_hdr_offset = skb_transport_offset(skb);
        desc->ip_hdr_offset = skb_network_offset(skb);
 }
 
index 9ac1fe659dc99bbe69702aaf10ae30934bd43f65..e4ab7a8acc1af466b29a793ade99a93034e0e2f0 100644 (file)
@@ -1562,7 +1562,7 @@ struct sk_buff    *pMessage)      /* pointer to send-message              */
        pTxd->pMBuf     = pMessage;
 
        if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
-               u16 hdrlen = pMessage->h.raw - pMessage->data;
+               u16 hdrlen = skb_transport_offset(pMessage);
                u16 offset = hdrlen + pMessage->csum_offset;
 
                if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) &&
@@ -1681,7 +1681,7 @@ struct sk_buff    *pMessage)      /* pointer to send-message              */
        ** Does the HW need to evaluate checksum for TCP or UDP packets? 
        */
        if (pMessage->ip_summed == CHECKSUM_PARTIAL) {
-               u16 hdrlen = pMessage->h.raw - pMessage->data;
+               u16 hdrlen = skb_transport_offset(pMessage);
                u16 offset = hdrlen + pMessage->csum_offset;
 
                Control = BMU_STFWD;
index d476a3cc2e94cf5f94df64940beb99ba5b2b2b51..ca7a0e0398496d723a0139a99164e468e5143445 100644 (file)
@@ -2654,7 +2654,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
        td->dma_hi = map >> 32;
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               int offset = skb->h.raw - skb->data;
+               const int offset = skb_transport_offset(skb);
 
                /* This seems backwards, but it is what the sk98lin
                 * does.  Looks like hardware is wrong?
index a37bb205f3d3076a4b0a253790577a7243a474ae..a35f2f2784ae0792c7cd4617464c526fe94130b7 100644 (file)
@@ -1421,7 +1421,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
        /* Handle TCP checksum offload */
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               unsigned offset = skb->h.raw - skb->data;
+               const unsigned offset = skb_transport_offset(skb);
                u32 tcpsum;
 
                tcpsum = offset << 16;          /* sum start */
index db2e1a6b7231dd3161a9ef934bfc8f957f7fb51f..4bb89dec565032ee56adf0479b2908afd8213901 100644 (file)
@@ -1028,10 +1028,8 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        ctrl = 0;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               u64 csum_start_off, csum_stuff_off;
-
-               csum_start_off = (u64) (skb->h.raw - skb->data);
-               csum_stuff_off = csum_start_off + skb->csum_offset;
+               const u64 csum_start_off = skb_transport_offset(skb);
+               const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                ctrl = (TXDCTRL_CENAB |
                        (csum_start_off << 15) |
index aca592bc0329ea56ee6c8e5f82a1242cae22e119..4b69c1deb9f3b3992d087233572f6f4fd3719bad 100644 (file)
@@ -2269,10 +2269,8 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        tx_flags = TXFLAG_OWN;
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               u32 csum_start_off, csum_stuff_off;
-
-               csum_start_off = (u32) (skb->h.raw - skb->data);
-               csum_stuff_off = csum_start_off + skb->csum_offset;
+               const u32 csum_start_off = skb_transport_offset(skb);
+               const u32 csum_stuff_off = csum_start_off + skb->csum_offset;
 
                tx_flags = (TXFLAG_OWN | TXFLAG_CSENABLE |
                            ((csum_start_off << 14) & TXFLAG_CSBUFBEGIN) |
index 7c1f1756e482dd587f00ea2237afd86f9b8e292a..64c3c1687e49e6c43b67d2c234d2209fde303e50 100644 (file)
@@ -962,6 +962,11 @@ static inline void skb_reset_transport_header(struct sk_buff *skb)
        skb->h.raw = skb->data;
 }
 
+static inline int skb_transport_offset(const struct sk_buff *skb)
+{
+       return skb->h.raw - skb->data;
+}
+
 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
 {
        return skb->nh.raw;
index d99df75fe54c51fa5d96899585ece186e3bc680d..765032036657008d0816a469ac3e6c1b2b7b9879 100644 (file)
@@ -101,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
 
 static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
 {
-       int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
+       int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
        __wsum csum = 0;
 
        skb->ip_summed = CHECKSUM_NONE;     /* no HW support for checksumming */
 
        skb_queue_walk(&sk->sk_write_queue, skb) {
-               off = skb->h.raw - skb->data;
-               len = skb->len - off;
+               const int off = skb_transport_offset(skb);
+               const int len = skb->len - off;
 
                csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
 
index 99f15728d9cb2a6c14488832720b44b0760f708a..f7f7e5687e462a459a8395d2ed5f273aa0eaee74 100644 (file)
@@ -1156,7 +1156,7 @@ EXPORT_SYMBOL(netif_device_attach);
 int skb_checksum_help(struct sk_buff *skb)
 {
        __wsum csum;
-       int ret = 0, offset = skb->h.raw - skb->data;
+       int ret = 0, offset = skb_transport_offset(skb);
 
        if (skb->ip_summed == CHECKSUM_COMPLETE)
                goto out_set_summed;
index 1493c95f633efd8feadbc54d10ee42e9d23742df..b242020c02f74ccdf42265abfbbcf597f1099c88 100644 (file)
@@ -1348,7 +1348,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
        long csstart;
 
        if (skb->ip_summed == CHECKSUM_PARTIAL)
-               csstart = skb->h.raw - skb->data;
+               csstart = skb_transport_offset(skb);
        else
                csstart = skb_headlen(skb);
 
index ed3deed66445b4fc6c1ebc5cc5600d063aa5e472..957674562801028d2ffa844c334a4e291a7e932b 100644 (file)
@@ -27,7 +27,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
        int nfrags;
 
        /* Strip IP+ESP header. */
-       __skb_pull(skb, skb->h.raw - skb->data);
+       __skb_pull(skb, skb_transport_offset(skb));
        /* Now skb is pure payload to encrypt */
 
        err = -ENOMEM;
index 13739cd8206f76c1bb05359761d22de4a768980d..13875e8419a7467360490fc8915fdf1ad669e84b 100644 (file)
@@ -435,7 +435,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
                 * fragments on the socket so that all csums of sk_buffs
                 * should be together
                 */
-               offset = skb->h.raw - skb->data;
+               offset = skb_transport_offset(skb);
                skb->csum = skb_checksum(skb, offset, skb->len - offset, 0);
 
                skb->ip_summed = CHECKSUM_NONE;
index 7aff380e74ef9f9eea0be386b8f420b6783db4e6..35905867ded161b46b88a67a0523de6c0daf0e7b 100644 (file)
 static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
 {
        int err;
-       int hdr_len;
        struct ipv6hdr *top_iph;
        struct ipv6_esp_hdr *esph;
        struct crypto_blkcipher *tfm;
        struct blkcipher_desc desc;
-       struct esp_data *esp;
        struct sk_buff *trailer;
        int blksize;
        int clen;
        int alen;
        int nfrags;
-
-       esp = x->data;
-       hdr_len = skb->h.raw - skb->data +
-                 sizeof(*esph) + esp->conf.ivlen;
+       struct esp_data *esp = x->data;
+       int hdr_len = (skb_transport_offset(skb) +
+                      sizeof(*esph) + esp->conf.ivlen);
 
        /* Strip IP+ESP header. */
        __skb_pull(skb, hdr_len);
index dab069b0b3f6e1bdccd8434876ffd0c9dd2dfff3..1bda0299890ee457555a6b82d5483d6b696be875 100644 (file)
@@ -146,7 +146,7 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
        int off = skb->h.raw - skb->nh.raw;
        int len = ((skb->h.raw[1]+1)<<3);
 
-       if ((skb->h.raw + len) - skb->data > skb_headlen(skb))
+       if (skb_transport_offset(skb) + len > skb_headlen(skb))
                goto bad;
 
        off += 2;
@@ -288,8 +288,9 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp)
 #endif
        struct dst_entry *dst;
 
-       if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
-           !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
+       if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
+           !pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                ((skb->h.raw[1] + 1) << 3)))) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                 IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
@@ -387,8 +388,9 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
        in6_dev_put(idev);
 
-       if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
-           !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
+       if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
+           !pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                ((skb->h.raw[1] + 1) << 3)))) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                 IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
index 2dd32a2ca05645ad6b6ffdddddd3d4702880395f..44275411d1a829fccbc93c625b05df5bec58f211 100644 (file)
@@ -160,7 +160,7 @@ static inline int ip6_input_finish(struct sk_buff *skb)
        rcu_read_lock();
 resubmit:
        idev = ip6_dst_idev(skb->dst);
-       if (!pskb_pull(skb, skb->h.raw - skb->data))
+       if (!pskb_pull(skb, skb_transport_offset(skb)))
                goto discard;
        nhoff = IP6CB(skb)->nhoff;
        nexthdr = skb_network_header(skb)[nhoff];
index e2404a62968056afdacb013489ad31929f9b2c65..4a6501695e98d5d5de163c7d0c1b88ae50303b57 100644 (file)
@@ -124,15 +124,13 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
 {
        int err;
        struct ipv6hdr *top_iph;
-       int hdr_len;
        struct ipv6_comp_hdr *ipch;
        struct ipcomp_data *ipcd = x->data;
        int plen, dlen;
        u8 *start, *scratch;
        struct crypto_comp *tfm;
        int cpu;
-
-       hdr_len = skb->h.raw - skb->data;
+       int hdr_len = skb_transport_offset(skb);
 
        /* check whether datagram len is larger than threshold */
        if ((skb->len - hdr_len) < ipcd->threshold) {
index 7b5f9d82e80145ddce339eb70d6bc9873d805eb4..85202891644e55a977997102c31be113aaacd4aa 100644 (file)
@@ -90,8 +90,9 @@ int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
 {
        struct ip6_mh *mh;
 
-       if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) ||
-           !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3)))
+       if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) ||
+           !pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                ((skb->h.raw[1] + 1) << 3))))
                return -1;
 
        mh = (struct ip6_mh *)skb->h.raw;
index 0e2b56ce0a56520fdfd625f1e065028e6eca78ac..bb049f1c2679fca77d9d36b5674b65d4c31c6745 100644 (file)
@@ -513,7 +513,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
                        if (csum_skb)
                                continue;
 
-                       len = skb->len - (skb->h.raw - skb->data);
+                       len = skb->len - skb_transport_offset(skb);
                        if (offset >= len) {
                                offset -= len;
                                continue;
@@ -525,7 +525,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
                skb = csum_skb;
        }
 
-       offset += skb->h.raw - skb->data;
+       offset += skb_transport_offset(skb);
        if (skb_copy_bits(skb, offset, &csum, 2))
                BUG();
 
index 2594f0fb290db55816f5ad212ba9bed194c7e359..ef29a7bb97cef3b4d422fd0ebaefccd81a6ca970 100644 (file)
@@ -718,7 +718,8 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
                return -1;
        }
-       if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) {
+       if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                sizeof(struct frag_hdr)))) {
                IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
                return -1;
index 595fe32b3d41ef238664b757449aeddd5b7fbb7c..9311b5ddf5c0f4ffff8f05c19df9efc955053e7d 100644 (file)
@@ -141,7 +141,7 @@ int sctp_rcv(struct sk_buff *skb)
        sh = (struct sctphdr *) skb->h.raw;
 
        /* Pull up the IP and SCTP headers. */
-       __skb_pull(skb, skb->h.raw - skb->data);
+       __skb_pull(skb, skb_transport_offset(skb));
        if (skb->len < sizeof(struct sctphdr))
                goto discard_it;
        if ((skb->ip_summed != CHECKSUM_UNNECESSARY) &&