Skip to contentSkip to conversation

wifi: mac80211: MLO handling for Dynamic VLAN

PATCH Superseded Muna Sinada 2 participants 6 messages Mar 10, 2025 – Mar 12, 2025 mac80211

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover wifi: mac80211: MLO handling for Dynamic VLAN

Currently for AP_VLAN interfaces that are a part of a MLD master AP, links are not created for the interface. Additionally, mac80211 handles duplicating multicast traffic on each link when a driver/hw is not handling such action.

With the introduction of MLO, there are two areas where additional handling is needed to enable Dynamic VLAN traffic: creating separate links for AP_VLAN interface and enabling mac80211 to send multicast Dynamic VLAN traffic on each link.

4addr mode + MLO is not currently supported.

v3:
- rebase to cleanly apply to wireless-next

v2:
- update Author signoff to new email

Muna Sinada (2):
wifi: mac80211: Create separate links for VLAN interfaces
wifi: mac80211: VLAN traffic in multicast path

 net/mac80211/chan.c        |  3 ++
 net/mac80211/ieee80211_i.h |  3 ++
 net/mac80211/iface.c       | 22 +++++++++-
 net/mac80211/link.c        | 90 ++++++++++++++++++++++++++++++++++++--
 net/mac80211/tx.c          |  6 ++-
 5 files changed, 116 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 wifi: mac80211: Create separate links for VLAN interfaces

Currently, MLD links for an AP_VLAN interface type is not fully supported.

Add allocation of separate links for each VLAN interface and copy chanctx and chandef of AP bss to VLAN where necessary. Separate links are created because for Dynamic VLAN each link will have its own default_multicast_key.

---
v3: rebase to cleanly apply to wireless-next

v2:
- move clearing links for AP_VLAN into seperate function:
ieee80211_apvlan_link_clear()
- remove use of goto
- replaced "master" terminalogy with "AP bss"
- update Author signoff to new email

---
 net/mac80211/chan.c        |  3 ++
 net/mac80211/ieee80211_i.h |  3 ++
 net/mac80211/iface.c       | 22 +++++++++-
 net/mac80211/link.c        | 90 ++++++++++++++++++++++++++++++++++++--
 4 files changed, 112 insertions(+), 6 deletions(-)
net/mac80211/chan.c +3 -0
index c3bfac58151f..3aaf5abf1acc 100644
@@ -2131,6 +2131,9 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link)
 {
 	struct ieee80211_sub_if_data *sdata = link->sdata;
 
+	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+		return;
+
 	lockdep_assert_wiphy(sdata->local->hw.wiphy);
 
 	if (rcu_access_pointer(link->conf->chanctx_conf))
net/mac80211/ieee80211_i.h +3 -0
index 845888ac3d2c..438a418ddf12 100644
@@ -2076,6 +2076,9 @@ static inline void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata
 	ieee80211_vif_set_links(sdata, 0, 0);
 }
 
+void ieee80211_apvlan_link_setup(struct ieee80211_sub_if_data *sdata);
+void ieee80211_apvlan_link_clear(struct ieee80211_sub_if_data *sdata);
+
 /* tx handling */
 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
 void ieee80211_tx_pending(struct tasklet_struct *t);
net/mac80211/iface.c +20 -2
index 33c7c62d19f5..84debd0e4607 100644
@@ -485,6 +485,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
 	case NL80211_IFTYPE_MONITOR:
 		list_del_rcu(&sdata->u.mntr.list);
 		break;
+	case NL80211_IFTYPE_AP_VLAN:
+		ieee80211_apvlan_link_clear(sdata);
+		break;
 	default:
 		break;
 	}
@@ -1232,7 +1235,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 	struct net_device *dev = wdev->netdev;
 	struct ieee80211_local *local = sdata->local;
 	u64 changed = 0;
-	int res;
+	int link_id, res;
 	u32 hw_reconf_flags = 0;
 
 	lockdep_assert_wiphy(local->hw.wiphy);
@@ -1264,6 +1267,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 		sdata->crypto_tx_tailroom_needed_cnt +=
 			master->crypto_tx_tailroom_needed_cnt;
 
+		ieee80211_apvlan_link_setup(sdata);
+
 		break;
 		}
 	case NL80211_IFTYPE_AP:
@@ -1320,7 +1325,20 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 	case NL80211_IFTYPE_AP_VLAN:
 		/* no need to tell driver, but set carrier and chanctx */
 		if (sdata->bss->active) {
-			ieee80211_link_vlan_copy_chanctx(&sdata->deflink);
+			struct ieee80211_link_data *link;
+			unsigned long valid_links = sdata->vif.valid_links;
+
+			if (valid_links) {
+				for_each_set_bit(link_id, &valid_links,
+						 IEEE80211_MLD_MAX_NUM_LINKS) {
+					link = sdata_dereference(sdata->link[link_id],
+								 sdata);
+					ieee80211_link_vlan_copy_chanctx(link);
+				}
+			} else {
+				ieee80211_link_vlan_copy_chanctx(&sdata->deflink);
+			}
+
 			netif_carrier_on(dev);
 			ieee80211_set_vif_encap_ops(sdata);
 		} else {
net/mac80211/link.c +86 -4

122 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [wireless-next v3 1/2] wifi: mac80211: Create separate links for VLAN interfaces

Quoted 8 lines · Muna Sinada
net/mac80211/iface.c +4 -1
 		/* no need to tell driver, but set carrier and chanctx */
 		if (sdata->bss->active) {
-			ieee80211_link_vlan_copy_chanctx(&sdata->deflink);
+			struct ieee80211_link_data *link;
+			unsigned long valid_links = sdata->vif.valid_links;
+
+			if (valid_links) {

net/mac80211/iface.c int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) · line 1341

Quoted 10 lines
net/mac80211/iface.c +10 -0
+				for_each_set_bit(link_id, &valid_links,
+						 IEEE80211_MLD_MAX_NUM_LINKS) {
+					link = sdata_dereference(sdata->link[link_id],
+								 sdata);
+					ieee80211_link_vlan_copy_chanctx(link);
+				}
+			} else {
+				ieee80211_link_vlan_copy_chanctx(&sdata->deflink);
+			}
+

Can this not use for_each_valid_link()? I think for_each_valid_link(&sdata->vif, link_id) should work? If not some new macro? I don't like open-coding this "if (valid_links)" etc. everywhere.

johannes

#3 lore raw

Re: [wireless-next v3 1/2] wifi: mac80211: Create separate links for VLAN interfaces

Quoted 6 lines · Johannes Berg

Can this not use for_each_valid_link()? I think for_each_valid_link(&sdata->vif, link_id) should work? If not some new macro? I don't like open-coding this "if (valid_links)" etc. everywhere.

johannes

for_each_valid_link() is a cfg80211 macro that utilizes wdev to access valid_links and links array. Using this macro with &sdata->vif will not work since, links array located in sdata and is named "link" and valid_links is located inside vif.

Should I will go ahead and define a new macro that is similar but utilizes sdata or should I stick to using for_each_valid_link() and pass in &sdata->wdev.

maintainer
#4 lore raw

Re: [wireless-next v3 1/2] wifi: mac80211: Create separate links for VLAN interfaces

Quoted 10 lines · Muna Sinada
Quoted 6 lines · Johannes Berg

Can this not use for_each_valid_link()? I think for_each_valid_link(&sdata->vif, link_id) should work? If not some new macro? I don't like open-coding this "if (valid_links)" etc. everywhere.

johannes

for_each_valid_link() is a cfg80211 macro that utilizes wdev to access valid_links and links array.

We probably discussed this before, sorry ...

Quoted 3 lines

Using this macro with &sdata->vif
will not work since, links array located in sdata and is named "link" and valid_links is located inside vif.

So valid_links would be fine, but we have links/link naming differences? That's unfortunate. But now that I think about it, also it's array of pointers in vif and array of structs in wdev?

Anyway ...

Quoted 4 lines

Should I will go ahead and define a new macro that is similar but utilizes sdata or should I stick to using for_each_valid_link() and pass in &sdata->wdev.

We already have for_each_vif_active_link() so maybe add for_each_vif_valid_link()? Though honestly in this case you could as well just use for_each_vif_active_link(), it's basically the same in AP?

johannes

#5 lore raw

PATCH v3 2/2 wifi: mac80211: VLAN traffic in multicast path

In reply to Muna Sinada

Currently for MLO, sending out multicast frames on each link is handled by mac80211 only when IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX flag is not set.

Dynamic VLAN multicast traffic utilizes software encryption. Due to this, mac80211 should handle transmitting multicast frames on all links for multicast VLAN traffic.

---
v3: rebase to cleanly apply to wireless-next

v2:
- move clearing links for AP_VLAN into seperate function:
ieee80211_apvlan_link_clear()
- remove use of goto
- replaced "master" terminalogy with "AP bss"
- update Author signoff to new email

---
 net/mac80211/tx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/tx.c +4 -2
index 20179db88c4a..b6d6d0658e14 100644
@@ -4526,8 +4526,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 						     IEEE80211_TX_CTRL_MLO_LINK_UNSPEC,
 						     NULL);
 	} else if (ieee80211_vif_is_mld(&sdata->vif) &&
-		   sdata->vif.type == NL80211_IFTYPE_AP &&
-		   !ieee80211_hw_check(&sdata->local->hw, MLO_MCAST_MULTI_LINK_TX)) {
+		   ((sdata->vif.type == NL80211_IFTYPE_AP &&
+		     !ieee80211_hw_check(&sdata->local->hw, MLO_MCAST_MULTI_LINK_TX)) ||
+		    ((sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
+		     !sdata->wdev.use_4addr))) {
 		ieee80211_mlo_multicast_tx(dev, skb);
 	} else {
 normal:
Signature · 1 line
2.34.1