Deleted Added
full compact
if_hme.c (147256) if_hme.c (148654)
1/*-
2 * Copyright (c) 1999 The NetBSD Foundation, Inc.
3 * Copyright (c) 2001-2003 Thomas Moestl <tmm@FreeBSD.org>.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Paul Kranenburg.
8 *

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

33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * from: NetBSD: hme.c,v 1.29 2002/05/05 03:02:38 thorpej Exp
38 */
39
40#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999 The NetBSD Foundation, Inc.
3 * Copyright (c) 2001-2003 Thomas Moestl <tmm@FreeBSD.org>.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Paul Kranenburg.
8 *

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

33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * from: NetBSD: hme.c,v 1.29 2002/05/05 03:02:38 thorpej Exp
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/dev/hme/if_hme.c 147256 2005-06-10 16:49:24Z brooks $");
41__FBSDID("$FreeBSD: head/sys/dev/hme/if_hme.c 148654 2005-08-03 00:18:35Z rwatson $");
42
43/*
44 * HME Ethernet module driver.
45 *
46 * The HME is e.g. part of the PCIO PCI multi function device.
47 * It supports TX gathering and TX and RX checksum offloading.
48 * RX buffers must be aligned at a programmable offset modulo 16. We choose 2
49 * for this offset: mbuf clusters are usually on about 2^11 boundaries, 2 bytes

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

1674 /*
1675 * Set up multicast address filter by passing all multicast addresses
1676 * through a crc generator, and then using the high order 6 bits as an
1677 * index into the 64 bit logical address filter. The high order bit
1678 * selects the word, while the rest of the bits select the bit within
1679 * the word.
1680 */
1681
42
43/*
44 * HME Ethernet module driver.
45 *
46 * The HME is e.g. part of the PCIO PCI multi function device.
47 * It supports TX gathering and TX and RX checksum offloading.
48 * RX buffers must be aligned at a programmable offset modulo 16. We choose 2
49 * for this offset: mbuf clusters are usually on about 2^11 boundaries, 2 bytes

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

1674 /*
1675 * Set up multicast address filter by passing all multicast addresses
1676 * through a crc generator, and then using the high order 6 bits as an
1677 * index into the 64 bit logical address filter. The high order bit
1678 * selects the word, while the rest of the bits select the bit within
1679 * the word.
1680 */
1681
1682 IF_ADDR_LOCK(sc->sc_ifp);
1682 TAILQ_FOREACH(inm, &sc->sc_ifp->if_multiaddrs, ifma_link) {
1683 if (inm->ifma_addr->sa_family != AF_LINK)
1684 continue;
1685 crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
1686 inm->ifma_addr), ETHER_ADDR_LEN);
1687
1688 /* Just want the 6 most significant bits. */
1689 crc >>= 26;
1690
1691 /* Set the corresponding bit in the filter. */
1692 hash[crc >> 4] |= 1 << (crc & 0xf);
1693 }
1683 TAILQ_FOREACH(inm, &sc->sc_ifp->if_multiaddrs, ifma_link) {
1684 if (inm->ifma_addr->sa_family != AF_LINK)
1685 continue;
1686 crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
1687 inm->ifma_addr), ETHER_ADDR_LEN);
1688
1689 /* Just want the 6 most significant bits. */
1690 crc >>= 26;
1691
1692 /* Set the corresponding bit in the filter. */
1693 hash[crc >> 4] |= 1 << (crc & 0xf);
1694 }
1695 IF_ADDR_UNLOCK(sc->sc_ifp);
1694
1695 ifp->if_flags &= ~IFF_ALLMULTI;
1696
1697chipit:
1698 /* Now load the hash table into the chip */
1699 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB0, hash[0]);
1700 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB1, hash[1]);
1701 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB2, hash[2]);
1702 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB3, hash[3]);
1703 hme_mac_bitflip(sc, HME_MACI_RXCFG, macc, 0,
1704 macc & (HME_MAC_RXCFG_ENABLE | HME_MAC_RXCFG_HENABLE |
1705 HME_MAC_RXCFG_ME));
1706}
1696
1697 ifp->if_flags &= ~IFF_ALLMULTI;
1698
1699chipit:
1700 /* Now load the hash table into the chip */
1701 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB0, hash[0]);
1702 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB1, hash[1]);
1703 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB2, hash[2]);
1704 HME_MAC_WRITE_4(sc, HME_MACI_HASHTAB3, hash[3]);
1705 hme_mac_bitflip(sc, HME_MACI_RXCFG, macc, 0,
1706 macc & (HME_MAC_RXCFG_ENABLE | HME_MAC_RXCFG_HENABLE |
1707 HME_MAC_RXCFG_ME));
1708}