Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael-CY Lee and committed by
Johannes Berg
4970e393 c639a44a

+17 -1
+17 -1
net/mac80211/rx.c
··· 5106 5106 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 5107 5107 5108 5108 sta = sta_info_get_bss(rx->sdata, hdr->addr2); 5109 - if (status->link_valid) 5109 + if (status->link_valid) { 5110 5110 link_id = status->link_id; 5111 + } else if (ieee80211_vif_is_mld(&rx->sdata->vif) && 5112 + status->freq) { 5113 + struct ieee80211_link_data *link; 5114 + struct ieee80211_chanctx_conf *conf; 5115 + 5116 + for_each_link_data_rcu(rx->sdata, link) { 5117 + conf = rcu_dereference(link->conf->chanctx_conf); 5118 + if (!conf || !conf->def.chan) 5119 + continue; 5120 + 5121 + if (status->freq == conf->def.chan->center_freq) { 5122 + link_id = link->link_id; 5123 + break; 5124 + } 5125 + } 5126 + } 5111 5127 } 5112 5128 5113 5129 if (!ieee80211_rx_data_set_sta(rx, sta, link_id))