This patch undoes the git commits e3145f7943db03e3808e493555b28e7696e8f408 and 8bab0e983d5fc1ad53c34c0cc68a07d9339a7148, "Work-around for TCP/IP errors" diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile index f198de4..4951e67 100644 --- a/arch/ppc/lib/Makefile +++ b/arch/ppc/lib/Makefile @@ -8,7 +8,7 @@ O_TARGET := lib.o export-objs := dec_and_lock.o -obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o checksum_alt.o +obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o obj-$(CONFIG_SMP) += locks.o diff --git a/arch/ppc/lib/checksum_alt.c b/arch/ppc/lib/checksum_alt.c deleted file mode 100644 index 820cb28..0000000 --- a/arch/ppc/lib/checksum_alt.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * INET An implementation of the TCP/IP protocol suite for the LINUX - * operating system. INET is implemented using the BSD Socket - * interface as the means of communication with the user level. - * - * IP/TCP/UDP checksumming routines - * - * Authors: Jorge Cwik, - * Arnt Gulbrandsen, - * Tom May, - * Andreas Schwab, - * Lots of code moved from tcp.c and ip.c; see those files - * for more names. - * - * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: - * Fixed some nasty bugs, causing some horrible crashes. - * A: At some points, the sum (%0) was used as - * length-counter instead of the length counter - * (%1). Thanks to Roman Hodek for pointing this out. - * B: GCC seems to mess up if one uses too many - * data-registers to hold input values and one tries to - * specify d0 and d1 as scratch registers. Letting gcc choose these - * registers itself solves the problem. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access kills, so most - of the assembly has to go. */ - -static inline unsigned short from32to16(unsigned long x) -{ - /* add up 16-bit and 16-bit for 16+c bit */ - x = (x & 0xffff) + (x >> 16); - /* add up carry.. */ - x = (x & 0xffff) + (x >> 16); - return x; -} - -static unsigned long do_csum(const unsigned char * buff, int len) -{ - int odd, count; - unsigned long result = 0; - - if (len <= 0) - goto out; - odd = 1 & (unsigned long) buff; - if (odd) { - result = *buff; - len--; - buff++; - } - count = len >> 1; /* nr of 16-bit words.. */ - if (count) { - if (2 & (unsigned long) buff) { - result += *(unsigned short *) buff; - count--; - len -= 2; - buff += 2; - } - count >>= 1; /* nr of 32-bit words.. */ - if (count) { - unsigned long carry = 0; - do { - unsigned long w = *(unsigned long *) buff; - count--; - buff += 4; - result += carry; - result += w; - carry = (w > result); - } while (count); - result += carry; - result = (result & 0xffff) + (result >> 16); - } - if (len & 2) { - result += *(unsigned short *) buff; - buff += 2; - } - } - if (len & 1) - result += (*buff << 8); - result = from32to16(result); - if (odd) - result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); -out: - return result; -} - -/* - * computes the checksum of a memory block at buff, length len, - * and adds in "sum" (32-bit) - * - * returns a 32-bit number suitable for feeding into itself - * or csum_tcpudp_magic - * - * this function must be called with even lengths, except - * for the last fragment, which may be odd - * - * it's best to have buff aligned on a 32-bit boundary - */ -unsigned int csum_partial_alt(const unsigned char *buff, int len, unsigned int sum) -{ - unsigned int result = do_csum(buff, len); - - /* add in old sum, and carry.. */ - result += sum; - if(sum > result) - result += 1; - return result; -} diff --git a/include/net/tcp.h b/include/net/tcp.h index de9dad9..b584b85 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -24,8 +24,6 @@ /* Cancel timers, when they are not required. */ #undef TCP_CLEAR_TIMERS -#define CONFIG_TCP_CS_RECHECK 1 - #include #include #include diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2931ef0..b4cd6b7 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1129,82 +1129,6 @@ out: sock_put(sk); } -#ifdef CONFIG_TCP_CS_RECHECK /* Re-check the TCP header checksum */ -static u32 csum_tcpudp_nofold_alt(u32 saddr, - u32 daddr, - unsigned short len, - unsigned short proto, - unsigned int sum) -{ - unsigned long long s = sum; - - s += saddr; - s += daddr; - - s += (proto << 16) + ntohs(len); /*be*/ - /* s += (ntohs(len)<<16)+proto*256;*/ /*le*/ - s += (s >> 32); - - return (u32) s; -} - -static unsigned int csum_fold_alt(unsigned int sum) -{ - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return ~sum; -} - -static inline unsigned short int -csum_tcpudp_magic_alt(unsigned long saddr, unsigned long daddr, unsigned short len, - unsigned short proto, unsigned int sum) -{ - - return csum_fold_alt (csum_tcpudp_nofold_alt (saddr, daddr, len, proto, sum)); -} - -static u16 tcp_v4_check_alt(struct tcphdr *th, int len, - unsigned long saddr, unsigned long daddr, - unsigned long base) -{ - u16 ret; - - ret = csum_tcpudp_magic_alt(saddr,daddr,len,IPPROTO_TCP,base); - return ret; -} - -static void tcp_recheck_csum(struct tcphdr *th, int len, - unsigned long saddr, unsigned long daddr, - int len2, unsigned int sum) -{ - extern int do_recheck; - int savedcs, altcs; - - if (!do_recheck) - return; - - savedcs = th->check; - th->check = 0; - altcs = tcp_v4_check_alt(th, len, saddr, daddr, - csum_partial_alt((char *)th, len2, sum)); - if (altcs != savedcs) { - printk("%s: seq %d: csum mismatch: %#x, alt %#x\n", __FUNCTION__, - ntohl(th->seq), ntohs(savedcs), ntohs(altcs)); - th->check = altcs; - /* Check for memory corruption */ - __asm__("sync" ::: "memory"); - if (*(volatile ushort *)&(th->check) != altcs) { - printk("%s: in mem %#x (@%#x), in reg %#x ?\n", __FUNCTION__, - ntohs(th->check), &th->check, ntohs(altcs)); - } - } else { - printk("%s: seq %#x retransmit, csum %#x OK?\n", __FUNCTION__, - ntohl(th->seq), ntohs(savedcs)); - th->check = savedcs; - } -} -#endif - /* This routine computes an IPv4 TCP checksum. */ void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb) @@ -1215,9 +1139,6 @@ void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, } else { th->check = tcp_v4_check(th, len, sk->saddr, sk->daddr, csum_partial((char *)th, th->doff<<2, skb->csum)); -#ifdef CONFIG_TCP_CS_RECHECK - tcp_recheck_csum(th, len, sk->saddr, sk->daddr, th->doff<<2, skb->csum); -#endif } } diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a13b106..39c12d6 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -809,9 +809,6 @@ void tcp_simple_retransmit(struct sock *sk) * state updates are done by the caller. Returns non-zero if an * error occurred which prevented the send. */ -#ifdef CONFIG_TCP_CS_RECHECK -int do_recheck; -#endif int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); @@ -872,17 +869,9 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) */ TCP_SKB_CB(skb)->when = tcp_time_stamp; -#ifdef CONFIG_TCP_CS_RECHECK - do_recheck = 1; err = tcp_transmit_skb(sk, (skb_cloned(skb) ? pskb_copy(skb, GFP_ATOMIC): skb_clone(skb, GFP_ATOMIC))); - do_recheck = 0; -#else - err = tcp_transmit_skb(sk, (skb_cloned(skb) ? - pskb_copy(skb, GFP_ATOMIC): - skb_clone(skb, GFP_ATOMIC))); -#endif if (err == 0) { /* Update global TCP statistics. */