Skip to content

Commit 8bf6008

Browse files
committed
Merge tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
Kalle Valo says: ==================== wireless fixes for v5.18 Second set of fixes for v5.18 and hopefully the last one. We have a new iwlwifi maintainer, a fix to rfkill ioctl interface and important fixes to both stack and two drivers. * tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless: rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition nl80211: fix locking in nl80211_set_tx_bitrate_mask() mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection mac80211_hwsim: fix RCU protected chanctx access mailmap: update Kalle Valo's email mac80211: Reset MBSSID parameters upon connection cfg80211: retrieve S1G operating channel number nl80211: validate S1G channel width mac80211: fix rx reordering with non explicit / psmp ack policy ath11k: reduce the wait time of 11d scan and hw scan while add interface MAINTAINERS: update iwlwifi driver maintainer iwlwifi: iwl-dbg: Use del_timer_sync() before freeing ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 3f95a74 + a36e07d commit 8bf6008

File tree

16 files changed

+120
-74
lines changed

16 files changed

+120
-74
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Juha Yrjola <at solidboot.com>
204204
Juha Yrjola <[email protected]>
205205
Juha Yrjola <[email protected]>
206206
207+
207208
208209
Kay Sievers <[email protected]>
209210

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10132,7 +10132,7 @@ S: Supported
1013210132
F: drivers/net/wireless/intel/iwlegacy/
1013310133

1013410134
INTEL WIRELESS WIFI LINK (iwlwifi)
10135-
M: Luca Coelho <luciano.coelho@intel.com>
10135+
M: Gregory Greenman <gregory.greenman@intel.com>
1013610136
1013710137
S: Supported
1013810138
W: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,7 @@ static void ath11k_core_restart(struct work_struct *work)
12881288

12891289
ieee80211_stop_queues(ar->hw);
12901290
ath11k_mac_drain_tx(ar);
1291+
complete(&ar->completed_11d_scan);
12911292
complete(&ar->scan.started);
12921293
complete(&ar->scan.completed);
12931294
complete(&ar->peer_assoc_done);

drivers/net/wireless/ath/ath11k/core.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
extern unsigned int ath11k_frame_mode;
4040

41+
#define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ)
42+
4143
#define ATH11K_MON_TIMER_INTERVAL 10
4244

4345
enum ath11k_supported_bw {
@@ -189,6 +191,12 @@ enum ath11k_scan_state {
189191
ATH11K_SCAN_ABORTING,
190192
};
191193

194+
enum ath11k_11d_state {
195+
ATH11K_11D_IDLE,
196+
ATH11K_11D_PREPARING,
197+
ATH11K_11D_RUNNING,
198+
};
199+
192200
enum ath11k_dev_flags {
193201
ATH11K_CAC_RUNNING,
194202
ATH11K_FLAG_CORE_REGISTERED,
@@ -607,9 +615,8 @@ struct ath11k {
607615
bool dfs_block_radar_events;
608616
struct ath11k_thermal thermal;
609617
u32 vdev_id_11d_scan;
610-
struct completion finish_11d_scan;
611-
struct completion finish_11d_ch_list;
612-
bool pending_11d;
618+
struct completion completed_11d_scan;
619+
enum ath11k_11d_state state_11d;
613620
bool regdom_set_by_user;
614621
int hw_rate_code;
615622
u8 twt_enabled;

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

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,26 +3601,6 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw,
36013601
if (ret)
36023602
goto exit;
36033603

3604-
/* Currently the pending_11d=true only happened 1 time while
3605-
* wlan interface up in ath11k_mac_11d_scan_start(), it is called by
3606-
* ath11k_mac_op_add_interface(), after wlan interface up,
3607-
* pending_11d=false always.
3608-
* If remove below wait, it always happened scan fail and lead connect
3609-
* fail while wlan interface up, because it has a 11d scan which is running
3610-
* in firmware, and lead this scan failed.
3611-
*/
3612-
if (ar->pending_11d) {
3613-
long time_left;
3614-
unsigned long timeout = 5 * HZ;
3615-
3616-
if (ar->supports_6ghz)
3617-
timeout += 5 * HZ;
3618-
3619-
time_left = wait_for_completion_timeout(&ar->finish_11d_ch_list, timeout);
3620-
ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
3621-
"mac wait 11d channel list time left %ld\n", time_left);
3622-
}
3623-
36243604
memset(&arg, 0, sizeof(arg));
36253605
ath11k_wmi_start_scan_init(ar, &arg);
36263606
arg.vdev_id = arvif->vdev_id;
@@ -3686,6 +3666,10 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw,
36863666
kfree(arg.extraie.ptr);
36873667

36883668
mutex_unlock(&ar->conf_mutex);
3669+
3670+
if (ar->state_11d == ATH11K_11D_PREPARING)
3671+
ath11k_mac_11d_scan_start(ar, arvif->vdev_id);
3672+
36893673
return ret;
36903674
}
36913675

@@ -5814,7 +5798,7 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
58145798

58155799
/* TODO: Do we need to enable ANI? */
58165800

5817-
ath11k_reg_update_chan_list(ar);
5801+
ath11k_reg_update_chan_list(ar, false);
58185802

58195803
ar->num_started_vdevs = 0;
58205804
ar->num_created_vdevs = 0;
@@ -5881,6 +5865,11 @@ static void ath11k_mac_op_stop(struct ieee80211_hw *hw)
58815865
cancel_work_sync(&ar->ab->update_11d_work);
58825866
cancel_work_sync(&ar->ab->rfkill_work);
58835867

5868+
if (ar->state_11d == ATH11K_11D_PREPARING) {
5869+
ar->state_11d = ATH11K_11D_IDLE;
5870+
complete(&ar->completed_11d_scan);
5871+
}
5872+
58845873
spin_lock_bh(&ar->data_lock);
58855874
list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) {
58865875
list_del(&ppdu_stats->list);
@@ -6051,7 +6040,7 @@ static bool ath11k_mac_vif_ap_active_any(struct ath11k_base *ab)
60516040
return false;
60526041
}
60536042

6054-
void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait)
6043+
void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id)
60556044
{
60566045
struct wmi_11d_scan_start_params param;
60576046
int ret;
@@ -6079,28 +6068,22 @@ void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait)
60796068

60806069
ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac start 11d scan\n");
60816070

6082-
if (wait)
6083-
reinit_completion(&ar->finish_11d_scan);
6084-
60856071
ret = ath11k_wmi_send_11d_scan_start_cmd(ar, &param);
60866072
if (ret) {
60876073
ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n",
60886074
vdev_id, ret);
60896075
} else {
60906076
ar->vdev_id_11d_scan = vdev_id;
6091-
if (wait) {
6092-
ar->pending_11d = true;
6093-
ret = wait_for_completion_timeout(&ar->finish_11d_scan,
6094-
5 * HZ);
6095-
ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
6096-
"mac 11d scan left time %d\n", ret);
6097-
6098-
if (!ret)
6099-
ar->pending_11d = false;
6100-
}
6077+
if (ar->state_11d == ATH11K_11D_PREPARING)
6078+
ar->state_11d = ATH11K_11D_RUNNING;
61016079
}
61026080

61036081
fin:
6082+
if (ar->state_11d == ATH11K_11D_PREPARING) {
6083+
ar->state_11d = ATH11K_11D_IDLE;
6084+
complete(&ar->completed_11d_scan);
6085+
}
6086+
61046087
mutex_unlock(&ar->ab->vdev_id_11d_lock);
61056088
}
61066089

@@ -6123,12 +6106,15 @@ void ath11k_mac_11d_scan_stop(struct ath11k *ar)
61236106
vdev_id = ar->vdev_id_11d_scan;
61246107

61256108
ret = ath11k_wmi_send_11d_scan_stop_cmd(ar, vdev_id);
6126-
if (ret)
6109+
if (ret) {
61276110
ath11k_warn(ar->ab,
61286111
"failed to stopt 11d scan vdev %d ret: %d\n",
61296112
vdev_id, ret);
6130-
else
6113+
} else {
61316114
ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID;
6115+
ar->state_11d = ATH11K_11D_IDLE;
6116+
complete(&ar->completed_11d_scan);
6117+
}
61326118
}
61336119
mutex_unlock(&ar->ab->vdev_id_11d_lock);
61346120
}
@@ -6324,8 +6310,10 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
63246310
goto err_peer_del;
63256311
}
63266312

6327-
ath11k_mac_11d_scan_start(ar, arvif->vdev_id, true);
6328-
6313+
if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) {
6314+
reinit_completion(&ar->completed_11d_scan);
6315+
ar->state_11d = ATH11K_11D_PREPARING;
6316+
}
63296317
break;
63306318
case WMI_VDEV_TYPE_MONITOR:
63316319
set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
@@ -7190,7 +7178,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
71907178
}
71917179

71927180
if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
7193-
ath11k_mac_11d_scan_start(ar, arvif->vdev_id, false);
7181+
ath11k_mac_11d_scan_start(ar, arvif->vdev_id);
71947182

71957183
mutex_unlock(&ar->conf_mutex);
71967184
}
@@ -8671,8 +8659,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab)
86718659
ar->monitor_vdev_id = -1;
86728660
clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
86738661
ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID;
8674-
init_completion(&ar->finish_11d_scan);
8675-
init_completion(&ar->finish_11d_ch_list);
8662+
init_completion(&ar->completed_11d_scan);
86768663
}
86778664

86788665
return 0;

drivers/net/wireless/ath/ath11k/mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ extern const struct htt_rx_ring_tlv_filter ath11k_mac_mon_status_filter_default;
130130
#define ATH11K_SCAN_11D_INTERVAL 600000
131131
#define ATH11K_11D_INVALID_VDEV_ID 0xFFFF
132132

133-
void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait);
133+
void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id);
134134
void ath11k_mac_11d_scan_stop(struct ath11k *ar);
135135
void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab);
136136

drivers/net/wireless/ath/ath11k/reg.c

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
102102
ar->regdom_set_by_user = true;
103103
}
104104

105-
int ath11k_reg_update_chan_list(struct ath11k *ar)
105+
int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait)
106106
{
107107
struct ieee80211_supported_band **bands;
108108
struct scan_chan_list_params *params;
@@ -111,7 +111,32 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
111111
struct channel_param *ch;
112112
enum nl80211_band band;
113113
int num_channels = 0;
114-
int i, ret;
114+
int i, ret, left;
115+
116+
if (wait && ar->state_11d != ATH11K_11D_IDLE) {
117+
left = wait_for_completion_timeout(&ar->completed_11d_scan,
118+
ATH11K_SCAN_TIMEOUT_HZ);
119+
if (!left) {
120+
ath11k_dbg(ar->ab, ATH11K_DBG_REG,
121+
"failed to receive 11d scan complete: timed out\n");
122+
ar->state_11d = ATH11K_11D_IDLE;
123+
}
124+
ath11k_dbg(ar->ab, ATH11K_DBG_REG,
125+
"reg 11d scan wait left time %d\n", left);
126+
}
127+
128+
if (wait &&
129+
(ar->scan.state == ATH11K_SCAN_STARTING ||
130+
ar->scan.state == ATH11K_SCAN_RUNNING)) {
131+
left = wait_for_completion_timeout(&ar->scan.completed,
132+
ATH11K_SCAN_TIMEOUT_HZ);
133+
if (!left)
134+
ath11k_dbg(ar->ab, ATH11K_DBG_REG,
135+
"failed to receive hw scan complete: timed out\n");
136+
137+
ath11k_dbg(ar->ab, ATH11K_DBG_REG,
138+
"reg hw scan wait left time %d\n", left);
139+
}
115140

116141
bands = hw->wiphy->bands;
117142
for (band = 0; band < NUM_NL80211_BANDS; band++) {
@@ -193,11 +218,6 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
193218
ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params);
194219
kfree(params);
195220

196-
if (ar->pending_11d) {
197-
complete(&ar->finish_11d_ch_list);
198-
ar->pending_11d = false;
199-
}
200-
201221
return ret;
202222
}
203223

@@ -263,15 +283,8 @@ int ath11k_regd_update(struct ath11k *ar)
263283
goto err;
264284
}
265285

266-
if (ar->pending_11d)
267-
complete(&ar->finish_11d_scan);
268-
269286
rtnl_lock();
270287
wiphy_lock(ar->hw->wiphy);
271-
272-
if (ar->pending_11d)
273-
reinit_completion(&ar->finish_11d_ch_list);
274-
275288
ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy);
276289
wiphy_unlock(ar->hw->wiphy);
277290
rtnl_unlock();
@@ -282,7 +295,7 @@ int ath11k_regd_update(struct ath11k *ar)
282295
goto err;
283296

284297
if (ar->state == ATH11K_STATE_ON) {
285-
ret = ath11k_reg_update_chan_list(ar);
298+
ret = ath11k_reg_update_chan_list(ar, true);
286299
if (ret)
287300
goto err;
288301
}

drivers/net/wireless/ath/ath11k/reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ struct ieee80211_regdomain *
3232
ath11k_reg_build_regd(struct ath11k_base *ab,
3333
struct cur_regulatory_info *reg_info, bool intersect);
3434
int ath11k_regd_update(struct ath11k *ar);
35-
int ath11k_reg_update_chan_list(struct ath11k *ar);
35+
int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait);
3636
#endif

drivers/net/wireless/ath/ath11k/wmi.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,10 @@ void ath11k_wmi_start_scan_init(struct ath11k *ar,
20152015
{
20162016
/* setup commonly used values */
20172017
arg->scan_req_id = 1;
2018-
arg->scan_priority = WMI_SCAN_PRIORITY_LOW;
2018+
if (ar->state_11d == ATH11K_11D_PREPARING)
2019+
arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM;
2020+
else
2021+
arg->scan_priority = WMI_SCAN_PRIORITY_LOW;
20192022
arg->dwell_time_active = 50;
20202023
arg->dwell_time_active_2g = 0;
20212024
arg->dwell_time_passive = 150;
@@ -6350,8 +6353,10 @@ static void ath11k_wmi_op_ep_tx_credits(struct ath11k_base *ab)
63506353
static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *skb)
63516354
{
63526355
const struct wmi_11d_new_cc_ev *ev;
6356+
struct ath11k *ar;
6357+
struct ath11k_pdev *pdev;
63536358
const void **tb;
6354-
int ret;
6359+
int ret, i;
63556360

63566361
tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
63576362
if (IS_ERR(tb)) {
@@ -6377,6 +6382,13 @@ static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *s
63776382

63786383
kfree(tb);
63796384

6385+
for (i = 0; i < ab->num_radios; i++) {
6386+
pdev = &ab->pdevs[i];
6387+
ar = pdev->ar;
6388+
ar->state_11d = ATH11K_11D_IDLE;
6389+
complete(&ar->completed_11d_scan);
6390+
}
6391+
63806392
queue_work(ab->workqueue, &ab->update_11d_work);
63816393

63826394
return 0;

drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ void iwl_dbg_tlv_del_timers(struct iwl_trans *trans)
371371
struct iwl_dbg_tlv_timer_node *node, *tmp;
372372

373373
list_for_each_entry_safe(node, tmp, timer_list, list) {
374-
del_timer(&node->timer);
374+
del_timer_sync(&node->timer);
375375
list_del(&node->list);
376376
kfree(node);
377377
}

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,11 +2202,14 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,
22022202
if (!data->use_chanctx) {
22032203
confbw = data->bw;
22042204
} else {
2205-
struct ieee80211_chanctx_conf *chanctx_conf =
2206-
rcu_dereference(vif->chanctx_conf);
2205+
struct ieee80211_chanctx_conf *chanctx_conf;
2206+
2207+
rcu_read_lock();
2208+
chanctx_conf = rcu_dereference(vif->chanctx_conf);
22072209

22082210
if (!WARN_ON(!chanctx_conf))
22092211
confbw = chanctx_conf->def.width;
2212+
rcu_read_unlock();
22102213
}
22112214

22122215
WARN(bw > hwsim_get_chanwidth(confbw),
@@ -2475,18 +2478,21 @@ static void hw_scan_work(struct work_struct *work)
24752478
if (req->ie_len)
24762479
skb_put_data(probe, req->ie, req->ie_len);
24772480

2481+
rcu_read_lock();
24782482
if (!ieee80211_tx_prepare_skb(hwsim->hw,
24792483
hwsim->hw_scan_vif,
24802484
probe,
24812485
hwsim->tmp_chan->band,
24822486
NULL)) {
2487+
rcu_read_unlock();
24832488
kfree_skb(probe);
24842489
continue;
24852490
}
24862491

24872492
local_bh_disable();
24882493
mac80211_hwsim_tx_frame(hwsim->hw, probe,
24892494
hwsim->tmp_chan);
2495+
rcu_read_unlock();
24902496
local_bh_enable();
24912497
}
24922498
}

0 commit comments

Comments
 (0)