]> Pileus Git - ~andy/linux/commitdiff
driver/qlogic: replace ip_fast_csum with csum_replace2
authorLi RongQing <roy.qing.li@gmail.com>
Thu, 14 Mar 2013 22:50:07 +0000 (22:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Mar 2013 13:12:24 +0000 (09:12 -0400)
replace ip_fast_csum with csum_replace2 to save cpu cycles

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c

index 4782dcfde736cbd2d2b6621accf05180c3c54494..7692dfd4f262db9045f285aadc194c1713fb724a 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/if_vlan.h>
+#include <net/checksum.h>
 #include "netxen_nic.h"
 #include "netxen_nic_hw.h"
 
@@ -1641,9 +1642,8 @@ netxen_process_lro(struct netxen_adapter *adapter,
        th = (struct tcphdr *)((skb->data + vhdr_len) + (iph->ihl << 2));
 
        length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
+       csum_replace2(&iph->check, iph->tot_len, htons(length));
        iph->tot_len = htons(length);
-       iph->check = 0;
-       iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
        th->psh = push;
        th->seq = htonl(seq_number);
 
index 0e630061bff31b41192d4b8fc7978e2be839e274..891f12d47c9ca68f5a0147f949b3cf6cee0b85d8 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/if_vlan.h>
 #include <net/ip.h>
 #include <linux/ipv6.h>
+#include <net/checksum.h>
 
 #include "qlcnic.h"
 
@@ -1132,9 +1133,8 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
                iph = (struct iphdr *)skb->data;
                th = (struct tcphdr *)(skb->data + (iph->ihl << 2));
                length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
+               csum_replace2(&iph->check, iph->tot_len, htons(length));
                iph->tot_len = htons(length);
-               iph->check = 0;
-               iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
        }
 
        th->psh = push;
@@ -1595,9 +1595,8 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
                iph = (struct iphdr *)skb->data;
                th = (struct tcphdr *)(skb->data + (iph->ihl << 2));
                length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
+               csum_replace2(&iph->check, iph->tot_len, htons(length));
                iph->tot_len = htons(length);
-               iph->check = 0;
-               iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
        }
 
        th->psh = push;