if_sk.c (191716) | if_sk.c (195049) |
---|---|
1/* $OpenBSD: if_sk.c,v 2.33 2003/08/12 05:23:06 nate Exp $ */ 2 3/*- 4 * Copyright (c) 1997, 1998, 1999, 2000 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 34 unchanged lines hidden (view full) --- 43 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 44 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 45 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 46 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 47 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 48 */ 49 50#include <sys/cdefs.h> | 1/* $OpenBSD: if_sk.c,v 2.33 2003/08/12 05:23:06 nate Exp $ */ 2 3/*- 4 * Copyright (c) 1997, 1998, 1999, 2000 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 34 unchanged lines hidden (view full) --- 43 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 44 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 45 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 46 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 47 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 48 */ 49 50#include <sys/cdefs.h> |
51__FBSDID("$FreeBSD: head/sys/dev/sk/if_sk.c 191716 2009-05-01 03:24:03Z yongari $"); | 51__FBSDID("$FreeBSD: head/sys/dev/sk/if_sk.c 195049 2009-06-26 11:45:06Z rwatson $"); |
52 53/* 54 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports 55 * the SK-984x series adapters, both single port and dual port. 56 * References: 57 * The XaQti XMAC II datasheet, 58 * http://www.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf 59 * The SysKonnect GEnesis manual, http://www.syskonnect.com --- 75 unchanged lines hidden (view full) --- 135MODULE_DEPEND(sk, ether, 1, 1, 1); 136MODULE_DEPEND(sk, miibus, 1, 1, 1); 137 138/* "device miibus" required. See GENERIC if you get errors here. */ 139#include "miibus_if.h" 140 141#ifndef lint 142static const char rcsid[] = | 52 53/* 54 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports 55 * the SK-984x series adapters, both single port and dual port. 56 * References: 57 * The XaQti XMAC II datasheet, 58 * http://www.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf 59 * The SysKonnect GEnesis manual, http://www.syskonnect.com --- 75 unchanged lines hidden (view full) --- 135MODULE_DEPEND(sk, ether, 1, 1, 1); 136MODULE_DEPEND(sk, miibus, 1, 1, 1); 137 138/* "device miibus" required. See GENERIC if you get errors here. */ 139#include "miibus_if.h" 140 141#ifndef lint 142static const char rcsid[] = |
143 "$FreeBSD: head/sys/dev/sk/if_sk.c 191716 2009-05-01 03:24:03Z yongari $"; | 143 "$FreeBSD: head/sys/dev/sk/if_sk.c 195049 2009-06-26 11:45:06Z rwatson $"; |
144#endif 145 146static struct sk_type sk_devs[] = { 147 { 148 VENDORID_SK, 149 DEVICEID_SK_V1, 150 "SysKonnect Gigabit Ethernet (V1.0)" 151 }, --- 602 unchanged lines hidden (view full) --- 754 if (ifp->if_flags & IFF_ALLMULTI) 755 mode |= XM_MODE_RX_USE_HASH; 756 if (ifp->if_flags & IFF_PROMISC) 757 mode |= XM_MODE_RX_PROMISC; 758 hashes[0] = 0xFFFFFFFF; 759 hashes[1] = 0xFFFFFFFF; 760 } else { 761 i = 1; | 144#endif 145 146static struct sk_type sk_devs[] = { 147 { 148 VENDORID_SK, 149 DEVICEID_SK_V1, 150 "SysKonnect Gigabit Ethernet (V1.0)" 151 }, --- 602 unchanged lines hidden (view full) --- 754 if (ifp->if_flags & IFF_ALLMULTI) 755 mode |= XM_MODE_RX_USE_HASH; 756 if (ifp->if_flags & IFF_PROMISC) 757 mode |= XM_MODE_RX_PROMISC; 758 hashes[0] = 0xFFFFFFFF; 759 hashes[1] = 0xFFFFFFFF; 760 } else { 761 i = 1; |
762 IF_ADDR_LOCK(ifp); | 762 if_maddr_rlock(ifp); |
763 TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, 764 ifma_link) { 765 if (ifma->ifma_addr->sa_family != AF_LINK) 766 continue; 767 /* 768 * Program the first XM_RXFILT_MAX multicast groups 769 * into the perfect filter. 770 */ --- 7 unchanged lines hidden (view full) --- 778 } 779 h = sk_xmchash((const uint8_t *)maddr); 780 if (h < 32) 781 hashes[0] |= (1 << h); 782 else 783 hashes[1] |= (1 << (h - 32)); 784 mode |= XM_MODE_RX_USE_HASH; 785 } | 763 TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, 764 ifma_link) { 765 if (ifma->ifma_addr->sa_family != AF_LINK) 766 continue; 767 /* 768 * Program the first XM_RXFILT_MAX multicast groups 769 * into the perfect filter. 770 */ --- 7 unchanged lines hidden (view full) --- 778 } 779 h = sk_xmchash((const uint8_t *)maddr); 780 if (h < 32) 781 hashes[0] |= (1 << h); 782 else 783 hashes[1] |= (1 << (h - 32)); 784 mode |= XM_MODE_RX_USE_HASH; 785 } |
786 IF_ADDR_UNLOCK(ifp); | 786 if_maddr_runlock(ifp); |
787 } 788 789 SK_XM_WRITE_4(sc_if, XM_MODE, mode); 790 SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]); 791 SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]); 792} 793 794static void --- 11 unchanged lines hidden (view full) --- 806 if (ifp->if_flags & IFF_PROMISC) 807 mode &= ~(YU_RCR_UFLEN | YU_RCR_MUFLEN); 808 else if (ifp->if_flags & IFF_ALLMULTI) { 809 mode |= YU_RCR_UFLEN | YU_RCR_MUFLEN; 810 hashes[0] = 0xFFFFFFFF; 811 hashes[1] = 0xFFFFFFFF; 812 } else { 813 mode |= YU_RCR_UFLEN; | 787 } 788 789 SK_XM_WRITE_4(sc_if, XM_MODE, mode); 790 SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]); 791 SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]); 792} 793 794static void --- 11 unchanged lines hidden (view full) --- 806 if (ifp->if_flags & IFF_PROMISC) 807 mode &= ~(YU_RCR_UFLEN | YU_RCR_MUFLEN); 808 else if (ifp->if_flags & IFF_ALLMULTI) { 809 mode |= YU_RCR_UFLEN | YU_RCR_MUFLEN; 810 hashes[0] = 0xFFFFFFFF; 811 hashes[1] = 0xFFFFFFFF; 812 } else { 813 mode |= YU_RCR_UFLEN; |
814 IF_ADDR_LOCK(ifp); | 814 if_maddr_rlock(ifp); |
815 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 816 if (ifma->ifma_addr->sa_family != AF_LINK) 817 continue; 818 crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) 819 ifma->ifma_addr), ETHER_ADDR_LEN); 820 /* Just want the 6 least significant bits. */ 821 crc &= 0x3f; 822 /* Set the corresponding bit in the hash table. */ 823 hashes[crc >> 5] |= 1 << (crc & 0x1f); 824 } | 815 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 816 if (ifma->ifma_addr->sa_family != AF_LINK) 817 continue; 818 crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) 819 ifma->ifma_addr), ETHER_ADDR_LEN); 820 /* Just want the 6 least significant bits. */ 821 crc &= 0x3f; 822 /* Set the corresponding bit in the hash table. */ 823 hashes[crc >> 5] |= 1 << (crc & 0x1f); 824 } |
825 IF_ADDR_UNLOCK(ifp); | 825 if_maddr_runlock(ifp); |
826 if (hashes[0] != 0 || hashes[1] != 0) 827 mode |= YU_RCR_MUFLEN; 828 } 829 830 SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff); 831 SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff); 832 SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff); 833 SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff); --- 2986 unchanged lines hidden --- | 826 if (hashes[0] != 0 || hashes[1] != 0) 827 mode |= YU_RCR_MUFLEN; 828 } 829 830 SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff); 831 SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff); 832 SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff); 833 SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff); --- 2986 unchanged lines hidden --- |