diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-12-03 03:20:44 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-06 16:01:29 -0500 |
commit | 29cbe68c516a48a9a88b3226878570c6cbd83c02 (patch) | |
tree | 4774f8a3a244236234a521baa4d1ae5b3e1494ba /net/mac80211/cfg.c | |
parent | bd90fdcc5fbd99a2a778999610420cf793bd1be2 (diff) |
cfg80211/mac80211: add mesh join/leave commands
Instead of tying mesh activity to interface up,
add join and leave commands for mesh. Since we
must be backward compatible, let cfg80211 handle
joining a mesh if a mesh ID was pre-configured
when the device goes up.
Note that this therefore must modify mac80211 as
well since mac80211 needs to lose the logic to
start the mesh on interface up.
We now allow querying mesh parameters before the
mesh is connected, which simply returns defaults.
Setting them (internally renamed to "update") is
only allowed while connected. Specify them with
the new mesh join command instead where needed.
In mac80211, beaconing must now also follow the
mesh enabled/not enabled state, which is done
by testing the mesh ID.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d34c7c3dd762..68329d713c02 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -60,11 +60,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
60 | if (ret) | 60 | if (ret) |
61 | return ret; | 61 | return ret; |
62 | 62 | ||
63 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) | ||
64 | ieee80211_sdata_set_mesh_id(sdata, | ||
65 | params->mesh_id_len, | ||
66 | params->mesh_id); | ||
67 | |||
68 | if (type == NL80211_IFTYPE_AP_VLAN && | 63 | if (type == NL80211_IFTYPE_AP_VLAN && |
69 | params && params->use_4addr == 0) | 64 | params && params->use_4addr == 0) |
70 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); | 65 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); |
@@ -1003,9 +998,9 @@ static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask) | |||
1003 | return (mask >> (parm-1)) & 0x1; | 998 | return (mask >> (parm-1)) & 0x1; |
1004 | } | 999 | } |
1005 | 1000 | ||
1006 | static int ieee80211_set_mesh_params(struct wiphy *wiphy, | 1001 | static int ieee80211_update_mesh_params(struct wiphy *wiphy, |
1007 | struct net_device *dev, | 1002 | struct net_device *dev, u32 mask, |
1008 | const struct mesh_config *nconf, u32 mask) | 1003 | const struct mesh_config *nconf) |
1009 | { | 1004 | { |
1010 | struct mesh_config *conf; | 1005 | struct mesh_config *conf; |
1011 | struct ieee80211_sub_if_data *sdata; | 1006 | struct ieee80211_sub_if_data *sdata; |
@@ -1056,6 +1051,30 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy, | |||
1056 | return 0; | 1051 | return 0; |
1057 | } | 1052 | } |
1058 | 1053 | ||
1054 | static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, | ||
1055 | const struct mesh_config *conf, | ||
1056 | const struct mesh_setup *setup) | ||
1057 | { | ||
1058 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1059 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
1060 | |||
1061 | memcpy(&sdata->u.mesh.mshcfg, conf, sizeof(struct mesh_config)); | ||
1062 | ifmsh->mesh_id_len = setup->mesh_id_len; | ||
1063 | memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); | ||
1064 | |||
1065 | ieee80211_start_mesh(sdata); | ||
1066 | |||
1067 | return 0; | ||
1068 | } | ||
1069 | |||
1070 | static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) | ||
1071 | { | ||
1072 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1073 | |||
1074 | ieee80211_stop_mesh(sdata); | ||
1075 | |||
1076 | return 0; | ||
1077 | } | ||
1059 | #endif | 1078 | #endif |
1060 | 1079 | ||
1061 | static int ieee80211_change_bss(struct wiphy *wiphy, | 1080 | static int ieee80211_change_bss(struct wiphy *wiphy, |
@@ -1760,8 +1779,10 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1760 | .change_mpath = ieee80211_change_mpath, | 1779 | .change_mpath = ieee80211_change_mpath, |
1761 | .get_mpath = ieee80211_get_mpath, | 1780 | .get_mpath = ieee80211_get_mpath, |
1762 | .dump_mpath = ieee80211_dump_mpath, | 1781 | .dump_mpath = ieee80211_dump_mpath, |
1763 | .set_mesh_params = ieee80211_set_mesh_params, | 1782 | .update_mesh_params = ieee80211_update_mesh_params, |
1764 | .get_mesh_params = ieee80211_get_mesh_params, | 1783 | .get_mesh_params = ieee80211_get_mesh_params, |
1784 | .join_mesh = ieee80211_join_mesh, | ||
1785 | .leave_mesh = ieee80211_leave_mesh, | ||
1765 | #endif | 1786 | #endif |
1766 | .change_bss = ieee80211_change_bss, | 1787 | .change_bss = ieee80211_change_bss, |
1767 | .set_txq_params = ieee80211_set_txq_params, | 1788 | .set_txq_params = ieee80211_set_txq_params, |