Skip to content

Commit 7947d3e

Browse files
AviSternjmberg-intel
authored andcommitted
mac80211: Add support for beacon report radio measurement
Add the following to support beacon report radio measurement with the measurement mode field set to passive or active: 1. Propagate the required scan duration to the device 2. Report the scan start time (in terms of TSF) 3. Report each BSS's detection time (also in terms of TSF) TSF times refer to the BSS that the interface that requested the scan is connected to. Signed-off-by: Assaf Krauss <[email protected]> Signed-off-by: Avraham Stern <[email protected]> [changed ath9k/10k, at76c59x-usb, iwlegacy, wl1251 and wlcore to match the new API] Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 1d76250 commit 7947d3e

File tree

15 files changed

+131
-35
lines changed

15 files changed

+131
-35
lines changed

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3858,12 +3858,16 @@ void __ath10k_scan_finish(struct ath10k *ar)
38583858
break;
38593859
case ATH10K_SCAN_RUNNING:
38603860
case ATH10K_SCAN_ABORTING:
3861-
if (!ar->scan.is_roc)
3862-
ieee80211_scan_completed(ar->hw,
3863-
(ar->scan.state ==
3864-
ATH10K_SCAN_ABORTING));
3865-
else if (ar->scan.roc_notify)
3861+
if (!ar->scan.is_roc) {
3862+
struct cfg80211_scan_info info = {
3863+
.aborted = (ar->scan.state ==
3864+
ATH10K_SCAN_ABORTING),
3865+
};
3866+
3867+
ieee80211_scan_completed(ar->hw, &info);
3868+
} else if (ar->scan.roc_notify) {
38663869
ieee80211_remain_on_channel_expired(ar->hw);
3870+
}
38673871
/* fall through */
38683872
case ATH10K_SCAN_STARTING:
38693873
ar->scan.state = ATH10K_SCAN_IDLE;

drivers/net/wireless/ath/ath9k/channel.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,9 @@ void ath_roc_complete(struct ath_softc *sc, enum ath_roc_complete_reason reason)
960960
void ath_scan_complete(struct ath_softc *sc, bool abort)
961961
{
962962
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
963+
struct cfg80211_scan_info info = {
964+
.aborted = abort,
965+
};
963966

964967
if (abort)
965968
ath_dbg(common, CHAN_CTX, "HW scan aborted\n");
@@ -969,7 +972,7 @@ void ath_scan_complete(struct ath_softc *sc, bool abort)
969972
sc->offchannel.scan_req = NULL;
970973
sc->offchannel.scan_vif = NULL;
971974
sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
972-
ieee80211_scan_completed(sc->hw, abort);
975+
ieee80211_scan_completed(sc->hw, &info);
973976
clear_bit(ATH_OP_SCANNING, &common->op_flags);
974977
spin_lock_bh(&sc->chan_lock);
975978
if (test_bit(ATH_OP_MULTI_CHANNEL, &common->op_flags))

drivers/net/wireless/atmel/at76c50x-usb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,9 @@ static void at76_dwork_hw_scan(struct work_struct *work)
19221922
{
19231923
struct at76_priv *priv = container_of(work, struct at76_priv,
19241924
dwork_hw_scan.work);
1925+
struct cfg80211_scan_info info = {
1926+
.aborted = false,
1927+
};
19251928
int ret;
19261929

19271930
if (priv->device_unplugged)
@@ -1948,7 +1951,7 @@ static void at76_dwork_hw_scan(struct work_struct *work)
19481951

19491952
mutex_unlock(&priv->mtx);
19501953

1951-
ieee80211_scan_completed(priv->hw, false);
1954+
ieee80211_scan_completed(priv->hw, &info);
19521955

19531956
ieee80211_wake_queues(priv->hw);
19541957
}

drivers/net/wireless/intel/iwlegacy/common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,14 @@ il_send_scan_abort(struct il_priv *il)
13051305
static void
13061306
il_complete_scan(struct il_priv *il, bool aborted)
13071307
{
1308+
struct cfg80211_scan_info info = {
1309+
.aborted = aborted,
1310+
};
1311+
13081312
/* check if scan was requested from mac80211 */
13091313
if (il->scan_request) {
13101314
D_SCAN("Complete scan in mac80211\n");
1311-
ieee80211_scan_completed(il->hw, aborted);
1315+
ieee80211_scan_completed(il->hw, &info);
13121316
}
13131317

13141318
il->scan_vif = NULL;

drivers/net/wireless/intel/iwlwifi/dvm/scan.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
9494

9595
static void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
9696
{
97+
struct cfg80211_scan_info info = {
98+
.aborted = aborted,
99+
};
100+
97101
/* check if scan was requested from mac80211 */
98102
if (priv->scan_request) {
99103
IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n");
100-
ieee80211_scan_completed(priv->hw, aborted);
104+
ieee80211_scan_completed(priv->hw, &info);
101105
}
102106

103107
priv->scan_type = IWL_SCAN_NORMAL;

drivers/net/wireless/intel/iwlwifi/mvm/scan.c

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,16 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
391391
ieee80211_sched_scan_stopped(mvm->hw);
392392
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
393393
} else if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) {
394+
struct cfg80211_scan_info info = {
395+
.aborted = aborted,
396+
};
397+
394398
IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s (FW)\n",
395399
aborted ? "aborted" : "completed",
396400
iwl_mvm_ebs_status_str(scan_notif->ebs_status));
397401

398402
mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR;
399-
ieee80211_scan_completed(mvm->hw,
400-
scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED);
403+
ieee80211_scan_completed(mvm->hw, &info);
401404
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
402405
del_timer(&mvm->scan_timer);
403406
} else {
@@ -1430,7 +1433,11 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
14301433

14311434
/* if the scan is already stopping, we don't need to notify mac80211 */
14321435
if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) {
1433-
ieee80211_scan_completed(mvm->hw, aborted);
1436+
struct cfg80211_scan_info info = {
1437+
.aborted = aborted,
1438+
};
1439+
1440+
ieee80211_scan_completed(mvm->hw, &info);
14341441
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
14351442
del_timer(&mvm->scan_timer);
14361443
} else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
@@ -1564,7 +1571,11 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
15641571

15651572
uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_REGULAR);
15661573
if (uid >= 0) {
1567-
ieee80211_scan_completed(mvm->hw, true);
1574+
struct cfg80211_scan_info info = {
1575+
.aborted = true,
1576+
};
1577+
1578+
ieee80211_scan_completed(mvm->hw, &info);
15681579
mvm->scan_uid_status[uid] = 0;
15691580
}
15701581
uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_SCHED);
@@ -1585,8 +1596,13 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
15851596
mvm->scan_uid_status[i] = 0;
15861597
}
15871598
} else {
1588-
if (mvm->scan_status & IWL_MVM_SCAN_REGULAR)
1589-
ieee80211_scan_completed(mvm->hw, true);
1599+
if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) {
1600+
struct cfg80211_scan_info info = {
1601+
.aborted = true,
1602+
};
1603+
1604+
ieee80211_scan_completed(mvm->hw, &info);
1605+
}
15901606

15911607
/* Sched scan will be restarted by mac80211 in
15921608
* restart_hw, so do not report if FW is about to be
@@ -1629,8 +1645,13 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify)
16291645
*/
16301646
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
16311647
del_timer(&mvm->scan_timer);
1632-
if (notify)
1633-
ieee80211_scan_completed(mvm->hw, true);
1648+
if (notify) {
1649+
struct cfg80211_scan_info info = {
1650+
.aborted = true,
1651+
};
1652+
1653+
ieee80211_scan_completed(mvm->hw, &info);
1654+
}
16341655
} else if (notify) {
16351656
ieee80211_sched_scan_stopped(mvm->hw);
16361657
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,8 +1941,12 @@ static void hw_scan_work(struct work_struct *work)
19411941

19421942
mutex_lock(&hwsim->mutex);
19431943
if (hwsim->scan_chan_idx >= req->n_channels) {
1944+
struct cfg80211_scan_info info = {
1945+
.aborted = false,
1946+
};
1947+
19441948
wiphy_debug(hwsim->hw->wiphy, "hw scan complete\n");
1945-
ieee80211_scan_completed(hwsim->hw, false);
1949+
ieee80211_scan_completed(hwsim->hw, &info);
19461950
hwsim->hw_scan_request = NULL;
19471951
hwsim->hw_scan_vif = NULL;
19481952
hwsim->tmp_chan = NULL;
@@ -2027,13 +2031,16 @@ static void mac80211_hwsim_cancel_hw_scan(struct ieee80211_hw *hw,
20272031
struct ieee80211_vif *vif)
20282032
{
20292033
struct mac80211_hwsim_data *hwsim = hw->priv;
2034+
struct cfg80211_scan_info info = {
2035+
.aborted = true,
2036+
};
20302037

20312038
wiphy_debug(hw->wiphy, "hwsim cancel_hw_scan\n");
20322039

20332040
cancel_delayed_work_sync(&hwsim->hw_scan);
20342041

20352042
mutex_lock(&hwsim->mutex);
2036-
ieee80211_scan_completed(hwsim->hw, true);
2043+
ieee80211_scan_completed(hwsim->hw, &info);
20372044
hwsim->tmp_chan = NULL;
20382045
hwsim->hw_scan_request = NULL;
20392046
hwsim->hw_scan_vif = NULL;

drivers/net/wireless/st/cw1200/scan.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ void cw1200_scan_work(struct work_struct *work)
167167
}
168168

169169
if (!priv->scan.req || (priv->scan.curr == priv->scan.end)) {
170+
struct cfg80211_scan_info info = {
171+
.aborted = priv->scan.status ? 1 : 0,
172+
};
173+
170174
if (priv->scan.output_power != priv->output_power)
171175
wsm_set_output_power(priv, priv->output_power * 10);
172176
if (priv->join_status == CW1200_JOIN_STATUS_STA &&
@@ -188,7 +192,7 @@ void cw1200_scan_work(struct work_struct *work)
188192
cw1200_scan_restart_delayed(priv);
189193
wsm_unlock_tx(priv);
190194
mutex_unlock(&priv->conf_mutex);
191-
ieee80211_scan_completed(priv->hw, priv->scan.status ? 1 : 0);
195+
ieee80211_scan_completed(priv->hw, &info);
192196
up(&priv->scan.lock);
193197
return;
194198
} else {

drivers/net/wireless/ti/wl1251/event.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ static int wl1251_event_scan_complete(struct wl1251 *wl,
3636
mbox->scheduled_scan_channels);
3737

3838
if (wl->scanning) {
39-
ieee80211_scan_completed(wl->hw, false);
39+
struct cfg80211_scan_info info = {
40+
.aborted = false,
41+
};
42+
43+
ieee80211_scan_completed(wl->hw, &info);
4044
wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan completed");
4145
wl->scanning = false;
4246
if (wl->hw->conf.flags & IEEE80211_CONF_IDLE)

drivers/net/wireless/ti/wl1251/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
448448
WARN_ON(wl->state != WL1251_STATE_ON);
449449

450450
if (wl->scanning) {
451-
ieee80211_scan_completed(wl->hw, true);
451+
struct cfg80211_scan_info info = {
452+
.aborted = true,
453+
};
454+
455+
ieee80211_scan_completed(wl->hw, &info);
452456
wl->scanning = false;
453457
}
454458

drivers/net/wireless/ti/wlcore/main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,6 +2615,10 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
26152615

26162616
if (wl->scan.state != WL1271_SCAN_STATE_IDLE &&
26172617
wl->scan_wlvif == wlvif) {
2618+
struct cfg80211_scan_info info = {
2619+
.aborted = true,
2620+
};
2621+
26182622
/*
26192623
* Rearm the tx watchdog just before idling scan. This
26202624
* prevents just-finished scans from triggering the watchdog
@@ -2625,7 +2629,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
26252629
memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
26262630
wl->scan_wlvif = NULL;
26272631
wl->scan.req = NULL;
2628-
ieee80211_scan_completed(wl->hw, true);
2632+
ieee80211_scan_completed(wl->hw, &info);
26292633
}
26302634

26312635
if (wl->sched_vif == wlvif)
@@ -3649,6 +3653,9 @@ static void wl1271_op_cancel_hw_scan(struct ieee80211_hw *hw,
36493653
{
36503654
struct wl1271 *wl = hw->priv;
36513655
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
3656+
struct cfg80211_scan_info info = {
3657+
.aborted = true,
3658+
};
36523659
int ret;
36533660

36543661
wl1271_debug(DEBUG_MAC80211, "mac80211 cancel hw scan");
@@ -3681,7 +3688,7 @@ static void wl1271_op_cancel_hw_scan(struct ieee80211_hw *hw,
36813688
memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
36823689
wl->scan_wlvif = NULL;
36833690
wl->scan.req = NULL;
3684-
ieee80211_scan_completed(wl->hw, true);
3691+
ieee80211_scan_completed(wl->hw, &info);
36853692

36863693
out_sleep:
36873694
wl1271_ps_elp_sleep(wl);

drivers/net/wireless/ti/wlcore/scan.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ void wl1271_scan_complete_work(struct work_struct *work)
3636
struct delayed_work *dwork;
3737
struct wl1271 *wl;
3838
struct wl12xx_vif *wlvif;
39+
struct cfg80211_scan_info info = {
40+
.aborted = false,
41+
};
3942
int ret;
4043

4144
dwork = to_delayed_work(work);
@@ -82,7 +85,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
8285

8386
wlcore_cmd_regdomain_config_locked(wl);
8487

85-
ieee80211_scan_completed(wl->hw, false);
88+
ieee80211_scan_completed(wl->hw, &info);
8689

8790
out:
8891
mutex_unlock(&wl->mutex);

include/net/mac80211.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4697,9 +4697,10 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
46974697
* any context, including hardirq context.
46984698
*
46994699
* @hw: the hardware that finished the scan
4700-
* @aborted: set to true if scan was aborted
4700+
* @info: information about the completed scan
47014701
*/
4702-
void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
4702+
void ieee80211_scan_completed(struct ieee80211_hw *hw,
4703+
struct cfg80211_scan_info *info);
47034704

47044705
/**
47054706
* ieee80211_sched_scan_results - got results from scheduled scan

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ struct ieee80211_local {
12501250
int scan_channel_idx;
12511251
int scan_ies_len;
12521252
int hw_scan_ies_bufsize;
1253+
struct cfg80211_scan_info scan_info;
12531254

12541255
struct work_struct sched_scan_stopped_work;
12551256
struct ieee80211_sub_if_data __rcu *sched_scan_sdata;

0 commit comments

Comments
 (0)