mt76: mt7615: use new tag sta_rec_wtbl
authorRyder Lee <ryder.lee@mediatek.com>
Sat, 1 Feb 2020 15:33:50 +0000 (23:33 +0800)
committerFelix Fietkau <nbd@nbd.name>
Fri, 14 Feb 2020 09:06:08 +0000 (10:06 +0100)
In order to reduce command/event times, newer firmware adds a tag
sta_rec_wtbl to take care of WTBL operations.

MCU_EXT_CMD_WTBL_UPDATE is deprecated.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.h

index 9cebf5797fcf229d4b03b49a73a919762218a855..72a3f9db7d21c37241627c4eafb613d499e195d1 100644 (file)
@@ -1174,6 +1174,7 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev,
                        .conn_type = cpu_to_le32(CONNECTION_INFRA_BC),
                },
        };
+       struct sta_rec_wtbl *wtbl = NULL;
        struct wtbl_req_hdr *wtbl_hdr;
        struct wtbl_generic *wtbl_g;
        struct wtbl_rx *wtbl_rx;
@@ -1181,6 +1182,13 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev,
 
        eth_broadcast_addr(req.basic.peer_addr);
 
+       if (dev->fw_ver > MT7615_FIRMWARE_V1) {
+               req.hdr.tlv_num = cpu_to_le16(2);
+               wtbl = (struct sta_rec_wtbl *)buf;
+               wtbl->tag = cpu_to_le16(STA_REC_WTBL);
+               buf += sizeof(*wtbl);
+       }
+
        wtbl_hdr = (struct wtbl_req_hdr *)buf;
        buf += sizeof(*wtbl_hdr);
        wtbl_hdr->wlan_idx = mvif->sta.wcid.idx;
@@ -1214,6 +1222,9 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev,
        wtbl_hdr->tlv_num = cpu_to_le16(2);
 
 out:
+       if (wtbl)
+               wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr);
+
        return mt7615_mcu_send_sta_rec(dev, (u8 *)&req, (u8 *)wtbl_hdr,
                                       buf - (u8 *)wtbl_hdr, en);
 }
@@ -1242,6 +1253,7 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif,
                        .aid = cpu_to_le16(sta->aid),
                },
        };
+       struct sta_rec_wtbl *wtbl = NULL;
        struct wtbl_req_hdr *wtbl_hdr;
        struct wtbl_generic *wtbl_g;
        struct wtbl_rx *wtbl_rx;
@@ -1305,6 +1317,13 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif,
        }
 
        /* wtbl */
+       if (dev->fw_ver > MT7615_FIRMWARE_V1) {
+               wtbl = (struct sta_rec_wtbl *)buf;
+               wtbl->tag = cpu_to_le16(STA_REC_WTBL);
+               buf += sizeof(*wtbl);
+               stlv++;
+       }
+
        wtbl_hdr = (struct wtbl_req_hdr *)buf;
        buf += sizeof(*wtbl_hdr);
        wtbl_hdr->wlan_idx = msta->wcid.idx;
@@ -1400,6 +1419,9 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif,
        }
 
 out:
+       if (wtbl)
+               wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr);
+
        wtbl_hdr->tlv_num = cpu_to_le16(wtlv);
        req.hdr.tlv_num = cpu_to_le16(stlv);
 
index 2fbfbdb2c53d938f6f5294680952a945d23fe211..db0199e60cb82a13bce76cdbb92c6be241e13f25 100644 (file)
@@ -565,9 +565,10 @@ struct sta_rec_ba {
        __le16 winsize;
 } __packed;
 
-#define MT7615_STA_REC_UPDATE_MAX_SIZE (sizeof(struct sta_rec_basic) + \
-                                       sizeof(struct sta_rec_ht) + \
-                                       sizeof(struct sta_rec_vht))
+struct sta_rec_wtbl {
+       __le16 tag;
+       __le16 len;
+} __packed;
 
 enum {
        STA_REC_BASIC,
@@ -582,6 +583,7 @@ enum {
        STA_REC_HT,
        STA_REC_VHT,
        STA_REC_APPS,
+       STA_REC_WTBL = 13,
        STA_REC_MAX_NUM
 };