Thu Dec 5 03:11:41 2019 UTC ()
 Remove SIOC[GS]IFMEDIA because ieee80211_ioctl() does the same thing.


(msaitoh)
diff -r1.98 -r1.99 src/sys/dev/ic/awi.c
diff -r1.253 -r1.254 src/sys/dev/ic/wi.c
diff -r1.67 -r1.68 src/sys/dev/usb/if_atu.c

cvs diff -r1.98 -r1.99 src/sys/dev/ic/awi.c (expand / switch to unified diff)

--- src/sys/dev/ic/awi.c 2019/05/28 07:41:48 1.98
+++ src/sys/dev/ic/awi.c 2019/12/05 03:11:40 1.99
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: awi.c,v 1.98 2019/05/28 07:41:48 msaitoh Exp $ */ 1/* $NetBSD: awi.c,v 1.99 2019/12/05 03:11:40 msaitoh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Bill Sommerfeld 8 * by Bill Sommerfeld
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.
@@ -68,27 +68,27 @@ @@ -68,27 +68,27 @@
68 */ 68 */
69 69
70/* 70/*
71 * Driver for AMD 802.11 PCnetMobile firmware. 71 * Driver for AMD 802.11 PCnetMobile firmware.
72 * Uses am79c930 chip driver to talk to firmware running on the am79c930. 72 * Uses am79c930 chip driver to talk to firmware running on the am79c930.
73 * 73 *
74 * The initial version of the driver was written by 74 * The initial version of the driver was written by
75 * Bill Sommerfeld <sommerfeld@NetBSD.org>. 75 * Bill Sommerfeld <sommerfeld@NetBSD.org>.
76 * Then the driver module completely rewritten to support cards with DS phy 76 * Then the driver module completely rewritten to support cards with DS phy
77 * and to support adhoc mode by Atsushi Onoe <onoe@NetBSD.org> 77 * and to support adhoc mode by Atsushi Onoe <onoe@NetBSD.org>
78 */ 78 */
79 79
80#include <sys/cdefs.h> 80#include <sys/cdefs.h>
81__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.98 2019/05/28 07:41:48 msaitoh Exp $"); 81__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.99 2019/12/05 03:11:40 msaitoh Exp $");
82 82
83#include "opt_inet.h" 83#include "opt_inet.h"
84 84
85#include <sys/param.h> 85#include <sys/param.h>
86#include <sys/systm.h> 86#include <sys/systm.h>
87#include <sys/kernel.h> 87#include <sys/kernel.h>
88#include <sys/mbuf.h> 88#include <sys/mbuf.h>
89#include <sys/malloc.h> 89#include <sys/malloc.h>
90#include <sys/proc.h> 90#include <sys/proc.h>
91#include <sys/socket.h> 91#include <sys/socket.h>
92#include <sys/sockio.h> 92#include <sys/sockio.h>
93#include <sys/errno.h> 93#include <sys/errno.h>
94#include <sys/endian.h> 94#include <sys/endian.h>
@@ -823,55 +823,50 @@ awi_watchdog(struct ifnet *ifp) @@ -823,55 +823,50 @@ awi_watchdog(struct ifnet *ifp)
823 } else 823 } else
824 ifp->if_timer = 1; 824 ifp->if_timer = 1;
825 } 825 }
826 /* TODO: rate control */ 826 /* TODO: rate control */
827 ieee80211_watchdog(&sc->sc_ic); 827 ieee80211_watchdog(&sc->sc_ic);
828 out: 828 out:
829 sc->sc_cansleep = ocansleep; 829 sc->sc_cansleep = ocansleep;
830} 830}
831 831
832static int 832static int
833awi_ioctl(struct ifnet *ifp, u_long cmd, void *data) 833awi_ioctl(struct ifnet *ifp, u_long cmd, void *data)
834{ 834{
835 struct awi_softc *sc = ifp->if_softc; 835 struct awi_softc *sc = ifp->if_softc;
836 struct ifreq *ifr = (struct ifreq *)data; 
837 int s, error; 836 int s, error;
838 837
839 s = splnet(); 838 s = splnet();
840 /* Serialize ioctl, since we may sleep */ 839 /* Serialize ioctl, since we may sleep */
841 if ((error = awi_lock(sc)) != 0) 840 if ((error = awi_lock(sc)) != 0)
842 goto cantlock; 841 goto cantlock;
843 842
844 switch (cmd) { 843 switch (cmd) {
845 case SIOCSIFFLAGS: 844 case SIOCSIFFLAGS:
846 if ((error = ifioctl_common(ifp, cmd, data)) != 0) 845 if ((error = ifioctl_common(ifp, cmd, data)) != 0)
847 break; 846 break;
848 if (ifp->if_flags & IFF_UP) { 847 if (ifp->if_flags & IFF_UP) {
849 if (sc->sc_enabled) { 848 if (sc->sc_enabled) {
850 /* 849 /*
851 * To avoid rescanning another access point, 850 * To avoid rescanning another access point,
852 * do not call awi_init() here. Instead, 851 * do not call awi_init() here. Instead,
853 * only reflect promisc mode settings. 852 * only reflect promisc mode settings.
854 */ 853 */
855 error = awi_mode_init(sc); 854 error = awi_mode_init(sc);
856 } else 855 } else
857 error = awi_init(ifp); 856 error = awi_init(ifp);
858 } else if (sc->sc_enabled) 857 } else if (sc->sc_enabled)
859 awi_stop(ifp, 1); 858 awi_stop(ifp, 1);
860 break; 859 break;
861 case SIOCSIFMEDIA: 
862 case SIOCGIFMEDIA: 
863 error = ifmedia_ioctl(ifp, ifr, &sc->sc_ic.ic_media, cmd); 
864 break; 
865 case SIOCADDMULTI: 860 case SIOCADDMULTI:
866 case SIOCDELMULTI: 861 case SIOCDELMULTI:
867 error = ether_ioctl(ifp, cmd, data); 862 error = ether_ioctl(ifp, cmd, data);
868 if (error == ENETRESET) { 863 if (error == ENETRESET) {
869 /* Do not rescan */ 864 /* Do not rescan */
870 if (ifp->if_flags & IFF_RUNNING) 865 if (ifp->if_flags & IFF_RUNNING)
871 error = awi_mode_init(sc); 866 error = awi_mode_init(sc);
872 else 867 else
873 error = 0; 868 error = 0;
874 } 869 }
875 break; 870 break;
876 default: 871 default:
877 error = ieee80211_ioctl(&sc->sc_ic, cmd, data); 872 error = ieee80211_ioctl(&sc->sc_ic, cmd, data);

cvs diff -r1.253 -r1.254 src/sys/dev/ic/wi.c (expand / switch to unified diff)

--- src/sys/dev/ic/wi.c 2019/05/28 07:41:48 1.253
+++ src/sys/dev/ic/wi.c 2019/12/05 03:11:40 1.254
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wi.c,v 1.253 2019/05/28 07:41:48 msaitoh Exp $ */ 1/* $NetBSD: wi.c,v 1.254 2019/12/05 03:11:40 msaitoh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
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.
@@ -89,27 +89,27 @@ @@ -89,27 +89,27 @@
89 * WaveLAN/IEEE cards. Note however that the ISA card isn't really 89 * WaveLAN/IEEE cards. Note however that the ISA card isn't really
90 * anything of the sort: it's actually a PCMCIA bridge adapter 90 * anything of the sort: it's actually a PCMCIA bridge adapter
91 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is 91 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is
92 * inserted. Consequently, you need to use the pccard support for 92 * inserted. Consequently, you need to use the pccard support for
93 * both the ISA and PCMCIA adapters. 93 * both the ISA and PCMCIA adapters.
94 */ 94 */
95 95
96/* 96/*
97 * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the 97 * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the
98 * Oslo IETF plenary meeting. 98 * Oslo IETF plenary meeting.
99 */ 99 */
100 100
101#include <sys/cdefs.h> 101#include <sys/cdefs.h>
102__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.253 2019/05/28 07:41:48 msaitoh Exp $"); 102__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.254 2019/12/05 03:11:40 msaitoh Exp $");
103 103
104#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ 104#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
105#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ 105#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
106#undef WI_HISTOGRAM 106#undef WI_HISTOGRAM
107#undef WI_RING_DEBUG 107#undef WI_RING_DEBUG
108#define STATIC static 108#define STATIC static
109 109
110 110
111#include <sys/param.h> 111#include <sys/param.h>
112#include <sys/sysctl.h> 112#include <sys/sysctl.h>
113#include <sys/systm.h> 113#include <sys/systm.h>
114#include <sys/callout.h> 114#include <sys/callout.h>
115#include <sys/device.h> 115#include <sys/device.h>
@@ -1409,27 +1409,26 @@ wi_ioctl_drain(struct wi_softc *sc) @@ -1409,27 +1409,26 @@ wi_ioctl_drain(struct wi_softc *sc)
1409 mutex_exit(&sc->sc_ioctl_mtx); 1409 mutex_exit(&sc->sc_ioctl_mtx);
1410 1410
1411 wi_ioctl_exit(sc); 1411 wi_ioctl_exit(sc);
1412 1412
1413 mutex_destroy(&sc->sc_ioctl_mtx); 1413 mutex_destroy(&sc->sc_ioctl_mtx);
1414 cv_destroy(&sc->sc_ioctl_cv); 1414 cv_destroy(&sc->sc_ioctl_cv);
1415} 1415}
1416 1416
1417STATIC int 1417STATIC int
1418wi_ioctl(struct ifnet *ifp, u_long cmd, void *data) 1418wi_ioctl(struct ifnet *ifp, u_long cmd, void *data)
1419{ 1419{
1420 struct wi_softc *sc = ifp->if_softc; 1420 struct wi_softc *sc = ifp->if_softc;
1421 struct ieee80211com *ic = &sc->sc_ic; 1421 struct ieee80211com *ic = &sc->sc_ic;
1422 struct ifreq *ifr = (struct ifreq *)data; 
1423 int s, error = 0; 1422 int s, error = 0;
1424 1423
1425 if (!device_is_active(sc->sc_dev)) 1424 if (!device_is_active(sc->sc_dev))
1426 return ENXIO; 1425 return ENXIO;
1427 1426
1428 s = splnet(); 1427 s = splnet();
1429 1428
1430 if ((error = wi_ioctl_enter(sc)) != 0) { 1429 if ((error = wi_ioctl_enter(sc)) != 0) {
1431 splx(s); 1430 splx(s);
1432 return error; 1431 return error;
1433 } 1432 }
1434 1433
1435 switch (cmd) { 1434 switch (cmd) {
@@ -1443,30 +1442,26 @@ wi_ioctl(struct ifnet *ifp, u_long cmd,  @@ -1443,30 +1442,26 @@ wi_ioctl(struct ifnet *ifp, u_long cmd,
1443 */ 1442 */
1444 if (ifp->if_flags & IFF_UP) { 1443 if (ifp->if_flags & IFF_UP) {
1445 if (sc->sc_enabled) { 1444 if (sc->sc_enabled) {
1446 if (ic->ic_opmode != IEEE80211_M_HOSTAP && 1445 if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
1447 (ifp->if_flags & IFF_PROMISC) != 0) 1446 (ifp->if_flags & IFF_PROMISC) != 0)
1448 wi_write_val(sc, WI_RID_PROMISC, 1); 1447 wi_write_val(sc, WI_RID_PROMISC, 1);
1449 else 1448 else
1450 wi_write_val(sc, WI_RID_PROMISC, 0); 1449 wi_write_val(sc, WI_RID_PROMISC, 0);
1451 } else 1450 } else
1452 error = wi_init(ifp); 1451 error = wi_init(ifp);
1453 } else if (sc->sc_enabled) 1452 } else if (sc->sc_enabled)
1454 wi_stop(ifp, 1); 1453 wi_stop(ifp, 1);
1455 break; 1454 break;
1456 case SIOCSIFMEDIA: 
1457 case SIOCGIFMEDIA: 
1458 error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); 
1459 break; 
1460 case SIOCADDMULTI: 1455 case SIOCADDMULTI:
1461 case SIOCDELMULTI: 1456 case SIOCDELMULTI:
1462 if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { 1457 if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
1463 if (ifp->if_flags & IFF_RUNNING) { 1458 if (ifp->if_flags & IFF_RUNNING) {
1464 /* do not rescan */ 1459 /* do not rescan */
1465 error = wi_write_multi(sc); 1460 error = wi_write_multi(sc);
1466 } else 1461 } else
1467 error = 0; 1462 error = 0;
1468 } 1463 }
1469 break; 1464 break;
1470 case SIOCGIFGENERIC: 1465 case SIOCGIFGENERIC:
1471 error = wi_get_cfg(ifp, cmd, data); 1466 error = wi_get_cfg(ifp, cmd, data);
1472 break; 1467 break;

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

--- src/sys/dev/usb/if_atu.c 2019/12/01 12:47:10 1.67
+++ src/sys/dev/usb/if_atu.c 2019/12/05 03:11:41 1.68
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_atu.c,v 1.67 2019/12/01 12:47:10 maxv Exp $ */ 1/* $NetBSD: if_atu.c,v 1.68 2019/12/05 03:11:41 msaitoh Exp $ */
2/* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */ 2/* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
3/* 3/*
4 * Copyright (c) 2003, 2004 4 * Copyright (c) 2003, 2004
5 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. 5 * Daan Vreeken <Danovitsch@Vitsch.net>. 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.
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 * 38 *
39 * Originally written by Daan Vreeken <Danovitsch @ Vitsch . net> 39 * Originally written by Daan Vreeken <Danovitsch @ Vitsch . net>
40 * http://vitsch.net/bsd/atuwi 40 * http://vitsch.net/bsd/atuwi
41 * 41 *
42 * Contributed to by : 42 * Contributed to by :
43 * Chris Whitehouse, Alistair Phillips, Peter Pilka, Martijn van Buul, 43 * Chris Whitehouse, Alistair Phillips, Peter Pilka, Martijn van Buul,
44 * Suihong Liang, Arjan van Leeuwen, Stuart Walsh 44 * Suihong Liang, Arjan van Leeuwen, Stuart Walsh
45 * 45 *
46 * Ported to OpenBSD by Theo de Raadt and David Gwynne. 46 * Ported to OpenBSD by Theo de Raadt and David Gwynne.
47 * Ported to NetBSD by Jesse Off 47 * Ported to NetBSD by Jesse Off
48 */ 48 */
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.67 2019/12/01 12:47:10 maxv Exp $"); 51__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.68 2019/12/05 03:11:41 msaitoh Exp $");
52 52
53#ifdef _KERNEL_OPT 53#ifdef _KERNEL_OPT
54#include "opt_usb.h" 54#include "opt_usb.h"
55#endif 55#endif
56 56
57#include <sys/param.h> 57#include <sys/param.h>
58#include <sys/sockio.h> 58#include <sys/sockio.h>
59#include <sys/mbuf.h> 59#include <sys/mbuf.h>
60#include <sys/kernel.h> 60#include <sys/kernel.h>
61#include <sys/socket.h> 61#include <sys/socket.h>
62#include <sys/systm.h> 62#include <sys/systm.h>
63#include <sys/kthread.h> 63#include <sys/kthread.h>
64#include <sys/queue.h> 64#include <sys/queue.h>
@@ -2128,37 +2128,31 @@ atu_debug_print(struct atu_softc *sc) @@ -2128,37 +2128,31 @@ atu_debug_print(struct atu_softc *sc)
2128 tmp)); 2128 tmp));
2129 2129
2130 if ((err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_ESSID, tmp))) 2130 if ((err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_ESSID, tmp)))
2131 return; 2131 return;
2132 DPRINTF(("%s: DEBUG: current ESSID=%s\n", device_xname(sc->atu_dev), 2132 DPRINTF(("%s: DEBUG: current ESSID=%s\n", device_xname(sc->atu_dev),
2133 tmp)); 2133 tmp));
2134} 2134}
2135#endif /* ATU_DEBUG */ 2135#endif /* ATU_DEBUG */
2136 2136
2137static int 2137static int
2138atu_ioctl(struct ifnet *ifp, u_long command, void *data) 2138atu_ioctl(struct ifnet *ifp, u_long command, void *data)
2139{ 2139{
2140 struct atu_softc *sc = ifp->if_softc; 2140 struct atu_softc *sc = ifp->if_softc;
2141 struct ifreq *ifr = (struct ifreq *)data; 
2142 struct ieee80211com *ic = &sc->sc_ic; 2141 struct ieee80211com *ic = &sc->sc_ic;
2143 int err = 0, s; 2142 int err = 0, s;
2144 2143
2145 s = splnet(); 2144 s = splnet();
2146 switch (command) { 2145 switch (command) {
2147 case SIOCSIFMEDIA: 
2148 case SIOCGIFMEDIA: 
2149 err = ifmedia_ioctl(ifp, ifr, &ic->ic_media, command); 
2150 break; 
2151 
2152 default: 2146 default:
2153 DPRINTFN(15, ("%s: ieee80211_ioctl (%lu)\n", 2147 DPRINTFN(15, ("%s: ieee80211_ioctl (%lu)\n",
2154 device_xname(sc->atu_dev), command)); 2148 device_xname(sc->atu_dev), command));
2155 err = ieee80211_ioctl(ic, command, data); 2149 err = ieee80211_ioctl(ic, command, data);
2156 break; 2150 break;
2157 } 2151 }
2158 2152
2159 if (err == ENETRESET) { 2153 if (err == ENETRESET) {
2160 if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) == 2154 if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) ==
2161 (IFF_RUNNING|IFF_UP)) { 2155 (IFF_RUNNING|IFF_UP)) {
2162 DPRINTF(("%s: atu_ioctl(): netreset %lu\n", 2156 DPRINTF(("%s: atu_ioctl(): netreset %lu\n",
2163 device_xname(sc->atu_dev), command)); 2157 device_xname(sc->atu_dev), command));
2164 ieee80211_new_state(ic, IEEE80211_S_INIT, -1); 2158 ieee80211_new_state(ic, IEEE80211_S_INIT, -1);