mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
mac80211: move TDLS data to mgd private part
We can only be a station for TDLS connections. Also fix a bug where a delayed work could be left scheduled if the station interface was brought down during TDLS setup. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
6f7eaa47e1
commit
81dd2b8822
@ -503,6 +503,9 @@ struct ieee80211_if_managed {
|
||||
struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
|
||||
struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
|
||||
struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
|
||||
|
||||
u8 tdls_peer[ETH_ALEN] __aligned(2);
|
||||
struct delayed_work tdls_peer_del_work;
|
||||
};
|
||||
|
||||
struct ieee80211_if_ibss {
|
||||
@ -815,9 +818,6 @@ struct ieee80211_sub_if_data {
|
||||
bool radar_required;
|
||||
struct delayed_work dfs_cac_timer_work;
|
||||
|
||||
u8 tdls_peer[ETH_ALEN] __aligned(2);
|
||||
struct delayed_work tdls_peer_del_work;
|
||||
|
||||
/*
|
||||
* AP this belongs to: self in AP mode and
|
||||
* corresponding AP in VLAN mode, NULL for
|
||||
|
@ -1672,8 +1672,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
|
||||
ieee80211_dfs_cac_timer_work);
|
||||
INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk,
|
||||
ieee80211_delayed_tailroom_dec);
|
||||
INIT_DELAYED_WORK(&sdata->tdls_peer_del_work,
|
||||
ieee80211_tdls_peer_del_work);
|
||||
|
||||
for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
|
||||
struct ieee80211_supported_band *sband;
|
||||
|
@ -3713,6 +3713,8 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
|
||||
INIT_WORK(&ifmgd->csa_connection_drop_work,
|
||||
ieee80211_csa_connection_drop_work);
|
||||
INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_mgd_work);
|
||||
INIT_DELAYED_WORK(&ifmgd->tdls_peer_del_work,
|
||||
ieee80211_tdls_peer_del_work);
|
||||
setup_timer(&ifmgd->timer, ieee80211_sta_timer,
|
||||
(unsigned long) sdata);
|
||||
setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer,
|
||||
@ -4576,6 +4578,7 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
|
||||
cancel_work_sync(&ifmgd->request_smps_work);
|
||||
cancel_work_sync(&ifmgd->csa_connection_drop_work);
|
||||
cancel_work_sync(&ifmgd->chswitch_work);
|
||||
cancel_delayed_work_sync(&ifmgd->tdls_peer_del_work);
|
||||
|
||||
sdata_lock(sdata);
|
||||
if (ifmgd->assoc_data) {
|
||||
|
@ -22,14 +22,14 @@ void ieee80211_tdls_peer_del_work(struct work_struct *wk)
|
||||
struct ieee80211_local *local;
|
||||
|
||||
sdata = container_of(wk, struct ieee80211_sub_if_data,
|
||||
tdls_peer_del_work.work);
|
||||
u.mgd.tdls_peer_del_work.work);
|
||||
local = sdata->local;
|
||||
|
||||
mutex_lock(&local->mtx);
|
||||
if (!is_zero_ether_addr(sdata->tdls_peer)) {
|
||||
tdls_dbg(sdata, "TDLS del peer %pM\n", sdata->tdls_peer);
|
||||
sta_info_destroy_addr(sdata, sdata->tdls_peer);
|
||||
eth_zero_addr(sdata->tdls_peer);
|
||||
if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer)) {
|
||||
tdls_dbg(sdata, "TDLS del peer %pM\n", sdata->u.mgd.tdls_peer);
|
||||
sta_info_destroy_addr(sdata, sdata->u.mgd.tdls_peer);
|
||||
eth_zero_addr(sdata->u.mgd.tdls_peer);
|
||||
}
|
||||
mutex_unlock(&local->mtx);
|
||||
}
|
||||
@ -561,8 +561,8 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
|
||||
mutex_lock(&local->mtx);
|
||||
|
||||
/* we don't support concurrent TDLS peer setups */
|
||||
if (!is_zero_ether_addr(sdata->tdls_peer) &&
|
||||
!ether_addr_equal(sdata->tdls_peer, peer)) {
|
||||
if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer) &&
|
||||
!ether_addr_equal(sdata->u.mgd.tdls_peer, peer)) {
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
@ -593,9 +593,9 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
||||
memcpy(sdata->tdls_peer, peer, ETH_ALEN);
|
||||
memcpy(sdata->u.mgd.tdls_peer, peer, ETH_ALEN);
|
||||
ieee80211_queue_delayed_work(&sdata->local->hw,
|
||||
&sdata->tdls_peer_del_work,
|
||||
&sdata->u.mgd.tdls_peer_del_work,
|
||||
TDLS_PEER_SETUP_TIMEOUT);
|
||||
|
||||
exit:
|
||||
@ -751,8 +751,8 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
|
||||
set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH);
|
||||
rcu_read_unlock();
|
||||
|
||||
WARN_ON_ONCE(is_zero_ether_addr(sdata->tdls_peer) ||
|
||||
!ether_addr_equal(sdata->tdls_peer, peer));
|
||||
WARN_ON_ONCE(is_zero_ether_addr(sdata->u.mgd.tdls_peer) ||
|
||||
!ether_addr_equal(sdata->u.mgd.tdls_peer, peer));
|
||||
ret = 0;
|
||||
break;
|
||||
case NL80211_TDLS_DISABLE_LINK:
|
||||
@ -766,9 +766,9 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == 0 && ether_addr_equal(sdata->tdls_peer, peer)) {
|
||||
cancel_delayed_work(&sdata->tdls_peer_del_work);
|
||||
eth_zero_addr(sdata->tdls_peer);
|
||||
if (ret == 0 && ether_addr_equal(sdata->u.mgd.tdls_peer, peer)) {
|
||||
cancel_delayed_work(&sdata->u.mgd.tdls_peer_del_work);
|
||||
eth_zero_addr(sdata->u.mgd.tdls_peer);
|
||||
}
|
||||
|
||||
mutex_unlock(&local->mtx);
|
||||
|
Loading…
Reference in New Issue
Block a user