Skip to content

Commit c85fb53

Browse files
bcopelandjmberg-intel
authored andcommitted
mac80211: implement VHT support for mesh
Implement the basics required for supporting very high throughput with mesh: include VHT information elements in beacons, probe responses, and peering action frames, and check for compatible VHT configurations when peering. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent f020ae4 commit c85fb53

3 files changed

Lines changed: 85 additions & 4 deletions

File tree

‎net/mac80211/mesh.c‎

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
9494
ieee80211_ht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan,
9595
ie->ht_operation, &sta_chan_def);
9696

97+
ieee80211_vht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan,
98+
ie->vht_operation, &sta_chan_def);
99+
97100
if (!cfg80211_chandef_compatible(&sdata->vif.bss_conf.chandef,
98101
&sta_chan_def))
99102
return false;
@@ -436,8 +439,6 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
436439
struct ieee80211_local *local = sdata->local;
437440
struct ieee80211_chanctx_conf *chanctx_conf;
438441
struct ieee80211_channel *channel;
439-
enum nl80211_channel_type channel_type =
440-
cfg80211_get_chandef_type(&sdata->vif.bss_conf.chandef);
441442
struct ieee80211_supported_band *sband;
442443
struct ieee80211_sta_ht_cap *ht_cap;
443444
u8 *pos;
@@ -454,7 +455,10 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
454455
sband = local->hw.wiphy->bands[channel->band];
455456
ht_cap = &sband->ht_cap;
456457

457-
if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
458+
if (!ht_cap->ht_supported ||
459+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
460+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
461+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
458462
return 0;
459463

460464
if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_operation))
@@ -467,6 +471,68 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
467471
return 0;
468472
}
469473

474+
int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata,
475+
struct sk_buff *skb)
476+
{
477+
struct ieee80211_local *local = sdata->local;
478+
enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
479+
struct ieee80211_supported_band *sband;
480+
u8 *pos;
481+
482+
sband = local->hw.wiphy->bands[band];
483+
if (!sband->vht_cap.vht_supported ||
484+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
485+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
486+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
487+
return 0;
488+
489+
if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_vht_cap))
490+
return -ENOMEM;
491+
492+
pos = skb_put(skb, 2 + sizeof(struct ieee80211_vht_cap));
493+
ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, sband->vht_cap.cap);
494+
495+
return 0;
496+
}
497+
498+
int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata,
499+
struct sk_buff *skb)
500+
{
501+
struct ieee80211_local *local = sdata->local;
502+
struct ieee80211_chanctx_conf *chanctx_conf;
503+
struct ieee80211_channel *channel;
504+
struct ieee80211_supported_band *sband;
505+
struct ieee80211_sta_vht_cap *vht_cap;
506+
u8 *pos;
507+
508+
rcu_read_lock();
509+
chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
510+
if (WARN_ON(!chanctx_conf)) {
511+
rcu_read_unlock();
512+
return -EINVAL;
513+
}
514+
channel = chanctx_conf->def.chan;
515+
rcu_read_unlock();
516+
517+
sband = local->hw.wiphy->bands[channel->band];
518+
vht_cap = &sband->vht_cap;
519+
520+
if (!vht_cap->vht_supported ||
521+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
522+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
523+
sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
524+
return 0;
525+
526+
if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_vht_operation))
527+
return -ENOMEM;
528+
529+
pos = skb_put(skb, 2 + sizeof(struct ieee80211_vht_operation));
530+
ieee80211_ie_build_vht_oper(pos, vht_cap,
531+
&sdata->vif.bss_conf.chandef);
532+
533+
return 0;
534+
}
535+
470536
static void ieee80211_mesh_path_timer(unsigned long data)
471537
{
472538
struct ieee80211_sub_if_data *sdata =
@@ -637,6 +703,8 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
637703
2 + ifmsh->mesh_id_len +
638704
2 + sizeof(struct ieee80211_meshconf_ie) +
639705
2 + sizeof(__le16) + /* awake window */
706+
2 + sizeof(struct ieee80211_vht_cap) +
707+
2 + sizeof(struct ieee80211_vht_operation) +
640708
ifmsh->ie_len;
641709

642710
bcn = kzalloc(sizeof(*bcn) + head_len + tail_len, GFP_KERNEL);
@@ -718,6 +786,8 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
718786
mesh_add_meshid_ie(sdata, skb) ||
719787
mesh_add_meshconf_ie(sdata, skb) ||
720788
mesh_add_awake_window_ie(sdata, skb) ||
789+
mesh_add_vht_cap_ie(sdata, skb) ||
790+
mesh_add_vht_oper_ie(sdata, skb) ||
721791
mesh_add_vendor_ies(sdata, skb))
722792
goto out_free;
723793

‎net/mac80211/mesh.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
227227
struct sk_buff *skb);
228228
int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
229229
struct sk_buff *skb);
230+
int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata,
231+
struct sk_buff *skb);
232+
int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata,
233+
struct sk_buff *skb);
230234
void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
231235
int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
232236
void ieee80211s_init(void);

‎net/mac80211/mesh_plink.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
226226
2 + sizeof(struct ieee80211_meshconf_ie) +
227227
2 + sizeof(struct ieee80211_ht_cap) +
228228
2 + sizeof(struct ieee80211_ht_operation) +
229+
2 + sizeof(struct ieee80211_vht_cap) +
230+
2 + sizeof(struct ieee80211_vht_operation) +
229231
2 + 8 + /* peering IE */
230232
sdata->u.mesh.ie_len);
231233
if (!skb)
@@ -306,7 +308,9 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
306308

307309
if (action != WLAN_SP_MESH_PEERING_CLOSE) {
308310
if (mesh_add_ht_cap_ie(sdata, skb) ||
309-
mesh_add_ht_oper_ie(sdata, skb))
311+
mesh_add_ht_oper_ie(sdata, skb) ||
312+
mesh_add_vht_cap_ie(sdata, skb) ||
313+
mesh_add_vht_oper_ie(sdata, skb))
310314
goto free;
311315
}
312316

@@ -402,6 +406,9 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
402406
elems->ht_cap_elem, sta))
403407
changed |= IEEE80211_RC_BW_CHANGED;
404408

409+
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
410+
elems->vht_cap_elem, sta);
411+
405412
if (bw != sta->sta.bandwidth)
406413
changed |= IEEE80211_RC_BW_CHANGED;
407414

0 commit comments

Comments
 (0)