| From 57bf57c14c4fba7e0e5dd595fa7e36fa75ce96ea Mon Sep 17 00:00:00 2001 |
| From: MeiChia Chiu <meichia.chiu@mediatek.com> |
| Date: Mon, 14 Aug 2023 13:36:58 +0800 |
| Subject: [PATCH 037/193] mtk: mt76: mt7996: add cert patch |
| |
| This patch includes TGac and TGax |
| |
| Commit histroy: |
| |
| Add vendor cmd set ap wireless rts_sigta support |
| |
| In Wi-Fi 7 UCC, there are a command without a specified interface, |
| causing the AP to send trigger frames on only one link. When testing |
| EMLSR+OFDMA test cases (EHT-4.45.1), this results in the AP sending |
| trigger frames on only one link, leading to test failure. |
| Therefore, the band_bitmap is corrected to ensure that trigger frames are sent on all links. |
| |
| The UCC command specifies an interface: |
| ap_set_rfeature,NAME,Wi-Fi7APUT,Interface,5G,type,EHT,TriggerType,0, |
| Trigger_Variant,HE,PPDUTxType,legacy |
| |
| The UCC command does not specify an interface: |
| ap_set_rfeature,NAME,Wi-Fi7APUT,type,EHT,TriggerType,0,Trigger_Variant, |
| EHT,PPDUTxType,legacy |
| |
| Logan set the band_bitmap to 7 in Wi-Fi 7 regardless of whether the UCC |
| command specifies an interface. |
| |
| Change-Id: I9c2a04efa733a6de5c37a21ea71d9715edc27ddb |
| Signed-off-by: ye he <ye.he@mediatek.com> |
| Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com> |
| --- |
| mt7996/mac.c | 9 ++ |
| mt7996/main.c | 31 ++++++- |
| mt7996/mcu.c | 40 +++++++++ |
| mt7996/mcu.h | 6 ++ |
| mt7996/mt7996.h | 13 +++ |
| mt7996/mtk_mcu.c | 206 ++++++++++++++++++++++++++++++++++++++++++ |
| mt7996/mtk_mcu.h | 184 +++++++++++++++++++++++++++++++++++-- |
| mt7996/vendor.c | 230 ++++++++++++++++++++++++++++++++++++++++++++++- |
| mt7996/vendor.h | 67 ++++++++++++++ |
| 9 files changed, 779 insertions(+), 7 deletions(-) |
| |
| diff --git a/mt7996/mac.c b/mt7996/mac.c |
| index 2ce9e83..484f91a 100644 |
| --- a/mt7996/mac.c |
| +++ b/mt7996/mac.c |
| @@ -10,6 +10,7 @@ |
| #include "../dma.h" |
| #include "mac.h" |
| #include "mcu.h" |
| +#include "vendor.h" |
| |
| #define to_rssi(field, rcpi) ((FIELD_GET(field, rcpi) - 220) / 2) |
| |
| @@ -2296,6 +2297,14 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy) |
| } |
| } |
| |
| +void mt7996_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en) |
| +{ |
| + if (en) |
| + ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU); |
| + else |
| + ieee80211_hw_clear(hw, SUPPORTS_AMSDU_IN_AMPDU); |
| +} |
| + |
| void mt7996_mac_sta_rc_work(struct work_struct *work) |
| { |
| struct mt7996_dev *dev = container_of(work, struct mt7996_dev, rc_work); |
| diff --git a/mt7996/main.c b/mt7996/main.c |
| index 359ea91..dd9f2ca 100644 |
| --- a/mt7996/main.c |
| +++ b/mt7996/main.c |
| @@ -601,6 +601,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| bool beacon, bool mcast) |
| { |
| struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; |
| + struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| struct mt76_phy *mphy = hw->priv; |
| u16 rate; |
| u8 i, idx; |
| @@ -610,6 +611,9 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| if (beacon) { |
| struct mt7996_phy *phy = mphy->priv; |
| |
| + if (dev->cert_mode && phy->mt76->band_idx == MT_BAND2) |
| + rate = 0x0200; |
| + |
| /* odd index for driver, even index for firmware */ |
| idx = MT7996_BEACON_RATES_TBL + 2 * phy->mt76->band_idx; |
| if (phy->beacon_rate != rate) |
| @@ -737,6 +741,10 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
| u8 band_idx = mvif->phy->mt76->band_idx; |
| int ret, idx; |
| |
| +#ifdef CONFIG_MTK_VENDOR |
| + struct mt7996_phy *phy = &dev->phy; |
| +#endif |
| + |
| idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA); |
| if (idx < 0) |
| return -ENOSPC; |
| @@ -762,7 +770,28 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
| if (ret) |
| return ret; |
| |
| - return mt7996_mcu_add_rate_ctrl(dev, vif, sta, false); |
| + ret = mt7996_mcu_add_rate_ctrl(dev, vif, sta, false); |
| + if (ret) |
| + return ret; |
| + |
| +#ifdef CONFIG_MTK_VENDOR |
| + switch (band_idx) { |
| + case MT_BAND1: |
| + phy = mt7996_phy2(dev); |
| + break; |
| + case MT_BAND2: |
| + phy = mt7996_phy3(dev); |
| + break; |
| + case MT_BAND0: |
| + default: |
| + break; |
| + } |
| + |
| + if (phy && phy->muru_onoff & MUMIMO_DL_CERT) |
| + mt7996_mcu_set_mimo(phy); |
| +#endif |
| + |
| + return 0; |
| } |
| |
| void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
| diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| index f46afbe..1ec4229 100644 |
| --- a/mt7996/mcu.c |
| +++ b/mt7996/mcu.c |
| @@ -1362,6 +1362,10 @@ mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| { |
| struct sta_rec_vht *vht; |
| struct tlv *tlv; |
| +#ifdef CONFIG_MTK_VENDOR |
| + struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| + struct mt7996_phy *phy = (struct mt7996_phy *)msta->vif->phy; |
| +#endif |
| |
| /* For 6G band, this tlv is necessary to let hw work normally */ |
| if (!sta->deflink.he_6ghz_capa.capa && !sta->deflink.vht_cap.vht_supported) |
| @@ -1373,6 +1377,9 @@ mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); |
| vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; |
| vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; |
| +#ifdef CONFIG_MTK_VENDOR |
| + vht->rts_bw_sig = phy->rts_bw_sig; |
| +#endif |
| } |
| |
| static void |
| @@ -4476,6 +4483,27 @@ int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val) |
| &req, sizeof(req), true); |
| } |
| |
| +int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable) |
| +{ |
| + struct { |
| + u8 band_idx; |
| + u8 _rsv[3]; |
| + |
| + __le16 tag; |
| + __le16 len; |
| + bool enable; |
| + u8 _rsv2[3]; |
| + } __packed req = { |
| + .band_idx = phy->mt76->band_idx, |
| + .tag = cpu_to_le16(option), |
| + .len = cpu_to_le16(sizeof(req) - 4), |
| + .enable = enable, |
| + }; |
| + |
| + return mt76_mcu_send_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(BAND_CONFIG), |
| + &req, sizeof(req), true); |
| +} |
| + |
| int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable) |
| { |
| struct { |
| @@ -5043,6 +5071,18 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif) |
| val = FIELD_GET(RATE_CFG_VAL, *((u32 *)data)); |
| |
| switch (mode) { |
| + case RATE_PARAM_FIXED_OFDMA: |
| + if (val == 3) |
| + phy->muru_onoff |= OFDMA_DL; |
| + else |
| + phy->muru_onoff |= val; |
| + break; |
| + case RATE_PARAM_FIXED_MIMO: |
| + if (val == 0) |
| + phy->muru_onoff |= MUMIMO_DL_CERT | MUMIMO_DL; |
| + else |
| + phy->muru_onoff |= MUMIMO_UL; |
| + break; |
| case RATE_PARAM_AUTO_MU: |
| if (val < 0 || val > 15) { |
| printk("Wrong value! The value is between 0-15.\n"); |
| diff --git a/mt7996/mcu.h b/mt7996/mcu.h |
| index a98b174..2546354 100644 |
| --- a/mt7996/mcu.h |
| +++ b/mt7996/mcu.h |
| @@ -755,6 +755,8 @@ enum { |
| RATE_PARAM_FIXED_GI = 11, |
| RATE_PARAM_AUTO = 20, |
| #ifdef CONFIG_MTK_VENDOR |
| + RATE_PARAM_FIXED_MIMO = 30, |
| + RATE_PARAM_FIXED_OFDMA = 31, |
| RATE_PARAM_AUTO_MU = 32, |
| #endif |
| }; |
| @@ -767,6 +769,7 @@ enum { |
| #define OFDMA_UL BIT(1) |
| #define MUMIMO_DL BIT(2) |
| #define MUMIMO_UL BIT(3) |
| +#define MUMIMO_DL_CERT BIT(4) |
| |
| enum { |
| BF_SOUNDING_ON = 1, |
| @@ -853,11 +856,14 @@ enum { |
| UNI_BAND_CONFIG_EDCCA_ENABLE = 0x05, |
| UNI_BAND_CONFIG_EDCCA_THRESHOLD = 0x06, |
| UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08, |
| + UNI_BAND_CONFIG_RTS_SIGTA_EN = 0x09, |
| + UNI_BAND_CONFIG_DIS_SECCH_CCA_DET = 0x0a, |
| }; |
| |
| enum { |
| UNI_WSYS_CONFIG_FW_LOG_CTRL, |
| UNI_WSYS_CONFIG_FW_DBG_CTRL, |
| + UNI_CMD_CERT_CFG = 6, |
| }; |
| |
| enum { |
| diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
| index ed998c0..a81e275 100644 |
| --- a/mt7996/mt7996.h |
| +++ b/mt7996/mt7996.h |
| @@ -363,6 +363,7 @@ struct mt7996_phy { |
| } test; |
| #endif |
| #ifdef CONFIG_MTK_VENDOR |
| + u8 rts_bw_sig; |
| spinlock_t amnt_lock; |
| struct mt7996_air_monitor_ctrl amnt_ctrl; |
| #endif |
| @@ -495,6 +496,9 @@ struct mt7996_dev { |
| } dbg; |
| const struct mt7996_dbg_reg_desc *dbg_reg; |
| #endif |
| +#ifdef CONFIG_MTK_VENDOR |
| + bool cert_mode; |
| +#endif |
| }; |
| |
| enum { |
| @@ -710,6 +714,7 @@ void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb); |
| int mt7996_mcu_get_tx_power_info(struct mt7996_phy *phy, u8 category, void *event); |
| int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable); |
| void mt7996_mcu_scs_sta_poll(struct work_struct *work); |
| +int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable); |
| |
| static inline u8 mt7996_max_interface_num(struct mt7996_dev *dev) |
| { |
| @@ -828,6 +833,10 @@ void mt7996_vendor_register(struct mt7996_phy *phy); |
| void mt7996_vendor_amnt_fill_rx(struct mt7996_phy *phy, struct sk_buff *skb); |
| int mt7996_vendor_amnt_sta_remove(struct mt7996_phy *phy, |
| struct ieee80211_sta *sta); |
| +void mt7996_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en); |
| +void mt7996_mcu_set_mimo(struct mt7996_phy *phy); |
| +int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val); |
| +int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data); |
| #endif |
| |
| int mt7996_mcu_edcca_enable(struct mt7996_phy *phy, bool enable); |
| @@ -855,6 +864,10 @@ int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para); |
| int mt7996_mcu_set_muru_cmd(struct mt7996_dev *dev, u16 action, int val); |
| int mt7996_mcu_muru_set_prot_frame_thr(struct mt7996_dev *dev, u32 val); |
| int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val); |
| +int mt7996_mcu_set_rfeature_trig_type(struct mt7996_phy *phy, u8 enable, u8 trig_type); |
| +void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type); |
| +void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 ofdma_user_cnt); |
| +void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type); |
| #endif |
| |
| #ifdef CONFIG_NET_MEDIATEK_SOC_WED |
| diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c |
| index 6865062..30da79f 100644 |
| --- a/mt7996/mtk_mcu.c |
| +++ b/mt7996/mtk_mcu.c |
| @@ -982,4 +982,210 @@ int mt7996_mcu_set_bypass_smthint(struct mt7996_phy *phy, u8 val) |
| true); |
| } |
| |
| +int mt7996_mcu_set_bsrp_ctrl(struct mt7996_phy *phy, u16 interval, |
| + u16 ru_alloc, u32 trig_type, u8 trig_flow, u8 ext_cmd) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + struct { |
| + u8 _rsv[4]; |
| + |
| + __le16 tag; |
| + __le16 len; |
| + |
| + __le16 interval; |
| + __le16 ru_alloc; |
| + __le32 trigger_type; |
| + u8 trigger_flow; |
| + u8 ext_cmd_bsrp; |
| + u8 band_bitmap; |
| + u8 _rsv2; |
| + } __packed req = { |
| + .tag = cpu_to_le16(UNI_CMD_MURU_BSRP_CTRL), |
| + .len = cpu_to_le16(sizeof(req) - 4), |
| + .interval = cpu_to_le16(interval), |
| + .ru_alloc = cpu_to_le16(ru_alloc), |
| + .trigger_type = cpu_to_le32(trig_type), |
| + .trigger_flow = trig_flow, |
| + .ext_cmd_bsrp = ext_cmd, |
| + .band_bitmap = mt7996_band_valid(dev, MT_BAND2) ? |
| + GENMASK(2, 0) : GENMASK(1, 0), |
| + }; |
| + |
| + return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req, |
| + sizeof(req), false); |
| +} |
| + |
| +int mt7996_mcu_set_rfeature_trig_type(struct mt7996_phy *phy, u8 enable, u8 trig_type) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + int ret = 0; |
| + char buf[] = "01:00:00:1B"; |
| + |
| + if (enable) { |
| + ret = mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_TRIG_TYPE, trig_type); |
| + if (ret) |
| + return ret; |
| + } |
| + |
| + switch (trig_type) { |
| + case CAPI_BASIC: |
| + return mt7996_mcu_set_bsrp_ctrl(phy, 5, 67, 0, 0, enable); |
| + case CAPI_BRP: |
| + return mt7996_mcu_set_txbf_snd_info(phy, buf); |
| + case CAPI_MU_BAR: |
| + return mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY, |
| + MU_DL_ACK_POLICY_MU_BAR); |
| + case CAPI_BSRP: |
| + return mt7996_mcu_set_bsrp_ctrl(phy, 5, 67, 4, 0, enable); |
| + default: |
| + return 0; |
| + } |
| +} |
| + |
| +int mt7996_mcu_set_muru_cfg(struct mt7996_phy *phy, void *data) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + struct mt7996_muru *muru; |
| + struct { |
| + u8 _rsv[4]; |
| + |
| + __le16 tag; |
| + __le16 len; |
| + |
| + u8 version; |
| + u8 revision; |
| + u8 _rsv2[2]; |
| + |
| + struct mt7996_muru muru; |
| + } __packed req = { |
| + .tag = cpu_to_le16(UNI_CMD_MURU_MUNUAL_CONFIG), |
| + .len = cpu_to_le16(sizeof(req) - 4), |
| + .version = UNI_CMD_MURU_VER_EHT, |
| + }; |
| + |
| + muru = (struct mt7996_muru *) data; |
| + memcpy(&req.muru, muru, sizeof(struct mt7996_muru)); |
| + |
| + return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req, |
| + sizeof(req), false); |
| +} |
| + |
| +int mt7996_set_muru_cfg(struct mt7996_phy *phy, u8 action, u8 val) |
| +{ |
| + struct mt7996_muru *muru; |
| + struct mt7996_muru_dl *dl; |
| + struct mt7996_muru_ul *ul; |
| + struct mt7996_muru_comm *comm; |
| + int ret = 0; |
| + |
| + muru = kzalloc(sizeof(struct mt7996_muru), GFP_KERNEL); |
| + dl = &muru->dl; |
| + ul = &muru->ul; |
| + comm = &muru->comm; |
| + |
| + switch (action) { |
| + case MU_CTRL_DL_USER_CNT: |
| + dl->user_num = val; |
| + comm->ppdu_format = MURU_PPDU_HE_MU; |
| + comm->sch_type = MURU_OFDMA_SCH_TYPE_DL; |
| + muru->cfg_comm = cpu_to_le32(MURU_COMM_SET); |
| + muru->cfg_dl = cpu_to_le32(MURU_FIXED_DL_TOTAL_USER_CNT); |
| + ret = mt7996_mcu_set_muru_cfg(phy, muru); |
| + break; |
| + case MU_CTRL_UL_USER_CNT: |
| + ul->user_num = val; |
| + comm->ppdu_format = MURU_PPDU_HE_TRIG; |
| + comm->sch_type = MURU_OFDMA_SCH_TYPE_UL; |
| + muru->cfg_comm = cpu_to_le32(MURU_COMM_SET); |
| + muru->cfg_ul = cpu_to_le32(MURU_FIXED_UL_TOTAL_USER_CNT); |
| + ret = mt7996_mcu_set_muru_cfg(phy, muru); |
| + break; |
| + default: |
| + break; |
| + } |
| + |
| + kfree(muru); |
| + return ret; |
| +} |
| + |
| +void mt7996_mcu_set_ppdu_tx_type(struct mt7996_phy *phy, u8 ppdu_type) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + int enable_su; |
| + |
| + switch (ppdu_type) { |
| + case CAPI_SU: |
| + enable_su = 1; |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SUTX_CTRL, enable_su); |
| + mt7996_set_muru_cfg(phy, MU_CTRL_DL_USER_CNT, 0); |
| + break; |
| + case CAPI_MU: |
| + enable_su = 0; |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SUTX_CTRL, enable_su); |
| + break; |
| + default: |
| + break; |
| + } |
| +} |
| + |
| +void mt7996_mcu_set_nusers_ofdma(struct mt7996_phy *phy, u8 type, u8 user_cnt) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + int enable_su = 0; |
| + |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SUTX_CTRL, enable_su); |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY, MU_DL_ACK_POLICY_SU_BAR); |
| + mt7996_mcu_muru_set_prot_frame_thr(dev, 9999); |
| + |
| + mt7996_set_muru_cfg(phy, type, user_cnt); |
| +} |
| + |
| +void mt7996_mcu_set_mimo(struct mt7996_phy *phy) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + struct cfg80211_chan_def *chandef = &phy->mt76->chandef; |
| + int disable_ra = 1; |
| + char buf[] = "2 134 0 1 0 1 2 2 2"; |
| + int force_mu = 1; |
| + |
| + switch (chandef->width) { |
| + case NL80211_CHAN_WIDTH_20_NOHT: |
| + case NL80211_CHAN_WIDTH_20: |
| + strscpy(buf, "2 122 0 1 0 1 2 2 2", sizeof(buf)); |
| + break; |
| + case NL80211_CHAN_WIDTH_80: |
| + break; |
| + case NL80211_CHAN_WIDTH_160: |
| + strscpy(buf, "2 137 0 1 0 1 2 2 2", sizeof(buf)); |
| + break; |
| + default: |
| + break; |
| + } |
| + |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY, MU_DL_ACK_POLICY_SU_BAR); |
| + mt7996_mcu_set_muru_fixed_rate_enable(dev, UNI_CMD_MURU_FIXED_RATE_CTRL, disable_ra); |
| + mt7996_mcu_set_muru_fixed_rate_parameter(dev, UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL, buf); |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_FORCE_MU, force_mu); |
| +} |
| + |
| +void mt7996_mcu_set_cert(struct mt7996_phy *phy, u8 type) |
| +{ |
| + struct mt7996_dev *dev = phy->dev; |
| + struct { |
| + u8 _rsv[4]; |
| + |
| + __le16 tag; |
| + __le16 len; |
| + u8 action; |
| + u8 _rsv2[3]; |
| + } __packed req = { |
| + .tag = cpu_to_le16(UNI_CMD_CERT_CFG), |
| + .len = cpu_to_le16(sizeof(req) - 4), |
| + .action = type, /* 1: CAPI Enable */ |
| + }; |
| + |
| + mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(WSYS_CONFIG), &req, |
| + sizeof(req), false); |
| +} |
| + |
| #endif |
| diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h |
| index d9686eb..7a4140b 100644 |
| --- a/mt7996/mtk_mcu.h |
| +++ b/mt7996/mtk_mcu.h |
| @@ -122,14 +122,15 @@ enum { |
| }; |
| |
| enum { |
| + UNI_CMD_MURU_BSRP_CTRL = 0x01, |
| UNI_CMD_MURU_SUTX_CTRL = 0x10, |
| - UNI_CMD_MURU_FIXED_RATE_CTRL, |
| - UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL, |
| + UNI_CMD_MURU_FIXED_RATE_CTRL = 0x11, |
| + UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL = 0x12, |
| UNI_CMD_MURU_SET_FORCE_MU = 0x33, |
| UNI_CMD_MURU_MUNUAL_CONFIG = 0x64, |
| - UNI_CMD_MURU_SET_MUDL_ACK_POLICY = 0xC9, |
| - UNI_CMD_MURU_SET_TRIG_TYPE, |
| - UNI_CMD_MURU_SET_20M_DYN_ALGO, |
| + UNI_CMD_MURU_SET_MUDL_ACK_POLICY = 0xC8, |
| + UNI_CMD_MURU_SET_TRIG_TYPE = 0xC9, |
| + UNI_CMD_MURU_SET_20M_DYN_ALGO = 0xCA, |
| UNI_CMD_MURU_PROT_FRAME_THR = 0xCC, |
| UNI_CMD_MURU_SET_CERT_MU_EDCA_OVERRIDE, |
| }; |
| @@ -533,6 +534,179 @@ struct mt7996_mcu_sr_hw_ind_event { |
| __le32 sr_ampdu_mpdu_cnt; |
| __le32 sr_ampdu_mpdu_acked_cnt; |
| }; |
| + |
| +struct mt7996_muru_comm { |
| + u8 pda_pol; |
| + u8 band; |
| + u8 spe_idx; |
| + u8 proc_type; |
| + |
| + __le16 mlo_ctrl; |
| + u8 sch_type; |
| + u8 ppdu_format; |
| + u8 ac; |
| + u8 _rsv[3]; |
| +}; |
| + |
| +struct mt7996_muru_dl { |
| + u8 user_num; |
| + u8 tx_mode; |
| + u8 bw; |
| + u8 gi; |
| + |
| + u8 ltf; |
| + u8 mcs; |
| + u8 dcm; |
| + u8 cmprs; |
| + |
| + __le16 ru[16]; |
| + |
| + u8 c26[2]; |
| + u8 ack_policy; |
| + u8 tx_power; |
| + |
| + __le16 mu_ppdu_duration; |
| + u8 agc_disp_order; |
| + u8 _rsv1; |
| + |
| + u8 agc_disp_pol; |
| + u8 agc_disp_ratio; |
| + __le16 agc_disp_linkMFG; |
| + |
| + __le16 prmbl_punc_bmp; |
| + u8 _rsv2[2]; |
| + |
| + struct { |
| + __le16 wlan_idx; |
| + u8 ru_alloc_seg; |
| + u8 ru_idx; |
| + u8 ldpc; |
| + u8 nss; |
| + u8 mcs; |
| + u8 mu_group_idx; |
| + u8 vht_groud_id; |
| + u8 vht_up; |
| + u8 he_start_stream; |
| + u8 he_mu_spatial; |
| + __le16 tx_power_alpha; |
| + u8 ack_policy; |
| + u8 ru_allo_ps160; |
| + } usr[16]; |
| +}; |
| + |
| +struct mt7996_muru_ul { |
| + u8 user_num; |
| + u8 tx_mode; |
| + |
| + u8 ba_type; |
| + u8 _rsv; |
| + |
| + u8 bw; |
| + u8 gi_ltf; |
| + __le16 ul_len; |
| + |
| + __le16 trig_cnt; |
| + u8 pad; |
| + u8 trig_type; |
| + |
| + __le16 trig_intv; |
| + u8 trig_ta[ETH_ALEN]; |
| + __le16 ul_ru[16]; |
| + |
| + u8 c26[2]; |
| + __le16 agc_disp_linkMFG; |
| + |
| + u8 agc_disp_mu_len; |
| + u8 agc_disp_pol; |
| + u8 agc_disp_ratio; |
| + u8 agc_disp_pu_idx; |
| + |
| + struct { |
| + __le16 wlan_idx; |
| + u8 ru_alloc_seg; |
| + u8 ru_idx; |
| + u8 ldpc; |
| + u8 nss; |
| + u8 mcs; |
| + u8 target_rssi; |
| + __le32 trig_pkt_size; |
| + u8 ru_allo_ps160; |
| + u8 _rsv2[3]; |
| + } usr[16]; |
| +}; |
| + |
| +struct mt7996_muru_dbg { |
| + /* HE TB RX Debug */ |
| + __le32 rx_hetb_nonsf_en_bitmap; |
| + __le32 rx_hetb_cfg[2]; |
| +}; |
| + |
| +struct mt7996_muru { |
| + __le32 cfg_comm; |
| + __le32 cfg_dl; |
| + __le32 cfg_ul; |
| + __le32 cfg_dbg; |
| + |
| + struct mt7996_muru_comm comm; |
| + struct mt7996_muru_dl dl; |
| + struct mt7996_muru_ul ul; |
| + struct mt7996_muru_dbg dbg; |
| +}; |
| + |
| + |
| +#define MURU_PPDU_HE_TRIG BIT(2) |
| +#define MURU_PPDU_HE_MU BIT(3) |
| + |
| +#define MURU_OFDMA_SCH_TYPE_DL BIT(0) |
| +#define MURU_OFDMA_SCH_TYPE_UL BIT(1) |
| + |
| +/* Common Config */ |
| +#define MURU_COMM_PPDU_FMT BIT(0) |
| +#define MURU_COMM_SCH_TYPE BIT(1) |
| +#define MURU_COMM_BAND BIT(2) |
| +#define MURU_COMM_WMM BIT(3) |
| +#define MURU_COMM_SPE_IDX BIT(4) |
| +#define MURU_COMM_PROC_TYPE BIT(5) |
| +#define MURU_COMM_SET (MURU_COMM_PPDU_FMT | MURU_COMM_SCH_TYPE) |
| +#define MURU_COMM_SET_TM (MURU_COMM_PPDU_FMT | MURU_COMM_BAND | \ |
| + MURU_COMM_WMM | MURU_COMM_SPE_IDX) |
| + |
| +/* DL Common config */ |
| +#define MURU_FIXED_DL_TOTAL_USER_CNT BIT(4) |
| + |
| +/* UL Common Config */ |
| +#define MURU_FIXED_UL_TOTAL_USER_CNT BIT(4) |
| + |
| +enum { |
| + CAPI_SU, |
| + CAPI_MU, |
| + CAPI_ER_SU, |
| + CAPI_TB, |
| + CAPI_LEGACY |
| +}; |
| + |
| +enum { |
| + CAPI_BASIC, |
| + CAPI_BRP, |
| + CAPI_MU_BAR, |
| + CAPI_MU_RTS, |
| + CAPI_BSRP, |
| + CAPI_GCR_MU_BAR, |
| + CAPI_BQRP, |
| + CAPI_NDP_FRP, |
| +}; |
| + |
| +enum { |
| + MU_DL_ACK_POLICY_MU_BAR = 3, |
| + MU_DL_ACK_POLICY_TF_FOR_ACK = 4, |
| + MU_DL_ACK_POLICY_SU_BAR = 5, |
| +}; |
| + |
| +enum muru_vendor_ctrl { |
| + MU_CTRL_UPDATE, |
| + MU_CTRL_DL_USER_CNT, |
| + MU_CTRL_UL_USER_CNT, |
| +}; |
| #endif |
| |
| #endif |
| diff --git a/mt7996/vendor.c b/mt7996/vendor.c |
| index 0d6fa77..7ab6447 100644 |
| --- a/mt7996/vendor.c |
| +++ b/mt7996/vendor.c |
| @@ -10,10 +10,31 @@ |
| #include "vendor.h" |
| #include "mtk_mcu.h" |
| |
| +#ifdef CONFIG_MTK_VENDOR |
| static const struct nla_policy |
| mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = { |
| [MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 }, |
| [MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_MU_CTRL_STRUCT] = {.type = NLA_BINARY }, |
| +}; |
| + |
| +static const struct nla_policy |
| +wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = { |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_AMPDU] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_FIXED_MCS] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE] = {.type = NLA_U16 }, |
| +}; |
| + |
| +static const struct nla_policy |
| +wireless_dump_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP] = { |
| + [MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU] = { .type = NLA_U8 }, |
| }; |
| |
| static const struct nla_policy |
| @@ -76,6 +97,17 @@ pp_ctrl_policy[NUM_MTK_VENDOR_ATTRS_PP_CTRL] = { |
| [MTK_VENDOR_ATTR_PP_BAND_IDX] = { .type = NLA_U8 }, |
| }; |
| |
| +static const struct nla_policy |
| +rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = { |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI] = {.type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_LTF] = { .type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG] = { .type = NLA_NESTED }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_EN] = { .type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE] = { .type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY] = { .type = NLA_U8 }, |
| + [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF] = { .type = NLA_U8 }, |
| +}; |
| + |
| struct mt7996_amnt_data { |
| u8 idx; |
| u8 addr[ETH_ALEN]; |
| @@ -90,6 +122,8 @@ static int mt7996_vendor_mu_ctrl(struct wiphy *wiphy, |
| { |
| struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_MU_CTRL]; |
| + struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| + struct mt7996_muru *muru; |
| int err; |
| u8 val8; |
| u32 val32 = 0; |
| @@ -105,9 +139,17 @@ static int mt7996_vendor_mu_ctrl(struct wiphy *wiphy, |
| FIELD_PREP(RATE_CFG_VAL, val8); |
| ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL, |
| mt7996_set_wireless_vif, &val32); |
| + } else if (tb[MTK_VENDOR_ATTR_MU_CTRL_STRUCT]) { |
| + muru = kzalloc(sizeof(struct mt7996_muru), GFP_KERNEL); |
| + |
| + nla_memcpy(muru, tb[MTK_VENDOR_ATTR_MU_CTRL_STRUCT], |
| + sizeof(struct mt7996_muru)); |
| + |
| + err = mt7996_mcu_set_muru_cfg(phy, muru); |
| + kfree(muru); |
| } |
| |
| - return 0; |
| + return err; |
| } |
| |
| static int |
| @@ -130,6 +172,48 @@ mt7996_vendor_mu_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
| return len; |
| } |
| |
| +void mt7996_set_wireless_rts_sigta(struct ieee80211_hw *hw, u8 value) { |
| + struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| + |
| + switch (value) { |
| + case BW_SIGNALING_STATIC: |
| + case BW_SIGNALING_DYNAMIC: |
| + mt7996_mcu_set_band_confg(phy, UNI_BAND_CONFIG_RTS_SIGTA_EN, true); |
| + mt7996_mcu_set_band_confg(phy, UNI_BAND_CONFIG_DIS_SECCH_CCA_DET, false); |
| + break; |
| + default: |
| + value = BW_SIGNALING_DISABLE; |
| + mt7996_mcu_set_band_confg(phy, UNI_BAND_CONFIG_RTS_SIGTA_EN, false); |
| + mt7996_mcu_set_band_confg(phy, UNI_BAND_CONFIG_DIS_SECCH_CCA_DET, true); |
| + break; |
| + } |
| + |
| + phy->rts_bw_sig = value; |
| + |
| + /* Set RTS Threshold to a lower Value */ |
| + mt7996_mcu_set_rts_thresh(phy, 500); |
| +} |
| + |
| +static int |
| +mt7996_vendor_wireless_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
| + struct sk_buff *skb, const void *data, int data_len, |
| + unsigned long *storage) |
| +{ |
| + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| + int len = 0; |
| + |
| + if (*storage == 1) |
| + return -ENOENT; |
| + *storage = 1; |
| + |
| + if (nla_put_u8(skb, MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, |
| + ieee80211_hw_check(hw, SUPPORTS_AMSDU_IN_AMPDU))) |
| + return -ENOMEM; |
| + len += 1; |
| + |
| + return len; |
| + } |
| + |
| void mt7996_vendor_amnt_fill_rx(struct mt7996_phy *phy, struct sk_buff *skb) |
| { |
| struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb; |
| @@ -712,6 +796,126 @@ error: |
| return -EINVAL; |
| } |
| |
| +static int mt7996_vendor_rfeature_ctrl(struct wiphy *wiphy, |
| + struct wireless_dev *wdev, |
| + const void *data, |
| + int data_len) |
| +{ |
| + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| + struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| + struct mt7996_dev *dev = phy->dev; |
| + struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL]; |
| + int err; |
| + u32 val; |
| + |
| + err = nla_parse(tb, MTK_VENDOR_ATTR_RFEATURE_CTRL_MAX, data, data_len, |
| + rfeature_ctrl_policy, NULL); |
| + if (err) |
| + return err; |
| + |
| + val = CAPI_RFEATURE_CHANGED; |
| + |
| + if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG]) { |
| + u8 enable, trig_type; |
| + int rem; |
| + struct nlattr *cur; |
| + |
| + nla_for_each_nested(cur, tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG], rem) { |
| + switch (nla_type(cur)) { |
| + case MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_EN: |
| + enable = nla_get_u8(cur); |
| + break; |
| + case MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE: |
| + trig_type = nla_get_u8(cur); |
| + break; |
| + default: |
| + return -EINVAL; |
| + }; |
| + } |
| + |
| + err = mt7996_mcu_set_rfeature_trig_type(phy, enable, trig_type); |
| + if (err) |
| + return err; |
| + } else if (tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY]) { |
| + u8 ack_policy; |
| + |
| + ack_policy = nla_get_u8(tb[MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY]); |
| + switch (ack_policy) { |
| + case MU_DL_ACK_POLICY_TF_FOR_ACK: |
| + return mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_MUDL_ACK_POLICY, |
| + ack_policy); |
| + default: |
| + return 0; |
| + } |
| + } |
| + |
| + return 0; |
| +} |
| + |
| +static int mt7996_vendor_wireless_ctrl(struct wiphy *wiphy, |
| + struct wireless_dev *wdev, |
| + const void *data, |
| + int data_len) |
| +{ |
| + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| + struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| + struct mt7996_dev *dev = phy->dev; |
| + struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL]; |
| + int err; |
| + u8 val8; |
| + u16 val16; |
| + u32 val32; |
| + |
| + err = nla_parse(tb, MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX, data, data_len, |
| + wireless_ctrl_policy, NULL); |
| + if (err) |
| + return err; |
| + |
| + val32 = CAPI_WIRELESS_CHANGED; |
| + |
| + if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA]); |
| + val32 |= FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_OFDMA) | |
| + FIELD_PREP(RATE_CFG_VAL, val8); |
| + ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL, |
| + mt7996_set_wireless_vif, &val32); |
| + if (val8 == 3) /* DL20and80 */ |
| + mt7996_mcu_set_muru_cmd(dev, UNI_CMD_MURU_SET_20M_DYN_ALGO, 1); |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE]) { |
| + val16 = nla_get_u16(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE]); |
| + hw->max_tx_aggregation_subframes = val16; |
| + hw->max_rx_aggregation_subframes = val16; |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE]); |
| + mt7996_mcu_set_ppdu_tx_type(phy, val8); |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA]); |
| + if (phy->muru_onoff & OFDMA_UL) |
| + mt7996_mcu_set_nusers_ofdma(phy, MU_CTRL_UL_USER_CNT, val8); |
| + else |
| + mt7996_mcu_set_nusers_ofdma(phy, MU_CTRL_DL_USER_CNT, val8); |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO]); |
| + val32 |= FIELD_PREP(RATE_CFG_MODE, RATE_PARAM_FIXED_MIMO) | |
| + FIELD_PREP(RATE_CFG_VAL, val8); |
| + ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL, |
| + mt7996_set_wireless_vif, &val32); |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]); |
| + dev->cert_mode = val8; |
| + mt7996_mcu_set_cert(phy, val8); |
| + mt7996_mcu_set_bypass_smthint(phy, val8); |
| + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) { |
| + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]); |
| + mt7996_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]); |
| + mt7996_set_wireless_rts_sigta(hw, val8); |
| + } |
| + |
| + return 0; |
| +} |
| + |
| static const struct wiphy_vendor_command mt7996_vendor_commands[] = { |
| { |
| .info = { |
| @@ -725,6 +929,18 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = { |
| .policy = mu_ctrl_policy, |
| .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX, |
| }, |
| + { |
| + .info = { |
| + .vendor_id = MTK_NL80211_VENDOR_ID, |
| + .subcmd = MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL, |
| + }, |
| + .flags = WIPHY_VENDOR_CMD_NEED_NETDEV | |
| + WIPHY_VENDOR_CMD_NEED_RUNNING, |
| + .doit = mt7996_vendor_wireless_ctrl, |
| + .dumpit = mt7996_vendor_wireless_ctrl_dump, |
| + .policy = wireless_ctrl_policy, |
| + .maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX, |
| + }, |
| { |
| .info = { |
| .vendor_id = MTK_NL80211_VENDOR_ID, |
| @@ -794,6 +1010,17 @@ static const struct wiphy_vendor_command mt7996_vendor_commands[] = { |
| .policy = pp_ctrl_policy, |
| .maxattr = MTK_VENDOR_ATTR_PP_CTRL_MAX, |
| }, |
| + { |
| + .info = { |
| + .vendor_id = MTK_NL80211_VENDOR_ID, |
| + .subcmd = MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL, |
| + }, |
| + .flags = WIPHY_VENDOR_CMD_NEED_NETDEV | |
| + WIPHY_VENDOR_CMD_NEED_RUNNING, |
| + .doit = mt7996_vendor_rfeature_ctrl, |
| + .policy = rfeature_ctrl_policy, |
| + .maxattr = MTK_VENDOR_ATTR_RFEATURE_CTRL_MAX, |
| + }, |
| }; |
| |
| void mt7996_vendor_register(struct mt7996_phy *phy) |
| @@ -803,3 +1030,4 @@ void mt7996_vendor_register(struct mt7996_phy *phy) |
| |
| spin_lock_init(&phy->amnt_lock); |
| } |
| +#endif |
| diff --git a/mt7996/vendor.h b/mt7996/vendor.h |
| index 8aaa18e..2ee1339 100644 |
| --- a/mt7996/vendor.h |
| +++ b/mt7996/vendor.h |
| @@ -3,8 +3,12 @@ |
| |
| #define MTK_NL80211_VENDOR_ID 0x0ce7 |
| |
| +#ifdef CONFIG_MTK_VENDOR |
| + |
| enum mtk_nl80211_vendor_subcmds { |
| MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0xae, |
| + MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3, |
| + MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4, |
| MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5, |
| MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7, |
| MTK_NL80211_VENDOR_SUBCMD_3WIRE_CTRL = 0xc8, |
| @@ -61,6 +65,7 @@ enum mtk_vendor_attr_mu_ctrl { |
| |
| MTK_VENDOR_ATTR_MU_CTRL_ONOFF, |
| MTK_VENDOR_ATTR_MU_CTRL_DUMP, |
| + MTK_VENDOR_ATTR_MU_CTRL_STRUCT, |
| |
| /* keep last */ |
| NUM_MTK_VENDOR_ATTRS_MU_CTRL, |
| @@ -68,6 +73,66 @@ enum mtk_vendor_attr_mu_ctrl { |
| NUM_MTK_VENDOR_ATTRS_MU_CTRL - 1 |
| }; |
| |
| +enum mtk_capi_control_changed { |
| + CAPI_RFEATURE_CHANGED = BIT(16), |
| + CAPI_WIRELESS_CHANGED = BIT(17), |
| +}; |
| + |
| +enum mtk_vendor_attr_rfeature_ctrl { |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC, |
| + |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_LTF, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_EN, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_ACK_PLCY, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF, |
| + |
| + /* keep last */ |
| + NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL, |
| + MTK_VENDOR_ATTR_RFEATURE_CTRL_MAX = |
| + NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL - 1 |
| +}; |
| + |
| +enum mtk_vendor_attr_wireless_ctrl { |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_UNSPEC, |
| + |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_FIXED_MCS, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_OFDMA, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_PPDU_TX_TYPE, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_AMPDU, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_RTS_SIGTA, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */ |
| + |
| + /* keep last */ |
| + NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL, |
| + MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX = |
| + NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1 |
| +}; |
| + |
| +enum mtk_vendor_attr_wireless_dump { |
| + MTK_VENDOR_ATTR_WIRELESS_DUMP_UNSPEC, |
| + |
| + MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, |
| + |
| + /* keep last */ |
| + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP, |
| + MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX = |
| + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP - 1 |
| +}; |
| + |
| +enum bw_sig { |
| + BW_SIGNALING_DISABLE, |
| + BW_SIGNALING_STATIC, |
| + BW_SIGNALING_DYNAMIC |
| +}; |
| + |
| enum mtk_vendor_attr_mnt_ctrl { |
| MTK_VENDOR_ATTR_AMNT_CTRL_UNSPEC, |
| |
| @@ -151,3 +216,5 @@ enum mtk_vendor_attr_pp_ctrl { |
| }; |
| |
| #endif |
| + |
| +#endif |
| -- |
| 2.45.2 |
| |