aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r--net/mac80211/mesh.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index b5933b271491..b631703bcc82 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -39,14 +39,13 @@ void ieee80211s_stop(void)
39 * mesh_matches_local - check if the config of a mesh point matches ours 39 * mesh_matches_local - check if the config of a mesh point matches ours
40 * 40 *
41 * @ie: information elements of a management frame from the mesh peer 41 * @ie: information elements of a management frame from the mesh peer
42 * @dev: local mesh interface 42 * @sdata: local mesh subif
43 * 43 *
44 * This function checks if the mesh configuration of a mesh point matches the 44 * This function checks if the mesh configuration of a mesh point matches the
45 * local mesh configuration, i.e. if both nodes belong to the same mesh network. 45 * local mesh configuration, i.e. if both nodes belong to the same mesh network.
46 */ 46 */
47bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev) 47bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata)
48{ 48{
49 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
50 struct ieee80211_if_sta *sta = &sdata->u.sta; 49 struct ieee80211_if_sta *sta = &sdata->u.sta;
51 50
52 /* 51 /*
@@ -73,10 +72,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev)
73 * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links 72 * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links
74 * 73 *
75 * @ie: information elements of a management frame from the mesh peer 74 * @ie: information elements of a management frame from the mesh peer
76 * @dev: local mesh interface
77 */ 75 */
78bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie, 76bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
79 struct net_device *dev)
80{ 77{
81 return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0; 78 return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0;
82} 79}
@@ -111,9 +108,8 @@ void mesh_ids_set_default(struct ieee80211_if_sta *sta)
111 memcpy(sta->mesh_cc_id, def_id, 4); 108 memcpy(sta->mesh_cc_id, def_id, 4);
112} 109}
113 110
114int mesh_rmc_init(struct net_device *dev) 111int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
115{ 112{
116 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
117 int i; 113 int i;
118 114
119 sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); 115 sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL);
@@ -125,9 +121,8 @@ int mesh_rmc_init(struct net_device *dev)
125 return 0; 121 return 0;
126} 122}
127 123
128void mesh_rmc_free(struct net_device *dev) 124void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
129{ 125{
130 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
131 struct mesh_rmc *rmc = sdata->u.sta.rmc; 126 struct mesh_rmc *rmc = sdata->u.sta.rmc;
132 struct rmc_entry *p, *n; 127 struct rmc_entry *p, *n;
133 int i; 128 int i;
@@ -158,9 +153,8 @@ void mesh_rmc_free(struct net_device *dev)
158 * it. 153 * it.
159 */ 154 */
160int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, 155int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
161 struct net_device *dev) 156 struct ieee80211_sub_if_data *sdata)
162{ 157{
163 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
164 struct mesh_rmc *rmc = sdata->u.sta.rmc; 158 struct mesh_rmc *rmc = sdata->u.sta.rmc;
165 u32 seqnum = 0; 159 u32 seqnum = 0;
166 int entries = 0; 160 int entries = 0;
@@ -194,10 +188,9 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
194 return 0; 188 return 0;
195} 189}
196 190
197void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev) 191void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
198{ 192{
199 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 193 struct ieee80211_local *local = sdata->local;
200 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
201 struct ieee80211_supported_band *sband; 194 struct ieee80211_supported_band *sband;
202 u8 *pos; 195 u8 *pos;
203 int len, i, rate; 196 int len, i, rate;
@@ -262,10 +255,10 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev)
262 return; 255 return;
263} 256}
264 257
265u32 mesh_table_hash(u8 *addr, struct net_device *dev, struct mesh_table *tbl) 258u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, struct mesh_table *tbl)
266{ 259{
267 /* Use last four bytes of hw addr and interface index as hash index */ 260 /* Use last four bytes of hw addr and interface index as hash index */
268 return jhash_2words(*(u32 *)(addr+2), dev->ifindex, tbl->hash_rnd) 261 return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, tbl->hash_rnd)
269 & tbl->hash_mask; 262 & tbl->hash_mask;
270} 263}
271 264
@@ -434,7 +427,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
434 ifsta->preq_id = 0; 427 ifsta->preq_id = 0;
435 ifsta->dsn = 0; 428 ifsta->dsn = 0;
436 atomic_set(&ifsta->mpaths, 0); 429 atomic_set(&ifsta->mpaths, 0);
437 mesh_rmc_init(sdata->dev); 430 mesh_rmc_init(sdata);
438 ifsta->last_preq = jiffies; 431 ifsta->last_preq = jiffies;
439 /* Allocate all mesh structures when creating the first mesh interface. */ 432 /* Allocate all mesh structures when creating the first mesh interface. */
440 if (!mesh_allocated) 433 if (!mesh_allocated)