if_tl.c (121816) | if_tl.c (122625) |
---|---|
1/* 2 * Copyright (c) 1997, 1998 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 --- 163 unchanged lines hidden (view full) --- 172 * Using these techniques, this driver achieves very high performance 173 * by minimizing the amount of interrupts generated during large 174 * transfers and by completely avoiding buffer copies. Frame transfer 175 * to and from the ThunderLAN chip is performed entirely by the chip 176 * itself thereby reducing the load on the host CPU. 177 */ 178 179#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1997, 1998 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 --- 163 unchanged lines hidden (view full) --- 172 * Using these techniques, this driver achieves very high performance 173 * by minimizing the amount of interrupts generated during large 174 * transfers and by completely avoiding buffer copies. Frame transfer 175 * to and from the ThunderLAN chip is performed entirely by the chip 176 * itself thereby reducing the load on the host CPU. 177 */ 178 179#include <sys/cdefs.h> |
180__FBSDID("$FreeBSD: head/sys/pci/if_tl.c 121816 2003-10-31 18:32:15Z brooks $"); | 180__FBSDID("$FreeBSD: head/sys/pci/if_tl.c 122625 2003-11-13 20:55:53Z obrien $"); |
181 182#include <sys/param.h> 183#include <sys/systm.h> 184#include <sys/sockio.h> 185#include <sys/mbuf.h> 186#include <sys/malloc.h> 187#include <sys/kernel.h> 188#include <sys/socket.h> --- 106 unchanged lines hidden (view full) --- 295static void tl_mii_send (struct tl_softc *, u_int32_t, int); 296static int tl_mii_readreg (struct tl_softc *, struct tl_mii_frame *); 297static int tl_mii_writereg (struct tl_softc *, struct tl_mii_frame *); 298static int tl_miibus_readreg (device_t, int, int); 299static int tl_miibus_writereg (device_t, int, int, int); 300static void tl_miibus_statchg (device_t); 301 302static void tl_setmode (struct tl_softc *, int); | 181 182#include <sys/param.h> 183#include <sys/systm.h> 184#include <sys/sockio.h> 185#include <sys/mbuf.h> 186#include <sys/malloc.h> 187#include <sys/kernel.h> 188#include <sys/socket.h> --- 106 unchanged lines hidden (view full) --- 295static void tl_mii_send (struct tl_softc *, u_int32_t, int); 296static int tl_mii_readreg (struct tl_softc *, struct tl_mii_frame *); 297static int tl_mii_writereg (struct tl_softc *, struct tl_mii_frame *); 298static int tl_miibus_readreg (device_t, int, int); 299static int tl_miibus_writereg (device_t, int, int, int); 300static void tl_miibus_statchg (device_t); 301 302static void tl_setmode (struct tl_softc *, int); |
303static int tl_calchash (caddr_t); | 303static u_int32_t tl_mchash (caddr_t); |
304static void tl_setmulti (struct tl_softc *); 305static void tl_setfilt (struct tl_softc *, caddr_t, int); 306static void tl_softreset (struct tl_softc *, int); 307static void tl_hardreset (device_t); 308static int tl_list_rx_init (struct tl_softc *); 309static int tl_list_tx_init (struct tl_softc *); 310 311static u_int8_t tl_dio_read8 (struct tl_softc *, int); --- 572 unchanged lines hidden (view full) --- 884 * Calculate the hash of a MAC address for programming the multicast hash 885 * table. This hash is simply the address split into 6-bit chunks 886 * XOR'd, e.g. 887 * byte: 000000|00 1111|1111 22|222222|333333|33 4444|4444 55|555555 888 * bit: 765432|10 7654|3210 76|543210|765432|10 7654|3210 76|543210 889 * Bytes 0-2 and 3-5 are symmetrical, so are folded together. Then 890 * the folded 24-bit value is split into 6-bit portions and XOR'd. 891 */ | 304static void tl_setmulti (struct tl_softc *); 305static void tl_setfilt (struct tl_softc *, caddr_t, int); 306static void tl_softreset (struct tl_softc *, int); 307static void tl_hardreset (device_t); 308static int tl_list_rx_init (struct tl_softc *); 309static int tl_list_tx_init (struct tl_softc *); 310 311static u_int8_t tl_dio_read8 (struct tl_softc *, int); --- 572 unchanged lines hidden (view full) --- 884 * Calculate the hash of a MAC address for programming the multicast hash 885 * table. This hash is simply the address split into 6-bit chunks 886 * XOR'd, e.g. 887 * byte: 000000|00 1111|1111 22|222222|333333|33 4444|4444 55|555555 888 * bit: 765432|10 7654|3210 76|543210|765432|10 7654|3210 76|543210 889 * Bytes 0-2 and 3-5 are symmetrical, so are folded together. Then 890 * the folded 24-bit value is split into 6-bit portions and XOR'd. 891 */ |
892static int 893tl_calchash(addr) 894 caddr_t addr; | 892static u_int32_t 893tl_mchash(addr) 894 caddr_t addr; |
895{ | 895{ |
896 int t; | 896 int t; |
897 898 t = (addr[0] ^ addr[3]) << 16 | (addr[1] ^ addr[4]) << 8 | 899 (addr[2] ^ addr[5]); 900 return ((t >> 18) ^ (t >> 12) ^ (t >> 6) ^ t) & 0x3f; 901} 902 903/* 904 * The ThunderLAN has a perfect MAC address filter in addition to --- 68 unchanged lines hidden (view full) --- 973 */ 974 if (i < 4) { 975 tl_setfilt(sc, 976 LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i); 977 i++; 978 continue; 979 } 980 | 897 898 t = (addr[0] ^ addr[3]) << 16 | (addr[1] ^ addr[4]) << 8 | 899 (addr[2] ^ addr[5]); 900 return ((t >> 18) ^ (t >> 12) ^ (t >> 6) ^ t) & 0x3f; 901} 902 903/* 904 * The ThunderLAN has a perfect MAC address filter in addition to --- 68 unchanged lines hidden (view full) --- 973 */ 974 if (i < 4) { 975 tl_setfilt(sc, 976 LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i); 977 i++; 978 continue; 979 } 980 |
981 h = tl_calchash( | 981 h = tl_mchash( |
982 LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); 983 if (h < 32) 984 hashes[0] |= (1 << h); 985 else 986 hashes[1] |= (1 << (h - 32)); 987 } 988 } 989 --- 1363 unchanged lines hidden --- | 982 LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); 983 if (h < 32) 984 hashes[0] |= (1 << h); 985 else 986 hashes[1] |= (1 << (h - 32)); 987 } 988 } 989 --- 1363 unchanged lines hidden --- |