Skip to content

Commit

Permalink
wifi: mac80211: add set_active_links variant not locking sdata
Browse files Browse the repository at this point in the history
There are cases where keeping sdata locked for an operation. Add a
variant that does not take sdata lock to permit these usecases.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Benjamin Berg authored and Johannes Berg committed Jun 19, 2023
1 parent ff32b45 commit 79973d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,7 @@ void ieee80211_link_stop(struct ieee80211_link_data *link);
int ieee80211_vif_set_links(struct ieee80211_sub_if_data *sdata,
u16 new_links, u16 dormant_links);
void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata);
int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);

/* tx handling */
void ieee80211_clear_tx_pending(struct ieee80211_local *local);
Expand Down
15 changes: 13 additions & 2 deletions net/mac80211/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata,
return 0;
}

int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
struct ieee80211_local *local = sdata->local;
u16 old_active;
int ret;

sdata_lock(sdata);
sdata_assert_lock(sdata);
mutex_lock(&local->sta_mtx);
mutex_lock(&local->mtx);
mutex_lock(&local->key_mtx);
Expand All @@ -476,6 +476,17 @@ int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
mutex_unlock(&local->key_mtx);
mutex_unlock(&local->mtx);
mutex_unlock(&local->sta_mtx);

return ret;
}

int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
int ret;

sdata_lock(sdata);
ret = __ieee80211_set_active_links(vif, active_links);
sdata_unlock(sdata);

return ret;
Expand Down

0 comments on commit 79973d5

Please sign in to comment.