linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Pedersen <thomas@cozybit.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wirelss <linux-wireless@vger.kernel.org>,
	me@bobcopeland.com, open80211s <devel@lists.open80211s.org>
Subject: [RFC 02/12] mac80211: mesh: add function to tx on all other mbss ifaces
Date: Thu,  2 May 2013 19:33:52 -0700	[thread overview]
Message-ID: <1367548442-8229-3-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1367548442-8229-1-git-send-email-thomas@cozybit.com>

From: Bob Copeland <me@bobcopeland.com>

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

Signed-off-by: Bob Copeland <bob@cozybit.com>
---
 net/mac80211/mesh.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/mesh.h |    4 ++++
 2 files changed, 47 insertions(+)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 5ea4812..eac9988 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -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
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index f23b58f..4a1a15e 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -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 */
-- 
1.7.10.4


  parent reply	other threads:[~2013-05-03  2:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  2:33 [RFC 00/12] MBSS sharing across multiple interfaces Thomas Pedersen
2013-05-03  2:33 ` [RFC 01/12] mac80211: track and share mesh BSSes among interfaces Thomas Pedersen
2013-05-07 13:37   ` Johannes Berg
2013-05-07 14:08     ` Bob Copeland
2013-05-07 14:22       ` Johannes Berg
2013-05-07 15:55         ` Bob Copeland
2013-05-03  2:33 ` Thomas Pedersen [this message]
2013-05-03  2:33 ` [RFC 03/12] mac80211: use all MBSS interfaces for path selection Thomas Pedersen
2013-05-07 13:40   ` Johannes Berg
2013-05-07 14:11     ` Bob Copeland
2013-05-03  2:33 ` [RFC 04/12] mac80211: assign outgoing interface with nexthop Thomas Pedersen
2013-05-03  2:33 ` [RFC 05/12] mac80211: forward frames on correct mbss-shared interface Thomas Pedersen
2013-05-03  2:33 ` [RFC 06/12] mac80211: notify bridge when leaving mesh Thomas Pedersen
2013-05-07 13:42   ` Johannes Berg
2013-05-22  1:09     ` Thomas Pedersen
2013-05-24 20:32       ` Johannes Berg
2013-05-28 17:01         ` Thomas Pedersen
2013-05-29 16:11           ` Thomas Pedersen
2013-05-03  2:33 ` [RFC 07/12] mac80211: make RMC per-mbss Thomas Pedersen
2013-05-03  2:33 ` [RFC 08/12] mac80211: forward group frames on mbss-shared interfaces Thomas Pedersen
2013-05-03  2:33 ` [RFC 09/12] mac80211: add shared-mbss transmit path Thomas Pedersen
2013-05-03  2:34 ` [RFC 10/12] mac08211: add shared-mbss receive path handling Thomas Pedersen
2013-05-03  2:34 ` [RFC 11/12] {nl,mac}80211: specify MBSS sharing on/off Thomas Pedersen
2013-05-03  2:34 ` [RFC 12/12] {nl,mac}80211: allow mpath dump to span local MBSS Thomas Pedersen
2013-05-03 13:25 ` [RFC 00/12] MBSS sharing across multiple interfaces Chaoxing Lin
     [not found]   ` <CAEFj987wqVTmN1eCCfqm2M16p5j8JtOn5AcKE0fETmsn+FyENg@mail.gmail.com>
2013-05-03 14:07     ` Chaoxing Lin
2013-05-03 14:35   ` Bob Copeland
     [not found]     ` <CAEFj986Avr_C5Hm4uRs0oP2ZRa-jnn6eRCJH71jkehcCuQ7iGQ@mail.gmail.com>
2013-05-03 15:41       ` Bob Copeland
2013-05-07 13:44 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367548442-8229-3-git-send-email-thomas@cozybit.com \
    --to=thomas@cozybit.com \
    --cc=devel@lists.open80211s.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=me@bobcopeland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).