@@ -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+
470536static 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
0 commit comments