aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-08-29 19:44:56 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:53:53 -0400
commit84fa7933a33f806bbbaae6775e87459b1ec584c0 (patch)
tree5be404225d90f640997b12f631e9b496b3fd0d61 /net/ipv4
parent8584d6df39db5601965f9bc5e3bf2fea833ad7bb (diff)
[NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE
Replace CHECKSUM_HW by CHECKSUM_PARTIAL (for outgoing packets, whose checksum still needs to be completed) and CHECKSUM_COMPLETE (for incoming packets, device supplied full checksum). Patch originally from Herbert Xu, updated by myself for 2.6.18-rc3. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_output.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c8
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_udp.c8
-rw-r--r--net/ipv4/netfilter.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c3
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_udp.c3
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c5
-rw-r--r--net/ipv4/netfilter/ip_queue.c6
-rw-r--r--net/ipv4/netfilter/ipt_ECN.c9
-rw-r--r--net/ipv4/netfilter/ipt_TCPMSS.c5
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/ipv4/tcp_ipv4.c6
-rw-r--r--net/ipv4/tcp_output.c18
-rw-r--r--net/ipv4/udp.c6
-rw-r--r--net/ipv4/xfrm4_output.c4
19 files changed, 53 insertions, 54 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 6ad797c14163..6d223e5c6741 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -930,7 +930,7 @@ int icmp_rcv(struct sk_buff *skb)
930 ICMP_INC_STATS_BH(ICMP_MIB_INMSGS); 930 ICMP_INC_STATS_BH(ICMP_MIB_INMSGS);
931 931
932 switch (skb->ip_summed) { 932 switch (skb->ip_summed) {
933 case CHECKSUM_HW: 933 case CHECKSUM_COMPLETE:
934 if (!(u16)csum_fold(skb->csum)) 934 if (!(u16)csum_fold(skb->csum))
935 break; 935 break;
936 /* fall through */ 936 /* fall through */
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 8e8117c19e4d..7003e763d970 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -931,7 +931,7 @@ int igmp_rcv(struct sk_buff *skb)
931 goto drop; 931 goto drop;
932 932
933 switch (skb->ip_summed) { 933 switch (skb->ip_summed) {
934 case CHECKSUM_HW: 934 case CHECKSUM_COMPLETE:
935 if (!(u16)csum_fold(skb->csum)) 935 if (!(u16)csum_fold(skb->csum))
936 break; 936 break;
937 /* fall through */ 937 /* fall through */
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b84b53a47526..8d7f107c2eef 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -665,7 +665,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
665 head->len += fp->len; 665 head->len += fp->len;
666 if (head->ip_summed != fp->ip_summed) 666 if (head->ip_summed != fp->ip_summed)
667 head->ip_summed = CHECKSUM_NONE; 667 head->ip_summed = CHECKSUM_NONE;
668 else if (head->ip_summed == CHECKSUM_HW) 668 else if (head->ip_summed == CHECKSUM_COMPLETE)
669 head->csum = csum_add(head->csum, fp->csum); 669 head->csum = csum_add(head->csum, fp->csum);
670 head->truesize += fp->truesize; 670 head->truesize += fp->truesize;
671 atomic_sub(fp->truesize, &ip_frag_mem); 671 atomic_sub(fp->truesize, &ip_frag_mem);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 0f9b3a31997b..e66f6ff2e198 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -576,7 +576,7 @@ static int ipgre_rcv(struct sk_buff *skb)
576 576
577 if (flags&GRE_CSUM) { 577 if (flags&GRE_CSUM) {
578 switch (skb->ip_summed) { 578 switch (skb->ip_summed) {
579 case CHECKSUM_HW: 579 case CHECKSUM_COMPLETE:
580 csum = (u16)csum_fold(skb->csum); 580 csum = (u16)csum_fold(skb->csum);
581 if (!csum) 581 if (!csum)
582 break; 582 break;
@@ -584,7 +584,7 @@ static int ipgre_rcv(struct sk_buff *skb)
584 case CHECKSUM_NONE: 584 case CHECKSUM_NONE:
585 skb->csum = 0; 585 skb->csum = 0;
586 csum = __skb_checksum_complete(skb); 586 csum = __skb_checksum_complete(skb);
587 skb->ip_summed = CHECKSUM_HW; 587 skb->ip_summed = CHECKSUM_COMPLETE;
588 } 588 }
589 offset += 4; 589 offset += 4;
590 } 590 }
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 308bdeac3455..1b9b6742ef77 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -680,7 +680,7 @@ ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk
680{ 680{
681 struct iovec *iov = from; 681 struct iovec *iov = from;
682 682
683 if (skb->ip_summed == CHECKSUM_HW) { 683 if (skb->ip_summed == CHECKSUM_PARTIAL) {
684 if (memcpy_fromiovecend(to, iov, offset, len) < 0) 684 if (memcpy_fromiovecend(to, iov, offset, len) < 0)
685 return -EFAULT; 685 return -EFAULT;
686 } else { 686 } else {
@@ -736,7 +736,7 @@ static inline int ip_ufo_append_data(struct sock *sk,
736 /* initialize protocol header pointer */ 736 /* initialize protocol header pointer */
737 skb->h.raw = skb->data + fragheaderlen; 737 skb->h.raw = skb->data + fragheaderlen;
738 738
739 skb->ip_summed = CHECKSUM_HW; 739 skb->ip_summed = CHECKSUM_PARTIAL;
740 skb->csum = 0; 740 skb->csum = 0;
741 sk->sk_sndmsg_off = 0; 741 sk->sk_sndmsg_off = 0;
742 } 742 }
@@ -844,7 +844,7 @@ int ip_append_data(struct sock *sk,
844 length + fragheaderlen <= mtu && 844 length + fragheaderlen <= mtu &&
845 rt->u.dst.dev->features & NETIF_F_ALL_CSUM && 845 rt->u.dst.dev->features & NETIF_F_ALL_CSUM &&
846 !exthdrlen) 846 !exthdrlen)
847 csummode = CHECKSUM_HW; 847 csummode = CHECKSUM_PARTIAL;
848 848
849 inet->cork.length += length; 849 inet->cork.length += length;
850 if (((length > mtu) && (sk->sk_protocol == IPPROTO_UDP)) && 850 if (((length > mtu) && (sk->sk_protocol == IPPROTO_UDP)) &&
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c
index bc28b1160a3a..820e8318d10d 100644
--- a/net/ipv4/ipvs/ip_vs_proto_tcp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c
@@ -151,7 +151,7 @@ tcp_snat_handler(struct sk_buff **pskb,
151 /* Only port and addr are changed, do fast csum update */ 151 /* Only port and addr are changed, do fast csum update */
152 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr, 152 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr,
153 cp->dport, cp->vport); 153 cp->dport, cp->vport);
154 if ((*pskb)->ip_summed == CHECKSUM_HW) 154 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE)
155 (*pskb)->ip_summed = CHECKSUM_NONE; 155 (*pskb)->ip_summed = CHECKSUM_NONE;
156 } else { 156 } else {
157 /* full checksum calculation */ 157 /* full checksum calculation */
@@ -204,7 +204,7 @@ tcp_dnat_handler(struct sk_buff **pskb,
204 /* Only port and addr are changed, do fast csum update */ 204 /* Only port and addr are changed, do fast csum update */
205 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr, 205 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr,
206 cp->vport, cp->dport); 206 cp->vport, cp->dport);
207 if ((*pskb)->ip_summed == CHECKSUM_HW) 207 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE)
208 (*pskb)->ip_summed = CHECKSUM_NONE; 208 (*pskb)->ip_summed = CHECKSUM_NONE;
209 } else { 209 } else {
210 /* full checksum calculation */ 210 /* full checksum calculation */
@@ -229,7 +229,7 @@ tcp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
229 switch (skb->ip_summed) { 229 switch (skb->ip_summed) {
230 case CHECKSUM_NONE: 230 case CHECKSUM_NONE:
231 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0); 231 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
232 case CHECKSUM_HW: 232 case CHECKSUM_COMPLETE:
233 if (csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr, 233 if (csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr,
234 skb->len - tcphoff, 234 skb->len - tcphoff,
235 skb->nh.iph->protocol, skb->csum)) { 235 skb->nh.iph->protocol, skb->csum)) {
@@ -239,7 +239,7 @@ tcp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
239 } 239 }
240 break; 240 break;
241 default: 241 default:
242 /* CHECKSUM_UNNECESSARY */ 242 /* No need to checksum. */
243 break; 243 break;
244 } 244 }
245 245
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c
index 89d9175d8f28..90c8166c0ec1 100644
--- a/net/ipv4/ipvs/ip_vs_proto_udp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_udp.c
@@ -161,7 +161,7 @@ udp_snat_handler(struct sk_buff **pskb,
161 /* Only port and addr are changed, do fast csum update */ 161 /* Only port and addr are changed, do fast csum update */
162 udp_fast_csum_update(udph, cp->daddr, cp->vaddr, 162 udp_fast_csum_update(udph, cp->daddr, cp->vaddr,
163 cp->dport, cp->vport); 163 cp->dport, cp->vport);
164 if ((*pskb)->ip_summed == CHECKSUM_HW) 164 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE)
165 (*pskb)->ip_summed = CHECKSUM_NONE; 165 (*pskb)->ip_summed = CHECKSUM_NONE;
166 } else { 166 } else {
167 /* full checksum calculation */ 167 /* full checksum calculation */
@@ -216,7 +216,7 @@ udp_dnat_handler(struct sk_buff **pskb,
216 /* Only port and addr are changed, do fast csum update */ 216 /* Only port and addr are changed, do fast csum update */
217 udp_fast_csum_update(udph, cp->vaddr, cp->daddr, 217 udp_fast_csum_update(udph, cp->vaddr, cp->daddr,
218 cp->vport, cp->dport); 218 cp->vport, cp->dport);
219 if ((*pskb)->ip_summed == CHECKSUM_HW) 219 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE)
220 (*pskb)->ip_summed = CHECKSUM_NONE; 220 (*pskb)->ip_summed = CHECKSUM_NONE;
221 } else { 221 } else {
222 /* full checksum calculation */ 222 /* full checksum calculation */
@@ -250,7 +250,7 @@ udp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
250 case CHECKSUM_NONE: 250 case CHECKSUM_NONE:
251 skb->csum = skb_checksum(skb, udphoff, 251 skb->csum = skb_checksum(skb, udphoff,
252 skb->len - udphoff, 0); 252 skb->len - udphoff, 0);
253 case CHECKSUM_HW: 253 case CHECKSUM_COMPLETE:
254 if (csum_tcpudp_magic(skb->nh.iph->saddr, 254 if (csum_tcpudp_magic(skb->nh.iph->saddr,
255 skb->nh.iph->daddr, 255 skb->nh.iph->daddr,
256 skb->len - udphoff, 256 skb->len - udphoff,
@@ -262,7 +262,7 @@ udp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
262 } 262 }
263 break; 263 break;
264 default: 264 default:
265 /* CHECKSUM_UNNECESSARY */ 265 /* No need to checksum. */
266 break; 266 break;
267 } 267 }
268 } 268 }
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 6a9e34b794bc..f88347de21a9 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -168,7 +168,7 @@ unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
168 unsigned int csum = 0; 168 unsigned int csum = 0;
169 169
170 switch (skb->ip_summed) { 170 switch (skb->ip_summed) {
171 case CHECKSUM_HW: 171 case CHECKSUM_COMPLETE:
172 if (hook != NF_IP_PRE_ROUTING && hook != NF_IP_LOCAL_IN) 172 if (hook != NF_IP_PRE_ROUTING && hook != NF_IP_LOCAL_IN)
173 break; 173 break;
174 if ((protocol == 0 && !(u16)csum_fold(skb->csum)) || 174 if ((protocol == 0 && !(u16)csum_fold(skb->csum)) ||
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index fb920e76ec10..9de81ff645d5 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -865,8 +865,7 @@ static int tcp_error(struct sk_buff *skb,
865 865
866 /* Checksum invalid? Ignore. 866 /* Checksum invalid? Ignore.
867 * We skip checking packets on the outgoing path 867 * We skip checking packets on the outgoing path
868 * because the semantic of CHECKSUM_HW is different there 868 * because it is assumed to be correct.
869 * and moreover root might send raw packets.
870 */ 869 */
871 /* FIXME: Source route IP option packets --RR */ 870 /* FIXME: Source route IP option packets --RR */
872 if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && 871 if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
index 9b2c16b4d2ff..e58e52f14553 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
@@ -117,8 +117,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
117 117
118 /* Checksum invalid? Ignore. 118 /* Checksum invalid? Ignore.
119 * We skip checking packets on the outgoing path 119 * We skip checking packets on the outgoing path
120 * because the semantic of CHECKSUM_HW is different there 120 * because the checksum is assumed to be correct.
121 * and moreover root might send raw packets.
122 * FIXME: Source route IP option packets --RR */ 121 * FIXME: Source route IP option packets --RR */
123 if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && 122 if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
124 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) { 123 nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) {
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 17de077a7901..f4f00c816d87 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -111,8 +111,9 @@ ip_nat_fn(unsigned int hooknum,
111 & htons(IP_MF|IP_OFFSET))); 111 & htons(IP_MF|IP_OFFSET)));
112 112
113 /* If we had a hardware checksum before, it's now invalid */ 113 /* If we had a hardware checksum before, it's now invalid */
114 if ((*pskb)->ip_summed == CHECKSUM_HW) 114 if ((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
115 if (skb_checksum_help(*pskb, (out == NULL))) 115 (*pskb)->ip_summed == CHECKSUM_COMPLETE)
116 if (skb_checksum_help(*pskb))
116 return NF_DROP; 117 return NF_DROP;
117 118
118 ct = ip_conntrack_get(*pskb, &ctinfo); 119 ct = ip_conntrack_get(*pskb, &ctinfo);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 198ac36db861..276a964ee6cf 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -208,9 +208,9 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
208 break; 208 break;
209 209
210 case IPQ_COPY_PACKET: 210 case IPQ_COPY_PACKET:
211 if (entry->skb->ip_summed == CHECKSUM_HW && 211 if ((entry->skb->ip_summed == CHECKSUM_PARTIAL ||
212 (*errp = skb_checksum_help(entry->skb, 212 entry->skb->ip_summed == CHECKSUM_COMPLETE) &&
213 entry->info->outdev == NULL))) { 213 (*errp = skb_checksum_help(entry->skb))) {
214 read_unlock_bh(&queue_lock); 214 read_unlock_bh(&queue_lock);
215 return NULL; 215 return NULL;
216 } 216 }
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c
index 4adf5c9d34f5..4ec43f98fe49 100644
--- a/net/ipv4/netfilter/ipt_ECN.c
+++ b/net/ipv4/netfilter/ipt_ECN.c
@@ -49,7 +49,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
49 49
50/* Return 0 if there was an error. */ 50/* Return 0 if there was an error. */
51static inline int 51static inline int
52set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward) 52set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
53{ 53{
54 struct tcphdr _tcph, *tcph; 54 struct tcphdr _tcph, *tcph;
55 u_int16_t diffs[2]; 55 u_int16_t diffs[2];
@@ -70,8 +70,9 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
70 return 0; 70 return 0;
71 tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; 71 tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4;
72 72
73 if ((*pskb)->ip_summed == CHECKSUM_HW && 73 if (((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
74 skb_checksum_help(*pskb, inward)) 74 (*pskb)->ip_summed == CHECKSUM_COMPLETE) &&
75 skb_checksum_help(*pskb))
75 return 0; 76 return 0;
76 77
77 diffs[0] = ((u_int16_t *)tcph)[6]; 78 diffs[0] = ((u_int16_t *)tcph)[6];
@@ -106,7 +107,7 @@ target(struct sk_buff **pskb,
106 107
107 if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) 108 if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR)
108 && (*pskb)->nh.iph->protocol == IPPROTO_TCP) 109 && (*pskb)->nh.iph->protocol == IPPROTO_TCP)
109 if (!set_ect_tcp(pskb, einfo, (out == NULL))) 110 if (!set_ect_tcp(pskb, einfo))
110 return NF_DROP; 111 return NF_DROP;
111 112
112 return IPT_CONTINUE; 113 return IPT_CONTINUE;
diff --git a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c
index ef2fe5b3f0d8..c998dc0fcd15 100644
--- a/net/ipv4/netfilter/ipt_TCPMSS.c
+++ b/net/ipv4/netfilter/ipt_TCPMSS.c
@@ -62,8 +62,9 @@ ipt_tcpmss_target(struct sk_buff **pskb,
62 if (!skb_make_writable(pskb, (*pskb)->len)) 62 if (!skb_make_writable(pskb, (*pskb)->len))
63 return NF_DROP; 63 return NF_DROP;
64 64
65 if ((*pskb)->ip_summed == CHECKSUM_HW && 65 if (((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
66 skb_checksum_help(*pskb, out == NULL)) 66 (*pskb)->ip_summed == CHECKSUM_COMPLETE) &&
67 skb_checksum_help(*pskb))
67 return NF_DROP; 68 return NF_DROP;
68 69
69 iph = (*pskb)->nh.iph; 70 iph = (*pskb)->nh.iph;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 934396bb1376..b0124e69ab38 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -568,7 +568,7 @@ new_segment:
568 skb->truesize += copy; 568 skb->truesize += copy;
569 sk->sk_wmem_queued += copy; 569 sk->sk_wmem_queued += copy;
570 sk->sk_forward_alloc -= copy; 570 sk->sk_forward_alloc -= copy;
571 skb->ip_summed = CHECKSUM_HW; 571 skb->ip_summed = CHECKSUM_PARTIAL;
572 tp->write_seq += copy; 572 tp->write_seq += copy;
573 TCP_SKB_CB(skb)->end_seq += copy; 573 TCP_SKB_CB(skb)->end_seq += copy;
574 skb_shinfo(skb)->gso_segs = 0; 574 skb_shinfo(skb)->gso_segs = 0;
@@ -723,7 +723,7 @@ new_segment:
723 * Check whether we can use HW checksum. 723 * Check whether we can use HW checksum.
724 */ 724 */
725 if (sk->sk_route_caps & NETIF_F_ALL_CSUM) 725 if (sk->sk_route_caps & NETIF_F_ALL_CSUM)
726 skb->ip_summed = CHECKSUM_HW; 726 skb->ip_summed = CHECKSUM_PARTIAL;
727 727
728 skb_entail(sk, tp, skb); 728 skb_entail(sk, tp, skb);
729 copy = size_goal; 729 copy = size_goal;
@@ -2205,7 +2205,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2205 th->fin = th->psh = 0; 2205 th->fin = th->psh = 0;
2206 2206
2207 th->check = ~csum_fold(th->check + delta); 2207 th->check = ~csum_fold(th->check + delta);
2208 if (skb->ip_summed != CHECKSUM_HW) 2208 if (skb->ip_summed != CHECKSUM_PARTIAL)
2209 th->check = csum_fold(csum_partial(skb->h.raw, thlen, 2209 th->check = csum_fold(csum_partial(skb->h.raw, thlen,
2210 skb->csum)); 2210 skb->csum));
2211 2211
@@ -2219,7 +2219,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2219 2219
2220 delta = htonl(oldlen + (skb->tail - skb->h.raw) + skb->data_len); 2220 delta = htonl(oldlen + (skb->tail - skb->h.raw) + skb->data_len);
2221 th->check = ~csum_fold(th->check + delta); 2221 th->check = ~csum_fold(th->check + delta);
2222 if (skb->ip_summed != CHECKSUM_HW) 2222 if (skb->ip_summed != CHECKSUM_PARTIAL)
2223 th->check = csum_fold(csum_partial(skb->h.raw, thlen, 2223 th->check = csum_fold(csum_partial(skb->h.raw, thlen,
2224 skb->csum)); 2224 skb->csum));
2225 2225
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 43f6740244f8..b2aa512a30e9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -484,7 +484,7 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
484 struct inet_sock *inet = inet_sk(sk); 484 struct inet_sock *inet = inet_sk(sk);
485 struct tcphdr *th = skb->h.th; 485 struct tcphdr *th = skb->h.th;
486 486
487 if (skb->ip_summed == CHECKSUM_HW) { 487 if (skb->ip_summed == CHECKSUM_PARTIAL) {
488 th->check = ~tcp_v4_check(th, len, inet->saddr, inet->daddr, 0); 488 th->check = ~tcp_v4_check(th, len, inet->saddr, inet->daddr, 0);
489 skb->csum = offsetof(struct tcphdr, check); 489 skb->csum = offsetof(struct tcphdr, check);
490 } else { 490 } else {
@@ -509,7 +509,7 @@ int tcp_v4_gso_send_check(struct sk_buff *skb)
509 th->check = 0; 509 th->check = 0;
510 th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0); 510 th->check = ~tcp_v4_check(th, skb->len, iph->saddr, iph->daddr, 0);
511 skb->csum = offsetof(struct tcphdr, check); 511 skb->csum = offsetof(struct tcphdr, check);
512 skb->ip_summed = CHECKSUM_HW; 512 skb->ip_summed = CHECKSUM_PARTIAL;
513 return 0; 513 return 0;
514} 514}
515 515
@@ -973,7 +973,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
973 973
974static int tcp_v4_checksum_init(struct sk_buff *skb) 974static int tcp_v4_checksum_init(struct sk_buff *skb)
975{ 975{
976 if (skb->ip_summed == CHECKSUM_HW) { 976 if (skb->ip_summed == CHECKSUM_COMPLETE) {
977 if (!tcp_v4_check(skb->h.th, skb->len, skb->nh.iph->saddr, 977 if (!tcp_v4_check(skb->h.th, skb->len, skb->nh.iph->saddr,
978 skb->nh.iph->daddr, skb->csum)) { 978 skb->nh.iph->daddr, skb->csum)) {
979 skb->ip_summed = CHECKSUM_UNNECESSARY; 979 skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b4f3ffe1b3b4..9252a50c4b49 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -577,7 +577,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
577 TCP_SKB_CB(buff)->sacked = TCP_SKB_CB(skb)->sacked; 577 TCP_SKB_CB(buff)->sacked = TCP_SKB_CB(skb)->sacked;
578 TCP_SKB_CB(skb)->sacked &= ~TCPCB_AT_TAIL; 578 TCP_SKB_CB(skb)->sacked &= ~TCPCB_AT_TAIL;
579 579
580 if (!skb_shinfo(skb)->nr_frags && skb->ip_summed != CHECKSUM_HW) { 580 if (!skb_shinfo(skb)->nr_frags && skb->ip_summed != CHECKSUM_PARTIAL) {
581 /* Copy and checksum data tail into the new buffer. */ 581 /* Copy and checksum data tail into the new buffer. */
582 buff->csum = csum_partial_copy_nocheck(skb->data + len, skb_put(buff, nsize), 582 buff->csum = csum_partial_copy_nocheck(skb->data + len, skb_put(buff, nsize),
583 nsize, 0); 583 nsize, 0);
@@ -586,7 +586,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
586 586
587 skb->csum = csum_block_sub(skb->csum, buff->csum, len); 587 skb->csum = csum_block_sub(skb->csum, buff->csum, len);
588 } else { 588 } else {
589 skb->ip_summed = CHECKSUM_HW; 589 skb->ip_summed = CHECKSUM_PARTIAL;
590 skb_split(skb, buff, len); 590 skb_split(skb, buff, len);
591 } 591 }
592 592
@@ -689,7 +689,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
689 __pskb_trim_head(skb, len - skb_headlen(skb)); 689 __pskb_trim_head(skb, len - skb_headlen(skb));
690 690
691 TCP_SKB_CB(skb)->seq += len; 691 TCP_SKB_CB(skb)->seq += len;
692 skb->ip_summed = CHECKSUM_HW; 692 skb->ip_summed = CHECKSUM_PARTIAL;
693 693
694 skb->truesize -= len; 694 skb->truesize -= len;
695 sk->sk_wmem_queued -= len; 695 sk->sk_wmem_queued -= len;
@@ -1062,7 +1062,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
1062 /* This packet was never sent out yet, so no SACK bits. */ 1062 /* This packet was never sent out yet, so no SACK bits. */
1063 TCP_SKB_CB(buff)->sacked = 0; 1063 TCP_SKB_CB(buff)->sacked = 0;
1064 1064
1065 buff->ip_summed = skb->ip_summed = CHECKSUM_HW; 1065 buff->ip_summed = skb->ip_summed = CHECKSUM_PARTIAL;
1066 skb_split(skb, buff, len); 1066 skb_split(skb, buff, len);
1067 1067
1068 /* Fix up tso_factor for both original and new SKB. */ 1068 /* Fix up tso_factor for both original and new SKB. */
@@ -1206,8 +1206,7 @@ static int tcp_mtu_probe(struct sock *sk)
1206 TCP_SKB_CB(nskb)->flags = TCPCB_FLAG_ACK; 1206 TCP_SKB_CB(nskb)->flags = TCPCB_FLAG_ACK;
1207 TCP_SKB_CB(nskb)->sacked = 0; 1207 TCP_SKB_CB(nskb)->sacked = 0;
1208 nskb->csum = 0; 1208 nskb->csum = 0;
1209 if (skb->ip_summed == CHECKSUM_HW) 1209 nskb->ip_summed = skb->ip_summed;
1210 nskb->ip_summed = CHECKSUM_HW;
1211 1210
1212 len = 0; 1211 len = 0;
1213 while (len < probe_size) { 1212 while (len < probe_size) {
@@ -1231,7 +1230,7 @@ static int tcp_mtu_probe(struct sock *sk)
1231 ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH); 1230 ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH);
1232 if (!skb_shinfo(skb)->nr_frags) { 1231 if (!skb_shinfo(skb)->nr_frags) {
1233 skb_pull(skb, copy); 1232 skb_pull(skb, copy);
1234 if (skb->ip_summed != CHECKSUM_HW) 1233 if (skb->ip_summed != CHECKSUM_PARTIAL)
1235 skb->csum = csum_partial(skb->data, skb->len, 0); 1234 skb->csum = csum_partial(skb->data, skb->len, 0);
1236 } else { 1235 } else {
1237 __pskb_trim_head(skb, copy); 1236 __pskb_trim_head(skb, copy);
@@ -1572,10 +1571,9 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1572 1571
1573 memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); 1572 memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size);
1574 1573
1575 if (next_skb->ip_summed == CHECKSUM_HW) 1574 skb->ip_summed = next_skb->ip_summed;
1576 skb->ip_summed = CHECKSUM_HW;
1577 1575
1578 if (skb->ip_summed != CHECKSUM_HW) 1576 if (skb->ip_summed != CHECKSUM_PARTIAL)
1579 skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); 1577 skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size);
1580 1578
1581 /* Update sequence range on original skb. */ 1579 /* Update sequence range on original skb. */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index a4d005eccc7f..87152510980c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -429,7 +429,7 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_sock *up)
429 /* 429 /*
430 * Only one fragment on the socket. 430 * Only one fragment on the socket.
431 */ 431 */
432 if (skb->ip_summed == CHECKSUM_HW) { 432 if (skb->ip_summed == CHECKSUM_PARTIAL) {
433 skb->csum = offsetof(struct udphdr, check); 433 skb->csum = offsetof(struct udphdr, check);
434 uh->check = ~csum_tcpudp_magic(fl->fl4_src, fl->fl4_dst, 434 uh->check = ~csum_tcpudp_magic(fl->fl4_src, fl->fl4_dst,
435 up->len, IPPROTO_UDP, 0); 435 up->len, IPPROTO_UDP, 0);
@@ -448,7 +448,7 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_sock *up)
448 * fragments on the socket so that all csums of sk_buffs 448 * fragments on the socket so that all csums of sk_buffs
449 * should be together. 449 * should be together.
450 */ 450 */
451 if (skb->ip_summed == CHECKSUM_HW) { 451 if (skb->ip_summed == CHECKSUM_PARTIAL) {
452 int offset = (unsigned char *)uh - skb->data; 452 int offset = (unsigned char *)uh - skb->data;
453 skb->csum = skb_checksum(skb, offset, skb->len - offset, 0); 453 skb->csum = skb_checksum(skb, offset, skb->len - offset, 0);
454 454
@@ -1088,7 +1088,7 @@ static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh,
1088{ 1088{
1089 if (uh->check == 0) { 1089 if (uh->check == 0) {
1090 skb->ip_summed = CHECKSUM_UNNECESSARY; 1090 skb->ip_summed = CHECKSUM_UNNECESSARY;
1091 } else if (skb->ip_summed == CHECKSUM_HW) { 1091 } else if (skb->ip_summed == CHECKSUM_COMPLETE) {
1092 if (!udp_check(uh, ulen, saddr, daddr, skb->csum)) 1092 if (!udp_check(uh, ulen, saddr, daddr, skb->csum))
1093 skb->ip_summed = CHECKSUM_UNNECESSARY; 1093 skb->ip_summed = CHECKSUM_UNNECESSARY;
1094 } 1094 }
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index d16f863cf687..4a96a9e3ef3b 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -48,8 +48,8 @@ static int xfrm4_output_one(struct sk_buff *skb)
48 struct xfrm_state *x = dst->xfrm; 48 struct xfrm_state *x = dst->xfrm;
49 int err; 49 int err;
50 50
51 if (skb->ip_summed == CHECKSUM_HW) { 51 if (skb->ip_summed == CHECKSUM_PARTIAL) {
52 err = skb_checksum_help(skb, 0); 52 err = skb_checksum_help(skb);
53 if (err) 53 if (err)
54 goto error_nolock; 54 goto error_nolock;
55 } 55 }