Commit 1bcac3b08e2f13c31f798ac46897e33f08cfbd53

Authored by Li RongQing
Committed by David S. Miller
1 parent b66c66dc5c

driver/qlogic: replace ip_fast_csum with csum_replace2

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>

Showing 2 changed files with 5 additions and 6 deletions Side-by-side Diff

drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
... ... @@ -27,6 +27,7 @@
27 27 #include <linux/delay.h>
28 28 #include <linux/slab.h>
29 29 #include <linux/if_vlan.h>
  30 +#include <net/checksum.h>
30 31 #include "netxen_nic.h"
31 32 #include "netxen_nic_hw.h"
32 33  
33 34  
... ... @@ -1641,9 +1642,8 @@
1641 1642 th = (struct tcphdr *)((skb->data + vhdr_len) + (iph->ihl << 2));
1642 1643  
1643 1644 length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
  1645 + csum_replace2(&iph->check, iph->tot_len, htons(length));
1644 1646 iph->tot_len = htons(length);
1645   - iph->check = 0;
1646   - iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
1647 1647 th->psh = push;
1648 1648 th->seq = htonl(seq_number);
1649 1649  
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
... ... @@ -9,6 +9,7 @@
9 9 #include <linux/if_vlan.h>
10 10 #include <net/ip.h>
11 11 #include <linux/ipv6.h>
  12 +#include <net/checksum.h>
12 13  
13 14 #include "qlcnic.h"
14 15  
15 16  
... ... @@ -1132,9 +1133,8 @@
1132 1133 iph = (struct iphdr *)skb->data;
1133 1134 th = (struct tcphdr *)(skb->data + (iph->ihl << 2));
1134 1135 length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
  1136 + csum_replace2(&iph->check, iph->tot_len, htons(length));
1135 1137 iph->tot_len = htons(length);
1136   - iph->check = 0;
1137   - iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
1138 1138 }
1139 1139  
1140 1140 th->psh = push;
1141 1141  
... ... @@ -1595,9 +1595,8 @@
1595 1595 iph = (struct iphdr *)skb->data;
1596 1596 th = (struct tcphdr *)(skb->data + (iph->ihl << 2));
1597 1597 length = (iph->ihl << 2) + (th->doff << 2) + lro_length;
  1598 + csum_replace2(&iph->check, iph->tot_len, htons(length));
1598 1599 iph->tot_len = htons(length);
1599   - iph->check = 0;
1600   - iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
1601 1600 }
1602 1601  
1603 1602 th->psh = push;