]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt792x: extend mt76_connac_mcu_uni_add_dev for per-link BSS
authorSean Wang <sean.wang@mediatek.com>
Thu, 13 Jun 2024 03:01:59 +0000 (20:01 -0700)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jul 2024 21:01:48 +0000 (23:01 +0200)
Extend mt76_connac_mcu_uni_add_dev with per-link BSS configuration.

The patch we created is a prerequisite to enable the MLO function in the
driver. It is purely a refactoring patch so the functionality should
remain unchanged.

We also extend link_idx field in mt76_connac_bss_basic_tlv for the firmware
to able to identify the link index in the MLO mode that is not harmful
for the current non-MLO mode.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20240613030241.5771-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7921/mac.c
drivers/net/wireless/mediatek/mt76/mt7921/main.c
drivers/net/wireless/mediatek/mt76/mt7925/mac.c
drivers/net/wireless/mediatek/mt76/mt7925/main.c
drivers/net/wireless/mediatek/mt76/mt792x_core.c

index c807bd8d928d64a69ed8ff5629bdb15de31aa462..792ae41f7c69b0a4b1470a2f1fdb3eb2d5d507c8 100644 (file)
@@ -1109,8 +1109,8 @@ mt7615_mcu_uni_add_dev(struct mt7615_phy *phy, struct ieee80211_vif *vif,
 {
        struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
 
-       return mt76_connac_mcu_uni_add_dev(phy->mt76, vif, &mvif->sta.wcid,
-                                          enable);
+       return mt76_connac_mcu_uni_add_dev(phy->mt76, &vif->bss_conf,
+                                          &mvif->sta.wcid, enable);
 }
 
 static int
index 162c57fb7954a06bdbb213c20aba57b453679ab1..a059532f383a1347e5da74a5b93f77de27c5d894 100644 (file)
@@ -1132,11 +1132,11 @@ void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev *dev, struct sk_buff *skb,
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_ba_tlv);
 
 int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
-                               struct ieee80211_vif *vif,
+                               struct ieee80211_bss_conf *bss_conf,
                                struct mt76_wcid *wcid,
                                bool enable)
 {
-       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+       struct mt76_vif *mvif = (struct mt76_vif *)bss_conf->vif->drv_priv;
        struct mt76_dev *dev = phy->dev;
        struct {
                struct {
@@ -1148,7 +1148,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
                        __le16 tag;
                        __le16 len;
                        u8 active;
-                       u8 pad;
+                       u8 link_idx; /* not link_id */
                        u8 omac_addr[ETH_ALEN];
                } __packed tlv;
        } dev_req = {
@@ -1160,6 +1160,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
                        .tag = cpu_to_le16(DEV_INFO_ACTIVE),
                        .len = cpu_to_le16(sizeof(struct req_tlv)),
                        .active = enable,
+                       .link_idx = mvif->idx,
                },
        };
        struct {
@@ -1182,12 +1183,13 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
                        .bmc_tx_wlan_idx = cpu_to_le16(wcid->idx),
                        .sta_idx = cpu_to_le16(wcid->idx),
                        .conn_state = 1,
+                       .link_idx = mvif->idx,
                },
        };
        int err, idx, cmd, len;
        void *data;
 
-       switch (vif->type) {
+       switch (bss_conf->vif->type) {
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_MONITOR:
        case NL80211_IFTYPE_AP:
@@ -1207,7 +1209,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
        idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx;
        basic_req.basic.hw_bss_idx = idx;
 
-       memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
+       memcpy(dev_req.tlv.omac_addr, bss_conf->vif->addr, ETH_ALEN);
 
        cmd = enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDATE);
        data = enable ? (void *)&dev_req : (void *)&basic_req;
index 6873ce14d299ddc2905fddc780c21b546fce4cd9..5c7c42c95de19d5d875f2e5a10f5d5e69d894f27 100644 (file)
@@ -1443,7 +1443,7 @@ struct mt76_connac_bss_basic_tlv {
        __le16 sta_idx;
        __le16 nonht_basic_phy;
        u8 phymode_ext; /* bit(0) AX_6G */
-       u8 pad[1];
+       u8 link_idx;
 } __packed;
 
 struct mt76_connac_bss_qos_tlv {
@@ -1917,7 +1917,7 @@ void mt76_connac_mcu_sta_ba_tlv(struct sk_buff *skb,
                                struct ieee80211_ampdu_params *params,
                                bool enable, bool tx);
 int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
-                               struct ieee80211_vif *vif,
+                               struct ieee80211_bss_conf *bss_conf,
                                struct mt76_wcid *wcid,
                                bool enable);
 int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
index 9ae9590999f41d1e4605420ca196e5b60a7e4c58..047106b65d2bc687e42363de5c8d91416791e6d3 100644 (file)
@@ -646,7 +646,8 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,
        if (vif->type == NL80211_IFTYPE_STATION)
                ieee80211_disconnect(vif, true);
 
-       mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true);
+       mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+                                   &mvif->sta.deflink.wcid, true);
        mt7921_mcu_set_tx(dev, vif);
 
        if (vif->type == NL80211_IFTYPE_AP) {
index 5dd9a7507f0b6b92d7b79138abb947eebeef83ef..2e6268cb06c002a129fbd5ddf552a6267b34de06 100644 (file)
@@ -306,8 +306,8 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
        mvif->bss_conf.mt76.band_idx = 0;
        mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
 
-       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid,
-                                         true);
+       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+                                         &mvif->sta.deflink.wcid, true);
        if (ret)
                goto out;
 
index 88e7b2ff459333e8c8085a3fe57dd032cc56dcd1..48425fc4e7fe879adf0c50c3b77e403b3f38a1dc 100644 (file)
@@ -1243,7 +1243,8 @@ mt7925_vif_connect_iter(void *priv, u8 *mac,
        if (vif->type == NL80211_IFTYPE_STATION)
                ieee80211_disconnect(vif, true);
 
-       mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true);
+       mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+                                   &mvif->sta.deflink.wcid, true);
        mt7925_mcu_set_tx(dev, vif);
 
        if (vif->type == NL80211_IFTYPE_AP) {
index 397776ddf01a3c0506fb66a3ad7d1afefb67be55..b0c8b090d2ceb3c0ba7d6f0f66e4983b4f266dba 100644 (file)
@@ -344,8 +344,8 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
        else
                mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL;
 
-       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid,
-                                         true);
+       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+                                         &mvif->sta.deflink.wcid, true);
        if (ret)
                goto out;
 
index 4d0e2def1c1db05d1e5430fa25e9a60659af1dd5..b1c51e3f39d0beaa0daf167447b688d0161f8f65 100644 (file)
@@ -124,7 +124,7 @@ void mt792x_remove_interface(struct ieee80211_hw *hw,
 
        mt792x_mutex_acquire(dev);
        mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid);
-       mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, false);
+       mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, &mvif->sta.deflink.wcid, false);
 
        rcu_assign_pointer(dev->mt76.wcid[idx], NULL);