Commit bfd8403a authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: reorg some iface data structs for MLD

Start reorganizing interface related data structures toward
MLD. The most complex part here is for the keys, since we
have to split the various kinds of GTKs off to the link but
still need to use (for WEP) the other keys as a fallback
even for multicast frames.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent f276e20b
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Copyright 2007, Michael Wu <flamingice@sourmilk.net> * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
* Copyright 2007-2010, Intel Corporation * Copyright 2007-2010, Intel Corporation
* Copyright(c) 2015-2017 Intel Deutschland GmbH * Copyright(c) 2015-2017 Intel Deutschland GmbH
* Copyright (C) 2018-2021 Intel Corporation * Copyright (C) 2018-2022 Intel Corporation
*/ */
/** /**
...@@ -242,7 +242,7 @@ static void ieee80211_send_addba_resp(struct sta_info *sta, u8 *da, u16 tid, ...@@ -242,7 +242,7 @@ static void ieee80211_send_addba_resp(struct sta_info *sta, u8 *da, u16 tid,
sdata->vif.type == NL80211_IFTYPE_MESH_POINT) sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION) else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
......
...@@ -82,7 +82,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, ...@@ -82,7 +82,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
sdata->vif.type == NL80211_IFTYPE_MESH_POINT) sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION) else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
......
This diff is collapsed.
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net> * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright (C) 2015 Intel Deutschland GmbH * Copyright (C) 2015 Intel Deutschland GmbH
* Copyright (C) 2021 Intel Corporation * Copyright (C) 2021-2022 Intel Corporation
*/ */
#include <linux/kobject.h> #include <linux/kobject.h>
...@@ -395,9 +395,9 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) ...@@ -395,9 +395,9 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
debugfs_remove(sdata->debugfs.default_multicast_key); debugfs_remove(sdata->debugfs.default_multicast_key);
sdata->debugfs.default_multicast_key = NULL; sdata->debugfs.default_multicast_key = NULL;
if (sdata->default_multicast_key) { if (sdata->deflink.default_multicast_key) {
key = key_mtx_dereference(sdata->local, key = key_mtx_dereference(sdata->local,
sdata->default_multicast_key); sdata->deflink.default_multicast_key);
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_multicast_key = sdata->debugfs.default_multicast_key =
debugfs_create_symlink("default_multicast_key", debugfs_create_symlink("default_multicast_key",
...@@ -414,7 +414,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) ...@@ -414,7 +414,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
return; return;
key = key_mtx_dereference(sdata->local, key = key_mtx_dereference(sdata->local,
sdata->default_mgmt_key); sdata->deflink.default_mgmt_key);
if (key) { if (key) {
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_mgmt_key = sdata->debugfs.default_mgmt_key =
...@@ -443,7 +443,7 @@ ieee80211_debugfs_key_add_beacon_default(struct ieee80211_sub_if_data *sdata) ...@@ -443,7 +443,7 @@ ieee80211_debugfs_key_add_beacon_default(struct ieee80211_sub_if_data *sdata)
return; return;
key = key_mtx_dereference(sdata->local, key = key_mtx_dereference(sdata->local,
sdata->default_beacon_key); sdata->deflink.default_beacon_key);
if (key) { if (key) {
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_beacon_key = sdata->debugfs.default_beacon_key =
......
...@@ -208,8 +208,8 @@ IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_5ghz); ...@@ -208,8 +208,8 @@ IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_5ghz);
IEEE80211_IF_FILE(flags, flags, HEX); IEEE80211_IF_FILE(flags, flags, HEX);
IEEE80211_IF_FILE(state, state, LHEX); IEEE80211_IF_FILE(state, state, LHEX);
IEEE80211_IF_FILE(txpower, vif.bss_conf.txpower, DEC); IEEE80211_IF_FILE(txpower, vif.bss_conf.txpower, DEC);
IEEE80211_IF_FILE(ap_power_level, ap_power_level, DEC); IEEE80211_IF_FILE(ap_power_level, deflink.ap_power_level, DEC);
IEEE80211_IF_FILE(user_power_level, user_power_level, DEC); IEEE80211_IF_FILE(user_power_level, deflink.user_power_level, DEC);
static ssize_t static ssize_t
ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata, ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata,
...@@ -232,7 +232,7 @@ ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata, ...@@ -232,7 +232,7 @@ ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata,
IEEE80211_IF_FILE_R(hw_queues); IEEE80211_IF_FILE_R(hw_queues);
/* STA attributes */ /* STA attributes */
IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); IEEE80211_IF_FILE(bssid, deflink.u.mgd.bssid, MAC);
IEEE80211_IF_FILE(aid, vif.cfg.aid, DEC); IEEE80211_IF_FILE(aid, vif.cfg.aid, DEC);
IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS); IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
...@@ -274,8 +274,8 @@ static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata, ...@@ -274,8 +274,8 @@ static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata,
{ {
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
return snprintf(buf, buflen, "request: %s\nused: %s\n", return snprintf(buf, buflen, "request: %s\nused: %s\n",
smps_modes[sdata->u.mgd.req_smps], smps_modes[sdata->deflink.u.mgd.req_smps],
smps_modes[sdata->smps_mode]); smps_modes[sdata->deflink.smps_mode]);
return -EINVAL; return -EINVAL;
} }
...@@ -337,7 +337,7 @@ static ssize_t ieee80211_if_parse_tkip_mic_test( ...@@ -337,7 +337,7 @@ static ssize_t ieee80211_if_parse_tkip_mic_test(
dev_kfree_skb(skb); dev_kfree_skb(skb);
return -ENOTCONN; return -ENOTCONN;
} }
memcpy(hdr->addr1, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
memcpy(hdr->addr3, addr, ETH_ALEN); memcpy(hdr->addr3, addr, ETH_ALEN);
sdata_unlock(sdata); sdata_unlock(sdata);
......
...@@ -105,7 +105,7 @@ static void ieee80211_get_stats(struct net_device *dev, ...@@ -105,7 +105,7 @@ static void ieee80211_get_stats(struct net_device *dev,
mutex_lock(&local->sta_mtx); mutex_lock(&local->sta_mtx);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid); sta = sta_info_get_bss(sdata, sdata->deflink.u.mgd.bssid);
if (!(sta && !WARN_ON(sta->sdata->dev != dev))) if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
goto do_survey; goto do_survey;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Copyright 2007, Michael Wu <flamingice@sourmilk.net> * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
* Copyright 2007-2010, Intel Corporation * Copyright 2007-2010, Intel Corporation
* Copyright 2017 Intel Deutschland GmbH * Copyright 2017 Intel Deutschland GmbH
* Copyright(c) 2020-2021 Intel Corporation * Copyright(c) 2020-2022 Intel Corporation
*/ */
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
...@@ -433,7 +433,7 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, ...@@ -433,7 +433,7 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
sdata->vif.type == NL80211_IFTYPE_MESH_POINT) sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION) else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
...@@ -543,10 +543,11 @@ void ieee80211_request_smps_mgd_work(struct work_struct *work) ...@@ -543,10 +543,11 @@ void ieee80211_request_smps_mgd_work(struct work_struct *work)
{ {
struct ieee80211_sub_if_data *sdata = struct ieee80211_sub_if_data *sdata =
container_of(work, struct ieee80211_sub_if_data, container_of(work, struct ieee80211_sub_if_data,
u.mgd.request_smps_work); deflink.u.mgd.request_smps_work);
sdata_lock(sdata); sdata_lock(sdata);
__ieee80211_request_smps_mgd(sdata, sdata->u.mgd.driver_smps_mode); __ieee80211_request_smps_mgd(sdata,
sdata->deflink.u.mgd.driver_smps_mode);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -558,12 +559,12 @@ void ieee80211_request_smps(struct ieee80211_vif *vif, ...@@ -558,12 +559,12 @@ void ieee80211_request_smps(struct ieee80211_vif *vif,
if (WARN_ON_ONCE(vif->type != NL80211_IFTYPE_STATION)) if (WARN_ON_ONCE(vif->type != NL80211_IFTYPE_STATION))
return; return;
if (sdata->u.mgd.driver_smps_mode == smps_mode) if (sdata->deflink.u.mgd.driver_smps_mode == smps_mode)
return; return;
sdata->u.mgd.driver_smps_mode = smps_mode; sdata->deflink.u.mgd.driver_smps_mode = smps_mode;
ieee80211_queue_work(&sdata->local->hw, ieee80211_queue_work(&sdata->local->hw,
&sdata->u.mgd.request_smps_work); &sdata->deflink.u.mgd.request_smps_work);
} }
/* this might change ... don't want non-open drivers using it */ /* this might change ... don't want non-open drivers using it */
EXPORT_SYMBOL_GPL(ieee80211_request_smps); EXPORT_SYMBOL_GPL(ieee80211_request_smps);
...@@ -309,7 +309,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -309,7 +309,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
return; return;
} }
sdata->radar_required = radar_required; sdata->deflink.radar_required = radar_required;
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
memcpy(ifibss->bssid, bssid, ETH_ALEN); memcpy(ifibss->bssid, bssid, ETH_ALEN);
...@@ -544,12 +544,12 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -544,12 +544,12 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
IEEE80211_PRIVACY(ifibss->privacy)); IEEE80211_PRIVACY(ifibss->privacy));
/* XXX: should not really modify cfg80211 data */ /* XXX: should not really modify cfg80211 data */
if (cbss) { if (cbss) {
cbss->channel = sdata->csa_chandef.chan; cbss->channel = sdata->deflink.csa_chandef.chan;
cfg80211_put_bss(sdata->local->hw.wiphy, cbss); cfg80211_put_bss(sdata->local->hw.wiphy, cbss);
} }
} }
ifibss->chandef = sdata->csa_chandef; ifibss->chandef = sdata->deflink.csa_chandef;
/* generate the beacon */ /* generate the beacon */
return ieee80211_ibss_csa_beacon(sdata, NULL); return ieee80211_ibss_csa_beacon(sdata, NULL);
...@@ -1853,8 +1853,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, ...@@ -1853,8 +1853,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
changed |= BSS_CHANGED_HT | BSS_CHANGED_MCAST_RATE; changed |= BSS_CHANGED_HT | BSS_CHANGED_MCAST_RATE;
ieee80211_bss_info_change_notify(sdata, changed); ieee80211_bss_info_change_notify(sdata, changed);
sdata->smps_mode = IEEE80211_SMPS_OFF; sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
sdata->needed_rx_chains = local->rx_chains; sdata->deflink.needed_rx_chains = local->rx_chains;
sdata->control_port_over_nl80211 = params->control_port_over_nl80211; sdata->control_port_over_nl80211 = params->control_port_over_nl80211;
ieee80211_queue_work(&local->hw, &sdata->work); ieee80211_queue_work(&local->hw, &sdata->work);
......
...@@ -293,19 +293,13 @@ struct ps_data { ...@@ -293,19 +293,13 @@ struct ps_data {
}; };
struct ieee80211_if_ap { struct ieee80211_if_ap {
struct beacon_data __rcu *beacon;
struct probe_resp __rcu *probe_resp;
struct fils_discovery_data __rcu *fils_discovery;
struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
/* to be used after channel switch. */
struct cfg80211_beacon_data *next_beacon;
struct list_head vlans; /* write-protected with RTNL and local->mtx */ struct list_head vlans; /* write-protected with RTNL and local->mtx */
struct ps_data ps; struct ps_data ps;
atomic_t num_mcast_sta; /* number of stations receiving multicast */ atomic_t num_mcast_sta; /* number of stations receiving multicast */
bool multicast_to_unicast; bool multicast_to_unicast;
bool active;
}; };
struct ieee80211_if_vlan { struct ieee80211_if_vlan {
...@@ -456,29 +450,14 @@ struct ieee80211_if_managed { ...@@ -456,29 +450,14 @@ struct ieee80211_if_managed {
reconnect:1, reconnect:1,
associated:1; associated:1;
struct cfg80211_bss *assoc_bss;
struct ieee80211_mgd_auth_data *auth_data; struct ieee80211_mgd_auth_data *auth_data;
struct ieee80211_mgd_assoc_data *assoc_data; struct ieee80211_mgd_assoc_data *assoc_data;
u8 bssid[ETH_ALEN] __aligned(2);
bool powersave; /* powersave requested for this iface */ bool powersave; /* powersave requested for this iface */
bool broken_ap; /* AP is broken -- turn off powersave */ bool broken_ap; /* AP is broken -- turn off powersave */
bool have_beacon;
u8 dtim_period;
enum ieee80211_smps_mode req_smps, /* requested smps mode */
driver_smps_mode; /* smps mode request */
struct work_struct request_smps_work;
unsigned int flags; unsigned int flags;
bool csa_waiting_bcn;
bool csa_ignored_same_chan;
bool beacon_crc_valid;
u32 beacon_crc;
bool status_acked; bool status_acked;
bool status_received; bool status_received;
__le16 status_fc; __le16 status_fc;
...@@ -503,39 +482,14 @@ struct ieee80211_if_managed { ...@@ -503,39 +482,14 @@ struct ieee80211_if_managed {
*/ */
unsigned int uapsd_max_sp_len; unsigned int uapsd_max_sp_len;
int wmm_last_param_set;
int mu_edca_last_param_set;
u8 use_4addr; u8 use_4addr;
s16 p2p_noa_index;
struct ewma_beacon_signal ave_beacon_signal;
/*
* Number of Beacon frames used in ave_beacon_signal. This can be used
* to avoid generating less reliable cqm events that would be based
* only on couple of received frames.
*/
unsigned int count_beacon_signal;
/* Number of times beacon loss was invoked. */
unsigned int beacon_loss_count;
/*
* Last Beacon frame signal strength average (ave_beacon_signal / 16)
* that triggered a cqm event. 0 indicates that no event has been
* generated for the current association.
*/
int last_cqm_event_signal;
/* /*
* State variables for keeping track of RSSI of the AP currently * State variables for keeping track of RSSI of the AP currently
* connected to and informing driver when RSSI has gone * connected to and informing driver when RSSI has gone
* below/above a certain threshold. * below/above a certain threshold.
*/ */
int rssi_min_thold, rssi_max_thold; int rssi_min_thold, rssi_max_thold;
int last_ave_beacon_signal;
struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
...@@ -901,6 +855,97 @@ struct ieee80211_if_nan { ...@@ -901,6 +855,97 @@ struct ieee80211_if_nan {
struct idr function_inst_ids; struct idr function_inst_ids;
}; };
struct ieee80211_link_data_managed {
u8 bssid[ETH_ALEN] __aligned(2);
u8 dtim_period;
enum ieee80211_smps_mode req_smps, /* requested smps mode */
driver_smps_mode; /* smps mode request */
s16 p2p_noa_index;
bool have_beacon;
bool csa_waiting_bcn;
bool csa_ignored_same_chan;
struct work_struct request_smps_work;
bool beacon_crc_valid;
u32 beacon_crc;
struct ewma_beacon_signal ave_beacon_signal;
int last_ave_beacon_signal;
/*
* Number of Beacon frames used in ave_beacon_signal. This can be used
* to avoid generating less reliable cqm events that would be based
* only on couple of received frames.
*/
unsigned int count_beacon_signal;
/* Number of times beacon loss was invoked. */
unsigned int beacon_loss_count;
/*
* Last Beacon frame signal strength average (ave_beacon_signal / 16)
* that triggered a cqm event. 0 indicates that no event has been
* generated for the current association.
*/
int last_cqm_event_signal;
int wmm_last_param_set;
int mu_edca_last_param_set;
struct cfg80211_bss *bss;
};
struct ieee80211_link_data_ap {
struct beacon_data __rcu *beacon;
struct probe_resp __rcu *probe_resp;
struct fils_discovery_data __rcu *fils_discovery;
struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
/* to be used after channel switch. */
struct cfg80211_beacon_data *next_beacon;
};
struct ieee80211_link_data {
/* multicast keys only */
struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
NUM_DEFAULT_MGMT_KEYS +
NUM_DEFAULT_BEACON_KEYS];
struct ieee80211_key __rcu *default_multicast_key;
struct ieee80211_key __rcu *default_mgmt_key;
struct ieee80211_key __rcu *default_beacon_key;
struct airtime_info airtime[IEEE80211_NUM_ACS];
struct work_struct csa_finalize_work;
bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
struct cfg80211_chan_def csa_chandef;
struct work_struct color_change_finalize_work;
/* context reservation -- protected with chanctx_mtx */
struct ieee80211_chanctx *reserved_chanctx;
struct cfg80211_chan_def reserved_chandef;
bool reserved_radar_required;
bool reserved_ready;
u8 needed_rx_chains;
enum ieee80211_smps_mode smps_mode;
int user_power_level; /* in dBm */
int ap_power_level; /* in dBm */
bool radar_required;
struct delayed_work dfs_cac_timer_work;
union {
struct ieee80211_link_data_managed mgd;
struct ieee80211_link_data_ap ap;
} u;
};
struct ieee80211_sub_if_data { struct ieee80211_sub_if_data {
struct list_head list; struct list_head list;
...@@ -931,13 +976,8 @@ struct ieee80211_sub_if_data { ...@@ -931,13 +976,8 @@ struct ieee80211_sub_if_data {
/* bit field of ACM bits (BIT(802.1D tag)) */ /* bit field of ACM bits (BIT(802.1D tag)) */
u8 wmm_acm; u8 wmm_acm;
struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS];
NUM_DEFAULT_MGMT_KEYS +
NUM_DEFAULT_BEACON_KEYS];
struct ieee80211_key __rcu *default_unicast_key; struct ieee80211_key __rcu *default_unicast_key;
struct ieee80211_key __rcu *default_multicast_key;
struct ieee80211_key __rcu *default_mgmt_key;
struct ieee80211_key __rcu *default_beacon_key;
u16 sequence_number; u16 sequence_number;
__be16 control_port_protocol; __be16 control_port_protocol;
...@@ -949,23 +989,9 @@ struct ieee80211_sub_if_data { ...@@ -949,23 +989,9 @@ struct ieee80211_sub_if_data {
struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
struct mac80211_qos_map __rcu *qos_map; struct mac80211_qos_map __rcu *qos_map;
struct airtime_info airtime[IEEE80211_NUM_ACS];
struct work_struct csa_finalize_work;
bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
struct cfg80211_chan_def csa_chandef;
struct work_struct color_change_finalize_work;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
/* context reservation -- protected with chanctx_mtx */
struct ieee80211_chanctx *reserved_chanctx;
struct cfg80211_chan_def reserved_chandef;
bool reserved_radar_required;
bool reserved_ready;
/* used to reconfigure hardware SM PS */ /* used to reconfigure hardware SM PS */
struct work_struct recalc_smps; struct work_struct recalc_smps;
...@@ -973,15 +999,6 @@ struct ieee80211_sub_if_data { ...@@ -973,15 +999,6 @@ struct ieee80211_sub_if_data {
struct sk_buff_head skb_queue; struct sk_buff_head skb_queue;
struct sk_buff_head status_queue; struct sk_buff_head status_queue;
u8 needed_rx_chains;
enum ieee80211_smps_mode smps_mode;
int user_power_level; /* in dBm */
int ap_power_level; /* in dBm */
bool radar_required;
struct delayed_work dfs_cac_timer_work;
/* /*
* AP this belongs to: self in AP mode and * AP this belongs to: self in AP mode and
* corresponding AP in VLAN mode, NULL for * corresponding AP in VLAN mode, NULL for
...@@ -1013,6 +1030,8 @@ struct ieee80211_sub_if_data { ...@@ -1013,6 +1030,8 @@ struct ieee80211_sub_if_data {
struct ieee80211_if_nan nan; struct ieee80211_if_nan nan;
} u; } u;
struct ieee80211_link_data deflink;
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
struct { struct {
struct dentry *subdir_stations; struct dentry *subdir_stations;
...@@ -1670,7 +1689,7 @@ static inline struct airtime_info *to_airtime_info(struct ieee80211_txq *txq) ...@@ -1670,7 +1689,7 @@ static inline struct airtime_info *to_airtime_info(struct ieee80211_txq *txq)
} }
sdata = vif_to_sdata(txq->vif); sdata = vif_to_sdata(txq->vif);
return &sdata->airtime[txq->ac]; return &sdata->deflink.airtime[txq->ac];
} }
/* To avoid divisions in the fast path, we keep pre-computed reciprocals for /* To avoid divisions in the fast path, we keep pre-computed reciprocals for
......
...@@ -60,11 +60,11 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) ...@@ -60,11 +60,11 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)
power = ieee80211_chandef_max_power(&chanctx_conf->def); power = ieee80211_chandef_max_power(&chanctx_conf->def);
rcu_read_unlock(); rcu_read_unlock();
if (sdata->user_power_level != IEEE80211_UNSET_POWER_LEVEL) if (sdata->deflink.user_power_level != IEEE80211_UNSET_POWER_LEVEL)
power = min(power, sdata->user_power_level); power = min(power, sdata->deflink.user_power_level);
if (sdata->ap_power_level != IEEE80211_UNSET_POWER_LEVEL) if (sdata->deflink.ap_power_level != IEEE80211_UNSET_POWER_LEVEL)
power = min(power, sdata->ap_power_level); power = min(power, sdata->deflink.ap_power_level);
if (power != sdata->vif.bss_conf.txpower) { if (power != sdata->vif.bss_conf.txpower) {
sdata->vif.bss_conf.txpower = power; sdata->vif.bss_conf.txpower = power;
...@@ -452,19 +452,19 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -452,19 +452,19 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
sdata->vif.bss_conf.csa_active = false; sdata->vif.bss_conf.csa_active = false;
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->u.mgd.csa_waiting_bcn = false; sdata->deflink.u.mgd.csa_waiting_bcn = false;
if (sdata->csa_block_tx) { if (sdata->deflink.csa_block_tx) {
ieee80211_wake_vif_queues(local, sdata, ieee80211_wake_vif_queues(local, sdata,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->csa_block_tx = false; sdata->deflink.csa_block_tx = false;
} }
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
cancel_work_sync(&sdata->csa_finalize_work); cancel_work_sync(&sdata->deflink.csa_finalize_work);
cancel_work_sync(&sdata->color_change_finalize_work); cancel_work_sync(&sdata->deflink.color_change_finalize_work);
cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); cancel_delayed_work_sync(&sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) { if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef; chandef = sdata->vif.bss_conf.chandef;
...@@ -831,7 +831,7 @@ static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx, ...@@ -831,7 +831,7 @@ static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
} }
} }
sta = sta_info_get(sdata, sdata->u.mgd.bssid); sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid);
break; break;
default: default:
goto out; goto out;
...@@ -1208,7 +1208,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) ...@@ -1208,7 +1208,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
switch (sdata->vif.type) { switch (sdata->vif.type) {
case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_AP_VLAN:
/* no need to tell driver, but set carrier and chanctx */ /* no need to tell driver, but set carrier and chanctx */
if (rtnl_dereference(sdata->bss->beacon)) { if (sdata->bss->active) {
ieee80211_vif_vlan_copy_chanctx(sdata); ieee80211_vif_vlan_copy_chanctx(sdata);
netif_carrier_on(dev); netif_carrier_on(dev);
ieee80211_set_vif_encap_ops(sdata); ieee80211_set_vif_encap_ops(sdata);
...@@ -1630,8 +1630,9 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, ...@@ -1630,8 +1630,9 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
static const u8 bssid_wildcard[ETH_ALEN] = {0xff, 0xff, 0xff, static const u8 bssid_wildcard[ETH_ALEN] = {0xff, 0xff, 0xff,
0xff, 0xff, 0xff}; 0xff, 0xff, 0xff};
/* clear type-dependent union */ /* clear type-dependent unions */
memset(&sdata->u, 0, sizeof(sdata->u)); memset(&sdata->u, 0, sizeof(sdata->u));
memset(&sdata->deflink.u, 0, sizeof(sdata->deflink.u));
/* and set some type-dependent values */ /* and set some type-dependent values */
sdata->vif.type = type; sdata->vif.type = type;
...@@ -1657,8 +1658,10 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, ...@@ -1657,8 +1658,10 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
skb_queue_head_init(&sdata->status_queue); skb_queue_head_init(&sdata->status_queue);
INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->work, ieee80211_iface_work);
INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); INIT_WORK(&sdata->deflink.csa_finalize_work,
INIT_WORK(&sdata->color_change_finalize_work, ieee80211_color_change_finalize_work); ieee80211_csa_finalize_work);
INIT_WORK(&sdata->deflink.color_change_finalize_work,
ieee80211_color_change_finalize_work);
INIT_LIST_HEAD(&sdata->assigned_chanctx_list); INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
INIT_LIST_HEAD(&sdata->reserved_chanctx_list); INIT_LIST_HEAD(&sdata->reserved_chanctx_list);
...@@ -1679,7 +1682,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, ...@@ -1679,7 +1682,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
sdata->vif.p2p = true; sdata->vif.p2p = true;
fallthrough; fallthrough;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid; sdata->vif.bss_conf.bssid = sdata->deflink.u.mgd.bssid;
ieee80211_sta_setup_sdata(sdata); ieee80211_sta_setup_sdata(sdata);
break; break;
case NL80211_IFTYPE_OCB: case NL80211_IFTYPE_OCB:
...@@ -2076,7 +2079,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -2076,7 +2079,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
INIT_LIST_HEAD(&sdata->key_list); INIT_LIST_HEAD(&sdata->key_list);
INIT_DELAYED_WORK(&sdata->dfs_cac_timer_work, INIT_DELAYED_WORK(&sdata->deflink.dfs_cac_timer_work,
ieee80211_dfs_cac_timer_work); ieee80211_dfs_cac_timer_work);
INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk, INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk,
ieee80211_delayed_tailroom_dec); ieee80211_delayed_tailroom_dec);
...@@ -2106,12 +2109,13 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -2106,12 +2109,13 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
} }
for (i = 0; i < IEEE80211_NUM_ACS; i++) for (i = 0; i < IEEE80211_NUM_ACS; i++)
init_airtime_info(&sdata->airtime[i], &local->airtime[i]); init_airtime_info(&sdata->deflink.airtime[i],
&local->airtime[i]);
ieee80211_set_default_queues(sdata); ieee80211_set_default_queues(sdata);
sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL;
sdata->user_power_level = local->user_power_level; sdata->deflink.user_power_level = local->user_power_level;
/* setup type-dependent data */ /* setup type-dependent data */
ieee80211_setup_sdata(sdata, type); ieee80211_setup_sdata(sdata, type);
......
...@@ -351,8 +351,11 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, ...@@ -351,8 +351,11 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
assert_key_lock(sdata->local); assert_key_lock(sdata->local);
if (idx >= 0 && idx < NUM_DEFAULT_KEYS) if (idx >= 0 && idx < NUM_DEFAULT_KEYS) {
key = key_mtx_dereference(sdata->local, sdata->keys[idx]); key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
if (!key)
key = key_mtx_dereference(sdata->local, sdata->deflink.gtk[idx]);
}
if (uni) { if (uni) {
rcu_assign_pointer(sdata->default_unicast_key, key); rcu_assign_pointer(sdata->default_unicast_key, key);
...@@ -362,7 +365,7 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, ...@@ -362,7 +365,7 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
} }
if (multi) if (multi)
rcu_assign_pointer(sdata->default_multicast_key, key); rcu_assign_pointer(sdata->deflink.default_multicast_key, key);
ieee80211_debugfs_key_update_default(sdata); ieee80211_debugfs_key_update_default(sdata);
} }
...@@ -384,9 +387,10 @@ __ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx) ...@@ -384,9 +387,10 @@ __ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx)
if (idx >= NUM_DEFAULT_KEYS && if (idx >= NUM_DEFAULT_KEYS &&
idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS)
key = key_mtx_dereference(sdata->local, sdata->keys[idx]); key = key_mtx_dereference(sdata->local,
sdata->deflink.gtk[idx]);
rcu_assign_pointer(sdata->default_mgmt_key, key); rcu_assign_pointer(sdata->deflink.default_mgmt_key, key);
ieee80211_debugfs_key_update_default(sdata); ieee80211_debugfs_key_update_default(sdata);
} }
...@@ -409,9 +413,10 @@ __ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, int idx) ...@@ -409,9 +413,10 @@ __ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, int idx)
if (idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS && if (idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS &&
idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS + idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS +
NUM_DEFAULT_BEACON_KEYS) NUM_DEFAULT_BEACON_KEYS)
key = key_mtx_dereference(sdata->local, sdata->keys[idx]); key = key_mtx_dereference(sdata->local,
sdata->deflink.gtk[idx]);
rcu_assign_pointer(sdata->default_beacon_key, key); rcu_assign_pointer(sdata->deflink.default_beacon_key, key);
ieee80211_debugfs_key_update_default(sdata); ieee80211_debugfs_key_update_default(sdata);
} }
...@@ -498,13 +503,13 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, ...@@ -498,13 +503,13 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
sdata->default_unicast_key); sdata->default_unicast_key);
defmultikey = old && defmultikey = old &&
old == key_mtx_dereference(sdata->local, old == key_mtx_dereference(sdata->local,
sdata->default_multicast_key); sdata->deflink.default_multicast_key);
defmgmtkey = old && defmgmtkey = old &&
old == key_mtx_dereference(sdata->local, old == key_mtx_dereference(sdata->local,
sdata->default_mgmt_key); sdata->deflink.default_mgmt_key);
defbeaconkey = old && defbeaconkey = old &&
old == key_mtx_dereference(sdata->local, old == key_mtx_dereference(sdata->local,
sdata->default_beacon_key); sdata->deflink.default_beacon_key);
if (defunikey && !new) if (defunikey && !new)
__ieee80211_set_default_key(sdata, -1, true, false); __ieee80211_set_default_key(sdata, -1, true, false);
...@@ -515,7 +520,11 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, ...@@ -515,7 +520,11 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
if (defbeaconkey && !new) if (defbeaconkey && !new)
__ieee80211_set_default_beacon_key(sdata, -1); __ieee80211_set_default_beacon_key(sdata, -1);
rcu_assign_pointer(sdata->keys[idx], new); if (is_wep || pairwise)
rcu_assign_pointer(sdata->keys[idx], new);
else
rcu_assign_pointer(sdata->deflink.gtk[idx], new);
if (defunikey && new) if (defunikey && new)
__ieee80211_set_default_key(sdata, new->conf.keyidx, __ieee80211_set_default_key(sdata, new->conf.keyidx,
true, false); true, false);
...@@ -792,7 +801,7 @@ int ieee80211_key_link(struct ieee80211_key *key, ...@@ -792,7 +801,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
struct sta_info *sta) struct sta_info *sta)
{ {
static atomic_t key_color = ATOMIC_INIT(0); static atomic_t key_color = ATOMIC_INIT(0);
struct ieee80211_key *old_key; struct ieee80211_key *old_key = NULL;
int idx = key->conf.keyidx; int idx = key->conf.keyidx;
bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
/* /*
...@@ -821,7 +830,12 @@ int ieee80211_key_link(struct ieee80211_key *key, ...@@ -821,7 +830,12 @@ int ieee80211_key_link(struct ieee80211_key *key,
old_key = key_mtx_dereference(sdata->local, old_key = key_mtx_dereference(sdata->local,
sta->deflink.gtk[idx]); sta->deflink.gtk[idx]);
} else { } else {
old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]); if (idx < NUM_DEFAULT_KEYS)
old_key = key_mtx_dereference(sdata->local,
sdata->keys[idx]);
if (!old_key)
old_key = key_mtx_dereference(sdata->local,
sdata->deflink.gtk[idx]);
} }
/* Non-pairwise keys must also not switch the cipher on rekey */ /* Non-pairwise keys must also not switch the cipher on rekey */
......
This diff is collapsed.
...@@ -182,8 +182,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, ...@@ -182,8 +182,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
return -EINVAL; return -EINVAL;
sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
sdata->smps_mode = IEEE80211_SMPS_OFF; sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
sdata->needed_rx_chains = sdata->local->rx_chains; sdata->deflink.needed_rx_chains = sdata->local->rx_chains;
mutex_lock(&sdata->local->mtx); mutex_lock(&sdata->local->mtx);
err = ieee80211_vif_use_channel(sdata, &setup->chandef, err = ieee80211_vif_use_channel(sdata, &setup->chandef,
......
...@@ -800,7 +800,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -800,7 +800,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_P2P_GO:
if (sdata->vif.type != NL80211_IFTYPE_ADHOC && if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
!ieee80211_vif_is_mesh(&sdata->vif) && !ieee80211_vif_is_mesh(&sdata->vif) &&
!rcu_access_pointer(sdata->bss->beacon)) !sdata->bss->active)
need_offchan = true; need_offchan = true;
if (!ieee80211_is_action(mgmt->frame_control) || if (!ieee80211_is_action(mgmt->frame_control) ||
mgmt->u.action.category == WLAN_CATEGORY_PUBLIC || mgmt->u.action.category == WLAN_CATEGORY_PUBLIC ||
...@@ -819,7 +819,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -819,7 +819,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
if (!sdata->u.mgd.associated || if (!sdata->u.mgd.associated ||
(params->offchan && params->wait && (params->offchan && params->wait &&
local->ops->remain_on_channel && local->ops->remain_on_channel &&
memcmp(sdata->u.mgd.bssid, memcmp(sdata->deflink.u.mgd.bssid,
mgmt->bssid, ETH_ALEN))) mgmt->bssid, ETH_ALEN)))
need_offchan = true; need_offchan = true;
sdata_unlock(sdata); sdata_unlock(sdata);
...@@ -887,7 +887,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -887,7 +887,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
rcu_read_lock(); rcu_read_lock();
if (sdata->vif.type == NL80211_IFTYPE_AP) if (sdata->vif.type == NL80211_IFTYPE_AP)
beacon = rcu_dereference(sdata->u.ap.beacon); beacon = rcu_dereference(sdata->deflink.u.ap.beacon);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
beacon = rcu_dereference(sdata->u.ibss.presp); beacon = rcu_dereference(sdata->u.ibss.presp);
else if (ieee80211_vif_is_mesh(&sdata->vif)) else if (ieee80211_vif_is_mesh(&sdata->vif))
......
...@@ -1872,11 +1872,11 @@ ieee80211_rx_get_bigtk(struct ieee80211_rx_data *rx, int idx) ...@@ -1872,11 +1872,11 @@ ieee80211_rx_get_bigtk(struct ieee80211_rx_data *rx, int idx)
if (rx->sta) if (rx->sta)
key = rcu_dereference(rx->sta->deflink.gtk[idx]); key = rcu_dereference(rx->sta->deflink.gtk[idx]);
if (!key) if (!key)
key = rcu_dereference(sdata->keys[idx]); key = rcu_dereference(sdata->deflink.gtk[idx]);
if (!key && rx->sta) if (!key && rx->sta)
key = rcu_dereference(rx->sta->deflink.gtk[idx2]); key = rcu_dereference(rx->sta->deflink.gtk[idx2]);
if (!key) if (!key)
key = rcu_dereference(sdata->keys[idx2]); key = rcu_dereference(sdata->deflink.gtk[idx2]);
return key; return key;
} }
...@@ -1990,7 +1990,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) ...@@ -1990,7 +1990,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
rx->key = rcu_dereference(rx->sta->deflink.gtk[mmie_keyidx]); rx->key = rcu_dereference(rx->sta->deflink.gtk[mmie_keyidx]);
} }
if (!rx->key) if (!rx->key)
rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]); rx->key = rcu_dereference(rx->sdata->deflink.gtk[mmie_keyidx]);
} else if (!ieee80211_has_protected(fc)) { } else if (!ieee80211_has_protected(fc)) {
/* /*
* The frame was not protected, so skip decryption. However, we * The frame was not protected, so skip decryption. However, we
...@@ -2006,7 +2006,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) ...@@ -2006,7 +2006,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
key = ieee80211_rx_get_bigtk(rx, -1); key = ieee80211_rx_get_bigtk(rx, -1);
} else if (ieee80211_is_mgmt(fc) && } else if (ieee80211_is_mgmt(fc) &&
is_multicast_ether_addr(hdr->addr1)) { is_multicast_ether_addr(hdr->addr1)) {
key = rcu_dereference(rx->sdata->default_mgmt_key); key = rcu_dereference(rx->sdata->deflink.default_mgmt_key);
} else { } else {
if (rx->sta) { if (rx->sta) {
for (i = 0; i < NUM_DEFAULT_KEYS; i++) { for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
...@@ -2017,7 +2017,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) ...@@ -2017,7 +2017,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
} }
if (!key) { if (!key) {
for (i = 0; i < NUM_DEFAULT_KEYS; i++) { for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
key = rcu_dereference(sdata->keys[i]); key = rcu_dereference(sdata->deflink.gtk[i]);
if (key) if (key)
break; break;
} }
...@@ -2051,7 +2051,10 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) ...@@ -2051,7 +2051,10 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
/* if not found, try default key */ /* if not found, try default key */
if (!rx->key) { if (!rx->key) {
rx->key = rcu_dereference(rx->sdata->keys[keyidx]); if (is_multicast_ether_addr(hdr->addr1))
rx->key = rcu_dereference(rx->sdata->deflink.gtk[keyidx]);
if (!rx->key)
rx->key = rcu_dereference(rx->sdata->keys[keyidx]);
/* /*
* RSNA-protected unicast frames should always be * RSNA-protected unicast frames should always be
...@@ -3121,8 +3124,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, ...@@ -3121,8 +3124,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,
return; return;
} }
if (!ether_addr_equal(mgmt->sa, sdata->u.mgd.bssid) || if (!ether_addr_equal(mgmt->sa, sdata->deflink.u.mgd.bssid) ||
!ether_addr_equal(mgmt->bssid, sdata->u.mgd.bssid)) { !ether_addr_equal(mgmt->bssid, sdata->deflink.u.mgd.bssid)) {
/* Not from the current AP or not associated yet. */ /* Not from the current AP or not associated yet. */
return; return;
} }
...@@ -3140,7 +3143,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, ...@@ -3140,7 +3143,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,
resp = skb_put_zero(skb, 24); resp = skb_put_zero(skb, 24);
memcpy(resp->da, mgmt->sa, ETH_ALEN); memcpy(resp->da, mgmt->sa, ETH_ALEN);
memcpy(resp->sa, sdata->vif.addr, ETH_ALEN); memcpy(resp->sa, sdata->vif.addr, ETH_ALEN);
memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(resp->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION); IEEE80211_STYPE_ACTION);
skb_put(skb, 1 + sizeof(resp->u.action.u.sa_query)); skb_put(skb, 1 + sizeof(resp->u.action.u.sa_query));
...@@ -3423,7 +3426,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) ...@@ -3423,7 +3426,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
break; break;
if (!rx->sta) if (!rx->sta)
break; break;
if (!ether_addr_equal(mgmt->bssid, sdata->u.mgd.bssid)) if (!ether_addr_equal(mgmt->bssid, sdata->deflink.u.mgd.bssid))
break; break;
if (mgmt->u.action.u.ext_chan_switch.action_code != if (mgmt->u.action.u.ext_chan_switch.action_code !=
WLAN_PUB_ACTION_EXT_CHANSW_ANN) WLAN_PUB_ACTION_EXT_CHANSW_ANN)
...@@ -3524,7 +3527,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) ...@@ -3524,7 +3527,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
break; break;
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
bssid = sdata->u.mgd.bssid; bssid = sdata->deflink.u.mgd.bssid;
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
bssid = sdata->u.ibss.bssid; bssid = sdata->u.ibss.bssid;
else if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) else if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
......
...@@ -2312,7 +2312,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, ...@@ -2312,7 +2312,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
* (or just modify the value entirely, of course) * (or just modify the value entirely, of course)
*/ */
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
sinfo->rx_beacon = sdata->u.mgd.count_beacon_signal; sinfo->rx_beacon = sdata->deflink.u.mgd.count_beacon_signal;
drv_sta_statistics(local, sdata, &sta->sta, sinfo); drv_sta_statistics(local, sdata, &sta->sta, sinfo);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) |
...@@ -2323,7 +2323,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, ...@@ -2323,7 +2323,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC);
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
sinfo->beacon_loss_count = sdata->u.mgd.beacon_loss_count; sinfo->beacon_loss_count =
sdata->deflink.u.mgd.beacon_loss_count;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_LOSS); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_LOSS);
} }
......
...@@ -223,7 +223,7 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb) ...@@ -223,7 +223,7 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
* only be the AP. And the only other place updating * only be the AP. And the only other place updating
* this variable in managed mode is before association. * this variable in managed mode is before association.
*/ */
sdata->smps_mode = smps_mode; sdata->deflink.smps_mode = smps_mode;
ieee80211_queue_work(&local->hw, &sdata->recalc_smps); ieee80211_queue_work(&local->hw, &sdata->recalc_smps);
} else if (sdata->vif.type == NL80211_IFTYPE_AP || } else if (sdata->vif.type == NL80211_IFTYPE_AP ||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
......
...@@ -218,7 +218,7 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata, ...@@ -218,7 +218,7 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata,
lnkid->ie_type = WLAN_EID_LINK_ID; lnkid->ie_type = WLAN_EID_LINK_ID;
lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2;
memcpy(lnkid->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(lnkid->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(lnkid->init_sta, init_addr, ETH_ALEN); memcpy(lnkid->init_sta, init_addr, ETH_ALEN);
memcpy(lnkid->resp_sta, rsp_addr, ETH_ALEN); memcpy(lnkid->resp_sta, rsp_addr, ETH_ALEN);
} }
...@@ -545,7 +545,6 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, ...@@ -545,7 +545,6 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
size_t extra_ies_len) size_t extra_ies_len)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
size_t offset = 0, noffset; size_t offset = 0, noffset;
struct sta_info *sta, *ap_sta; struct sta_info *sta, *ap_sta;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
...@@ -558,7 +557,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, ...@@ -558,7 +557,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
mutex_lock(&local->sta_mtx); mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, peer); sta = sta_info_get(sdata, peer);
ap_sta = sta_info_get(sdata, ifmgd->bssid); ap_sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid);
if (WARN_ON_ONCE(!sta || !ap_sta)) { if (WARN_ON_ONCE(!sta || !ap_sta)) {
mutex_unlock(&local->sta_mtx); mutex_unlock(&local->sta_mtx);
return; return;
...@@ -833,7 +832,7 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, ...@@ -833,7 +832,7 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
mgmt = skb_put_zero(skb, 24); mgmt = skb_put_zero(skb, 24);
memcpy(mgmt->da, peer, ETH_ALEN); memcpy(mgmt->da, peer, ETH_ALEN);
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); memcpy(mgmt->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION); IEEE80211_STYPE_ACTION);
...@@ -1072,7 +1071,8 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, ...@@ -1072,7 +1071,8 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
enum ieee80211_smps_mode smps_mode = sdata->u.mgd.driver_smps_mode; enum ieee80211_smps_mode smps_mode =
sdata->deflink.u.mgd.driver_smps_mode;
int ret; int ret;
/* don't support setup with forced SMPS mode that's not off */ /* don't support setup with forced SMPS mode that's not off */
...@@ -1431,7 +1431,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1431,7 +1431,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
if (ret == 0) if (ret == 0)
ieee80211_queue_work(&sdata->local->hw, ieee80211_queue_work(&sdata->local->hw,
&sdata->u.mgd.request_smps_work); &sdata->deflink.u.mgd.request_smps_work);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
......
...@@ -593,15 +593,15 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) ...@@ -593,15 +593,15 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
(key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
tx->key = key; tx->key = key;
else if (ieee80211_is_group_privacy_action(tx->skb) && else if (ieee80211_is_group_privacy_action(tx->skb) &&
(key = rcu_dereference(tx->sdata->default_multicast_key))) (key = rcu_dereference(tx->sdata->deflink.default_multicast_key)))
tx->key = key; tx->key = key;
else if (ieee80211_is_mgmt(hdr->frame_control) && else if (ieee80211_is_mgmt(hdr->frame_control) &&
is_multicast_ether_addr(hdr->addr1) && is_multicast_ether_addr(hdr->addr1) &&
ieee80211_is_robust_mgmt_frame(tx->skb) && ieee80211_is_robust_mgmt_frame(tx->skb) &&
(key = rcu_dereference(tx->sdata->default_mgmt_key))) (key = rcu_dereference(tx->sdata->deflink.default_mgmt_key)))
tx->key = key; tx->key = key;
else if (is_multicast_ether_addr(hdr->addr1) && else if (is_multicast_ether_addr(hdr->addr1) &&
(key = rcu_dereference(tx->sdata->default_multicast_key))) (key = rcu_dereference(tx->sdata->deflink.default_multicast_key)))
tx->key = key; tx->key = key;
else if (!is_multicast_ether_addr(hdr->addr1) && else if (!is_multicast_ether_addr(hdr->addr1) &&
(key = rcu_dereference(tx->sdata->default_unicast_key))) (key = rcu_dereference(tx->sdata->default_unicast_key)))
...@@ -2477,7 +2477,7 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, ...@@ -2477,7 +2477,7 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
} }
sta = sta_info_get(sdata, sdata->u.mgd.bssid); sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid);
if (!sta) if (!sta)
return -ENOLINK; return -ENOLINK;
break; break;
...@@ -2712,14 +2712,14 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, ...@@ -2712,14 +2712,14 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
/* DA SA BSSID */ /* DA SA BSSID */
memcpy(hdr.addr1, skb->data, ETH_ALEN); memcpy(hdr.addr1, skb->data, ETH_ALEN);
memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr.addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN);
hdrlen = 24; hdrlen = 24;
} else if (sdata->u.mgd.use_4addr && } else if (sdata->u.mgd.use_4addr &&
cpu_to_be16(ethertype) != sdata->control_port_protocol) { cpu_to_be16(ethertype) != sdata->control_port_protocol) {
fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
IEEE80211_FCTL_TODS); IEEE80211_FCTL_TODS);
/* RA TA DA SA */ /* RA TA DA SA */
memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr.addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN);
memcpy(hdr.addr3, skb->data, ETH_ALEN); memcpy(hdr.addr3, skb->data, ETH_ALEN);
memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
...@@ -2727,7 +2727,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, ...@@ -2727,7 +2727,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
} else { } else {
fc |= cpu_to_le16(IEEE80211_FCTL_TODS); fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
/* BSSID SA DA */ /* BSSID SA DA */
memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr.addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
memcpy(hdr.addr3, skb->data, ETH_ALEN); memcpy(hdr.addr3, skb->data, ETH_ALEN);
hdrlen = 24; hdrlen = 24;
...@@ -3004,7 +3004,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) ...@@ -3004,7 +3004,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
/* DA SA BSSID */ /* DA SA BSSID */
build.da_offs = offsetof(struct ieee80211_hdr, addr1); build.da_offs = offsetof(struct ieee80211_hdr, addr1);
build.sa_offs = offsetof(struct ieee80211_hdr, addr2); build.sa_offs = offsetof(struct ieee80211_hdr, addr2);
memcpy(hdr->addr3, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN);
build.hdr_len = 24; build.hdr_len = 24;
break; break;
} }
...@@ -3014,7 +3014,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) ...@@ -3014,7 +3014,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
IEEE80211_FCTL_TODS); IEEE80211_FCTL_TODS);
/* RA TA DA SA */ /* RA TA DA SA */
memcpy(hdr->addr1, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
build.da_offs = offsetof(struct ieee80211_hdr, addr3); build.da_offs = offsetof(struct ieee80211_hdr, addr3);
build.sa_offs = offsetof(struct ieee80211_hdr, addr4); build.sa_offs = offsetof(struct ieee80211_hdr, addr4);
...@@ -3023,7 +3023,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) ...@@ -3023,7 +3023,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
} }
fc |= cpu_to_le16(IEEE80211_FCTL_TODS); fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
/* BSSID SA DA */ /* BSSID SA DA */
memcpy(hdr->addr1, sdata->u.mgd.bssid, ETH_ALEN); memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
build.da_offs = offsetof(struct ieee80211_hdr, addr3); build.da_offs = offsetof(struct ieee80211_hdr, addr3);
build.sa_offs = offsetof(struct ieee80211_hdr, addr2); build.sa_offs = offsetof(struct ieee80211_hdr, addr2);
build.hdr_len = 24; build.hdr_len = 24;
...@@ -3250,7 +3250,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, ...@@ -3250,7 +3250,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
*/ */
switch (sdata->vif.type) { switch (sdata->vif.type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
bssid = sdata->u.mgd.bssid; bssid = sdata->deflink.u.mgd.bssid;
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_AP_VLAN:
...@@ -4804,7 +4804,7 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, ...@@ -4804,7 +4804,7 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata,
} }
rcu_read_lock(); rcu_read_lock();
resp = rcu_dereference(sdata->u.ap.probe_resp); resp = rcu_dereference(sdata->deflink.u.ap.probe_resp);
bcn_offsets = beacon->cntdwn_counter_offsets; bcn_offsets = beacon->cntdwn_counter_offsets;
count = beacon->cntdwn_current_counter; count = beacon->cntdwn_current_counter;
...@@ -4848,7 +4848,7 @@ u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif) ...@@ -4848,7 +4848,7 @@ u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif)
rcu_read_lock(); rcu_read_lock();
if (sdata->vif.type == NL80211_IFTYPE_AP) if (sdata->vif.type == NL80211_IFTYPE_AP)
beacon = rcu_dereference(sdata->u.ap.beacon); beacon = rcu_dereference(sdata->deflink.u.ap.beacon);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
beacon = rcu_dereference(sdata->u.ibss.presp); beacon = rcu_dereference(sdata->u.ibss.presp);
else if (ieee80211_vif_is_mesh(&sdata->vif)) else if (ieee80211_vif_is_mesh(&sdata->vif))
...@@ -4873,7 +4873,7 @@ void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) ...@@ -4873,7 +4873,7 @@ void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
rcu_read_lock(); rcu_read_lock();
if (sdata->vif.type == NL80211_IFTYPE_AP) if (sdata->vif.type == NL80211_IFTYPE_AP)
beacon = rcu_dereference(sdata->u.ap.beacon); beacon = rcu_dereference(sdata->deflink.u.ap.beacon);
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
beacon = rcu_dereference(sdata->u.ibss.presp); beacon = rcu_dereference(sdata->u.ibss.presp);
else if (ieee80211_vif_is_mesh(&sdata->vif)) else if (ieee80211_vif_is_mesh(&sdata->vif))
...@@ -4903,9 +4903,7 @@ bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif) ...@@ -4903,9 +4903,7 @@ bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif)
rcu_read_lock(); rcu_read_lock();
if (vif->type == NL80211_IFTYPE_AP) { if (vif->type == NL80211_IFTYPE_AP) {
struct ieee80211_if_ap *ap = &sdata->u.ap; beacon = rcu_dereference(sdata->deflink.u.ap.beacon);
beacon = rcu_dereference(ap->beacon);
if (WARN_ON(!beacon || !beacon->tail)) if (WARN_ON(!beacon || !beacon->tail))
goto out; goto out;
beacon_data = beacon->tail; beacon_data = beacon->tail;
...@@ -4958,7 +4956,7 @@ static int ieee80211_beacon_protect(struct sk_buff *skb, ...@@ -4958,7 +4956,7 @@ static int ieee80211_beacon_protect(struct sk_buff *skb,
struct sk_buff *check_skb; struct sk_buff *check_skb;
memset(&tx, 0, sizeof(tx)); memset(&tx, 0, sizeof(tx));
tx.key = rcu_dereference(sdata->default_beacon_key); tx.key = rcu_dereference(sdata->deflink.default_beacon_key);
if (!tx.key) if (!tx.key)
return 0; return 0;
tx.local = local; tx.local = local;
...@@ -5128,9 +5126,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw, ...@@ -5128,9 +5126,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
memset(offs, 0, sizeof(*offs)); memset(offs, 0, sizeof(*offs));
if (sdata->vif.type == NL80211_IFTYPE_AP) { if (sdata->vif.type == NL80211_IFTYPE_AP) {
struct ieee80211_if_ap *ap = &sdata->u.ap; beacon = rcu_dereference(sdata->deflink.u.ap.beacon);
beacon = rcu_dereference(ap->beacon);
if (!beacon) if (!beacon)
goto out; goto out;
...@@ -5268,7 +5264,6 @@ EXPORT_SYMBOL(ieee80211_beacon_get_tim); ...@@ -5268,7 +5264,6 @@ EXPORT_SYMBOL(ieee80211_beacon_get_tim);
struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ieee80211_if_ap *ap = NULL;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct probe_resp *presp = NULL; struct probe_resp *presp = NULL;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
...@@ -5278,9 +5273,7 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, ...@@ -5278,9 +5273,7 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
return NULL; return NULL;
rcu_read_lock(); rcu_read_lock();
presp = rcu_dereference(sdata->deflink.u.ap.probe_resp);
ap = &sdata->u.ap;
presp = rcu_dereference(ap->probe_resp);
if (!presp) if (!presp)
goto out; goto out;
...@@ -5310,7 +5303,7 @@ struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw, ...@@ -5310,7 +5303,7 @@ struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
return NULL; return NULL;
rcu_read_lock(); rcu_read_lock();
tmpl = rcu_dereference(sdata->u.ap.fils_discovery); tmpl = rcu_dereference(sdata->deflink.u.ap.fils_discovery);
if (!tmpl) { if (!tmpl) {
rcu_read_unlock(); rcu_read_unlock();
return NULL; return NULL;
...@@ -5339,7 +5332,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, ...@@ -5339,7 +5332,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
return NULL; return NULL;
rcu_read_lock(); rcu_read_lock();
tmpl = rcu_dereference(sdata->u.ap.unsol_bcast_probe_resp); tmpl = rcu_dereference(sdata->deflink.u.ap.unsol_bcast_probe_resp);
if (!tmpl) { if (!tmpl) {
rcu_read_unlock(); rcu_read_unlock();
return NULL; return NULL;
...@@ -5360,7 +5353,6 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, ...@@ -5360,7 +5353,6 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct ieee80211_if_managed *ifmgd;
struct ieee80211_pspoll *pspoll; struct ieee80211_pspoll *pspoll;
struct ieee80211_local *local; struct ieee80211_local *local;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -5369,7 +5361,6 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, ...@@ -5369,7 +5361,6 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
return NULL; return NULL;
sdata = vif_to_sdata(vif); sdata = vif_to_sdata(vif);
ifmgd = &sdata->u.mgd;
local = sdata->local; local = sdata->local;
skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll)); skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll));
...@@ -5386,7 +5377,7 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, ...@@ -5386,7 +5377,7 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
/* aid in PS-Poll has its two MSBs each set to 1 */ /* aid in PS-Poll has its two MSBs each set to 1 */
pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14); pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN); memcpy(pspoll->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(pspoll->ta, vif->addr, ETH_ALEN); memcpy(pspoll->ta, vif->addr, ETH_ALEN);
return skb; return skb;
...@@ -5399,7 +5390,6 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, ...@@ -5399,7 +5390,6 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
{ {
struct ieee80211_hdr_3addr *nullfunc; struct ieee80211_hdr_3addr *nullfunc;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct ieee80211_if_managed *ifmgd;
struct ieee80211_local *local; struct ieee80211_local *local;
struct sk_buff *skb; struct sk_buff *skb;
bool qos = false; bool qos = false;
...@@ -5408,14 +5398,13 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, ...@@ -5408,14 +5398,13 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
return NULL; return NULL;
sdata = vif_to_sdata(vif); sdata = vif_to_sdata(vif);
ifmgd = &sdata->u.mgd;
local = sdata->local; local = sdata->local;
if (qos_ok) { if (qos_ok) {
struct sta_info *sta; struct sta_info *sta;
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(sdata, ifmgd->bssid); sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid);
qos = sta && sta->sta.wme; qos = sta && sta->sta.wme;
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -5444,9 +5433,9 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, ...@@ -5444,9 +5433,9 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
skb_put_data(skb, &qoshdr, sizeof(qoshdr)); skb_put_data(skb, &qoshdr, sizeof(qoshdr));
} }
memcpy(nullfunc->addr1, ifmgd->bssid, ETH_ALEN); memcpy(nullfunc->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); memcpy(nullfunc->addr2, vif->addr, ETH_ALEN);
memcpy(nullfunc->addr3, ifmgd->bssid, ETH_ALEN); memcpy(nullfunc->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN);
return skb; return skb;
} }
...@@ -5543,7 +5532,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, ...@@ -5543,7 +5532,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
if (sdata->vif.type == NL80211_IFTYPE_AP) { if (sdata->vif.type == NL80211_IFTYPE_AP) {
struct beacon_data *beacon = struct beacon_data *beacon =
rcu_dereference(sdata->u.ap.beacon); rcu_dereference(sdata->deflink.u.ap.beacon);
if (!beacon || !beacon->head) if (!beacon || !beacon->head)
goto out; goto out;
......
...@@ -2533,7 +2533,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2533,7 +2533,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
BSS_CHANGED_PS; BSS_CHANGED_PS;
/* Re-send beacon info report to the driver */ /* Re-send beacon info report to the driver */
if (sdata->u.mgd.have_beacon) if (sdata->deflink.u.mgd.have_beacon)
changed |= BSS_CHANGED_BEACON_INFO; changed |= BSS_CHANGED_BEACON_INFO;
if (sdata->vif.bss_conf.max_idle_period || if (sdata->vif.bss_conf.max_idle_period ||
...@@ -2562,7 +2562,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2562,7 +2562,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
if (sdata->vif.type == NL80211_IFTYPE_AP) { if (sdata->vif.type == NL80211_IFTYPE_AP) {
changed |= BSS_CHANGED_AP_PROBE_RESP; changed |= BSS_CHANGED_AP_PROBE_RESP;
if (rcu_access_pointer(sdata->u.ap.beacon)) if (rcu_access_pointer(sdata->deflink.u.ap.beacon))
drv_start_ap(local, sdata); drv_start_ap(local, sdata);
} }
fallthrough; fallthrough;
...@@ -3041,7 +3041,7 @@ void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, ...@@ -3041,7 +3041,7 @@ void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
cap = le16_to_cpu(iftd->he_6ghz_capa.capa); cap = le16_to_cpu(iftd->he_6ghz_capa.capa);
cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS; cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS;
switch (sdata->smps_mode) { switch (sdata->deflink.smps_mode) {
case IEEE80211_SMPS_AUTOMATIC: case IEEE80211_SMPS_AUTOMATIC:
case IEEE80211_SMPS_NUM_MODES: case IEEE80211_SMPS_NUM_MODES:
WARN_ON(1); WARN_ON(1);
...@@ -3775,13 +3775,11 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, ...@@ -3775,13 +3775,11 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
int ieee80211_ave_rssi(struct ieee80211_vif *vif) int ieee80211_ave_rssi(struct ieee80211_vif *vif)
{ {
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) { if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION))
/* non-managed type inferfaces */
return 0; return 0;
}
return -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal);
} }
EXPORT_SYMBOL_GPL(ieee80211_ave_rssi); EXPORT_SYMBOL_GPL(ieee80211_ave_rssi);
...@@ -3973,7 +3971,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) ...@@ -3973,7 +3971,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
* by the time it gets it, sdata->wdev.cac_started * by the time it gets it, sdata->wdev.cac_started
* will no longer be true * will no longer be true
*/ */
cancel_delayed_work(&sdata->dfs_cac_timer_work); cancel_delayed_work(&sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) { if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef; chandef = sdata->vif.bss_conf.chandef;
...@@ -4412,8 +4410,8 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, ...@@ -4412,8 +4410,8 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local,
return 0; return 0;
list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list)
if (sdata->reserved_radar_required) if (sdata->deflink.reserved_radar_required)
radar_detect |= BIT(sdata->reserved_chandef.width); radar_detect |= BIT(sdata->deflink.reserved_chandef.width);
/* /*
* An in-place reservation context should not have any assigned vifs * An in-place reservation context should not have any assigned vifs
...@@ -4423,7 +4421,7 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, ...@@ -4423,7 +4421,7 @@ static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local,
!list_empty(&ctx->assigned_vifs)); !list_empty(&ctx->assigned_vifs));
list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list)
if (sdata->radar_required) if (sdata->deflink.radar_required)
radar_detect |= BIT(sdata->vif.bss_conf.chandef.width); radar_detect |= BIT(sdata->vif.bss_conf.chandef.width);
return radar_detect; return radar_detect;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* /*
* Copyright 2004, Instant802 Networks, Inc. * Copyright 2004, Instant802 Networks, Inc.
* Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2022 Intel Corporation
*/ */
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -210,7 +211,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ...@@ -210,7 +211,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
if (sta) if (sta)
break; break;
ra = sdata->u.mgd.bssid; ra = sdata->deflink.u.mgd.bssid;
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
ra = skb->data; ra = skb->data;
......
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