aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@gmail.com>2009-11-09 18:46:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-13 17:43:57 -0500
commit63c5723bc3af8d4e86984dd4ff0c78218de418d0 (patch)
treefe900ef2a92377c49c6b3124bb5741a1ac04d436
parente304bfd30f356f7b75d30cad0029ecca705fd590 (diff)
mac80211: add nl80211/cfg80211 handling of the new mesh root mode option.
Signed-off-by: Rui Paulo <rpaulo@gmail.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Reviewed-by: Andrey Yurovsky <andrey@cozybit.com> Tested-by: Brian Cavagnolo <brian@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h3
-rw-r--r--include/net/cfg80211.h1
-rw-r--r--net/mac80211/cfg.c7
-rw-r--r--net/mac80211/debugfs_netdev.c2
-rw-r--r--net/mac80211/mesh.c13
-rw-r--r--net/mac80211/mesh.h1
-rw-r--r--net/wireless/nl80211.c6
7 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 7a0bd6ea6f63..d2f276de9abe 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1200,6 +1200,8 @@ enum nl80211_mntr_flags {
1200 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) 1200 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
1201 * that it takes for an HWMP information element to propagate across the mesh 1201 * that it takes for an HWMP information element to propagate across the mesh
1202 * 1202 *
1203 * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not
1204 *
1203 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 1205 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
1204 * 1206 *
1205 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 1207 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -1219,6 +1221,7 @@ enum nl80211_meshconf_params {
1219 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, 1221 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
1220 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 1222 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
1221 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 1223 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1224 NL80211_MESHCONF_HWMP_ROOTMODE,
1222 1225
1223 /* keep last */ 1226 /* keep last */
1224 __NL80211_MESHCONF_ATTR_AFTER_LAST, 1227 __NL80211_MESHCONF_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7d0ae9c18286..0e4c51fc63e5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -508,6 +508,7 @@ struct mesh_config {
508 u32 dot11MeshHWMPactivePathTimeout; 508 u32 dot11MeshHWMPactivePathTimeout;
509 u16 dot11MeshHWMPpreqMinInterval; 509 u16 dot11MeshHWMPpreqMinInterval;
510 u16 dot11MeshHWMPnetDiameterTraversalTime; 510 u16 dot11MeshHWMPnetDiameterTraversalTime;
511 u8 dot11MeshHWMPRootMode;
511}; 512};
512 513
513/** 514/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 81053587e72b..7f18c8fa1880 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1029,7 +1029,10 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1029{ 1029{
1030 struct mesh_config *conf; 1030 struct mesh_config *conf;
1031 struct ieee80211_sub_if_data *sdata; 1031 struct ieee80211_sub_if_data *sdata;
1032 struct ieee80211_if_mesh *ifmsh;
1033
1032 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1034 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1035 ifmsh = &sdata->u.mesh;
1033 1036
1034 /* Set the config options which we are interested in setting */ 1037 /* Set the config options which we are interested in setting */
1035 conf = &(sdata->u.mesh.mshcfg); 1038 conf = &(sdata->u.mesh.mshcfg);
@@ -1064,6 +1067,10 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1064 mask)) 1067 mask))
1065 conf->dot11MeshHWMPnetDiameterTraversalTime = 1068 conf->dot11MeshHWMPnetDiameterTraversalTime =
1066 nconf->dot11MeshHWMPnetDiameterTraversalTime; 1069 nconf->dot11MeshHWMPnetDiameterTraversalTime;
1070 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE, mask)) {
1071 conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode;
1072 ieee80211_mesh_root_setup(ifmsh);
1073 }
1067 return 0; 1074 return 0;
1068} 1075}
1069 1076
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 8782264f49e7..472b2039906c 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -149,6 +149,8 @@ IEEE80211_IF_FILE(path_refresh_time,
149 u.mesh.mshcfg.path_refresh_time, DEC); 149 u.mesh.mshcfg.path_refresh_time, DEC);
150IEEE80211_IF_FILE(min_discovery_timeout, 150IEEE80211_IF_FILE(min_discovery_timeout,
151 u.mesh.mshcfg.min_discovery_timeout, DEC); 151 u.mesh.mshcfg.min_discovery_timeout, DEC);
152IEEE80211_IF_FILE(dot11MeshHWMPRootMode,
153 u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC);
152#endif 154#endif
153 155
154 156
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 88dcfe3030b1..05955dc6b3d3 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -373,6 +373,17 @@ static void ieee80211_mesh_path_root_timer(unsigned long data)
373 ieee80211_queue_work(&local->hw, &ifmsh->work); 373 ieee80211_queue_work(&local->hw, &ifmsh->work);
374} 374}
375 375
376void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh)
377{
378 if (ifmsh->mshcfg.dot11MeshHWMPRootMode)
379 set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
380 else {
381 clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
382 /* stop running timer */
383 del_timer_sync(&ifmsh->mesh_path_root_timer);
384 }
385}
386
376/** 387/**
377 * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame 388 * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
378 * @hdr: 802.11 frame header 389 * @hdr: 802.11 frame header
@@ -503,6 +514,7 @@ void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata)
503 add_timer(&ifmsh->mesh_path_timer); 514 add_timer(&ifmsh->mesh_path_timer);
504 if (test_and_clear_bit(TMR_RUNNING_MPR, &ifmsh->timers_running)) 515 if (test_and_clear_bit(TMR_RUNNING_MPR, &ifmsh->timers_running))
505 add_timer(&ifmsh->mesh_path_root_timer); 516 add_timer(&ifmsh->mesh_path_root_timer);
517 ieee80211_mesh_root_setup(ifmsh);
506} 518}
507#endif 519#endif
508 520
@@ -512,6 +524,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
512 struct ieee80211_local *local = sdata->local; 524 struct ieee80211_local *local = sdata->local;
513 525
514 set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags); 526 set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags);
527 ieee80211_mesh_root_setup(ifmsh);
515 ieee80211_queue_work(&local->hw, &ifmsh->work); 528 ieee80211_queue_work(&local->hw, &ifmsh->work);
516 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; 529 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
517 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | 530 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 00ee84258196..5ad6975bf28c 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -242,6 +242,7 @@ ieee80211_rx_result
242ieee80211_mesh_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 242ieee80211_mesh_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
243void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); 243void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
244void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata); 244void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata);
245void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh);
245 246
246/* Mesh paths */ 247/* Mesh paths */
247int mesh_nexthop_lookup(struct sk_buff *skb, 248int mesh_nexthop_lookup(struct sk_buff *skb,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 7c1999872503..17bcad69428d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2616,6 +2616,8 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,
2616 cur_params.dot11MeshHWMPpreqMinInterval); 2616 cur_params.dot11MeshHWMPpreqMinInterval);
2617 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 2617 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
2618 cur_params.dot11MeshHWMPnetDiameterTraversalTime); 2618 cur_params.dot11MeshHWMPnetDiameterTraversalTime);
2619 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE,
2620 cur_params.dot11MeshHWMPRootMode);
2619 nla_nest_end(msg, pinfoattr); 2621 nla_nest_end(msg, pinfoattr);
2620 genlmsg_end(msg, hdr); 2622 genlmsg_end(msg, hdr);
2621 err = genlmsg_reply(msg, info); 2623 err = genlmsg_reply(msg, info);
@@ -2726,6 +2728,10 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info)
2726 dot11MeshHWMPnetDiameterTraversalTime, 2728 dot11MeshHWMPnetDiameterTraversalTime,
2727 mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 2729 mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
2728 nla_get_u16); 2730 nla_get_u16);
2731 FILL_IN_MESH_PARAM_IF_SET(tb, cfg,
2732 dot11MeshHWMPRootMode, mask,
2733 NL80211_MESHCONF_HWMP_ROOTMODE,
2734 nla_get_u8);
2729 2735
2730 /* Apply changes */ 2736 /* Apply changes */
2731 err = rdev->ops->set_mesh_params(&rdev->wiphy, dev, &cfg, mask); 2737 err = rdev->ops->set_mesh_params(&rdev->wiphy, dev, &cfg, mask);