Skip to content

Commit 86c051f

Browse files
moore-brosnbd168
authored andcommitted
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>
1 parent 67e9847 commit 86c051f

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h

+1
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ enum {
14021402
MT_NIC_CAP_WFDMA_REALLOC,
14031403
MT_NIC_CAP_6G,
14041404
MT_NIC_CAP_CHIP_CAP = 0x20,
1405+
MT_NIC_CAP_EML_CAP = 0x22,
14051406
};
14061407

14071408
#define UNI_WOW_DETECT_TYPE_MAGIC BIT(0)

drivers/net/wireless/mediatek/mt76/mt7925/init.c

+6
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ static void mt7925_init_work(struct work_struct *work)
179179
mt76_set_stream_caps(&dev->mphy, true);
180180
mt7925_set_stream_he_eht_caps(&dev->phy);
181181

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+
182188
ret = mt76_register_device(&dev->mt76, true, mt76_rates,
183189
ARRAY_SIZE(mt76_rates));
184190
if (ret) {

drivers/net/wireless/mediatek/mt76/mt7925/main.c

+29
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,35 @@ mt7925_init_eht_caps(struct mt792x_phy *phy, enum nl80211_band band,
236236
eht_nss->bw._160.rx_tx_mcs13_max_nss = val;
237237
}
238238

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+
239268
static void
240269
__mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy,
241270
struct ieee80211_supported_band *sband,

drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

+20
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,20 @@ mt7925_mcu_parse_phy_cap(struct mt792x_dev *dev, char *data)
751751
dev->has_eht = cap->eht;
752752
}
753753

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+
754768
static int
755769
mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
756770
{
@@ -805,6 +819,12 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
805819
case MT_NIC_CAP_PHY:
806820
mt7925_mcu_parse_phy_cap(dev, tlv->data);
807821
break;
822+
case MT_NIC_CAP_CHIP_CAP:
823+
memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64));
824+
break;
825+
case MT_NIC_CAP_EML_CAP:
826+
mt7925_mcu_parse_eml_cap(dev, tlv->data);
827+
break;
808828
default:
809829
break;
810830
}

drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
235235
struct sk_buff *skb, u32 *info);
236236
void mt7925_stats_work(struct work_struct *work);
237237
void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy);
238+
int mt7925_init_mlo_caps(struct mt792x_phy *phy);
238239
int mt7925_init_debugfs(struct mt792x_dev *dev);
239240

240241
int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,

drivers/net/wireless/mediatek/mt76/mt792x.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0)
2929
#define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1)
30+
#define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2)
3031

3132
/* NOTE: used to map mt76_rates. idx may change if firmware expands table */
3233
#define MT792x_BASIC_RATES_TBL 11
@@ -163,6 +164,7 @@ struct mt792x_phy {
163164
#endif
164165
void *clc[MT792x_CLC_MAX_NUM];
165166
u64 chip_cap;
167+
u16 eml_cap;
166168

167169
struct work_struct roc_work;
168170
struct timer_list roc_timer;

0 commit comments

Comments
 (0)