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>,
	Thomas Pedersen <thomas@cozybit.com>
Subject: [RFC 05/12] mac80211: forward frames on correct mbss-shared interface
Date: Thu,  2 May 2013 19:33:55 -0700	[thread overview]
Message-ID: <1367548442-8229-6-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1367548442-8229-1-git-send-email-thomas@cozybit.com>

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.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 net/mac80211/rx.c |   47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 4e7886d..d86f0df 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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);
-- 
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 ` [RFC 02/12] mac80211: mesh: add function to tx on all other mbss ifaces Thomas Pedersen
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 ` Thomas Pedersen [this message]
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-6-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).