Commit 5435af6e authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: remove chanctx_mtx

We now hold the wiphy mutex everywhere that we use or
needed the chanctx_mtx, so we don't need this mutex any
more. Remove it.

Most of this change was done automatically with spatch.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2a8b665e
...@@ -261,9 +261,9 @@ static int ieee80211_start_p2p_device(struct wiphy *wiphy, ...@@ -261,9 +261,9 @@ static int ieee80211_start_p2p_device(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
int ret; int ret;
mutex_lock(&sdata->local->chanctx_mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
ret = ieee80211_check_combinations(sdata, NULL, 0, 0); ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
mutex_unlock(&sdata->local->chanctx_mtx);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -283,9 +283,9 @@ static int ieee80211_start_nan(struct wiphy *wiphy, ...@@ -283,9 +283,9 @@ static int ieee80211_start_nan(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
int ret; int ret;
mutex_lock(&sdata->local->chanctx_mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
ret = ieee80211_check_combinations(sdata, NULL, 0, 0); ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
mutex_unlock(&sdata->local->chanctx_mtx);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -3619,7 +3619,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -3619,7 +3619,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_held(&local->mtx); lockdep_assert_held(&local->mtx);
lockdep_assert_held(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* /*
* using reservation isn't immediate as it may be deferred until later * using reservation isn't immediate as it may be deferred until later
...@@ -3692,7 +3692,7 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -3692,7 +3692,7 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* AP might have been stopped while waiting for the lock. */ /* AP might have been stopped while waiting for the lock. */
if (!sdata->vif.bss_conf.csa_active) if (!sdata->vif.bss_conf.csa_active)
...@@ -3704,7 +3704,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -3704,7 +3704,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
ieee80211_csa_finalize(sdata); ieee80211_csa_finalize(sdata);
unlock: unlock:
mutex_unlock(&local->chanctx_mtx);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -3864,6 +3863,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3864,6 +3863,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_held(&local->mtx); lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy);
if (!list_empty(&local->roc_list) || local->scanning) if (!list_empty(&local->roc_list) || local->scanning)
return -EBUSY; return -EBUSY;
...@@ -3879,9 +3879,8 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3879,9 +3879,8 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
if (sdata->vif.bss_conf.csa_active) if (sdata->vif.bss_conf.csa_active)
return -EBUSY; return -EBUSY;
mutex_lock(&local->chanctx_mtx);
conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf, conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (!conf) { if (!conf) {
err = -EBUSY; err = -EBUSY;
goto out; goto out;
...@@ -3955,7 +3954,6 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3955,7 +3954,6 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
} }
out: out:
mutex_unlock(&local->chanctx_mtx);
return err; return err;
} }
......
This diff is collapsed.
...@@ -1765,6 +1765,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, ...@@ -1765,6 +1765,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
int i; int i;
int ret; int ret;
lockdep_assert_wiphy(local->hw.wiphy);
if (params->chandef.chan->freq_offset) { if (params->chandef.chan->freq_offset) {
/* this may work, but is untested */ /* this may work, but is untested */
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1785,10 +1787,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, ...@@ -1785,10 +1787,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
chanmode = (params->channel_fixed && !ret) ? chanmode = (params->channel_fixed && !ret) ?
IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_EXCLUSIVE; IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_EXCLUSIVE;
mutex_lock(&local->chanctx_mtx);
ret = ieee80211_check_combinations(sdata, &params->chandef, chanmode, ret = ieee80211_check_combinations(sdata, &params->chandef, chanmode,
radar_detect_width); radar_detect_width);
mutex_unlock(&local->chanctx_mtx);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -979,8 +979,8 @@ struct ieee80211_link_data { ...@@ -979,8 +979,8 @@ struct ieee80211_link_data {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
unsigned int link_id; unsigned int link_id;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head assigned_chanctx_list; /* protected by wiphy mutex */
struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by wiphy mutex */
/* multicast keys only */ /* multicast keys only */
struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
...@@ -1001,7 +1001,7 @@ struct ieee80211_link_data { ...@@ -1001,7 +1001,7 @@ struct ieee80211_link_data {
struct delayed_work color_collision_detect_work; struct delayed_work color_collision_detect_work;
u64 color_bitmap; u64 color_bitmap;
/* context reservation -- protected with chanctx_mtx */ /* context reservation -- protected with wiphy mutex */
struct ieee80211_chanctx *reserved_chanctx; struct ieee80211_chanctx *reserved_chanctx;
struct cfg80211_chan_def reserved_chandef; struct cfg80211_chan_def reserved_chandef;
bool reserved_radar_required; bool reserved_radar_required;
...@@ -1499,7 +1499,6 @@ struct ieee80211_local { ...@@ -1499,7 +1499,6 @@ struct ieee80211_local {
/* channel contexts */ /* channel contexts */
struct list_head chanctx_list; struct list_head chanctx_list;
struct mutex chanctx_mtx;
#ifdef CONFIG_MAC80211_LEDS #ifdef CONFIG_MAC80211_LEDS
struct led_trigger tx_led, rx_led, assoc_led, radio_led; struct led_trigger tx_led, rx_led, assoc_led, radio_led;
......
...@@ -324,9 +324,9 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, ...@@ -324,9 +324,9 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_sub_if_data *nsdata; struct ieee80211_sub_if_data *nsdata;
int ret;
ASSERT_RTNL(); ASSERT_RTNL();
lockdep_assert_wiphy(local->hw.wiphy);
/* we hold the RTNL here so can safely walk the list */ /* we hold the RTNL here so can safely walk the list */
list_for_each_entry(nsdata, &local->interfaces, list) { list_for_each_entry(nsdata, &local->interfaces, list) {
...@@ -391,10 +391,7 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, ...@@ -391,10 +391,7 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
} }
} }
mutex_lock(&local->chanctx_mtx); return ieee80211_check_combinations(sdata, NULL, 0, 0);
ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
mutex_unlock(&local->chanctx_mtx);
return ret;
} }
static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata, static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata,
......
...@@ -826,7 +826,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, ...@@ -826,7 +826,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
spin_lock_init(&local->handle_wake_tx_queue_lock); spin_lock_init(&local->handle_wake_tx_queue_lock);
INIT_LIST_HEAD(&local->chanctx_list); INIT_LIST_HEAD(&local->chanctx_list);
mutex_init(&local->chanctx_mtx);
wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work); wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work);
......
...@@ -1691,7 +1691,7 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy, ...@@ -1691,7 +1691,7 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!ifmgd->associated) if (!ifmgd->associated)
goto out; goto out;
...@@ -1743,7 +1743,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy, ...@@ -1743,7 +1743,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
ieee80211_sta_reset_conn_monitor(sdata); ieee80211_sta_reset_conn_monitor(sdata);
out: out:
mutex_unlock(&local->chanctx_mtx);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -1813,14 +1812,14 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link) ...@@ -1813,14 +1812,14 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link)
struct ieee80211_sub_if_data *sdata = link->sdata; struct ieee80211_sub_if_data *sdata = link->sdata;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
lockdep_assert_wiphy(local->hw.wiphy);
if (!local->ops->abort_channel_switch) if (!local->ops->abort_channel_switch)
return; return;
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx);
ieee80211_link_unreserve_chanctx(link); ieee80211_link_unreserve_chanctx(link);
mutex_unlock(&local->chanctx_mtx);
if (link->csa_block_tx) if (link->csa_block_tx)
ieee80211_wake_vif_queues(local, sdata, ieee80211_wake_vif_queues(local, sdata,
...@@ -1854,6 +1853,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1854,6 +1853,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
int res; int res;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
if (!cbss) if (!cbss)
return; return;
...@@ -1936,9 +1936,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1936,9 +1936,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
ieee80211_teardown_tdls_peers(sdata); ieee80211_teardown_tdls_peers(sdata);
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx);
conf = rcu_dereference_protected(link->conf->chanctx_conf, conf = rcu_dereference_protected(link->conf->chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (!conf) { if (!conf) {
sdata_info(sdata, sdata_info(sdata,
"no channel context assigned to vif?, disconnecting\n"); "no channel context assigned to vif?, disconnecting\n");
...@@ -1968,7 +1967,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1968,7 +1967,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
res); res);
goto drop_connection; goto drop_connection;
} }
mutex_unlock(&local->chanctx_mtx);
link->conf->csa_active = true; link->conf->csa_active = true;
link->csa_chandef = csa_ie.chandef; link->csa_chandef = csa_ie.chandef;
...@@ -2000,7 +1998,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -2000,7 +1998,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
return; return;
lock_and_drop_connection: lock_and_drop_connection:
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
mutex_lock(&local->chanctx_mtx);
drop_connection: drop_connection:
/* /*
* This is just so that the disconnect flow will know that * This is just so that the disconnect flow will know that
...@@ -2014,7 +2011,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -2014,7 +2011,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
wiphy_work_queue(sdata->local->hw.wiphy, wiphy_work_queue(sdata->local->hw.wiphy,
&ifmgd->csa_connection_drop_work); &ifmgd->csa_connection_drop_work);
mutex_unlock(&local->chanctx_mtx);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
} }
...@@ -3186,6 +3182,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) ...@@ -3186,6 +3182,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
u8 unicast_limit = max(1, max_probe_tries - 3); u8 unicast_limit = max(1, max_probe_tries - 3);
struct sta_info *sta; struct sta_info *sta;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif)))
return; return;
...@@ -3207,7 +3205,6 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) ...@@ -3207,7 +3205,6 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
ifmgd->probe_send_count++; ifmgd->probe_send_count++;
if (dst) { if (dst) {
lockdep_assert_wiphy(sdata->local->hw.wiphy);
sta = sta_info_get(sdata, dst); sta = sta_info_get(sdata, dst);
if (!WARN_ON(!sta)) if (!WARN_ON(!sta))
ieee80211_check_fast_rx(sta); ieee80211_check_fast_rx(sta);
...@@ -3629,6 +3626,8 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata) ...@@ -3629,6 +3626,8 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata)
const u8 *ap_addr = ifmgd->auth_data->ap_addr; const u8 *ap_addr = ifmgd->auth_data->ap_addr;
struct sta_info *sta; struct sta_info *sta;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
sdata_info(sdata, "authenticated\n"); sdata_info(sdata, "authenticated\n");
ifmgd->auth_data->done = true; ifmgd->auth_data->done = true;
ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
...@@ -3636,7 +3635,6 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata) ...@@ -3636,7 +3635,6 @@ static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata)
run_again(sdata, ifmgd->auth_data->timeout); run_again(sdata, ifmgd->auth_data->timeout);
/* move station state to auth */ /* move station state to auth */
lockdep_assert_wiphy(sdata->local->hw.wiphy);
sta = sta_info_get(sdata, ap_addr); sta = sta_info_get(sdata, ap_addr);
if (!sta) { if (!sta) {
WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr); WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr);
...@@ -5899,6 +5897,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, ...@@ -5899,6 +5897,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
}; };
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
/* Process beacon from the current BSS */ /* Process beacon from the current BSS */
bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type); bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type);
...@@ -6133,7 +6132,6 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, ...@@ -6133,7 +6132,6 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
le16_to_cpu(mgmt->u.beacon.capab_info), le16_to_cpu(mgmt->u.beacon.capab_info),
erp_valid, erp_value); erp_valid, erp_value);
lockdep_assert_wiphy(local->hw.wiphy);
sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
if (WARN_ON(!sta)) { if (WARN_ON(!sta)) {
goto free; goto free;
......
...@@ -1354,9 +1354,10 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata, ...@@ -1354,9 +1354,10 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,
enum nl80211_chan_width width; enum nl80211_chan_width width;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf, conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (conf) { if (conf) {
width = conf->def.width; width = conf->def.width;
sband = local->hw.wiphy->bands[conf->def.chan->band]; sband = local->hw.wiphy->bands[conf->def.chan->band];
...@@ -1384,7 +1385,6 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata, ...@@ -1384,7 +1385,6 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,
} }
} }
mutex_unlock(&local->chanctx_mtx);
} }
static int iee80211_tdls_have_ht_peers(struct ieee80211_sub_if_data *sdata) static int iee80211_tdls_have_ht_peers(struct ieee80211_sub_if_data *sdata)
...@@ -1447,6 +1447,8 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1447,6 +1447,8 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int ret; int ret;
lockdep_assert_wiphy(local->hw.wiphy);
if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS))
return -ENOTSUPP; return -ENOTSUPP;
...@@ -1479,7 +1481,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1479,7 +1481,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
break; break;
} }
lockdep_assert_wiphy(local->hw.wiphy);
sta = sta_info_get(sdata, peer); sta = sta_info_get(sdata, peer);
if (!sta) { if (!sta) {
ret = -ENOLINK; ret = -ENOLINK;
...@@ -1512,7 +1513,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1512,7 +1513,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
ret = sta_info_destroy_addr(sdata, peer); ret = sta_info_destroy_addr(sdata, peer);
lockdep_assert_wiphy(local->hw.wiphy);
iee80211_tdls_recalc_ht_protection(sdata, NULL); iee80211_tdls_recalc_ht_protection(sdata, NULL);
iee80211_tdls_recalc_chanctx(sdata, NULL); iee80211_tdls_recalc_chanctx(sdata, NULL);
...@@ -1667,11 +1667,12 @@ ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -1667,11 +1667,12 @@ ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
u32 ch_sw_tm_ie; u32 ch_sw_tm_ie;
int ret; int ret;
lockdep_assert_wiphy(local->hw.wiphy);
if (chandef->chan->freq_offset) if (chandef->chan->freq_offset)
/* this may work, but is untested */ /* this may work, but is untested */
return -EOPNOTSUPP; return -EOPNOTSUPP;
lockdep_assert_wiphy(local->hw.wiphy);
sta = sta_info_get(sdata, addr); sta = sta_info_get(sdata, addr);
if (!sta) { if (!sta) {
tdls_dbg(sdata, tdls_dbg(sdata,
...@@ -1793,6 +1794,8 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1793,6 +1794,8 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_tdls_ch_sw_params params = {}; struct ieee80211_tdls_ch_sw_params params = {};
int ret; int ret;
lockdep_assert_wiphy(local->hw.wiphy);
params.action_code = WLAN_TDLS_CHANNEL_SWITCH_RESPONSE; params.action_code = WLAN_TDLS_CHANNEL_SWITCH_RESPONSE;
params.timestamp = rx_status->device_timestamp; params.timestamp = rx_status->device_timestamp;
...@@ -1802,7 +1805,6 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1802,7 +1805,6 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata,
return -EINVAL; return -EINVAL;
} }
lockdep_assert_wiphy(local->hw.wiphy);
sta = sta_info_get(sdata, tf->sa); sta = sta_info_get(sdata, tf->sa);
if (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) { if (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) {
tdls_dbg(sdata, "TDLS chan switch from non-peer sta %pM\n", tdls_dbg(sdata, "TDLS chan switch from non-peer sta %pM\n",
...@@ -1890,6 +1892,8 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata, ...@@ -1890,6 +1892,8 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
struct ieee80211_tdls_ch_sw_params params = {}; struct ieee80211_tdls_ch_sw_params params = {};
int ret = 0; int ret = 0;
lockdep_assert_wiphy(local->hw.wiphy);
params.action_code = WLAN_TDLS_CHANNEL_SWITCH_REQUEST; params.action_code = WLAN_TDLS_CHANNEL_SWITCH_REQUEST;
params.timestamp = rx_status->device_timestamp; params.timestamp = rx_status->device_timestamp;
...@@ -1978,7 +1982,6 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata, ...@@ -1978,7 +1982,6 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
goto free; goto free;
} }
lockdep_assert_wiphy(local->hw.wiphy);
sta = sta_info_get(sdata, tf->sa); sta = sta_info_get(sdata, tf->sa);
if (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) { if (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) {
tdls_dbg(sdata, "TDLS chan switch from non-peer sta %pM\n", tdls_dbg(sdata, "TDLS chan switch from non-peer sta %pM\n",
......
...@@ -2351,6 +2351,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) ...@@ -2351,6 +2351,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
lockdep_assert_wiphy(local->hw.wiphy);
/* /*
* We get here if during resume the device can't be restarted properly. * We get here if during resume the device can't be restarted properly.
* We might also get here if this happens during HW reset, which is a * We might also get here if this happens during HW reset, which is a
...@@ -2379,10 +2381,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) ...@@ -2379,10 +2381,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
/* Mark channel contexts as not being in the driver any more to avoid /* Mark channel contexts as not being in the driver any more to avoid
* removing them from the driver during the shutdown process... * removing them from the driver during the shutdown process...
*/ */
mutex_lock(&local->chanctx_mtx);
list_for_each_entry(ctx, &local->chanctx_list, list) list_for_each_entry(ctx, &local->chanctx_list, list)
ctx->driver_present = false; ctx->driver_present = false;
mutex_unlock(&local->chanctx_mtx);
} }
static void ieee80211_assign_chanctx(struct ieee80211_local *local, static void ieee80211_assign_chanctx(struct ieee80211_local *local,
...@@ -2392,17 +2392,17 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local, ...@@ -2392,17 +2392,17 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local,
struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx_conf *conf;
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
lockdep_assert_wiphy(local->hw.wiphy);
if (!local->use_chanctx) if (!local->use_chanctx)
return; return;
mutex_lock(&local->chanctx_mtx);
conf = rcu_dereference_protected(link->conf->chanctx_conf, conf = rcu_dereference_protected(link->conf->chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (conf) { if (conf) {
ctx = container_of(conf, struct ieee80211_chanctx, conf); ctx = container_of(conf, struct ieee80211_chanctx, conf);
drv_assign_vif_chanctx(local, sdata, link->conf, ctx); drv_assign_vif_chanctx(local, sdata, link->conf, ctx);
} }
mutex_unlock(&local->chanctx_mtx);
} }
static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata) static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata)
...@@ -2410,8 +2410,9 @@ static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata) ...@@ -2410,8 +2410,9 @@ static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sta_info *sta; struct sta_info *sta;
/* add STAs back */
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
/* add STAs back */
list_for_each_entry(sta, &local->sta_list, list) { list_for_each_entry(sta, &local->sta_list, list) {
enum ieee80211_sta_state state; enum ieee80211_sta_state state;
...@@ -2509,6 +2510,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2509,6 +2510,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
bool suspended = local->suspended; bool suspended = local->suspended;
bool in_reconfig = false; bool in_reconfig = false;
lockdep_assert_wiphy(local->hw.wiphy);
/* nothing to do if HW shouldn't run */ /* nothing to do if HW shouldn't run */
if (!local->open_count) if (!local->open_count)
goto wake_up; goto wake_up;
...@@ -2624,12 +2627,10 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2624,12 +2627,10 @@ int ieee80211_reconfig(struct ieee80211_local *local)
/* add channel contexts */ /* add channel contexts */
if (local->use_chanctx) { if (local->use_chanctx) {
mutex_lock(&local->chanctx_mtx);
list_for_each_entry(ctx, &local->chanctx_list, list) list_for_each_entry(ctx, &local->chanctx_list, list)
if (ctx->replace_state != if (ctx->replace_state !=
IEEE80211_CHANCTX_REPLACES_OTHER) IEEE80211_CHANCTX_REPLACES_OTHER)
WARN_ON(drv_add_chanctx(local, ctx)); WARN_ON(drv_add_chanctx(local, ctx));
mutex_unlock(&local->chanctx_mtx);
sdata = wiphy_dereference(local->hw.wiphy, sdata = wiphy_dereference(local->hw.wiphy,
local->monitor_sdata); local->monitor_sdata);
...@@ -2901,8 +2902,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2901,8 +2902,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
* are active. This is really a workaround though. * are active. This is really a workaround though.
*/ */
if (ieee80211_hw_check(hw, AMPDU_AGGREGATION)) { if (ieee80211_hw_check(hw, AMPDU_AGGREGATION)) {
lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(sta, &local->sta_list, list) { list_for_each_entry(sta, &local->sta_list, list) {
if (!local->resuming) if (!local->resuming)
ieee80211_sta_tear_down_BA_sessions( ieee80211_sta_tear_down_BA_sessions(
...@@ -3025,10 +3024,10 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata, ...@@ -3025,10 +3024,10 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata,
struct ieee80211_chanctx_conf *chanctx_conf; struct ieee80211_chanctx_conf *chanctx_conf;
struct ieee80211_chanctx *chanctx; struct ieee80211_chanctx *chanctx;
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
/* /*
* This function can be called from a work, thus it may be possible * This function can be called from a work, thus it may be possible
...@@ -3037,12 +3036,10 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata, ...@@ -3037,12 +3036,10 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata,
* So nothing should be done in such case. * So nothing should be done in such case.
*/ */
if (!chanctx_conf) if (!chanctx_conf)
goto unlock; return;
chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf); chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf);
ieee80211_recalc_smps_chanctx(local, chanctx); ieee80211_recalc_smps_chanctx(local, chanctx);
unlock:
mutex_unlock(&local->chanctx_mtx);
} }
void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata, void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
...@@ -3053,7 +3050,7 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata, ...@@ -3053,7 +3050,7 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
struct ieee80211_chanctx *chanctx; struct ieee80211_chanctx *chanctx;
int i; int i;
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) {
struct ieee80211_bss_conf *bss_conf; struct ieee80211_bss_conf *bss_conf;
...@@ -3069,9 +3066,9 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata, ...@@ -3069,9 +3066,9 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
} }
chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf,
lockdep_is_held(&local->chanctx_mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
/* /*
* Since we hold the chanctx_mtx (checked above) * Since we hold the wiphy mutex (checked above)
* we can take the chanctx_conf pointer out of the * we can take the chanctx_conf pointer out of the
* RCU critical section, it cannot go away without * RCU critical section, it cannot go away without
* the mutex. Just the way we reached it could - in * the mutex. Just the way we reached it could - in
...@@ -3081,14 +3078,12 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata, ...@@ -3081,14 +3078,12 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
rcu_read_unlock(); rcu_read_unlock();
if (!chanctx_conf) if (!chanctx_conf)
goto unlock; return;
chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, chanctx = container_of(chanctx_conf, struct ieee80211_chanctx,
conf); conf);
ieee80211_recalc_chanctx_min_def(local, chanctx, NULL); ieee80211_recalc_chanctx_min_def(local, chanctx, NULL);
} }
unlock:
mutex_unlock(&local->chanctx_mtx);
} }
size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset) size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset)
...@@ -4364,7 +4359,7 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, ...@@ -4364,7 +4359,7 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
int num_chanctx = 0; int num_chanctx = 0;
mutex_lock(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(ctx, &local->chanctx_list, list) { list_for_each_entry(ctx, &local->chanctx_list, list) {
if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER)
continue; continue;
...@@ -4372,7 +4367,6 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, ...@@ -4372,7 +4367,6 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
num_chanctx++; num_chanctx++;
chandef = ctx->conf.def; chandef = ctx->conf.def;
} }
mutex_unlock(&local->chanctx_mtx);
ieee80211_dfs_cac_cancel(local); ieee80211_dfs_cac_cancel(local);
...@@ -4773,7 +4767,7 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, ...@@ -4773,7 +4767,7 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local,
struct ieee80211_link_data *link; struct ieee80211_link_data *link;
u8 radar_detect = 0; u8 radar_detect = 0;
lockdep_assert_held(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED))
return 0; return 0;
...@@ -4814,7 +4808,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, ...@@ -4814,7 +4808,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
.radar_detect = radar_detect, .radar_detect = radar_detect,
}; };
lockdep_assert_held(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (WARN_ON(hweight32(radar_detect) > 1)) if (WARN_ON(hweight32(radar_detect) > 1))
return -EINVAL; return -EINVAL;
...@@ -4904,7 +4898,7 @@ int ieee80211_max_num_channels(struct ieee80211_local *local) ...@@ -4904,7 +4898,7 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
int err; int err;
struct iface_combination_params params = {0}; struct iface_combination_params params = {0};
lockdep_assert_held(&local->chanctx_mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(ctx, &local->chanctx_list, list) { list_for_each_entry(ctx, &local->chanctx_list, list) {
if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment