Commit c8fe4b0b authored by Johannes Berg's avatar Johannes Berg

mac80211: use ifmgd->bssid instead of ifmgd->associated->bssid

Since we always track the BSSID there when we get associated,
these are equivalent, but ifmgd->bssid saves a dereference and
thus makes the code a bit smaller, and more readable.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent f344c58c
...@@ -2928,7 +2928,7 @@ int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata, ...@@ -2928,7 +2928,7 @@ int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT) sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
return 0; return 0;
ap = sdata->u.mgd.associated->bssid; ap = sdata->u.mgd.bssid;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) { list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) {
......
...@@ -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.associated->bssid, ETH_ALEN); memcpy(hdr->addr1, sdata->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);
......
...@@ -287,7 +287,7 @@ static void ieee80211_restart_work(struct work_struct *work) ...@@ -287,7 +287,7 @@ static void ieee80211_restart_work(struct work_struct *work)
if (sdata->vif.csa_active) { if (sdata->vif.csa_active) {
sdata_lock(sdata); sdata_lock(sdata);
ieee80211_sta_connection_lost(sdata, ieee80211_sta_connection_lost(sdata,
sdata->u.mgd.associated->bssid, sdata->u.mgd.bssid,
WLAN_REASON_UNSPECIFIED, false); WLAN_REASON_UNSPECIFIED, false);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
......
...@@ -1398,7 +1398,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -1398,7 +1398,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band,
bss->vht_cap_info, bss->vht_cap_info,
ifmgd->flags, ifmgd->flags,
ifmgd->associated->bssid, &csa_ie); ifmgd->bssid, &csa_ie);
if (!res) { if (!res) {
ch_switch.timestamp = timestamp; ch_switch.timestamp = timestamp;
...@@ -1427,7 +1427,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -1427,7 +1427,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
csa_ie.chandef.chan->band) { csa_ie.chandef.chan->band) {
sdata_info(sdata, sdata_info(sdata,
"AP %pM switches to different band (%d MHz, width:%d, CF1/2: %d/%d MHz), disconnecting\n", "AP %pM switches to different band (%d MHz, width:%d, CF1/2: %d/%d MHz), disconnecting\n",
ifmgd->associated->bssid, ifmgd->bssid,
csa_ie.chandef.chan->center_freq, csa_ie.chandef.chan->center_freq,
csa_ie.chandef.width, csa_ie.chandef.center_freq1, csa_ie.chandef.width, csa_ie.chandef.center_freq1,
csa_ie.chandef.center_freq2); csa_ie.chandef.center_freq2);
...@@ -1440,7 +1440,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -1440,7 +1440,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
"AP %pM switches to unsupported channel " "AP %pM switches to unsupported channel "
"(%d.%03d MHz, width:%d, CF1/2: %d.%03d/%d MHz), " "(%d.%03d MHz, width:%d, CF1/2: %d.%03d/%d MHz), "
"disconnecting\n", "disconnecting\n",
ifmgd->associated->bssid, ifmgd->bssid,
csa_ie.chandef.chan->center_freq, csa_ie.chandef.chan->center_freq,
csa_ie.chandef.chan->freq_offset, csa_ie.chandef.chan->freq_offset,
csa_ie.chandef.width, csa_ie.chandef.center_freq1, csa_ie.chandef.width, csa_ie.chandef.center_freq1,
...@@ -1456,7 +1456,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -1456,7 +1456,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
return; return;
sdata_info(sdata, sdata_info(sdata,
"AP %pM tries to chanswitch to same channel, ignore\n", "AP %pM tries to chanswitch to same channel, ignore\n",
ifmgd->associated->bssid); ifmgd->bssid);
ifmgd->csa_ignored_same_chan = true; ifmgd->csa_ignored_same_chan = true;
return; return;
} }
...@@ -2609,7 +2609,7 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) ...@@ -2609,7 +2609,7 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
const struct element *ssid; const struct element *ssid;
u8 *dst = ifmgd->associated->bssid; u8 *dst = ifmgd->bssid;
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;
...@@ -3219,8 +3219,8 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, ...@@ -3219,8 +3219,8 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
} }
if (ifmgd->associated && if (ifmgd->associated &&
ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) { ether_addr_equal(mgmt->bssid, ifmgd->bssid)) {
const u8 *bssid = ifmgd->associated->bssid; const u8 *bssid = ifmgd->bssid;
sdata_info(sdata, "deauthenticated from %pM (Reason: %u=%s)\n", sdata_info(sdata, "deauthenticated from %pM (Reason: %u=%s)\n",
bssid, reason_code, bssid, reason_code,
...@@ -3262,7 +3262,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -3262,7 +3262,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
return; return;
if (!ifmgd->associated || if (!ifmgd->associated ||
!ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) !ether_addr_equal(mgmt->bssid, ifmgd->bssid))
return; return;
reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
...@@ -3966,7 +3966,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, ...@@ -3966,7 +3966,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status); ieee80211_rx_bss_info(sdata, mgmt, len, rx_status);
if (ifmgd->associated && if (ifmgd->associated &&
ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) ether_addr_equal(mgmt->bssid, ifmgd->bssid))
ieee80211_reset_ap_probe(sdata); ieee80211_reset_ap_probe(sdata);
} }
...@@ -4197,7 +4197,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -4197,7 +4197,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
if (!ifmgd->associated || if (!ifmgd->associated ||
!ieee80211_rx_our_beacon(bssid, ifmgd->associated)) !ieee80211_rx_our_beacon(bssid, ifmgd->associated))
return; return;
bssid = ifmgd->associated->bssid; bssid = ifmgd->bssid;
if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL))
ieee80211_handle_beacon_sig(sdata, ifmgd, bss_conf, ieee80211_handle_beacon_sig(sdata, ifmgd, bss_conf,
...@@ -4747,7 +4747,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) ...@@ -4747,7 +4747,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
int max_tries; int max_tries;
memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); memcpy(bssid, ifmgd->bssid, ETH_ALEN);
if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
max_tries = max_nullfunc_tries; max_tries = max_nullfunc_tries;
...@@ -4928,7 +4928,7 @@ void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata) ...@@ -4928,7 +4928,7 @@ void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata)
.bssid = bssid, .bssid = bssid,
}; };
memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); memcpy(bssid, ifmgd->bssid, ETH_ALEN);
ieee80211_mgd_deauth(sdata, &req); ieee80211_mgd_deauth(sdata, &req);
} }
...@@ -4950,7 +4950,7 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) ...@@ -4950,7 +4950,7 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME;
mlme_dbg(sdata, "driver requested disconnect after resume\n"); mlme_dbg(sdata, "driver requested disconnect after resume\n");
ieee80211_sta_connection_lost(sdata, ieee80211_sta_connection_lost(sdata,
ifmgd->associated->bssid, ifmgd->bssid,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
true); true);
sdata_unlock(sdata); sdata_unlock(sdata);
...@@ -4961,7 +4961,7 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) ...@@ -4961,7 +4961,7 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART; sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART;
mlme_dbg(sdata, "driver requested disconnect after hardware restart\n"); mlme_dbg(sdata, "driver requested disconnect after hardware restart\n");
ieee80211_sta_connection_lost(sdata, ieee80211_sta_connection_lost(sdata,
ifmgd->associated->bssid, ifmgd->bssid,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
true); true);
sdata_unlock(sdata); sdata_unlock(sdata);
...@@ -5836,7 +5836,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -5836,7 +5836,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
sdata_info(sdata, sdata_info(sdata,
"disconnect from AP %pM for new auth to %pM\n", "disconnect from AP %pM for new auth to %pM\n",
ifmgd->associated->bssid, req->bss->bssid); ifmgd->bssid, req->bss->bssid);
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
false, frame_buf); false, frame_buf);
...@@ -5912,7 +5912,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, ...@@ -5912,7 +5912,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
sdata_info(sdata, sdata_info(sdata,
"disconnect from AP %pM for new assoc to %pM\n", "disconnect from AP %pM for new assoc to %pM\n",
ifmgd->associated->bssid, req->bss->bssid); ifmgd->bssid, req->bss->bssid);
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
false, frame_buf); false, frame_buf);
...@@ -6270,7 +6270,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, ...@@ -6270,7 +6270,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
} }
if (ifmgd->associated && if (ifmgd->associated &&
ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { ether_addr_equal(ifmgd->bssid, req->bssid)) {
sdata_info(sdata, sdata_info(sdata,
"deauthenticating from %pM by local choice (Reason: %u=%s)\n", "deauthenticating from %pM by local choice (Reason: %u=%s)\n",
req->bssid, req->reason_code, req->bssid, req->reason_code,
......
...@@ -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.associated->bssid, memcmp(sdata->u.mgd.bssid,
mgmt->bssid, ETH_ALEN))) mgmt->bssid, ETH_ALEN)))
need_offchan = true; need_offchan = true;
sdata_unlock(sdata); sdata_unlock(sdata);
......
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