Pull up following revision(s) (requested by msaitoh in ticket #662): sys/dev/pcmcia/if_xi.c: revision 1.93 sys/arch/x86/pci/if_vmx.c: revision 1.54 sys/dev/pci/if_de.c: revision 1.165 sys/arch/arm/ti/if_cpsw.c: revision 1.10 sys/arch/arm/omap/if_cpsw.c: revision 1.26 sys/dev/isa/if_iy.c: revision 1.112 sys/dev/pcmcia/if_ray.c: revision 1.96 Add ETHER_LOCK() and ETHER_UNLOCK() to protect ec_multiaddrs. XXX These drivers don't check whether enm_addrlo and enm_addrhi are the same or not, so it won't work correctly if an multicast address entry has a range. Protect ec_multicnt.diff -r1.25 -r1.25.2.1 src/sys/arch/arm/omap/if_cpsw.c
(martin)
--- src/sys/arch/arm/omap/Attic/if_cpsw.c 2019/05/29 06:17:27 1.25
+++ src/sys/arch/arm/omap/Attic/if_cpsw.c 2020/01/28 11:01:37 1.25.2.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $ */ | 1 | /* $NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2013 Jonathan A. Kollasch | 4 | * Copyright (c) 2013 Jonathan A. Kollasch | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -43,27 +43,27 @@ | @@ -43,27 +43,27 @@ | |||
43 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 43 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
44 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 44 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
46 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 46 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
47 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 47 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
48 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 48 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
50 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 50 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
51 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 51 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
52 | * SUCH DAMAGE. | 52 | * SUCH DAMAGE. | |
53 | */ | 53 | */ | |
54 | 54 | |||
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $"); | 56 | __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $"); | |
57 | 57 | |||
58 | #include <sys/param.h> | 58 | #include <sys/param.h> | |
59 | #include <sys/bus.h> | 59 | #include <sys/bus.h> | |
60 | #include <sys/device.h> | 60 | #include <sys/device.h> | |
61 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> | |
62 | #include <sys/intr.h> | 62 | #include <sys/intr.h> | |
63 | #include <sys/kmem.h> | 63 | #include <sys/kmem.h> | |
64 | #include <sys/mutex.h> | 64 | #include <sys/mutex.h> | |
65 | #include <sys/systm.h> | 65 | #include <sys/systm.h> | |
66 | #include <sys/kernel.h> | 66 | #include <sys/kernel.h> | |
67 | 67 | |||
68 | #include <net/if.h> | 68 | #include <net/if.h> | |
69 | #include <net/if_ether.h> | 69 | #include <net/if_ether.h> | |
@@ -1533,19 +1533,21 @@ cpsw_ale_update_addresses(struct cpsw_so | @@ -1533,19 +1533,21 @@ cpsw_ale_update_addresses(struct cpsw_so | |||
1533 | cpsw_ale_entry_init(ale_entry); | 1533 | cpsw_ale_entry_init(ale_entry); | |
1534 | cpsw_ale_entry_set_bcast_mac(ale_entry); | 1534 | cpsw_ale_entry_set_bcast_mac(ale_entry); | |
1535 | cpsw_ale_entry_set(ale_entry, ALE_ENTRY_TYPE, ALE_TYPE_ADDRESS); | 1535 | cpsw_ale_entry_set(ale_entry, ALE_ENTRY_TYPE, ALE_TYPE_ADDRESS); | |
1536 | cpsw_ale_entry_set(ale_entry, ALE_MCAST_FWD_STATE, ALE_FWSTATE_FWONLY); | 1536 | cpsw_ale_entry_set(ale_entry, ALE_MCAST_FWD_STATE, ALE_FWSTATE_FWONLY); | |
1537 | cpsw_ale_entry_set(ale_entry, ALE_PORT_MASK, ALE_PORT_MASK_ALL); | 1537 | cpsw_ale_entry_set(ale_entry, ALE_PORT_MASK, ALE_PORT_MASK_ALL); | |
1538 | cpsw_ale_write_entry(sc, 1, ale_entry); | 1538 | cpsw_ale_write_entry(sc, 1, ale_entry); | |
1539 | 1539 | |||
1540 | /* SIOCDELMULTI doesn't specify the particular address | 1540 | /* SIOCDELMULTI doesn't specify the particular address | |
1541 | being removed, so we have to remove all and rebuild. */ | 1541 | being removed, so we have to remove all and rebuild. */ | |
1542 | if (purge) | 1542 | if (purge) | |
1543 | cpsw_ale_remove_all_mc_entries(sc); | 1543 | cpsw_ale_remove_all_mc_entries(sc); | |
1544 | 1544 | |||
1545 | /* Set other multicast addrs desired. */ | 1545 | /* Set other multicast addrs desired. */ | |
1546 | ETHER_LOCK(ec); | |||
1546 | LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) { | 1547 | LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) { | |
1547 | cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo); | 1548 | cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo); | |
1548 | } | 1549 | } | |
1550 | ETHER_UNLOCK(ec); | |||
1549 | 1551 | |||
1550 | return 0; | 1552 | return 0; | |
1551 | } | 1553 | } |
--- src/sys/arch/arm/ti/if_cpsw.c 2019/11/27 13:46:45 1.6.2.1
+++ src/sys/arch/arm/ti/if_cpsw.c 2020/01/28 11:01:37 1.6.2.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $ */ | 1 | /* $NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2013 Jonathan A. Kollasch | 4 | * Copyright (c) 2013 Jonathan A. Kollasch | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -43,27 +43,27 @@ | @@ -43,27 +43,27 @@ | |||
43 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 43 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
44 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 44 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 45 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
46 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 46 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
47 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 47 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
48 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 48 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
50 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 50 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
51 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 51 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
52 | * SUCH DAMAGE. | 52 | * SUCH DAMAGE. | |
53 | */ | 53 | */ | |
54 | 54 | |||
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $"); | 56 | __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $"); | |
57 | 57 | |||
58 | #include <sys/param.h> | 58 | #include <sys/param.h> | |
59 | #include <sys/bus.h> | 59 | #include <sys/bus.h> | |
60 | #include <sys/device.h> | 60 | #include <sys/device.h> | |
61 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> | |
62 | #include <sys/intr.h> | 62 | #include <sys/intr.h> | |
63 | #include <sys/kmem.h> | 63 | #include <sys/kmem.h> | |
64 | #include <sys/mutex.h> | 64 | #include <sys/mutex.h> | |
65 | #include <sys/systm.h> | 65 | #include <sys/systm.h> | |
66 | #include <sys/kernel.h> | 66 | #include <sys/kernel.h> | |
67 | 67 | |||
68 | #include <net/if.h> | 68 | #include <net/if.h> | |
69 | #include <net/if_ether.h> | 69 | #include <net/if_ether.h> | |
@@ -1545,19 +1545,21 @@ cpsw_ale_update_addresses(struct cpsw_so | @@ -1545,19 +1545,21 @@ cpsw_ale_update_addresses(struct cpsw_so | |||
1545 | cpsw_ale_entry_init(ale_entry); | 1545 | cpsw_ale_entry_init(ale_entry); | |
1546 | cpsw_ale_entry_set_bcast_mac(ale_entry); | 1546 | cpsw_ale_entry_set_bcast_mac(ale_entry); | |
1547 | cpsw_ale_entry_set(ale_entry, ALE_ENTRY_TYPE, ALE_TYPE_ADDRESS); | 1547 | cpsw_ale_entry_set(ale_entry, ALE_ENTRY_TYPE, ALE_TYPE_ADDRESS); | |
1548 | cpsw_ale_entry_set(ale_entry, ALE_MCAST_FWD_STATE, ALE_FWSTATE_FWONLY); | 1548 | cpsw_ale_entry_set(ale_entry, ALE_MCAST_FWD_STATE, ALE_FWSTATE_FWONLY); | |
1549 | cpsw_ale_entry_set(ale_entry, ALE_PORT_MASK, ALE_PORT_MASK_ALL); | 1549 | cpsw_ale_entry_set(ale_entry, ALE_PORT_MASK, ALE_PORT_MASK_ALL); | |
1550 | cpsw_ale_write_entry(sc, 1, ale_entry); | 1550 | cpsw_ale_write_entry(sc, 1, ale_entry); | |
1551 | 1551 | |||
1552 | /* SIOCDELMULTI doesn't specify the particular address | 1552 | /* SIOCDELMULTI doesn't specify the particular address | |
1553 | being removed, so we have to remove all and rebuild. */ | 1553 | being removed, so we have to remove all and rebuild. */ | |
1554 | if (purge) | 1554 | if (purge) | |
1555 | cpsw_ale_remove_all_mc_entries(sc); | 1555 | cpsw_ale_remove_all_mc_entries(sc); | |
1556 | 1556 | |||
1557 | /* Set other multicast addrs desired. */ | 1557 | /* Set other multicast addrs desired. */ | |
1558 | ETHER_LOCK(ec); | |||
1558 | LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) { | 1559 | LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) { | |
1559 | cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo); | 1560 | cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo); | |
1560 | } | 1561 | } | |
1562 | ETHER_UNLOCK(ec); | |||
1561 | 1563 | |||
1562 | return 0; | 1564 | return 0; | |
1563 | } | 1565 | } |
--- src/sys/arch/x86/pci/Attic/if_vmx.c 2019/12/26 20:19:37 1.45.2.5
+++ src/sys/arch/x86/pci/Attic/if_vmx.c 2020/01/28 11:01:37 1.45.2.6
@@ -1,35 +1,35 @@ | @@ -1,35 +1,35 @@ | |||
1 | /* $NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $ */ | 1 | /* $NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $ */ | |
2 | /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ | 2 | /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2013 Tsubai Masanari | 5 | * Copyright (c) 2013 Tsubai Masanari | |
6 | * Copyright (c) 2013 Bryan Venteicher <bryanv@FreeBSD.org> | 6 | * Copyright (c) 2013 Bryan Venteicher <bryanv@FreeBSD.org> | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
19 | */ | 19 | */ | |
20 | 20 | |||
21 | #include <sys/cdefs.h> | 21 | #include <sys/cdefs.h> | |
22 | __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $"); | 22 | __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $"); | |
23 | 23 | |||
24 | #include <sys/param.h> | 24 | #include <sys/param.h> | |
25 | #include <sys/cpu.h> | 25 | #include <sys/cpu.h> | |
26 | #include <sys/kernel.h> | 26 | #include <sys/kernel.h> | |
27 | #include <sys/kmem.h> | 27 | #include <sys/kmem.h> | |
28 | #include <sys/bus.h> | 28 | #include <sys/bus.h> | |
29 | #include <sys/device.h> | 29 | #include <sys/device.h> | |
30 | #include <sys/mbuf.h> | 30 | #include <sys/mbuf.h> | |
31 | #include <sys/sockio.h> | 31 | #include <sys/sockio.h> | |
32 | #include <sys/pcq.h> | 32 | #include <sys/pcq.h> | |
33 | #include <sys/workqueue.h> | 33 | #include <sys/workqueue.h> | |
34 | #include <sys/interrupt.h> | 34 | #include <sys/interrupt.h> | |
35 | 35 | |||
@@ -3310,63 +3310,61 @@ vmxnet3_set_rxfilter(struct vmxnet3_soft | @@ -3310,63 +3310,61 @@ vmxnet3_set_rxfilter(struct vmxnet3_soft | |||
3310 | uint8_t *p; | 3310 | uint8_t *p; | |
3311 | 3311 | |||
3312 | ds->mcast_tablelen = 0; | 3312 | ds->mcast_tablelen = 0; | |
3313 | ETHER_LOCK(ec); | 3313 | ETHER_LOCK(ec); | |
3314 | CLR(ec->ec_flags, ETHER_F_ALLMULTI); | 3314 | CLR(ec->ec_flags, ETHER_F_ALLMULTI); | |
3315 | ETHER_UNLOCK(ec); | 3315 | ETHER_UNLOCK(ec); | |
3316 | 3316 | |||
3317 | /* | 3317 | /* | |
3318 | * Always accept broadcast frames. | 3318 | * Always accept broadcast frames. | |
3319 | * Always accept frames destined to our station address. | 3319 | * Always accept frames destined to our station address. | |
3320 | */ | 3320 | */ | |
3321 | mode = VMXNET3_RXMODE_BCAST | VMXNET3_RXMODE_UCAST; | 3321 | mode = VMXNET3_RXMODE_BCAST | VMXNET3_RXMODE_UCAST; | |
3322 | 3322 | |||
3323 | ETHER_LOCK(ec); | |||
3323 | if (ISSET(ifp->if_flags, IFF_PROMISC) || | 3324 | if (ISSET(ifp->if_flags, IFF_PROMISC) || | |
3324 | ec->ec_multicnt > VMXNET3_MULTICAST_MAX) | 3325 | ec->ec_multicnt > VMXNET3_MULTICAST_MAX) | |
3325 | goto allmulti; | 3326 | goto allmulti; | |
3326 | 3327 | |||
3327 | p = sc->vmx_mcast; | 3328 | p = sc->vmx_mcast; | |
3328 | ETHER_LOCK(ec); | |||
3329 | ETHER_FIRST_MULTI(step, ec, enm); | 3329 | ETHER_FIRST_MULTI(step, ec, enm); | |
3330 | while (enm != NULL) { | 3330 | while (enm != NULL) { | |
3331 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { | 3331 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { | |
3332 | ETHER_UNLOCK(ec); | |||
3333 | /* | 3332 | /* | |
3334 | * We must listen to a range of multicast addresses. | 3333 | * We must listen to a range of multicast addresses. | |
3335 | * For now, just accept all multicasts, rather than | 3334 | * For now, just accept all multicasts, rather than | |
3336 | * trying to set only those filter bits needed to match | 3335 | * trying to set only those filter bits needed to match | |
3337 | * the range. (At this time, the only use of address | 3336 | * the range. (At this time, the only use of address | |
3338 | * ranges is for IP multicast routing, for which the | 3337 | * ranges is for IP multicast routing, for which the | |
3339 | * range is big enough to require all bits set.) | 3338 | * range is big enough to require all bits set.) | |
3340 | */ | 3339 | */ | |
3341 | goto allmulti; | 3340 | goto allmulti; | |
3342 | } | 3341 | } | |
3343 | memcpy(p, enm->enm_addrlo, ETHER_ADDR_LEN); | 3342 | memcpy(p, enm->enm_addrlo, ETHER_ADDR_LEN); | |
3344 | 3343 | |||
3345 | p += ETHER_ADDR_LEN; | 3344 | p += ETHER_ADDR_LEN; | |
3346 | 3345 | |||
3347 | ETHER_NEXT_MULTI(step, enm); | 3346 | ETHER_NEXT_MULTI(step, enm); | |
3348 | } | 3347 | } | |
3349 | ETHER_UNLOCK(ec); | |||
3350 | 3348 | |||
3351 | if (ec->ec_multicnt > 0) { | 3349 | if (ec->ec_multicnt > 0) { | |
3352 | SET(mode, VMXNET3_RXMODE_MCAST); | 3350 | SET(mode, VMXNET3_RXMODE_MCAST); | |
3353 | ds->mcast_tablelen = p - sc->vmx_mcast; | 3351 | ds->mcast_tablelen = p - sc->vmx_mcast; | |
3354 | } | 3352 | } | |
3353 | ETHER_UNLOCK(ec); | |||
3355 | 3354 | |||
3356 | goto setit; | 3355 | goto setit; | |
3357 | 3356 | |||
3358 | allmulti: | 3357 | allmulti: | |
3359 | ETHER_LOCK(ec); | |||
3360 | SET(ec->ec_flags, ETHER_F_ALLMULTI); | 3358 | SET(ec->ec_flags, ETHER_F_ALLMULTI); | |
3361 | ETHER_UNLOCK(ec); | 3359 | ETHER_UNLOCK(ec); | |
3362 | SET(mode, (VMXNET3_RXMODE_ALLMULTI | VMXNET3_RXMODE_MCAST)); | 3360 | SET(mode, (VMXNET3_RXMODE_ALLMULTI | VMXNET3_RXMODE_MCAST)); | |
3363 | if (ifp->if_flags & IFF_PROMISC) | 3361 | if (ifp->if_flags & IFF_PROMISC) | |
3364 | SET(mode, VMXNET3_RXMODE_PROMISC); | 3362 | SET(mode, VMXNET3_RXMODE_PROMISC); | |
3365 | 3363 | |||
3366 | setit: | 3364 | setit: | |
3367 | vmxnet3_write_cmd(sc, VMXNET3_CMD_SET_FILTER); | 3365 | vmxnet3_write_cmd(sc, VMXNET3_CMD_SET_FILTER); | |
3368 | ds->rxmode = mode; | 3366 | ds->rxmode = mode; | |
3369 | vmxnet3_write_cmd(sc, VMXNET3_CMD_SET_RXMODE); | 3367 | vmxnet3_write_cmd(sc, VMXNET3_CMD_SET_RXMODE); | |
3370 | } | 3368 | } | |
3371 | 3369 | |||
3372 | int | 3370 | int |
--- src/sys/dev/isa/if_iy.c 2019/11/14 15:38:02 1.109.2.1
+++ src/sys/dev/isa/if_iy.c 2020/01/28 11:01:37 1.109.2.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_iy.c,v 1.109.2.1 2019/11/14 15:38:02 martin Exp $ */ | 1 | /* $NetBSD: if_iy.c,v 1.109.2.2 2020/01/28 11:01:37 martin Exp $ */ | |
2 | /* #define IYDEBUG */ | 2 | /* #define IYDEBUG */ | |
3 | /* #define IYMEMDEBUG */ | 3 | /* #define IYMEMDEBUG */ | |
4 | 4 | |||
5 | /*- | 5 | /*- | |
6 | * Copyright (c) 1996,2001 The NetBSD Foundation, Inc. | 6 | * Copyright (c) 1996,2001 The NetBSD Foundation, Inc. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to The NetBSD Foundation | 9 | * This code is derived from software contributed to The NetBSD Foundation | |
10 | * by Ignatios Souvatzis. | 10 | * by Ignatios Souvatzis. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -29,27 +29,27 @@ | @@ -29,27 +29,27 @@ | |||
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 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 THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * Supported hardware: | 35 | * Supported hardware: | |
36 | * | 36 | * | |
37 | * - Intel EtherExpress Pro/10. | 37 | * - Intel EtherExpress Pro/10. | |
38 | * - possibly other boards using the i82595 chip and no special tweaks. | 38 | * - possibly other boards using the i82595 chip and no special tweaks. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.109.2.1 2019/11/14 15:38:02 martin Exp $"); | 42 | __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.109.2.2 2020/01/28 11:01:37 martin Exp $"); | |
43 | 43 | |||
44 | #include "opt_inet.h" | 44 | #include "opt_inet.h" | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/mbuf.h> | 48 | #include <sys/mbuf.h> | |
49 | #include <sys/buf.h> | 49 | #include <sys/buf.h> | |
50 | #include <sys/protosw.h> | 50 | #include <sys/protosw.h> | |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> | |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> | |
53 | #include <sys/errno.h> | 53 | #include <sys/errno.h> | |
54 | #include <sys/syslog.h> | 54 | #include <sys/syslog.h> | |
55 | #include <sys/device.h> | 55 | #include <sys/device.h> | |
@@ -1295,52 +1295,52 @@ iy_mc_setup(struct iy_softc *sc) | @@ -1295,52 +1295,52 @@ iy_mc_setup(struct iy_softc *sc) | |||
1295 | bus_space_handle_t ioh; | 1295 | bus_space_handle_t ioh; | |
1296 | int avail, last /*, end*/ , len; | 1296 | int avail, last /*, end*/ , len; | |
1297 | int timeout; | 1297 | int timeout; | |
1298 | volatile uint16_t dum; | 1298 | volatile uint16_t dum; | |
1299 | uint8_t temp; | 1299 | uint8_t temp; | |
1300 | 1300 | |||
1301 | 1301 | |||
1302 | ecp = &sc->sc_ethercom; | 1302 | ecp = &sc->sc_ethercom; | |
1303 | ifp = &ecp->ec_if; | 1303 | ifp = &ecp->ec_if; | |
1304 | 1304 | |||
1305 | iot = sc->sc_iot; | 1305 | iot = sc->sc_iot; | |
1306 | ioh = sc->sc_ioh; | 1306 | ioh = sc->sc_ioh; | |
1307 | 1307 | |||
1308 | ETHER_LOCK(ecp); | |||
1308 | len = 6 * ecp->ec_multicnt; | 1309 | len = 6 * ecp->ec_multicnt; | |
1309 | 1310 | |||
1310 | avail = sc->tx_start - sc->tx_end; | 1311 | avail = sc->tx_start - sc->tx_end; | |
1311 | if (avail <= 0) | 1312 | if (avail <= 0) | |
1312 | avail += sc->tx_size; | 1313 | avail += sc->tx_size; | |
1313 | if (ifp->if_flags & IFF_DEBUG) | 1314 | if (ifp->if_flags & IFF_DEBUG) | |
1314 | printf("%s: iy_mc_setup called, %d addresses, " | 1315 | printf("%s: iy_mc_setup called, %d addresses, " | |
1315 | "%d/%d bytes needed/avail\n", ifp->if_xname, | 1316 | "%d/%d bytes needed/avail\n", ifp->if_xname, | |
1316 | ecp->ec_multicnt, len + I595_XMT_HDRLEN, avail); | 1317 | ecp->ec_multicnt, len + I595_XMT_HDRLEN, avail); | |
1317 | 1318 | |||
1318 | last = sc->rx_size; | 1319 | last = sc->rx_size; | |
1319 | 1320 | |||
1320 | bus_space_write_1(iot, ioh, 0, BANK_SEL(2)); | 1321 | bus_space_write_1(iot, ioh, 0, BANK_SEL(2)); | |
1321 | bus_space_write_1(iot, ioh, RECV_MODES_REG, MATCH_BRDCST); | 1322 | bus_space_write_1(iot, ioh, RECV_MODES_REG, MATCH_BRDCST); | |
1322 | /* XXX VOODOO */ | 1323 | /* XXX VOODOO */ | |
1323 | temp = bus_space_read_1(iot, ioh, MEDIA_SELECT); | 1324 | temp = bus_space_read_1(iot, ioh, MEDIA_SELECT); | |
1324 | bus_space_write_1(iot, ioh, MEDIA_SELECT, temp); | 1325 | bus_space_write_1(iot, ioh, MEDIA_SELECT, temp); | |
1325 | /* XXX END OF VOODOO */ | 1326 | /* XXX END OF VOODOO */ | |
1326 | bus_space_write_1(iot, ioh, 0, BANK_SEL(0)); | 1327 | bus_space_write_1(iot, ioh, 0, BANK_SEL(0)); | |
1327 | bus_space_write_2(iot, ioh, HOST_ADDR_REG, last); | 1328 | bus_space_write_2(iot, ioh, HOST_ADDR_REG, last); | |
1328 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(MC_SETUP_CMD)); | 1329 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(MC_SETUP_CMD)); | |
1329 | bus_space_write_2(iot, ioh, MEM_PORT_REG, 0); | 1330 | bus_space_write_2(iot, ioh, MEM_PORT_REG, 0); | |
1330 | bus_space_write_2(iot, ioh, MEM_PORT_REG, 0); | 1331 | bus_space_write_2(iot, ioh, MEM_PORT_REG, 0); | |
1331 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(len)); | 1332 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(len)); | |
1332 | 1333 | |||
1333 | ETHER_LOCK(ecp); | |||
1334 | ETHER_FIRST_MULTI(step, ecp, enm); | 1334 | ETHER_FIRST_MULTI(step, ecp, enm); | |
1335 | while (enm) { | 1335 | while (enm) { | |
1336 | /* | 1336 | /* | |
1337 | * XXX ALIGNMENT LOSSAGE HERE? | 1337 | * XXX ALIGNMENT LOSSAGE HERE? | |
1338 | */ | 1338 | */ | |
1339 | bus_space_write_multi_stream_2(iot, ioh, MEM_PORT_REG, | 1339 | bus_space_write_multi_stream_2(iot, ioh, MEM_PORT_REG, | |
1340 | (uint16_t *) enm->enm_addrlo, 3); | 1340 | (uint16_t *) enm->enm_addrlo, 3); | |
1341 | 1341 | |||
1342 | ETHER_NEXT_MULTI(step, enm); | 1342 | ETHER_NEXT_MULTI(step, enm); | |
1343 | } | 1343 | } | |
1344 | ETHER_UNLOCK(ecp); | 1344 | ETHER_UNLOCK(ecp); | |
1345 | dum = bus_space_read_2(iot, ioh, MEM_PORT_REG); /* dummy read */ | 1345 | dum = bus_space_read_2(iot, ioh, MEM_PORT_REG); /* dummy read */ | |
1346 | __USE(dum); | 1346 | __USE(dum); |
--- src/sys/dev/pci/Attic/if_de.c 2019/05/29 10:07:29 1.163
+++ src/sys/dev/pci/Attic/if_de.c 2020/01/28 11:01:37 1.163.2.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $ */ | 1 | /* $NetBSD: if_de.c,v 1.163.2.1 2020/01/28 11:01:37 martin Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) | 4 | * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. The name of the author may not be used to endorse or promote products | 12 | * 2. The name of the author may not be used to endorse or promote products | |
13 | * derived from this software without specific prior written permission | 13 | * derived from this software without specific prior written permission | |
14 | * | 14 | * | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * | 27 | * | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | /* | 30 | /* | |
31 | * DEC 21040 PCI Ethernet Controller | 31 | * DEC 21040 PCI Ethernet Controller | |
32 | * | 32 | * | |
33 | * Written by Matt Thomas | 33 | * Written by Matt Thomas | |
34 | * BPF support code stolen directly from if_ec.c | 34 | * BPF support code stolen directly from if_ec.c | |
35 | * | 35 | * | |
36 | * This driver supports the DEC DE435 or any other PCI | 36 | * This driver supports the DEC DE435 or any other PCI | |
37 | * board which support 21040, 21041, or 21140 (mostly). | 37 | * board which support 21040, 21041, or 21140 (mostly). | |
38 | */ | 38 | */ | |
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.163.2.1 2020/01/28 11:01:37 martin Exp $"); | |
41 | 41 | |||
42 | #define TULIP_HDR_DATA | 42 | #define TULIP_HDR_DATA | |
43 | 43 | |||
44 | #ifdef __NetBSD__ | 44 | #ifdef __NetBSD__ | |
45 | #include "opt_inet.h" | 45 | #include "opt_inet.h" | |
46 | #endif | 46 | #endif | |
47 | 47 | |||
48 | #include <sys/param.h> | 48 | #include <sys/param.h> | |
49 | #include <sys/systm.h> | 49 | #include <sys/systm.h> | |
50 | #include <sys/callout.h> | 50 | #include <sys/callout.h> | |
51 | #include <sys/mbuf.h> | 51 | #include <sys/mbuf.h> | |
52 | #include <sys/protosw.h> | 52 | #include <sys/protosw.h> | |
53 | #include <sys/socket.h> | 53 | #include <sys/socket.h> | |
@@ -3208,65 +3208,64 @@ tulip_addr_filter(tulip_softc_t * const | @@ -3208,65 +3208,64 @@ tulip_addr_filter(tulip_softc_t * const | |||
3208 | struct ethercom *ec = TULIP_ETHERCOM(sc); | 3208 | struct ethercom *ec = TULIP_ETHERCOM(sc); | |
3209 | struct ether_multistep step; | 3209 | struct ether_multistep step; | |
3210 | struct ether_multi *enm; | 3210 | struct ether_multi *enm; | |
3211 | 3211 | |||
3212 | sc->tulip_flags | 3212 | sc->tulip_flags | |
3213 | &= ~(TULIP_WANTHASHPERFECT | TULIP_WANTHASHONLY | TULIP_ALLMULTI); | 3213 | &= ~(TULIP_WANTHASHPERFECT | TULIP_WANTHASHONLY | TULIP_ALLMULTI); | |
3214 | sc->tulip_flags |= TULIP_WANTSETUP | TULIP_WANTTXSTART; | 3214 | sc->tulip_flags |= TULIP_WANTSETUP | TULIP_WANTTXSTART; | |
3215 | sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; | 3215 | sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; | |
3216 | sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; | 3216 | sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; | |
3217 | #if defined(IFF_ALLMULTI) | 3217 | #if defined(IFF_ALLMULTI) | |
3218 | sc->tulip_if.if_flags &= ~IFF_ALLMULTI; | 3218 | sc->tulip_if.if_flags &= ~IFF_ALLMULTI; | |
3219 | #endif | 3219 | #endif | |
3220 | sc->tulip_if.if_start = tulip_ifstart; /* so the setup packet gets queued */ | 3220 | sc->tulip_if.if_start = tulip_ifstart; /* so the setup packet gets queued */ | |
3221 | ETHER_LOCK(ec); | |||
3221 | if (sc->tulip_multicnt > 14) { | 3222 | if (sc->tulip_multicnt > 14) { | |
3222 | uint32_t *sp = sc->tulip_setupdata; | 3223 | uint32_t *sp = sc->tulip_setupdata; | |
3223 | unsigned hash; | 3224 | unsigned hash; | |
3224 | /* | 3225 | /* | |
3225 | * Some early passes of the 21140 have broken implementations | 3226 | * Some early passes of the 21140 have broken implementations | |
3226 | * of hash-perfect mode. When we get too many multicasts for | 3227 | * of hash-perfect mode. When we get too many multicasts for | |
3227 | * perfect filtering with these chips, we need to switch into | 3228 | * perfect filtering with these chips, we need to switch into | |
3228 | * hash-only mode (this is better than all-multicast on network | 3229 | * hash-only mode (this is better than all-multicast on network | |
3229 | * with lots of multicast traffic). | 3230 | * with lots of multicast traffic). | |
3230 | */ | 3231 | */ | |
3231 | if (sc->tulip_features & TULIP_HAVE_BROKEN_HASH) | 3232 | if (sc->tulip_features & TULIP_HAVE_BROKEN_HASH) | |
3232 | sc->tulip_flags |= TULIP_WANTHASHONLY; | 3233 | sc->tulip_flags |= TULIP_WANTHASHONLY; | |
3233 | else | 3234 | else | |
3234 | sc->tulip_flags |= TULIP_WANTHASHPERFECT; | 3235 | sc->tulip_flags |= TULIP_WANTHASHPERFECT; | |
3235 | /* | 3236 | /* | |
3236 | * If we have more than 14 multicasts, we have go into hash | 3237 | * If we have more than 14 multicasts, we have go into hash | |
3237 | * perfect mode (512 bit multicast hash and one perfect | 3238 | * perfect mode (512 bit multicast hash and one perfect | |
3238 | * hardware). | 3239 | * hardware). | |
3239 | */ | 3240 | */ | |
3240 | memset(sc->tulip_setupdata, 0, sizeof(sc->tulip_setupdata)); | 3241 | memset(sc->tulip_setupdata, 0, sizeof(sc->tulip_setupdata)); | |
3241 | ETHER_LOCK(ec); | |||
3242 | ETHER_FIRST_MULTI(step, ec, enm); | 3242 | ETHER_FIRST_MULTI(step, ec, enm); | |
3243 | while (enm != NULL) { | 3243 | while (enm != NULL) { | |
3244 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { | 3244 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { | |
3245 | hash = tulip_mchash(enm->enm_addrlo); | 3245 | hash = tulip_mchash(enm->enm_addrlo); | |
3246 | #if BYTE_ORDER == BIG_ENDIAN | 3246 | #if BYTE_ORDER == BIG_ENDIAN | |
3247 | sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); | 3247 | sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); | |
3248 | #else | 3248 | #else | |
3249 | sp[hash >> 4] |= 1 << (hash & 0xF); | 3249 | sp[hash >> 4] |= 1 << (hash & 0xF); | |
3250 | #endif | 3250 | #endif | |
3251 | } else { | 3251 | } else { | |
3252 | sc->tulip_flags |= TULIP_ALLMULTI; | 3252 | sc->tulip_flags |= TULIP_ALLMULTI; | |
3253 | sc->tulip_flags &= ~(TULIP_WANTHASHONLY | 3253 | sc->tulip_flags &= ~(TULIP_WANTHASHONLY | |
3254 | | TULIP_WANTHASHPERFECT); | 3254 | | TULIP_WANTHASHPERFECT); | |
3255 | break; | 3255 | break; | |
3256 | } | 3256 | } | |
3257 | ETHER_NEXT_MULTI(step, enm); | 3257 | ETHER_NEXT_MULTI(step, enm); | |
3258 | } | 3258 | } | |
3259 | ETHER_UNLOCK(ec); | |||
3260 | /* | 3259 | /* | |
3261 | * No reason to use a hash if we are going to be | 3260 | * No reason to use a hash if we are going to be | |
3262 | * receiving every multicast. | 3261 | * receiving every multicast. | |
3263 | */ | 3262 | */ | |
3264 | if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { | 3263 | if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { | |
3265 | hash = tulip_mchash(etherbroadcastaddr); | 3264 | hash = tulip_mchash(etherbroadcastaddr); | |
3266 | #if BYTE_ORDER == BIG_ENDIAN | 3265 | #if BYTE_ORDER == BIG_ENDIAN | |
3267 | sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); | 3266 | sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); | |
3268 | #else | 3267 | #else | |
3269 | sp[hash >> 4] |= 1 << (hash & 0xF); | 3268 | sp[hash >> 4] |= 1 << (hash & 0xF); | |
3270 | #endif | 3269 | #endif | |
3271 | if (sc->tulip_flags & TULIP_WANTHASHONLY) { | 3270 | if (sc->tulip_flags & TULIP_WANTHASHONLY) { | |
3272 | hash = tulip_mchash(sc->tulip_enaddr); | 3271 | hash = tulip_mchash(sc->tulip_enaddr); | |
@@ -3278,26 +3277,27 @@ tulip_addr_filter(tulip_softc_t * const | @@ -3278,26 +3277,27 @@ tulip_addr_filter(tulip_softc_t * const | |||
3278 | } else { | 3277 | } else { | |
3279 | #if BYTE_ORDER == BIG_ENDIAN | 3278 | #if BYTE_ORDER == BIG_ENDIAN | |
3280 | sp[39] = ((uint16_t *) sc->tulip_enaddr)[0] << 16; | 3279 | sp[39] = ((uint16_t *) sc->tulip_enaddr)[0] << 16; | |
3281 | sp[40] = ((uint16_t *) sc->tulip_enaddr)[1] << 16; | 3280 | sp[40] = ((uint16_t *) sc->tulip_enaddr)[1] << 16; | |
3282 | sp[41] = ((uint16_t *) sc->tulip_enaddr)[2] << 16; | 3281 | sp[41] = ((uint16_t *) sc->tulip_enaddr)[2] << 16; | |
3283 | #else | 3282 | #else | |
3284 | sp[39] = ((uint16_t *) sc->tulip_enaddr)[0]; | 3283 | sp[39] = ((uint16_t *) sc->tulip_enaddr)[0]; | |
3285 | sp[40] = ((uint16_t *) sc->tulip_enaddr)[1]; | 3284 | sp[40] = ((uint16_t *) sc->tulip_enaddr)[1]; | |
3286 | sp[41] = ((uint16_t *) sc->tulip_enaddr)[2]; | 3285 | sp[41] = ((uint16_t *) sc->tulip_enaddr)[2]; | |
3287 | #endif | 3286 | #endif | |
3288 | } | 3287 | } | |
3289 | } | 3288 | } | |
3290 | } | 3289 | } | |
3290 | ETHER_UNLOCK(ec); | |||
3291 | if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT | TULIP_WANTHASHONLY)) | 3291 | if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT | TULIP_WANTHASHONLY)) | |
3292 | == 0) { | 3292 | == 0) { | |
3293 | uint32_t *sp = sc->tulip_setupdata; | 3293 | uint32_t *sp = sc->tulip_setupdata; | |
3294 | int idx = 0; | 3294 | int idx = 0; | |
3295 | if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { | 3295 | if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { | |
3296 | /* | 3296 | /* | |
3297 | * Else can get perfect filtering for 16 addresses. | 3297 | * Else can get perfect filtering for 16 addresses. | |
3298 | */ | 3298 | */ | |
3299 | ETHER_LOCK(ec); | 3299 | ETHER_LOCK(ec); | |
3300 | ETHER_FIRST_MULTI(step, ec, enm); | 3300 | ETHER_FIRST_MULTI(step, ec, enm); | |
3301 | for (; enm != NULL; idx++) { | 3301 | for (; enm != NULL; idx++) { | |
3302 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { | 3302 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { | |
3303 | #if BYTE_ORDER == BIG_ENDIAN | 3303 | #if BYTE_ORDER == BIG_ENDIAN |
--- src/sys/dev/pcmcia/if_ray.c 2019/10/23 19:43:24 1.94.2.1
+++ src/sys/dev/pcmcia/if_ray.c 2020/01/28 11:01:37 1.94.2.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_ray.c,v 1.94.2.1 2019/10/23 19:43:24 martin Exp $ */ | 1 | /* $NetBSD: if_ray.c,v 1.94.2.2 2020/01/28 11:01:37 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2000 Christian E. Hopps | 4 | * Copyright (c) 2000 Christian E. Hopps | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * | 47 | * | |
48 | * N.B. Its unclear yet whether the Aviator 2.4 cards interoperate | 48 | * N.B. Its unclear yet whether the Aviator 2.4 cards interoperate | |
49 | * with other 802.11 FH 2Mbps cards, since this was also untested. | 49 | * with other 802.11 FH 2Mbps cards, since this was also untested. | |
50 | * Given the nature of the buggy build 4 firmware there may be problems. | 50 | * Given the nature of the buggy build 4 firmware there may be problems. | |
51 | * | 51 | * | |
52 | * Authentication added by Steve Weiss <srw@alum.mit.edu> based on | 52 | * Authentication added by Steve Weiss <srw@alum.mit.edu> based on | |
53 | * advice from Corey Thomas (author of the Linux RayLink driver). | 53 | * advice from Corey Thomas (author of the Linux RayLink driver). | |
54 | * Authentication is currently limited to adhoc networks, and was | 54 | * Authentication is currently limited to adhoc networks, and was | |
55 | * added to support a requirement of the newest Windows drivers for | 55 | * added to support a requirement of the newest Windows drivers for | |
56 | * the RayLink. Tested with Aviator Pro (firmware 5.63) on Win98. | 56 | * the RayLink. Tested with Aviator Pro (firmware 5.63) on Win98. | |
57 | */ | 57 | */ | |
58 | 58 | |||
59 | #include <sys/cdefs.h> | 59 | #include <sys/cdefs.h> | |
60 | __KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.94.2.1 2019/10/23 19:43:24 martin Exp $"); | 60 | __KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.94.2.2 2020/01/28 11:01:37 martin Exp $"); | |
61 | 61 | |||
62 | #include "opt_inet.h" | 62 | #include "opt_inet.h" | |
63 | 63 | |||
64 | #include <sys/param.h> | 64 | #include <sys/param.h> | |
65 | #include <sys/systm.h> | 65 | #include <sys/systm.h> | |
66 | #include <sys/callout.h> | 66 | #include <sys/callout.h> | |
67 | #include <sys/mbuf.h> | 67 | #include <sys/mbuf.h> | |
68 | #include <sys/socket.h> | 68 | #include <sys/socket.h> | |
69 | #include <sys/ioctl.h> | 69 | #include <sys/ioctl.h> | |
70 | #include <sys/errno.h> | 70 | #include <sys/errno.h> | |
71 | #include <sys/device.h> | 71 | #include <sys/device.h> | |
72 | #include <sys/kernel.h> | 72 | #include <sys/kernel.h> | |
73 | #include <sys/proc.h> | 73 | #include <sys/proc.h> | |
@@ -2814,41 +2814,41 @@ ray_update_params(struct ray_softc *sc) | @@ -2814,41 +2814,41 @@ ray_update_params(struct ray_softc *sc) | |||
2814 | static void | 2814 | static void | |
2815 | ray_update_mcast(struct ray_softc *sc) | 2815 | ray_update_mcast(struct ray_softc *sc) | |
2816 | { | 2816 | { | |
2817 | bus_size_t ccs; | 2817 | bus_size_t ccs; | |
2818 | struct ether_multistep step; | 2818 | struct ether_multistep step; | |
2819 | struct ether_multi *enm; | 2819 | struct ether_multi *enm; | |
2820 | struct ethercom *ec; | 2820 | struct ethercom *ec; | |
2821 | bus_size_t bufp; | 2821 | bus_size_t bufp; | |
2822 | int count; | 2822 | int count; | |
2823 | 2823 | |||
2824 | ec = &sc->sc_ec; | 2824 | ec = &sc->sc_ec; | |
2825 | ray_cmd_cancel(sc, SCP_UPD_MCAST); | 2825 | ray_cmd_cancel(sc, SCP_UPD_MCAST); | |
2826 | 2826 | |||
2827 | ETHER_LOCK(ec); | |||
2827 | /* see if we have any ranges */ | 2828 | /* see if we have any ranges */ | |
2828 | if ((count = sc->sc_ec.ec_multicnt) < 17) { | 2829 | if ((count = sc->sc_ec.ec_multicnt) < 17) { | |
2829 | ETHER_LOCK(ec); | |||
2830 | ETHER_FIRST_MULTI(step, ec, enm); | 2830 | ETHER_FIRST_MULTI(step, ec, enm); | |
2831 | while (enm) { | 2831 | while (enm) { | |
2832 | /* see if this is a range */ | 2832 | /* see if this is a range */ | |
2833 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, | 2833 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, | |
2834 | ETHER_ADDR_LEN)) { | 2834 | ETHER_ADDR_LEN)) { | |
2835 | count = 17; | 2835 | count = 17; | |
2836 | break; | 2836 | break; | |
2837 | } | 2837 | } | |
2838 | ETHER_NEXT_MULTI(step, enm); | 2838 | ETHER_NEXT_MULTI(step, enm); | |
2839 | } | 2839 | } | |
2840 | ETHER_UNLOCK(ec); | |||
2841 | } | 2840 | } | |
2841 | ETHER_UNLOCK(ec); | |||
2842 | 2842 | |||
2843 | /* track this stuff even when not running */ | 2843 | /* track this stuff even when not running */ | |
2844 | if (count > 16) { | 2844 | if (count > 16) { | |
2845 | sc->sc_if.if_flags |= IFF_ALLMULTI; | 2845 | sc->sc_if.if_flags |= IFF_ALLMULTI; | |
2846 | ray_update_promisc(sc); | 2846 | ray_update_promisc(sc); | |
2847 | return; | 2847 | return; | |
2848 | } else if (sc->sc_if.if_flags & IFF_ALLMULTI) { | 2848 | } else if (sc->sc_if.if_flags & IFF_ALLMULTI) { | |
2849 | sc->sc_if.if_flags &= ~IFF_ALLMULTI; | 2849 | sc->sc_if.if_flags &= ~IFF_ALLMULTI; | |
2850 | ray_update_promisc(sc); | 2850 | ray_update_promisc(sc); | |
2851 | } | 2851 | } | |
2852 | 2852 | |||
2853 | if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) | 2853 | if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) | |
2854 | return; | 2854 | return; |
--- src/sys/dev/pcmcia/if_xi.c 2019/11/06 09:59:38 1.90.2.1
+++ src/sys/dev/pcmcia/if_xi.c 2020/01/28 11:01:37 1.90.2.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_xi.c,v 1.90.2.1 2019/11/06 09:59:38 martin Exp $ */ | 1 | /* $NetBSD: if_xi.c,v 1.90.2.2 2020/01/28 11:01:37 martin Exp $ */ | |
2 | /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ | 2 | /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2004 Charles M. Hannum. All rights reserved. | 5 | * Copyright (c) 2004 Charles M. Hannum. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -45,27 +45,27 @@ | @@ -45,27 +45,27 @@ | |||
45 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 45 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
47 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 47 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
48 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 48 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
50 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
51 | */ | 51 | */ | |
52 | 52 | |||
53 | /* | 53 | /* | |
54 | * A driver for Xircom CreditCard PCMCIA Ethernet adapters. | 54 | * A driver for Xircom CreditCard PCMCIA Ethernet adapters. | |
55 | */ | 55 | */ | |
56 | 56 | |||
57 | #include <sys/cdefs.h> | 57 | #include <sys/cdefs.h> | |
58 | __KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.90.2.1 2019/11/06 09:59:38 martin Exp $"); | 58 | __KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.90.2.2 2020/01/28 11:01:37 martin Exp $"); | |
59 | 59 | |||
60 | #include "opt_inet.h" | 60 | #include "opt_inet.h" | |
61 | 61 | |||
62 | #include <sys/param.h> | 62 | #include <sys/param.h> | |
63 | #include <sys/systm.h> | 63 | #include <sys/systm.h> | |
64 | #include <sys/device.h> | 64 | #include <sys/device.h> | |
65 | #include <sys/ioctl.h> | 65 | #include <sys/ioctl.h> | |
66 | #include <sys/mbuf.h> | 66 | #include <sys/mbuf.h> | |
67 | #include <sys/malloc.h> | 67 | #include <sys/malloc.h> | |
68 | #include <sys/socket.h> | 68 | #include <sys/socket.h> | |
69 | #include <sys/kernel.h> | 69 | #include <sys/kernel.h> | |
70 | #include <sys/proc.h> | 70 | #include <sys/proc.h> | |
71 | 71 | |||
@@ -954,57 +954,56 @@ xi_set_address(struct xi_softc *sc) | @@ -954,57 +954,56 @@ xi_set_address(struct xi_softc *sc) | |||
954 | uint8_t indaddr[64]; | 954 | uint8_t indaddr[64]; | |
955 | 955 | |||
956 | DPRINTF(XID_CONFIG, ("xi_set_address()\n")); | 956 | DPRINTF(XID_CONFIG, ("xi_set_address()\n")); | |
957 | 957 | |||
958 | enaddr = (const uint8_t *)CLLADDR(ifp->if_sadl); | 958 | enaddr = (const uint8_t *)CLLADDR(ifp->if_sadl); | |
959 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | 959 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | |
960 | for (i = 0; i < 6; i++) | 960 | for (i = 0; i < 6; i++) | |
961 | indaddr[i] = enaddr[5 - i]; | 961 | indaddr[i] = enaddr[5 - i]; | |
962 | else | 962 | else | |
963 | for (i = 0; i < 6; i++) | 963 | for (i = 0; i < 6; i++) | |
964 | indaddr[i] = enaddr[i]; | 964 | indaddr[i] = enaddr[i]; | |
965 | num = 1; | 965 | num = 1; | |
966 | 966 | |||
967 | ETHER_LOCK(ec); | |||
967 | if (ec->ec_multicnt > 9) { | 968 | if (ec->ec_multicnt > 9) { | |
968 | ifp->if_flags |= IFF_ALLMULTI; | 969 | ifp->if_flags |= IFF_ALLMULTI; | |
969 | goto done; | 970 | goto done; | |
970 | } | 971 | } | |
971 | 972 | |||
972 | ETHER_LOCK(ec); | |||
973 | ETHER_FIRST_MULTI(step, ec, enm); | 973 | ETHER_FIRST_MULTI(step, ec, enm); | |
974 | for (; enm; num++) { | 974 | for (; enm; num++) { | |
975 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, | 975 | if (memcmp(enm->enm_addrlo, enm->enm_addrhi, | |
976 | sizeof(enm->enm_addrlo)) != 0) { | 976 | sizeof(enm->enm_addrlo)) != 0) { | |
977 | /* | 977 | /* | |
978 | * The multicast address is really a range; | 978 | * The multicast address is really a range; | |
979 | * it's easier just to accept all multicasts. | 979 | * it's easier just to accept all multicasts. | |
980 | * XXX should we be setting IFF_ALLMULTI here? | 980 | * XXX should we be setting IFF_ALLMULTI here? | |
981 | */ | 981 | */ | |
982 | ifp->if_flags |= IFF_ALLMULTI; | 982 | ifp->if_flags |= IFF_ALLMULTI; | |
983 | ETHER_UNLOCK(ec); | |||
984 | goto done; | 983 | goto done; | |
985 | } | 984 | } | |
986 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | 985 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | |
987 | for (i = 0; i < 6; i++) | 986 | for (i = 0; i < 6; i++) | |
988 | indaddr[num * 6 + i] = enm->enm_addrlo[5 - i]; | 987 | indaddr[num * 6 + i] = enm->enm_addrlo[5 - i]; | |
989 | else | 988 | else | |
990 | for (i = 0; i < 6; i++) | 989 | for (i = 0; i < 6; i++) | |
991 | indaddr[num * 6 + i] = enm->enm_addrlo[i]; | 990 | indaddr[num * 6 + i] = enm->enm_addrlo[i]; | |
992 | ETHER_NEXT_MULTI(step, enm); | 991 | ETHER_NEXT_MULTI(step, enm); | |
993 | } | 992 | } | |
994 | ETHER_UNLOCK(ec); | |||
995 | ifp->if_flags &= ~IFF_ALLMULTI; | 993 | ifp->if_flags &= ~IFF_ALLMULTI; | |
996 | 994 | |||
997 | done: | 995 | done: | |
996 | ETHER_UNLOCK(ec); | |||
998 | if (num < 10) | 997 | if (num < 10) | |
999 | memset(&indaddr[num * 6], 0xff, 6 * (10 - num)); | 998 | memset(&indaddr[num * 6], 0xff, 6 * (10 - num)); | |
1000 | 999 | |||
1001 | for (page = 0; page < 8; page++) { | 1000 | for (page = 0; page < 8; page++) { | |
1002 | #ifdef XIDEBUG | 1001 | #ifdef XIDEBUG | |
1003 | if (xidebug & XID_MCAST) { | 1002 | if (xidebug & XID_MCAST) { | |
1004 | printf("page %d before:", page); | 1003 | printf("page %d before:", page); | |
1005 | for (i = 0; i < 8; i++) | 1004 | for (i = 0; i < 8; i++) | |
1006 | printf(" %02x", indaddr[page * 8 + i]); | 1005 | printf(" %02x", indaddr[page * 8 + i]); | |
1007 | printf("\n"); | 1006 | printf("\n"); | |
1008 | } | 1007 | } | |
1009 | #endif | 1008 | #endif | |
1010 | 1009 |