developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From 073ba6d0288ea53059ec280b7789a2cbf25ba03f Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Mon, 22 Jul 2024 10:47:45 +0800 |
| 4 | Subject: [PATCH 186/199] mtk: mt76: mt7996: add mcu command to set bssid |
| 5 | mapping address |
| 6 | |
| 7 | When receiving 4 address non-amsdu packet, there is no bssid in the address |
| 8 | field. Set mcu command to use A1 as bssid when receiving 4 address non-amsdu |
| 9 | packet. |
| 10 | |
| 11 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 12 | --- |
| 13 | mt7996/init.c | 7 +++++++ |
| 14 | mt7996/mcu.c | 26 ++++++++++++++++++++++++++ |
| 15 | mt7996/mcu.h | 1 + |
| 16 | mt7996/mt7996.h | 1 + |
| 17 | 4 files changed, 35 insertions(+) |
| 18 | |
| 19 | diff --git a/mt7996/init.c b/mt7996/init.c |
| 20 | index f923ce66..25f772af 100644 |
| 21 | --- a/mt7996/init.c |
| 22 | +++ b/mt7996/init.c |
| 23 | @@ -539,6 +539,9 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band) |
| 24 | { |
| 25 | u32 mask, set; |
| 26 | |
| 27 | + if (!mt7996_band_valid(dev, band)) |
| 28 | + return; |
| 29 | + |
| 30 | /* clear estimated value of EIFS for Rx duration & OBSS time */ |
| 31 | mt76_wr(dev, MT_WF_RMAC_RSVD0(band), MT_WF_RMAC_RSVD0_EIFS_CLR); |
| 32 | |
| 33 | @@ -566,6 +569,10 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band) |
| 34 | * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set. |
| 35 | */ |
| 36 | mt76_set(dev, MT_AGG_ACR4(band), MT_AGG_ACR_PPDU_TXS2H); |
| 37 | + |
| 38 | + |
| 39 | + if (!is_mt7996(&dev->mt76)) |
| 40 | + mt7996_mcu_set_bssid_mapping_addr(&dev->mt76, band); |
| 41 | } |
| 42 | |
| 43 | static void mt7996_mac_init_basic_rates(struct mt7996_dev *dev) |
| 44 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| 45 | index 0af0ca82..ead9ff4f 100644 |
| 46 | --- a/mt7996/mcu.c |
| 47 | +++ b/mt7996/mcu.c |
| 48 | @@ -6117,6 +6117,32 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev, |
| 49 | &req, sizeof(req), true); |
| 50 | } |
| 51 | |
| 52 | +int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band_idx) |
| 53 | +{ |
| 54 | + enum { |
| 55 | + BSSID_MAPPING_ADDR1, |
| 56 | + BSSID_MAPPING_ADDR2, |
| 57 | + BSSID_MAPPING_ADDR3, |
| 58 | + }; |
| 59 | + struct { |
| 60 | + u8 band_idx; |
| 61 | + u8 _rsv1[3]; |
| 62 | + |
| 63 | + __le16 tag; |
| 64 | + __le16 len; |
| 65 | + u8 addr; |
| 66 | + u8 _rsv2[3]; |
| 67 | + } __packed req = { |
| 68 | + .band_idx = band_idx, |
| 69 | + .tag = cpu_to_le16(UNI_BAND_CONFIG_BSSID_MAPPING_ADDR), |
| 70 | + .len = cpu_to_le16(sizeof(req) - 4), |
| 71 | + .addr = BSSID_MAPPING_ADDR1, |
| 72 | + }; |
| 73 | + |
| 74 | + return mt76_mcu_send_msg(dev, MCU_WM_UNI_CMD(BAND_CONFIG), |
| 75 | + &req, sizeof(req), true); |
| 76 | +} |
| 77 | + |
| 78 | int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val) |
| 79 | { |
| 80 | struct { |
| 81 | diff --git a/mt7996/mcu.h b/mt7996/mcu.h |
| 82 | index ffa574b8..5d4625c8 100644 |
| 83 | --- a/mt7996/mcu.h |
| 84 | +++ b/mt7996/mcu.h |
| 85 | @@ -1067,6 +1067,7 @@ enum { |
| 86 | UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08, |
| 87 | UNI_BAND_CONFIG_RTS_SIGTA_EN = 0x09, |
| 88 | UNI_BAND_CONFIG_DIS_SECCH_CCA_DET = 0x0a, |
| 89 | + UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12, |
| 90 | }; |
| 91 | |
| 92 | enum { |
| 93 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
| 94 | index c1823759..e1e1160a 100644 |
| 95 | --- a/mt7996/mt7996.h |
| 96 | +++ b/mt7996/mt7996.h |
| 97 | @@ -1108,6 +1108,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index, |
| 98 | const struct mt7996_dfs_pattern *pattern); |
| 99 | int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable); |
| 100 | int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val); |
| 101 | +int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band); |
| 102 | int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct mt7996_bss_conf *mconf); |
| 103 | int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch); |
| 104 | int mt7996_mcu_get_temperature(struct mt7996_phy *phy); |
| 105 | -- |
| 106 | 2.18.0 |
| 107 | |