]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - net/ipv4/ip_fragment.c
clean up reading of ICR register in FEC driver
[linux-2.6.git] / net / ipv4 / ip_fragment.c
index 3dfd7581cfc6fe64e384c3181a1cbc206969ffa6..0231bdcb2ab7620b55c1aaeda45d256c5a0de2ef 100644 (file)
@@ -479,11 +479,11 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
                goto err;
        }
 
-       offset = ntohs(skb->nh.iph->frag_off);
+       offset = ntohs(ip_hdr(skb)->frag_off);
        flags = offset & ~IP_OFFSET;
        offset &= IP_OFFSET;
        offset <<= 3;           /* offset is in 8-byte chunks */
-       ihl = skb->nh.iph->ihl * 4;
+       ihl = ip_hdrlen(skb);
 
        /* Determine the position of this fragment. */
        end = offset + skb->len - ihl;
@@ -624,7 +624,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
        BUG_TRAP(FRAG_CB(head)->offset == 0);
 
        /* Allocate a new buffer for the datagram. */
-       ihlen = head->nh.iph->ihl*4;
+       ihlen = ip_hdrlen(head);
        len = ihlen + qp->len;
 
        if (len > 65535)
@@ -658,7 +658,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
        }
 
        skb_shinfo(head)->frag_list = head->next;
-       skb_push(head, head->data - head->nh.raw);
+       skb_push(head, head->data - skb_network_header(head));
        atomic_sub(head->truesize, &ip_frag_mem);
 
        for (fp=head->next; fp; fp = fp->next) {
@@ -676,7 +676,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
        head->dev = dev;
        head->tstamp = qp->stamp;
 
-       iph = head->nh.iph;
+       iph = ip_hdr(head);
        iph->frag_off = 0;
        iph->tot_len = htons(len);
        IP_INC_STATS_BH(IPSTATS_MIB_REASMOKS);
@@ -700,7 +700,6 @@ out_fail:
 /* Process an incoming IP datagram fragment. */
 struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
 {
-       struct iphdr *iph = skb->nh.iph;
        struct ipq *qp;
        struct net_device *dev;
 
@@ -713,7 +712,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
        dev = skb->dev;
 
        /* Lookup (or create) queue header */
-       if ((qp = ip_find(iph, user)) != NULL) {
+       if ((qp = ip_find(ip_hdr(skb), user)) != NULL) {
                struct sk_buff *ret = NULL;
 
                spin_lock(&qp->lock);