[][MAC80211][mt76][Add vendor command attribute for RTS BW signaling for mt76.]
[Description]
Add vendor command attribute for RTS BW signaling for mt76.
Ref: WFA 11AC test case 4.2.59A
[Release-log]
Change-Id: Ide1547d2b00b3b4502259904d1f565bd085b2acb
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7069418
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1133-mt76-mt7915-Add-vendor-command-attribute-for-RTS-BW-.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1133-mt76-mt7915-Add-vendor-command-attribute-for-RTS-BW-.patch
new file mode 100644
index 0000000..4f92ace
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1133-mt76-mt7915-Add-vendor-command-attribute-for-RTS-BW-.patch
@@ -0,0 +1,100 @@
+From 3c943d4668b64ee1540e70707db0021b012d13da Mon Sep 17 00:00:00 2001
+From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
+Date: Tue, 24 Jan 2023 14:32:08 +0800
+Subject: [PATCH] mt76: mt7915: Add vendor command attribute for RTS BW
+ signaling.
+
+Signed-off-by: himanshu.goyal <himanshu.goyal@mediatek.com>
+---
+ mt7915/mcu.c | 6 ++++++
+ mt7915/mcu.h | 9 +++++++++
+ mt7915/vendor.c | 4 ++++
+ mt7915/vendor.h | 1 +
+ 4 files changed, 20 insertions(+)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 7954745..da3c004 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -4534,6 +4534,12 @@ int mt7915_mcu_set_cfg(struct mt7915_phy *phy, u8 cfg_info, u8 type)
+ req.cert.length = cpu_to_le16(tlv_len);
+ req.cert.cert_program = type;
+ break;
++ case CFGINFO_RTS_SIGTA_EN_FEATURE:
++ tlv_len = sizeof(struct rts_sigta_cfg);
++ req.rts_sigta.tag = cpu_to_le16(cfg_info);
++ req.rts_sigta.length = cpu_to_le16(tlv_len);
++ req.rts_sigta.enable = type ? 1: 0;
++ break;
+ case CFGINFO_3WIRE_EN_CFG:
+ tlv_len = sizeof(struct three_wire_cfg);
+ req.three_wire.tag = cpu_to_le16(cfg_info);
+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
+index 572cc16..b045578 100644
+--- a/mt7915/mcu.h
++++ b/mt7915/mcu.h
+@@ -868,6 +868,13 @@ struct three_wire_cfg {
+ u8 rsv[3];
+ } __packed;
+
++struct rts_sigta_cfg {
++ __le16 tag;
++ __le16 length;
++ bool enable; /* 0: Disable, 1: Enable */
++ u8 rsv[3];
++} __packed;
++
+ struct cfg_basic_info {
+ u8 dbdc_idx;
+ u8 rsv[3];
+@@ -875,11 +882,13 @@ struct cfg_basic_info {
+ union {
+ struct cert_cfg cert;
+ struct three_wire_cfg three_wire;
++ struct rts_sigta_cfg rts_sigta;
+ };
+ } __packed;
+
+ enum {
+ CFGINFO_CERT_CFG = 4,
++ CFGINFO_RTS_SIGTA_EN_FEATURE = 7,
+ CFGINFO_3WIRE_EN_CFG = 10,
+ };
+
+diff --git a/mt7915/vendor.c b/mt7915/vendor.c
+index a1f526c..b54fee7 100644
+--- a/mt7915/vendor.c
++++ b/mt7915/vendor.c
+@@ -33,6 +33,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU] = {.type = NLA_U8 },
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA] = {.type = NLA_U8 },
+ [MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT] = {.type = NLA_U8 },
++ [MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA] = {.type = NLA_U8 },
+ };
+
+ static const struct nla_policy
+@@ -992,6 +993,9 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) {
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]);
+ mt7915_set_wireless_amsdu(hw, val8);
++ } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA]) {
++ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA]);
++ mt7915_mcu_set_cfg(phy, CFGINFO_RTS_SIGTA_EN_FEATURE, val8);
+ }
+
+ return 0;
+diff --git a/mt7915/vendor.h b/mt7915/vendor.h
+index cbff910..41d6ff2 100644
+--- a/mt7915/vendor.h
++++ b/mt7915/vendor.h
+@@ -76,6 +76,7 @@ enum mtk_vendor_attr_wireless_ctrl {
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU,
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9,
++ MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA,
+
+ MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */
+ /* keep last */
+--
+2.18.0
+