diff options
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index db134b500caa..c30b8b72eedb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -19,9 +19,10 @@ | |||
19 | #include "rate.h" | 19 | #include "rate.h" |
20 | #include "mesh.h" | 20 | #include "mesh.h" |
21 | 21 | ||
22 | static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | 22 | static struct net_device *ieee80211_add_iface(struct wiphy *wiphy, char *name, |
23 | enum nl80211_iftype type, u32 *flags, | 23 | enum nl80211_iftype type, |
24 | struct vif_params *params) | 24 | u32 *flags, |
25 | struct vif_params *params) | ||
25 | { | 26 | { |
26 | struct ieee80211_local *local = wiphy_priv(wiphy); | 27 | struct ieee80211_local *local = wiphy_priv(wiphy); |
27 | struct net_device *dev; | 28 | struct net_device *dev; |
@@ -29,12 +30,15 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
29 | int err; | 30 | int err; |
30 | 31 | ||
31 | err = ieee80211_if_add(local, name, &dev, type, params); | 32 | err = ieee80211_if_add(local, name, &dev, type, params); |
32 | if (err || type != NL80211_IFTYPE_MONITOR || !flags) | 33 | if (err) |
33 | return err; | 34 | return ERR_PTR(err); |
34 | 35 | ||
35 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 36 | if (type == NL80211_IFTYPE_MONITOR && flags) { |
36 | sdata->u.mntr_flags = *flags; | 37 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
37 | return 0; | 38 | sdata->u.mntr_flags = *flags; |
39 | } | ||
40 | |||
41 | return dev; | ||
38 | } | 42 | } |
39 | 43 | ||
40 | static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) | 44 | static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) |
@@ -56,11 +60,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
56 | if (ret) | 60 | if (ret) |
57 | return ret; | 61 | return ret; |
58 | 62 | ||
59 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) | ||
60 | ieee80211_sdata_set_mesh_id(sdata, | ||
61 | params->mesh_id_len, | ||
62 | params->mesh_id); | ||
63 | |||
64 | if (type == NL80211_IFTYPE_AP_VLAN && | 63 | if (type == NL80211_IFTYPE_AP_VLAN && |
65 | params && params->use_4addr == 0) | 64 | params && params->use_4addr == 0) |
66 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); | 65 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); |
@@ -343,8 +342,9 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
343 | 342 | ||
344 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || | 343 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || |
345 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { | 344 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { |
346 | sinfo->filled |= STATION_INFO_SIGNAL; | 345 | sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; |
347 | sinfo->signal = (s8)sta->last_signal; | 346 | sinfo->signal = (s8)sta->last_signal; |
347 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | ||
348 | } | 348 | } |
349 | 349 | ||
350 | sinfo->txrate.flags = 0; | 350 | sinfo->txrate.flags = 0; |
@@ -999,9 +999,9 @@ static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask) | |||
999 | return (mask >> (parm-1)) & 0x1; | 999 | return (mask >> (parm-1)) & 0x1; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static int ieee80211_set_mesh_params(struct wiphy *wiphy, | 1002 | static int ieee80211_update_mesh_params(struct wiphy *wiphy, |
1003 | struct net_device *dev, | 1003 | struct net_device *dev, u32 mask, |
1004 | const struct mesh_config *nconf, u32 mask) | 1004 | const struct mesh_config *nconf) |
1005 | { | 1005 | { |
1006 | struct mesh_config *conf; | 1006 | struct mesh_config *conf; |
1007 | struct ieee80211_sub_if_data *sdata; | 1007 | struct ieee80211_sub_if_data *sdata; |
@@ -1024,6 +1024,8 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy, | |||
1024 | conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; | 1024 | conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; |
1025 | if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) | 1025 | if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) |
1026 | conf->dot11MeshTTL = nconf->dot11MeshTTL; | 1026 | conf->dot11MeshTTL = nconf->dot11MeshTTL; |
1027 | if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) | ||
1028 | conf->dot11MeshTTL = nconf->element_ttl; | ||
1027 | if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) | 1029 | if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) |
1028 | conf->auto_open_plinks = nconf->auto_open_plinks; | 1030 | conf->auto_open_plinks = nconf->auto_open_plinks; |
1029 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) | 1031 | if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) |
@@ -1050,6 +1052,30 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy, | |||
1050 | return 0; | 1052 | return 0; |
1051 | } | 1053 | } |
1052 | 1054 | ||
1055 | static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, | ||
1056 | const struct mesh_config *conf, | ||
1057 | const struct mesh_setup *setup) | ||
1058 | { | ||
1059 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1060 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
1061 | |||
1062 | memcpy(&sdata->u.mesh.mshcfg, conf, sizeof(struct mesh_config)); | ||
1063 | ifmsh->mesh_id_len = setup->mesh_id_len; | ||
1064 | memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); | ||
1065 | |||
1066 | ieee80211_start_mesh(sdata); | ||
1067 | |||
1068 | return 0; | ||
1069 | } | ||
1070 | |||
1071 | static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) | ||
1072 | { | ||
1073 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1074 | |||
1075 | ieee80211_stop_mesh(sdata); | ||
1076 | |||
1077 | return 0; | ||
1078 | } | ||
1053 | #endif | 1079 | #endif |
1054 | 1080 | ||
1055 | static int ieee80211_change_bss(struct wiphy *wiphy, | 1081 | static int ieee80211_change_bss(struct wiphy *wiphy, |
@@ -1108,6 +1134,12 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1108 | sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; | 1134 | sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; |
1109 | } | 1135 | } |
1110 | 1136 | ||
1137 | if (params->ht_opmode >= 0) { | ||
1138 | sdata->vif.bss_conf.ht_operation_mode = | ||
1139 | (u16) params->ht_opmode; | ||
1140 | changed |= BSS_CHANGED_HT; | ||
1141 | } | ||
1142 | |||
1111 | ieee80211_bss_info_change_notify(sdata, changed); | 1143 | ieee80211_bss_info_change_notify(sdata, changed); |
1112 | 1144 | ||
1113 | return 0; | 1145 | return 0; |
@@ -1754,8 +1786,10 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1754 | .change_mpath = ieee80211_change_mpath, | 1786 | .change_mpath = ieee80211_change_mpath, |
1755 | .get_mpath = ieee80211_get_mpath, | 1787 | .get_mpath = ieee80211_get_mpath, |
1756 | .dump_mpath = ieee80211_dump_mpath, | 1788 | .dump_mpath = ieee80211_dump_mpath, |
1757 | .set_mesh_params = ieee80211_set_mesh_params, | 1789 | .update_mesh_params = ieee80211_update_mesh_params, |
1758 | .get_mesh_params = ieee80211_get_mesh_params, | 1790 | .get_mesh_params = ieee80211_get_mesh_params, |
1791 | .join_mesh = ieee80211_join_mesh, | ||
1792 | .leave_mesh = ieee80211_leave_mesh, | ||
1759 | #endif | 1793 | #endif |
1760 | .change_bss = ieee80211_change_bss, | 1794 | .change_bss = ieee80211_change_bss, |
1761 | .set_txq_params = ieee80211_set_txq_params, | 1795 | .set_txq_params = ieee80211_set_txq_params, |