Skip to content

Commit 379f768

Browse files
committed
wifi: iwlwifi: mld: allow 2 ROCs on the same vif
In the current code, if an ROC is started on a vif that already has an active ROC we reject it and warn. But really there is no such limitation. The actual limitation is to not have 2 ROCs of the same type simultaneously. Add a helper function to find a vif that has an active ROC of a given type, and only if one exist - reject the ROC. This allows also to remove bss_roc_vif. Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250511195137.1f8c55198578.I17cb191596ed4e97a4854108f8ca5ca197662a62@changeid
1 parent 11e9f42 commit 379f768

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

drivers/net/wireless/intel/iwlwifi/mld/mld.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
* cleanup using iwl_mld_free_internal_sta
128128
* @netdetect: indicates the FW is in suspend mode with netdetect configured
129129
* @p2p_device_vif: points to the p2p device vif if exists
130-
* @bss_roc_vif: points to the BSS vif that has an active ROC.
131130
* @dev: pointer to device struct. For printing purposes
132131
* @trans: pointer to the transport layer
133132
* @cfg: pointer to the device configuration
@@ -213,7 +212,6 @@ struct iwl_mld {
213212
bool netdetect;
214213
#endif /* CONFIG_PM_SLEEP */
215214
struct ieee80211_vif *p2p_device_vif;
216-
struct ieee80211_vif *bss_roc_vif;
217215
struct iwl_bt_coex_profile_notif last_bt_notif;
218216
);
219217
struct ieee80211_link_sta __rcu *fw_id_to_link_sta[IWL_STATION_COUNT_MAX];

drivers/net/wireless/intel/iwlwifi/mld/roc.c

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,47 @@ iwl_mld_vif_iter_emlsr_block_roc(void *data, u8 *mac, struct ieee80211_vif *vif)
3131
*result = ret;
3232
}
3333

34+
struct iwl_mld_roc_iter_data {
35+
enum iwl_roc_activity activity;
36+
struct ieee80211_vif *vif;
37+
bool found;
38+
};
39+
40+
static void iwl_mld_find_roc_vif_iter(void *data, u8 *mac,
41+
struct ieee80211_vif *vif)
42+
{
43+
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
44+
struct iwl_mld_roc_iter_data *roc_data = data;
45+
46+
if (mld_vif->roc_activity != roc_data->activity)
47+
return;
48+
49+
/* The FW supports one ROC of each type simultaneously */
50+
if (WARN_ON(roc_data->found)) {
51+
roc_data->vif = NULL;
52+
return;
53+
}
54+
55+
roc_data->found = true;
56+
roc_data->vif = vif;
57+
}
58+
59+
static struct ieee80211_vif *
60+
iwl_mld_find_roc_vif(struct iwl_mld *mld, enum iwl_roc_activity activity)
61+
{
62+
struct iwl_mld_roc_iter_data roc_data = {
63+
.activity = activity,
64+
.found = false,
65+
};
66+
67+
ieee80211_iterate_active_interfaces_mtx(mld->hw,
68+
IEEE80211_IFACE_ITER_NORMAL,
69+
iwl_mld_find_roc_vif_iter,
70+
&roc_data);
71+
72+
return roc_data.vif;
73+
}
74+
3475
int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
3576
struct ieee80211_channel *channel, int duration,
3677
enum ieee80211_roc_type type)
@@ -73,10 +114,8 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
73114
activity = ROC_ACTIVITY_HOTSPOT;
74115
}
75116

76-
if (WARN_ON(mld_vif->roc_activity != ROC_NUM_ACTIVITIES))
77-
return -EBUSY;
78-
79-
if (vif->type == NL80211_IFTYPE_STATION && mld->bss_roc_vif)
117+
/* The FW supports one ROC of each type simultaneously */
118+
if (WARN_ON(iwl_mld_find_roc_vif(mld, activity)))
80119
return -EBUSY;
81120

82121
ieee80211_iterate_active_interfaces_mtx(mld->hw,
@@ -109,9 +148,6 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
109148

110149
mld_vif->roc_activity = activity;
111150

112-
if (vif->type == NL80211_IFTYPE_STATION)
113-
mld->bss_roc_vif = vif;
114-
115151
return 0;
116152
}
117153

@@ -130,9 +166,6 @@ static void iwl_mld_destroy_roc(struct iwl_mld *mld,
130166
{
131167
mld_vif->roc_activity = ROC_NUM_ACTIVITIES;
132168

133-
if (vif->type == NL80211_IFTYPE_STATION)
134-
mld->bss_roc_vif = NULL;
135-
136169
ieee80211_iterate_active_interfaces_mtx(mld->hw,
137170
IEEE80211_IFACE_ITER_NORMAL,
138171
iwl_mld_vif_iter_emlsr_unblock_roc,
@@ -203,11 +236,7 @@ void iwl_mld_handle_roc_notif(struct iwl_mld *mld,
203236
struct iwl_mld_vif *mld_vif;
204237
struct ieee80211_vif *vif;
205238

206-
if (activity == ROC_ACTIVITY_HOTSPOT)
207-
vif = mld->bss_roc_vif;
208-
else
209-
vif = mld->p2p_device_vif;
210-
239+
vif = iwl_mld_find_roc_vif(mld, activity);
211240
if (WARN_ON(!vif))
212241
return;
213242

0 commit comments

Comments
 (0)