Thu Mar 3 05:51:27 2022 UTC ()
usbnet drivers: No need for usbnet_busy in uno_mcast.

This callback always runs with IFNET_LOCK held, and during a task
that usbnet_detach prevents scheduling anew and waits for finishing
before completing the detach, so there is no need to hang onto a
reference count here.


(riastradh)
diff -r1.135 -r1.136 src/sys/dev/usb/if_axe.c
diff -r1.77 -r1.78 src/sys/dev/usb/if_axen.c
diff -r1.95 -r1.96 src/sys/dev/usb/if_cue.c
diff -r1.108 -r1.109 src/sys/dev/usb/if_kue.c
diff -r1.11 -r1.12 src/sys/dev/usb/if_mos.c
diff -r1.67 -r1.68 src/sys/dev/usb/if_mue.c
diff -r1.75 -r1.76 src/sys/dev/usb/if_smsc.c
diff -r1.82 -r1.83 src/sys/dev/usb/if_udav.c
diff -r1.82 -r1.83 src/sys/dev/usb/if_url.c
diff -r1.44 -r1.45 src/sys/dev/usb/if_ure.c

cvs diff -r1.135 -r1.136 src/sys/dev/usb/if_axe.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_axe.c 2022/03/03 05:51:17 1.135
+++ src/sys/dev/usb/if_axe.c 2022/03/03 05:51:27 1.136
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_axe.c,v 1.135 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_axe.c,v 1.136 2022/03/03 05:51:27 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.135 2022/03/03 05:51:17 riastradh Exp $"); 90__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.136 2022/03/03 05:51:27 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
103struct axe_type { 103struct axe_type {
@@ -1316,31 +1316,29 @@ static int @@ -1316,31 +1316,29 @@ static int
1316axe_uno_init(struct ifnet *ifp) 1316axe_uno_init(struct ifnet *ifp)
1317{ 1317{
1318 int ret = axe_init_locked(ifp); 1318 int ret = axe_init_locked(ifp);
1319 1319
1320 return ret; 1320 return ret;
1321} 1321}
1322 1322
1323static void 1323static void
1324axe_uno_mcast(struct ifnet *ifp) 1324axe_uno_mcast(struct ifnet *ifp)
1325{ 1325{
1326 struct usbnet * const un = ifp->if_softc; 1326 struct usbnet * const un = ifp->if_softc;
1327 1327
1328 usbnet_lock_core(un); 1328 usbnet_lock_core(un);
1329 usbnet_busy(un); 
1330 1329
1331 axe_rcvfilt_locked(un); 1330 axe_rcvfilt_locked(un);
1332 1331
1333 usbnet_unbusy(un); 
1334 usbnet_unlock_core(un); 1332 usbnet_unlock_core(un);
1335} 1333}
1336 1334
1337static void 1335static void
1338axe_uno_stop(struct ifnet *ifp, int disable) 1336axe_uno_stop(struct ifnet *ifp, int disable)
1339{ 1337{
1340 struct usbnet * const un = ifp->if_softc; 1338 struct usbnet * const un = ifp->if_softc;
1341 1339
1342 axe_reset(un); 1340 axe_reset(un);
1343} 1341}
1344 1342
1345#ifdef _MODULE 1343#ifdef _MODULE
1346#include "ioconf.c" 1344#include "ioconf.c"

cvs diff -r1.77 -r1.78 src/sys/dev/usb/if_axen.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_axen.c 2022/03/03 05:51:17 1.77
+++ src/sys/dev/usb/if_axen.c 2022/03/03 05:51:27 1.78
@@ -1,39 +1,39 @@ @@ -1,39 +1,39 @@
1/* $NetBSD: if_axen.c,v 1.77 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_axen.c,v 1.78 2022/03/03 05:51:27 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.77 2022/03/03 05:51:17 riastradh Exp $"); 26__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.78 2022/03/03 05:51:27 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>
@@ -570,31 +570,29 @@ axen_uno_ioctl(struct ifnet *ifp, u_long @@ -570,31 +570,29 @@ axen_uno_ioctl(struct ifnet *ifp, u_long
570 570
571 usbnet_unbusy(un); 571 usbnet_unbusy(un);
572 usbnet_unlock_core(un); 572 usbnet_unlock_core(un);
573 573
574 return 0; 574 return 0;
575} 575}
576 576
577static void 577static void
578axen_uno_mcast(struct ifnet *ifp) 578axen_uno_mcast(struct ifnet *ifp)
579{ 579{
580 struct usbnet * const un = ifp->if_softc; 580 struct usbnet * const un = ifp->if_softc;
581 581
582 usbnet_lock_core(un); 582 usbnet_lock_core(un);
583 usbnet_busy(un); 
584 583
585 axen_setiff_locked(un); 584 axen_setiff_locked(un);
586 585
587 usbnet_unbusy(un); 
588 usbnet_unlock_core(un); 586 usbnet_unlock_core(un);
589} 587}
590 588
591static int 589static int
592axen_match(device_t parent, cfdata_t match, void *aux) 590axen_match(device_t parent, cfdata_t match, void *aux)
593{ 591{
594 struct usb_attach_arg *uaa = aux; 592 struct usb_attach_arg *uaa = aux;
595 593
596 return axen_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? 594 return axen_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ?
597 UMATCH_VENDOR_PRODUCT : UMATCH_NONE; 595 UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
598} 596}
599 597
600static void 598static void

cvs diff -r1.95 -r1.96 src/sys/dev/usb/if_cue.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_cue.c 2022/03/03 05:51:17 1.95
+++ src/sys/dev/usb/if_cue.c 2022/03/03 05:51:27 1.96
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_cue.c,v 1.95 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_cue.c,v 1.96 2022/03/03 05:51:27 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.95 2022/03/03 05:51:17 riastradh Exp $"); 60__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.96 2022/03/03 05:51:27 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>
@@ -673,31 +673,29 @@ cue_uno_init(struct ifnet *ifp) @@ -673,31 +673,29 @@ cue_uno_init(struct ifnet *ifp)
673 int rv; 673 int rv;
674 674
675 rv = cue_init_locked(ifp); 675 rv = cue_init_locked(ifp);
676 676
677 return rv; 677 return rv;
678} 678}
679 679
680static void 680static void
681cue_uno_mcast(struct ifnet *ifp) 681cue_uno_mcast(struct ifnet *ifp)
682{ 682{
683 struct usbnet * const un = ifp->if_softc; 683 struct usbnet * const un = ifp->if_softc;
684 684
685 usbnet_lock_core(un); 685 usbnet_lock_core(un);
686 usbnet_busy(un); 
687 686
688 cue_setiff_locked(un); 687 cue_setiff_locked(un);
689 688
690 usbnet_unbusy(un); 
691 usbnet_unlock_core(un); 689 usbnet_unlock_core(un);
692} 690}
693 691
694/* Stop and reset the adapter. */ 692/* Stop and reset the adapter. */
695static void 693static void
696cue_uno_stop(struct ifnet *ifp, int disable) 694cue_uno_stop(struct ifnet *ifp, int disable)
697{ 695{
698 struct usbnet * const un = ifp->if_softc; 696 struct usbnet * const un = ifp->if_softc;
699 697
700 DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev), __func__)); 698 DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev), __func__));
701 699
702 cue_csr_write_1(un, CUE_ETHCTL, 0); 700 cue_csr_write_1(un, CUE_ETHCTL, 0);
703 cue_reset(un); 701 cue_reset(un);

cvs diff -r1.108 -r1.109 src/sys/dev/usb/if_kue.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_kue.c 2022/03/03 05:51:17 1.108
+++ src/sys/dev/usb/if_kue.c 2022/03/03 05:51:27 1.109
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_kue.c,v 1.108 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_kue.c,v 1.109 2022/03/03 05:51:27 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.108 2022/03/03 05:51:17 riastradh Exp $"); 74__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.109 2022/03/03 05:51:27 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>
@@ -633,26 +633,24 @@ kue_uno_init(struct ifnet *ifp) @@ -633,26 +633,24 @@ kue_uno_init(struct ifnet *ifp)
633 int rv; 633 int rv;
634 634
635 rv = kue_init_locked(ifp); 635 rv = kue_init_locked(ifp);
636 636
637 return rv; 637 return rv;
638} 638}
639 639
640static void 640static void
641kue_uno_mcast(struct ifnet *ifp) 641kue_uno_mcast(struct ifnet *ifp)
642{ 642{
643 struct usbnet * const un = ifp->if_softc; 643 struct usbnet * const un = ifp->if_softc;
644 644
645 usbnet_lock_core(un); 645 usbnet_lock_core(un);
646 usbnet_busy(un); 
647 646
648 kue_setiff_locked(un); 647 kue_setiff_locked(un);
649 648
650 usbnet_unbusy(un); 
651 usbnet_unlock_core(un); 649 usbnet_unlock_core(un);
652} 650}
653 651
654#ifdef _MODULE 652#ifdef _MODULE
655#include "ioconf.c" 653#include "ioconf.c"
656#endif 654#endif
657 655
658USBNET_MODULE(kue) 656USBNET_MODULE(kue)

cvs diff -r1.11 -r1.12 src/sys/dev/usb/if_mos.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_mos.c 2022/03/03 05:51:17 1.11
+++ src/sys/dev/usb/if_mos.c 2022/03/03 05:51:27 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_mos.c,v 1.11 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_mos.c,v 1.12 2022/03/03 05:51:27 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.11 2022/03/03 05:51:17 riastradh Exp $"); 75__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.12 2022/03/03 05:51:27 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
@@ -763,28 +763,26 @@ static int @@ -763,28 +763,26 @@ static int
763mos_uno_init(struct ifnet *ifp) 763mos_uno_init(struct ifnet *ifp)
764{ 764{
765 int ret = mos_init_locked(ifp); 765 int ret = mos_init_locked(ifp);
766 766
767 return ret; 767 return ret;
768} 768}
769 769
770static void 770static void
771mos_uno_mcast(struct ifnet *ifp) 771mos_uno_mcast(struct ifnet *ifp)
772{ 772{
773 struct usbnet * const un = ifp->if_softc; 773 struct usbnet * const un = ifp->if_softc;
774 774
775 usbnet_lock_core(un); 775 usbnet_lock_core(un);
776 usbnet_busy(un); 
777 776
778 mos_rcvfilt_locked(un); 777 mos_rcvfilt_locked(un);
779 778
780 usbnet_unbusy(un); 
781 usbnet_unlock_core(un); 779 usbnet_unlock_core(un);
782} 780}
783 781
784void 782void
785mos_uno_stop(struct ifnet *ifp, int disable) 783mos_uno_stop(struct ifnet *ifp, int disable)
786{ 784{
787 struct usbnet * const un = ifp->if_softc; 785 struct usbnet * const un = ifp->if_softc;
788 786
789 mos_reset(un); 787 mos_reset(un);
790} 788}

cvs diff -r1.67 -r1.68 src/sys/dev/usb/if_mue.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_mue.c 2022/03/03 05:51:17 1.67
+++ src/sys/dev/usb/if_mue.c 2022/03/03 05:51:27 1.68
@@ -1,36 +1,36 @@ @@ -1,36 +1,36 @@
1/* $NetBSD: if_mue.c,v 1.67 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_mue.c,v 1.68 2022/03/03 05:51:27 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.67 2022/03/03 05:51:17 riastradh Exp $"); 23__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.68 2022/03/03 05:51:27 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
@@ -1284,31 +1284,29 @@ mue_uno_ioctl(struct ifnet *ifp, u_long  @@ -1284,31 +1284,29 @@ mue_uno_ioctl(struct ifnet *ifp, u_long
1284 1284
1285 usbnet_unbusy(un); 1285 usbnet_unbusy(un);
1286 usbnet_unlock_core(un); 1286 usbnet_unlock_core(un);
1287 1287
1288 return 0; 1288 return 0;
1289} 1289}
1290 1290
1291static void 1291static void
1292mue_uno_mcast(struct ifnet *ifp) 1292mue_uno_mcast(struct ifnet *ifp)
1293{ 1293{
1294 struct usbnet * const un = ifp->if_softc; 1294 struct usbnet * const un = ifp->if_softc;
1295 1295
1296 usbnet_lock_core(un); 1296 usbnet_lock_core(un);
1297 usbnet_busy(un); 
1298 1297
1299 mue_setiff_locked(un); 1298 mue_setiff_locked(un);
1300 1299
1301 usbnet_unbusy(un); 
1302 usbnet_unlock_core(un); 1300 usbnet_unlock_core(un);
1303} 1301}
1304 1302
1305static void 1303static void
1306mue_reset(struct usbnet *un) 1304mue_reset(struct usbnet *un)
1307{ 1305{
1308 if (usbnet_isdying(un)) 1306 if (usbnet_isdying(un))
1309 return; 1307 return;
1310 1308
1311 /* Wait a little while for the chip to get its brains in order. */ 1309 /* Wait a little while for the chip to get its brains in order. */
1312 usbd_delay_ms(un->un_udev, 1); 1310 usbd_delay_ms(un->un_udev, 1);
1313 1311
1314// mue_chip_init(un); /* XXX */ 1312// mue_chip_init(un); /* XXX */

cvs diff -r1.75 -r1.76 src/sys/dev/usb/if_smsc.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_smsc.c 2022/03/03 05:51:17 1.75
+++ src/sys/dev/usb/if_smsc.c 2022/03/03 05:51:27 1.76
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_smsc.c,v 1.75 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_smsc.c,v 1.76 2022/03/03 05:51:27 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.75 2022/03/03 05:51:17 riastradh Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.76 2022/03/03 05:51:27 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"
@@ -764,31 +764,29 @@ smsc_uno_ioctl(struct ifnet *ifp, u_long @@ -764,31 +764,29 @@ smsc_uno_ioctl(struct ifnet *ifp, u_long
764 764
765 usbnet_unbusy(un); 765 usbnet_unbusy(un);
766 usbnet_unlock_core(un); 766 usbnet_unlock_core(un);
767 767
768 return 0; 768 return 0;
769} 769}
770 770
771static void 771static void
772smsc_uno_mcast(struct ifnet *ifp) 772smsc_uno_mcast(struct ifnet *ifp)
773{ 773{
774 struct usbnet * const un = ifp->if_softc; 774 struct usbnet * const un = ifp->if_softc;
775 775
776 usbnet_lock_core(un); 776 usbnet_lock_core(un);
777 usbnet_busy(un); 
778 777
779 smsc_setiff_locked(un); 778 smsc_setiff_locked(un);
780 779
781 usbnet_unbusy(un); 
782 usbnet_unlock_core(un); 780 usbnet_unlock_core(un);
783} 781}
784 782
785static int 783static int
786smsc_match(device_t parent, cfdata_t match, void *aux) 784smsc_match(device_t parent, cfdata_t match, void *aux)
787{ 785{
788 struct usb_attach_arg *uaa = aux; 786 struct usb_attach_arg *uaa = aux;
789 787
790 return (usb_lookup(smsc_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ? 788 return (usb_lookup(smsc_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ?
791 UMATCH_VENDOR_PRODUCT : UMATCH_NONE; 789 UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
792} 790}
793 791
794static void 792static void

cvs diff -r1.82 -r1.83 src/sys/dev/usb/if_udav.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_udav.c 2022/03/03 05:51:17 1.82
+++ src/sys/dev/usb/if_udav.c 2022/03/03 05:51:27 1.83
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_udav.c,v 1.82 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_udav.c,v 1.83 2022/03/03 05:51:27 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.82 2022/03/03 05:51:17 riastradh Exp $"); 48__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.83 2022/03/03 05:51:27 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 */
60static int udav_match(device_t, cfdata_t, void *); 60static int udav_match(device_t, cfdata_t, void *);
61static void udav_attach(device_t, device_t, void *); 61static void udav_attach(device_t, device_t, void *);
@@ -709,31 +709,29 @@ udav_uno_rx_loop(struct usbnet *un, stru @@ -709,31 +709,29 @@ udav_uno_rx_loop(struct usbnet *un, stru
709 pkt_len -= ETHER_CRC_LEN; 709 pkt_len -= ETHER_CRC_LEN;
710 710
711 DPRINTF(("%s: Rx deliver: 0x%02x\n", device_xname(un->un_dev), pkt_len)); 711 DPRINTF(("%s: Rx deliver: 0x%02x\n", device_xname(un->un_dev), pkt_len));
712 712
713 usbnet_enqueue(un, buf, pkt_len, 0, 0, 0); 713 usbnet_enqueue(un, buf, pkt_len, 0, 0, 0);
714} 714}
715 715
716static void 716static void
717udav_uno_mcast(struct ifnet *ifp) 717udav_uno_mcast(struct ifnet *ifp)
718{ 718{
719 struct usbnet * const un = ifp->if_softc; 719 struct usbnet * const un = ifp->if_softc;
720 720
721 usbnet_lock_core(un); 721 usbnet_lock_core(un);
722 usbnet_busy(un); 
723 722
724 udav_setiff_locked(un); 723 udav_setiff_locked(un);
725 724
726 usbnet_unbusy(un); 
727 usbnet_unlock_core(un); 725 usbnet_unlock_core(un);
728} 726}
729 727
730/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ 728/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */
731static void 729static void
732udav_uno_stop(struct ifnet *ifp, int disable) 730udav_uno_stop(struct ifnet *ifp, int disable)
733{ 731{
734 struct usbnet * const un = ifp->if_softc; 732 struct usbnet * const un = ifp->if_softc;
735 733
736 DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); 734 DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__));
737 735
738 udav_reset(un); 736 udav_reset(un);
739} 737}

cvs diff -r1.82 -r1.83 src/sys/dev/usb/if_url.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_url.c 2022/03/03 05:51:17 1.82
+++ src/sys/dev/usb/if_url.c 2022/03/03 05:51:27 1.83
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_url.c,v 1.82 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_url.c,v 1.83 2022/03/03 05:51:27 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.82 2022/03/03 05:51:17 riastradh Exp $"); 47__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.83 2022/03/03 05:51:27 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
@@ -551,31 +551,29 @@ url_uno_rx_loop(struct usbnet *un, struc @@ -551,31 +551,29 @@ url_uno_rx_loop(struct usbnet *un, struc
551 551
552#if 0 552#if 0
553static void url_intr(void) 553static void url_intr(void)
554{ 554{
555} 555}
556#endif 556#endif
557 557
558static void 558static void
559url_uno_mcast(struct ifnet *ifp) 559url_uno_mcast(struct ifnet *ifp)
560{ 560{
561 struct usbnet * const un = ifp->if_softc; 561 struct usbnet * const un = ifp->if_softc;
562 562
563 usbnet_lock_core(un); 563 usbnet_lock_core(un);
564 usbnet_busy(un); 
565 564
566 url_rcvfilt_locked(un); 565 url_rcvfilt_locked(un);
567 566
568 usbnet_unbusy(un); 
569 usbnet_unlock_core(un); 567 usbnet_unlock_core(un);
570} 568}
571 569
572/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */ 570/* Stop the adapter and free any mbufs allocated to the RX and TX lists. */
573static void 571static void
574url_uno_stop(struct ifnet *ifp, int disable) 572url_uno_stop(struct ifnet *ifp, int disable)
575{ 573{
576 struct usbnet * const un = ifp->if_softc; 574 struct usbnet * const un = ifp->if_softc;
577 575
578 DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); 576 DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__));
579 577
580 url_reset(un); 578 url_reset(un);
581} 579}

cvs diff -r1.44 -r1.45 src/sys/dev/usb/if_ure.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_ure.c 2022/03/03 05:51:17 1.44
+++ src/sys/dev/usb/if_ure.c 2022/03/03 05:51:27 1.45
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ure.c,v 1.44 2022/03/03 05:51:17 riastradh Exp $ */ 1/* $NetBSD: if_ure.c,v 1.45 2022/03/03 05:51:27 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.44 2022/03/03 05:51:17 riastradh Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.45 2022/03/03 05:51:27 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
@@ -794,31 +794,29 @@ ure_init_fifo(struct usbnet *un) @@ -794,31 +794,29 @@ ure_init_fifo(struct usbnet *un)
794 ure_write_4(un, URE_PLA_RXFIFO_CTRL2, URE_MCU_TYPE_PLA, rx_fifo2); 794 ure_write_4(un, URE_PLA_RXFIFO_CTRL2, URE_MCU_TYPE_PLA, rx_fifo2);
795 795
796 /* Configure Tx FIFO threshold. */ 796 /* Configure Tx FIFO threshold. */
797 ure_write_4(un, URE_PLA_TXFIFO_CTRL, URE_MCU_TYPE_PLA, 797 ure_write_4(un, URE_PLA_TXFIFO_CTRL, URE_MCU_TYPE_PLA,
798 URE_TXFIFO_THR_NORMAL); 798 URE_TXFIFO_THR_NORMAL);
799} 799}
800 800
801static void 801static void
802ure_uno_mcast(struct ifnet *ifp) 802ure_uno_mcast(struct ifnet *ifp)
803{ 803{
804 struct usbnet * const un = ifp->if_softc; 804 struct usbnet * const un = ifp->if_softc;
805 805
806 usbnet_lock_core(un); 806 usbnet_lock_core(un);
807 usbnet_busy(un); 
808 807
809 ure_rcvfilt_locked(un); 808 ure_rcvfilt_locked(un);
810 809
811 usbnet_unbusy(un); 
812 usbnet_unlock_core(un); 810 usbnet_unlock_core(un);
813} 811}
814 812
815static int 813static int
816ure_match(device_t parent, cfdata_t match, void *aux) 814ure_match(device_t parent, cfdata_t match, void *aux)
817{ 815{
818 struct usb_attach_arg *uaa = aux; 816 struct usb_attach_arg *uaa = aux;
819 817
820 return usb_lookup(ure_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL ? 818 return usb_lookup(ure_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL ?
821 UMATCH_VENDOR_PRODUCT : UMATCH_NONE; 819 UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
822} 820}
823 821
824static void 822static void