aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorcolin@cozybit.com <colin@cozybit.com>2008-10-21 15:03:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:39 -0400
commit93da9cc17c5ae8a751886fd4732db89ad5e9bdb9 (patch)
tree5c8c16eaeca4c6e4555682a4ab1b448cdbe21595 /net/mac80211
parent4a68ec535ef1043319928f601d633f78e650a16f (diff)
Add nl80211 commands to get and set o11s mesh networking parameters
The two new commands are NL80211_CMD_GET_MESH_PARAMS and NL80211_CMD_SET_MESH_PARAMS. There is a new attribute enum, NL80211_ATTR_MESH_PARAMS, which enumerates the various mesh configuration parameters. Moved struct mesh_config from mac80211/ieee80211_i.h to net/cfg80211.h. nl80211_get_mesh_params and nl80211_set_mesh_params unpack the netlink messages and ask the driver to get or set the configuration. This is done via two new function stubs, get_mesh_params and set_mesh_params, in struct cfg80211_ops. Signed-off-by: Colin McCabe <colin@cozybit.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c68
-rw-r--r--net/mac80211/ieee80211_i.h21
2 files changed, 69 insertions, 20 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 55e3a26510ed..91f56a48e2b4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -951,6 +951,72 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
951 rcu_read_unlock(); 951 rcu_read_unlock();
952 return 0; 952 return 0;
953} 953}
954
955static int ieee80211_get_mesh_params(struct wiphy *wiphy,
956 struct net_device *dev,
957 struct mesh_config *conf)
958{
959 struct ieee80211_sub_if_data *sdata;
960 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
961
962 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
963 return -ENOTSUPP;
964 memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
965 return 0;
966}
967
968static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
969{
970 return (mask >> (parm-1)) & 0x1;
971}
972
973static int ieee80211_set_mesh_params(struct wiphy *wiphy,
974 struct net_device *dev,
975 const struct mesh_config *nconf, u32 mask)
976{
977 struct mesh_config *conf;
978 struct ieee80211_sub_if_data *sdata;
979 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
980
981 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
982 return -ENOTSUPP;
983
984 /* Set the config options which we are interested in setting */
985 conf = &(sdata->u.mesh.mshcfg);
986 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
987 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
988 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
989 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
990 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
991 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
992 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
993 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
994 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
995 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
996 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
997 conf->dot11MeshTTL = nconf->dot11MeshTTL;
998 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
999 conf->auto_open_plinks = nconf->auto_open_plinks;
1000 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
1001 conf->dot11MeshHWMPmaxPREQretries =
1002 nconf->dot11MeshHWMPmaxPREQretries;
1003 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
1004 conf->path_refresh_time = nconf->path_refresh_time;
1005 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
1006 conf->min_discovery_timeout = nconf->min_discovery_timeout;
1007 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
1008 conf->dot11MeshHWMPactivePathTimeout =
1009 nconf->dot11MeshHWMPactivePathTimeout;
1010 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1011 conf->dot11MeshHWMPpreqMinInterval =
1012 nconf->dot11MeshHWMPpreqMinInterval;
1013 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1014 mask))
1015 conf->dot11MeshHWMPnetDiameterTraversalTime =
1016 nconf->dot11MeshHWMPnetDiameterTraversalTime;
1017 return 0;
1018}
1019
954#endif 1020#endif
955 1021
956static int ieee80211_change_bss(struct wiphy *wiphy, 1022static int ieee80211_change_bss(struct wiphy *wiphy,
@@ -1007,6 +1073,8 @@ struct cfg80211_ops mac80211_config_ops = {
1007 .change_mpath = ieee80211_change_mpath, 1073 .change_mpath = ieee80211_change_mpath,
1008 .get_mpath = ieee80211_get_mpath, 1074 .get_mpath = ieee80211_get_mpath,
1009 .dump_mpath = ieee80211_dump_mpath, 1075 .dump_mpath = ieee80211_dump_mpath,
1076 .set_mesh_params = ieee80211_set_mesh_params,
1077 .get_mesh_params = ieee80211_get_mesh_params,
1010#endif 1078#endif
1011 .change_bss = ieee80211_change_bss, 1079 .change_bss = ieee80211_change_bss,
1012}; 1080};
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index fe4efdd4253d..2c91108e3901 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -23,6 +23,7 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
26#include <net/cfg80211.h>
26#include <net/wireless.h> 27#include <net/wireless.h>
27#include <net/iw_handler.h> 28#include <net/iw_handler.h>
28#include <net/mac80211.h> 29#include <net/mac80211.h>
@@ -247,26 +248,6 @@ struct mesh_preq_queue {
247 u8 flags; 248 u8 flags;
248}; 249};
249 250
250struct mesh_config {
251 /* Timeouts in ms */
252 /* Mesh plink management parameters */
253 u16 dot11MeshRetryTimeout;
254 u16 dot11MeshConfirmTimeout;
255 u16 dot11MeshHoldingTimeout;
256 u16 dot11MeshMaxPeerLinks;
257 u8 dot11MeshMaxRetries;
258 u8 dot11MeshTTL;
259 bool auto_open_plinks;
260 /* HWMP parameters */
261 u8 dot11MeshHWMPmaxPREQretries;
262 u32 path_refresh_time;
263 u16 min_discovery_timeout;
264 u32 dot11MeshHWMPactivePathTimeout;
265 u16 dot11MeshHWMPpreqMinInterval;
266 u16 dot11MeshHWMPnetDiameterTraversalTime;
267};
268
269
270/* flags used in struct ieee80211_if_sta.flags */ 251/* flags used in struct ieee80211_if_sta.flags */
271#define IEEE80211_STA_SSID_SET BIT(0) 252#define IEEE80211_STA_SSID_SET BIT(0)
272#define IEEE80211_STA_BSSID_SET BIT(1) 253#define IEEE80211_STA_BSSID_SET BIT(1)