aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/include/in_cksum.h
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 2ff63af9b88c)
* x86: Remove silly checks for <sys/cdefs.h>.John Baldwin2022-05-131-4/+0
| | | | | | | | | | | | | | These headers #include <sys/cdefs.h> right after checking if it has already been #included. The nested #include already existed when the check for _SYS_CDEFS_H_ was added, so the check shouldn't have been added in the first place. PR: 263102 (exp-run) Reported by: brooks Reviewed by: brooks, imp, emaste Differential Revision: https://reviews.freebsd.org/D34796 (cherry picked from commit 1c1bf5bd7c1e479a7889839b941f53e689aa2569)
* Drop an OBE MP safe comment.John Baldwin2022-05-131-4/+0
| | | | (cherry picked from commit a7eb8afe9a8b9ac3a61e819e3940ad16a84b63a0)
* netinet: Deduplicate most in_cksum() implementationsMark Johnston2021-12-011-0/+3
| | | | | | | | | | | | | | | | | | | in_cksum() and related routines are implemented separately for each platform, but only i386 and arm have optimized versions. Other platforms' copies of in_cksum.c are identical except for style differences and support for big-endian CPUs. Deduplicate the implementations for the rest of the platforms. This will make it easier to implement in_cksum() for unmapped mbufs. On arm and i386, define HAVE_MD_IN_CKSUM to mean that the MI implementation is not to be compiled. No functional change intended. Reviewed by: kp, glebius Sponsored by: The FreeBSD Foundation (cherry picked from commit ecbbe831445a4b94279e5932828d60076e4ca444)
* netinet: Remove in_cksum_update()Mark Johnston2021-12-011-19/+0
| | | | | | | | | | It was never implemented on powerpc or riscv and appears to have been unused since it was added in 1998. No functional change intended. Reviewed by: kp, glebius, cy Sponsored by: The FreeBSD Foundation (cherry picked from commit 09100f936be0684aa8caef441b96345960fd9c72)
* Remove support for intel compiler from i386 in_cksumWarner Losh2020-10-241-2/+2
| | | | | | | | | | We no longer support building the kernel with the old intel compiler. Remove support for it from in_cksum. Should there be interest in reviving it, this is as likely to get in the way as to help anyway. Notes: svn path=/head/; revision=367031
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Rationalize BSD license on sys/*/include/in_cksum.hEd Maste2015-08-051-1/+1
| | | | | | | | | | Remove the advertising clause from the Regents of the University of California's license, per the letter dated July 22, 1999. Update clause numbering. Notes: svn path=/head/; revision=286336
* MFp4 bz_ipv6_fast:Bjoern A. Zeeb2012-05-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | in_cksum.h required ip.h to be included for struct ip. To be able to use some general checksum functions like in_addword() in a non-IPv4 context, limit the (also exported to user space) IPv4 specific functions to the times, when the ip.h header is present and IPVERSION is defined (to 4). We should consider more general checksum (updating) functions to also allow easier incremental checksum updates in the L3/4 stack and firewalls, as well as ponder further requirements by certain NIC drivers needing slightly different pseudo values in offloading cases. Thinking in terms of a better "library". Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Reviewed by: gnn (as part of the whole) MFC After: 3 days Notes: svn path=/head/; revision=235941
* Clobber "cc" instead of using volatile; remove obsolete register keyword.Ed Schouten2009-06-131-7/+8
| | | | | | | Submitted by: Christoph Mallon Notes: svn path=/head/; revision=194111
* Fold multiple asm statements into one so that the compiler at a certainBjoern A. Zeeb2007-10-201-7/+14
| | | | | | | | | | | | | | | | | | optimization level (-march=pentium-mmx for example) does not insert intermediate ops which would trash the carry. Change both sys/i386/i386/in_cksum.c[1] and sys/i386/include/in_cksum.h. To my best understanding the same problem was addressed in rev. 1.16 of src/sys/i386/include/in_cksum.h for just a single function 3y ago. Reviewed by: jhb Submitted by: Zhouyi ZHOU <zhouzhouyi FreeBSD.org> (intial version of [1]) MFC after: 5 days PR: 115678, 69257 Notes: svn path=/head/; revision=172835
* netchild's mega-patch to isolate compiler dependencies into a centralJoerg Wunsch2005-03-021-2/+6
| | | | | | | | | | | | | | | | | | | place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago Notes: svn path=/head/; revision=143063
* Fix a bug in in_cksum_hdr w/o -O.David E. O'Brien2004-08-251-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C code assumes that the carry bit is always kept from the previous operation. However, the pointer indexing requires another add operation. Thus, the carry bit from the first operation is tromped over by the "addl" operation that ends up following it, so the "adcl" that follows that has no effect because the carry bit is cleared before it. The result is checksum failure on received packets. The larger issue is that there isn't any other way of preventing the compiler inserting arbitrary instructions between different __asm statements (and that the commit message in revision 1.13 of in_cksum.h is wrong on this point). From http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/Extended-Asm.html ---8<---8<---8<--- You can't expect a sequence of volatile asm instructions to remain perfectly consecutive. If you want consecutive output, use a single asm. Also, GCC will perform some optimizations across a volatile asm instruction; GCC does not "forget everything" when it encounters a volatile asm instruction the way some other compilers do. ---8<---8<---8<--- Also, this change also makes the ASM code much easier to read. PR: 69257 Submitted by: Mike Bristow <mike@urgle.com>, Qing Li <qing.li@bluecoat.com> Notes: svn path=/head/; revision=134300
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-071-4/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)Tom Rhodes2004-03-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to build the kernel. It doesn't affect the operation if gcc. Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as icc v8 may define __GNUC__ some parts may look strange but are necessary. Additional changes: - in_cksum.[ch]: * use a generic C version instead of the assembly version in the !gcc case (ASM code breaks with the optimizations icc does) -> no bad checksums with an icc compiled kernel Help from: andre, grehan, das Stolen from: alpha version via ppc version The entire checksum code should IMHO be replaced with the DragonFly version (because it isn't guaranteed future revisions of gcc will include similar optimizations) as in: ---snip--- Revision Changes Path 1.12 +1 -0 src/sys/conf/files.i386 1.4 +142 -558 src/sys/i386/i386/in_cksum.c 1.5 +33 -69 src/sys/i386/include/in_cksum.h 1.5 +2 -0 src/sys/netinet/igmp.c 1.6 +0 -1 src/sys/netinet/in.h 1.6 +2 -0 src/sys/netinet/ip_icmp.c 1.4 +3 -4 src/contrib/ipfilter/ip_compat.h 1.3 +1 -2 src/sbin/natd/icmp.c 1.4 +0 -1 src/sbin/natd/natd.c 1.48 +1 -0 src/sys/conf/files 1.2 +0 -1 src/sys/conf/files.amd64 1.13 +0 -1 src/sys/conf/files.i386 1.5 +0 -1 src/sys/conf/files.pc98 1.7 +1 -1 src/sys/contrib/ipfilter/netinet/fil.c 1.10 +2 -3 src/sys/contrib/ipfilter/netinet/ip_compat.h 1.10 +1 -1 src/sys/contrib/ipfilter/netinet/ip_fil.c 1.7 +1 -1 src/sys/dev/netif/txp/if_txp.c 1.7 +1 -1 src/sys/net/ip_mroute/ip_mroute.c 1.7 +1 -2 src/sys/net/ipfw/ip_fw2.c 1.6 +1 -2 src/sys/netinet/igmp.c 1.4 +158 -116 src/sys/netinet/in_cksum.c 1.6 +1 -1 src/sys/netinet/ip_gre.c 1.7 +1 -2 src/sys/netinet/ip_icmp.c 1.10 +1 -1 src/sys/netinet/ip_input.c 1.10 +1 -2 src/sys/netinet/ip_output.c 1.13 +1 -2 src/sys/netinet/tcp_input.c 1.9 +1 -2 src/sys/netinet/tcp_output.c 1.10 +1 -1 src/sys/netinet/tcp_subr.c 1.10 +1 -1 src/sys/netinet/tcp_syncache.c 1.9 +1 -2 src/sys/netinet/udp_usrreq.c 1.5 +1 -2 src/sys/netinet6/ipsec.c 1.5 +1 -2 src/sys/netproto/ipsec/ipsec.c 1.5 +1 -1 src/sys/netproto/ipsec/ipsec_input.c 1.4 +1 -2 src/sys/netproto/ipsec/ipsec_output.c and finally remove sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h ---snip--- - endian.h: * DTRT in C++ mode - quad.h: * we don't use gcc v1 anymore, remove support for it Suggested by: bde (long ago) - assym.h: * avoid zero-length arrays (remove dependency on a gcc specific feature) This change changes the contents of the object file, but as it's only used to generate some values for a header, and the generator knows how to handle this, there's no impact in the gcc case. Explained by: bde Submitted by: Marius Strobl <marius@alchemy.franken.de> - aicasm.c: * minor change to teach it about the way icc spells "-nostdinc" Not approved by: gibbs (no reply to my mail) - bump __FreeBSD_version (lang/icc needs to know about the changes) Incarnations of this patch survive gcc compiles since a loooong time, I use it on my desktop. An icc compiled kernel works since Nov. 2003 (exceptions: snd_* if used as modules), it survives a build of the entire ports collection with icc. Parts of this commit contains suggestions or submissions from Marius Strobl <marius@alchemy.franken.de>. Reviewed by: -arch Submitted by: netchild Notes: svn path=/head/; revision=126891
* Fix several bugs in the i386 asm statements used to speed up InternetJohn Polstra2002-06-221-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | checksumming. These bugs could possibly cause bad code to be generated at elevated optimization levels. First, eliminate the use of preprocessor magic to form the address fields of asm instructions. It hid the actual addresses being referenced from the compiler. Without knowledge of all the data dependencies, the compiler might possibly use optimizations which would result in incorrect code. Use "__asm __volatile" rather than "__asm" for instruction sequences that pass information through the condition codes (the carry bit, in this case). Without __volatile, the compiler might add unrelated code between consecutive __asm instructions, modifying the condition codes. I have seen GCC insert stack pointer adjustments in this way, for example. Unfortunately, GCC doesn't provide a way to specify dependencies on the condition codes. You can specify that they are clobbered, but not that you are going to use them as input. Finally, simplify the LOAD macro. This macro is used as a poor man's prefetch. The simpler version gives the compiler more leeway about just how it performs the prefetch. MFC after: 1 week Notes: svn path=/head/; revision=98648
* Remove __P.Alfred Perlstein2002-03-201-1/+1
| | | | Notes: svn path=/head/; revision=92761
* Various assembly fixes mostly in the form of using the "+" modifier forJohn Baldwin2001-12-181-8/+8
| | | | | | | | | | output operands to mark them as both input and output rather than listing operands twice. Reviewed by: bde Notes: svn path=/head/; revision=88118
* These files are mpsafe.Alfred Perlstein2000-11-251-0/+4
| | | | Notes: svn path=/head/; revision=69133
* Make in_cksum() a macro call to in_cksum_skip(), since it provides theJonathan Lemon2000-05-061-3/+2
| | | | | | | | | | same functionality. Sharing code should help cache issues. Remove in_cksum_partial, since its not being used, and we now have a way to compute partial checksums on mbuf chains. Notes: svn path=/head/; revision=60104
* Add support for offloading IP/TCP/UDP checksums to NIC hardware whichJonathan Lemon2000-03-271-0/+25
| | | | | | | supports them. Notes: svn path=/head/; revision=58698
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-291-2/+2
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55205
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Fix all areas of the system (or at least all those in LINT) to avoid storingGarrett Wollman1997-08-161-1/+10
| | | | | | | | | | | socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family. Notes: svn path=/head/; revision=28270
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Add an incremental checksum update routine. Perhaps some i386 assemblyGarrett Wollman1996-05-231-1/+17
| | | | | | | | | guru out there can find a way to take advantage of little-endianness to make this computation more efficient. (I am certain that it can be done, but haven't managed to make it work myself.) Notes: svn path=/head/; revision=15884
* Add an inline function to compute the common-case IP header checksum.Garrett Wollman1996-04-181-0/+76
Notes: svn path=/head/; revision=15291