usbnet: Take the core lock around uno_mcast. Every driver does this already. This will enable us to change the lock that serializes access to the registers so we can go back to doing this synchronously in SIOCADDMULTI/SIOCDELMULTI.diff -r1.176 -r1.177 src/sys/dev/usb/if_aue.c
(riastradh)
--- src/sys/dev/usb/if_aue.c 2022/03/03 05:52:35 1.176
+++ src/sys/dev/usb/if_aue.c 2022/03/03 05:52:46 1.177
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_aue.c,v 1.176 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_aue.c,v 1.177 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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. | |
@@ -66,27 +66,27 @@ | @@ -66,27 +66,27 @@ | |||
66 | /* | 66 | /* | |
67 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 67 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | /* | 70 | /* | |
71 | * TODO: | 71 | * TODO: | |
72 | * better error messages from rxstat | 72 | * better error messages from rxstat | |
73 | * more error checks | 73 | * more error checks | |
74 | * investigate short rx problem | 74 | * investigate short rx problem | |
75 | * proper cleanup on errors | 75 | * proper cleanup on errors | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | #include <sys/cdefs.h> | 78 | #include <sys/cdefs.h> | |
79 | __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.176 2022/03/03 05:52:35 riastradh Exp $"); | 79 | __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.177 2022/03/03 05:52:46 riastradh Exp $"); | |
80 | 80 | |||
81 | #ifdef _KERNEL_OPT | 81 | #ifdef _KERNEL_OPT | |
82 | #include "opt_usb.h" | 82 | #include "opt_usb.h" | |
83 | #include "opt_inet.h" | 83 | #include "opt_inet.h" | |
84 | #endif | 84 | #endif | |
85 | 85 | |||
86 | #include <sys/param.h> | 86 | #include <sys/param.h> | |
87 | 87 | |||
88 | #include <dev/usb/usbnet.h> | 88 | #include <dev/usb/usbnet.h> | |
89 | #include <dev/usb/usbhist.h> | 89 | #include <dev/usb/usbhist.h> | |
90 | #include <dev/usb/if_auereg.h> | 90 | #include <dev/usb/if_auereg.h> | |
91 | 91 | |||
92 | #ifdef INET | 92 | #ifdef INET | |
@@ -993,40 +993,37 @@ aue_uno_init(struct ifnet *ifp) | @@ -993,40 +993,37 @@ aue_uno_init(struct ifnet *ifp) | |||
993 | /* Enable RX and TX */ | 993 | /* Enable RX and TX */ | |
994 | aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB); | 994 | aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB); | |
995 | AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB); | 995 | AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB); | |
996 | AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR); | 996 | AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR); | |
997 | 997 | |||
998 | //mii_mediachg(mii); | 998 | //mii_mediachg(mii); | |
999 | 999 | |||
1000 | return rv; | 1000 | return rv; | |
1001 | } | 1001 | } | |
1002 | 1002 | |||
1003 | static void | 1003 | static void | |
1004 | aue_uno_mcast(struct ifnet *ifp) | 1004 | aue_uno_mcast(struct ifnet *ifp) | |
1005 | { | 1005 | { | |
1006 | struct usbnet * const un = ifp->if_softc; | |||
1007 | 1006 | |||
1008 | AUEHIST_FUNC(); | 1007 | AUEHIST_FUNC(); | |
1009 | AUEHIST_CALLARGSN(5, "aue%jd: enter", | 1008 | AUEHIST_CALLARGSN(5, "aue%jd: enter", | |
1010 | device_unit(((struct usbnet *)(ifp->if_softc))->un_dev), | 1009 | device_unit(((struct usbnet *)(ifp->if_softc))->un_dev), | |
1011 | 0, 0, 0); | 1010 | 0, 0, 0); | |
1012 | 1011 | |||
1013 | /* | 1012 | /* | |
1014 | * XXX I feel like this is pretty heavy-handed! Maybe we could | 1013 | * XXX I feel like this is pretty heavy-handed! Maybe we could | |
1015 | * make do with aue_setiff_locked instead? | 1014 | * make do with aue_setiff_locked instead? | |
1016 | */ | 1015 | */ | |
1017 | usbnet_lock_core(un); | |||
1018 | aue_uno_init(ifp); | 1016 | aue_uno_init(ifp); | |
1019 | usbnet_unlock_core(un); | |||
1020 | } | 1017 | } | |
1021 | 1018 | |||
1022 | static void | 1019 | static void | |
1023 | aue_uno_stop(struct ifnet *ifp, int disable) | 1020 | aue_uno_stop(struct ifnet *ifp, int disable) | |
1024 | { | 1021 | { | |
1025 | struct usbnet * const un = ifp->if_softc; | 1022 | struct usbnet * const un = ifp->if_softc; | |
1026 | struct aue_softc * const sc = usbnet_softc(un); | 1023 | struct aue_softc * const sc = usbnet_softc(un); | |
1027 | 1024 | |||
1028 | AUEHIST_FUNC(); | 1025 | AUEHIST_FUNC(); | |
1029 | AUEHIST_CALLARGSN(5, "aue%jd: enter", device_unit(un->un_dev), 0, 0, 0); | 1026 | AUEHIST_CALLARGSN(5, "aue%jd: enter", device_unit(un->un_dev), 0, 0, 0); | |
1030 | 1027 | |||
1031 | aue_csr_write_1(sc, AUE_CTL0, 0); | 1028 | aue_csr_write_1(sc, AUE_CTL0, 0); | |
1032 | aue_csr_write_1(sc, AUE_CTL1, 0); | 1029 | aue_csr_write_1(sc, AUE_CTL1, 0); |
--- src/sys/dev/usb/if_axe.c 2022/03/03 05:52:35 1.139
+++ src/sys/dev/usb/if_axe.c 2022/03/03 05:52:46 1.140
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_axe.c,v 1.139 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_axe.c,v 1.140 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */ | 2 | /* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> | 5 | * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -77,27 +77,27 @@ | @@ -77,27 +77,27 @@ | |||
77 | * (Adam Weinberger wanted me to name this driver if_gir.c.) | 77 | * (Adam Weinberger wanted me to name this driver if_gir.c.) | |
78 | */ | 78 | */ | |
79 | 79 | |||
80 | /* | 80 | /* | |
81 | * Ax88178 and Ax88772 support backported from the OpenBSD driver. | 81 | * Ax88178 and Ax88772 support backported from the OpenBSD driver. | |
82 | * 2007/02/12, J.R. Oldroyd, fbsd@opal.com | 82 | * 2007/02/12, J.R. Oldroyd, fbsd@opal.com | |
83 | * | 83 | * | |
84 | * Manual here: | 84 | * Manual here: | |
85 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88178_datasheet_Rev10.pdf | 85 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88178_datasheet_Rev10.pdf | |
86 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf | 86 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf | |
87 | */ | 87 | */ | |
88 | 88 | |||
89 | #include <sys/cdefs.h> | 89 | #include <sys/cdefs.h> | |
90 | __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.139 2022/03/03 05:52:35 riastradh Exp $"); | 90 | __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.140 2022/03/03 05:52:46 riastradh Exp $"); | |
91 | 91 | |||
92 | #ifdef _KERNEL_OPT | 92 | #ifdef _KERNEL_OPT | |
93 | #include "opt_usb.h" | 93 | #include "opt_usb.h" | |
94 | #include "opt_net_mpsafe.h" | 94 | #include "opt_net_mpsafe.h" | |
95 | #endif | 95 | #endif | |
96 | 96 | |||
97 | #include <sys/param.h> | 97 | #include <sys/param.h> | |
98 | 98 | |||
99 | #include <dev/usb/usbnet.h> | 99 | #include <dev/usb/usbnet.h> | |
100 | #include <dev/usb/usbhist.h> | 100 | #include <dev/usb/usbhist.h> | |
101 | #include <dev/usb/if_axereg.h> | 101 | #include <dev/usb/if_axereg.h> | |
102 | 102 | |||
103 | struct axe_type { | 103 | struct axe_type { | |
@@ -1301,31 +1301,27 @@ axe_uno_init(struct ifnet *ifp) | @@ -1301,31 +1301,27 @@ axe_uno_init(struct ifnet *ifp) | |||
1301 | axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); | 1301 | axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); | |
1302 | 1302 | |||
1303 | /* Accept multicast frame or run promisc. mode */ | 1303 | /* Accept multicast frame or run promisc. mode */ | |
1304 | axe_rcvfilt_locked(un); | 1304 | axe_rcvfilt_locked(un); | |
1305 | 1305 | |||
1306 | return usbnet_init_rx_tx(un); | 1306 | return usbnet_init_rx_tx(un); | |
1307 | } | 1307 | } | |
1308 | 1308 | |||
1309 | static void | 1309 | static void | |
1310 | axe_uno_mcast(struct ifnet *ifp) | 1310 | axe_uno_mcast(struct ifnet *ifp) | |
1311 | { | 1311 | { | |
1312 | struct usbnet * const un = ifp->if_softc; | 1312 | struct usbnet * const un = ifp->if_softc; | |
1313 | 1313 | |||
1314 | usbnet_lock_core(un); | |||
1315 | ||||
1316 | axe_rcvfilt_locked(un); | 1314 | axe_rcvfilt_locked(un); | |
1317 | ||||
1318 | usbnet_unlock_core(un); | |||
1319 | } | 1315 | } | |
1320 | 1316 | |||
1321 | static void | 1317 | static void | |
1322 | axe_uno_stop(struct ifnet *ifp, int disable) | 1318 | axe_uno_stop(struct ifnet *ifp, int disable) | |
1323 | { | 1319 | { | |
1324 | struct usbnet * const un = ifp->if_softc; | 1320 | struct usbnet * const un = ifp->if_softc; | |
1325 | 1321 | |||
1326 | axe_reset(un); | 1322 | axe_reset(un); | |
1327 | } | 1323 | } | |
1328 | 1324 | |||
1329 | #ifdef _MODULE | 1325 | #ifdef _MODULE | |
1330 | #include "ioconf.c" | 1326 | #include "ioconf.c" | |
1331 | #endif | 1327 | #endif |
--- src/sys/dev/usb/if_axen.c 2022/03/03 05:52:35 1.81
+++ src/sys/dev/usb/if_axen.c 2022/03/03 05:52:46 1.82
@@ -1,39 +1,39 @@ | @@ -1,39 +1,39 @@ | |||
1 | /* $NetBSD: if_axen.c,v 1.81 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_axen.c,v 1.82 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ | 2 | /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2013 Yojiro UO <yuo@openbsd.org> | 5 | * Copyright (c) 2013 Yojiro UO <yuo@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | /* | 20 | /* | |
21 | * ASIX Electronics AX88178a USB 2.0 ethernet and AX88179 USB 3.0 Ethernet | 21 | * ASIX Electronics AX88178a USB 2.0 ethernet and AX88179 USB 3.0 Ethernet | |
22 | * driver. | 22 | * driver. | |
23 | */ | 23 | */ | |
24 | 24 | |||
25 | #include <sys/cdefs.h> | 25 | #include <sys/cdefs.h> | |
26 | __KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.81 2022/03/03 05:52:35 riastradh Exp $"); | 26 | __KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.82 2022/03/03 05:52:46 riastradh Exp $"); | |
27 | 27 | |||
28 | #ifdef _KERNEL_OPT | 28 | #ifdef _KERNEL_OPT | |
29 | #include "opt_usb.h" | 29 | #include "opt_usb.h" | |
30 | #endif | 30 | #endif | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | 33 | |||
34 | #include <netinet/in.h> /* XXX for netinet/ip.h */ | 34 | #include <netinet/in.h> /* XXX for netinet/ip.h */ | |
35 | #include <netinet/ip.h> /* XXX for IP_MAXPACKET */ | 35 | #include <netinet/ip.h> /* XXX for IP_MAXPACKET */ | |
36 | 36 | |||
37 | #include <dev/usb/usbnet.h> | 37 | #include <dev/usb/usbnet.h> | |
38 | 38 | |||
39 | #include <dev/usb/if_axenreg.h> | 39 | #include <dev/usb/if_axenreg.h> | |
@@ -564,31 +564,27 @@ axen_uno_ioctl(struct ifnet *ifp, u_long | @@ -564,31 +564,27 @@ axen_uno_ioctl(struct ifnet *ifp, u_long | |||
564 | break; | 564 | break; | |
565 | } | 565 | } | |
566 | 566 | |||
567 | usbnet_unlock_core(un); | 567 | usbnet_unlock_core(un); | |
568 | 568 | |||
569 | return 0; | 569 | return 0; | |
570 | } | 570 | } | |
571 | 571 | |||
572 | static void | 572 | static void | |
573 | axen_uno_mcast(struct ifnet *ifp) | 573 | axen_uno_mcast(struct ifnet *ifp) | |
574 | { | 574 | { | |
575 | struct usbnet * const un = ifp->if_softc; | 575 | struct usbnet * const un = ifp->if_softc; | |
576 | 576 | |||
577 | usbnet_lock_core(un); | |||
578 | ||||
579 | axen_setiff_locked(un); | 577 | axen_setiff_locked(un); | |
580 | ||||
581 | usbnet_unlock_core(un); | |||
582 | } | 578 | } | |
583 | 579 | |||
584 | static int | 580 | static int | |
585 | axen_match(device_t parent, cfdata_t match, void *aux) | 581 | axen_match(device_t parent, cfdata_t match, void *aux) | |
586 | { | 582 | { | |
587 | struct usb_attach_arg *uaa = aux; | 583 | struct usb_attach_arg *uaa = aux; | |
588 | 584 | |||
589 | return axen_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | 585 | return axen_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | |
590 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 586 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
591 | } | 587 | } | |
592 | 588 | |||
593 | static void | 589 | static void | |
594 | axen_attach(device_t parent, device_t self, void *aux) | 590 | axen_attach(device_t parent, device_t self, void *aux) |
--- src/sys/dev/usb/if_cue.c 2022/03/03 05:52:35 1.97
+++ src/sys/dev/usb/if_cue.c 2022/03/03 05:52:46 1.98
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cue.c,v 1.97 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_cue.c,v 1.98 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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 | * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The | 47 | * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The | |
48 | * RX filter uses a 512-bit multicast hash table, single perfect entry | 48 | * RX filter uses a 512-bit multicast hash table, single perfect entry | |
49 | * for the station address, and promiscuous mode. Unlike the ADMtek | 49 | * for the station address, and promiscuous mode. Unlike the ADMtek | |
50 | * and KLSI chips, the CATC ASIC supports read and write combining | 50 | * and KLSI chips, the CATC ASIC supports read and write combining | |
51 | * mode where multiple packets can be transferred using a single bulk | 51 | * mode where multiple packets can be transferred using a single bulk | |
52 | * transaction, which helps performance a great deal. | 52 | * transaction, which helps performance a great deal. | |
53 | */ | 53 | */ | |
54 | 54 | |||
55 | /* | 55 | /* | |
56 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 56 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
57 | */ | 57 | */ | |
58 | 58 | |||
59 | #include <sys/cdefs.h> | 59 | #include <sys/cdefs.h> | |
60 | __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.97 2022/03/03 05:52:35 riastradh Exp $"); | 60 | __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.98 2022/03/03 05:52:46 riastradh Exp $"); | |
61 | 61 | |||
62 | #ifdef _KERNEL_OPT | 62 | #ifdef _KERNEL_OPT | |
63 | #include "opt_inet.h" | 63 | #include "opt_inet.h" | |
64 | #include "opt_usb.h" | 64 | #include "opt_usb.h" | |
65 | #endif | 65 | #endif | |
66 | 66 | |||
67 | #include <sys/param.h> | 67 | #include <sys/param.h> | |
68 | 68 | |||
69 | #include <dev/usb/usbnet.h> | 69 | #include <dev/usb/usbnet.h> | |
70 | #include <dev/usb/if_cuereg.h> | 70 | #include <dev/usb/if_cuereg.h> | |
71 | 71 | |||
72 | #ifdef INET | 72 | #ifdef INET | |
73 | #include <netinet/in.h> | 73 | #include <netinet/in.h> | |
@@ -662,31 +662,27 @@ cue_uno_init(struct ifnet *ifp) | @@ -662,31 +662,27 @@ cue_uno_init(struct ifnet *ifp) | |||
662 | CUE_AOP_EMBED_RXLEN | 0x01); /* 1 wait state */ | 662 | CUE_AOP_EMBED_RXLEN | 0x01); /* 1 wait state */ | |
663 | 663 | |||
664 | /* Program the LED operation. */ | 664 | /* Program the LED operation. */ | |
665 | cue_csr_write_1(un, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK); | 665 | cue_csr_write_1(un, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK); | |
666 | 666 | |||
667 | return usbnet_init_rx_tx(un); | 667 | return usbnet_init_rx_tx(un); | |
668 | } | 668 | } | |
669 | 669 | |||
670 | static void | 670 | static void | |
671 | cue_uno_mcast(struct ifnet *ifp) | 671 | cue_uno_mcast(struct ifnet *ifp) | |
672 | { | 672 | { | |
673 | struct usbnet * const un = ifp->if_softc; | 673 | struct usbnet * const un = ifp->if_softc; | |
674 | 674 | |||
675 | usbnet_lock_core(un); | |||
676 | ||||
677 | cue_setiff_locked(un); | 675 | cue_setiff_locked(un); | |
678 | ||||
679 | usbnet_unlock_core(un); | |||
680 | } | 676 | } | |
681 | 677 | |||
682 | /* Stop and reset the adapter. */ | 678 | /* Stop and reset the adapter. */ | |
683 | static void | 679 | static void | |
684 | cue_uno_stop(struct ifnet *ifp, int disable) | 680 | cue_uno_stop(struct ifnet *ifp, int disable) | |
685 | { | 681 | { | |
686 | struct usbnet * const un = ifp->if_softc; | 682 | struct usbnet * const un = ifp->if_softc; | |
687 | 683 | |||
688 | DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | 684 | DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | |
689 | 685 | |||
690 | cue_csr_write_1(un, CUE_ETHCTL, 0); | 686 | cue_csr_write_1(un, CUE_ETHCTL, 0); | |
691 | cue_reset(un); | 687 | cue_reset(un); | |
692 | } | 688 | } |
--- src/sys/dev/usb/if_kue.c 2022/03/03 05:52:35 1.110
+++ src/sys/dev/usb/if_kue.c 2022/03/03 05:52:46 1.111
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_kue.c,v 1.110 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_kue.c,v 1.111 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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. | |
@@ -61,27 +61,27 @@ | @@ -61,27 +61,27 @@ | |||
61 | * powered on and retain its firmware. In this case, we don't need | 61 | * powered on and retain its firmware. In this case, we don't need | |
62 | * to load the firmware a second time. | 62 | * to load the firmware a second time. | |
63 | * | 63 | * | |
64 | * Special thanks to Rob Furr for providing an ADS Technologies | 64 | * Special thanks to Rob Furr for providing an ADS Technologies | |
65 | * adapter for development and testing. No monkeys were harmed during | 65 | * adapter for development and testing. No monkeys were harmed during | |
66 | * the development of this driver. | 66 | * the development of this driver. | |
67 | */ | 67 | */ | |
68 | 68 | |||
69 | /* | 69 | /* | |
70 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 70 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | #include <sys/cdefs.h> | 73 | #include <sys/cdefs.h> | |
74 | __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.110 2022/03/03 05:52:35 riastradh Exp $"); | 74 | __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.111 2022/03/03 05:52:46 riastradh Exp $"); | |
75 | 75 | |||
76 | #ifdef _KERNEL_OPT | 76 | #ifdef _KERNEL_OPT | |
77 | #include "opt_inet.h" | 77 | #include "opt_inet.h" | |
78 | #include "opt_usb.h" | 78 | #include "opt_usb.h" | |
79 | #endif | 79 | #endif | |
80 | 80 | |||
81 | #include <sys/param.h> | 81 | #include <sys/param.h> | |
82 | #include <sys/kmem.h> | 82 | #include <sys/kmem.h> | |
83 | 83 | |||
84 | #include <dev/usb/usbnet.h> | 84 | #include <dev/usb/usbnet.h> | |
85 | 85 | |||
86 | #ifdef INET | 86 | #ifdef INET | |
87 | #include <netinet/in.h> | 87 | #include <netinet/in.h> | |
@@ -622,25 +622,21 @@ kue_uno_init(struct ifnet *ifp) | @@ -622,25 +622,21 @@ kue_uno_init(struct ifnet *ifp) | |||
622 | kue_setword(un, KUE_CMD_SET_URB_SIZE, 64); | 622 | kue_setword(un, KUE_CMD_SET_URB_SIZE, 64); | |
623 | 623 | |||
624 | /* Load the multicast filter. */ | 624 | /* Load the multicast filter. */ | |
625 | kue_setiff_locked(un); | 625 | kue_setiff_locked(un); | |
626 | 626 | |||
627 | return usbnet_init_rx_tx(un); | 627 | return usbnet_init_rx_tx(un); | |
628 | } | 628 | } | |
629 | 629 | |||
630 | static void | 630 | static void | |
631 | kue_uno_mcast(struct ifnet *ifp) | 631 | kue_uno_mcast(struct ifnet *ifp) | |
632 | { | 632 | { | |
633 | struct usbnet * const un = ifp->if_softc; | 633 | struct usbnet * const un = ifp->if_softc; | |
634 | 634 | |||
635 | usbnet_lock_core(un); | |||
636 | ||||
637 | kue_setiff_locked(un); | 635 | kue_setiff_locked(un); | |
638 | ||||
639 | usbnet_unlock_core(un); | |||
640 | } | 636 | } | |
641 | 637 | |||
642 | #ifdef _MODULE | 638 | #ifdef _MODULE | |
643 | #include "ioconf.c" | 639 | #include "ioconf.c" | |
644 | #endif | 640 | #endif | |
645 | 641 | |||
646 | USBNET_MODULE(kue) | 642 | USBNET_MODULE(kue) |
--- src/sys/dev/usb/if_mos.c 2022/03/03 05:52:35 1.13
+++ src/sys/dev/usb/if_mos.c 2022/03/03 05:52:46 1.14
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_mos.c,v 1.13 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_mos.c,v 1.14 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */ | 2 | /* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> | 5 | * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -62,27 +62,27 @@ | @@ -62,27 +62,27 @@ | |||
62 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 62 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
63 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 63 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
64 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 64 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
65 | * THE POSSIBILITY OF SUCH DAMAGE. | 65 | * THE POSSIBILITY OF SUCH DAMAGE. | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | /* | 68 | /* | |
69 | * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller | 69 | * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller | |
70 | * The datasheet is available at the following URL: | 70 | * The datasheet is available at the following URL: | |
71 | * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf | 71 | * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf | |
72 | */ | 72 | */ | |
73 | 73 | |||
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | __KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.13 2022/03/03 05:52:35 riastradh Exp $"); | 75 | __KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.14 2022/03/03 05:52:46 riastradh Exp $"); | |
76 | 76 | |||
77 | #include <sys/param.h> | 77 | #include <sys/param.h> | |
78 | 78 | |||
79 | #include <dev/usb/usbnet.h> | 79 | #include <dev/usb/usbnet.h> | |
80 | #include <dev/usb/if_mosreg.h> | 80 | #include <dev/usb/if_mosreg.h> | |
81 | 81 | |||
82 | #define MOS_PAUSE_REWRITES 3 | 82 | #define MOS_PAUSE_REWRITES 3 | |
83 | 83 | |||
84 | #define MOS_TIMEOUT 1000 | 84 | #define MOS_TIMEOUT 1000 | |
85 | 85 | |||
86 | #define MOS_RX_LIST_CNT 1 | 86 | #define MOS_RX_LIST_CNT 1 | |
87 | #define MOS_TX_LIST_CNT 1 | 87 | #define MOS_TX_LIST_CNT 1 | |
88 | 88 | |||
@@ -754,27 +754,23 @@ mos_uno_init(struct ifnet *ifp) | @@ -754,27 +754,23 @@ mos_uno_init(struct ifnet *ifp) | |||
754 | rxmode = mos_reg_read_1(un, MOS_CTL); | 754 | rxmode = mos_reg_read_1(un, MOS_CTL); | |
755 | rxmode |= MOS_CTL_RX_ENB | MOS_CTL_TX_ENB | MOS_CTL_BS_ENB; | 755 | rxmode |= MOS_CTL_RX_ENB | MOS_CTL_TX_ENB | MOS_CTL_BS_ENB; | |
756 | rxmode &= ~(MOS_CTL_SLEEP); | 756 | rxmode &= ~(MOS_CTL_SLEEP); | |
757 | mos_reg_write_1(un, MOS_CTL, rxmode); | 757 | mos_reg_write_1(un, MOS_CTL, rxmode); | |
758 | 758 | |||
759 | return usbnet_init_rx_tx(un); | 759 | return usbnet_init_rx_tx(un); | |
760 | } | 760 | } | |
761 | 761 | |||
762 | static void | 762 | static void | |
763 | mos_uno_mcast(struct ifnet *ifp) | 763 | mos_uno_mcast(struct ifnet *ifp) | |
764 | { | 764 | { | |
765 | struct usbnet * const un = ifp->if_softc; | 765 | struct usbnet * const un = ifp->if_softc; | |
766 | 766 | |||
767 | usbnet_lock_core(un); | |||
768 | ||||
769 | mos_rcvfilt_locked(un); | 767 | mos_rcvfilt_locked(un); | |
770 | ||||
771 | usbnet_unlock_core(un); | |||
772 | } | 768 | } | |
773 | 769 | |||
774 | void | 770 | void | |
775 | mos_uno_stop(struct ifnet *ifp, int disable) | 771 | mos_uno_stop(struct ifnet *ifp, int disable) | |
776 | { | 772 | { | |
777 | struct usbnet * const un = ifp->if_softc; | 773 | struct usbnet * const un = ifp->if_softc; | |
778 | 774 | |||
779 | mos_reset(un); | 775 | mos_reset(un); | |
780 | } | 776 | } |
--- src/sys/dev/usb/if_mue.c 2022/03/03 05:52:35 1.70
+++ src/sys/dev/usb/if_mue.c 2022/03/03 05:52:46 1.71
@@ -1,36 +1,36 @@ | @@ -1,36 +1,36 @@ | |||
1 | /* $NetBSD: if_mue.c,v 1.70 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_mue.c,v 1.71 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ | 2 | /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org> | 5 | * Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | /* Driver for Microchip LAN7500/LAN7800 chipsets. */ | 20 | /* Driver for Microchip LAN7500/LAN7800 chipsets. */ | |
21 | 21 | |||
22 | #include <sys/cdefs.h> | 22 | #include <sys/cdefs.h> | |
23 | __KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.70 2022/03/03 05:52:35 riastradh Exp $"); | 23 | __KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.71 2022/03/03 05:52:46 riastradh Exp $"); | |
24 | 24 | |||
25 | #ifdef _KERNEL_OPT | 25 | #ifdef _KERNEL_OPT | |
26 | #include "opt_usb.h" | 26 | #include "opt_usb.h" | |
27 | #include "opt_inet.h" | 27 | #include "opt_inet.h" | |
28 | #endif | 28 | #endif | |
29 | 29 | |||
30 | #include <sys/param.h> | 30 | #include <sys/param.h> | |
31 | 31 | |||
32 | #include <dev/usb/usbnet.h> | 32 | #include <dev/usb/usbnet.h> | |
33 | 33 | |||
34 | #include <dev/usb/if_muereg.h> | 34 | #include <dev/usb/if_muereg.h> | |
35 | #include <dev/usb/if_muevar.h> | 35 | #include <dev/usb/if_muevar.h> | |
36 | 36 | |||
@@ -1271,31 +1271,27 @@ mue_uno_ioctl(struct ifnet *ifp, u_long | @@ -1271,31 +1271,27 @@ mue_uno_ioctl(struct ifnet *ifp, u_long | |||
1271 | break; | 1271 | break; | |
1272 | } | 1272 | } | |
1273 | 1273 | |||
1274 | usbnet_unlock_core(un); | 1274 | usbnet_unlock_core(un); | |
1275 | 1275 | |||
1276 | return 0; | 1276 | return 0; | |
1277 | } | 1277 | } | |
1278 | 1278 | |||
1279 | static void | 1279 | static void | |
1280 | mue_uno_mcast(struct ifnet *ifp) | 1280 | mue_uno_mcast(struct ifnet *ifp) | |
1281 | { | 1281 | { | |
1282 | struct usbnet * const un = ifp->if_softc; | 1282 | struct usbnet * const un = ifp->if_softc; | |
1283 | 1283 | |||
1284 | usbnet_lock_core(un); | |||
1285 | ||||
1286 | mue_setiff_locked(un); | 1284 | mue_setiff_locked(un); | |
1287 | ||||
1288 | usbnet_unlock_core(un); | |||
1289 | } | 1285 | } | |
1290 | 1286 | |||
1291 | static void | 1287 | static void | |
1292 | mue_reset(struct usbnet *un) | 1288 | mue_reset(struct usbnet *un) | |
1293 | { | 1289 | { | |
1294 | if (usbnet_isdying(un)) | 1290 | if (usbnet_isdying(un)) | |
1295 | return; | 1291 | return; | |
1296 | 1292 | |||
1297 | /* Wait a little while for the chip to get its brains in order. */ | 1293 | /* Wait a little while for the chip to get its brains in order. */ | |
1298 | usbd_delay_ms(un->un_udev, 1); | 1294 | usbd_delay_ms(un->un_udev, 1); | |
1299 | 1295 | |||
1300 | // mue_chip_init(un); /* XXX */ | 1296 | // mue_chip_init(un); /* XXX */ | |
1301 | } | 1297 | } |
--- src/sys/dev/usb/if_smsc.c 2022/03/03 05:52:35 1.79
+++ src/sys/dev/usb/if_smsc.c 2022/03/03 05:52:46 1.80
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_smsc.c,v 1.79 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_smsc.c,v 1.80 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ | 3 | /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ | |
4 | /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ | 4 | /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ | |
5 | /*- | 5 | /*- | |
6 | * Copyright (c) 2012 | 6 | * Copyright (c) 2012 | |
7 | * Ben Gray <bgray@freebsd.org>. | 7 | * Ben Gray <bgray@freebsd.org>. | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -51,27 +51,27 @@ | @@ -51,27 +51,27 @@ | |||
51 | * the H/W checksum will be incorrect, however the rx code compensates for this. | 51 | * the H/W checksum will be incorrect, however the rx code compensates for this. | |
52 | * | 52 | * | |
53 | * TX checksuming is more complicated, the device requires a special header to | 53 | * TX checksuming is more complicated, the device requires a special header to | |
54 | * be prefixed onto the start of the frame which indicates the start and end | 54 | * be prefixed onto the start of the frame which indicates the start and end | |
55 | * positions of the UDP or TCP frame. This requires the driver to manually | 55 | * positions of the UDP or TCP frame. This requires the driver to manually | |
56 | * go through the packet data and decode the headers prior to sending. | 56 | * go through the packet data and decode the headers prior to sending. | |
57 | * On Linux they generally provide cues to the location of the csum and the | 57 | * On Linux they generally provide cues to the location of the csum and the | |
58 | * area to calculate it over, on FreeBSD we seem to have to do it all ourselves, | 58 | * area to calculate it over, on FreeBSD we seem to have to do it all ourselves, | |
59 | * hence this is not as optimal and therefore h/w TX checksum is currently not | 59 | * hence this is not as optimal and therefore h/w TX checksum is currently not | |
60 | * implemented. | 60 | * implemented. | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | #include <sys/cdefs.h> | 63 | #include <sys/cdefs.h> | |
64 | __KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.79 2022/03/03 05:52:35 riastradh Exp $"); | 64 | __KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.80 2022/03/03 05:52:46 riastradh Exp $"); | |
65 | 65 | |||
66 | #ifdef _KERNEL_OPT | 66 | #ifdef _KERNEL_OPT | |
67 | #include "opt_usb.h" | 67 | #include "opt_usb.h" | |
68 | #endif | 68 | #endif | |
69 | 69 | |||
70 | #include <sys/param.h> | 70 | #include <sys/param.h> | |
71 | 71 | |||
72 | #include <dev/usb/usbnet.h> | 72 | #include <dev/usb/usbnet.h> | |
73 | #include <dev/usb/usbhist.h> | 73 | #include <dev/usb/usbhist.h> | |
74 | 74 | |||
75 | #include <dev/usb/if_smscreg.h> | 75 | #include <dev/usb/if_smscreg.h> | |
76 | 76 | |||
77 | #include "ioconf.h" | 77 | #include "ioconf.h" | |
@@ -752,31 +752,27 @@ smsc_uno_ioctl(struct ifnet *ifp, u_long | @@ -752,31 +752,27 @@ smsc_uno_ioctl(struct ifnet *ifp, u_long | |||
752 | break; | 752 | break; | |
753 | } | 753 | } | |
754 | 754 | |||
755 | usbnet_unlock_core(un); | 755 | usbnet_unlock_core(un); | |
756 | 756 | |||
757 | return 0; | 757 | return 0; | |
758 | } | 758 | } | |
759 | 759 | |||
760 | static void | 760 | static void | |
761 | smsc_uno_mcast(struct ifnet *ifp) | 761 | smsc_uno_mcast(struct ifnet *ifp) | |
762 | { | 762 | { | |
763 | struct usbnet * const un = ifp->if_softc; | 763 | struct usbnet * const un = ifp->if_softc; | |
764 | 764 | |||
765 | usbnet_lock_core(un); | |||
766 | ||||
767 | smsc_setiff_locked(un); | 765 | smsc_setiff_locked(un); | |
768 | ||||
769 | usbnet_unlock_core(un); | |||
770 | } | 766 | } | |
771 | 767 | |||
772 | static int | 768 | static int | |
773 | smsc_match(device_t parent, cfdata_t match, void *aux) | 769 | smsc_match(device_t parent, cfdata_t match, void *aux) | |
774 | { | 770 | { | |
775 | struct usb_attach_arg *uaa = aux; | 771 | struct usb_attach_arg *uaa = aux; | |
776 | 772 | |||
777 | return (usb_lookup(smsc_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ? | 773 | return (usb_lookup(smsc_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ? | |
778 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 774 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
779 | } | 775 | } | |
780 | 776 | |||
781 | static void | 777 | static void | |
782 | smsc_attach(device_t parent, device_t self, void *aux) | 778 | smsc_attach(device_t parent, device_t self, void *aux) |
--- src/sys/dev/usb/if_udav.c 2022/03/03 05:51:44 1.84
+++ src/sys/dev/usb/if_udav.c 2022/03/03 05:52:46 1.85
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_udav.c,v 1.84 2022/03/03 05:51:44 riastradh Exp $ */ | 1 | /* $NetBSD: if_udav.c,v 1.85 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ | 2 | /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2003 | 5 | * Copyright (c) 2003 | |
6 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | 6 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -35,27 +35,27 @@ | @@ -35,27 +35,27 @@ | |||
35 | * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY) | 35 | * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY) | |
36 | * The spec can be found at the following url. | 36 | * The spec can be found at the following url. | |
37 | * http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-F01-062202s.pdf | 37 | * http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-F01-062202s.pdf | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | /* | 40 | /* | |
41 | * TODO: | 41 | * TODO: | |
42 | * Interrupt Endpoint support | 42 | * Interrupt Endpoint support | |
43 | * External PHYs | 43 | * External PHYs | |
44 | * powerhook() support? | 44 | * powerhook() support? | |
45 | */ | 45 | */ | |
46 | 46 | |||
47 | #include <sys/cdefs.h> | 47 | #include <sys/cdefs.h> | |
48 | __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.84 2022/03/03 05:51:44 riastradh Exp $"); | 48 | __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.85 2022/03/03 05:52:46 riastradh Exp $"); | |
49 | 49 | |||
50 | #ifdef _KERNEL_OPT | 50 | #ifdef _KERNEL_OPT | |
51 | #include "opt_usb.h" | 51 | #include "opt_usb.h" | |
52 | #endif | 52 | #endif | |
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | 55 | |||
56 | #include <dev/usb/usbnet.h> | 56 | #include <dev/usb/usbnet.h> | |
57 | #include <dev/usb/if_udavreg.h> | 57 | #include <dev/usb/if_udavreg.h> | |
58 | 58 | |||
59 | /* Function declarations */ | 59 | /* Function declarations */ | |
60 | static int udav_match(device_t, cfdata_t, void *); | 60 | static int udav_match(device_t, cfdata_t, void *); | |
61 | static void udav_attach(device_t, device_t, void *); | 61 | static void udav_attach(device_t, device_t, void *); | |
@@ -706,31 +706,27 @@ udav_uno_rx_loop(struct usbnet *un, stru | @@ -706,31 +706,27 @@ udav_uno_rx_loop(struct usbnet *un, stru | |||
706 | 706 | |||
707 | pkt_len -= ETHER_CRC_LEN; | 707 | pkt_len -= ETHER_CRC_LEN; | |
708 | 708 | |||
709 | DPRINTF(("%s: Rx deliver: 0x%02x\n", device_xname(un->un_dev), pkt_len)); | 709 | DPRINTF(("%s: Rx deliver: 0x%02x\n", device_xname(un->un_dev), pkt_len)); | |
710 | 710 | |||
711 | usbnet_enqueue(un, buf, pkt_len, 0, 0, 0); | 711 | usbnet_enqueue(un, buf, pkt_len, 0, 0, 0); | |
712 | } | 712 | } | |
713 | 713 | |||
714 | static void | 714 | static void | |
715 | udav_uno_mcast(struct ifnet *ifp) | 715 | udav_uno_mcast(struct ifnet *ifp) | |
716 | { | 716 | { | |
717 | struct usbnet * const un = ifp->if_softc; | 717 | struct usbnet * const un = ifp->if_softc; | |
718 | 718 | |||
719 | usbnet_lock_core(un); | |||
720 | ||||
721 | udav_setiff_locked(un); | 719 | udav_setiff_locked(un); | |
722 | ||||
723 | usbnet_unlock_core(un); | |||
724 | } | 720 | } | |
725 | 721 | |||
726 | /* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ | 722 | /* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ | |
727 | static void | 723 | static void | |
728 | udav_uno_stop(struct ifnet *ifp, int disable) | 724 | udav_uno_stop(struct ifnet *ifp, int disable) | |
729 | { | 725 | { | |
730 | struct usbnet * const un = ifp->if_softc; | 726 | struct usbnet * const un = ifp->if_softc; | |
731 | 727 | |||
732 | DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | 728 | DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | |
733 | 729 | |||
734 | udav_reset(un); | 730 | udav_reset(un); | |
735 | } | 731 | } | |
736 | 732 |
--- src/sys/dev/usb/if_ure.c 2022/03/03 05:52:35 1.46
+++ src/sys/dev/usb/if_ure.c 2022/03/03 05:52:46 1.47
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_ure.c,v 1.46 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_ure.c,v 1.47 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ | 2 | /* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> | 5 | * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ | 30 | /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.46 2022/03/03 05:52:35 riastradh Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.47 2022/03/03 05:52:46 riastradh Exp $"); | |
34 | 34 | |||
35 | #ifdef _KERNEL_OPT | 35 | #ifdef _KERNEL_OPT | |
36 | #include "opt_usb.h" | 36 | #include "opt_usb.h" | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/cprng.h> | 41 | #include <sys/cprng.h> | |
42 | 42 | |||
43 | #include <net/route.h> | 43 | #include <net/route.h> | |
44 | 44 | |||
45 | #include <dev/usb/usbnet.h> | 45 | #include <dev/usb/usbnet.h> | |
46 | 46 | |||
@@ -785,31 +785,27 @@ ure_init_fifo(struct usbnet *un) | @@ -785,31 +785,27 @@ ure_init_fifo(struct usbnet *un) | |||
785 | ure_write_4(un, URE_PLA_RXFIFO_CTRL1, URE_MCU_TYPE_PLA, rx_fifo1); | 785 | ure_write_4(un, URE_PLA_RXFIFO_CTRL1, URE_MCU_TYPE_PLA, rx_fifo1); | |
786 | ure_write_4(un, URE_PLA_RXFIFO_CTRL2, URE_MCU_TYPE_PLA, rx_fifo2); | 786 | ure_write_4(un, URE_PLA_RXFIFO_CTRL2, URE_MCU_TYPE_PLA, rx_fifo2); | |
787 | 787 | |||
788 | /* Configure Tx FIFO threshold. */ | 788 | /* Configure Tx FIFO threshold. */ | |
789 | ure_write_4(un, URE_PLA_TXFIFO_CTRL, URE_MCU_TYPE_PLA, | 789 | ure_write_4(un, URE_PLA_TXFIFO_CTRL, URE_MCU_TYPE_PLA, | |
790 | URE_TXFIFO_THR_NORMAL); | 790 | URE_TXFIFO_THR_NORMAL); | |
791 | } | 791 | } | |
792 | 792 | |||
793 | static void | 793 | static void | |
794 | ure_uno_mcast(struct ifnet *ifp) | 794 | ure_uno_mcast(struct ifnet *ifp) | |
795 | { | 795 | { | |
796 | struct usbnet * const un = ifp->if_softc; | 796 | struct usbnet * const un = ifp->if_softc; | |
797 | 797 | |||
798 | usbnet_lock_core(un); | |||
799 | ||||
800 | ure_rcvfilt_locked(un); | 798 | ure_rcvfilt_locked(un); | |
801 | ||||
802 | usbnet_unlock_core(un); | |||
803 | } | 799 | } | |
804 | 800 | |||
805 | static int | 801 | static int | |
806 | ure_match(device_t parent, cfdata_t match, void *aux) | 802 | ure_match(device_t parent, cfdata_t match, void *aux) | |
807 | { | 803 | { | |
808 | struct usb_attach_arg *uaa = aux; | 804 | struct usb_attach_arg *uaa = aux; | |
809 | 805 | |||
810 | return usb_lookup(ure_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL ? | 806 | return usb_lookup(ure_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL ? | |
811 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 807 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
812 | } | 808 | } | |
813 | 809 | |||
814 | static void | 810 | static void | |
815 | ure_attach(device_t parent, device_t self, void *aux) | 811 | ure_attach(device_t parent, device_t self, void *aux) |
--- src/sys/dev/usb/if_url.c 2022/03/03 05:52:35 1.85
+++ src/sys/dev/usb/if_url.c 2022/03/03 05:52:46 1.86
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_url.c,v 1.85 2022/03/03 05:52:35 riastradh Exp $ */ | 1 | /* $NetBSD: if_url.c,v 1.86 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2001, 2002 | 4 | * Copyright (c) 2001, 2002 | |
5 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | 5 | * Shingo WATANABE <nabe@nabechan.org>. 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. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | 34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | |
35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | 35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | |
36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | 36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | /* | 39 | /* | |
40 | * TODO: | 40 | * TODO: | |
41 | * Interrupt Endpoint support | 41 | * Interrupt Endpoint support | |
42 | * External PHYs | 42 | * External PHYs | |
43 | * powerhook() support? | 43 | * powerhook() support? | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.85 2022/03/03 05:52:35 riastradh Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.86 2022/03/03 05:52:46 riastradh Exp $"); | |
48 | 48 | |||
49 | #ifdef _KERNEL_OPT | 49 | #ifdef _KERNEL_OPT | |
50 | #include "opt_inet.h" | 50 | #include "opt_inet.h" | |
51 | #include "opt_usb.h" | 51 | #include "opt_usb.h" | |
52 | #endif | 52 | #endif | |
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | 55 | |||
56 | #include <net/if_ether.h> | 56 | #include <net/if_ether.h> | |
57 | #ifdef INET | 57 | #ifdef INET | |
58 | #include <netinet/in.h> | 58 | #include <netinet/in.h> | |
59 | #include <netinet/if_inarp.h> | 59 | #include <netinet/if_inarp.h> | |
60 | #endif | 60 | #endif | |
@@ -540,31 +540,27 @@ url_uno_rx_loop(struct usbnet *un, struc | @@ -540,31 +540,27 @@ url_uno_rx_loop(struct usbnet *un, struc | |||
540 | } | 540 | } | |
541 | 541 | |||
542 | #if 0 | 542 | #if 0 | |
543 | static void url_intr(void) | 543 | static void url_intr(void) | |
544 | { | 544 | { | |
545 | } | 545 | } | |
546 | #endif | 546 | #endif | |
547 | 547 | |||
548 | static void | 548 | static void | |
549 | url_uno_mcast(struct ifnet *ifp) | 549 | url_uno_mcast(struct ifnet *ifp) | |
550 | { | 550 | { | |
551 | struct usbnet * const un = ifp->if_softc; | 551 | struct usbnet * const un = ifp->if_softc; | |
552 | 552 | |||
553 | usbnet_lock_core(un); | |||
554 | ||||
555 | url_rcvfilt_locked(un); | 553 | url_rcvfilt_locked(un); | |
556 | ||||
557 | usbnet_unlock_core(un); | |||
558 | } | 554 | } | |
559 | 555 | |||
560 | /* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ | 556 | /* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ | |
561 | static void | 557 | static void | |
562 | url_uno_stop(struct ifnet *ifp, int disable) | 558 | url_uno_stop(struct ifnet *ifp, int disable) | |
563 | { | 559 | { | |
564 | struct usbnet * const un = ifp->if_softc; | 560 | struct usbnet * const un = ifp->if_softc; | |
565 | 561 | |||
566 | DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | 562 | DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); | |
567 | 563 | |||
568 | url_reset(un); | 564 | url_reset(un); | |
569 | } | 565 | } | |
570 | 566 |
--- src/sys/dev/usb/usbnet.c 2022/03/03 05:52:27 1.80
+++ src/sys/dev/usb/usbnet.c 2022/03/03 05:52:46 1.81
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $ */ | 1 | /* $NetBSD: usbnet.c,v 1.81 2022/03/03 05:52:46 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2019 Matthew R. Green | 4 | * Copyright (c) 2019 Matthew R. Green | |
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. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * Common code shared between USB network drivers. | 30 | * Common code shared between USB network drivers. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.81 2022/03/03 05:52:46 riastradh Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/kmem.h> | 38 | #include <sys/kmem.h> | |
39 | #include <sys/module.h> | 39 | #include <sys/module.h> | |
40 | #include <sys/atomic.h> | 40 | #include <sys/atomic.h> | |
41 | 41 | |||
42 | #include <dev/usb/usbnet.h> | 42 | #include <dev/usb/usbnet.h> | |
43 | #include <dev/usb/usbhist.h> | 43 | #include <dev/usb/usbhist.h> | |
44 | 44 | |||
45 | struct usbnet_cdata { | 45 | struct usbnet_cdata { | |
46 | struct usbnet_chain *uncd_tx_chain; | 46 | struct usbnet_chain *uncd_tx_chain; | |
47 | struct usbnet_chain *uncd_rx_chain; | 47 | struct usbnet_chain *uncd_rx_chain; | |
@@ -1050,28 +1050,31 @@ usbnet_mcast_task(void *arg) | @@ -1050,28 +1050,31 @@ usbnet_mcast_task(void *arg) | |||
1050 | * IFNET_LOCK after if_detach. See usbnet_detach for details. | 1050 | * IFNET_LOCK after if_detach. See usbnet_detach for details. | |
1051 | */ | 1051 | */ | |
1052 | if (usbnet_isdying(un)) | 1052 | if (usbnet_isdying(un)) | |
1053 | return; | 1053 | return; | |
1054 | 1054 | |||
1055 | /* | 1055 | /* | |
1056 | * If the hardware is running, ask the driver to reprogram the | 1056 | * If the hardware is running, ask the driver to reprogram the | |
1057 | * multicast filter. If the hardware is not running, the | 1057 | * multicast filter. If the hardware is not running, the | |
1058 | * driver is responsible for programming the multicast filter | 1058 | * driver is responsible for programming the multicast filter | |
1059 | * as part of its uno_init routine to bring the hardware up. | 1059 | * as part of its uno_init routine to bring the hardware up. | |
1060 | */ | 1060 | */ | |
1061 | IFNET_LOCK(ifp); | 1061 | IFNET_LOCK(ifp); | |
1062 | if (ifp->if_flags & IFF_RUNNING) { | 1062 | if (ifp->if_flags & IFF_RUNNING) { | |
1063 | if (un->un_ops->uno_mcast) | 1063 | if (un->un_ops->uno_mcast) { | |
1064 | mutex_enter(&un->un_pri->unp_core_lock); | |||
1064 | (*un->un_ops->uno_mcast)(ifp); | 1065 | (*un->un_ops->uno_mcast)(ifp); | |
1066 | mutex_exit(&un->un_pri->unp_core_lock); | |||
1067 | } | |||
1065 | } | 1068 | } | |
1066 | IFNET_UNLOCK(ifp); | 1069 | IFNET_UNLOCK(ifp); | |
1067 | } | 1070 | } | |
1068 | 1071 | |||
1069 | /* | 1072 | /* | |
1070 | * Generic stop network function: | 1073 | * Generic stop network function: | |
1071 | * - mark as stopping | 1074 | * - mark as stopping | |
1072 | * - call DD routine to stop the device | 1075 | * - call DD routine to stop the device | |
1073 | * - turn off running, timer, statchg callout, link | 1076 | * - turn off running, timer, statchg callout, link | |
1074 | * - stop transfers | 1077 | * - stop transfers | |
1075 | * - free RX and TX resources | 1078 | * - free RX and TX resources | |
1076 | * - close pipes | 1079 | * - close pipes | |
1077 | * | 1080 | * |