Deleted Added
full compact
if_gem.c (148369) if_gem.c (148654)
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 148369 2005-07-24 18:45:15Z marius $");
31__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 148654 2005-08-03 00:18:35Z rwatson $");
32
33/*
34 * Driver for Sun GEM ethernet controllers.
35 */
36
37#if 0
38#define GEM_DEBUG
39#endif

--- 1909 unchanged lines hidden (view full) ---

1949 * index into the 256 bit logical address filter. The high order 4
1950 * bits selects the word, while the other 4 bits select the bit within
1951 * the word (where bit 0 is the MSB).
1952 */
1953
1954 /* Clear hash table */
1955 memset(hash, 0, sizeof(hash));
1956
32
33/*
34 * Driver for Sun GEM ethernet controllers.
35 */
36
37#if 0
38#define GEM_DEBUG
39#endif

--- 1909 unchanged lines hidden (view full) ---

1949 * index into the 256 bit logical address filter. The high order 4
1950 * bits selects the word, while the other 4 bits select the bit within
1951 * the word (where bit 0 is the MSB).
1952 */
1953
1954 /* Clear hash table */
1955 memset(hash, 0, sizeof(hash));
1956
1957 IF_ADDR_LOCK(ifp);
1957 TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
1958 if (inm->ifma_addr->sa_family != AF_LINK)
1959 continue;
1960 crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
1961 inm->ifma_addr), ETHER_ADDR_LEN);
1962
1963 /* Just want the 8 most significant bits. */
1964 crc >>= 24;
1965
1966 /* Set the corresponding bit in the filter. */
1967 hash[crc >> 4] |= 1 << (15 - (crc & 15));
1968 }
1958 TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) {
1959 if (inm->ifma_addr->sa_family != AF_LINK)
1960 continue;
1961 crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
1962 inm->ifma_addr), ETHER_ADDR_LEN);
1963
1964 /* Just want the 8 most significant bits. */
1965 crc >>= 24;
1966
1967 /* Set the corresponding bit in the filter. */
1968 hash[crc >> 4] |= 1 << (15 - (crc & 15));
1969 }
1970 IF_ADDR_UNLOCK(ifp);
1969
1970 v |= GEM_MAC_RX_HASH_FILTER;
1971 ifp->if_flags &= ~IFF_ALLMULTI;
1972
1973 /* Now load the hash table into the chip (if we are using it) */
1974 for (i = 0; i < 16; i++) {
1975 bus_space_write_4(t, h,
1976 GEM_MAC_HASH0 + i * (GEM_MAC_HASH1-GEM_MAC_HASH0),
1977 hash[i]);
1978 }
1979
1980chipit:
1981 bus_space_write_4(t, h, GEM_MAC_RX_CONFIG, v);
1982}
1971
1972 v |= GEM_MAC_RX_HASH_FILTER;
1973 ifp->if_flags &= ~IFF_ALLMULTI;
1974
1975 /* Now load the hash table into the chip (if we are using it) */
1976 for (i = 0; i < 16; i++) {
1977 bus_space_write_4(t, h,
1978 GEM_MAC_HASH0 + i * (GEM_MAC_HASH1-GEM_MAC_HASH0),
1979 hash[i]);
1980 }
1981
1982chipit:
1983 bus_space_write_4(t, h, GEM_MAC_RX_CONFIG, v);
1984}