/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) * * Joern Rennecke <joern.rennecke@embecosm.com>: Jan 2012 * -Insn Scheduling improvements to csum core routines. * = csum_fold( ) largely derived from ARM version. * = ip_fast_cum( ) to have module scheduling * -gcc 4.4.x broke networking. Alias analysis needed to be primed. * worked around by adding memory clobber to ip_fast_csum( ) * * vineetg: May 2010 * -Rewrote ip_fast_cscum( ) and csum_fold( ) with fast inline asm
*/
/* * Fold a partial checksum * * The 2 swords comprising the 32bit sum are added, any carry to 16th bit * added back and final sword result inverted.
*/ staticinline __sum16 csum_fold(__wsum s)
{ unsignedint r = s << 16 | s >> 16; /* ror */
s = ~s;
s -= r; return s >> 16;
}
/* * This is a version of ip_compute_csum() optimized for IP headers, * which always checksum on 4 octet boundaries.
*/ staticinline __sum16
ip_fast_csum(constvoid *iph, unsignedint ihl)
{ constvoid *ptr = iph; unsignedint tmp, tmp2, sum;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.