003 File Manager
Current Path:
/usr/src/sys/dev/sfxge/common
usr
/
src
/
sys
/
dev
/
sfxge
/
common
/
📁
..
📄
ef10_ev.c
(38.47 KB)
📄
ef10_filter.c
(48.25 KB)
📄
ef10_image.c
(22.76 KB)
📄
ef10_impl.h
(28.32 KB)
📄
ef10_intr.c
(4.71 KB)
📄
ef10_mac.c
(31.92 KB)
📄
ef10_mcdi.c
(9.59 KB)
📄
ef10_nic.c
(62.96 KB)
📄
ef10_nvram.c
(54.36 KB)
📄
ef10_phy.c
(20.26 KB)
📄
ef10_rx.c
(30.8 KB)
📄
ef10_signed_image_layout.h
(3.9 KB)
📄
ef10_tlv_layout.h
(33.34 KB)
📄
ef10_tx.c
(19.03 KB)
📄
ef10_vpd.c
(11.03 KB)
📄
efsys.h
(31.95 KB)
📄
efx.h
(82.48 KB)
📄
efx_annote.h
(4.06 KB)
📄
efx_bootcfg.c
(25.55 KB)
📄
efx_check.h
(11.67 KB)
📄
efx_crc32.c
(5.45 KB)
📄
efx_ev.c
(34.49 KB)
📄
efx_filter.c
(39.47 KB)
📄
efx_hash.c
(8.08 KB)
📄
efx_impl.h
(38.52 KB)
📄
efx_intr.c
(14.56 KB)
📄
efx_lic.c
(37.43 KB)
📄
efx_mac.c
(22.27 KB)
📄
efx_mcdi.c
(58.17 KB)
📄
efx_mcdi.h
(13.28 KB)
📄
efx_mon.c
(23.85 KB)
📄
efx_nic.c
(28.89 KB)
📄
efx_nvram.c
(24.9 KB)
📄
efx_phy.c
(13.44 KB)
📄
efx_phy_ids.h
(2.04 KB)
📄
efx_port.c
(5.99 KB)
📄
efx_regs.h
(118.32 KB)
📄
efx_regs_ef10.h
(21.93 KB)
📄
efx_regs_mcdi.h
(769.41 KB)
📄
efx_regs_mcdi_aoe.h
(125.41 KB)
📄
efx_regs_mcdi_strs.h
(8.54 KB)
📄
efx_regs_pci.h
(55.57 KB)
📄
efx_rx.c
(39.55 KB)
📄
efx_sram.c
(8.76 KB)
📄
efx_tunnel.c
(11.69 KB)
📄
efx_tx.c
(27.1 KB)
📄
efx_types.h
(57.59 KB)
📄
efx_vpd.c
(20.8 KB)
📄
hunt_impl.h
(2.36 KB)
📄
hunt_nic.c
(7.76 KB)
📄
mcdi_mon.c
(16.08 KB)
📄
mcdi_mon.h
(2.47 KB)
📄
medford2_impl.h
(2.1 KB)
📄
medford2_nic.c
(5.53 KB)
📄
medford_impl.h
(2.04 KB)
📄
medford_nic.c
(5.39 KB)
📄
siena_flash.h
(9.02 KB)
📄
siena_impl.h
(10.2 KB)
📄
siena_mac.c
(15.58 KB)
📄
siena_mcdi.c
(6.87 KB)
📄
siena_nic.c
(20.68 KB)
📄
siena_nvram.c
(17.89 KB)
📄
siena_phy.c
(22.34 KB)
📄
siena_sram.c
(5.46 KB)
📄
siena_vpd.c
(14.54 KB)
Editing: efx_hash.c
/*- * Copyright 2006 Bob Jenkins * * Derived from public domain source, see * <http://burtleburtle.net/bob/c/lookup3.c>: * * "lookup3.c, by Bob Jenkins, May 2006, Public Domain. * * These are functions for producing 32-bit hashes for hash table lookup... * ...You can use this free for any purpose. It's in the public domain. * It has no warranty." * * Copyright (c) 2014-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are * those of the authors and should not be interpreted as representing official * policies, either expressed or implied, of the FreeBSD Project. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include "efx.h" #include "efx_impl.h" /* Hash initial value */ #define EFX_HASH_INITIAL_VALUE 0xdeadbeef /* * Rotate a 32-bit value left * * Allow platform to provide an intrinsic or optimised routine and * fall-back to a simple shift based implementation. */ #if EFSYS_HAS_ROTL_DWORD #define EFX_HASH_ROTATE(_value, _shift) \ EFSYS_ROTL_DWORD(_value, _shift) #else #define EFX_HASH_ROTATE(_value, _shift) \ (((_value) << (_shift)) | ((_value) >> (32 - (_shift)))) #endif /* Mix three 32-bit values reversibly */ #define EFX_HASH_MIX(_a, _b, _c) \ do { \ _a -= _c; \ _a ^= EFX_HASH_ROTATE(_c, 4); \ _c += _b; \ _b -= _a; \ _b ^= EFX_HASH_ROTATE(_a, 6); \ _a += _c; \ _c -= _b; \ _c ^= EFX_HASH_ROTATE(_b, 8); \ _b += _a; \ _a -= _c; \ _a ^= EFX_HASH_ROTATE(_c, 16); \ _c += _b; \ _b -= _a; \ _b ^= EFX_HASH_ROTATE(_a, 19); \ _a += _c; \ _c -= _b; \ _c ^= EFX_HASH_ROTATE(_b, 4); \ _b += _a; \ _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) /* Final mixing of three 32-bit values into one (_c) */ #define EFX_HASH_FINALISE(_a, _b, _c) \ do { \ _c ^= _b; \ _c -= EFX_HASH_ROTATE(_b, 14); \ _a ^= _c; \ _a -= EFX_HASH_ROTATE(_c, 11); \ _b ^= _a; \ _b -= EFX_HASH_ROTATE(_a, 25); \ _c ^= _b; \ _c -= EFX_HASH_ROTATE(_b, 16); \ _a ^= _c; \ _a -= EFX_HASH_ROTATE(_c, 4); \ _b ^= _a; \ _b -= EFX_HASH_ROTATE(_a, 14); \ _c ^= _b; \ _c -= EFX_HASH_ROTATE(_b, 24); \ _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) /* Produce a 32-bit hash from 32-bit aligned input */ __checkReturn uint32_t efx_hash_dwords( __in_ecount(count) uint32_t const *input, __in size_t count, __in uint32_t init) { uint32_t a; uint32_t b; uint32_t c; /* Set up the initial internal state */ a = b = c = EFX_HASH_INITIAL_VALUE + (((uint32_t)count) * sizeof (uint32_t)) + init; /* Handle all but the last three dwords of the input */ while (count > 3) { a += input[0]; b += input[1]; c += input[2]; EFX_HASH_MIX(a, b, c); count -= 3; input += 3; } /* Handle the left-overs */ switch (count) { case 3: c += input[2]; /* Fall-through */ case 2: b += input[1]; /* Fall-through */ case 1: a += input[0]; EFX_HASH_FINALISE(a, b, c); break; case 0: /* Should only get here if count parameter was zero */ break; } return (c); } #if EFSYS_IS_BIG_ENDIAN /* Produce a 32-bit hash from arbitrarily aligned input */ __checkReturn uint32_t efx_hash_bytes( __in_ecount(length) uint8_t const *input, __in size_t length, __in uint32_t init) { uint32_t a; uint32_t b; uint32_t c; /* Set up the initial internal state */ a = b = c = EFX_HASH_INITIAL_VALUE + (uint32_t)length + init; /* Handle all but the last twelve bytes of the input */ while (length > 12) { a += ((uint32_t)input[0]) << 24; a += ((uint32_t)input[1]) << 16; a += ((uint32_t)input[2]) << 8; a += ((uint32_t)input[3]); b += ((uint32_t)input[4]) << 24; b += ((uint32_t)input[5]) << 16; b += ((uint32_t)input[6]) << 8; b += ((uint32_t)input[7]); c += ((uint32_t)input[8]) << 24; c += ((uint32_t)input[9]) << 16; c += ((uint32_t)input[10]) << 8; c += ((uint32_t)input[11]); EFX_HASH_MIX(a, b, c); length -= 12; input += 12; } /* Handle the left-overs */ switch (length) { case 12: c += ((uint32_t)input[11]); /* Fall-through */ case 11: c += ((uint32_t)input[10]) << 8; /* Fall-through */ case 10: c += ((uint32_t)input[9]) << 16; /* Fall-through */ case 9: c += ((uint32_t)input[8]) << 24; /* Fall-through */ case 8: b += ((uint32_t)input[7]); /* Fall-through */ case 7: b += ((uint32_t)input[6]) << 8; /* Fall-through */ case 6: b += ((uint32_t)input[5]) << 16; /* Fall-through */ case 5: b += ((uint32_t)input[4]) << 24; /* Fall-through */ case 4: a += ((uint32_t)input[3]); /* Fall-through */ case 3: a += ((uint32_t)input[2]) << 8; /* Fall-through */ case 2: a += ((uint32_t)input[1]) << 16; /* Fall-through */ case 1: a += ((uint32_t)input[0]) << 24; EFX_HASH_FINALISE(a, b, c); break; case 0: /* Should only get here if length parameter was zero */ break; } return (c); } #elif EFSYS_IS_LITTLE_ENDIAN /* Produce a 32-bit hash from arbitrarily aligned input */ __checkReturn uint32_t efx_hash_bytes( __in_ecount(length) uint8_t const *input, __in size_t length, __in uint32_t init) { uint32_t a; uint32_t b; uint32_t c; /* Set up the initial internal state */ a = b = c = EFX_HASH_INITIAL_VALUE + (uint32_t)length + init; /* Handle all but the last twelve bytes of the input */ while (length > 12) { a += ((uint32_t)input[0]); a += ((uint32_t)input[1]) << 8; a += ((uint32_t)input[2]) << 16; a += ((uint32_t)input[3]) << 24; b += ((uint32_t)input[4]); b += ((uint32_t)input[5]) << 8; b += ((uint32_t)input[6]) << 16; b += ((uint32_t)input[7]) << 24; c += ((uint32_t)input[8]); c += ((uint32_t)input[9]) << 8; c += ((uint32_t)input[10]) << 16; c += ((uint32_t)input[11]) << 24; EFX_HASH_MIX(a, b, c); length -= 12; input += 12; } /* Handle the left-overs */ switch (length) { case 12: c += ((uint32_t)input[11]) << 24; /* Fall-through */ case 11: c += ((uint32_t)input[10]) << 16; /* Fall-through */ case 10: c += ((uint32_t)input[9]) << 8; /* Fall-through */ case 9: c += ((uint32_t)input[8]); /* Fall-through */ case 8: b += ((uint32_t)input[7]) << 24; /* Fall-through */ case 7: b += ((uint32_t)input[6]) << 16; /* Fall-through */ case 6: b += ((uint32_t)input[5]) << 8; /* Fall-through */ case 5: b += ((uint32_t)input[4]); /* Fall-through */ case 4: a += ((uint32_t)input[3]) << 24; /* Fall-through */ case 3: a += ((uint32_t)input[2]) << 16; /* Fall-through */ case 2: a += ((uint32_t)input[1]) << 8; /* Fall-through */ case 1: a += ((uint32_t)input[0]); EFX_HASH_FINALISE(a, b, c); break; case 0: /* Should only get here if length parameter was zero */ break; } return (c); } #else #error "Neither of EFSYS_IS_{BIG,LITTLE}_ENDIAN is set" #endif
Upload File
Create Folder