Skip to contentSkip to conversation

MBSS sharing across multiple interfaces

RFC In review Thomas Pedersen 4 participants 29 messages May 3, 2013 – May 29, 2013 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover MBSS sharing across multiple interfaces

This patchset enables multiple interfaces on the same host to share mesh path selection and frame forwarding duties. The peering state machine remains per-interface.

The user interface looks something like:

iw wlan0 mesh join foo shared on
iw wlan1 mesh join foo shared on

As long as wlan0 and wlan1 have a matching mesh setup profile, they will be considered part of the same MBSS.

This approach is superior to simple 802.1d briding, since mac80211 can dynamically pick the better link instead of simply disabling an entire port. The added link knowledge also enables bonding and alternation in the future.

Bob Copeland (6):
mac80211: track and share mesh BSSes among interfaces
mac80211: mesh: add function to tx on all other mbss ifaces
mac80211: use all MBSS interfaces for path selection
mac80211: forward group frames on mbss-shared interfaces
mac80211: add shared-mbss transmit path
mac08211: add shared-mbss receive path handling

Thomas Pedersen (6):
mac80211: assign outgoing interface with nexthop
mac80211: forward frames on correct mbss-shared interface
mac80211: notify bridge when leaving mesh
mac80211: make RMC per-mbss
{nl,mac}80211: specify MBSS sharing on/off {nl,mac}80211: allow mpath dump to span local MBSS

 include/net/cfg80211.h       |    8 +-
 include/uapi/linux/nl80211.h |   12 +-
 net/mac80211/cfg.c           |   17 +--
 net/mac80211/ieee80211_i.h   |   37 +++++-
 net/mac80211/iface.c         |    3 -
 net/mac80211/mesh.c          |  276 +++++++++++++++++++++++++++++++++++++++---
 net/mac80211/mesh.h          |   24 ++--
 net/mac80211/mesh_hwmp.c     |  133 ++++++++++++++------
 net/mac80211/mesh_pathtbl.c  |   68 +++++++----
 net/mac80211/rx.c            |  110 +++++++++++++----
 net/mac80211/tx.c            |    8 +-
 net/wireless/mesh.c          |    1 +
 net/wireless/nl80211.c       |   21 +++-
 net/wireless/rdev-ops.h      |   10 +-
 14 files changed, 599 insertions(+), 129 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

RFC 1/12 mac80211: track and share mesh BSSes among interfaces

From: Bob Copeland <[email protected]>

Add a new global list of mesh BSSes for this host. Each struct mesh_local_bss contains parameters specific to a mesh instance, as well as a list of interfaces participating in the MBSS. This will enable lookup of other interfaces on the host participating in the same mesh.

---
 net/mac80211/ieee80211_i.h |   33 +++++++++
 net/mac80211/mesh.c        |  172 ++++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/mesh.h        |    4 ++
 3 files changed, 209 insertions(+)
net/mac80211/ieee80211_i.h +33 -0
index 44be28c..da7fbd4 100644
@@ -285,6 +285,35 @@ struct mesh_stats {
 	__u32 dropped_frames_congestion;/* Not forwarded due to congestion */
 };
 
+/**
+ * mesh_local_bss - a mesh BSS running on this host
+ *
+ * @mesh_id: the mesh id
+ * @mesh_id_len: size of mesh id in bytes
+ * @sync_method: which synchronization method to use
+ * @path_sel_proto: which path selection protocol to use
+ * @path_metric: which metric to use
+ * @is_secure: true if the mesh is secure
+ * @can_share: true if this bss can be shared (user-configurable per-if)
+ * @net: network namespace devices in this mbss belong to
+ * @list: listptr for siblings in mesh_bss_list
+ * @if_list: interfaces sharing this bss
+ */
+struct mesh_local_bss {
+	u8 mesh_id[IEEE80211_MAX_SSID_LEN];
+	u8 mesh_id_len;
+	u8 sync_method;
+	u8 path_sel_proto;
+	u8 path_metric;
+	bool is_secure;
+
+	bool can_share;
+	struct net *net;
+
+	struct list_head list;
+	struct list_head if_list;
+};
+
 #define PREQ_Q_F_START		0x1
 #define PREQ_Q_F_REFRESH	0x2
 struct mesh_preq_queue {
@@ -600,6 +629,10 @@ struct ieee80211_if_mesh {
 	int ps_peers_light_sleep;
 	int ps_peers_deep_sleep;
 	struct ps_data ps;
+
+	/* mbss sharing */
+	struct mesh_local_bss *mesh_bss;
+	struct list_head if_list;
 };
 
 #ifdef CONFIG_MAC80211_MESH
net/mac80211/mesh.c +172 -0

202 lines not on this page · raw message

net/mac80211/mesh.h +4 -0
index da15877..f23b58f 100644
@@ -361,6 +361,10 @@ void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
 void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
 void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
 void ieee80211s_stop(void);
+struct ieee80211_sub_if_data *
+mesh_bss_find_if(struct mesh_local_bss *mbss, const u8 *addr);
+bool mesh_bss_matches_addr(struct mesh_local_bss *mbss, const u8 *addr);
+#define mbss(sdata) (sdata->u.mesh.mesh_bss)
 #else
 static inline void
 ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
Signature · 1 line
1.7.10.4
maintainer
#2 lore raw

Re: [RFC 01/12] mac80211: track and share mesh BSSes among interfaces

Ok this is big ... Let me tackle it patch by patch I guess :-)

net/mac80211/ieee80211_i.h struct mesh_stats { · line 310

Quoted 3 lines
net/mac80211/ieee80211_i.h +2 -0
+struct mesh_local_bss {
 
+	bool can_share;

Does that even make sense? I mean, wouldn't you simply not link/create such an entry if the given vif can't share?

net/mac80211/mesh.c void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · line 990

Quoted 6 lines
net/mac80211/mesh.c +2 -0
@@ -818,6 +986,10 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
 	local->fif_other_bss--;
 	atomic_dec(&local->iff_allmultis);
 	ieee80211_configure_filter(local);
+
+	netif_tx_stop_all_queues(sdata->dev);

how is that related to this patch?

johannes

#3 lore raw

Re: [RFC 01/12] mac80211: track and share mesh BSSes among interfaces

Quoted 8 lines · Johannes Berg

Ok this is big ... Let me tackle it patch by patch I guess :-)

net/mac80211/ieee80211_i.h struct mesh_stats { · line 310

Quoted 3 lines
net/mac80211/ieee80211_i.h +2 -0
+struct mesh_local_bss {
 
+	bool can_share;

Does that even make sense? I mean, wouldn't you simply not link/create such an entry if the given vif can't share?

We could do that, but as written mpath table now wants an mbss pointer in either case. Seemed more straight-forward to just always require it even though the structures are kind of pointless for unshared vifs.

Quoted 8 lines

net/mac80211/mesh.c void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · line 990

Quoted 6 lines
net/mac80211/mesh.c +2 -0
@@ -818,6 +986,10 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
 	local->fif_other_bss--;
 	atomic_dec(&local->iff_allmultis);
 	ieee80211_configure_filter(local);
+
+	netif_tx_stop_all_queues(sdata->dev);

how is that related to this patch?

Intent was to be sure pending queue doesn't run while we're taking out this interface (since another interface may be queueing frames here), but that can't actually happen until a later patch. So maybe it should be split out or moved later.

The stop path should be revisited anyway, there's some duplication in what ieee80211_do_stop() does and this, which is really about when stop_mesh() gets called and when mbss gets freed.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
maintainer
#4 lore raw

Re: [RFC 01/12] mac80211: track and share mesh BSSes among interfaces

Quoted 5 lines · Bob Copeland
Quoted 4 lines · Johannes Berg

Ok this is big ... Let me tackle it patch by patch I guess :-)

Quoted 1 line

+struct mesh_local_bss {

Quoted 8 lines
Quoted 4 lines

net/mac80211/ieee80211_i.h struct mesh_stats { · line 310

Quoted 1 line
net/mac80211/ieee80211_i.h +1 -0
+	bool can_share;

Does that even make sense? I mean, wouldn't you simply not link/create such an entry if the given vif can't share?

We could do that, but as written mpath table now wants an mbss pointer in either case. Seemed more straight-forward to just always require it even though the structures are kind of pointless for unshared vifs.

But why even add it to the global list if you only need it locally?

Anyway I guess it doesn't matter, just seemed a bit odd.

johannes

#5 lore raw

Re: [RFC 01/12] mac80211: track and share mesh BSSes among interfaces

Quoted 1 line · Johannes Berg

But why even add it to the global list if you only need it locally?

Gotcha - agreed, makes sense to not do so and drop the can_share bit.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#6 lore raw

RFC 2/12 mac80211: mesh: add function to tx on all other mbss ifaces

In reply to Thomas Pedersen

From: Bob Copeland <[email protected]>

Add a function to rebroadcast mcast/bcast frames on other interfaces when multiple interfaces are shared in an mbss.

---
 net/mac80211/mesh.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/mesh.h |    4 ++++
 2 files changed, 47 insertions(+)
net/mac80211/mesh.c +43 -0
index 5ea4812..eac9988 100644
@@ -11,6 +11,7 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 #include "ieee80211_i.h"
+#include "wme.h"
 #include "mesh.h"
 
 static int mesh_allocated;
@@ -202,6 +203,48 @@ bool mesh_bss_matches_addr(struct mesh_local_bss *mbss, const u8 *addr)
 }
 
 /**
+ * mesh_bss_forward_tx - send a frame on all other interfaces in a bss
+ *
+ * @sdata: interface to exclude from tx
+ * @skb: frame to send
+ *
+ * Forwards group-directed frames from sdata for tx on all other interfaces
+ * which are participating in an mbss.
+ */
+void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata,
+			 struct sk_buff *skb)
+{
+	struct mesh_local_bss *mbss = mbss(sdata);
+	struct ieee80211_hdr *fwd_hdr;
+	struct sk_buff *fwd_skb;
+	struct ieee80211_tx_info *info;
+	struct ieee80211_sub_if_data *tmp_sdata;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(tmp_sdata, &mbss->if_list, u.mesh.if_list) {
+
+		if (sdata == tmp_sdata)
+			continue;
+
+		fwd_skb = skb_copy(skb, GFP_ATOMIC);
+		if (!fwd_skb)
+			goto out;
+
+		fwd_hdr =  (struct ieee80211_hdr *) fwd_skb->data;
+		info = IEEE80211_SKB_CB(fwd_skb);
+		memset(info, 0, sizeof(*info));
+		info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
+		info->control.vif = &tmp_sdata->vif;
+
+		memcpy(fwd_hdr->addr2, tmp_sdata->vif.addr, ETH_ALEN);
+		ieee80211_set_qos_hdr(tmp_sdata, fwd_skb);
+		ieee80211_add_pending_skb(tmp_sdata->local, fwd_skb);
+	}
+out:
+	rcu_read_unlock();
+}
+
+/**
  * mesh_matches_local - check if the config of a mesh point matches ours
  *
  * @sdata: local mesh subif
net/mac80211/mesh.h +4 -0
index f23b58f..4a1a15e 100644
@@ -361,6 +361,8 @@ void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
 void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
 void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
 void ieee80211s_stop(void);
+void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata,
+			 struct sk_buff *skb);
 struct ieee80211_sub_if_data *
 mesh_bss_find_if(struct mesh_local_bss *mbss, const u8 *addr);
 bool mesh_bss_matches_addr(struct mesh_local_bss *mbss, const u8 *addr);
@@ -373,6 +375,8 @@ static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
 static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
 {}
 static inline void ieee80211s_stop(void) {}
+static inline void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata,
+				       struct sk_buff *skb) {}
 #endif
 
 #endif /* IEEE80211S_H */
Signature · 1 line
1.7.10.4
#7 lore raw

RFC 3/12 mac80211: use all MBSS interfaces for path selection

In reply to Thomas Pedersen

From: Bob Copeland <[email protected]>

Change the HWMP path selection code to establish paths using all interfaces participating in a shared mbss. This means that group-addressed action frames like PREQ will go out on each interface, while individually addressed frames use whichever interface has the destination as a peer.

When processing received frames, consider it a match if any local interface in the mbss matches the target address.

Finally, mesh_path_lookup() now scans the path table on each interface until a path (if any) is found so that paths can be shared among the interfaces.

[ PERR/unicast frame handling fixes from Thomas Pedersen ]

---
 net/mac80211/cfg.c          |    8 +--
 net/mac80211/mesh.h         |    6 +--
 net/mac80211/mesh_hwmp.c    |  121 ++++++++++++++++++++++++++++++-------------
 net/mac80211/mesh_pathtbl.c |   47 +++++++++++------
 net/mac80211/rx.c           |    5 +-
 net/mac80211/tx.c           |    5 +-
 6 files changed, 128 insertions(+), 64 deletions(-)
net/mac80211/cfg.c +4 -4
index 1f51bdf..76e9575 100644
@@ -1605,8 +1605,8 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
 		return -ENOENT;
 	}
 
-	mpath = mesh_path_lookup(sdata, dst);
-	if (!mpath) {
+	mpath = mesh_path_lookup(mbss(sdata), dst);
+	if (!mpath || mpath->sdata != sdata) {
 		rcu_read_unlock();
 		return -ENOENT;
 	}
@@ -1669,8 +1669,8 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	rcu_read_lock();
-	mpath = mesh_path_lookup(sdata, dst);
-	if (!mpath) {
+	mpath = mesh_path_lookup(mbss(sdata), dst);
+	if (!mpath || mpath->sdata != sdata) {
 		rcu_read_unlock();
 		return -ENOENT;
 	}
net/mac80211/mesh.h +3 -3
index 4a1a15e..2f83e8c 100644
@@ -258,14 +258,14 @@ void ieee80211_mps_frame_release(struct sta_info *sta,
 				 struct ieee802_11_elems *elems);
 
 /* Mesh paths */
-int mesh_nexthop_lookup(struct ieee80211_sub_if_data *sdata,
+int mesh_nexthop_lookup(struct mesh_local_bss *mbss,
 			struct sk_buff *skb);
 int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
 			 struct sk_buff *skb);
 void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata);
-struct mesh_path *mesh_path_lookup(struct ieee80211_sub_if_data *sdata,
+struct mesh_path *mesh_path_lookup(struct mesh_local_bss *mbss,
 				   const u8 *dst);
-struct mesh_path *mpp_path_lookup(struct ieee80211_sub_if_data *sdata,
+struct mesh_path *mpp_path_lookup(struct mesh_local_bss *mbss,
 				  const u8 *dst);
 int mpp_path_add(struct ieee80211_sub_if_data *sdata,
 		 const u8 *dst, const u8 *mpp);
net/mac80211/mesh_hwmp.c +84 -37

294 lines not on this page · raw message

net/mac80211/mesh_pathtbl.c +31 -16

109 lines not on this page · raw message

net/mac80211/rx.c +3 -2
index 22e412b..4e7886d 100644
@@ -2006,6 +2006,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	struct sk_buff *skb = rx->skb, *fwd_skb;
 	struct ieee80211_local *local = rx->local;
 	struct ieee80211_sub_if_data *sdata = rx->sdata;
+	struct mesh_local_bss *mbss = mbss(sdata);
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
 	__le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD);
@@ -2059,7 +2060,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		}
 
 		rcu_read_lock();
-		mppath = mpp_path_lookup(sdata, proxied_addr);
+		mppath = mpp_path_lookup(mbss, proxied_addr);
 		if (!mppath) {
 			mpp_path_add(sdata, proxied_addr, mpp_addr);
 		} else {
@@ -2110,7 +2111,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
 		/* update power mode indication when forwarding */
 		ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr);
-	} else if (!mesh_nexthop_lookup(sdata, fwd_skb)) {
+	} else if (!mesh_nexthop_lookup(mbss, fwd_skb)) {
 		/* mesh power mode flags updated in mesh_nexthop_lookup */
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
 	} else {
net/mac80211/tx.c +3 -2
index 4a5fbf8..c132c76 100644
@@ -1799,7 +1799,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 			struct sta_info *next_hop;
 			bool mpp_lookup = true;
 
-			mpath = mesh_path_lookup(sdata, skb->data);
+			mpath = mesh_path_lookup(mbss(sdata), skb->data);
 			if (mpath) {
 				mpp_lookup = false;
 				next_hop = rcu_dereference(mpath->next_hop);
@@ -1810,7 +1810,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 			}
 
 			if (mpp_lookup)
-				mppath = mpp_path_lookup(sdata, skb->data);
+				mppath = mpp_path_lookup(mbss(sdata),
+							 skb->data);
 
 			if (mppath && mpath)
 				mesh_path_del(mpath->sdata, mpath->dst);
Signature · 1 line
1.7.10.4
maintainer
#8 lore raw

Re: [RFC 03/12] mac80211: use all MBSS interfaces for path selection

Quoted 8 lines · Thomas Pedersen

/**
- * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling
- * this function is considered "using" the associated mpath, so preempt a path
- * refresh if this mpath expires soon.
+ * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame and
+ * insert the correct outgoing interface on the skb cb. Calling this function
+ * is considered "using" the associated mpath, so preempt a path refresh if
+ * this mpath expires soon.

This is of course completely bogus kernel-doc :)

johannes

#9 lore raw

Re: [RFC 03/12] mac80211: use all MBSS interfaces for path selection

Quoted 7 lines · Johannes Berg
Quoted 5 lines

/**
+ * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame and
+ * insert the correct outgoing interface on the skb cb. Calling this function
+ * is considered "using" the associated mpath, so preempt a path refresh if
+ * this mpath expires soon.

This is of course completely bogus kernel-doc :)

Ack, thanks.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#10 lore raw

RFC 4/12 mac80211: assign outgoing interface with nexthop

In reply to Thomas Pedersen

When updated mpath routing info is found, the new route may be on a different interface (in the case of MBSS sharing).

---
 net/mac80211/mesh_pathtbl.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
net/mac80211/mesh_pathtbl.c +10 -3
index 993a270..7df8f27 100644
@@ -195,27 +195,34 @@ static u32 mesh_table_hash(struct mesh_local_bss *mbss, const u8 *addr,
 
 /**
  *
- * mesh_path_assign_nexthop - update mesh path next hop
+ * mesh_path_assign_nexthop - update mesh path info
  *
  * @mpath: mesh path to update
  * @sta: next hop to assign
  *
+ * Updates queued frames and outgoing interface.
+ *
  * Locking: mpath->state_lock must be held when calling this function
  */
 void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta)
 {
+	struct ieee80211_sub_if_data *sdata = sta->sdata;
+	struct ieee80211_tx_info *info;
 	struct sk_buff *skb;
 	struct ieee80211_hdr *hdr;
 	unsigned long flags;
 
 	rcu_assign_pointer(mpath->next_hop, sta);
+	mpath->sdata = sdata;
 
 	spin_lock_irqsave(&mpath->frame_queue.lock, flags);
 	skb_queue_walk(&mpath->frame_queue, skb) {
+		info = IEEE80211_SKB_CB(skb);
 		hdr = (struct ieee80211_hdr *) skb->data;
 		memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
-		memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN);
-		ieee80211_mps_set_frame_flags(sta->sdata, sta, hdr);
+		memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
+		info->control.vif = &sdata->vif;
+		ieee80211_mps_set_frame_flags(sdata, sta, hdr);
 	}
 
 	spin_unlock_irqrestore(&mpath->frame_queue.lock, flags);
Signature · 1 line
1.7.10.4
#11 lore raw

RFC 5/12 mac80211: forward frames on correct mbss-shared interface

In reply to Thomas Pedersen

A forwarded frame may have a destination STA which resides on a vif other than the RX interface. Have mesh_nexthop_lookup() fill in the right outgoing sdata in the skb control block.

Also update the congestion detection logic to take into account a possibly different outgoing interface.

---
 net/mac80211/rx.c |   47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)
net/mac80211/rx.c +32 -15
index 4e7886d..d86f0df 100644
@@ -2077,13 +2077,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	    ether_addr_equal(sdata->vif.addr, hdr->addr3))
 		return RX_CONTINUE;
 
-	q = ieee80211_select_queue_80211(sdata, skb, hdr);
-	if (ieee80211_queue_stopped(&local->hw, q)) {
-		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
-		return RX_DROP_MONITOR;
-	}
-	skb_set_queue_mapping(skb, q);
-
 	if (!--mesh_hdr->ttl) {
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
 		goto out;
@@ -2106,21 +2099,45 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
 	info->control.vif = &rx->sdata->vif;
 	info->control.jiffies = jiffies;
+
+	/* unicast frame may go out on a different HW, so resolve now */
+	if (!is_multicast_ether_addr(fwd_hdr->addr1)) {
+		if (!mesh_nexthop_lookup(mbss, fwd_skb))
+			/* next hop may be on a different interface */
+			local = vif_to_sdata(info->control.vif)->local;
+		else {
+			/* unable to resolve next hop */
+			mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl,
+					   fwd_hdr->addr3, 0, reason,
+					   fwd_hdr->addr2);
+			IEEE80211_IFSTA_MESH_CTR_INC(ifmsh,
+						     dropped_frames_no_route);
+			kfree_skb(fwd_skb);
+			return RX_DROP_MONITOR;
+	       }
+	}
+
+	/*
+	 * note: ifmsh still points to RX iface (for forwarded frame
+	 * statistics), while local is sending HW
+	 */
+	q = ieee80211_select_queue_80211(vif_to_sdata(info->control.vif),
+					 fwd_skb, fwd_hdr);
+	if (ieee80211_queue_stopped(&local->hw, q)) {
+		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
+		kfree_skb(fwd_skb);
+		return RX_DROP_MONITOR;
+	}
+	skb_set_queue_mapping(fwd_skb, q);
+
 	if (is_multicast_ether_addr(fwd_hdr->addr1)) {
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
 		memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
 		/* update power mode indication when forwarding */
 		ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr);
-	} else if (!mesh_nexthop_lookup(mbss, fwd_skb)) {
+	} else {
 		/* mesh power mode flags updated in mesh_nexthop_lookup */
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
-	} else {
-		/* unable to resolve next hop */
-		mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl,
-				   fwd_hdr->addr3, 0, reason, fwd_hdr->addr2);
-		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route);
-		kfree_skb(fwd_skb);
-		return RX_DROP_MONITOR;
 	}
 
 	IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
Signature · 1 line
1.7.10.4
#12 lore raw

RFC 6/12 mac80211: notify bridge when leaving mesh

In reply to Thomas Pedersen

After turning carrier off, any parent bridge interface needs to be notified. Otherwise we would see a panic when attempting to transmit frames on a mesh interface which hadn't yet been put down.

---
 net/mac80211/mesh.c |    3 +++
 1 file changed, 3 insertions(+)
net/mac80211/mesh.c +3 -0
index eac9988..271ddc9 100644
@@ -993,6 +993,9 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
 	struct beacon_data *bcn;
 
 	netif_carrier_off(sdata->dev);
+	if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+		/* stop bridge transmissions */
+		call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);
 
 	/* stop the beacon */
 	ifmsh->mesh_id_len = 0;
Signature · 1 line
1.7.10.4
maintainer
#13 lore raw

Re: [RFC 06/12] mac80211: notify bridge when leaving mesh

Quoted 15 lines · Thomas Pedersen

After turning carrier off, any parent bridge interface needs to be notified. Otherwise we would see a panic when attempting to transmit frames on a mesh interface which hadn't yet been put down.

---
 net/mac80211/mesh.c |    3 +++
 1 file changed, 3 insertions(+)
net/mac80211/mesh.c +0 -0
index eac9988..271ddc9 100644

net/mac80211/mesh.c void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · line 998

Quoted 6 lines
net/mac80211/mesh.c +3 -0
@@ -993,6 +993,9 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
 	struct beacon_data *bcn;
 
 	netif_carrier_off(sdata->dev);
+	if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+		/* stop bridge transmissions */
+		call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);

Err, this seems like a really bad hack? I don't really think drivers should call that?

johannes

#14 lore raw

Re: [RFC 06/12] mac80211: notify bridge when leaving mesh

Hey, Sorry for the late response.

Quoted 18 lines · Johannes Berg
Quoted 17 lines · Thomas Pedersen

After turning carrier off, any parent bridge interface needs to be notified. Otherwise we would see a panic when attempting to transmit frames on a mesh interface which hadn't yet been put down.

---
 net/mac80211/mesh.c |    3 +++
 1 file changed, 3 insertions(+)
net/mac80211/mesh.c +0 -0
index eac9988..271ddc9 100644
@@ -993,6 +993,9 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
      struct beacon_data *bcn;
 
Quoted 7 lines

net/mac80211/mesh.c void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · line 998

Quoted 4 lines
net/mac80211/mesh.c +3 -0
      netif_carrier_off(sdata->dev);
+     if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+             /* stop bridge transmissions */
+             call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);

Err, this seems like a really bad hack? I don't really think drivers should call that?

Why not? We're just notifying the bridge interface that this port has gone down, to avoid dereferencing a null pointer (on bridge flood traffic) after the mesh_bss has been removed.

Is cfg80211_leave_mesh() an acceptable location for this fix?

--
Thomas

maintainer
#15 lore raw

Re: [RFC 06/12] mac80211: notify bridge when leaving mesh

Quoted 1 line · Thomas Pedersen

Hey, Sorry for the late response.

Me too :)

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
      netif_carrier_off(sdata->dev);
net/mac80211/mesh.c +3 -0
+     if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+             /* stop bridge transmissions */
+             call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);
Quoted 8 lines
Quoted 2 lines

Err, this seems like a really bad hack? I don't really think drivers should call that?

Why not? We're just notifying the bridge interface that this port has gone down, to avoid dereferencing a null pointer (on bridge flood traffic) after the mesh_bss has been removed.

Is cfg80211_leave_mesh() an acceptable location for this fix?

I'm not really convinced it's an acceptable fix in itself? Why should we ever have to call netdev notifiers, that seems odd to me. Also why would that prevent a crash? Wouldn't we just drop packets for the mesh if we aren't joined in a mesh any more? Or something like that? Accessing the priv flags and then calling the netdev notifiers seems really strange to me. If this was necessary, then wouldn't netif_carrier_off() do it internally?

johannes

#16 lore raw

Re: [RFC 06/12] mac80211: notify bridge when leaving mesh

Quoted 19 lines · Johannes Berg
Quoted 1 line · Thomas Pedersen

Hey, Sorry for the late response.

Me too :)

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
      netif_carrier_off(sdata->dev);
net/mac80211/mesh.c +3 -0
+     if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+             /* stop bridge transmissions */
+             call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);
Quoted 8 lines
Quoted 2 lines

Err, this seems like a really bad hack? I don't really think drivers should call that?

Why not? We're just notifying the bridge interface that this port has gone down, to avoid dereferencing a null pointer (on bridge flood traffic) after the mesh_bss has been removed.

Is cfg80211_leave_mesh() an acceptable location for this fix?

Quoted 7 lines

I'm not really convinced it's an acceptable fix in itself? Why should we ever have to call netdev notifiers, that seems odd to me. Also why would that prevent a crash? Wouldn't we just drop packets for the mesh if we aren't joined in a mesh any more? Or something like that Accessing the priv flags and then calling the netdev notifiers seems really strange to me. If this was necessary, then wouldn't netif_carrier_off() do it internally?

OK I'll take a look at this and figure out a cleaner solution then. Thanks.

--
Thomas

#17 lore raw

Re: [RFC 06/12] mac80211: notify bridge when leaving mesh

Quoted 29 lines · Thomas Pedersen
Quoted 19 lines · Johannes Berg
Quoted 1 line · Thomas Pedersen

Hey, Sorry for the late response.

Me too :)

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
      netif_carrier_off(sdata->dev);
net/mac80211/mesh.c +3 -0
+     if (sdata->dev->priv_flags & IFF_BRIDGE_PORT)
+             /* stop bridge transmissions */
+             call_netdevice_notifiers(NETDEV_CHANGE, sdata->dev);
Quoted 8 lines
Quoted 2 lines

Err, this seems like a really bad hack? I don't really think drivers should call that?

Why not? We're just notifying the bridge interface that this port has gone down, to avoid dereferencing a null pointer (on bridge flood traffic) after the mesh_bss has been removed.

Is cfg80211_leave_mesh() an acceptable location for this fix?

Quoted 7 lines

I'm not really convinced it's an acceptable fix in itself? Why should we ever have to call netdev notifiers, that seems odd to me. Also why would that prevent a crash? Wouldn't we just drop packets for the mesh if we aren't joined in a mesh any more? Or something like that Accessing the priv flags and then calling the netdev notifiers seems really strange to me. If this was necessary, then wouldn't netif_carrier_off() do it internally?

Quoted 1 line

OK I'll take a look at this and figure out a cleaner solution then. Thanks.

After reverting this patch I can no longer trigger the crash it was supposed to fix. Either something changed in the rebase, or it was never needed. Will drop from the resubmission for now.

Thanks,
--
Thomas

#18 lore raw

RFC 7/12 mac80211: make RMC per-mbss

In reply to Thomas Pedersen

The RMC was previously per-sdata, but it is sufficient for one of the interfaces in a local mbss to receive a multicast frame once.

Once multiple interfaces share the same mesh data forwarding duties, we may inadvertently create a multicast routing loop and have a corner case where a multicast frame is retransmitted a few times too many.

---
 net/mac80211/ieee80211_i.h |    3 ++-
 net/mac80211/iface.c       |    3 ---
 net/mac80211/mesh.c        |   56 ++++++++++++++++++++++++++++++--------------
 net/mac80211/mesh.h        |    7 +++---
 net/mac80211/rx.c          |    2 +-
 5 files changed, 45 insertions(+), 26 deletions(-)
net/mac80211/ieee80211_i.h +2 -1
index da7fbd4..a8b33d2 100644
@@ -296,6 +296,7 @@ struct mesh_stats {
  * @is_secure: true if the mesh is secure
  * @can_share: true if this bss can be shared (user-configurable per-if)
  * @net: network namespace devices in this mbss belong to
+ * @rmc: Recent Multicast Cache for this mbss
  * @list: listptr for siblings in mesh_bss_list
  * @if_list: interfaces sharing this bss
  */
@@ -310,6 +311,7 @@ struct mesh_local_bss {
 	bool can_share;
 	struct net *net;
 
+	struct mesh_rmc *rmc;
 	struct list_head list;
 	struct list_head if_list;
 };
@@ -598,7 +600,6 @@ struct ieee80211_if_mesh {
 	unsigned long next_perr;
 	/* Timestamp of last PREQ sent */
 	unsigned long last_preq;
-	struct mesh_rmc *rmc;
 	spinlock_t mesh_preq_queue_lock;
 	struct mesh_preq_queue preq_queue;
 	int preq_queue_len;
net/mac80211/iface.c +0 -3
index 9daa64e..652fb40 100644
@@ -994,9 +994,6 @@ static void ieee80211_teardown_sdata(struct ieee80211_sub_if_data *sdata)
 		__skb_queue_purge(&sdata->fragments[i].skb_list);
 	sdata->fragment_next = 0;
 
-	if (ieee80211_vif_is_mesh(&sdata->vif))
-		mesh_rmc_free(sdata);
-
 	flushed = sta_info_flush(sdata);
 	WARN_ON(flushed);
 }
net/mac80211/mesh.c +38 -18

133 lines not on this page · raw message

net/mac80211/mesh.h +4 -3
index 2f83e8c..bf108ef 100644
@@ -185,6 +185,7 @@ struct rmc_entry {
 
 struct mesh_rmc {
 	struct list_head bucket[RMC_BUCKETS];
+	rwlock_t bucket_lock[RMC_BUCKETS];
 	u32 idx_mask;
 };
 
@@ -209,7 +210,7 @@ int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
 int ieee80211_new_mesh_header(struct ieee80211_sub_if_data *sdata,
 			      struct ieee80211s_hdr *meshhdr,
 			      const char *addr4or5, const char *addr6);
-int mesh_rmc_check(struct ieee80211_sub_if_data *sdata,
+int mesh_rmc_check(struct mesh_local_bss *mbss,
 		   const u8 *addr, struct ieee80211s_hdr *mesh_hdr);
 bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
 			struct ieee802_11_elems *ie);
@@ -228,8 +229,8 @@ int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
 		       struct sk_buff *skb);
 int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
 			struct sk_buff *skb);
-void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
-int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
+void mesh_rmc_free(struct mesh_local_bss *mbss);
+int mesh_rmc_init(struct mesh_local_bss *mbss);
 void ieee80211s_init(void);
 void ieee80211s_update_metric(struct ieee80211_local *local,
 			      struct sta_info *sta, struct sk_buff *skb);
net/mac80211/rx.c +1 -1
index d86f0df..0c5f870 100644
@@ -2033,7 +2033,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	/* frame is in RMC, don't forward */
 	if (ieee80211_is_data(hdr->frame_control) &&
 	    is_multicast_ether_addr(hdr->addr1) &&
-	    mesh_rmc_check(rx->sdata, hdr->addr3, mesh_hdr))
+	    mesh_rmc_check(mbss(sdata), hdr->addr3, mesh_hdr))
 		return RX_DROP_MONITOR;
 
 	if (!ieee80211_is_data(hdr->frame_control) ||
Signature · 1 line
1.7.10.4
#19 lore raw

RFC 8/12 mac80211: forward group frames on mbss-shared interfaces

In reply to Thomas Pedersen

From: Bob Copeland <[email protected]>

When multiple local interfaces are in the same MBSS, we should forward group-directed data frames received on one interface for transmit on the other interfaces, so that the frames may be seen on other channels.

---
 net/mac80211/rx.c |    2 ++
 1 file changed, 2 insertions(+)
net/mac80211/rx.c +2 -0
index 0c5f870..850bfe3 100644
@@ -2142,6 +2142,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
 	IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
 	ieee80211_add_pending_skb(local, fwd_skb);
+	if (is_multicast_ether_addr(fwd_hdr->addr1))
+		mesh_bss_forward_tx(sdata, fwd_skb);
  out:
 	if (is_multicast_ether_addr(hdr->addr1) ||
 	    sdata->dev->flags & IFF_PROMISC)
Signature · 1 line
1.7.10.4
#20 lore raw

RFC 9/12 mac80211: add shared-mbss transmit path

In reply to Thomas Pedersen

From: Bob Copeland <[email protected]>

Transmit locally-originated group data frames on every interface so that members of the mesh on every channel will see the frame.

For individually-addressed frames, when we resolve the next hop, the outgoing interface might be different than the originator if the best path is on a different channel. Requeue such frames on the correct interface's pending queue.

---
 net/mac80211/mesh_hwmp.c |   12 +++++++++++-
 net/mac80211/tx.c        |    3 +++
 2 files changed, 14 insertions(+), 1 deletion(-)
net/mac80211/mesh_hwmp.c +11 -1
index d8eaccc..6ba483e 100644
@@ -1115,6 +1115,7 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
 			 struct sk_buff *skb)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_sub_if_data *dest_sdata;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct mesh_local_bss *mbss = mbss(sdata);
 	struct mesh_path *mpath;
@@ -1128,8 +1129,17 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
 
 	rcu_read_lock();
 	err = mesh_nexthop_lookup(mbss, skb);
-	if (!err)
+	if (!err) {
+		dest_sdata = vif_to_sdata(info->control.vif);
+		/* requeue if mesh path uses a different interface */
+		if (dest_sdata != sdata) {
+			info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
+			ieee80211_set_qos_hdr(dest_sdata, skb);
+			ieee80211_add_pending_skb(dest_sdata->local, skb);
+			err = -EAGAIN;
+		}
 		goto endlookup;
+	}
 
 	/* no nexthop found, start resolving */
 	mpath = mesh_path_lookup(mbss, target_addr);
net/mac80211/tx.c +3 -0
index c132c76..4b28680 100644
@@ -1452,6 +1452,9 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
 		} else {
 			ieee80211_mps_set_frame_flags(sdata, NULL, hdr);
 		}
+		if (is_multicast_ether_addr(hdr->addr1) &&
+		    ieee80211_is_data(hdr->frame_control))
+			mesh_bss_forward_tx(sdata, skb);
 	}
 
 	ieee80211_set_qos_hdr(sdata, skb);
Signature · 1 line
1.7.10.4
#21 lore raw

RFC 10/12 mac08211: add shared-mbss receive path handling

In reply to Thomas Pedersen

From: Bob Copeland <[email protected]>

If a destination interface is participating in a shared mbss, then receive data frames on the correct interface (or all for mcast) when passing frames to upper layers.

---
 net/mac80211/rx.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 4 deletions(-)
net/mac80211/rx.c +52 -4
index 850bfe3..f705210 100644
@@ -594,19 +594,22 @@ static int ieee80211_get_mmie_keyidx(struct sk_buff *skb)
 static ieee80211_rx_result ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
-	char *dev_addr = rx->sdata->vif.addr;
+	struct mesh_local_bss *mbss = mbss(rx->sdata);
+
+	if (!mbss)
+		return RX_DROP_MONITOR;
 
 	if (ieee80211_is_data(hdr->frame_control)) {
 		if (is_multicast_ether_addr(hdr->addr1)) {
 			if (ieee80211_has_tods(hdr->frame_control) ||
 			    !ieee80211_has_fromds(hdr->frame_control))
 				return RX_DROP_MONITOR;
-			if (ether_addr_equal(hdr->addr3, dev_addr))
+			if (mesh_bss_matches_addr(mbss, hdr->addr3))
 				return RX_DROP_MONITOR;
 		} else {
 			if (!ieee80211_has_a4(hdr->frame_control))
 				return RX_DROP_MONITOR;
-			if (ether_addr_equal(hdr->addr4, dev_addr))
+			if (mesh_bss_matches_addr(mbss, hdr->addr4))
 				return RX_DROP_MONITOR;
 		}
 	}
@@ -2074,7 +2077,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
 	/* Frame has reached destination.  Don't forward */
 	if (!is_multicast_ether_addr(hdr->addr1) &&
-	    ether_addr_equal(sdata->vif.addr, hdr->addr3))
+	    mesh_bss_matches_addr(mbss, hdr->addr3))
 		return RX_CONTINUE;
 
 	if (!--mesh_hdr->ttl) {
@@ -2157,6 +2160,7 @@ static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 {
 	struct ieee80211_sub_if_data *sdata = rx->sdata;
+	struct ieee80211_sub_if_data *tmp_sdata;
 	struct ieee80211_local *local = rx->local;
 	struct net_device *dev = sdata->dev;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
@@ -2183,6 +2187,19 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 		return RX_DROP_MONITOR;
 	}
 
+	if (ieee80211_vif_is_mesh(&rx->sdata->vif) &&
+	    !is_multicast_ether_addr(hdr->addr1)) {
+		u8 *dest = ieee80211_get_DA(hdr);
+
+		/* deliver unicast frames to the dest netif */
+		tmp_sdata = mesh_bss_find_if(mbss(sdata), dest);
+		if (tmp_sdata && tmp_sdata != sdata) {
+			local = tmp_sdata->local;
+			rx->sdata = tmp_sdata;
+			dev = tmp_sdata->dev;
+		}
+	}
+
 	err = __ieee80211_data_to_8023(rx, &port_control);
 	if (unlikely(err))
 		return RX_DROP_UNUSABLE;
@@ -2198,6 +2215,37 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 		rx->sdata = sdata;
 	}
 
+	if (ieee80211_vif_is_mesh(&rx->sdata->vif)) {
+		struct mesh_local_bss *mbss = mbss(sdata);
+		struct sk_buff *skb = rx->skb, *fwd_skb;
+		u8 *dest = ((struct ethhdr *)rx->skb->data)->h_dest;
+
+		if (is_multicast_ether_addr(dest)) {
+			/* deliver mcast frames to all other interfaces */
+			list_for_each_entry_rcu(tmp_sdata, &mbss->if_list,
+						u.mesh.if_list) {
+
+				if (sdata == tmp_sdata)
+					continue;
+
+				fwd_skb = skb_copy(skb, GFP_ATOMIC);
+				if (!fwd_skb)
+					break;
+
+				dev = tmp_sdata->dev;
+				fwd_skb->dev = dev;
+				rx->skb = fwd_skb;
+				rx->sdata = tmp_sdata;
+				dev->stats.rx_packets++;
+				dev->stats.rx_bytes += rx->skb->len;
+				ieee80211_deliver_skb(rx);
+			}
+			rx->sdata = sdata;
+			rx->skb = skb;
+			dev = sdata->dev;
+		}
+	}
+
 	rx->skb->dev = dev;
 
 	dev->stats.rx_packets++;
Signature · 1 line
1.7.10.4
#22 lore raw

RFC 11/12 {nl,mac}80211: specify MBSS sharing on/off

In reply to Thomas Pedersen
---
 include/net/cfg80211.h       |    3 +++
 include/uapi/linux/nl80211.h |    5 +++++
 net/mac80211/cfg.c           |    1 +
 net/mac80211/ieee80211_i.h   |    1 +
 net/mac80211/mesh.c          |    4 +++-
 net/wireless/mesh.c          |    1 +
 net/wireless/nl80211.c       |    3 +++
 7 files changed, 17 insertions(+), 1 deletion(-)
include/net/cfg80211.h +3 -0
index 26e9113..21007e7 100644
@@ -1169,6 +1169,8 @@ struct mesh_config {
  * @dtim_period: DTIM period to use
  * @beacon_interval: beacon interval to use
  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
+ * @shared: MBSS sharing and intra-vif data forwarding may take place for
+ *	this mesh setup.
  *
  * These parameters are fixed when the mesh is created.
  */
@@ -1187,6 +1189,7 @@ struct mesh_setup {
 	u8 dtim_period;
 	u16 beacon_interval;
 	int mcast_rate[IEEE80211_NUM_BANDS];
+	bool shared;
 };
 
 /**
include/uapi/linux/nl80211.h +5 -0
index b484307..549ce133 100644
@@ -2645,6 +2645,10 @@ enum nl80211_meshconf_params {
  * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
  *	implement an MPM which handles peer allocation and state.
  *
+ * @NL80211_MESH_SETUP_CAN_SHARE: Enable this option to allow sharing an MBSS
+ *	profile and frame forwarding across multiple virtual interfaces with the
+ *	same profile. Defaults to off.
+ *
  * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
  *
  * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -2658,6 +2662,7 @@ enum nl80211_mesh_setup_params {
 	NL80211_MESH_SETUP_USERSPACE_AMPE,
 	NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
 	NL80211_MESH_SETUP_USERSPACE_MPM,
+	NL80211_MESH_SETUP_CAN_SHARE,
 
 	/* keep last */
 	__NL80211_MESH_SETUP_ATTR_AFTER_LAST,
net/mac80211/cfg.c +1 -0
index 76e9575..398df0a 100644
@@ -1742,6 +1742,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
 	/* now copy the rest of the setup parameters */
 	ifmsh->mesh_id_len = setup->mesh_id_len;
 	memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);
+	ifmsh->share_mbss = setup->shared;
 	ifmsh->mesh_sp_id = setup->sync_method;
 	ifmsh->mesh_pp_id = setup->path_sel_proto;
 	ifmsh->mesh_pm_id = setup->path_metric;
net/mac80211/ieee80211_i.h +1 -0
index a8b33d2..19c0ff4 100644
@@ -632,6 +632,7 @@ struct ieee80211_if_mesh {
 	struct ps_data ps;
 
 	/* mbss sharing */
+	bool share_mbss;
 	struct mesh_local_bss *mesh_bss;
 	struct list_head if_list;
 };
net/mac80211/mesh.c +3 -1
index 9445f02..08d3171 100644
@@ -60,6 +60,7 @@ mesh_bss_matches(struct ieee80211_sub_if_data *sdata,
 		 struct mesh_local_bss *mbss)
 {
 	return mbss->can_share &&
+	       setup->shared &&
 	       mbss->mesh_id_len == setup->mesh_id_len &&
 	       memcmp(mbss->mesh_id, setup->mesh_id, mbss->mesh_id_len) == 0 &&
 	       mbss->path_sel_proto == setup->path_sel_proto &&
@@ -109,7 +110,7 @@ mesh_bss_create(struct ieee80211_sub_if_data *sdata, struct mesh_setup *setup)
 
 	mbss->mesh_id_len = setup->mesh_id_len;
 	memcpy(mbss->mesh_id, setup->mesh_id, setup->mesh_id_len);
-	mbss->can_share = false;
+	mbss->can_share = setup->shared;
 	mbss->path_metric = setup->path_metric;
 	mbss->path_sel_proto = setup->path_sel_proto;
 	mbss->sync_method = setup->sync_method;
@@ -994,6 +995,7 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
 	setup.sync_method = ifmsh->mesh_pm_id;
 	setup.path_metric = ifmsh->mesh_cc_id;
 	setup.is_secure = ifmsh->security & IEEE80211_MESH_SEC_SECURED;
+	setup.shared = ifmsh->share_mbss;
 
 	ret = mesh_bss_add(sdata, &setup);
 	if (ret) {
net/wireless/mesh.c +1 -0
index 0bb93f3..cb1e360 100644
@@ -88,6 +88,7 @@ const struct mesh_setup default_mesh_setup = {
 	.user_mpm = false,
 	.beacon_interval = MESH_DEFAULT_BEACON_INTERVAL,
 	.dtim_period = MESH_DEFAULT_DTIM_PERIOD,
+	.shared = false,
 };
 
 int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
net/wireless/nl80211.c +3 -0
index 9cdcd9e..5925b13 100644
@@ -4857,6 +4857,9 @@ static int nl80211_parse_mesh_setup(struct genl_info *info,
 	if (setup->is_secure)
 		setup->user_mpm = true;
 
+	if (tb[NL80211_MESH_SETUP_CAN_SHARE])
+		setup->shared = nla_get_u8(tb[NL80211_MESH_SETUP_CAN_SHARE]);
+
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#23 lore raw

RFC 12/12 {nl,mac}80211: allow mpath dump to span local MBSS

In reply to Thomas Pedersen

Allow the user to specify a flag NL80211_ATTR_MPATH_DUMP_MBSS along with an mpath dump request to dump all paths in the interface's mbss.

---
 include/net/cfg80211.h       |    5 +++--
 include/uapi/linux/nl80211.h |    7 +++++--
 net/mac80211/cfg.c           |    8 +++++---
 net/mac80211/mesh.h          |    3 ++-
 net/mac80211/mesh_pathtbl.c  |    8 ++++++--
 net/wireless/nl80211.c       |   18 +++++++++++++++---
 net/wireless/rdev-ops.h      |   10 ++++++----
 7 files changed, 42 insertions(+), 17 deletions(-)
include/net/cfg80211.h +3 -2
index 21007e7..fa9a6e6 100644
@@ -2087,8 +2087,9 @@ struct cfg80211_ops {
 			       u8 *dst, u8 *next_hop,
 			       struct mpath_info *pinfo);
 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
-			       int idx, u8 *dst, u8 *next_hop,
-			       struct mpath_info *pinfo);
+			      int idx, struct net_device **pathdev,
+			      u8 *dst, u8 *next_hop,
+			      struct mpath_info *pinfo, bool mbss);
 	int	(*get_mesh_config)(struct wiphy *wiphy,
 				struct net_device *dev,
 				struct mesh_config *conf);
include/uapi/linux/nl80211.h +5 -2
index 549ce133..6c1a03e 100644
@@ -205,8 +205,9 @@
  *	by %NL80211_ATTR_IFINDEX.
  *
  * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
- * 	destination %NL80211_ATTR_MAC on the interface identified by
- * 	%NL80211_ATTR_IFINDEX.
+ *	destination %NL80211_ATTR_MAC on the interface identified by
+ *	%NL80211_ATTR_IFINDEX. If %NL80211_ATTR_MPATH_MBSS is set, get all
+ *	mpaths in mbss, not just ones matched by %NL80211_ATTR_IFINDEX.
  * @NL80211_CMD_SET_MPATH:  Set mesh path attributes for mesh path to
  * 	destination %NL80211_ATTR_MAC on the interface identified by
  * 	%NL80211_ATTR_IFINDEX.
@@ -1729,6 +1730,8 @@ enum nl80211_attrs {
 	NL80211_ATTR_CRIT_PROT_ID,
 	NL80211_ATTR_MAX_CRIT_PROT_DURATION,
 
+	NL80211_ATTR_MPATH_DUMP_MBSS,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
net/mac80211/cfg.c +5 -3
index 398df0a..ff713d5 100644
@@ -1681,8 +1681,9 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
 }
 
 static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
-				 int idx, u8 *dst, u8 *next_hop,
-				 struct mpath_info *pinfo)
+				int idx, struct net_device **pathdev,
+				u8 *dst, u8 *next_hop,
+				struct mpath_info *pinfo, bool mbss)
 {
 	struct ieee80211_sub_if_data *sdata;
 	struct mesh_path *mpath;
@@ -1690,13 +1691,14 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	rcu_read_lock();
-	mpath = mesh_path_lookup_by_idx(sdata, idx);
+	mpath = mesh_path_lookup_by_idx(sdata, idx, mbss);
 	if (!mpath) {
 		rcu_read_unlock();
 		return -ENOENT;
 	}
 	memcpy(dst, mpath->dst, ETH_ALEN);
 	mpath_set_pinfo(mpath, next_hop, pinfo);
+	*pathdev = mpath->sdata->wdev.netdev;
 	rcu_read_unlock();
 	return 0;
 }
net/mac80211/mesh.h +2 -1
index bf108ef..31b60f1 100644
@@ -271,7 +271,8 @@ struct mesh_path *mpp_path_lookup(struct mesh_local_bss *mbss,
 int mpp_path_add(struct ieee80211_sub_if_data *sdata,
 		 const u8 *dst, const u8 *mpp);
 struct mesh_path *
-mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx);
+mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata,
+			int idx, bool mbss);
 void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop);
 void mesh_path_expire(struct ieee80211_sub_if_data *sdata);
 void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,
net/mac80211/mesh_pathtbl.c +6 -2
index 7df8f27..01b5738 100644
@@ -400,13 +400,15 @@ mpp_path_lookup(struct mesh_local_bss *mbss, const u8 *dst)
  * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
  * @idx: index
  * @sdata: local subif, or NULL for all entries
+ * @mbss: match @idx against all mpaths in sdata's MBSS
  *
  * Returns: pointer to the mesh path structure, or NULL if not found.
  *
  * Locking: must be called within a read rcu section.
  */
 struct mesh_path *
-mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx)
+mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata,
+			int idx, bool mbss)
 {
 	struct mesh_table *tbl = rcu_dereference(mesh_paths);
 	struct mpath_node *node;
@@ -414,7 +416,9 @@ mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx)
 	int j = 0;
 
 	for_each_mesh_entry(tbl, node, i) {
-		if (sdata && node->mpath->sdata != sdata)
+		if (mbss && mbss(sdata) != mbss(node->mpath->sdata))
+			continue;
+		if (!mbss && sdata && sdata != node->mpath->sdata)
 			continue;
 		if (j++ == idx) {
 			if (mpath_expired(node->mpath)) {
net/wireless/nl80211.c +15 -3
index 5925b13..f95dfff 100644
@@ -270,6 +270,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 	[NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY,
 				   .len = IEEE80211_MAX_MESH_ID_LEN },
 	[NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 },
+	[NL80211_ATTR_MPATH_DUMP_MBSS] = { .type = NLA_FLAG },
 
 	[NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 },
 	[NL80211_ATTR_REG_RULES] = { .type = NLA_NESTED },
@@ -4222,9 +4223,12 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
 	struct mpath_info pinfo;
 	struct cfg80211_registered_device *dev;
 	struct wireless_dev *wdev;
+	struct net_device *pathdev;
 	u8 dst[ETH_ALEN];
 	u8 next_hop[ETH_ALEN];
 	int path_idx = cb->args[2];
+	struct nlattr **tb = nl80211_fam.attrbuf;
+	bool mbss = false;
 	int err;
 
 	err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev);
@@ -4241,9 +4245,17 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
 		goto out_err;
 	}
 
+	err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
+			  tb, nl80211_fam.maxattr, nl80211_policy);
+	if (err)
+		return err;
+
+	mbss = nla_get_flag(tb[NL80211_ATTR_MPATH_DUMP_MBSS]);
+
 	while (1) {
-		err = rdev_dump_mpath(dev, wdev->netdev, path_idx, dst,
-				      next_hop, &pinfo);
+		err = rdev_dump_mpath(dev, wdev->netdev, path_idx,
+				      &pathdev, dst, next_hop,
+				      &pinfo, mbss);
 		if (err == -ENOENT)
 			break;
 		if (err)
@@ -4251,7 +4263,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
 
 		if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid,
 				       cb->nlh->nlmsg_seq, NLM_F_MULTI,
-				       wdev->netdev, dst, next_hop,
+				       pathdev, dst, next_hop,
 				       &pinfo) < 0)
 			goto out;
 
net/wireless/rdev-ops.h +6 -4
index 9f15f0a..a543601 100644
@@ -264,14 +264,16 @@ static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
 }
 
 static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
-				  struct net_device *dev, int idx, u8 *dst,
-				  u8 *next_hop, struct mpath_info *pinfo)
+				  struct net_device *dev, int idx,
+				  struct net_device **pathdev,
+				  u8 *dst, u8 *next_hop,
+				  struct mpath_info *pinfo, bool mbss)
 
 {
 	int ret;
 	trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
-	ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
-				     pinfo);
+	ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, pathdev,
+				    dst, next_hop, pinfo, mbss);
 	trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
 	return ret;
 }
Signature · 1 line
1.7.10.4
#24 lore raw
In reply to Thomas Pedersen

I have some questions and comments.

Question 1

The typical use case of multiple interfaces on this same host is to do RF segregation in order to improve overall network performance. e.g. divide a original mesh of 16 radios into 2 meshes of 8 radios each. This multi-radio host bridges these two small meshes which are on different channels. I can't see why user would put multiple radios of the same host on the same channel. They would just interfere with each other very badly.

So, it does not matter whether they have matching mesh setup profile or not. Two MBSS-es simply can't see each other in air.

Question 2

In MPP where there are multiple mesh interfaces, AP interface and/or Ethernet interface, how does this "MBSS sharing" work?
a. add both mesh interface in 802.1d bridge, or
b. add either interface in bridge, or
c. sharing can't be used

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Thomas Pedersen
Sent: Thursday, May 02, 2013 10:34 PM
To: Johannes Berg
Cc: open80211s; linux-wirelss
Subject: [RFC 00/12] MBSS sharing across multiple interfaces

This patchset enables multiple interfaces on the same host to share mesh path selection and frame forwarding duties. The peering state machine remains per-interface.

The user interface looks something like:

iw wlan0 mesh join foo shared on
iw wlan1 mesh join foo shared on

As long as wlan0 and wlan1 have a matching mesh setup profile, they will be considered part of the same MBSS.

This approach is superior to simple 802.1d briding, since mac80211 can dynamically pick the better link instead of simply disabling an entire port. The added link knowledge also enables bonding and alternation in the future.

Bob Copeland (6):
mac80211: track and share mesh BSSes among interfaces
mac80211: mesh: add function to tx on all other mbss ifaces
mac80211: use all MBSS interfaces for path selection
mac80211: forward group frames on mbss-shared interfaces
mac80211: add shared-mbss transmit path
mac08211: add shared-mbss receive path handling

Thomas Pedersen (6):
mac80211: assign outgoing interface with nexthop
mac80211: forward frames on correct mbss-shared interface
mac80211: notify bridge when leaving mesh
mac80211: make RMC per-mbss
{nl,mac}80211: specify MBSS sharing on/off {nl,mac}80211: allow mpath dump to span local MBSS

 include/net/cfg80211.h       |    8 +-
 include/uapi/linux/nl80211.h |   12 +-
 net/mac80211/cfg.c           |   17 +--
 net/mac80211/ieee80211_i.h   |   37 +++++-
 net/mac80211/iface.c         |    3 -
 net/mac80211/mesh.c          |  276 +++++++++++++++++++++++++++++++++++++++---
 net/mac80211/mesh.h          |   24 ++--
 net/mac80211/mesh_hwmp.c     |  133 ++++++++++++++------
 net/mac80211/mesh_pathtbl.c  |   68 +++++++----
 net/mac80211/rx.c            |  110 +++++++++++++----
 net/mac80211/tx.c            |    8 +-
 net/wireless/mesh.c          |    1 +
 net/wireless/nl80211.c       |   21 +++-
 net/wireless/rdev-ops.h      |   10 +-
 14 files changed, 599 insertions(+), 129 deletions(-)

--
1.7.10.4

_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

A message that is not in the archive (sent off-list or not yet received): CAEFj987wqVTmN1eCCfqm2M16p5j8JtOn5AcKE0fETmsn+FyENg@mail.gmail.com

#26 lore raw

Question 2

In MPP where there are multiple mesh interfaces, AP interface and/or Ethernet interface, how does this "MBSS sharing" work? a. add both mesh interface in 802.1d bridge, or
        b. add either interface in bridge, or
        c. sharing can't be used

Quoted 1 line

As far as I know, sharing can't be used for mesh interfaces with AP or Ethernet interfaces. Perhaps, Thomas and Bob can comment further.

I am not talking about sharing with AP or Ethernet interface. I am saying, how to bridge with AP or Ethernet?
a. add both mesh interface in 802.1d bridge, or b. add either mesh interface in bridge, or
c. if sharing is enabled, interface can't added to bridge.

#27 lore raw
In reply to Chaoxing Lin
Quoted 11 lines · Chaoxing Lin

I have some questions and comments.

Question 1

The typical use case of multiple interfaces on this same host is to do RF segregation in order to improve overall network performance. e.g. divide a original mesh of 16 radios into 2 meshes of 8 radios each. This multi-radio host bridges these two small meshes which are on different channels. I can't see why user would put multiple radios of the same host on the same channel. They would just interfere with each other very badly.

Yes, you want to use different channels. Also, you need to have good spacing between the radios, because even on different channels, closely located radios will interfere. We found that putting one in 2.4 ghz band and one in 5 ghz band worked without resorting to directional antennas or the like.

Quoted 4 lines

In MPP where there are multiple mesh interfaces, AP interface and/or Ethernet interface, how does this "MBSS sharing" work?
a. add both mesh interface in 802.1d bridge, or
b. add either interface in bridge, or
c. sharing can't be used

You should be able to add either interface in the bridge.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com

A message that is not in the archive (sent off-list or not yet received): CAEFj986Avr_C5Hm4uRs0oP2ZRa-jnn6eRCJH71jkehcCuQ7iGQ@mail.gmail.com

#29 lore raw
Quoted 9 lines · Yeoh Chun-Yeow

Hi, Bob

If we have two mesh interfaces which MBSS sharing is turned on and one Ethernet interface in the same host, can we use the brctl to add the mesh interfaces and Ethernet interface together, like the following?

brctl add br-lan mesh0
brctl add br-lan mesh1
brctl add br-lan eth0

So in the patch, the frames are already forwarded between the mesh interfaces, so we've at least tested the case like this:

mesh0/mesh1 shared
brctl addif br-lan mesh1
brctl addif br-lan eth0

Then frames destined for mesh1/eth0 that arrive at mesh0 will be forwarded to the other devices and vice-versa. I imagine some frame duplication would happen if both mesh devices were in the bridge, but I haven't tried.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
maintainer
#30 lore raw
In reply to Thomas Pedersen
Quoted 3 lines · Thomas Pedersen

This patchset enables multiple interfaces on the same host to share mesh path selection and frame forwarding duties. The peering state machine remains per-interface.

Generally, this looks pretty good. The one thing I didn't see (maybe I missed it) is how you handle different headroom/tailroom/crypto requirements for different devices?

johannes