nfsd: move some of fh_compose into helper functions
[safe/jmp/linux-2.6] / net / ipv4 / inet_lro.c
index ac3b1d3..6a667da 100644 (file)
@@ -120,7 +120,7 @@ static void lro_update_tcp_ip_header(struct net_lro_desc *lro_desc)
        iph->check = ip_fast_csum((u8 *)lro_desc->iph, iph->ihl);
 
        tcph->check = 0;
-       tcp_hdr_csum = csum_partial((u8 *)tcph, TCP_HDR_LEN(tcph), 0);
+       tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), 0);
        lro_desc->data_csum = csum_add(lro_desc->data_csum, tcp_hdr_csum);
        tcph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
                                        lro_desc->ip_tot_len -
@@ -135,7 +135,7 @@ static __wsum lro_tcp_data_csum(struct iphdr *iph, struct tcphdr *tcph, int len)
        __wsum tcp_ps_hdr_csum;
 
        tcp_csum = ~csum_unfold(tcph->check);
-       tcp_hdr_csum = csum_partial((u8 *)tcph, TCP_HDR_LEN(tcph), tcp_csum);
+       tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), tcp_csum);
 
        tcp_ps_hdr_csum = csum_tcpudp_nofold(iph->saddr, iph->daddr,
                                             len + TCP_HDR_LEN(tcph),
@@ -310,7 +310,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
        skb_shinfo(lro_desc->parent)->gso_size = lro_desc->mss;
 
        if (lro_desc->vgrp) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        vlan_hwaccel_receive_skb(lro_desc->parent,
                                                 lro_desc->vgrp,
                                                 lro_desc->vlan_tag);
@@ -320,7 +320,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
                                        lro_desc->vlan_tag);
 
        } else {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        netif_receive_skb(lro_desc->parent);
                else
                        netif_rx(lro_desc->parent);
@@ -352,7 +352,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
                goto out;
 
        if ((skb->protocol == htons(ETH_P_8021Q))
-           && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features))
+           && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
                vlan_hdr_len = VLAN_HLEN;
 
        if (!lro_desc->active) { /* start new lro session */
@@ -383,8 +383,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
 out2: /* send aggregated SKBs to stack */
        lro_flush(lro_mgr, lro_desc);
 
-out:  /* Original SKB has to be posted to stack */
-       skb->ip_summed = lro_mgr->ip_summed;
+out:
        return 1;
 }
 
@@ -401,10 +400,11 @@ static struct sk_buff *lro_gen_skb(struct net_lro_mgr *lro_mgr,
        int data_len = len;
        int hdr_len = min(len, hlen);
 
-       skb = netdev_alloc_skb(lro_mgr->dev, hlen);
+       skb = netdev_alloc_skb(lro_mgr->dev, hlen + lro_mgr->frag_align_pad);
        if (!skb)
                return NULL;
 
+       skb_reserve(skb, lro_mgr->frag_align_pad);
        skb->len = len;
        skb->data_len = len - hdr_len;
        skb->truesize += true_size;
@@ -473,7 +473,7 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
                        goto out;
 
                if ((skb->protocol == htons(ETH_P_8021Q))
-                   && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features))
+                   && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
                        vlan_hdr_len = VLAN_HLEN;
 
                iph = (void *)(skb->data + vlan_hdr_len);
@@ -515,7 +515,7 @@ void lro_receive_skb(struct net_lro_mgr *lro_mgr,
                     void *priv)
 {
        if (__lro_proc_skb(lro_mgr, skb, NULL, 0, priv)) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        netif_receive_skb(skb);
                else
                        netif_rx(skb);
@@ -530,7 +530,7 @@ void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr,
                                  void *priv)
 {
        if (__lro_proc_skb(lro_mgr, skb, vgrp, vlan_tag, priv)) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
                else
                        vlan_hwaccel_rx(skb, vgrp, vlan_tag);
@@ -549,7 +549,7 @@ void lro_receive_frags(struct net_lro_mgr *lro_mgr,
        if (!skb)
                return;
 
-       if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+       if (lro_mgr->features & LRO_F_NAPI)
                netif_receive_skb(skb);
        else
                netif_rx(skb);
@@ -569,7 +569,7 @@ void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr,
        if (!skb)
                return;
 
-       if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+       if (lro_mgr->features & LRO_F_NAPI)
                vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
        else
                vlan_hwaccel_rx(skb, vgrp, vlan_tag);