From 8a9be422f5ff34ec7abec289c6fe862d9e7864d2 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 15 Jul 2022 15:37:23 +0200 Subject: [PATCH] wifi: mac80211: tx: use AP address in some places for MLO In a few places we need to use the AP (MLD) address, not the deflink BSSID, the link address translation will happen later. To make that work properly for fast-xmit, set up the ap_addr in the vif.cfg earlier. Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 6 ++++-- net/mac80211/tx.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 912095e4e256c0..ee1a72519c15f1 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2743,8 +2743,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, changed[link_id] |= ieee80211_link_set_associated(link, cbss); } - memcpy(sdata->vif.cfg.ap_addr, assoc_data->ap_addr, ETH_ALEN); - /* just to be sure */ ieee80211_stop_poll(sdata); @@ -4893,6 +4891,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, sta->sta.wme = (elems->wmm_param || elems->s1g_capab) && local->hw.queues >= IEEE80211_NUM_ACS; + /* needed for fast-xmit setup in sta_info_move_state() */ + memcpy(sdata->vif.cfg.ap_addr, assoc_data->ap_addr, ETH_ALEN); + err = sta_info_move_state(sta, IEEE80211_STA_ASSOC); if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); @@ -4927,6 +4928,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, return true; out_err: + eth_zero_addr(sdata->vif.cfg.ap_addr); mutex_unlock(&sdata->local->sta_mtx); return false; } diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 34dae26646a691..cded1b207b73a1 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2735,7 +2735,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, } else { fc |= cpu_to_le16(IEEE80211_FCTL_TODS); /* BSSID SA DA */ - memcpy(hdr.addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); + memcpy(hdr.addr1, sdata->vif.cfg.ap_addr, ETH_ALEN); memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); memcpy(hdr.addr3, skb->data, ETH_ALEN); hdrlen = 24; @@ -3023,7 +3023,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) } fc |= cpu_to_le16(IEEE80211_FCTL_TODS); /* BSSID SA DA */ - memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); + memcpy(hdr->addr1, sdata->vif.cfg.ap_addr, ETH_ALEN); build.da_offs = offsetof(struct ieee80211_hdr, addr3); build.sa_offs = offsetof(struct ieee80211_hdr, addr2); build.hdr_len = 24; @@ -3250,7 +3250,7 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: - bssid = sdata->deflink.u.mgd.bssid; + bssid = sdata->vif.cfg.ap_addr; break; case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: