Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/net80211 Clean up locking around scan cancelation
details: https://anonhg.NetBSD.org/src-all/rev/d8288b0705b4
branches: trunk
changeset: 947074:d8288b0705b4
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Thu Dec 10 17:35:39 2020 +0100
description:
Clean up locking around scan cancelation
diffstat:
sys/dev/pci/if_iwm.c | 5 +----
sys/dev/pci/if_iwn.c | 9 ++-------
sys/net80211/ieee80211_adhoc.c | 4 ++--
sys/net80211/ieee80211_hostap.c | 4 ++--
sys/net80211/ieee80211_ioctl.c | 9 +--------
sys/net80211/ieee80211_mesh.c | 4 ++--
sys/net80211/ieee80211_proto.c | 2 +-
sys/net80211/ieee80211_scan.c | 7 +++++--
sys/net80211/ieee80211_scan.h | 2 +-
sys/net80211/ieee80211_sta.c | 4 ++--
sys/net80211/ieee80211_tdma.c | 2 +-
sys/net80211/ieee80211_wds.c | 4 ++--
12 files changed, 22 insertions(+), 34 deletions(-)
diffs (222 lines):
diff -r 40a048d2c93a -r d8288b0705b4 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/dev/pci/if_iwm.c Thu Dec 10 17:35:39 2020 +0100
@@ -8414,10 +8414,7 @@
IEEE80211_UNLOCK(ic);
ieee80211_scan_done(vap);
-
- IEEE80211_LOCK(ic);
- ieee80211_cancel_scan(vap);
- IEEE80211_UNLOCK(ic);
+ ieee80211_cancel_scan(vap, 0);
}
/*
diff -r 40a048d2c93a -r d8288b0705b4 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/dev/pci/if_iwn.c Thu Dec 10 17:35:39 2020 +0100
@@ -805,10 +805,7 @@
IEEE80211_UNLOCK(ic);
ieee80211_scan_done(vap);
-
- IEEE80211_LOCK(ic);
- ieee80211_cancel_scan(vap);
- IEEE80211_UNLOCK(ic);
+ ieee80211_cancel_scan(vap, 0);
if (vap->iv_state == IEEE80211_S_RUN) {
/* Set link LED to ON status if we are associated */
@@ -853,9 +850,7 @@
error = iwn_scan(ic, ss);
if (error != 0) {
- IEEE80211_LOCK(ic);
- ieee80211_cancel_scan(vap);
- IEEE80211_UNLOCK(ic);
+ ieee80211_cancel_scan(vap,0);
}
}
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_adhoc.c
--- a/sys/net80211/ieee80211_adhoc.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_adhoc.c Thu Dec 10 17:35:39 2020 +0100
@@ -162,13 +162,13 @@
ieee80211_state_name[nstate], arg);
vap->iv_state = nstate; /* state transition */
if (ostate != IEEE80211_S_SCAN)
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap,1); /* background scan */
ni = vap->iv_bss; /* NB: no reference held */
switch (nstate) {
case IEEE80211_S_INIT:
switch (ostate) {
case IEEE80211_S_SCAN:
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap,1);
break;
default:
break;
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_hostap.c
--- a/sys/net80211/ieee80211_hostap.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_hostap.c Thu Dec 10 17:35:39 2020 +0100
@@ -187,12 +187,12 @@
ieee80211_state_name[nstate], arg);
vap->iv_state = nstate; /* state transition */
if (ostate != IEEE80211_S_SCAN)
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap,1); /* background scan */
switch (nstate) {
case IEEE80211_S_INIT:
switch (ostate) {
case IEEE80211_S_SCAN:
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap,1);
break;
case IEEE80211_S_CAC:
ieee80211_dfs_cac_stop(vap);
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_ioctl.c Thu Dec 10 17:35:39 2020 +0100
@@ -3234,14 +3234,7 @@
case IEEE80211_IOC_SCAN_CANCEL:
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: cancel scan\n", __func__);
-#if __NetBSD__
- /* Bug in FreeBSD? */
- IEEE80211_LOCK(ic);
-#endif
- ieee80211_cancel_scan(vap);
-#if __NetBSD__
- IEEE80211_UNLOCK(ic);
-#endif
+ ieee80211_cancel_scan(vap,0);
break;
case IEEE80211_IOC_HTCONF:
if (ireq->i_val & 1)
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_mesh.c
--- a/sys/net80211/ieee80211_mesh.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_mesh.c Thu Dec 10 17:35:39 2020 +0100
@@ -732,7 +732,7 @@
ieee80211_state_name[nstate], arg);
vap->iv_state = nstate; /* state transition */
if (ostate != IEEE80211_S_SCAN)
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap,1); /* background scan */
ni = vap->iv_bss; /* NB: no reference held */
if (nstate != IEEE80211_S_RUN && ostate == IEEE80211_S_RUN) {
callout_drain(&ms->ms_cleantimer);
@@ -742,7 +742,7 @@
case IEEE80211_S_INIT:
switch (ostate) {
case IEEE80211_S_SCAN:
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap,1);
break;
case IEEE80211_S_CAC:
ieee80211_dfs_cac_stop(vap);
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_proto.c Thu Dec 10 17:35:39 2020 +0100
@@ -2462,7 +2462,7 @@
break;
case IEEE80211_S_INIT:
/* cancel any scan in progress */
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap,1);
if (ostate == IEEE80211_S_INIT ) {
/* XXX don't believe this */
/* INIT -> INIT. nothing to do */
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_scan.c
--- a/sys/net80211/ieee80211_scan.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_scan.c Thu Dec 10 17:35:39 2020 +0100
@@ -494,11 +494,15 @@
* Cancel any scan currently going on for the specified vap.
*/
void
-ieee80211_cancel_scan(struct ieee80211vap *vap)
+ieee80211_cancel_scan(struct ieee80211vap *vap, int ic_locked)
{
struct ieee80211com *ic = vap->iv_ic;
+ if (!ic_locked)
+ IEEE80211_LOCK(ic);
ic->ic_scan_methods->sc_cancel_scan(vap);
+ if (!ic_locked)
+ IEEE80211_UNLOCK(ic);
}
/*
@@ -630,7 +634,6 @@
{
struct ieee80211com *ic = vap->iv_ic;
- printf ("ieee80211_add_scan ...\n");
return (ic->ic_scan_methods->sc_add_scan(vap, curchan, sp, wh, subtype,
rssi, noise));
}
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_scan.h
--- a/sys/net80211/ieee80211_scan.h Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_scan.h Thu Dec 10 17:35:39 2020 +0100
@@ -176,7 +176,7 @@
u_int nssid, const struct ieee80211_scan_ssid ssids[]);
int ieee80211_check_scan_current(struct ieee80211vap *, int locked);
int ieee80211_bg_scan(struct ieee80211vap *, int);
-void ieee80211_cancel_scan(struct ieee80211vap *);
+void ieee80211_cancel_scan(struct ieee80211vap *, int ic_locked);
void ieee80211_cancel_anyscan(struct ieee80211vap *);
void ieee80211_scan_next(struct ieee80211vap *);
void ieee80211_scan_done(struct ieee80211vap *);
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_sta.c
--- a/sys/net80211/ieee80211_sta.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_sta.c Thu Dec 10 17:35:39 2020 +0100
@@ -269,7 +269,7 @@
vap->iv_state = nstate; /* state transition */
callout_stop(&vap->iv_mgtsend); /* XXX callout_drain */
if (ostate != IEEE80211_S_SCAN)
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap, 1); /* background scan */
ni = vap->iv_bss; /* NB: no reference held */
if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)
callout_stop(&vap->iv_swbmiss);
@@ -291,7 +291,7 @@
IEEE80211_REASON_AUTH_LEAVE);
break;
case IEEE80211_S_SCAN:
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap, 1);
break;
default:
break;
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_tdma.c
--- a/sys/net80211/ieee80211_tdma.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_tdma.c Thu Dec 10 17:35:39 2020 +0100
@@ -263,7 +263,7 @@
* we need to scan even if the channel is locked.
*/
vap->iv_state = nstate; /* state transition */
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap,1); /* background scan */
if (ostate == IEEE80211_S_RUN) {
/* purge station table; entries are stale */
ieee80211_iterate_nodes_vap(&ic->ic_sta, vap,
diff -r 40a048d2c93a -r d8288b0705b4 sys/net80211/ieee80211_wds.c
--- a/sys/net80211/ieee80211_wds.c Thu Dec 10 15:49:43 2020 +0100
+++ b/sys/net80211/ieee80211_wds.c Thu Dec 10 17:35:39 2020 +0100
@@ -389,13 +389,13 @@
vap->iv_state = nstate; /* state transition */
callout_stop(&vap->iv_mgtsend); /* XXX callout_drain */
if (ostate != IEEE80211_S_SCAN)
- ieee80211_cancel_scan(vap); /* background scan */
+ ieee80211_cancel_scan(vap,1); /* background scan */
error = 0;
switch (nstate) {
case IEEE80211_S_INIT:
switch (ostate) {
case IEEE80211_S_SCAN:
- ieee80211_cancel_scan(vap);
+ ieee80211_cancel_scan(vap,1);
break;
default:
break;
Home |
Main Index |
Thread Index |
Old Index