From: Ryder Lee <ryder.lee@mediatek.com>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
Josh Boyer <jwboyer@kernel.org>,
Sean Wang <sean.wang@mediatek.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, Roy Luo <royluo@google.com>,
Shayne Chen <shayne.chen@mediatek.com>
Subject: [PATCH v2 5/7] mt76: mt7615: use new tag sta_rec_wtbl
Date: Sat, 1 Feb 2020 23:33:50 +0800 [thread overview]
Message-ID: <dd9cb430c3c3a6baa843663bc1478dc72dd7f188.1580565624.git.ryder.lee@mediatek.com> (raw)
In-Reply-To: <cover.1580565624.git.ryder.lee@mediatek.com>
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>
---
.../net/wireless/mediatek/mt76/mt7615/mcu.c | 22 +++++++++++++++++++
.../net/wireless/mediatek/mt76/mt7615/mcu.h | 8 ++++---
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index ce70e2c03956..58eac8fe5511 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -1045,6 +1045,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;
@@ -1052,6 +1053,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;
@@ -1085,6 +1093,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);
}
@@ -1113,6 +1124,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;
@@ -1176,6 +1188,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;
@@ -1271,6 +1290,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);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
index 8d057c72366a..0af5e519f712 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
@@ -506,9 +506,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,
@@ -523,6 +524,7 @@ enum {
STA_REC_HT,
STA_REC_VHT,
STA_REC_APPS,
+ STA_REC_WTBL = 13,
STA_REC_MAX_NUM
};
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2020-02-01 15:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-01 15:33 [PATCH v2 0/7] switch mt7615 MCU command format from v1 to v2 Ryder Lee
2020-02-01 15:33 ` [PATCH v2 1/7] mt76: mt7615: simplify mcu_set_bmc flow Ryder Lee
2020-02-01 15:33 ` [PATCH v2 2/7] mt76: mt7615: simplify mcu_set_sta flow Ryder Lee
2020-02-01 15:33 ` [PATCH v2 3/7] mt76: mt7615: add a helper to encapsulate sta_rec operation Ryder Lee
2020-02-01 15:33 ` [PATCH v2 4/7] mt76: mt7615: add starec operating flow for firmware v2 Ryder Lee
2020-02-01 15:33 ` Ryder Lee [this message]
2020-02-01 15:33 ` [PATCH v2 6/7] mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 format Ryder Lee
2020-02-01 15:33 ` [PATCH v2 7/7] mt76: mt7615: switch mt7615_mcu_set_rx_ba " Ryder Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd9cb430c3c3a6baa843663bc1478dc72dd7f188.1580565624.git.ryder.lee@mediatek.com \
--to=ryder.lee@mediatek.com \
--cc=jwboyer@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=royluo@google.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).