if_sis.c (129876) | if_sis.c (130270) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/pci/if_sis.c 129876 2004-05-30 17:57:46Z phk $"); | 34__FBSDID("$FreeBSD: head/sys/pci/if_sis.c 130270 2004-06-09 14:34:04Z naddy $"); |
35 36/* 37 * SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are 38 * available from http://www.sis.com.tw. 39 * 40 * This driver also supports the NatSemi DP83815. Datasheets are 41 * available from http://www.national.com. 42 * --- 794 unchanged lines hidden (view full) --- 837 return; 838} 839 840static u_int32_t 841sis_mchash(sc, addr) 842 struct sis_softc *sc; 843 const uint8_t *addr; 844{ | 35 36/* 37 * SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are 38 * available from http://www.sis.com.tw. 39 * 40 * This driver also supports the NatSemi DP83815. Datasheets are 41 * available from http://www.national.com. 42 * --- 794 unchanged lines hidden (view full) --- 837 return; 838} 839 840static u_int32_t 841sis_mchash(sc, addr) 842 struct sis_softc *sc; 843 const uint8_t *addr; 844{ |
845 uint32_t crc, carry; 846 int idx, bit; 847 uint8_t data; | 845 uint32_t crc; |
848 849 /* Compute CRC for the address value. */ | 846 847 /* Compute CRC for the address value. */ |
850 crc = 0xFFFFFFFF; /* initial value */ | 848 crc = ether_crc32_be(addr, ETHER_ADDR_LEN); |
851 | 849 |
852 for (idx = 0; idx < 6; idx++) { 853 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) { 854 carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01); 855 crc <<= 1; 856 if (carry) 857 crc = (crc ^ 0x04c11db6) | carry; 858 } 859 } 860 | |
861 /* 862 * return the filter bit position 863 * 864 * The NatSemi chip has a 512-bit filter, which is 865 * different than the SiS, so we special-case it. 866 */ 867 if (sc->sis_type == SIS_TYPE_83815) 868 return (crc >> 23); --- 1603 unchanged lines hidden --- | 850 /* 851 * return the filter bit position 852 * 853 * The NatSemi chip has a 512-bit filter, which is 854 * different than the SiS, so we special-case it. 855 */ 856 if (sc->sis_type == SIS_TYPE_83815) 857 return (crc >> 23); --- 1603 unchanged lines hidden --- |