if_bge.c (122497) | if_bge.c (122625) |
---|---|
1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. 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: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. 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: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 122497 2003-11-11 17:57:03Z sam $"); | 35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 122625 2003-11-13 20:55:53Z obrien $"); |
36 37/* 38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 39 * 40 * The Broadcom BCM5700 is based on technology originally developed by 41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet 42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has 43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external --- 18 unchanged lines hidden (view full) --- 62 * Without external SSRAM, you can only have at most 4 TX rings, 63 * and the use of the mini RX ring is disabled. This seems to imply 64 * that these features are simply not available on the BCM5701. As a 65 * result, this driver does not implement any support for the mini RX 66 * ring. 67 */ 68 69#include <sys/cdefs.h> | 36 37/* 38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 39 * 40 * The Broadcom BCM5700 is based on technology originally developed by 41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet 42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has 43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external --- 18 unchanged lines hidden (view full) --- 62 * Without external SSRAM, you can only have at most 4 TX rings, 63 * and the use of the mini RX ring is disabled. This seems to imply 64 * that these features are simply not available on the BCM5701. As a 65 * result, this driver does not implement any support for the mini RX 66 * ring. 67 */ 68 69#include <sys/cdefs.h> |
70__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 122497 2003-11-11 17:57:03Z sam $"); | 70__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 122625 2003-11-13 20:55:53Z obrien $"); |
71 72#include <sys/param.h> 73#include <sys/endian.h> 74#include <sys/systm.h> 75#include <sys/sockio.h> 76#include <sys/mbuf.h> 77#include <sys/malloc.h> 78#include <sys/kernel.h> --- 125 unchanged lines hidden (view full) --- 204static void bge_watchdog (struct ifnet *); 205static void bge_shutdown (device_t); 206static int bge_ifmedia_upd (struct ifnet *); 207static void bge_ifmedia_sts (struct ifnet *, struct ifmediareq *); 208 209static u_int8_t bge_eeprom_getbyte (struct bge_softc *, int, u_int8_t *); 210static int bge_read_eeprom (struct bge_softc *, caddr_t, int, int); 211 | 71 72#include <sys/param.h> 73#include <sys/endian.h> 74#include <sys/systm.h> 75#include <sys/sockio.h> 76#include <sys/mbuf.h> 77#include <sys/malloc.h> 78#include <sys/kernel.h> --- 125 unchanged lines hidden (view full) --- 204static void bge_watchdog (struct ifnet *); 205static void bge_shutdown (device_t); 206static int bge_ifmedia_upd (struct ifnet *); 207static void bge_ifmedia_sts (struct ifnet *, struct ifmediareq *); 208 209static u_int8_t bge_eeprom_getbyte (struct bge_softc *, int, u_int8_t *); 210static int bge_read_eeprom (struct bge_softc *, caddr_t, int, int); 211 |
212static u_int32_t bge_crc (caddr_t); | 212static u_int32_t bge_mchash (caddr_t); |
213static void bge_setmulti (struct bge_softc *); 214 215static void bge_handle_events (struct bge_softc *); 216static int bge_alloc_jumbo_mem (struct bge_softc *); 217static void bge_free_jumbo_mem (struct bge_softc *); 218static void *bge_jalloc (struct bge_softc *); 219static void bge_jfree (void *, void *); 220static int bge_newbuf_std (struct bge_softc *, int, struct mbuf *); --- 908 unchanged lines hidden (view full) --- 1129 CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); 1130 1131 return(0); 1132} 1133 1134#define BGE_POLY 0xEDB88320 1135 1136static u_int32_t | 213static void bge_setmulti (struct bge_softc *); 214 215static void bge_handle_events (struct bge_softc *); 216static int bge_alloc_jumbo_mem (struct bge_softc *); 217static void bge_free_jumbo_mem (struct bge_softc *); 218static void *bge_jalloc (struct bge_softc *); 219static void bge_jfree (void *, void *); 220static int bge_newbuf_std (struct bge_softc *, int, struct mbuf *); --- 908 unchanged lines hidden (view full) --- 1129 CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); 1130 1131 return(0); 1132} 1133 1134#define BGE_POLY 0xEDB88320 1135 1136static u_int32_t |
1137bge_crc(addr) | 1137bge_mchash(addr) |
1138 caddr_t addr; 1139{ | 1138 caddr_t addr; 1139{ |
1140 u_int32_t idx, bit, data, crc; | 1140 u_int32_t crc; 1141 int idx, bit; 1142 u_int8_t data; |
1141 1142 /* Compute CRC for the address value. */ 1143 crc = 0xFFFFFFFF; /* initial value */ 1144 1145 for (idx = 0; idx < 6; idx++) { 1146 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 1147 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? BGE_POLY : 0); 1148 } --- 23 unchanged lines hidden (view full) --- 1172 /* First, zot all the existing filters. */ 1173 for (i = 0; i < 4; i++) 1174 CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); 1175 1176 /* Now program new ones. */ 1177 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 1178 if (ifma->ifma_addr->sa_family != AF_LINK) 1179 continue; | 1143 1144 /* Compute CRC for the address value. */ 1145 crc = 0xFFFFFFFF; /* initial value */ 1146 1147 for (idx = 0; idx < 6; idx++) { 1148 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 1149 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? BGE_POLY : 0); 1150 } --- 23 unchanged lines hidden (view full) --- 1174 /* First, zot all the existing filters. */ 1175 for (i = 0; i < 4; i++) 1176 CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); 1177 1178 /* Now program new ones. */ 1179 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 1180 if (ifma->ifma_addr->sa_family != AF_LINK) 1181 continue; |
1180 h = bge_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); | 1182 h = bge_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); |
1181 hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); 1182 } 1183 1184 for (i = 0; i < 4; i++) 1185 CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); 1186 1187 return; 1188} --- 2449 unchanged lines hidden --- | 1183 hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); 1184 } 1185 1186 for (i = 0; i < 4; i++) 1187 CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); 1188 1189 return; 1190} --- 2449 unchanged lines hidden --- |