summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_hwmp.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-07-21 19:38:22 +0000
committersam <sam@FreeBSD.org>2009-07-21 19:38:22 +0000
commit68cbb6a7463b70cec8d8a0cd9948339a98406099 (patch)
tree0f9e36b532861f65854a4eb56c1f537c203e5b91 /sys/net80211/ieee80211_hwmp.c
parente5dfb90bc39200659ab00a42b65e93605c31f968 (diff)
downloadFreeBSD-src-68cbb6a7463b70cec8d8a0cd9948339a98406099.zip
FreeBSD-src-68cbb6a7463b70cec8d8a0cd9948339a98406099.tar.gz
store mesh timers as ticks and sysctls for changing the defaults
Reviewed by: rpaulo Approved by: re (kib)
Diffstat (limited to 'sys/net80211/ieee80211_hwmp.c')
-rw-r--r--sys/net80211/ieee80211_hwmp.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c
index 41b119f..5ad0d41 100644
--- a/sys/net80211/ieee80211_hwmp.c
+++ b/sys/net80211/ieee80211_hwmp.c
@@ -116,24 +116,8 @@ static struct ieee80211_node *
const uint8_t [IEEE80211_ADDR_LEN], struct mbuf *);
static void hwmp_peerdown(struct ieee80211_node *);
-static int ieee80211_hwmp_targetonly = 0;
-static int ieee80211_hwmp_replyforward = 1;
-static const int ieee80211_hwmp_maxprepretries = 3;
-static const struct timeval ieee80211_hwmp_maxhopstime = { 0, 500000 };
-static const struct timeval ieee80211_hwmp_preqminint = { 0, 100000 };
-static const struct timeval ieee80211_hwmp_perrminint = { 0, 100000 };
-static const struct timeval ieee80211_hwmp_roottimeout = { 5, 0 };
-static const struct timeval ieee80211_hwmp_pathtimeout = { 5, 0 };
-static const struct timeval ieee80211_hwmp_pathtoroottimeout = { 5, 0 };
-static const struct timeval ieee80211_hwmp_rootint = { 2, 0 };
-static const struct timeval ieee80211_hwmp_rannint = { 1, 0 };
-static const struct timeval ieee80211_hwmp_pathmaintenanceint = { 2, 0 };
-static const struct timeval ieee80211_hwmp_confirmint = { 2, 0 };
-
-#define timeval2msecs(tv) (tv.tv_sec * 1000 + tv.tv_usec / 1000)
-
-#define HWMP_ROOTMODEINT msecs_to_ticks(timeval2msecs(ieee80211_hwmp_rootint))
-#define HWMP_RANNMODEINT msecs_to_ticks(timeval2msecs(ieee80211_hwmp_rannint))
+static struct timeval ieee80211_hwmp_preqminint = { 0, 100000 };
+static struct timeval ieee80211_hwmp_perrminint = { 0, 100000 };
/* unalligned little endian access */
#define LE_WRITE_2(p, v) do { \
@@ -176,10 +160,28 @@ struct ieee80211_hwmp_state {
SYSCTL_NODE(_net_wlan, OID_AUTO, hwmp, CTLFLAG_RD, 0,
"IEEE 802.11s HWMP parameters");
+static int ieee80211_hwmp_targetonly = 0;
SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, targetonly, CTLTYPE_INT | CTLFLAG_RW,
&ieee80211_hwmp_targetonly, 0, "Set TO bit on generated PREQs");
+static int ieee80211_hwmp_replyforward = 1;
SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, replyforward, CTLTYPE_INT | CTLFLAG_RW,
&ieee80211_hwmp_replyforward, 0, "Set RF bit on generated PREQs");
+static int ieee80211_hwmp_pathtimeout = -1;
+SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW,
+ &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I",
+ "path entry lifetime (ms)");
+static int ieee80211_hwmp_roottimeout = -1;
+SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, roottimeout, CTLTYPE_INT | CTLFLAG_RW,
+ &ieee80211_hwmp_roottimeout, 0, ieee80211_sysctl_msecs_ticks, "I",
+ "root PREQ timeout (ms)");
+static int ieee80211_hwmp_rootint = -1;
+SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rootint, CTLTYPE_INT | CTLFLAG_RW,
+ &ieee80211_hwmp_rootint, 0, ieee80211_sysctl_msecs_ticks, "I",
+ "root interval (ms)");
+static int ieee80211_hwmp_rannint = -1;
+SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rannint, CTLTYPE_INT | CTLFLAG_RW,
+ &ieee80211_hwmp_rannint, 0, ieee80211_sysctl_msecs_ticks, "I",
+ "root announcement interval (ms)");
#define IEEE80211_HWMP_DEFAULT_MAXHOPS 31
@@ -188,7 +190,7 @@ static ieee80211_recv_action_func hwmp_recv_action_meshpath_prep;
static ieee80211_recv_action_func hwmp_recv_action_meshpath_perr;
static ieee80211_recv_action_func hwmp_recv_action_meshpath_rann;
-static const struct ieee80211_mesh_proto_path mesh_proto_hwmp = {
+static struct ieee80211_mesh_proto_path mesh_proto_hwmp = {
.mpp_descr = "HWMP",
.mpp_ie = IEEE80211_MESHCONF_HWMP,
.mpp_discover = hwmp_discover,
@@ -197,14 +199,20 @@ static const struct ieee80211_mesh_proto_path mesh_proto_hwmp = {
.mpp_vdetach = hwmp_vdetach,
.mpp_newstate = hwmp_newstate,
.mpp_privlen = sizeof(struct ieee80211_hwmp_route),
- /* ieee80211_hwmp_pathtimeout */
- .mpp_inact = { 5, 0 },
};
+SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, inact, CTLTYPE_INT | CTLFLAG_RW,
+ &mesh_proto_hwmp.mpp_inact, 0, ieee80211_sysctl_msecs_ticks, "I",
+ "mesh route inactivity timeout (ms)");
static void
ieee80211_hwmp_init(void)
{
+ ieee80211_hwmp_pathtimeout = msecs_to_ticks(5*1000);
+ ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000);
+ ieee80211_hwmp_rootint = msecs_to_ticks(2*1000);
+ ieee80211_hwmp_rannint = msecs_to_ticks(1*1000);
+
/*
* Register action frame handlers.
*/
@@ -217,6 +225,9 @@ ieee80211_hwmp_init(void)
ieee80211_recv_action_register(IEEE80211_ACTION_CAT_MESHPATH,
IEEE80211_ACTION_MESHPATH_RANN, hwmp_recv_action_meshpath_rann);
+ /* NB: default is 5 secs per spec */
+ mesh_proto_hwmp.mpp_inact = msecs_to_ticks(5*1000);
+
/*
* Register HWMP.
*/
@@ -617,11 +628,11 @@ hwmp_rootmode_setup(struct ieee80211vap *vap)
break;
case IEEE80211_HWMP_ROOTMODE_NORMAL:
case IEEE80211_HWMP_ROOTMODE_PROACTIVE:
- callout_reset(&hs->hs_roottimer, HWMP_ROOTMODEINT,
+ callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rootint,
hwmp_rootmode_cb, vap);
break;
case IEEE80211_HWMP_ROOTMODE_RANN:
- callout_reset(&hs->hs_roottimer, HWMP_RANNMODEINT,
+ callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rannint,
hwmp_rootmode_rann_cb, vap);
break;
}
@@ -654,7 +665,7 @@ hwmp_rootmode_cb(void *arg)
preq.preq_id = ++hs->hs_preqid;
IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr);
preq.preq_origseq = ++hs->hs_seq;
- preq.preq_lifetime = timeval2msecs(ieee80211_hwmp_roottimeout);
+ preq.preq_lifetime = ticks_to_msecs(ieee80211_hwmp_roottimeout);
preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
preq.preq_tcount = 1;
IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr);
@@ -1297,7 +1308,7 @@ hwmp_discover(struct ieee80211vap *vap,
}
rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
rt->rt_lifetime =
- timeval2msecs(ieee80211_hwmp_pathtimeout);
+ ticks_to_msecs(ieee80211_hwmp_pathtimeout);
/* XXX check preq retries */
sendpreq = 1;
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest,
OpenPOWER on IntegriCloud