if_gem.c (130026) | if_gem.c (130270) |
---|---|
1/*- 2 * Copyright (C) 2001 Eduardo Horvath. 3 * Copyright (c) 2001-2003 Thomas Moestl 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: NetBSD: gem.c,v 1.21 2002/06/01 23:50:58 lukem Exp 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2001 Eduardo Horvath. 3 * Copyright (c) 2001-2003 Thomas Moestl 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: NetBSD: gem.c,v 1.21 2002/06/01 23:50:58 lukem Exp 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 130026 2004-06-03 06:10:02Z phk $"); | 31__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 130270 2004-06-09 14:34:04Z naddy $"); |
32 33/* 34 * Driver for Sun GEM ethernet controllers. 35 */ 36 37#if 0 38#define GEM_DEBUG 39#endif --- 1802 unchanged lines hidden (view full) --- 1842gem_setladrf(sc) 1843 struct gem_softc *sc; 1844{ 1845 struct ifnet *ifp = &sc->sc_arpcom.ac_if; 1846 struct ifmultiaddr *inm; 1847 struct sockaddr_dl *sdl; 1848 bus_space_tag_t t = sc->sc_bustag; 1849 bus_space_handle_t h = sc->sc_h; | 32 33/* 34 * Driver for Sun GEM ethernet controllers. 35 */ 36 37#if 0 38#define GEM_DEBUG 39#endif --- 1802 unchanged lines hidden (view full) --- 1842gem_setladrf(sc) 1843 struct gem_softc *sc; 1844{ 1845 struct ifnet *ifp = &sc->sc_arpcom.ac_if; 1846 struct ifmultiaddr *inm; 1847 struct sockaddr_dl *sdl; 1848 bus_space_tag_t t = sc->sc_bustag; 1849 bus_space_handle_t h = sc->sc_h; |
1850 u_char *cp; | |
1851 u_int32_t crc; 1852 u_int32_t hash[16]; 1853 u_int32_t v; 1854 int len; 1855 int i; 1856 1857 /* Get current RX configuration */ 1858 v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG); --- 28 unchanged lines hidden (view full) --- 1887 1888 /* Clear hash table */ 1889 memset(hash, 0, sizeof(hash)); 1890 1891 TAILQ_FOREACH(inm, &sc->sc_arpcom.ac_if.if_multiaddrs, ifma_link) { 1892 if (inm->ifma_addr->sa_family != AF_LINK) 1893 continue; 1894 sdl = (struct sockaddr_dl *)inm->ifma_addr; | 1850 u_int32_t crc; 1851 u_int32_t hash[16]; 1852 u_int32_t v; 1853 int len; 1854 int i; 1855 1856 /* Get current RX configuration */ 1857 v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG); --- 28 unchanged lines hidden (view full) --- 1886 1887 /* Clear hash table */ 1888 memset(hash, 0, sizeof(hash)); 1889 1890 TAILQ_FOREACH(inm, &sc->sc_arpcom.ac_if.if_multiaddrs, ifma_link) { 1891 if (inm->ifma_addr->sa_family != AF_LINK) 1892 continue; 1893 sdl = (struct sockaddr_dl *)inm->ifma_addr; |
1895 cp = LLADDR(sdl); 1896 crc = 0xffffffff; 1897 for (len = sdl->sdl_alen; --len >= 0;) { 1898 int octet = *cp++; 1899 int i; | 1894 crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); |
1900 | 1895 |
1901#define MC_POLY_LE 0xedb88320UL /* mcast crc, little endian */ 1902 for (i = 0; i < 8; i++) { 1903 if ((crc & 1) ^ (octet & 1)) { 1904 crc >>= 1; 1905 crc ^= MC_POLY_LE; 1906 } else { 1907 crc >>= 1; 1908 } 1909 octet >>= 1; 1910 } 1911 } | |
1912 /* Just want the 8 most significant bits. */ 1913 crc >>= 24; 1914 1915 /* Set the corresponding bit in the filter. */ 1916 hash[crc >> 4] |= 1 << (15 - (crc & 15)); 1917 } 1918 1919 v |= GEM_MAC_RX_HASH_FILTER; --- 12 unchanged lines hidden --- | 1896 /* Just want the 8 most significant bits. */ 1897 crc >>= 24; 1898 1899 /* Set the corresponding bit in the filter. */ 1900 hash[crc >> 4] |= 1 << (15 - (crc & 15)); 1901 } 1902 1903 v |= GEM_MAC_RX_HASH_FILTER; --- 12 unchanged lines hidden --- |