aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/realtek/rtw89/txrx.h
AgeCommit message (Collapse)Author
2023-10-30wifi: rtw89: consider RX info for WiFi 7 chipsPing-Ke Shih
For WiFi 7 chips, some fields and predefined length are changed, so add them accordingly. The mac_id field is used to identify peer that send a packet, and we can use it to know RSSI and traffic from the peer. For WiFi 7 chips, RXWD.mac_id of PPDU status packet is not set by hardware. Instead, we should fill it by rxinfo_user[].mac_id of PPDU status content. Also, filter out invalid reports to prevent warning messages keep showing. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20231027015059.10032-4-pkshih@realtek.com
2023-09-18wifi: rtw89: add to fill TX descriptor v2Ping-Ke Shih
The format v2 of TX descriptor contains 8-word body and 8-word info, and fields include packet size, MAC_ID, security key ID and etc. By design, it can possibly only fill body to reduce overhead, but this driver keeps thing simple, so always fill body and info currently. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230911082049.33541-4-pkshih@realtek.com
2023-09-18wifi: rtw89: add to query RX descriptor format v2Ping-Ke Shih
RX descriptor is used to provide meta data of received data. The WiFi 7 chips use different RX descriptor format, so add this parser along with hardware design. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230911082049.33541-2-pkshih@realtek.com
2023-08-01wifi: rtw89: get data rate mode/NSS/MCS v1 from RX descriptorPing-Ke Shih
The data rate from RX descriptor also uses hardware rate v1 for WiFi 7 chips. The rate code contains three parts -- mode, NSS and MCS. For CCK/OFDM/HT rates, NSS/MCS parts are the same as before. VHT/HE/EHT rates are changed and listed as below: mode NSS MCS V0 [8:7] [6:4] [3:0] V1 [10:8] [7:5] [4:0] Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230728070252.66525-11-pkshih@realtek.com
2023-05-25wifi: rtw89: use struct and le32_get_bits() to access RX descriptorPing-Ke Shih
RX descriptor is to provide basic and important information related to packets, such as packet size, security, MAC ID and so on. Change to use struct to access these fields, and not change logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230522122513.13559-5-pkshih@realtek.com
2023-05-25wifi: rtw89: use struct and le32_get_bits() to access received PHY status IEsPing-Ke Shih
PHY status IEs generated by BB hardware is to provide more detail information related to received packets, such as RSSI and bandwidth. To avoid type casting, change buf type from u8* to void* as well. This patch doesn't change logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230522122513.13559-4-pkshih@realtek.com
2023-05-25wifi: rtw89: use struct and le32_get_bits to access RX infoPing-Ke Shih
If received packet type is PPDU status, RX info provides information attached by MAC hardware, and mention how long BB information attached. This conversion patch doesn't change logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230522122513.13559-3-pkshih@realtek.com
2023-05-05wifi: rtw89: add EVM and SNR statistics to debugfsPing-Ke Shih
To help debug performance problem, add EVM and SNR statistics to debugfs that shows EVM: [(26.75, 26.75) (25.75, 25.75)] SNR: 40 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230418012820.5139-5-pkshih@realtek.com
2023-05-05wifi: rtw89: use struct rtw89_phy_sts_ie0 instead of macro to access PHY IE0 ↵Ping-Ke Shih
status To be more clear to know where it gets information from PHY IE0 data, change to use struct and standard le32_get_bits() to access. This doesn't change logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230418012820.5139-2-pkshih@realtek.com
2022-12-14wifi: rtw89: consider ER SU as a TX capabilityPing-Ke Shih
ER (Extended Range) SU is to have a larger coverage. We set this as a RA capability, and then firmware can choose ER SU to transmit packets to reception at cell edge. For 8852C, it needs to fill this capability in TXWD, so update rtw89_build_txwd_info0_v1(). Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20221209012110.7242-1-pkshih@realtek.com
2022-11-22wifi: rtw89: read CFO from FD or preamble CFO field of phy status ie_type 1 ↵Eric Huang
accordingly Add macro to get FD(frequency domain) CFO field from ie_type 1, and correct the naming for preamble CFO field. Each IC could assign the CFO source to either FD CFO or preamble CFO in chip_info. Based on the suggestion from HW designer, rtw8852b and its derived versions will have better CFO tracking performance with FD CFO. Signed-off-by: Eric Huang <echuang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20221117063001.42967-2-pkshih@realtek.com
2022-04-06rtw89: read RX bandwidth from v1 type RX descriptorPing-Ke Shih
8852C uses different fields to represent RX bandwidth. Since other fields are the same, I check chip_id to get bandwidth instead of creating another v1 function. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220318023214.32411-12-pkshih@realtek.com
2022-04-06rtw89: support hardware generate security headerPing-Ke Shih
The newer chip will generate security header itself, so don't set IEEE80211_KEY_FLAG_GENERATE_IV in this kind of chip. But, it needs to fill key_index, PN and 802.11 header length to TX descriptor, and then hardware uses these to generate security header. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220318023214.32411-11-pkshih@realtek.com
2022-04-06rtw89: support variant of fill_txdescPing-Ke Shih
The txdesc is descriptor related to skb->data. The v1 version contains 8 dwords txwd_body and 6 dwords txwd_info, and the format is also different from original one. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220318023214.32411-10-pkshih@realtek.com
2022-04-06rtw89: add chip_info::h2c_desc_size/fill_txdesc_fwcmd to support new chipsPing-Ke Shih
8852A and 8852C use different H2C header and size, so add h2c_desc_size to allocate different header size and fill content by fill_txdesc_fwcmd. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220318023214.32411-8-pkshih@realtek.com
2022-01-28rtw89: set mac_id and port ID to TXWDPing-Ke Shih
One mac_id is corresponding to one connected station, and port ID is a ID of virtual interfaces. With proper mac_id and port ID, firmware and hardware can handle a packet with correct context. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-12-pkshih@realtek.com
2022-01-28rtw89: use hardware SSN to TX management framePing-Ke Shih
Since firmware transmits beacon by hardware SSN, driver does it with the same setting, then packets in the air have continual sequence number. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220107034239.22002-3-pkshih@realtek.com
2021-12-08rtw89: fix incorrect channel info during scanPo Hao Huang
We used to fill in rx skbs' frequency field by mac80211's current channel value. In some cases, mac80211 switches channel before all rx packets have been processed. This results in incorrect bss info. We fix this by filling in frequency field with channel index obtained from hardware, then fix potential cck missing issue by skb's original hw rate. After all fix is done, convert hw rate back to the supported band rate index. Signed-off-by: Po Hao Huang <phhuang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211111023706.14154-3-pkshih@realtek.com
2021-12-08rtw89: add const in the cast of le32_get_bits()Ping-Ke Shih
Add 'const' to be clear that this is a read-only access, and this patch doesn't change logic at all. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Takashi Iwai <tiwai@suse.de> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20211119054512.10620-3-pkshih@realtek.com
2021-10-13rtw89: add Realtek 802.11ax driverPing-Ke Shih
This driver named rtw89, which is the next generation of rtw88, supports Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC, Spatial reuse, TWT and BSS coloring; now some of them aren't implemented though. The chip architecture is entirely different from the chips supported by rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges are totally redefined, so it's impossible to reuse register definition. To communicate with firmware, new H2C/C2H format is proposed. In order to have better utilization, TX DMA flow is changed to two stages DMA. To provide rich RX status information, additional RX PPDU packets are added. Since there are so many differences mentioned above, we decide to propose a new driver. It has many authors, they are listed in alphabetic order: Chin-Yen Lee <timlee@realtek.com> Ping-Ke Shih <pkshih@realtek.com> Po Hao Huang <phhuang@realtek.com> Tzu-En Huang <tehuang@realtek.com> Vincent Fann <vincent_fann@realtek.com> Yan-Hsuan Chuang <tony0620emma@gmail.com> Zong-Zhe Yang <kevin_yang@realtek.com> Tested-by: Aaron Ma <aaron.ma@canonical.com> Tested-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com