Skip to content

Commit

Permalink
wifi: mt76: mt7925: enabling MLO when the firmware supports it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sean Wang authored and Felix Fietkau committed Jul 9, 2024
1 parent 67e9847 commit 86c051f
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,7 @@ enum {
MT_NIC_CAP_WFDMA_REALLOC,
MT_NIC_CAP_6G,
MT_NIC_CAP_CHIP_CAP = 0x20,
MT_NIC_CAP_EML_CAP = 0x22,
};

#define UNI_WOW_DETECT_TYPE_MAGIC BIT(0)
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7925/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ static void mt7925_init_work(struct work_struct *work)
mt76_set_stream_caps(&dev->mphy, true);
mt7925_set_stream_he_eht_caps(&dev->phy);

ret = mt7925_init_mlo_caps(&dev->phy);
if (ret) {
dev_err(dev->mt76.dev, "MLO init failed\n");
return;
}

ret = mt76_register_device(&dev->mt76, true, mt76_rates,
ARRAY_SIZE(mt76_rates));
if (ret) {
Expand Down
29 changes: 29 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7925/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,35 @@ mt7925_init_eht_caps(struct mt792x_phy *phy, enum nl80211_band band,
eht_nss->bw._160.rx_tx_mcs13_max_nss = val;
}

int mt7925_init_mlo_caps(struct mt792x_phy *phy)
{
struct wiphy *wiphy = phy->mt76->hw->wiphy;
static const u8 ext_capa_sta[] = {
[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
};
static struct wiphy_iftype_ext_capab ext_capab[] = {
{
.iftype = NL80211_IFTYPE_STATION,
.extended_capabilities = ext_capa_sta,
.extended_capabilities_mask = ext_capa_sta,
.extended_capabilities_len = sizeof(ext_capa_sta),
},
};

if (!(phy->chip_cap & MT792x_CHIP_CAP_MLO_EVT_EN))
return 0;

ext_capab[0].eml_capabilities = phy->eml_cap;
ext_capab[0].mld_capa_and_ops =
u16_encode_bits(1, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);

wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
wiphy->iftype_ext_capab = ext_capab;
wiphy->num_iftype_ext_capab = ARRAY_SIZE(ext_capab);

return 0;
}

static void
__mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy,
struct ieee80211_supported_band *sband,
Expand Down
20 changes: 20 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,20 @@ mt7925_mcu_parse_phy_cap(struct mt792x_dev *dev, char *data)
dev->has_eht = cap->eht;
}

static void
mt7925_mcu_parse_eml_cap(struct mt792x_dev *dev, char *data)
{
struct mt7925_mcu_eml_cap {
u8 rsv[4];
__le16 eml_cap;
u8 rsv2[6];
} __packed * cap;

cap = (struct mt7925_mcu_eml_cap *)data;

dev->phy.eml_cap = le16_to_cpu(cap->eml_cap);
}

static int
mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
{
Expand Down Expand Up @@ -805,6 +819,12 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
case MT_NIC_CAP_PHY:
mt7925_mcu_parse_phy_cap(dev, tlv->data);
break;
case MT_NIC_CAP_CHIP_CAP:
memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64));
break;
case MT_NIC_CAP_EML_CAP:
mt7925_mcu_parse_eml_cap(dev, tlv->data);
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
struct sk_buff *skb, u32 *info);
void mt7925_stats_work(struct work_struct *work);
void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy);
int mt7925_init_mlo_caps(struct mt792x_phy *phy);
int mt7925_init_debugfs(struct mt792x_dev *dev);

int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt792x.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0)
#define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1)
#define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2)

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

struct work_struct roc_work;
struct timer_list roc_timer;
Expand Down

0 comments on commit 86c051f

Please sign in to comment.