summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael-CY Lee <michael-cy.lee@mediatek.com>2025-07-21 14:29:29 +0800
committerJohannes Berg <johannes.berg@intel.com>2025-07-21 19:39:43 +0200
commit4970e393eb5d1aed10119532abe36e07f27eec7f (patch)
treec5d1ec364c046a7c1ae9dfecac969958c4c179ac
parentc639a44ac6c2624f983bbe36483166a4b3afb371 (diff)
wifi: mac80211: determine missing link_id in ieee80211_rx_for_interface() based on frequency
For broadcast frames, every interface might have to process it and therefore the link_id cannot be determined in the driver. In mac80211, when the frame is about to be forwarded to each interface, we can use the member "freq" in struct ieee80211_rx_status to determine the "link_id" for each interface. Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> Reviewed-by: Money Wang <money.wang@mediatek.com> Link: https://patch.msgid.link/20250721062929.1662700-1-michael-cy.lee@mediatek.com [simplify, remove unnecessary link->conf check] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/rx.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b414c9e6e61b..576e399fc99c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5106,8 +5106,24 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx,
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
sta = sta_info_get_bss(rx->sdata, hdr->addr2);
- if (status->link_valid)
+ if (status->link_valid) {
link_id = status->link_id;
+ } else if (ieee80211_vif_is_mld(&rx->sdata->vif) &&
+ status->freq) {
+ struct ieee80211_link_data *link;
+ struct ieee80211_chanctx_conf *conf;
+
+ for_each_link_data_rcu(rx->sdata, link) {
+ conf = rcu_dereference(link->conf->chanctx_conf);
+ if (!conf || !conf->def.chan)
+ continue;
+
+ if (status->freq == conf->def.chan->center_freq) {
+ link_id = link->link_id;
+ break;
+ }
+ }
+ }
}
if (!ieee80211_rx_data_set_sta(rx, sta, link_id))