2014-01-11, José Vázquez Fernández <[email protected]>: > While Daniel González and me were fighting with jffs2 tested some code > extracted from Netgear. Here are what we found. > We only tested brcm_wait, broadcom checksum code and the modification in > tlbex.c and nothing strange happened when we flashed it. > Hope this could help for the Broadcom SoCs and maybe others. > > > diff -urN b/include/asm-mips/checksum.h a/include/asm-mips/checksum.h > --- b/include/asm-mips/checksum.h 2007-06-12 16:13:11.000000000 +0200 > +++ a/include/asm-mips/checksum.h 2010-05-31 03:43:32.000000000 +0200 > @@ -98,6 +98,64 @@ > * By Jorge Cwik <[email protected]>, adapted for linux by > * Arnt Gulbrandsen. > */ > + > +#if defined(CONFIG_MIPS_BRCM) > + > +/* Brcm version can handle unaligned data. Merged from brcm 2.6.8 > kernel.*/ > +static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) > +{ > + if (((__u32)iph&0x3) == 0) { > + unsigned int *word = (unsigned int *) iph; > + unsigned int *stop = word + ihl; > + unsigned int csum; > + int carry; > + > + csum = word[0]; > + csum += word[1]; > + carry = (csum < word[1]); > + csum += carry; > + > + csum += word[2]; > + carry = (csum < word[2]); > + csum += carry; > + > + csum += word[3]; > + carry = (csum < word[3]); > + csum += carry; > + > + word += 4; > + do { > + csum += *word; > + carry = (csum < *word); > + csum += carry; > + word++; > + } while (word != stop); > + > + return csum_fold(csum); > + } else { > + __u16 * buff = (__u16 *) iph; > + __u32 sum=0; > + __u16 i; > + > + // make 16 bit words out of every two adjacent 8 bit words in > the packet > + // and add them up > + for (i=0;i<ihl*2;i++){ > + sum = sum + (__u32) buff[i]; > + } > + > + // take only 16 bits out of the 32 bit sum and add up the > carries > + while (sum>>16) > + sum = (sum & 0xFFFF)+(sum >> 16); > + > + // one's complement the result > + sum = ~sum; > + > + return ((__sum16) sum); > + } > +} > + > +#else > + > static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) > { > const unsigned int *word = iph;
I've tested the above code and the network throughput improved between 0'5 to 1% while running rsync with cifs and a 500 GB usb hdd with a BCM63281 based board. _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
