aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
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/cfg.c
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/cfg.c')
-rw-r--r--net/mac80211/cfg.c68
1 files changed, 68 insertions, 0 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};