aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c96
1 files changed, 79 insertions, 17 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 855126a3039d..91f56a48e2b4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -17,13 +17,6 @@
17#include "rate.h" 17#include "rate.h"
18#include "mesh.h" 18#include "mesh.h"
19 19
20struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy)
21{
22 struct ieee80211_local *local = wiphy_priv(wiphy);
23 return &local->hw;
24}
25EXPORT_SYMBOL(wiphy_to_hw);
26
27static bool nl80211_type_check(enum nl80211_iftype type) 20static bool nl80211_type_check(enum nl80211_iftype type)
28{ 21{
29 switch (type) { 22 switch (type) {
@@ -401,8 +394,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
401 */ 394 */
402 if (params->interval) { 395 if (params->interval) {
403 sdata->local->hw.conf.beacon_int = params->interval; 396 sdata->local->hw.conf.beacon_int = params->interval;
404 if (ieee80211_hw_config(sdata->local)) 397 ieee80211_hw_config(sdata->local,
405 return -EINVAL; 398 IEEE80211_CONF_CHANGE_BEACON_INTERVAL);
406 /* 399 /*
407 * We updated some parameter so if below bails out 400 * We updated some parameter so if below bails out
408 * it's not an error. 401 * it's not an error.
@@ -589,6 +582,8 @@ static void sta_apply_parameters(struct ieee80211_local *local,
589 struct ieee80211_supported_band *sband; 582 struct ieee80211_supported_band *sband;
590 struct ieee80211_sub_if_data *sdata = sta->sdata; 583 struct ieee80211_sub_if_data *sdata = sta->sdata;
591 584
585 sband = local->hw.wiphy->bands[local->oper_channel->band];
586
592 /* 587 /*
593 * FIXME: updating the flags is racy when this function is 588 * FIXME: updating the flags is racy when this function is
594 * called from ieee80211_change_station(), this will 589 * called from ieee80211_change_station(), this will
@@ -629,7 +624,6 @@ static void sta_apply_parameters(struct ieee80211_local *local,
629 624
630 if (params->supported_rates) { 625 if (params->supported_rates) {
631 rates = 0; 626 rates = 0;
632 sband = local->hw.wiphy->bands[local->oper_channel->band];
633 627
634 for (i = 0; i < params->supported_rates_len; i++) { 628 for (i = 0; i < params->supported_rates_len; i++) {
635 int rate = (params->supported_rates[i] & 0x7f) * 5; 629 int rate = (params->supported_rates[i] & 0x7f) * 5;
@@ -641,10 +635,10 @@ static void sta_apply_parameters(struct ieee80211_local *local,
641 sta->sta.supp_rates[local->oper_channel->band] = rates; 635 sta->sta.supp_rates[local->oper_channel->band] = rates;
642 } 636 }
643 637
644 if (params->ht_capa) { 638 if (params->ht_capa)
645 ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, 639 ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
646 &sta->sta.ht_info); 640 params->ht_capa,
647 } 641 &sta->sta.ht_cap);
648 642
649 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { 643 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
650 switch (params->plink_action) { 644 switch (params->plink_action) {
@@ -957,6 +951,72 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
957 rcu_read_unlock(); 951 rcu_read_unlock();
958 return 0; 952 return 0;
959} 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
960#endif 1020#endif
961 1021
962static int ieee80211_change_bss(struct wiphy *wiphy, 1022static int ieee80211_change_bss(struct wiphy *wiphy,
@@ -972,16 +1032,16 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
972 return -EINVAL; 1032 return -EINVAL;
973 1033
974 if (params->use_cts_prot >= 0) { 1034 if (params->use_cts_prot >= 0) {
975 sdata->bss_conf.use_cts_prot = params->use_cts_prot; 1035 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
976 changed |= BSS_CHANGED_ERP_CTS_PROT; 1036 changed |= BSS_CHANGED_ERP_CTS_PROT;
977 } 1037 }
978 if (params->use_short_preamble >= 0) { 1038 if (params->use_short_preamble >= 0) {
979 sdata->bss_conf.use_short_preamble = 1039 sdata->vif.bss_conf.use_short_preamble =
980 params->use_short_preamble; 1040 params->use_short_preamble;
981 changed |= BSS_CHANGED_ERP_PREAMBLE; 1041 changed |= BSS_CHANGED_ERP_PREAMBLE;
982 } 1042 }
983 if (params->use_short_slot_time >= 0) { 1043 if (params->use_short_slot_time >= 0) {
984 sdata->bss_conf.use_short_slot = 1044 sdata->vif.bss_conf.use_short_slot =
985 params->use_short_slot_time; 1045 params->use_short_slot_time;
986 changed |= BSS_CHANGED_ERP_SLOT; 1046 changed |= BSS_CHANGED_ERP_SLOT;
987 } 1047 }
@@ -1013,6 +1073,8 @@ struct cfg80211_ops mac80211_config_ops = {
1013 .change_mpath = ieee80211_change_mpath, 1073 .change_mpath = ieee80211_change_mpath,
1014 .get_mpath = ieee80211_get_mpath, 1074 .get_mpath = ieee80211_get_mpath,
1015 .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,
1016#endif 1078#endif
1017 .change_bss = ieee80211_change_bss, 1079 .change_bss = ieee80211_change_bss,
1018}; 1080};