diff mbox series

[v2] wifi: mac80211: handle link ID during management Tx

Message ID 20240410052705.169865-1-quic_adisi@quicinc.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series [v2] wifi: mac80211: handle link ID during management Tx | expand

Commit Message

Aditya Kumar Singh April 10, 2024, 5:27 a.m. UTC
From: Sriram R <quic_srirrama@quicinc.com>

During management Tx, when source address is same as one of the link conf's
address and even when userspace requested Tx on a specific link, link ID
is not set. Now if MLD address is also same as that of the link address,
then mac80211 fills link as unspecified. Due to this, later in driver, the
channel context is fetched from vif->bss_conf instead of link's conf which
in turn gives channel as NULL and hence as a result, the packet is
ultimately dropped.

Add changes to use the same link id and set it if the link bss is matching
the requested channel. This will prevent the packet from getting dropped.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
v2: rephrased commit message to describe how packet is getting dropped.

---
 net/mac80211/offchannel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)


base-commit: a35b36e6ee5dcf323d846ec3881159e4af90c9b4
diff mbox series

Patch

diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 221695d841fd..65e1e9e971fd 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -897,8 +897,18 @@  int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 				break;
 			}
 
-			if (ether_addr_equal(conf->addr, mgmt->sa))
+			if (ether_addr_equal(conf->addr, mgmt->sa)) {
+				/* If userspace requested Tx on a specific link
+				 * use the same link id if the link bss is matching
+				 * the requested chan.
+				 */
+				if (sdata->vif.valid_links &&
+				    params->link_id >= 0 && params->link_id == i &&
+				    params->chan == chanctx_conf->def.chan)
+					link_id = i;
+
 				break;
+			}
 
 			chanctx_conf = NULL;
 		}