if_nge.c (193105) | if_nge.c (195049) |
---|---|
1/*- 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001 4 * Bill Paul <wpaul@bsdi.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, 2000, 2001 4 * Bill Paul <wpaul@bsdi.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/nge/if_nge.c 193105 2009-05-30 18:39:22Z attilio $"); | 35__FBSDID("$FreeBSD: head/sys/dev/nge/if_nge.c 195049 2009-06-26 11:45:06Z rwatson $"); |
36 37/* 38 * National Semiconductor DP83820/DP83821 gigabit ethernet driver 39 * for FreeBSD. Datasheets are available from: 40 * 41 * http://www.national.com/ds/DP/DP83820.pdf 42 * http://www.national.com/ds/DP/DP83821.pdf 43 * --- 814 unchanged lines hidden (view full) --- 858 } 859 860 /* 861 * From the 11 bits returned by the crc routine, the top 7 862 * bits represent the 16-bit word in the mcast hash table 863 * that needs to be updated, and the lower 4 bits represent 864 * which bit within that byte needs to be set. 865 */ | 36 37/* 38 * National Semiconductor DP83820/DP83821 gigabit ethernet driver 39 * for FreeBSD. Datasheets are available from: 40 * 41 * http://www.national.com/ds/DP/DP83820.pdf 42 * http://www.national.com/ds/DP/DP83821.pdf 43 * --- 814 unchanged lines hidden (view full) --- 858 } 859 860 /* 861 * From the 11 bits returned by the crc routine, the top 7 862 * bits represent the 16-bit word in the mcast hash table 863 * that needs to be updated, and the lower 4 bits represent 864 * which bit within that byte needs to be set. 865 */ |
866 IF_ADDR_LOCK(ifp); | 866 if_maddr_rlock(ifp); |
867 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 868 if (ifma->ifma_addr->sa_family != AF_LINK) 869 continue; 870 h = ether_crc32_be(LLADDR((struct sockaddr_dl *) 871 ifma->ifma_addr), ETHER_ADDR_LEN) >> 21; 872 index = (h >> 4) & 0x7F; 873 bit = h & 0xF; 874 CSR_WRITE_4(sc, NGE_RXFILT_CTL, 875 NGE_FILTADDR_MCAST_LO + (index * 2)); 876 NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); 877 } | 867 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 868 if (ifma->ifma_addr->sa_family != AF_LINK) 869 continue; 870 h = ether_crc32_be(LLADDR((struct sockaddr_dl *) 871 ifma->ifma_addr), ETHER_ADDR_LEN) >> 21; 872 index = (h >> 4) & 0x7F; 873 bit = h & 0xF; 874 CSR_WRITE_4(sc, NGE_RXFILT_CTL, 875 NGE_FILTADDR_MCAST_LO + (index * 2)); 876 NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); 877 } |
878 IF_ADDR_UNLOCK(ifp); | 878 if_maddr_runlock(ifp); |
879 880done: 881 CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); 882 /* Turn the receive filter on. */ 883 rxfilt |= NGE_RXFILTCTL_ENABLE; 884 CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); 885 CSR_BARRIER_WRITE_4(sc, NGE_RXFILT_CTL); 886} --- 2014 unchanged lines hidden --- | 879 880done: 881 CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); 882 /* Turn the receive filter on. */ 883 rxfilt |= NGE_RXFILTCTL_ENABLE; 884 CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); 885 CSR_BARRIER_WRITE_4(sc, NGE_RXFILT_CTL); 886} --- 2014 unchanged lines hidden --- |