rtw89: add Realtek 802.11ax driver
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
2021-10-11 14:47:27 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
|
|
|
* Copyright(c) 2019-2020 Realtek Corporation
|
|
|
|
*/
|
|
|
|
#ifndef __RTW89_UTIL_H__
|
|
|
|
#define __RTW89_UTIL_H__
|
|
|
|
|
|
|
|
#include "core.h"
|
|
|
|
|
|
|
|
#define rtw89_iterate_vifs_bh(rtwdev, iterator, data) \
|
|
|
|
ieee80211_iterate_active_interfaces_atomic((rtwdev)->hw, \
|
|
|
|
IEEE80211_IFACE_ITER_NORMAL, iterator, data)
|
|
|
|
|
2025-01-22 14:03:08 +08:00
|
|
|
/* call this function with wiphy mutex is held */
|
rtw89: add Realtek 802.11ax driver
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
2021-10-11 14:47:27 +03:00
|
|
|
#define rtw89_for_each_rtwvif(rtwdev, rtwvif) \
|
|
|
|
list_for_each_entry(rtwvif, &(rtwdev)->rtwvifs_list, list)
|
|
|
|
|
2024-07-31 15:05:04 +08:00
|
|
|
/* Before adding rtwvif to list, we need to check if it already exist, beacase
|
|
|
|
* in some case such as SER L2 happen during WoWLAN flow, calling reconfig
|
|
|
|
* twice cause the list to be added twice.
|
|
|
|
*/
|
|
|
|
static inline bool rtw89_rtwvif_in_list(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_vif *new)
|
|
|
|
{
|
|
|
|
struct rtw89_vif *rtwvif;
|
|
|
|
|
2025-01-22 14:03:07 +08:00
|
|
|
lockdep_assert_wiphy(rtwdev->hw->wiphy);
|
2024-07-31 15:05:04 +08:00
|
|
|
|
|
|
|
rtw89_for_each_rtwvif(rtwdev, rtwvif)
|
|
|
|
if (rtwvif == new)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-04-14 14:20:25 +08:00
|
|
|
/* The result of negative dividend and positive divisor is undefined, but it
|
|
|
|
* should be one case of round-down or round-up. So, make it round-down if the
|
|
|
|
* result is round-up.
|
|
|
|
* Note: the maximum value of divisor is 0x7FFF_FFFF, because we cast it to
|
|
|
|
* signed value to make compiler to use signed divide instruction.
|
|
|
|
*/
|
|
|
|
static inline s32 s32_div_u32_round_down(s32 dividend, u32 divisor, s32 *remainder)
|
|
|
|
{
|
|
|
|
s32 i_divisor = (s32)divisor;
|
|
|
|
s32 i_remainder;
|
|
|
|
s32 quotient;
|
|
|
|
|
|
|
|
quotient = dividend / i_divisor;
|
|
|
|
i_remainder = dividend % i_divisor;
|
|
|
|
|
|
|
|
if (i_remainder < 0) {
|
|
|
|
quotient--;
|
|
|
|
i_remainder += i_divisor;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (remainder)
|
|
|
|
*remainder = i_remainder;
|
|
|
|
return quotient;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline s32 s32_div_u32_round_closest(s32 dividend, u32 divisor)
|
|
|
|
{
|
|
|
|
return s32_div_u32_round_down(dividend + divisor / 2, divisor, NULL);
|
|
|
|
}
|
|
|
|
|
2022-10-27 13:27:07 +08:00
|
|
|
static inline void ether_addr_copy_mask(u8 *dst, const u8 *src, u8 mask)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
eth_zero_addr(dst);
|
|
|
|
for (i = 0; i < ETH_ALEN; i++) {
|
|
|
|
if (mask & BIT(i))
|
|
|
|
dst[i] = src[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-03-06 10:11:40 +08:00
|
|
|
s32 rtw89_linear_to_db_quarter(u64 val);
|
|
|
|
s32 rtw89_linear_to_db(u64 val);
|
|
|
|
u64 rtw89_db_quarter_to_linear(s32 db);
|
|
|
|
u64 rtw89_db_to_linear(s32 db);
|
wifi: rtw89: debugfs: implement file_ops::read/write to replace seq_file
Since debugfs needs wiphy lock held, wiphy_locked_debugfs_{read,write}()
will be adopted, so implmenet file_ops::read/write along with their
arguments.
For reading part, it needs lots of changes because seq_file is not
suitable for wiphy_locked_debugfs_{read,write}(), so use spatch script
below to convert basically, and manually implement the functions.
@ rule1 @
identifier m;
@@
- seq_printf(m,
+ p += scnprintf(p, end - p,
...)
@ rule2 @
identifier m;
@@
- seq_puts(m,
+ p += scnprintf(p, end - p,
...)
For current version, only 4K buffer to output. To note ourselves, add
ellipsis symbol "..." to trailing if buffer is full. Later, add an option
to specify buffer size needed by a debugfs entry.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122060310.31976-4-pkshih@realtek.com
2025-01-22 14:03:03 +08:00
|
|
|
void rtw89_might_trailing_ellipsis(char *buf, size_t size, ssize_t used);
|
2024-06-07 15:06:58 +08:00
|
|
|
|
rtw89: add Realtek 802.11ax driver
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
2021-10-11 14:47:27 +03:00
|
|
|
#endif
|