@@ -152,10 +152,12 @@ mt7996_init_wiphy(struct ieee80211_hw *hw)
152152 struct mt7996_phy * phy = mt7996_hw_phy (hw );
153153 struct mt76_dev * mdev = & phy -> dev -> mt76 ;
154154 struct wiphy * wiphy = hw -> wiphy ;
155+ u16 max_subframes = phy -> dev -> has_eht ? IEEE80211_MAX_AMPDU_BUF_EHT :
156+ IEEE80211_MAX_AMPDU_BUF_HE ;
155157
156158 hw -> queues = 4 ;
157- hw -> max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE ;
158- hw -> max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE ;
159+ hw -> max_rx_aggregation_subframes = max_subframes ;
160+ hw -> max_tx_aggregation_subframes = max_subframes ;
159161 hw -> netdev_features = NETIF_F_RXCSUM ;
160162
161163 hw -> radiotap_timestamp .units_pos =
@@ -213,7 +215,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw)
213215
214216 mt76_set_stream_caps (phy -> mt76 , true);
215217 mt7996_set_stream_vht_txbf_caps (phy );
216- mt7996_set_stream_he_caps (phy );
218+ mt7996_set_stream_he_eht_caps (phy );
217219
218220 wiphy -> available_antennas_rx = phy -> mt76 -> antenna_mask ;
219221 wiphy -> available_antennas_tx = phy -> mt76 -> antenna_mask ;
@@ -699,9 +701,104 @@ mt7996_init_he_caps(struct mt7996_phy *phy, enum nl80211_band band,
699701}
700702
701703static void
702- __mt7996_set_stream_he_caps (struct mt7996_phy * phy ,
703- struct ieee80211_supported_band * sband ,
704- enum nl80211_band band )
704+ mt7996_init_eht_caps (struct mt7996_phy * phy , enum nl80211_band band ,
705+ struct ieee80211_sband_iftype_data * data ,
706+ enum nl80211_iftype iftype )
707+ {
708+ struct ieee80211_sta_eht_cap * eht_cap = & data -> eht_cap ;
709+ struct ieee80211_eht_cap_elem_fixed * eht_cap_elem = & eht_cap -> eht_cap_elem ;
710+ struct ieee80211_eht_mcs_nss_supp * eht_nss = & eht_cap -> eht_mcs_nss_supp ;
711+ enum nl80211_chan_width width = phy -> mt76 -> chandef .width ;
712+ int nss = hweight8 (phy -> mt76 -> antenna_mask );
713+ int sts = hweight16 (phy -> mt76 -> chainmask );
714+ u8 val ;
715+
716+ if (!phy -> dev -> has_eht )
717+ return ;
718+
719+ eht_cap -> has_eht = true;
720+
721+ eht_cap_elem -> mac_cap_info [0 ] =
722+ IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
723+ IEEE80211_EHT_MAC_CAP0_OM_CONTROL ;
724+
725+ eht_cap_elem -> phy_cap_info [0 ] =
726+ IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ |
727+ IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
728+ IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER |
729+ IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE ;
730+
731+ eht_cap_elem -> phy_cap_info [0 ] |=
732+ u8_encode_bits (u8_get_bits (sts - 1 , BIT (0 )),
733+ IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK );
734+
735+ eht_cap_elem -> phy_cap_info [1 ] =
736+ u8_encode_bits (u8_get_bits (sts - 1 , GENMASK (2 , 1 )),
737+ IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK ) |
738+ u8_encode_bits (sts - 1 ,
739+ IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK ) |
740+ u8_encode_bits (sts - 1 ,
741+ IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK );
742+
743+ eht_cap_elem -> phy_cap_info [2 ] =
744+ u8_encode_bits (sts - 1 , IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK ) |
745+ u8_encode_bits (sts - 1 , IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK ) |
746+ u8_encode_bits (sts - 1 , IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK );
747+
748+ eht_cap_elem -> phy_cap_info [3 ] =
749+ IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK |
750+ IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK |
751+ IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK |
752+ IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK |
753+ IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK |
754+ IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK |
755+ IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK ;
756+
757+ eht_cap_elem -> phy_cap_info [4 ] =
758+ u8_encode_bits (min_t (int , sts - 1 , 2 ),
759+ IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK );
760+
761+ eht_cap_elem -> phy_cap_info [5 ] =
762+ IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK |
763+ u8_encode_bits (IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US ,
764+ IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK ) |
765+ u8_encode_bits (u8_get_bits (0x11 , GENMASK (1 , 0 )),
766+ IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK );
767+
768+ val = width == NL80211_CHAN_WIDTH_320 ? 0xf :
769+ width == NL80211_CHAN_WIDTH_160 ? 0x7 :
770+ width == NL80211_CHAN_WIDTH_80 ? 0x3 : 0x1 ;
771+ eht_cap_elem -> phy_cap_info [6 ] =
772+ u8_encode_bits (u8_get_bits (0x11 , GENMASK (4 , 2 )),
773+ IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK ) |
774+ u8_encode_bits (val , IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK );
775+
776+ eht_cap_elem -> phy_cap_info [7 ] =
777+ IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ |
778+ IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ |
779+ IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ |
780+ IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ |
781+ IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ |
782+ IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ ;
783+
784+ val = u8_encode_bits (nss , IEEE80211_EHT_MCS_NSS_RX ) |
785+ u8_encode_bits (nss , IEEE80211_EHT_MCS_NSS_TX );
786+ #define SET_EHT_MAX_NSS (_bw , _val ) do { \
787+ eht_nss->bw._##_bw.rx_tx_mcs9_max_nss = _val; \
788+ eht_nss->bw._##_bw.rx_tx_mcs11_max_nss = _val; \
789+ eht_nss->bw._##_bw.rx_tx_mcs13_max_nss = _val; \
790+ } while (0)
791+
792+ SET_EHT_MAX_NSS (80 , val );
793+ SET_EHT_MAX_NSS (160 , val );
794+ SET_EHT_MAX_NSS (320 , val );
795+ #undef SET_EHT_MAX_NSS
796+ }
797+
798+ static void
799+ __mt7996_set_stream_he_eht_caps (struct mt7996_phy * phy ,
800+ struct ieee80211_supported_band * sband ,
801+ enum nl80211_band band )
705802{
706803 struct ieee80211_sband_iftype_data * data = phy -> iftype [band ];
707804 int i , n = 0 ;
@@ -720,6 +817,7 @@ __mt7996_set_stream_he_caps(struct mt7996_phy *phy,
720817
721818 data [n ].types_mask = BIT (i );
722819 mt7996_init_he_caps (phy , band , & data [n ], i );
820+ mt7996_init_eht_caps (phy , band , & data [n ], i );
723821
724822 n ++ ;
725823 }
@@ -728,19 +826,19 @@ __mt7996_set_stream_he_caps(struct mt7996_phy *phy,
728826 sband -> n_iftype_data = n ;
729827}
730828
731- void mt7996_set_stream_he_caps (struct mt7996_phy * phy )
829+ void mt7996_set_stream_he_eht_caps (struct mt7996_phy * phy )
732830{
733831 if (phy -> mt76 -> cap .has_2ghz )
734- __mt7996_set_stream_he_caps (phy , & phy -> mt76 -> sband_2g .sband ,
735- NL80211_BAND_2GHZ );
832+ __mt7996_set_stream_he_eht_caps (phy , & phy -> mt76 -> sband_2g .sband ,
833+ NL80211_BAND_2GHZ );
736834
737835 if (phy -> mt76 -> cap .has_5ghz )
738- __mt7996_set_stream_he_caps (phy , & phy -> mt76 -> sband_5g .sband ,
739- NL80211_BAND_5GHZ );
836+ __mt7996_set_stream_he_eht_caps (phy , & phy -> mt76 -> sband_5g .sband ,
837+ NL80211_BAND_5GHZ );
740838
741839 if (phy -> mt76 -> cap .has_6ghz )
742- __mt7996_set_stream_he_caps (phy , & phy -> mt76 -> sband_6g .sband ,
743- NL80211_BAND_6GHZ );
840+ __mt7996_set_stream_he_eht_caps (phy , & phy -> mt76 -> sband_6g .sband ,
841+ NL80211_BAND_6GHZ );
744842}
745843
746844int mt7996_register_device (struct mt7996_dev * dev )
0 commit comments