developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From 3330075935bef71cea064ce4bf0d4453fdc2301a Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Tue, 3 Jan 2023 09:42:07 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 035/223] mtk: mt76: mt7996: support BF/MIMO debug commands |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | |
| 6 | This commit includes the following commands: |
| 7 | 1. starec_bf_read |
| 8 | 2. txbf_snd_info: start/stop sounding and set sounding period |
| 9 | 3. fbkRptInfo |
| 10 | 4. fix muru rate |
| 11 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 12 | fix the wrong wlan_idx for user3 |
| 13 | |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 14 | Align the format of mcu event mt7996_mcu_bf_starec_read with |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 15 | firmware definition. |
| 16 | |
| 17 | Fw gerrit change: |
| 18 | https://gerrit.mediatek.inc/c/neptune/firmware/bora/wifi/core/+/8218143 |
| 19 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 20 | Change-Id: Id6cbaf16e4e6f63238a495ac9f45744e1dd38e9b |
| 21 | Change-Id: I7ece7399370f2bd22d2564029025baeda27057a5 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 22 | Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 23 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 24 | --- |
| 25 | mt7996/mcu.c | 5 + |
| 26 | mt7996/mcu.h | 4 + |
| 27 | mt7996/mt7996.h | 5 + |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 28 | mt7996/mtk_debugfs.c | 9 + |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 29 | mt7996/mtk_mcu.c | 624 +++++++++++++++++++++++++++++++++++++++++++ |
| 30 | mt7996/mtk_mcu.h | 342 ++++++++++++++++++++++++ |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 31 | 6 files changed, 989 insertions(+) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 32 | |
| 33 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 34 | index 2a647b7b..baf71b0a 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 35 | --- a/mt7996/mcu.c |
| 36 | +++ b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 37 | @@ -754,6 +754,11 @@ mt7996_mcu_uni_rx_unsolicited_event(struct mt7996_dev *dev, struct sk_buff *skb) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 38 | case MCU_UNI_EVENT_TESTMODE_CTRL: |
| 39 | mt7996_tm_rf_test_event(dev, skb); |
| 40 | break; |
| 41 | +#endif |
| 42 | +#if defined CONFIG_NL80211_TESTMODE || defined CONFIG_MTK_DEBUG |
| 43 | + case MCU_UNI_EVENT_BF: |
| 44 | + mt7996_mcu_rx_bf_event(dev, skb); |
| 45 | + break; |
| 46 | #endif |
| 47 | default: |
| 48 | break; |
| 49 | diff --git a/mt7996/mcu.h b/mt7996/mcu.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 50 | index 3e9364de..8a718513 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 51 | --- a/mt7996/mcu.h |
| 52 | +++ b/mt7996/mcu.h |
| 53 | @@ -770,8 +770,12 @@ enum { |
| 54 | |
| 55 | enum { |
| 56 | BF_SOUNDING_ON = 1, |
| 57 | + BF_PFMU_TAG_READ = 5, |
| 58 | + BF_STA_REC_READ = 11, |
| 59 | BF_HW_EN_UPDATE = 17, |
| 60 | BF_MOD_EN_CTRL = 20, |
| 61 | + BF_FBRPT_DBG_INFO_READ = 23, |
| 62 | + BF_TXSND_INFO = 24, |
| 63 | }; |
| 64 | |
| 65 | enum { |
| 66 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 67 | index 22d44542..8d986dee 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 68 | --- a/mt7996/mt7996.h |
| 69 | +++ b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 70 | @@ -847,6 +847,11 @@ int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 71 | int mt7996_mcu_set_sr_enable(struct mt7996_phy *phy, u8 action, u64 val, bool set); |
| 72 | void mt7996_mcu_rx_sr_event(struct mt7996_dev *dev, struct sk_buff *skb); |
| 73 | int mt7996_mcu_set_dup_wtbl(struct mt7996_dev *dev); |
| 74 | +int mt7996_mcu_set_txbf_internal(struct mt7996_phy *phy, u8 action, int idx); |
| 75 | +void mt7996_mcu_rx_bf_event(struct mt7996_dev *dev, struct sk_buff *skb); |
| 76 | +int mt7996_mcu_set_muru_fixed_rate_enable(struct mt7996_dev *dev, u8 action, int val); |
| 77 | +int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action, void *para); |
| 78 | +int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para); |
| 79 | #endif |
| 80 | |
| 81 | #ifdef CONFIG_NET_MEDIATEK_SOC_WED |
| 82 | diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 83 | index 13ea6274..51449df4 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 84 | --- a/mt7996/mtk_debugfs.c |
| 85 | +++ b/mt7996/mtk_debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 86 | @@ -2996,6 +2996,15 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 87 | debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops); |
| 88 | debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops); |
| 89 | |
| 90 | + debugfs_create_file("muru_fixed_rate_enable", 0600, dir, dev, |
| 91 | + &fops_muru_fixed_rate_enable); |
| 92 | + debugfs_create_file("muru_fixed_group_rate", 0600, dir, dev, |
| 93 | + &fops_muru_fixed_group_rate); |
| 94 | + debugfs_create_file("bf_txsnd_info", 0600, dir, phy, &fops_bf_txsnd_info); |
| 95 | + debugfs_create_file("bf_starec_read", 0600, dir, phy, &fops_starec_bf_read); |
| 96 | + debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt); |
| 97 | + debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read); |
| 98 | + |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 103 | index ea4e5bf2..6b2cdad6 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 104 | --- a/mt7996/mtk_mcu.c |
| 105 | +++ b/mt7996/mtk_mcu.c |
| 106 | @@ -280,4 +280,628 @@ int mt7996_mcu_set_dup_wtbl(struct mt7996_dev *dev) |
| 107 | return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(CHIP_CONFIG), &req, |
| 108 | sizeof(req), true); |
| 109 | } |
| 110 | + |
| 111 | +static struct tlv * |
| 112 | +__mt7996_mcu_add_uni_tlv(struct sk_buff *skb, u16 tag, u16 len) |
| 113 | +{ |
| 114 | + struct tlv *ptlv, tlv = { |
| 115 | + .tag = cpu_to_le16(tag), |
| 116 | + .len = cpu_to_le16(len), |
| 117 | + }; |
| 118 | + |
| 119 | + ptlv = skb_put(skb, len); |
| 120 | + memcpy(ptlv, &tlv, sizeof(tlv)); |
| 121 | + |
| 122 | + return ptlv; |
| 123 | +} |
| 124 | + |
| 125 | +int mt7996_mcu_set_txbf_internal(struct mt7996_phy *phy, u8 action, int idx) |
| 126 | +{ |
| 127 | + struct mt7996_dev *dev = phy->dev; |
| 128 | +#define MT7996_MTK_BF_MAX_SIZE sizeof(struct bf_starec_read) |
| 129 | + struct uni_header hdr; |
| 130 | + struct sk_buff *skb; |
| 131 | + struct tlv *tlv; |
| 132 | + int len = sizeof(hdr) + MT7996_MTK_BF_MAX_SIZE; |
| 133 | + |
| 134 | + memset(&hdr, 0, sizeof(hdr)); |
| 135 | + |
| 136 | + skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, len); |
| 137 | + if (!skb) |
| 138 | + return -ENOMEM; |
| 139 | + |
| 140 | + skb_put_data(skb, &hdr, sizeof(hdr)); |
| 141 | + |
| 142 | + switch (action) { |
| 143 | + case BF_PFMU_TAG_READ: { |
| 144 | + struct bf_pfmu_tag *req; |
| 145 | + |
| 146 | + tlv = __mt7996_mcu_add_uni_tlv(skb, action, sizeof(*req)); |
| 147 | + req = (struct bf_pfmu_tag *)tlv; |
| 148 | +#define BFER 1 |
| 149 | + req->pfmu_id = idx; |
| 150 | + req->bfer = BFER; |
| 151 | + req->band_idx = phy->mt76->band_idx; |
| 152 | + break; |
| 153 | + } |
| 154 | + case BF_STA_REC_READ: { |
| 155 | + struct bf_starec_read *req; |
| 156 | + |
| 157 | + tlv = __mt7996_mcu_add_uni_tlv(skb, action, sizeof(*req)); |
| 158 | + req = (struct bf_starec_read *)tlv; |
| 159 | + req->wlan_idx = idx; |
| 160 | + break; |
| 161 | + } |
| 162 | + case BF_FBRPT_DBG_INFO_READ: { |
| 163 | + struct bf_fbk_rpt_info *req; |
| 164 | + |
| 165 | + if (idx != 0) { |
| 166 | + dev_info(dev->mt76.dev, "Invalid input"); |
| 167 | + return 0; |
| 168 | + } |
| 169 | + |
| 170 | + tlv = __mt7996_mcu_add_uni_tlv(skb, action, sizeof(*req)); |
| 171 | + req = (struct bf_fbk_rpt_info *)tlv; |
| 172 | + req->action = idx; |
| 173 | + req->band_idx = phy->mt76->band_idx; |
| 174 | + break; |
| 175 | + } |
| 176 | + default: |
| 177 | + return -EINVAL; |
| 178 | + } |
| 179 | + |
| 180 | + return mt76_mcu_skb_send_msg(&phy->dev->mt76, skb, MCU_WM_UNI_CMD(BF), false); |
| 181 | +} |
| 182 | + |
| 183 | +int mt7996_mcu_set_txbf_snd_info(struct mt7996_phy *phy, void *para) |
| 184 | +{ |
| 185 | + char *buf = (char *)para; |
| 186 | + __le16 input[5] = {0}; |
| 187 | + u8 recv_arg = 0; |
| 188 | + struct bf_txsnd_info *req; |
| 189 | + struct uni_header hdr; |
| 190 | + struct sk_buff *skb; |
| 191 | + struct tlv *tlv; |
| 192 | + int len = sizeof(hdr) + MT7996_MTK_BF_MAX_SIZE; |
| 193 | + |
| 194 | + memset(&hdr, 0, sizeof(hdr)); |
| 195 | + |
| 196 | + skb = mt76_mcu_msg_alloc(&phy->dev->mt76, NULL, len); |
| 197 | + if (!skb) |
| 198 | + return -ENOMEM; |
| 199 | + |
| 200 | + skb_put_data(skb, &hdr, sizeof(hdr)); |
| 201 | + |
| 202 | + recv_arg = sscanf(buf, "%hx:%hx:%hx:%hx:%hx", &input[0], &input[1], &input[2], |
| 203 | + &input[3], &input[4]); |
| 204 | + |
| 205 | + if (!recv_arg) |
| 206 | + return -EINVAL; |
| 207 | + |
| 208 | + tlv = __mt7996_mcu_add_uni_tlv(skb, BF_TXSND_INFO, sizeof(*req)); |
| 209 | + req = (struct bf_txsnd_info *)tlv; |
| 210 | + req->action = input[0]; |
| 211 | + |
| 212 | + switch (req->action) { |
| 213 | + case BF_SND_READ_INFO: { |
| 214 | + req->read_clr = input[1]; |
| 215 | + break; |
| 216 | + } |
| 217 | + case BF_SND_CFG_OPT: { |
| 218 | + req->vht_opt = input[1]; |
| 219 | + req->he_opt = input[2]; |
| 220 | + req->glo_opt = input[3]; |
| 221 | + break; |
| 222 | + } |
| 223 | + case BF_SND_CFG_INTV: { |
| 224 | + req->wlan_idx = input[1]; |
| 225 | + req->snd_intv = input[2]; |
| 226 | + break; |
| 227 | + } |
| 228 | + case BF_SND_STA_STOP: { |
| 229 | + req->wlan_idx = input[1]; |
| 230 | + req->snd_stop = input[2]; |
| 231 | + break; |
| 232 | + } |
| 233 | + case BF_SND_CFG_MAX_STA: { |
| 234 | + req->max_snd_stas = input[1]; |
| 235 | + break; |
| 236 | + } |
| 237 | + case BF_SND_CFG_BFRP: { |
| 238 | + req->man = input[1]; |
| 239 | + req->tx_time = input[2]; |
| 240 | + req->mcs = input[3]; |
| 241 | + req->ldpc = input[4]; |
| 242 | + break; |
| 243 | + } |
| 244 | + case BF_SND_CFG_INF: { |
| 245 | + req->inf = input[1]; |
| 246 | + break; |
| 247 | + } |
| 248 | + case BF_SND_CFG_TXOP_SND: { |
| 249 | + req->man = input[1]; |
| 250 | + req->ac_queue = input[2]; |
| 251 | + req->sxn_protect = input[3]; |
| 252 | + req->direct_fbk = input[4]; |
| 253 | + break; |
| 254 | + } |
| 255 | + default: |
| 256 | + return -EINVAL; |
| 257 | + } |
| 258 | + |
| 259 | + return mt76_mcu_skb_send_msg(&phy->dev->mt76, skb, MCU_WM_UNI_CMD(BF), false); |
| 260 | +} |
| 261 | + |
| 262 | +void |
| 263 | +mt7996_mcu_rx_bf_event(struct mt7996_dev *dev, struct sk_buff *skb) |
| 264 | +{ |
| 265 | +#define HE_MODE 3 |
| 266 | + struct mt7996_mcu_bf_basic_event *event; |
| 267 | + |
| 268 | + event = (struct mt7996_mcu_bf_basic_event *)skb->data; |
| 269 | + |
| 270 | + dev_info(dev->mt76.dev, " bf_event tag = %d\n", event->tag); |
| 271 | + |
| 272 | + switch (event->tag) { |
| 273 | + case UNI_EVENT_BF_PFMU_TAG: { |
| 274 | + |
| 275 | + struct mt7996_pfmu_tag_event *tag; |
| 276 | + u32 *raw_t1, *raw_t2; |
| 277 | + |
| 278 | + tag = (struct mt7996_pfmu_tag_event *) skb->data; |
| 279 | + |
| 280 | + raw_t1 = (u32 *)&tag->t1; |
| 281 | + raw_t2 = (u32 *)&tag->t2; |
| 282 | + |
| 283 | + dev_info(dev->mt76.dev, "=================== TXBf Profile Tag1 Info ==================\n"); |
| 284 | + dev_info(dev->mt76.dev, |
| 285 | + "DW0 = 0x%08x, DW1 = 0x%08x, DW2 = 0x%08x\n", |
| 286 | + raw_t1[0], raw_t1[1], raw_t1[2]); |
| 287 | + dev_info(dev->mt76.dev, |
| 288 | + "DW4 = 0x%08x, DW5 = 0x%08x, DW6 = 0x%08x\n\n", |
| 289 | + raw_t1[3], raw_t1[4], raw_t1[5]); |
| 290 | + dev_info(dev->mt76.dev, "PFMU ID = %d Invalid status = %d\n", |
| 291 | + tag->t1.pfmu_idx, tag->t1.invalid_prof); |
| 292 | + dev_info(dev->mt76.dev, "iBf/eBf = %d\n\n", tag->t1.ebf); |
| 293 | + dev_info(dev->mt76.dev, "DBW = %d\n", tag->t1.data_bw); |
| 294 | + dev_info(dev->mt76.dev, "SU/MU = %d\n", tag->t1.is_mu); |
| 295 | + dev_info(dev->mt76.dev, |
| 296 | + "nrow = %d, ncol = %d, ng = %d, LM = %d, CodeBook = %d MobCalEn = %d\n", |
| 297 | + tag->t1.nr, tag->t1.nc, tag->t1.ngroup, tag->t1.lm, tag->t1.codebook, |
| 298 | + tag->t1.mob_cal_en); |
| 299 | + |
| 300 | + if (tag->t1.lm <= HE_MODE) { |
| 301 | + dev_info(dev->mt76.dev, "RU start = %d, RU end = %d\n", |
| 302 | + tag->t1.field.ru_start_id, tag->t1.field.ru_end_id); |
| 303 | + } else { |
| 304 | + dev_info(dev->mt76.dev, "PartialBW = %d\n", |
| 305 | + tag->t1.bw_info.partial_bw_info); |
| 306 | + } |
| 307 | + |
| 308 | + dev_info(dev->mt76.dev, "Mem Col1 = %d, Mem Row1 = %d, Mem Col2 = %d, Mem Row2 = %d\n", |
| 309 | + tag->t1.col_id1, tag->t1.row_id1, tag->t1.col_id2, tag->t1.row_id2); |
| 310 | + dev_info(dev->mt76.dev, "Mem Col3 = %d, Mem Row3 = %d, Mem Col4 = %d, Mem Row4 = %d\n\n", |
| 311 | + tag->t1.col_id3, tag->t1.row_id3, tag->t1.col_id4, tag->t1.row_id4); |
| 312 | + dev_info(dev->mt76.dev, |
| 313 | + "STS0_SNR = 0x%02x, STS1_SNR = 0x%02x, STS2_SNR = 0x%02x, STS3_SNR = 0x%02x\n", |
| 314 | + tag->t1.snr_sts0, tag->t1.snr_sts1, tag->t1.snr_sts2, tag->t1.snr_sts3); |
| 315 | + dev_info(dev->mt76.dev, |
| 316 | + "STS4_SNR = 0x%02x, STS5_SNR = 0x%02x, STS6_SNR = 0x%02x, STS7_SNR = 0x%02x\n", |
| 317 | + tag->t1.snr_sts4, tag->t1.snr_sts5, tag->t1.snr_sts6, tag->t1.snr_sts7); |
| 318 | + dev_info(dev->mt76.dev, "=============================================================\n"); |
| 319 | + |
| 320 | + dev_info(dev->mt76.dev, "=================== TXBf Profile Tag2 Info ==================\n"); |
| 321 | + dev_info(dev->mt76.dev, |
| 322 | + "DW0 = 0x%08x, DW1 = 0x%08x, DW2 = 0x%08x\n", |
| 323 | + raw_t2[0], raw_t2[1], raw_t2[2]); |
| 324 | + dev_info(dev->mt76.dev, |
| 325 | + "DW3 = 0x%08x, DW4 = 0x%08x, DW5 = 0x%08x\n\n", |
| 326 | + raw_t2[3], raw_t2[4], raw_t2[5]); |
| 327 | + dev_info(dev->mt76.dev, "Smart antenna ID = 0x%x, SE index = %d\n", |
| 328 | + tag->t2.smart_ant, tag->t2.se_idx); |
| 329 | + dev_info(dev->mt76.dev, "Timeout = 0x%x\n", tag->t2.ibf_timeout); |
| 330 | + dev_info(dev->mt76.dev, "Desired BW = %d, Desired Ncol = %d, Desired Nrow = %d\n", |
| 331 | + tag->t2.ibf_data_bw, tag->t2.ibf_nc, tag->t2.ibf_nr); |
| 332 | + dev_info(dev->mt76.dev, "Desired RU Allocation = %d\n", tag->t2.ibf_ru); |
| 333 | + dev_info(dev->mt76.dev, "Mobility DeltaT = %d, Mobility LQ = %d\n", |
| 334 | + tag->t2.mob_delta_t, tag->t2.mob_lq_result); |
| 335 | + dev_info(dev->mt76.dev, "=============================================================\n"); |
| 336 | + break; |
| 337 | + } |
| 338 | + case UNI_EVENT_BF_STAREC: { |
| 339 | + |
| 340 | + struct mt7996_mcu_bf_starec_read *r; |
| 341 | + |
| 342 | + r = (struct mt7996_mcu_bf_starec_read *)skb->data; |
| 343 | + dev_info(dev->mt76.dev, "=================== BF StaRec ===================\n" |
| 344 | + "rStaRecBf.u2PfmuId = %d\n" |
| 345 | + "rStaRecBf.fgSU_MU = %d\n" |
| 346 | + "rStaRecBf.u1TxBfCap = %d\n" |
| 347 | + "rStaRecBf.ucSoundingPhy = %d\n" |
| 348 | + "rStaRecBf.ucNdpaRate = %d\n" |
| 349 | + "rStaRecBf.ucNdpRate = %d\n" |
| 350 | + "rStaRecBf.ucReptPollRate= %d\n" |
| 351 | + "rStaRecBf.ucTxMode = %d\n" |
| 352 | + "rStaRecBf.ucNc = %d\n" |
| 353 | + "rStaRecBf.ucNr = %d\n" |
| 354 | + "rStaRecBf.ucCBW = %d\n" |
| 355 | + "rStaRecBf.ucMemRequire20M = %d\n" |
| 356 | + "rStaRecBf.ucMemRow0 = %d\n" |
| 357 | + "rStaRecBf.ucMemCol0 = %d\n" |
| 358 | + "rStaRecBf.ucMemRow1 = %d\n" |
| 359 | + "rStaRecBf.ucMemCol1 = %d\n" |
| 360 | + "rStaRecBf.ucMemRow2 = %d\n" |
| 361 | + "rStaRecBf.ucMemCol2 = %d\n" |
| 362 | + "rStaRecBf.ucMemRow3 = %d\n" |
| 363 | + "rStaRecBf.ucMemCol3 = %d\n", |
| 364 | + r->pfmu_id, |
| 365 | + r->is_su_mu, |
| 366 | + r->txbf_cap, |
| 367 | + r->sounding_phy, |
| 368 | + r->ndpa_rate, |
| 369 | + r->ndp_rate, |
| 370 | + r->rpt_poll_rate, |
| 371 | + r->tx_mode, |
| 372 | + r->nc, |
| 373 | + r->nr, |
| 374 | + r->bw, |
| 375 | + r->mem_require_20m, |
| 376 | + r->mem_row0, |
| 377 | + r->mem_col0, |
| 378 | + r->mem_row1, |
| 379 | + r->mem_col1, |
| 380 | + r->mem_row2, |
| 381 | + r->mem_col2, |
| 382 | + r->mem_row3, |
| 383 | + r->mem_col3); |
| 384 | + |
| 385 | + dev_info(dev->mt76.dev, "rStaRecBf.u2SmartAnt = 0x%x\n" |
| 386 | + "rStaRecBf.ucSEIdx = %d\n" |
| 387 | + "rStaRecBf.uciBfTimeOut = 0x%x\n" |
| 388 | + "rStaRecBf.uciBfDBW = %d\n" |
| 389 | + "rStaRecBf.uciBfNcol = %d\n" |
| 390 | + "rStaRecBf.uciBfNrow = %d\n" |
| 391 | + "rStaRecBf.nr_bw160 = %d\n" |
| 392 | + "rStaRecBf.nc_bw160 = %d\n" |
| 393 | + "rStaRecBf.ru_start_idx = %d\n" |
| 394 | + "rStaRecBf.ru_end_idx = %d\n" |
| 395 | + "rStaRecBf.trigger_su = %d\n" |
| 396 | + "rStaRecBf.trigger_mu = %d\n" |
| 397 | + "rStaRecBf.ng16_su = %d\n" |
| 398 | + "rStaRecBf.ng16_mu = %d\n" |
| 399 | + "rStaRecBf.codebook42_su = %d\n" |
| 400 | + "rStaRecBf.codebook75_mu = %d\n" |
| 401 | + "rStaRecBf.he_ltf = %d\n" |
| 402 | + "======================================\n", |
| 403 | + r->smart_ant, |
| 404 | + r->se_idx, |
| 405 | + r->bf_timeout, |
| 406 | + r->bf_dbw, |
| 407 | + r->bf_ncol, |
| 408 | + r->bf_nrow, |
| 409 | + r->nr_lt_bw80, |
| 410 | + r->nc_lt_bw80, |
| 411 | + r->ru_start_idx, |
| 412 | + r->ru_end_idx, |
| 413 | + r->trigger_su, |
| 414 | + r->trigger_mu, |
| 415 | + r->ng16_su, |
| 416 | + r->ng16_mu, |
| 417 | + r->codebook42_su, |
| 418 | + r->codebook75_mu, |
| 419 | + r->he_ltf); |
| 420 | + break; |
| 421 | + } |
| 422 | + case UNI_EVENT_BF_FBK_INFO: { |
| 423 | + struct mt7996_mcu_txbf_fbk_info *info; |
| 424 | + __le32 total, i; |
| 425 | + |
| 426 | + info = (struct mt7996_mcu_txbf_fbk_info *)skb->data; |
| 427 | + |
| 428 | + total = info->u4PFMUWRDoneCnt + info->u4PFMUWRFailCnt; |
| 429 | + total += info->u4PFMUWRTimeoutFreeCnt + info->u4FbRptPktDropCnt; |
| 430 | + |
| 431 | + dev_info(dev->mt76.dev, "\n"); |
| 432 | + dev_info(dev->mt76.dev, "\x1b[32m =================================\x1b[m\n"); |
| 433 | + dev_info(dev->mt76.dev, "\x1b[32m PFMUWRDoneCnt = %u\x1b[m\n", |
| 434 | + info->u4PFMUWRDoneCnt); |
| 435 | + dev_info(dev->mt76.dev, "\x1b[32m PFMUWRFailCnt = %u\x1b[m\n", |
| 436 | + info->u4PFMUWRFailCnt); |
| 437 | + dev_info(dev->mt76.dev, "\x1b[32m PFMUWRTimeOutCnt = %u\x1b[m\n", |
| 438 | + info->u4PFMUWRTimeOutCnt); |
| 439 | + dev_info(dev->mt76.dev, "\x1b[32m PFMUWRTimeoutFreeCnt = %u\x1b[m\n", |
| 440 | + info->u4PFMUWRTimeoutFreeCnt); |
| 441 | + dev_info(dev->mt76.dev, "\x1b[32m FbRptPktDropCnt = %u\x1b[m\n", |
| 442 | + info->u4FbRptPktDropCnt); |
| 443 | + dev_info(dev->mt76.dev, "\x1b[32m TotalFbRptPkt = %u\x1b[m\n", total); |
| 444 | + dev_info(dev->mt76.dev, "\x1b[32m PollPFMUIntrStatTimeOut = %u(micro-sec)\x1b[m\n", |
| 445 | + info->u4PollPFMUIntrStatTimeOut); |
| 446 | + dev_info(dev->mt76.dev, "\x1b[32m FbRptDeQInterval = %u(milli-sec)\x1b[m\n", |
| 447 | + info->u4DeQInterval); |
| 448 | + dev_info(dev->mt76.dev, "\x1b[32m PktCntInFbRptTimeOutQ = %u\x1b[m\n", |
| 449 | + info->u4RptPktTimeOutListNum); |
| 450 | + dev_info(dev->mt76.dev, "\x1b[32m PktCntInFbRptQ = %u\x1b[m\n", |
| 451 | + info->u4RptPktListNum); |
| 452 | + |
| 453 | + // [ToDo] Check if it is valid entry |
| 454 | + for (i = 0; ((i < 5) && (i < CFG_BF_STA_REC_NUM)); i++) { |
| 455 | + |
| 456 | + // [ToDo] AID needs to be refined |
| 457 | + dev_info(dev->mt76.dev,"\x1b[32m AID%u RxFbRptCnt = %u\x1b[m\n" |
| 458 | + , i, info->au4RxPerStaFbRptCnt[i]); |
| 459 | + } |
| 460 | + |
| 461 | + break; |
| 462 | + } |
| 463 | + case UNI_EVENT_BF_TXSND_INFO: { |
| 464 | + struct mt7996_mcu_tx_snd_info *info; |
| 465 | + struct uni_event_bf_txsnd_sta_info *snd_sta_info; |
| 466 | + int Idx; |
| 467 | + int max_wtbl_size = mt7996_wtbl_size(dev); |
| 468 | + |
| 469 | + info = (struct mt7996_mcu_tx_snd_info *)skb->data; |
| 470 | + dev_info(dev->mt76.dev, "=================== Global Setting ===================\n"); |
| 471 | + |
| 472 | + dev_info(dev->mt76.dev, "VhtOpt = 0x%02X, HeOpt = 0x%02X, GloOpt = 0x%02X\n", |
| 473 | + info->vht_opt, info->he_opt, info->glo_opt); |
| 474 | + |
| 475 | + for (Idx = 0; Idx < BF_SND_CTRL_STA_DWORD_CNT; Idx++) { |
| 476 | + dev_info(dev->mt76.dev, "SuSta[%d] = 0x%08X,", Idx, |
| 477 | + info->snd_rec_su_sta[Idx]); |
| 478 | + if ((Idx & 0x03) == 0x03) |
| 479 | + dev_info(dev->mt76.dev, "\n"); |
| 480 | + } |
| 481 | + |
| 482 | + if ((Idx & 0x03) != 0x03) |
| 483 | + dev_info(dev->mt76.dev, "\n"); |
| 484 | + |
| 485 | + |
| 486 | + for (Idx = 0; Idx < BF_SND_CTRL_STA_DWORD_CNT; Idx++) { |
| 487 | + dev_info(dev->mt76.dev, "VhtMuSta[%d] = 0x%08X,", Idx, info->snd_rec_vht_mu_sta[Idx]); |
| 488 | + if ((Idx & 0x03) == 0x03) |
| 489 | + dev_info(dev->mt76.dev, "\n"); |
| 490 | + } |
| 491 | + |
| 492 | + if ((Idx & 0x03) != 0x03) |
| 493 | + dev_info(dev->mt76.dev, "\n"); |
| 494 | + |
| 495 | + for (Idx = 0; Idx < BF_SND_CTRL_STA_DWORD_CNT; Idx++) { |
| 496 | + dev_info(dev->mt76.dev, "HeTBSta[%d] = 0x%08X,", Idx, info->snd_rec_he_tb_sta[Idx]); |
| 497 | + if ((Idx & 0x03) == 0x03) |
| 498 | + dev_info(dev->mt76.dev, "\n"); |
| 499 | + } |
| 500 | + |
| 501 | + if ((Idx & 0x03) != 0x03) |
| 502 | + dev_info(dev->mt76.dev, "\n"); |
| 503 | + |
| 504 | + for (Idx = 0; Idx < BF_SND_CTRL_STA_DWORD_CNT; Idx++) { |
| 505 | + dev_info(dev->mt76.dev, "EhtTBSta[%d] = 0x%08X,", Idx, info->snd_rec_eht_tb_sta[Idx]); |
| 506 | + if ((Idx & 0x03) == 0x03) |
| 507 | + dev_info(dev->mt76.dev, "\n"); |
| 508 | + } |
| 509 | + |
| 510 | + if ((Idx & 0x03) != 0x03) |
| 511 | + dev_info(dev->mt76.dev, "\n"); |
| 512 | + |
| 513 | + for (Idx = 0; Idx < CFG_WIFI_RAM_BAND_NUM; Idx++) { |
| 514 | + dev_info(dev->mt76.dev, "Band%u:\n", Idx); |
| 515 | + dev_info(dev->mt76.dev, " Wlan Idx For VHT MC Sounding = %u\n", info->wlan_idx_for_mc_snd[Idx]); |
| 516 | + dev_info(dev->mt76.dev, " Wlan Idx For HE TB Sounding = %u\n", info->wlan_idx_for_he_tb_snd[Idx]); |
| 517 | + dev_info(dev->mt76.dev, " Wlan Idx For EHT TB Sounding = %u\n", info->wlan_idx_for_eht_tb_snd[Idx]); |
| 518 | + } |
| 519 | + |
| 520 | + dev_info(dev->mt76.dev, "ULLen = %d, ULMcs = %d, ULLDCP = %d\n", |
| 521 | + info->ul_length, info->mcs, info->ldpc); |
| 522 | + |
| 523 | + dev_info(dev->mt76.dev, "=================== STA Info ===================\n"); |
| 524 | + |
| 525 | + for (Idx = 1; (Idx < 5 && (Idx < CFG_BF_STA_REC_NUM)); Idx++) { |
| 526 | + snd_sta_info = &info->snd_sta_info[Idx]; |
| 527 | + dev_info(dev->mt76.dev, "Idx%2u Interval = %d, interval counter = %d, TxCnt = %d, StopReason = 0x%02X\n", |
| 528 | + Idx, |
| 529 | + snd_sta_info->snd_intv, |
| 530 | + snd_sta_info->snd_intv_cnt, |
| 531 | + snd_sta_info->snd_tx_cnt, |
| 532 | + snd_sta_info->snd_stop_reason); |
| 533 | + } |
| 534 | + |
| 535 | + dev_info(dev->mt76.dev, "=================== STA Info Connected ===================\n"); |
| 536 | + // [ToDo] How to iterate and get AID info of station |
| 537 | + // Check UniEventBFCtrlTxSndHandle() on Logan |
| 538 | + |
| 539 | + //hardcode max_wtbl_size as 5 |
| 540 | + max_wtbl_size = 5; |
| 541 | + for (Idx = 1; ((Idx < max_wtbl_size) && (Idx < CFG_BF_STA_REC_NUM)); Idx++) { |
| 542 | + |
| 543 | + // [ToDo] We do not show AID info here |
| 544 | + snd_sta_info = &info->snd_sta_info[Idx]; |
| 545 | + dev_info(dev->mt76.dev, " Interval = %d (%u ms), interval counter = %d (%u ms), TxCnt = %d, StopReason = 0x%02X\n", |
| 546 | + snd_sta_info->snd_intv, |
| 547 | + snd_sta_info->snd_intv * 10, |
| 548 | + snd_sta_info->snd_intv_cnt, |
| 549 | + snd_sta_info->snd_intv_cnt * 10, |
| 550 | + snd_sta_info->snd_tx_cnt, |
| 551 | + snd_sta_info->snd_stop_reason); |
| 552 | + } |
| 553 | + |
| 554 | + dev_info(dev->mt76.dev, "======================================\n"); |
| 555 | + |
| 556 | + break; |
| 557 | + } |
| 558 | + default: |
| 559 | + dev_info(dev->mt76.dev, "%s: unknown bf event tag %d\n", |
| 560 | + __func__, event->tag); |
| 561 | + } |
| 562 | + |
| 563 | +} |
| 564 | + |
| 565 | + |
| 566 | +int mt7996_mcu_set_muru_fixed_rate_enable(struct mt7996_dev *dev, u8 action, int val) |
| 567 | +{ |
| 568 | + struct { |
| 569 | + u8 _rsv[4]; |
| 570 | + |
| 571 | + __le16 tag; |
| 572 | + __le16 len; |
| 573 | + |
| 574 | + __le16 value; |
| 575 | + __le16 rsv; |
| 576 | + } __packed data = { |
| 577 | + .tag = cpu_to_le16(action), |
| 578 | + .len = cpu_to_le16(sizeof(data) - 4), |
| 579 | + .value = cpu_to_le16(!!val), |
| 580 | + }; |
| 581 | + |
| 582 | + return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, sizeof(data), |
| 583 | + false); |
| 584 | +} |
| 585 | + |
| 586 | +int mt7996_mcu_set_muru_fixed_rate_parameter(struct mt7996_dev *dev, u8 action, void *para) |
| 587 | +{ |
| 588 | + char *buf = (char *)para; |
| 589 | + u8 num_user = 0, recv_arg = 0, max_mcs = 0, usr_mcs[4] = {0}; |
| 590 | + __le16 bw; |
| 591 | + int i; |
| 592 | + struct { |
| 593 | + u8 _rsv[4]; |
| 594 | + |
| 595 | + __le16 tag; |
| 596 | + __le16 len; |
| 597 | + |
| 598 | + u8 cmd_version; |
| 599 | + u8 cmd_revision; |
| 600 | + __le16 rsv; |
| 601 | + |
| 602 | + struct uni_muru_mum_set_group_tbl_entry entry; |
| 603 | + } __packed data = { |
| 604 | + .tag = cpu_to_le16(action), |
| 605 | + .len = cpu_to_le16(sizeof(data) - 4), |
| 606 | + }; |
| 607 | + |
| 608 | +#define __RUALLOC_TYPE_CHECK_HE(BW) ((BW == RUALLOC_BW20) || (BW == RUALLOC_BW40) || (BW == RUALLOC_BW80) || (BW == RUALLOC_BW160)) |
| 609 | +#define __RUALLOC_TYPE_CHECK_EHT(BW) (__RUALLOC_TYPE_CHECK_HE(BW) || (BW == RUALLOC_BW320)) |
| 610 | + /* [Num of user] - 1~4 |
| 611 | + * [RUAlloc] - BW320: 395, BW160: 137, BW80: 134, BW40: 130, BW20: 122 |
| 612 | + * [LTF/GI] - For VHT, short GI: 0, Long GI: 1; * |
| 613 | + * For HE/EHT, 4xLTF+3.2us: 0, 4xLTF+0.8us: 1, 2xLTF+0.8us:2 |
| 614 | + * [Phy/FullBW] - VHT: 0 / HEFullBw: 1 / HEPartialBw: 2 / EHTFullBW: 3, EHTPartialBW: 4 |
| 615 | + * [DL/UL] DL: 0, UL: 1, DL_UL: 2 |
| 616 | + * [Wcid User0] - WCID 0 |
| 617 | + * [MCS of WCID0] - For HE/VHT, 0-11: 1ss MCS0-MCS11, 12-23: 2SS MCS0-MCS11 |
| 618 | + * For EHT, 0-13: 1ss MCS0-MCS13, 14-27: 2SS MCS0-MCS13 |
| 619 | + * [WCID 1] |
| 620 | + * [MCS of WCID1] |
| 621 | + * [WCID 2] |
| 622 | + * [MCS of WCID2] |
| 623 | + * [WCID 3] |
| 624 | + * [MCS of WCID3] |
| 625 | + */ |
| 626 | + |
| 627 | + recv_arg = sscanf(buf, "%hhu %hu %hhu %hhu %hhu %hu %hhu %hu %hhu %hu %hhu %hu %hhu", |
| 628 | + &num_user, &bw, &data.entry.gi, &data.entry.capa, &data.entry.dl_ul, |
| 629 | + &data.entry.wlan_idx0, &usr_mcs[0], |
| 630 | + &data.entry.wlan_idx1, &usr_mcs[1], |
| 631 | + &data.entry.wlan_idx2, &usr_mcs[2], |
| 632 | + &data.entry.wlan_idx3, &usr_mcs[3]); |
| 633 | + |
| 634 | + if (recv_arg != (5 + (2 * num_user))) { |
| 635 | + dev_err(dev->mt76.dev, "The number of argument is invalid\n"); |
| 636 | + goto error; |
| 637 | + } |
| 638 | + |
| 639 | + if (num_user > 0 && num_user < 5) |
| 640 | + data.entry.num_user = num_user - 1; |
| 641 | + else { |
| 642 | + dev_err(dev->mt76.dev, "The number of user count is invalid\n"); |
| 643 | + goto error; |
| 644 | + } |
| 645 | + |
| 646 | + /** |
| 647 | + * Older chip shall be set as HE. Refer to getHWSupportByChip() in Logan |
| 648 | + * driver to know the value for differnt chips |
| 649 | + */ |
| 650 | + data.cmd_version = UNI_CMD_MURU_VER_EHT; |
| 651 | + |
| 652 | + if (data.cmd_version == UNI_CMD_MURU_VER_EHT) |
| 653 | + max_mcs = UNI_MAX_MCS_SUPPORT_EHT; |
| 654 | + else |
| 655 | + max_mcs = UNI_MAX_MCS_SUPPORT_HE; |
| 656 | + |
| 657 | + |
| 658 | + // Parameter Check |
| 659 | + if (data.cmd_version != UNI_CMD_MURU_VER_EHT) { |
| 660 | + if ((data.entry.capa > MAX_MODBF_HE) || (bw == RUALLOC_BW320)) |
| 661 | + goto error; |
| 662 | + } else { |
| 663 | + if ((data.entry.capa <= MAX_MODBF_HE) && (bw == RUALLOC_BW320)) |
| 664 | + goto error; |
| 665 | + } |
| 666 | + |
| 667 | + if (data.entry.capa <= MAX_MODBF_HE) |
| 668 | + max_mcs = UNI_MAX_MCS_SUPPORT_HE; |
| 669 | + |
| 670 | + if (__RUALLOC_TYPE_CHECK_EHT(bw)) { |
| 671 | + data.entry.ru_alloc = (u8)(bw & 0xFF); |
| 672 | + if (bw == RUALLOC_BW320) |
| 673 | + data.entry.ru_alloc_ext = (u8)(bw >> 8); |
| 674 | + } else { |
| 675 | + dev_err(dev->mt76.dev, "RU_ALLOC argument is invalid\n"); |
| 676 | + goto error; |
| 677 | + } |
| 678 | + |
| 679 | + if ((data.entry.gi > 2) || |
| 680 | + ((data.entry.gi > 1) && (data.entry.capa == MAX_MODBF_VHT))) { |
| 681 | + dev_err(dev->mt76.dev, "GI argument is invalid\n"); |
| 682 | + goto error; |
| 683 | + } |
| 684 | + |
| 685 | + if (data.entry.dl_ul > 2) { |
| 686 | + dev_err(dev->mt76.dev, "DL_UL argument is invalid\n"); |
| 687 | + goto error; |
| 688 | + } |
| 689 | + |
| 690 | +#define __mcs_handler(_n) \ |
| 691 | + do { \ |
| 692 | + if (usr_mcs[_n] > max_mcs) { \ |
| 693 | + usr_mcs[_n] -= (max_mcs + 1); \ |
| 694 | + data.entry.nss##_n = 1; \ |
| 695 | + if (usr_mcs[_n] > max_mcs) \ |
| 696 | + usr_mcs[_n] = max_mcs; \ |
| 697 | + } \ |
| 698 | + if ((data.entry.dl_ul & 0x1) == 0) \ |
| 699 | + data.entry.dl_mcs_user##_n = usr_mcs[_n]; \ |
| 700 | + if ((data.entry.dl_ul & 0x3) > 0) \ |
| 701 | + data.entry.ul_mcs_user##_n = usr_mcs[_n]; \ |
| 702 | + } \ |
| 703 | + while (0) |
| 704 | + |
| 705 | + for (i=0; i<= data.entry.num_user; i++) { |
| 706 | + switch (i) { |
| 707 | + case 0: |
| 708 | + __mcs_handler(0); |
| 709 | + break; |
| 710 | + case 1: |
| 711 | + __mcs_handler(1); |
| 712 | + break; |
| 713 | + case 2: |
| 714 | + __mcs_handler(2); |
| 715 | + break; |
| 716 | + case 3: |
| 717 | + __mcs_handler(3); |
| 718 | + break; |
| 719 | + default: |
| 720 | + break; |
| 721 | + } |
| 722 | + } |
| 723 | +#undef __mcs_handler |
| 724 | + |
| 725 | + |
| 726 | + return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &data, |
| 727 | + sizeof(data), false); |
| 728 | + |
| 729 | +error: |
| 730 | + dev_err(dev->mt76.dev, "Command failed!\n"); |
| 731 | + return -EINVAL; |
| 732 | +} |
| 733 | + |
| 734 | #endif |
| 735 | diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 736 | index 098e63ae..27d6a05b 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 737 | --- a/mt7996/mtk_mcu.h |
| 738 | +++ b/mt7996/mtk_mcu.h |
| 739 | @@ -119,6 +119,348 @@ enum { |
| 740 | EDCCA_FCC = 1, |
| 741 | EDCCA_ETSI = 2, |
| 742 | EDCCA_JAPAN = 3 |
| 743 | + |
| 744 | +struct bf_pfmu_tag { |
| 745 | + __le16 tag; |
| 746 | + __le16 len; |
| 747 | + |
| 748 | + u8 pfmu_id; |
| 749 | + bool bfer; |
| 750 | + u8 band_idx; |
| 751 | + u8 __rsv[5]; |
| 752 | + u8 buf[56]; |
| 753 | +} __packed; |
| 754 | + |
| 755 | +struct bf_starec_read { |
| 756 | + __le16 tag; |
| 757 | + __le16 len; |
| 758 | + |
| 759 | + __le16 wlan_idx; |
| 760 | + u8 __rsv[2]; |
| 761 | +} __packed; |
| 762 | + |
| 763 | +struct bf_fbk_rpt_info { |
| 764 | + __le16 tag; |
| 765 | + __le16 len; |
| 766 | + |
| 767 | + __le16 wlan_idx; // Only need for dynamic_pfmu_update 0x4 |
| 768 | + u8 action; |
| 769 | + u8 band_idx; |
| 770 | + u8 __rsv[4]; |
| 771 | + |
| 772 | +} __packed; |
| 773 | + |
| 774 | +struct bf_txsnd_info { |
| 775 | + __le16 tag; |
| 776 | + __le16 len; |
| 777 | + |
| 778 | + u8 action; |
| 779 | + u8 read_clr; |
| 780 | + u8 vht_opt; |
| 781 | + u8 he_opt; |
| 782 | + __le16 wlan_idx; |
| 783 | + u8 glo_opt; |
| 784 | + u8 snd_intv; |
| 785 | + u8 snd_stop; |
| 786 | + u8 max_snd_stas; |
| 787 | + u8 tx_time; |
| 788 | + u8 mcs; |
| 789 | + u8 ldpc; |
| 790 | + u8 inf; |
| 791 | + u8 man; |
| 792 | + u8 ac_queue; |
| 793 | + u8 sxn_protect; |
| 794 | + u8 direct_fbk; |
| 795 | + u8 __rsv[2]; |
| 796 | +} __packed; |
| 797 | + |
| 798 | +struct mt7996_mcu_bf_basic_event { |
| 799 | + struct mt7996_mcu_rxd rxd; |
| 800 | + |
| 801 | + u8 __rsv1[4]; |
| 802 | + |
| 803 | + __le16 tag; |
| 804 | + __le16 len; |
| 805 | +}; |
| 806 | + |
| 807 | +struct mt7996_mcu_bf_starec_read { |
| 808 | + |
| 809 | + struct mt7996_mcu_bf_basic_event event; |
| 810 | + |
| 811 | + __le16 pfmu_id; |
| 812 | + bool is_su_mu; |
| 813 | + u8 txbf_cap; |
| 814 | + u8 sounding_phy; |
| 815 | + u8 ndpa_rate; |
| 816 | + u8 ndp_rate; |
| 817 | + u8 rpt_poll_rate; |
| 818 | + u8 tx_mode; |
| 819 | + u8 nc; |
| 820 | + u8 nr; |
| 821 | + u8 bw; |
| 822 | + u8 total_mem_require; |
| 823 | + u8 mem_require_20m; |
| 824 | + u8 mem_row0; |
| 825 | + u8 mem_col0:6; |
| 826 | + u8 mem_row0_msb:2; |
| 827 | + u8 mem_row1; |
| 828 | + u8 mem_col1:6; |
| 829 | + u8 mem_row1_msb:2; |
| 830 | + u8 mem_row2; |
| 831 | + u8 mem_col2:6; |
| 832 | + u8 mem_row2_msb:2; |
| 833 | + u8 mem_row3; |
| 834 | + u8 mem_col3:6; |
| 835 | + u8 mem_row3_msb:2; |
| 836 | + |
| 837 | + __le16 smart_ant; |
| 838 | + u8 se_idx; |
| 839 | + u8 auto_sounding_ctrl; |
| 840 | + |
| 841 | + u8 bf_timeout; |
| 842 | + u8 bf_dbw; |
| 843 | + u8 bf_ncol; |
| 844 | + u8 bf_nrow; |
| 845 | + |
| 846 | + u8 nr_lt_bw80; |
| 847 | + u8 nc_lt_bw80; |
| 848 | + u8 ru_start_idx; |
| 849 | + u8 ru_end_idx; |
| 850 | + |
| 851 | + bool trigger_su; |
| 852 | + bool trigger_mu; |
| 853 | + |
| 854 | + bool ng16_su; |
| 855 | + bool ng16_mu; |
| 856 | + |
| 857 | + bool codebook42_su; |
| 858 | + bool codebook75_mu; |
| 859 | + |
| 860 | + u8 he_ltf; |
| 861 | + u8 rsv[3]; |
| 862 | +}; |
| 863 | + |
| 864 | +#define TXBF_PFMU_ID_NUM_MAX 48 |
| 865 | + |
| 866 | +#define TXBF_PFMU_ID_NUM_MAX_TBTC_BAND0 TXBF_PFMU_ID_NUM_MAX |
| 867 | +#define TXBF_PFMU_ID_NUM_MAX_TBTC_BAND1 TXBF_PFMU_ID_NUM_MAX |
| 868 | +#define TXBF_PFMU_ID_NUM_MAX_TBTC_BAND2 TXBF_PFMU_ID_NUM_MAX |
| 869 | + |
| 870 | +/* CFG_BF_STA_REC shall be varied based on BAND Num */ |
| 871 | +#define CFG_BF_STA_REC_NUM (TXBF_PFMU_ID_NUM_MAX_TBTC_BAND0 + TXBF_PFMU_ID_NUM_MAX_TBTC_BAND1 + TXBF_PFMU_ID_NUM_MAX_TBTC_BAND2) |
| 872 | + |
| 873 | +#define BF_SND_CTRL_STA_DWORD_CNT ((CFG_BF_STA_REC_NUM + 0x1F) >> 5) |
| 874 | + |
| 875 | +#ifndef ALIGN_4 |
| 876 | + #define ALIGN_4(_value) (((_value) + 3) & ~3u) |
| 877 | +#endif /* ALIGN_4 */ |
| 878 | + |
| 879 | +#define CFG_WIFI_RAM_BAND_NUM 3 |
| 880 | + |
| 881 | +struct uni_event_bf_txsnd_sta_info { |
| 882 | + u8 snd_intv; /* Sounding interval upper bound, unit:15ms */ |
| 883 | + u8 snd_intv_cnt; /* Sounding interval counter */ |
| 884 | + u8 snd_tx_cnt; /* Tx sounding count for debug */ |
| 885 | + u8 snd_stop_reason; /* Bitwise reason to put in Stop Queue */ |
| 886 | +}; |
| 887 | + |
| 888 | +struct mt7996_mcu_tx_snd_info { |
| 889 | + |
| 890 | + struct mt7996_mcu_bf_basic_event event; |
| 891 | + |
| 892 | + u8 vht_opt; |
| 893 | + u8 he_opt; |
| 894 | + u8 glo_opt; |
| 895 | + u8 __rsv; |
| 896 | + __le32 snd_rec_su_sta[BF_SND_CTRL_STA_DWORD_CNT]; |
| 897 | + __le32 snd_rec_vht_mu_sta[BF_SND_CTRL_STA_DWORD_CNT]; |
| 898 | + __le32 snd_rec_he_tb_sta[BF_SND_CTRL_STA_DWORD_CNT]; |
| 899 | + __le32 snd_rec_eht_tb_sta[BF_SND_CTRL_STA_DWORD_CNT]; |
| 900 | + __le16 wlan_idx_for_mc_snd[ALIGN_4(CFG_WIFI_RAM_BAND_NUM)]; |
| 901 | + __le16 wlan_idx_for_he_tb_snd[ALIGN_4(CFG_WIFI_RAM_BAND_NUM)]; |
| 902 | + __le16 wlan_idx_for_eht_tb_snd[ALIGN_4(CFG_WIFI_RAM_BAND_NUM)]; |
| 903 | + __le16 ul_length; |
| 904 | + u8 mcs; |
| 905 | + u8 ldpc; |
| 906 | + struct uni_event_bf_txsnd_sta_info snd_sta_info[CFG_BF_STA_REC_NUM]; |
| 907 | +}; |
| 908 | + |
| 909 | +struct mt7996_mcu_txbf_fbk_info { |
| 910 | + |
| 911 | + struct mt7996_mcu_bf_basic_event event; |
| 912 | + |
| 913 | + __le32 u4DeQInterval; /* By ms */ |
| 914 | + __le32 u4PollPFMUIntrStatTimeOut; /* micro-sec */ |
| 915 | + __le32 u4RptPktTimeOutListNum; |
| 916 | + __le32 u4RptPktListNum; |
| 917 | + __le32 u4PFMUWRTimeOutCnt; |
| 918 | + __le32 u4PFMUWRFailCnt; |
| 919 | + __le32 u4PFMUWRDoneCnt; |
| 920 | + __le32 u4PFMUWRTimeoutFreeCnt; |
| 921 | + __le32 u4FbRptPktDropCnt; |
| 922 | + __le32 au4RxPerStaFbRptCnt[CFG_BF_STA_REC_NUM]; |
| 923 | +}; |
| 924 | + |
| 925 | +struct pfmu_ru_field { |
| 926 | + __le32 ru_start_id:7; |
| 927 | + __le32 _rsv1:1; |
| 928 | + __le32 ru_end_id:7; |
| 929 | + __le32 _rsv2:1; |
| 930 | +} __packed; |
| 931 | + |
| 932 | +struct pfmu_partial_bw_info { |
| 933 | + __le32 partial_bw_info:9; |
| 934 | + __le32 _rsv1:7; |
| 935 | +} __packed; |
| 936 | + |
| 937 | +struct mt7996_pfmu_tag1 { |
| 938 | + __le32 pfmu_idx:10; |
| 939 | + __le32 ebf:1; |
| 940 | + __le32 data_bw:3; |
| 941 | + __le32 lm:3; |
| 942 | + __le32 is_mu:1; |
| 943 | + __le32 nr:3; |
| 944 | + __le32 nc:3; |
| 945 | + __le32 codebook:2; |
| 946 | + __le32 ngroup:2; |
| 947 | + __le32 invalid_prof:1; |
| 948 | + __le32 _rsv:3; |
| 949 | + |
| 950 | + __le32 col_id1:7, row_id1:9; |
| 951 | + __le32 col_id2:7, row_id2:9; |
| 952 | + __le32 col_id3:7, row_id3:9; |
| 953 | + __le32 col_id4:7, row_id4:9; |
| 954 | + |
| 955 | + union { |
| 956 | + struct pfmu_ru_field field; |
| 957 | + struct pfmu_partial_bw_info bw_info; |
| 958 | + }; |
| 959 | + __le32 mob_cal_en:1; |
| 960 | + __le32 _rsv2:3; |
| 961 | + __le32 mob_ru_alloc:9; /* EHT profile uses full 9 bit */ |
| 962 | + __le32 _rsv3:3; |
| 963 | + |
| 964 | + __le32 snr_sts0:8, snr_sts1:8, snr_sts2:8, snr_sts3:8; |
| 965 | + __le32 snr_sts4:8, snr_sts5:8, snr_sts6:8, snr_sts7:8; |
| 966 | + |
| 967 | + __le32 _rsv4; |
| 968 | +} __packed; |
| 969 | + |
| 970 | +struct mt7996_pfmu_tag2 { |
| 971 | + __le32 smart_ant:24; |
| 972 | + __le32 se_idx:5; |
| 973 | + __le32 _rsv:3; |
| 974 | + |
| 975 | + __le32 _rsv1:16; |
| 976 | + __le32 ibf_timeout:8; |
| 977 | + __le32 _rsv2:8; |
| 978 | + |
| 979 | + __le32 ibf_data_bw:3; |
| 980 | + __le32 ibf_nc:3; |
| 981 | + __le32 ibf_nr:3; |
| 982 | + __le32 ibf_ru:9; |
| 983 | + __le32 _rsv3:14; |
| 984 | + |
| 985 | + __le32 mob_delta_t:8; |
| 986 | + __le32 mob_lq_result:7; |
| 987 | + __le32 _rsv5:1; |
| 988 | + __le32 _rsv6:16; |
| 989 | + |
| 990 | + __le32 _rsv7; |
| 991 | +} __packed; |
| 992 | + |
| 993 | +struct mt7996_pfmu_tag_event { |
| 994 | + struct mt7996_mcu_bf_basic_event event; |
| 995 | + |
| 996 | + u8 bfer; |
| 997 | + u8 __rsv[3]; |
| 998 | + |
| 999 | + struct mt7996_pfmu_tag1 t1; |
| 1000 | + struct mt7996_pfmu_tag2 t2; |
| 1001 | +}; |
| 1002 | + |
| 1003 | +enum { |
| 1004 | + UNI_EVENT_BF_PFMU_TAG = 0x5, |
| 1005 | + UNI_EVENT_BF_PFMU_DATA = 0x7, |
| 1006 | + UNI_EVENT_BF_STAREC = 0xB, |
| 1007 | + UNI_EVENT_BF_CAL_PHASE = 0xC, |
| 1008 | + UNI_EVENT_BF_FBK_INFO = 0x17, |
| 1009 | + UNI_EVENT_BF_TXSND_INFO = 0x18, |
| 1010 | + UNI_EVENT_BF_PLY_INFO = 0x19, |
| 1011 | + UNI_EVENT_BF_METRIC_INFO = 0x1A, |
| 1012 | + UNI_EVENT_BF_TXCMD_CFG_INFO = 0x1B, |
| 1013 | + UNI_EVENT_BF_SND_CNT_INFO = 0x1D, |
| 1014 | + UNI_EVENT_BF_MAX_NUM |
| 1015 | +}; |
| 1016 | + |
| 1017 | +enum { |
| 1018 | + UNI_CMD_MURU_FIXED_RATE_CTRL = 0x11, |
| 1019 | + UNI_CMD_MURU_FIXED_GROUP_RATE_CTRL, |
| 1020 | +}; |
| 1021 | + |
| 1022 | +struct uni_muru_mum_set_group_tbl_entry { |
| 1023 | + __le16 wlan_idx0; |
| 1024 | + __le16 wlan_idx1; |
| 1025 | + __le16 wlan_idx2; |
| 1026 | + __le16 wlan_idx3; |
| 1027 | + |
| 1028 | + u8 dl_mcs_user0:4; |
| 1029 | + u8 dl_mcs_user1:4; |
| 1030 | + u8 dl_mcs_user2:4; |
| 1031 | + u8 dl_mcs_user3:4; |
| 1032 | + u8 ul_mcs_user0:4; |
| 1033 | + u8 ul_mcs_user1:4; |
| 1034 | + u8 ul_mcs_user2:4; |
| 1035 | + u8 ul_mcs_user3:4; |
| 1036 | + |
| 1037 | + u8 num_user:2; |
| 1038 | + u8 rsv:6; |
| 1039 | + u8 nss0:2; |
| 1040 | + u8 nss1:2; |
| 1041 | + u8 nss2:2; |
| 1042 | + u8 nss3:2; |
| 1043 | + u8 ru_alloc; |
| 1044 | + u8 ru_alloc_ext; |
| 1045 | + |
| 1046 | + u8 capa; |
| 1047 | + u8 gi; |
| 1048 | + u8 dl_ul; |
| 1049 | + u8 _rsv2; |
| 1050 | +}; |
| 1051 | + |
| 1052 | +enum UNI_CMD_MURU_VER_T { |
| 1053 | + UNI_CMD_MURU_VER_LEG = 0, |
| 1054 | + UNI_CMD_MURU_VER_HE, |
| 1055 | + UNI_CMD_MURU_VER_EHT, |
| 1056 | + UNI_CMD_MURU_VER_MAX |
| 1057 | +}; |
| 1058 | + |
| 1059 | +#define UNI_MAX_MCS_SUPPORT_HE 11 |
| 1060 | +#define UNI_MAX_MCS_SUPPORT_EHT 13 |
| 1061 | + |
| 1062 | +enum { |
| 1063 | + RUALLOC_BW20 = 122, |
| 1064 | + RUALLOC_BW40 = 130, |
| 1065 | + RUALLOC_BW80 = 134, |
| 1066 | + RUALLOC_BW160 = 137, |
| 1067 | + RUALLOC_BW320 = 395, |
| 1068 | +}; |
| 1069 | + |
| 1070 | +enum { |
| 1071 | + MAX_MODBF_VHT = 0, |
| 1072 | + MAX_MODBF_HE = 2, |
| 1073 | + MAX_MODBF_EHT = 4, |
| 1074 | +}; |
| 1075 | + |
| 1076 | +enum { |
| 1077 | + BF_SND_READ_INFO = 0, |
| 1078 | + BF_SND_CFG_OPT, |
| 1079 | + BF_SND_CFG_INTV, |
| 1080 | + BF_SND_STA_STOP, |
| 1081 | + BF_SND_CFG_MAX_STA, |
| 1082 | + BF_SND_CFG_BFRP, |
| 1083 | + BF_SND_CFG_INF, |
| 1084 | + BF_SND_CFG_TXOP_SND |
| 1085 | }; |
| 1086 | |
| 1087 | enum { |
| 1088 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1089 | 2.45.2 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1090 | |