diff options
author | Javier Cardona <javier@cozybit.com> | 2011-08-09 19:45:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-24 13:59:43 -0400 |
commit | 0507e159a2b590666982b53ecf6fb2843a5bb423 (patch) | |
tree | a5c0aefae3ea789fb1b0ef9019372e534b93aecc | |
parent | 699403dbd41998a56d1d92d612ac261e5085a99f (diff) |
{nl,cfg,mac}80211: let userspace set RANN interval
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 4 | ||||
-rw-r--r-- | include/net/cfg80211.h | 1 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 4 | ||||
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 3 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 3 | ||||
-rw-r--r-- | net/mac80211/mesh.h | 1 | ||||
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 8 | ||||
-rw-r--r-- | net/wireless/mesh.c | 2 | ||||
-rw-r--r-- | 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 89dec16b4697..20353bb44840 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -1861,6 +1861,9 @@ enum nl80211_mntr_flags { | |||
1861 | * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a | 1861 | * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a |
1862 | * source mesh point for path selection elements. | 1862 | * source mesh point for path selection elements. |
1863 | * | 1863 | * |
1864 | * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between | ||
1865 | * root announcements are transmitted. | ||
1866 | * | ||
1864 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | 1867 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute |
1865 | * | 1868 | * |
1866 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 1869 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
@@ -1882,6 +1885,7 @@ enum nl80211_meshconf_params { | |||
1882 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | 1885 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, |
1883 | NL80211_MESHCONF_HWMP_ROOTMODE, | 1886 | NL80211_MESHCONF_HWMP_ROOTMODE, |
1884 | NL80211_MESHCONF_ELEMENT_TTL, | 1887 | NL80211_MESHCONF_ELEMENT_TTL, |
1888 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | ||
1885 | 1889 | ||
1886 | /* keep last */ | 1890 | /* keep last */ |
1887 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 1891 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d29d11a31f5a..4f0d12e349d1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -755,6 +755,7 @@ struct mesh_config { | |||
755 | u16 dot11MeshHWMPpreqMinInterval; | 755 | u16 dot11MeshHWMPpreqMinInterval; |
756 | u16 dot11MeshHWMPnetDiameterTraversalTime; | 756 | u16 dot11MeshHWMPnetDiameterTraversalTime; |
757 | u8 dot11MeshHWMPRootMode; | 757 | u8 dot11MeshHWMPRootMode; |
758 | u16 dot11MeshHWMPRannInterval; | ||
758 | }; | 759 | }; |
759 | 760 | ||
760 | /** | 761 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c1fa5775cef2..9995c83c2420 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1137,6 +1137,10 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1137 | conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode; | 1137 | conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode; |
1138 | ieee80211_mesh_root_setup(ifmsh); | 1138 | ieee80211_mesh_root_setup(ifmsh); |
1139 | } | 1139 | } |
1140 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) { | ||
1141 | conf->dot11MeshHWMPRannInterval = | ||
1142 | nconf->dot11MeshHWMPRannInterval; | ||
1143 | } | ||
1140 | return 0; | 1144 | return 0; |
1141 | } | 1145 | } |
1142 | 1146 | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 75ece3d3b6dd..bac94434a874 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -372,6 +372,8 @@ IEEE80211_IF_FILE(min_discovery_timeout, | |||
372 | u.mesh.mshcfg.min_discovery_timeout, DEC); | 372 | u.mesh.mshcfg.min_discovery_timeout, DEC); |
373 | IEEE80211_IF_FILE(dot11MeshHWMPRootMode, | 373 | IEEE80211_IF_FILE(dot11MeshHWMPRootMode, |
374 | u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC); | 374 | u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC); |
375 | IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, | ||
376 | u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); | ||
375 | #endif | 377 | #endif |
376 | 378 | ||
377 | 379 | ||
@@ -486,6 +488,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata) | |||
486 | MESHPARAMS_ADD(path_refresh_time); | 488 | MESHPARAMS_ADD(path_refresh_time); |
487 | MESHPARAMS_ADD(min_discovery_timeout); | 489 | MESHPARAMS_ADD(min_discovery_timeout); |
488 | MESHPARAMS_ADD(dot11MeshHWMPRootMode); | 490 | MESHPARAMS_ADD(dot11MeshHWMPRootMode); |
491 | MESHPARAMS_ADD(dot11MeshHWMPRannInterval); | ||
489 | #undef MESHPARAMS_ADD | 492 | #undef MESHPARAMS_ADD |
490 | } | 493 | } |
491 | #endif | 494 | #endif |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e120fefb4e40..1c4f53c31ae5 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) | |||
537 | 537 | ||
538 | mesh_path_tx_root_frame(sdata); | 538 | mesh_path_tx_root_frame(sdata); |
539 | mod_timer(&ifmsh->mesh_path_root_timer, | 539 | mod_timer(&ifmsh->mesh_path_root_timer, |
540 | round_jiffies(jiffies + IEEE80211_MESH_RANN_INTERVAL)); | 540 | round_jiffies(jiffies + |
541 | usecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPRannInterval * 1024))); | ||
541 | } | 542 | } |
542 | 543 | ||
543 | #ifdef CONFIG_PM | 544 | #ifdef CONFIG_PM |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 9d9116e1a9ac..20272072171f 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -175,7 +175,6 @@ struct mesh_rmc { | |||
175 | 175 | ||
176 | #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) | 176 | #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) |
177 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) | 177 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) |
178 | #define IEEE80211_MESH_RANN_INTERVAL (1 * HZ) | ||
179 | 178 | ||
180 | #define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */ | 179 | #define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */ |
181 | 180 | ||
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 7b517c46100d..ae3de755fada 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -695,7 +695,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
695 | u8 ttl, flags, hopcount; | 695 | u8 ttl, flags, hopcount; |
696 | u8 *orig_addr; | 696 | u8 *orig_addr; |
697 | u32 orig_sn, metric; | 697 | u32 orig_sn, metric; |
698 | u32 interval = cpu_to_le32(IEEE80211_MESH_RANN_INTERVAL); | 698 | u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; |
699 | bool root_is_gate; | 699 | bool root_is_gate; |
700 | 700 | ||
701 | ttl = rann->rann_ttl; | 701 | ttl = rann->rann_ttl; |
@@ -743,7 +743,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
743 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, | 743 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, |
744 | cpu_to_le32(orig_sn), | 744 | cpu_to_le32(orig_sn), |
745 | 0, NULL, 0, broadcast_addr, | 745 | 0, NULL, 0, broadcast_addr, |
746 | hopcount, ttl, interval, | 746 | hopcount, ttl, cpu_to_le32(interval), |
747 | cpu_to_le32(metric + mpath->metric), | 747 | cpu_to_le32(metric + mpath->metric), |
748 | 0, sdata); | 748 | 0, sdata); |
749 | mpath->sn = orig_sn; | 749 | mpath->sn = orig_sn; |
@@ -1044,11 +1044,11 @@ void | |||
1044 | mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata) | 1044 | mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata) |
1045 | { | 1045 | { |
1046 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 1046 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
1047 | u32 interval = cpu_to_le32(IEEE80211_MESH_RANN_INTERVAL); | 1047 | u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; |
1048 | 1048 | ||
1049 | mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr, | 1049 | mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr, |
1050 | cpu_to_le32(++ifmsh->sn), | 1050 | cpu_to_le32(++ifmsh->sn), |
1051 | 0, NULL, 0, broadcast_addr, | 1051 | 0, NULL, 0, broadcast_addr, |
1052 | 0, sdata->u.mesh.mshcfg.element_ttl, | 1052 | 0, sdata->u.mesh.mshcfg.element_ttl, |
1053 | interval, 0, 0, sdata); | 1053 | cpu_to_le32(interval), 0, 0, sdata); |
1054 | } | 1054 | } |
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 5c116083eeca..b5a39d4d1dcf 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #define MESH_HOLD_T 100 | 12 | #define MESH_HOLD_T 100 |
13 | 13 | ||
14 | #define MESH_PATH_TIMEOUT 5000 | 14 | #define MESH_PATH_TIMEOUT 5000 |
15 | #define MESH_RANN_INTERVAL 5000 | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Minimum interval between two consecutive PREQs originated by the same | 18 | * Minimum interval between two consecutive PREQs originated by the same |
@@ -49,6 +50,7 @@ const struct mesh_config default_mesh_config = { | |||
49 | .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES, | 50 | .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES, |
50 | .path_refresh_time = MESH_PATH_REFRESH_TIME, | 51 | .path_refresh_time = MESH_PATH_REFRESH_TIME, |
51 | .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, | 52 | .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, |
53 | .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL, | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | const struct mesh_setup default_mesh_setup = { | 56 | const struct mesh_setup default_mesh_setup = { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 93ee888b1059..bbf3d7384a6b 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3035,6 +3035,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, | |||
3035 | cur_params.dot11MeshHWMPnetDiameterTraversalTime); | 3035 | cur_params.dot11MeshHWMPnetDiameterTraversalTime); |
3036 | NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, | 3036 | NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, |
3037 | cur_params.dot11MeshHWMPRootMode); | 3037 | cur_params.dot11MeshHWMPRootMode); |
3038 | NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_RANN_INTERVAL, | ||
3039 | cur_params.dot11MeshHWMPRannInterval); | ||
3038 | nla_nest_end(msg, pinfoattr); | 3040 | nla_nest_end(msg, pinfoattr); |
3039 | genlmsg_end(msg, hdr); | 3041 | genlmsg_end(msg, hdr); |
3040 | return genlmsg_reply(msg, info); | 3042 | return genlmsg_reply(msg, info); |
@@ -3063,6 +3065,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A | |||
3063 | [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 }, | 3065 | [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 }, |
3064 | [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, | 3066 | [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, |
3065 | [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, | 3067 | [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, |
3068 | [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, | ||
3066 | }; | 3069 | }; |
3067 | 3070 | ||
3068 | static const struct nla_policy | 3071 | static const struct nla_policy |
@@ -3141,6 +3144,10 @@ do {\ | |||
3141 | dot11MeshHWMPRootMode, mask, | 3144 | dot11MeshHWMPRootMode, mask, |
3142 | NL80211_MESHCONF_HWMP_ROOTMODE, | 3145 | NL80211_MESHCONF_HWMP_ROOTMODE, |
3143 | nla_get_u8); | 3146 | nla_get_u8); |
3147 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, | ||
3148 | dot11MeshHWMPRannInterval, mask, | ||
3149 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | ||
3150 | nla_get_u16); | ||
3144 | if (mask_out) | 3151 | if (mask_out) |
3145 | *mask_out = mask; | 3152 | *mask_out = mask; |
3146 | 3153 | ||