From: Thomas Pedersen <thomas@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: Pedro Larbig <pedro.larbig@carhs.de>,
johannes@sipsolutions.net, linville@tuxdriver.com
Subject: [PATCH 2/9] mac80211: Limit amount of HWMP frames and forwarded data packets in queues on mesh interfaces
Date: Wed, 24 Aug 2011 18:40:45 -0700 [thread overview]
Message-ID: <1314236452-7226-3-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1314236452-7226-1-git-send-email-thomas@cozybit.com>
From: Pedro Larbig <pedro.larbig@carhs.de>
To avoid contention problems in a mesh network's high load areas, this patch
adds a 2-stage packet dropping mechanism:
* If the transmit queue for HWMP frames is filled with 256 or more packets,
additional HWMP frames will be dropped
* If the transmit queue for forwarded packets is at 384 or more, drop those,
too
This way, if a node runs into contention issues, it first reduces the amount
of HWMP messages, and only if this is not enough, starts also dropping data
packets from other nodes.
So, instead of eating up memory and crashing, a node does only behave selfish
in such situations.
This patch has been tested several hours in a 20-node testbed under heavy
iperf load.
Signed-off-by: Pedro Larbig <pedro.larbig@carhs.de>
Signed-off-by: Javier Cardona <javier@cozybit.com>
---
net/mac80211/debugfs.c | 4 ++++
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/mesh.h | 5 +++++
net/mac80211/mesh_hwmp.c | 21 +++++++++++++++++++--
net/mac80211/rx.c | 13 ++++++++++++-
5 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 186e02f..8aefd2e 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -496,6 +496,10 @@ void debugfs_hw_add(struct ieee80211_local *local)
local->tx_handlers_drop_not_assoc);
DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port,
local->tx_handlers_drop_unauth_port);
+ DEBUGFS_STATS_ADD(tx_handlers_drop_mesh_mgmt,
+ local->tx_handlers_drop_mesh_mgmt);
+ DEBUGFS_STATS_ADD(tx_handlers_drop_mesh_fwd,
+ local->tx_handlers_drop_mesh_fwd);
DEBUGFS_STATS_ADD(rx_handlers_drop, local->rx_handlers_drop);
DEBUGFS_STATS_ADD(rx_handlers_queued, local->rx_handlers_queued);
DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c204cee..12ad787 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -922,6 +922,8 @@ struct ieee80211_local {
unsigned int tx_handlers_drop_wep;
unsigned int tx_handlers_drop_not_assoc;
unsigned int tx_handlers_drop_unauth_port;
+ unsigned int tx_handlers_drop_mesh_mgmt;
+ unsigned int tx_handlers_drop_mesh_fwd;
unsigned int rx_handlers_drop;
unsigned int rx_handlers_queued;
unsigned int rx_handlers_drop_nullfunc;
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 2027207..6b57b11 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -186,6 +186,11 @@ struct mesh_rmc {
/* Maximum number of paths per interface */
#define MESH_MAX_MPATHS 1024
+/* Maximum number of data frames to be forwarded in tx queue */
+#define MESH_MAX_FWDING_QUEUE 384
+/* Maximum number of HWMP management frames in tx queue */
+#define MESH_MGMT_QUEUE_LEN 256
+
/* Public interfaces */
/* Various */
int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index fd4f76a..f09e5e8 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -105,6 +105,23 @@ enum mpath_frame_type {
static const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static void mesh_tx_skb(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb)
+{
+ struct ieee80211_local *local = sdata->local;
+
+ /* Frames going through ieee80211_tx_skb will be on the voice queue,
+ * Therefor we need to check only IEEE80211_AC_VO */
+ if (unlikely(skb_queue_len(&local->pending[IEEE80211_AC_VO]) >=
+ MESH_MGMT_QUEUE_LEN)) {
+ kfree_skb(skb);
+ I802_DEBUG_INC(local->tx_handlers_drop_mesh_mgmt);
+ return;
+ }
+
+ ieee80211_tx_skb(sdata, skb);
+}
+
static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
u8 *orig_addr, __le32 orig_sn, u8 target_flags, u8 *target,
__le32 target_sn, const u8 *da, u8 hop_count, u8 ttl,
@@ -198,7 +215,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
pos += 4;
}
- ieee80211_tx_skb(sdata, skb);
+ mesh_tx_skb(sdata, skb);
return 0;
}
@@ -263,7 +280,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
pos += 4;
memcpy(pos, &target_rcode, 2);
- ieee80211_tx_skb(sdata, skb);
+ mesh_tx_skb(sdata, skb);
return 0;
}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c4453fd..9b5daa1 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1817,7 +1817,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
{
struct ieee80211_hdr *hdr;
struct ieee80211s_hdr *mesh_hdr;
- unsigned int hdrlen;
+ unsigned int hdrlen, q;
struct sk_buff *skb = rx->skb, *fwd_skb;
struct ieee80211_local *local = rx->local;
struct ieee80211_sub_if_data *sdata = rx->sdata;
@@ -1915,6 +1915,17 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
}
IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
fwded_frames);
+
+ /* Check selected queue's size and drop if full */
+ q = skb_get_queue_mapping(fwd_skb);
+ if (unlikely(skb_queue_len(&local->pending[q]) >=
+ MESH_MAX_FWDING_QUEUE)) {
+ kfree_skb(fwd_skb);
+ I802_DEBUG_INC(local->
+ tx_handlers_drop_mesh_fwd);
+ return RX_DROP_MONITOR;
+ }
+
ieee80211_add_pending_skb(local, fwd_skb);
}
}
--
1.7.4.1
next prev parent reply other threads:[~2011-08-25 1:41 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 1:40 [PATCH 0/9] mesh fixes Thomas Pedersen
2011-08-25 1:40 ` [PATCH 1/9] mac80211: Fix RCU pointer dereference in mesh_path_discard_frame() Thomas Pedersen
2011-08-25 2:08 ` Johannes Berg
2011-08-25 18:16 ` Javier Cardona
2011-08-25 18:21 ` Johannes Berg
2011-08-25 18:45 ` Javier Cardona
2011-08-25 18:48 ` Johannes Berg
2011-08-25 19:04 ` Javier Cardona
2011-08-25 1:40 ` Thomas Pedersen [this message]
2011-08-25 5:08 ` [PATCH 2/9] mac80211: Limit amount of HWMP frames and forwarded data packets in queues on mesh interfaces Johannes Berg
2011-08-25 17:46 ` Javier Cardona
2011-08-25 1:40 ` [PATCH 3/9] mac80211: Remove mesh paths when an interface is removed Thomas Pedersen
2011-08-25 1:40 ` [PATCH 4/9] mac80211: Improve mpath state locking Thomas Pedersen
2011-08-25 1:40 ` [PATCH 5/9] mac80211: Remove redundant mesh path expiration checks Thomas Pedersen
2011-08-25 1:40 ` [PATCH 6/9] mac80211: Don't iterate twice over all mpaths when once in sufficient Thomas Pedersen
2011-08-25 1:40 ` [PATCH 7/9] mac80211: Consolidate {mesh,mpp}_path_flush into one function Thomas Pedersen
2011-08-25 1:40 ` [PATCH 8/9] mac80211: Don't take the mesh path resize lock when deleting an mpath Thomas Pedersen
2011-08-25 1:40 ` [PATCH 9/9] mac80211: Consolidate mesh path duplicated functions Thomas Pedersen
2011-08-27 0:18 ` [PATCH v2 0/8] mesh fixes Javier Cardona
2011-08-27 0:18 ` [PATCH v2 1/8] mac80211: Fix RCU pointer dereference in mesh_path_discard_frame() Javier Cardona
2011-08-27 0:18 ` [PATCH v2 2/8] mac80211: Remove mesh paths when an interface is removed Javier Cardona
2011-08-27 0:18 ` [PATCH v2 3/8] mac80211: Improve mpath state locking Javier Cardona
2011-08-27 0:18 ` [PATCH v2 4/8] mac80211: Remove redundant mesh path expiration checks Javier Cardona
2011-08-27 0:18 ` [PATCH v2 5/8] mac80211: Don't iterate twice over all mpaths when once in sufficient Javier Cardona
2011-08-27 0:18 ` [PATCH v2 6/8] mac80211: Consolidate {mesh,mpp}_path_flush into one function Javier Cardona
2011-08-29 13:49 ` Johannes Berg
2011-08-29 18:36 ` Javier Cardona
2011-08-29 18:38 ` Johannes Berg
2011-08-27 0:18 ` [PATCH v2 7/8] mac80211: Don't take the mesh path resize lock when deleting an mpath Javier Cardona
2011-08-29 13:49 ` Johannes Berg
2011-08-27 0:18 ` [PATCH v2 8/8] mac80211: Consolidate mesh path duplicated functions Javier Cardona
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=1314236452-7226-3-git-send-email-thomas@cozybit.com \
--to=thomas@cozybit.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=pedro.larbig@carhs.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.