linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Pedersen <thomas@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: Javier Cardona <javier@cozybit.com>,
	johannes@sipsolutions.net, linville@tuxdriver.com
Subject: [PATCH 7/8] {nl,cfg,mac}80211: let userspace set RANN interval
Date: Tue,  9 Aug 2011 16:45:10 -0700	[thread overview]
Message-ID: <1312933511-9486-8-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1312933511-9486-1-git-send-email-thomas@cozybit.com>

From: Javier Cardona <javier@cozybit.com>

Allow userspace to set Root Announcement Interval for our mesh
interface. Also, RANN interval is now in proper units of TUs.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 include/linux/nl80211.h       |    4 ++++
 include/net/cfg80211.h        |    1 +
 net/mac80211/cfg.c            |    4 ++++
 net/mac80211/debugfs_netdev.c |    3 +++
 net/mac80211/mesh.c           |    3 ++-
 net/mac80211/mesh.h           |    1 -
 net/mac80211/mesh_hwmp.c      |    8 ++++----
 net/wireless/mesh.c           |    2 ++
 net/wireless/nl80211.c        |    7 +++++++
 9 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8ad70dc..63ad64b 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1833,6 +1833,9 @@ enum nl80211_mntr_flags {
  * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
  * source mesh point for path selection elements.
  *
+ * @NL80211_MESHCONF_HWMP_RANN_INTERVAL:  The interval of time (in TUs) between
+ * root announcements are transmitted.
+ *
  * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
  *
  * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -1854,6 +1857,7 @@ enum nl80211_meshconf_params {
 	NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
 	NL80211_MESHCONF_HWMP_ROOTMODE,
 	NL80211_MESHCONF_ELEMENT_TTL,
+	NL80211_MESHCONF_HWMP_RANN_INTERVAL,
 
 	/* keep last */
 	__NL80211_MESHCONF_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 44e72cc..207e508 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -683,6 +683,7 @@ struct mesh_config {
 	u16 dot11MeshHWMPpreqMinInterval;
 	u16 dot11MeshHWMPnetDiameterTraversalTime;
 	u8  dot11MeshHWMPRootMode;
+	u16 dot11MeshHWMPRannInterval;
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c1fa577..9995c83 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1137,6 +1137,10 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,
 		conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode;
 		ieee80211_mesh_root_setup(ifmsh);
 	}
+	if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) {
+		conf->dot11MeshHWMPRannInterval =
+			nconf->dot11MeshHWMPRannInterval;
+	}
 	return 0;
 }
 
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 75ece3d..bac9443 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -372,6 +372,8 @@ IEEE80211_IF_FILE(min_discovery_timeout,
 		u.mesh.mshcfg.min_discovery_timeout, DEC);
 IEEE80211_IF_FILE(dot11MeshHWMPRootMode,
 		u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPRannInterval,
+		u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC);
 #endif
 
 
@@ -486,6 +488,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
 	MESHPARAMS_ADD(path_refresh_time);
 	MESHPARAMS_ADD(min_discovery_timeout);
 	MESHPARAMS_ADD(dot11MeshHWMPRootMode);
+	MESHPARAMS_ADD(dot11MeshHWMPRannInterval);
 #undef MESHPARAMS_ADD
 }
 #endif
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e120fef..1c4f53c 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -537,7 +537,8 @@ static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata)
 
 	mesh_path_tx_root_frame(sdata);
 	mod_timer(&ifmsh->mesh_path_root_timer,
-		  round_jiffies(jiffies + IEEE80211_MESH_RANN_INTERVAL));
+		  round_jiffies(jiffies +
+			  usecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPRannInterval * 1024)));
 }
 
 #ifdef CONFIG_PM
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 9d9116e..2027207 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -175,7 +175,6 @@ struct mesh_rmc {
 
 #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
 #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)
-#define IEEE80211_MESH_RANN_INTERVAL	     (1 * HZ)
 
 #define MESH_DEFAULT_BEACON_INTERVAL		1000 	/* in 1024 us units */
 
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index d14dfe4..d6dd460 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -694,7 +694,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
 	u8 ttl, flags, hopcount;
 	u8 *orig_addr;
 	u32 orig_sn, metric;
-	u32 interval = cpu_to_le32(IEEE80211_MESH_RANN_INTERVAL);
+	u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval;
 	bool root_is_gate;
 
 	ttl = rann->rann_ttl;
@@ -742,7 +742,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
 		mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
 				       cpu_to_le32(orig_sn),
 				       0, NULL, 0, broadcast_addr,
-				       hopcount, ttl, interval,
+				       hopcount, ttl, cpu_to_le32(interval),
 				       cpu_to_le32(metric + mpath->metric),
 				       0, sdata);
 		mpath->sn = orig_sn;
@@ -1043,11 +1043,11 @@ void
 mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-	u32 interval = cpu_to_le32(IEEE80211_MESH_RANN_INTERVAL);
+	u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval;
 
 	mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr,
 			       cpu_to_le32(++ifmsh->sn),
 			       0, NULL, 0, broadcast_addr,
 			       0, sdata->u.mesh.mshcfg.element_ttl,
-			       interval, 0, 0, sdata);
+			       cpu_to_le32(interval), 0, 0, sdata);
 }
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 5c11608..b5a39d4 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -12,6 +12,7 @@
 #define MESH_HOLD_T 		100
 
 #define MESH_PATH_TIMEOUT	5000
+#define MESH_RANN_INTERVAL      5000
 
 /*
  * Minimum interval between two consecutive PREQs originated by the same
@@ -49,6 +50,7 @@ const struct mesh_config default_mesh_config = {
 	.dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES,
 	.path_refresh_time = MESH_PATH_REFRESH_TIME,
 	.min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT,
+	.dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL,
 };
 
 const struct mesh_setup default_mesh_setup = {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c7b5e44..40cab48 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2955,6 +2955,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
 			cur_params.dot11MeshHWMPnetDiameterTraversalTime);
 	NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE,
 			cur_params.dot11MeshHWMPRootMode);
+	NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_RANN_INTERVAL,
+			cur_params.dot11MeshHWMPRannInterval);
 	nla_nest_end(msg, pinfoattr);
 	genlmsg_end(msg, hdr);
 	return genlmsg_reply(msg, info);
@@ -2983,6 +2985,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A
 	[NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 },
 	[NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 },
 	[NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 },
+	[NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 },
 };
 
 static const struct nla_policy
@@ -3061,6 +3064,10 @@ do {\
 			dot11MeshHWMPRootMode, mask,
 			NL80211_MESHCONF_HWMP_ROOTMODE,
 			nla_get_u8);
+	FILL_IN_MESH_PARAM_IF_SET(tb, cfg,
+			dot11MeshHWMPRannInterval, mask,
+			NL80211_MESHCONF_HWMP_RANN_INTERVAL,
+			nla_get_u16);
 	if (mask_out)
 		*mask_out = mask;
 
-- 
1.7.6


  parent reply	other threads:[~2011-08-09 23:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 23:45 [PATCH 0/8] mac80211: add mesh gate forwarding Thomas Pedersen
2011-08-09 23:45 ` [PATCH 1/8] mac80211: improve mpath debugging Thomas Pedersen
2011-08-10 13:38   ` Johannes Berg
2011-08-10 20:11     ` Thomas Pedersen
2011-08-10 20:14       ` Johannes Berg
2011-08-10 20:40         ` Thomas Pedersen
2011-08-09 23:45 ` [PATCH 2/8] mac80211: fix mpath timer NULL function Thomas Pedersen
2011-08-10 13:39   ` Johannes Berg
2011-08-09 23:45 ` [PATCH 3/8] mac80211: mesh locking fixes Thomas Pedersen
2011-08-09 23:45 ` [PATCH 4/8] mac80211: fix mesh path flushing Thomas Pedersen
2011-08-09 23:45 ` [PATCH 5/8] mac80211: mesh gate implementation Thomas Pedersen
2011-08-10 13:41   ` Johannes Berg
2011-08-09 23:45 ` [PATCH 6/8] {nl,mac}80211: add missing root mode meshconf entries Thomas Pedersen
2011-08-09 23:45 ` Thomas Pedersen [this message]
2011-08-10 13:47   ` [PATCH 7/8] {nl,cfg,mac}80211: let userspace set RANN interval Johannes Berg
2011-08-09 23:45 ` [PATCH 8/8] {nl,cfg,mac}80211: let userspace make meshif mesh gate Thomas Pedersen
2011-08-10 13:47   ` Johannes Berg
2011-08-10 21:31     ` Thomas Pedersen
2011-08-12  9:31       ` Johannes Berg
2011-08-12 19:00         ` Thomas Pedersen
2011-08-12 19:03           ` Johannes Berg
2011-08-12 19:26             ` Javier Cardona
2011-08-12  2:53 ` [PATCH v2 1/8] mac80211: improve mpath debugging Thomas Pedersen
2011-08-12  2:53   ` [PATCH v2 2/8] mac80211: fix mpath timer removal Thomas Pedersen
2011-08-12  2:53   ` [PATCH v2 3/8] mac80211: mesh locking fixes Thomas Pedersen
2011-08-12  2:53   ` [PATCH v2 4/8] mac80211: fix mesh path flushing Thomas Pedersen
2011-08-12  2:53   ` [PATCH v2 5/8] mac80211: mesh gate implementation Thomas Pedersen
2011-08-12  2:53   ` [PATCH v2 6/8] {nl,mac}80211: add missing root mode debugfs entries Thomas Pedersen
2011-08-12  2:54   ` [PATCH v2 7/8] {nl,cfg,mac}80211: let userspace set RANN interval Thomas Pedersen
2011-08-12  2:54   ` [PATCH v2 8/8] {nl,cfg,mac}80211: let userspace make meshif mesh gate Thomas Pedersen
2011-08-12 12:28   ` [PATCH v2 1/8] mac80211: improve mpath debugging Johannes Berg
2011-08-12 18:12     ` Thomas Pedersen
2011-08-22 18:34       ` John W. Linville
2011-08-22 21:57         ` Thomas Pedersen
  -- strict thread matches above, loose matches on Subject: below --
2011-08-25  1:21 [PATCH 0/8] FIXUP: mesh gates Thomas Pedersen
2011-08-25  1:21 ` [PATCH 7/8] {nl,cfg,mac}80211: let userspace set RANN interval Thomas Pedersen

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=1312933511-9486-8-git-send-email-thomas@cozybit.com \
    --to=thomas@cozybit.com \
    --cc=javier@cozybit.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).