Commit 176f36086e8a00bdf701dc6e4c5a8784ef6529df

Authored by Thomas Pedersen
Committed by John W. Linville
1 parent 42e7aa7711

mac80211: add HT IEs to mesh frames

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Ashok Nagarajan <anagar6@uic.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 4 changed files with 60 additions and 0 deletions Side-by-side Diff

... ... @@ -341,6 +341,49 @@
341 341 return 0;
342 342 }
343 343  
  344 +int mesh_add_ht_cap_ie(struct sk_buff *skb,
  345 + struct ieee80211_sub_if_data *sdata)
  346 +{
  347 + struct ieee80211_local *local = sdata->local;
  348 + struct ieee80211_supported_band *sband;
  349 + u8 *pos;
  350 +
  351 + sband = local->hw.wiphy->bands[local->oper_channel->band];
  352 + if (!sband->ht_cap.ht_supported ||
  353 + local->_oper_channel_type == NL80211_CHAN_NO_HT)
  354 + return 0;
  355 +
  356 + if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
  357 + return -ENOMEM;
  358 +
  359 + pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
  360 + ieee80211_ie_build_ht_cap(pos, sband, sband->ht_cap.cap);
  361 +
  362 + return 0;
  363 +}
  364 +
  365 +int mesh_add_ht_info_ie(struct sk_buff *skb,
  366 + struct ieee80211_sub_if_data *sdata)
  367 +{
  368 + struct ieee80211_local *local = sdata->local;
  369 + struct ieee80211_channel *channel = local->oper_channel;
  370 + enum nl80211_channel_type channel_type = local->_oper_channel_type;
  371 + struct ieee80211_supported_band *sband =
  372 + local->hw.wiphy->bands[channel->band];
  373 + struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
  374 + u8 *pos;
  375 +
  376 + if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
  377 + return 0;
  378 +
  379 + if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_info))
  380 + return -ENOMEM;
  381 +
  382 + pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_info));
  383 + ieee80211_ie_build_ht_info(pos, ht_cap, channel, channel_type);
  384 +
  385 + return 0;
  386 +}
344 387 static void ieee80211_mesh_path_timer(unsigned long data)
345 388 {
346 389 struct ieee80211_sub_if_data *sdata =
... ... @@ -212,6 +212,10 @@
212 212 struct ieee80211_sub_if_data *sdata);
213 213 int mesh_add_ds_params_ie(struct sk_buff *skb,
214 214 struct ieee80211_sub_if_data *sdata);
  215 +int mesh_add_ht_cap_ie(struct sk_buff *skb,
  216 + struct ieee80211_sub_if_data *sdata);
  217 +int mesh_add_ht_info_ie(struct sk_buff *skb,
  218 + struct ieee80211_sub_if_data *sdata);
215 219 void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
216 220 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
217 221 void ieee80211s_init(void);
net/mac80211/mesh_plink.c
... ... @@ -169,6 +169,8 @@
169 169 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
170 170 2 + sdata->u.mesh.mesh_id_len +
171 171 2 + sizeof(struct ieee80211_meshconf_ie) +
  172 + 2 + sizeof(struct ieee80211_ht_cap) +
  173 + 2 + sizeof(struct ieee80211_ht_info) +
172 174 2 + 8 + /* peering IE */
173 175 sdata->u.mesh.ie_len);
174 176 if (!skb)
... ... @@ -241,6 +243,13 @@
241 243 memcpy(pos, &reason, 2);
242 244 pos += 2;
243 245 }
  246 +
  247 + if (action != WLAN_SP_MESH_PEERING_CLOSE) {
  248 + if (mesh_add_ht_cap_ie(skb, sdata) ||
  249 + mesh_add_ht_info_ie(skb, sdata))
  250 + return -1;
  251 + }
  252 +
244 253 if (mesh_add_vendor_ies(skb, sdata))
245 254 return -1;
246 255  
... ... @@ -2292,6 +2292,8 @@
2292 2292 2 + 8 + /* supported rates */
2293 2293 2 + 3 + /* DS params */
2294 2294 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
  2295 + 2 + sizeof(struct ieee80211_ht_cap) +
  2296 + 2 + sizeof(struct ieee80211_ht_info) +
2295 2297 2 + sdata->u.mesh.mesh_id_len +
2296 2298 2 + sizeof(struct ieee80211_meshconf_ie) +
2297 2299 sdata->u.mesh.ie_len);
... ... @@ -2319,6 +2321,8 @@
2319 2321 mesh_add_ds_params_ie(skb, sdata) ||
2320 2322 ieee80211_add_ext_srates_ie(&sdata->vif, skb) ||
2321 2323 mesh_add_rsn_ie(skb, sdata) ||
  2324 + mesh_add_ht_cap_ie(skb, sdata) ||
  2325 + mesh_add_ht_info_ie(skb, sdata) ||
2322 2326 mesh_add_meshid_ie(skb, sdata) ||
2323 2327 mesh_add_meshconf_ie(skb, sdata) ||
2324 2328 mesh_add_vendor_ies(skb, sdata)) {