nxge_fflp_hash.c revision 14ea4bb737263733ad80a36b4f73f681c30a6b45
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License (the "License").
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You may not use this file except in compliance with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void nxge_crc32c_word(uint32_t *crcptr, const uint32_t *buf, int len);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The crc32c algorithms are taken from sctp_crc32 implementation
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Fast CRC32C calculation algorithm suggested by Ferenc Rakoczi
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (ferenc.rakoczi@sun.com). The basic idea is to look at it
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * four bytes (one word) at a time, using four tables. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * standard algorithm in RFC 3309 uses one table.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * SCTP uses reflected/reverse polynomial CRC32 with generating
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * polynomial 0x1EDC6F41L
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* CRC-CCITT Polynomial */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The four CRC32c tables. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The four CRC-CCITT tables. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* the four tables for H1 Computation */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (crc = (crc<<8)^h1table[0][((crc >> 24) ^data) & 0xff])
return (rw);
static uint32_t
nxge_crc32c_init(void)
#ifdef _BIG_ENDIAN
nxge_crc_ccitt_init(void)
#ifdef _BIG_ENDIAN
for (i = 0; i < len; i++) {
#ifdef _BIG_ENDIAN
for (i = 0; i < len; i++) {
#ifdef _BIG_ENDIAN
for (i = 0; i < len; i++) {
return (crc16);
int rem;
if (rem != 0) {
if (rem != 0) {
return (crc32);
return (crc_h1);
#ifdef _BIG_ENDIAN
return (crch1);
for (i = 0; i < length; i++) {
return (crch1);