Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: mt76: mt7925: enabling MLO when the firmware supports it

Register MLD capability for the firmware supporting MLO.

Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/49c796b101e792c84bc2c0d74753022b75fd3355.1720248331.git.sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>

authored by

Sean Wang and committed by
Felix Fietkau
86c051f2 67e9847b

+59
+1
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
··· 1402 1402 MT_NIC_CAP_WFDMA_REALLOC, 1403 1403 MT_NIC_CAP_6G, 1404 1404 MT_NIC_CAP_CHIP_CAP = 0x20, 1405 + MT_NIC_CAP_EML_CAP = 0x22, 1405 1406 }; 1406 1407 1407 1408 #define UNI_WOW_DETECT_TYPE_MAGIC BIT(0)
+6
drivers/net/wireless/mediatek/mt76/mt7925/init.c
··· 179 179 mt76_set_stream_caps(&dev->mphy, true); 180 180 mt7925_set_stream_he_eht_caps(&dev->phy); 181 181 182 + ret = mt7925_init_mlo_caps(&dev->phy); 183 + if (ret) { 184 + dev_err(dev->mt76.dev, "MLO init failed\n"); 185 + return; 186 + } 187 + 182 188 ret = mt76_register_device(&dev->mt76, true, mt76_rates, 183 189 ARRAY_SIZE(mt76_rates)); 184 190 if (ret) {
+29
drivers/net/wireless/mediatek/mt76/mt7925/main.c
··· 236 236 eht_nss->bw._160.rx_tx_mcs13_max_nss = val; 237 237 } 238 238 239 + int mt7925_init_mlo_caps(struct mt792x_phy *phy) 240 + { 241 + struct wiphy *wiphy = phy->mt76->hw->wiphy; 242 + static const u8 ext_capa_sta[] = { 243 + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, 244 + }; 245 + static struct wiphy_iftype_ext_capab ext_capab[] = { 246 + { 247 + .iftype = NL80211_IFTYPE_STATION, 248 + .extended_capabilities = ext_capa_sta, 249 + .extended_capabilities_mask = ext_capa_sta, 250 + .extended_capabilities_len = sizeof(ext_capa_sta), 251 + }, 252 + }; 253 + 254 + if (!(phy->chip_cap & MT792x_CHIP_CAP_MLO_EVT_EN)) 255 + return 0; 256 + 257 + ext_capab[0].eml_capabilities = phy->eml_cap; 258 + ext_capab[0].mld_capa_and_ops = 259 + u16_encode_bits(1, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); 260 + 261 + wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; 262 + wiphy->iftype_ext_capab = ext_capab; 263 + wiphy->num_iftype_ext_capab = ARRAY_SIZE(ext_capab); 264 + 265 + return 0; 266 + } 267 + 239 268 static void 240 269 __mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy, 241 270 struct ieee80211_supported_band *sband,
+20
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
··· 751 751 dev->has_eht = cap->eht; 752 752 } 753 753 754 + static void 755 + mt7925_mcu_parse_eml_cap(struct mt792x_dev *dev, char *data) 756 + { 757 + struct mt7925_mcu_eml_cap { 758 + u8 rsv[4]; 759 + __le16 eml_cap; 760 + u8 rsv2[6]; 761 + } __packed * cap; 762 + 763 + cap = (struct mt7925_mcu_eml_cap *)data; 764 + 765 + dev->phy.eml_cap = le16_to_cpu(cap->eml_cap); 766 + } 767 + 754 768 static int 755 769 mt7925_mcu_get_nic_capability(struct mt792x_dev *dev) 756 770 { ··· 818 804 break; 819 805 case MT_NIC_CAP_PHY: 820 806 mt7925_mcu_parse_phy_cap(dev, tlv->data); 807 + break; 808 + case MT_NIC_CAP_CHIP_CAP: 809 + memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64)); 810 + break; 811 + case MT_NIC_CAP_EML_CAP: 812 + mt7925_mcu_parse_eml_cap(dev, tlv->data); 821 813 break; 822 814 default: 823 815 break;
+1
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
··· 235 235 struct sk_buff *skb, u32 *info); 236 236 void mt7925_stats_work(struct work_struct *work); 237 237 void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy); 238 + int mt7925_init_mlo_caps(struct mt792x_phy *phy); 238 239 int mt7925_init_debugfs(struct mt792x_dev *dev); 239 240 240 241 int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
+2
drivers/net/wireless/mediatek/mt76/mt792x.h
··· 27 27 28 28 #define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0) 29 29 #define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1) 30 + #define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2) 30 31 31 32 /* NOTE: used to map mt76_rates. idx may change if firmware expands table */ 32 33 #define MT792x_BASIC_RATES_TBL 11 ··· 164 163 #endif 165 164 void *clc[MT792x_CLC_MAX_NUM]; 166 165 u64 chip_cap; 166 + u16 eml_cap; 167 167 168 168 struct work_struct roc_work; 169 169 struct timer_list roc_timer;