wifi: rtw89: update RTL8922D capabilities and settings, and enable P2P device
Ping-Ke Shih
maintainerv2 cover wifi: rtw89: update RTL8922D capabilities and settings, and enable P2P device
Patches 1-3 are to enable/disable certain capabilities by specific application.
Patches 4-10 are to update hardware settings according to internal development.
Patches 11-14 are to support interface type P2P device, which is necessary for MLO concurrency.
v2:
- patch 1/14: correct PID from 0x892D to 0x895D
Chih-Wen Hsiao (1):
wifi: rtw89: 8922d: disable VCORE for thermal protection by default
Eric Huang (1):
wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v4
Hsiao-Yung Chen (2):
wifi: rtw89: 8922de: add low latency quirk for Valve device
wifi: rtw89: allow two station interfaces in SCC
Ping-Ke Shih (6):
wifi: rtw89: 8922d: set BB wrapper settings according to operating
channel
wifi: rtw89: 8922d: move conditionally disabled TX shape to common
flow
wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v5
wifi: rtw89: 8922d: send RFE type to firmware
wifi: rtw89: 8922d: bypass RX IQK when scan
wifi: rtw89: 8922d: correct selection of CCK rate circuit
Po-Hao Huang (1):
wifi: rtw89: add p2p device declaration
Zong-Zhe Yang (3):
wifi: rtw89: chan: introduce helper and refine active list iteration
wifi: rtw89: regd: check only active vifs when recalculating 6 GHz
power type
wifi: rtw89: skip tracking things when entity is paused
drivers/net/wireless/realtek/rtw89/chan.c | 28 ++- drivers/net/wireless/realtek/rtw89/chan.h | 1 + drivers/net/wireless/realtek/rtw89/core.c | 24 +- drivers/net/wireless/realtek/rtw89/core.h | 5 +- drivers/net/wireless/realtek/rtw89/debug.c | 3 +- drivers/net/wireless/realtek/rtw89/fw.c | 46 +++- drivers/net/wireless/realtek/rtw89/fw.h | 7 + drivers/net/wireless/realtek/rtw89/phy.c | 8 +- drivers/net/wireless/realtek/rtw89/phy.h | 20 +- drivers/net/wireless/realtek/rtw89/phy_be.c | 193 +++++++++----- drivers/net/wireless/realtek/rtw89/ps.c | 8 +- drivers/net/wireless/realtek/rtw89/reg.h | 8 + drivers/net/wireless/realtek/rtw89/regd.c | 2 +- drivers/net/wireless/realtek/rtw89/rtw8922d.c | 237 +++++++++++------- .../net/wireless/realtek/rtw89/rtw8922de.c | 8 +- drivers/net/wireless/realtek/rtw89/util.h | 4 + 16 files changed, 419 insertions(+), 183 deletions(-)
base-commit: 81510c3d6f2199889a4a936d8cf8b9e05911b10e
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 1/14 wifi: rtw89: 8922de: add low latency quirk for Valve device
From: Hsiao-Yung Chen <[email protected]>
Add RTW89_QUIRK_LOW_LATENCY to the rtw89_quirks enum for latency-sensitive platforms. When set, the RA report handler skips computing max_agg_wait and leaves it at its default of zero, which makes rtw89_core_txq_agg_wait() bail out early, so frames are dispatched immediately instead of being held to build an aggregate, trading throughput for lower latency.
Apply the quirk for the Valve device (SSID 0x1e44:0x1400) on the 8922DE, and add RTW89_CUSTID_VALVE for that customer ID.
--- drivers/net/wireless/realtek/rtw89/core.h | 2 ++ drivers/net/wireless/realtek/rtw89/phy.c | 3 ++- drivers/net/wireless/realtek/rtw89/rtw8922de.c | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +2 -0
@@ -6465,6 +6465,7 @@ enum rtw89_quirks {RTW89_QUIRK_THERMAL_PROT_110C ,RTW89_QUIRK_HW_INFO_SYSFS ,RTW89_QUIRK_DISABLE_2GHZ , +RTW89_QUIRK_LOW_LATENCY , NUM_OF_RTW89_QUIRKS, };
@@ -6479,6 +6480,7 @@ enum rtw89_custid {RTW89_CUSTID_AMD =6 ,RTW89_CUSTID_FUJITSU =7 ,RTW89_CUSTID_DELL =8 , + RTW89_CUSTID_VALVE, /* driver only */ }; enum rtw89_pkt_drop_sel {
drivers/net/wireless/realtek/rtw89/phy.c +2 -1
@@ -3345,7 +3345,8 @@ static void __rtw89_phy_c2h_ra_rpt_iter(struct rtw89_sta_link *rtwsta_link, *changed = true; } - rtwsta_link->max_agg_wait = link_sta->agg.max_rc_amsdu_len /1500 -1 ; +if (!test_bit (RTW89_QUIRK_LOW_LATENCY , rtwdev->quirks)) + rtwsta_link->max_agg_wait = link_sta->agg.max_rc_amsdu_len /1500 -1 ; }static void rtw89_phy_c2h_ra_rpt_iter (void *data,struct ieee80211_sta *sta)
drivers/net/wireless/realtek/rtw89/rtw8922de.c +7 -1
@@ -9,6 +9,12 @@#include "reg.h" #include "rtw8922d.h" +static const struct rtw89_pci_ssid_quirk rtw8922de_pci_ssid_quirks[] = { + {RTW89_PCI_SSID (PCI_VENDOR_ID_REALTEK ,0x895D ,0x1E44 ,0x1400 ,VALVE ), + .bitmap =BIT (RTW89_QUIRK_LOW_LATENCY )}, + {}, +}; +static const struct rtw89_pci_info rtw8922d_pci_info = { .gen_def = &rtw89_pci_gen_be, .isr_def = &rtw89_pci_isr_be_v1,
@@ -66,7 +72,7 @@ static const struct rtw89_pci_info rtw8922d_pci_info = { .disable_intr = rtw89_pci_disable_intr_v3, .recognize_intrs = rtw89_pci_recognize_intrs_v3, - .ssid_quirks = NULL, + .ssid_quirks = rtw8922de_pci_ssid_quirks, };static const struct rtw89_driver_info rtw89_8922de_vs_info = {
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerRe: [PATCH rtw-next v2 01/14] wifi: rtw89: 8922de: add low latency quirk for Valve device
Quoted 9 lines · Ping-Ke Shih
From: Hsiao-Yung Chen <[email protected]>
Add
RTW89_QUIRK_LOW_LATENCYto thertw89_quirksenum for latency-sensitive platforms. When set, the RA report handler skips computingmax_agg_waitand leaves it at its default of zero, which makesrtw89_core_txq_agg_wait()bail out early, so frames are dispatched immediately instead of being held to build an aggregate, trading throughput for lower latency.
Quoted 5 lines
Apply the quirk for the Valve device (SSID 0x1e44:0x1400) on the 8922DE, and add
RTW89_CUSTID_VALVEfor that customer ID.Signed-off-by Hsiao-Yung Chen <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
As we have generic approach to control AMSDU, drop patch 1/14.
Set patchset state to Rejected
[rtw-next,v2,01/14] wifi: rtw89: 8922de: add low latency quirk for Valve device
Ping-Ke Shih
maintainerPATCH v2 2/14 wifi: rtw89: 8922d: disable VCORE for thermal protection by default
In reply to Ping-Ke ShihFrom: Chih-Wen Hsiao <[email protected]>
To ensure the stability of the thermal protection mechanism, the primary approach is to reduce the transmit (TX) duty cycle; the option to lower the voltage(VCORE) is disabled by default.
--- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/rtw8922d.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -6463,6 +6463,7 @@ enum rtw89_quirks {RTW89_QUIRK_PCI_BER ,RTW89_QUIRK_THERMAL_PROT_120C ,RTW89_QUIRK_THERMAL_PROT_110C , +RTW89_QUIRK_THERMAL_PROT_VCORE ,RTW89_QUIRK_HW_INFO_SYSFS ,RTW89_QUIRK_DISABLE_2GHZ , RTW89_QUIRK_LOW_LATENCY,
drivers/net/wireless/realtek/rtw89/rtw8922d.c +3 -0
@@ -901,6 +901,9 @@ static int rtw8922d_read_sys(struct rtw89_dev *rtwdev, u8 *log_map)u16 digk;u8 vmin; +if (!test_bit (RTW89_QUIRK_THERMAL_PROT_VCORE , rtwdev->quirks)) +return 0 ; + digk = log_map[0x200 ] | log_map[0x201 ] <<8 ; hal->thermal_prot_vmax =u16_get_bits (digk,B_BE_PWMTUNE_MASK );
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerRe: [PATCH rtw-next v2 02/14] wifi: rtw89: 8922d: disable VCORE for thermal protection by default
Quoted 8 lines · Ping-Ke Shih
From: Chih-Wen Hsiao <[email protected]>
To ensure the stability of the thermal protection mechanism, the primary approach is to reduce the transmit (TX) duty cycle; the option to lower the voltage(VCORE) is disabled by default.
Signed-off-by Chih-Wen Hsiao <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
13 patch(es) applied to rtw-next branch of rtw.git, thanks.
2b214a3d00f1 wifi: rtw89: 8922d: disable VCORE for thermal protection by default 0ea8f90346e3 wifi: rtw89: allow two station interfaces in SCC0ab8684c28a5 wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v4 565dd9a7002a wifi: rtw89: 8922d: set BB wrapper settings according to operating channel 941519462c0c wifi: rtw89: 8922d: move conditionally disabled TX shape to common flow f56de6b1cd66 wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v5 5630d62627dd wifi: rtw89: 8922d: send RFE type to firmware23497cfa5503 wifi: rtw89: 8922d: bypass RX IQK when scan55adcae98e64 wifi: rtw89: 8922d: correct selection of CCK rate circuit f9b6b239d081 wifi: rtw89: chan: introduce helper and refine active list iteration 5678a22cc96f wifi: rtw89: regd: check only active vifs when recalculating 6 GHz power type 8642e72ca1db wifi: rtw89: skip tracking things when entity is paused e4ffe7d6683e wifi: rtw89: add p2p device declaration
Ping-Ke Shih
maintainerPATCH v2 3/14 wifi: rtw89: allow two station interfaces in SCC
In reply to Ping-Ke ShihFrom: Hsiao-Yung Chen <[email protected]>
The single-channel interface combination previously permitted only one STATION interface, alongside one P2P or AP interface. Raise the STATION limit to two so that a STA + STA combination is allowed in the single channel concurrency (SCC) case.
This enables concurrent dual-STA use cases on the same channel, such as having one STA interface connected to an AP router for Internet access, while the second STA interface connects to another local peer/device for dedicated media/data streaming.
Benchmark results on RTL8922DE in 6 GHz / 80 MHz SCC mode (UDP):
STA1 alone SCC STA1+STA2 STA2 alone UDP TX (Gbps) 0.95 0.52 + 0.49 0.99 UDP RX (Gbps) 0.95 0.56 + 0.46 0.95
--- drivers/net/wireless/realtek/rtw89/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +1 -1
@@ -167,7 +167,7 @@ static struct ieee80211_rate rtw89_bitrates[] = {static const struct ieee80211_iface_limit rtw89_iface_limits[] = { { - .max =1 , + .max =2 , .types =BIT (NL80211_IFTYPE_STATION ), }, {
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 4/14 wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v4
In reply to Ping-Ke ShihFrom: Eric Huang <[email protected]>
Update the BB wrapper RFSI control configuration tables for RTL8922D variants to v4. Remove the redundant table for RFE types 35/41/44, which use the default 7090 configuration, and add table for RFE type 38.
--- drivers/net/wireless/realtek/rtw89/phy.h | 14 ++- drivers/net/wireless/realtek/rtw89/phy_be.c | 79 +++++++++----- drivers/net/wireless/realtek/rtw89/reg.h | 4 + drivers/net/wireless/realtek/rtw89/rtw8922d.c | 103 ++++++++++++------ 4 files changed, 139 insertions(+), 61 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.h +13 -1
@@ -632,7 +632,18 @@ struct rtw89_bb_wrap_common_data {u32 rfsi_ct_opt[2 ];u8 pb_tb; } bands[RFSI_CTRL_BAND_NUM ]; -u8 qam_th[6 ]; +u8 qam_th[3 ]; +}; + +struct rtw89_bb_wrap_common_data_gen2 { +struct { +u8 mdpd_160m; +u8 mdpd_320m; +u8 oob_dpd_20m; +u8 oob_dpd_40m; +u8 oob_dpd_80m; +u8 cim3k; + } qam_th; };struct rtw89_bb_wrap_common_data_gen3 {
@@ -644,6 +655,7 @@ struct rtw89_bb_wrap_common_data_gen3 {struct rtw89_bb_wrap_data {const struct rtw89_bb_wrap_common_data *common; +const struct rtw89_bb_wrap_common_data_gen2 *common_gen2;const struct rtw89_bb_wrap_common_data_gen3 *common_gen3;struct {u16 qam_comp_th0[MAX_TX_RFSI_CTRL_OPT ];
drivers/net/wireless/realtek/rtw89/phy_be.c +54 -25
106 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/reg.h +4 -0
@@ -10696,6 +10696,10 @@#define B_FBTB_CT_FTM_BE4 GENMASK(23, 20)#define B_FBTB_CT_SENS_BE4 GENMASK(27, 24)#define R_CIM3K_SU_FORCE 0x119F8 +#define B_CIM3K_RU26_FORCE_EN BIT(13) +#define B_CIM3K_RU26_FORCE_VAL BIT(14) +#define B_CIM3K_RU52_FORCE_EN BIT(15) +#define B_CIM3K_RU52_FORCE_VAL BIT(16)#define B_CIM3K_SU_FORCE_EN BIT(17)#define B_CIM3K_SU_FORCE_VAL BIT(18)#define R_QAM3_TH0_BE4 0x119FC
drivers/net/wireless/realtek/rtw89/rtw8922d.c +68 -35
178 lines not on this page · raw message
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 5/14 wifi: rtw89: 8922d: set BB wrapper settings according to operating channel
In reply to Ping-Ke ShihThe BB wrapper settings are estimated and filled by operating channel. Set the values according to channels to yield better performance.
--- drivers/net/wireless/realtek/rtw89/phy.h | 6 +- drivers/net/wireless/realtek/rtw89/phy_be.c | 64 +++++++++++-------- drivers/net/wireless/realtek/rtw89/rtw8922d.c | 3 +- 3 files changed, 42 insertions(+), 31 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.h +3 -3
@@ -1051,9 +1051,9 @@ static inline void rtw89_phy_bb_wrap_init(struct rtw89_dev *rtwdev) phy->bb_wrap_init (rtwdev); } -void rtw89_phy_bb_wrap_set_rfsi_ct_opt (struct rtw89_dev *rtwdev, -enum rtw89_rfsi_ctrl_band ctrl_band, -enum rtw89_phy_idx phy_idx); +void rtw89_phy_bb_wrap_tx_rfsi_ctrl_init_by_chan (struct rtw89_dev *rtwdev, +const struct rtw89_chan *chan, +u8 mac_idx);void rtw89_phy_bb_wrap_set_rfsi_bandedge_ch (struct rtw89_dev *rtwdev,const struct rtw89_chan *chan,enum rtw89_phy_idx phy_idx);
drivers/net/wireless/realtek/rtw89/phy_be.c +37 -27
201 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8922d.c +2 -1
@@ -2544,7 +2544,8 @@ static void rtw8922d_set_channel_bb(struct rtw89_dev *rtwdev,u8 pri_sb = chan->pri_sb_idx;u32 val; -rtw89_phy_bb_wrap_set_rfsi_ct_opt (rtwdev, chan->rfsi_band, phy_idx); +rtw89_phy_bb_wrap_tx_rfsi_ctrl_init_by_chan (rtwdev, chan, phy_idx); +rtw8922d_ctrl_ch (rtwdev, chan, phy_idx);rtw8922d_ctrl_bw (rtwdev, pri_sb, chan->band_width, phy_idx);rtw89_phy_bb_wrap_set_rfsi_bandedge_ch (rtwdev, chan, phy_idx);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 6/14 wifi: rtw89: 8922d: move conditionally disabled TX shape to common flow
In reply to Ping-Ke ShihBy default, the TX shape settings are written to registers. However, if TX shape type for current operating band isn't necessary, set the disable-bit to avoid considering TX shape settings.
--- drivers/net/wireless/realtek/rtw89/phy_be.c | 41 +++++++++++++- drivers/net/wireless/realtek/rtw89/rtw8922d.c | 56 ------------------- 2 files changed, 40 insertions(+), 57 deletions(-)
drivers/net/wireless/realtek/rtw89/phy_be.c +40 -1
@@ -931,7 +931,7 @@ static void rtw89_phy_bb_wrap_tx_rfsi_qam_comp_val(struct rtw89_dev *rtwdev,const struct rtw89_bb_wrap_data *d = rtwdev->phy_info.bb_wrap_data;const u16 *th; -if (!d || !d->common) +if (!d)return ; th = d->bands[chan->rfsi_band].qam_comp_th0;
@@ -975,6 +975,44 @@ static void rtw89_phy_bb_wrap_tx_rfsi_qam_comp_val(struct rtw89_dev *rtwdev,rtw89_write32_idx (rtwdev,R_OW_VAL_3_BE4 ,MASKHWORD , th[7 ], mac_idx); } +static void rtw89_phy_trig_spect_tx_shape_disabled (struct rtw89_dev *rtwdev, +const struct rtw89_chan *chan, +enum rtw89_mac_idx mac_idx) +{ +const struct rtw89_bb_wrap_data *d = rtwdev->phy_info.bb_wrap_data; +u8 band = chan->band_type; +u8 tx_shape_idx; + +/* +* Only needed by chips with d->bands[].{qam_comp_th0, qam_comp_ow} as +* what rtw89_phy_bb_wrap_tx_rfsi_qam_comp_val() does. +*/ +if (!d) +return ; + + tx_shape_idx =rtw89_get_tx_shape_idx (rtwdev, band,RTW89_RS_OFDM ); +if (tx_shape_idx) +return ; + +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH0_BE4 ,B_QAM_COMP_TH_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH0_BE4 ,B_QAM_COMP_TH_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH1_BE4 ,B_QAM_COMP_TH_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH1_BE4 ,B_QAM_COMP_TH_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH2_BE4 ,B_QAM_COMP_TH_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH2_BE4 ,B_QAM_COMP_TH_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH3_BE4 ,B_QAM_COMP_TH_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_QAM_COMP_TH3_BE4 ,B_QAM_COMP_TH_TRIANGULAR_H ,0 , mac_idx); + +rtw89_write32_idx (rtwdev,R_OW_VAL_0_BE4 ,B_OW_VAL_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_0_BE4 ,B_OW_VAL_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_1_BE4 ,B_OW_VAL_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_1_BE4 ,B_OW_VAL_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_2_BE4 ,B_OW_VAL_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_2_BE4 ,B_OW_VAL_TRIANGULAR_H ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_3_BE4 ,B_OW_VAL_TRIANGULAR_L ,0 , mac_idx); +rtw89_write32_idx (rtwdev,R_OW_VAL_3_BE4 ,B_OW_VAL_TRIANGULAR_H ,0 , mac_idx); +} +static void rtw89_phy_bb_set_oob_dpd_qam_comp_val (struct rtw89_dev *rtwdev,const struct rtw89_chan *chan,enum rtw89_mac_idx mac_idx)
@@ -1189,6 +1227,7 @@ void rtw89_phy_bb_wrap_tx_rfsi_ctrl_init_by_chan(struct rtw89_dev *rtwdev,rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_gen3_init (rtwdev, chan, mac_idx);rtw89_phy_bb_wrap_tx_rfsi_scenario_def (rtwdev, chan, mac_idx);rtw89_phy_bb_wrap_tx_rfsi_qam_comp_val (rtwdev, chan, mac_idx); +rtw89_phy_trig_spect_tx_shape_disabled (rtwdev, chan, mac_idx);rtw89_phy_bb_set_oob_dpd_qam_comp_val (rtwdev, chan, mac_idx);rtw89_phy_bb_set_mdpd_qam_comp_val (rtwdev, mac_idx);rtw89_phy_bb_set_cim3k_val (rtwdev, chan, mac_idx);
drivers/net/wireless/realtek/rtw89/rtw8922d.c +0 -56
68 lines not on this page · raw message
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 7/14 wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v5
In reply to Ping-Ke ShihUpdate the BB wrapper RFSI control configuration tables for RTL8922D variants to v5. The major change is to define qam_th[] per band to optimize performance for RTL8922D_CID7090 variant, and others variants keep to use the same values for both bands.
--- drivers/net/wireless/realtek/rtw89/phy.h | 2 +- drivers/net/wireless/realtek/rtw89/phy_be.c | 9 +++++---- drivers/net/wireless/realtek/rtw89/rtw8922d.c | 15 +++++++++------ 3 files changed, 15 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.h +1 -1
@@ -631,8 +631,8 @@ struct rtw89_bb_wrap_common_data { } cim3k;u32 rfsi_ct_opt[2 ];u8 pb_tb; +u8 qam_th[3 ]; } bands[RFSI_CTRL_BAND_NUM ]; -u8 qam_th[3 ]; };struct rtw89_bb_wrap_common_data_gen2 {
drivers/net/wireless/realtek/rtw89/phy_be.c +5 -4
@@ -732,6 +732,7 @@ void rtw89_phy_bb_wrap_set_rfsi_bandedge_ch(struct rtw89_dev *rtwdev,EXPORT_SYMBOL (rtw89_phy_bb_wrap_set_rfsi_bandedge_ch);static void rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_init (struct rtw89_dev *rtwdev, +const struct rtw89_chan *chan,enum rtw89_mac_idx mac_idx) {const struct rtw89_bb_wrap_data *d = rtwdev->phy_info.bb_wrap_data;
@@ -740,9 +741,9 @@ static void rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_init(struct rtw89_dev *rtwdev,if (!d || !d->common)return ; - th0 = d->common->qam_th[0 ]; - th1 = d->common->qam_th[1 ]; - th2 = d->common->qam_th[2 ]; + th0 = d->common->bands[chan->rfsi_band].qam_th[0 ]; + th1 = d->common->bands[chan->rfsi_band].qam_th[1 ]; + th2 = d->common->bands[chan->rfsi_band].qam_th[2 ];/* TH0 */ rtw89_write32_idx (rtwdev,R_QAM_TH0_BE4 ,B_QAM_TH0_0_BE4 , th0, mac_idx);
@@ -1222,7 +1223,7 @@ void rtw89_phy_bb_wrap_tx_rfsi_ctrl_init_by_chan(struct rtw89_dev *rtwdev,const struct rtw89_chan *chan, u8 mac_idx) { -rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_init (rtwdev ,mac_idx ); +rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_init (rtwdev ,chan ,mac_idx );rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_gen2_init (rtwdev, mac_idx);rtw89_phy_bb_wrap_tx_rfsi_qam_comp_th_gen3_init (rtwdev, chan, mac_idx);rtw89_phy_bb_wrap_tx_rfsi_scenario_def (rtwdev, chan, mac_idx);
drivers/net/wireless/realtek/rtw89/rtw8922d.c +9 -6
@@ -347,14 +347,15 @@ static const struct rtw89_bb_wrap_common_data rtw8922d_bb_wrap_common_data_7025 .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 3, + .qam_th = {RFSI_BPSK, RFSI_QPSK, RFSI_256QAM}, }, [RFSI_CTRL_BAND_2GHZ] = { .cim3k = {CIM3K_ON, CIM3K_ON, CIM3K_ENABLE, CIM3K_ENABLE}, .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 0, + .qam_th = {RFSI_BPSK, RFSI_QPSK, RFSI_256QAM}, }}, - .qam_th = {RFSI_BPSK, RFSI_QPSK, RFSI_256QAM}, }; static const struct rtw89_bb_wrap_common_data rtw8922d_bb_wrap_common_data_7090 = {
@@ -364,14 +365,15 @@ static const struct rtw89_bb_wrap_common_data rtw8922d_bb_wrap_common_data_7090 .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 0, + .qam_th = {RFSI_BPSK, RFSI_QPSK, RFSI_256QAM}, }, [RFSI_CTRL_BAND_2GHZ] = { .cim3k = {CIM3K_ON, CIM3K_ON, CIM3K_ENABLE, CIM3K_ENABLE}, .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 0, + .qam_th = {RFSI_QPSK, RFSI_16QAM, RFSI_256QAM}, }}, - .qam_th = {RFSI_BPSK, RFSI_QPSK, RFSI_256QAM}, }; static const struct rtw89_bb_wrap_common_data rtw8922d_bb_wrap_common_data_7090_rfe38 = {
@@ -381,14 +383,15 @@ static const struct rtw89_bb_wrap_common_data rtw8922d_bb_wrap_common_data_7090_ .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 0, + .qam_th = {RFSI_QPSK, RFSI_16QAM, RFSI_256QAM}, }, [RFSI_CTRL_BAND_2GHZ] = { .cim3k = {CIM3K_ON, CIM3K_ON, CIM3K_ENABLE, CIM3K_ENABLE}, .rfsi_ct_opt = {_8nibble(2, 2, 2, 2, 1, 1, 1, 1), _8nibble(2, 2, 2, 2, 1, 1, 1, 1)}, .pb_tb = 0, + .qam_th = {RFSI_QPSK, RFSI_16QAM, RFSI_256QAM}, }}, - .qam_th = {RFSI_QPSK, RFSI_16QAM, RFSI_256QAM}, }; static const
@@ -474,7 +477,7 @@ static const struct rtw89_bb_wrap_data rtw8922d_bb_wrap_data_7090_default = { }, [RFSI_CTRL_BAND_2GHZ] = { .qam_comp_th0 = {0x4000, 0x4400, 0x4500, 0, 0, 0, 0, 0, 0, 0}, - .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4500, 0, 0, + .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4600, 0, 0, 0, 0, 0, 0, 0)}, .qam_comp_th2 = {_10qam_comp_code(0x4000, 0x4400, 0x4400, 0, 0, 0, 0, 0, 0, 0)},
@@ -492,7 +495,7 @@ static const struct rtw89_bb_wrap_data rtw8922d_bb_wrap_data_7090_rfe38 = { .bands = { [RFSI_CTRL_BAND_5_6GHZ] = { .qam_comp_th0 = {0x4000, 0x4400, 0x4500, 0, 0, 0, 0, 0, 0, 0}, - .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4500, 0, + .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4600, 0, 0, 0, 0, 0, 0, 0)}, .qam_comp_th2 = {_10qam_comp_code(0x4000, 0x4400, 0x4400, 0, 0, 0, 0, 0, 0, 0)},
@@ -502,7 +505,7 @@ static const struct rtw89_bb_wrap_data rtw8922d_bb_wrap_data_7090_rfe38 = { }, [RFSI_CTRL_BAND_2GHZ] = { .qam_comp_th0 = {0x4000, 0x4400, 0x4500, 0, 0, 0, 0, 0, 0, 0}, - .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4400, 0, 0, + .qam_comp_th1 = {_10qam_comp_code(0x4000, 0x4400, 0x4700, 0, 0, 0, 0, 0, 0, 0)}, .qam_comp_th2 = {_10qam_comp_code(0x4000, 0x4400, 0x4400, 0, 0, 0, 0, 0, 0, 0)},
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 8/14 wifi: rtw89: 8922d: send RFE type to firmware
In reply to Ping-Ke ShihTo configure BT in firmware according to RFE type, send it via H2C command.
--- drivers/net/wireless/realtek/rtw89/fw.c | 40 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/fw.h | 7 ++++ drivers/net/wireless/realtek/rtw89/rtw8922d.c | 2 + 3 files changed, 49 insertions(+)
drivers/net/wireless/realtek/rtw89/fw.c +40 -0
@@ -3567,6 +3567,46 @@ int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev,return ret; } +int rtw89_fw_h2c_phy_rfe_type (struct rtw89_dev *rtwdev) +{ +const struct rtw89_chip_info *chip = rtwdev->chip; +struct rtw89_efuse *efuse = &rtwdev->efuse; +struct rtw89_h2c_phy_rfe_type *h2c; +u32 len =sizeof (*h2c); +struct sk_buff *skb; +int ret; + +if (chip->chip_id !=RTL8922D ) +return 0 ; + + skb =rtw89_fw_h2c_alloc_skb_with_hdr (rtwdev, len); +if (!skb) { +rtw89_err (rtwdev,"failed to alloc skb for h2c phy_rfe_type\n" ); +return -ENOMEM ; + } +skb_put (skb, len); + h2c = (struct rtw89_h2c_phy_rfe_type *)skb->data; + + h2c->rfe_type = efuse->rfe_type; + +rtw89_h2c_pkt_set_hdr (rtwdev, skb,FWCMD_TYPE_H2C , +H2C_CAT_OUTSRC ,H2C_CL_OUTSRC_DM , +H2C_FUNC_FW_RFE_TYPE ,0 ,0 , len); + + ret =rtw89_h2c_tx (rtwdev, skb, false); +if (ret) { +rtw89_err (rtwdev,"failed to send h2c\n" ); + goto fail; + } + +return 0 ; +fail: +dev_kfree_skb_any (skb); + +return ret; +} +EXPORT_SYMBOL (rtw89_fw_h2c_phy_rfe_type); +#define H2C_P2P_ACT_LEN 20 int rtw89_fw_h2c_p2p_act(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,
drivers/net/wireless/realtek/rtw89/fw.h +7 -0
@@ -2101,6 +2101,11 @@ struct rtw89_h2c_lps_ml_cmn_info_v1 {struct rtw89_bb_link_info_rx_gain rx_gain[RTW89_BB_PS_LINK_BUF_MAX ]; } __packed; +struct rtw89_h2c_phy_rfe_type { +u8 rfe_type; +u8 rsvd[3 ]; +} __packed; +struct rtw89_h2c_trig_cpu_except {__le32 w0; } __packed;
@@ -4886,6 +4891,7 @@ enum rtw89_mrc_h2c_func {#define H2C_FUNC_FW_MCC_DIG 0x6#define H2C_FUNC_FW_LPS_CH_INFO 0xb#define H2C_FUNC_FW_LPS_ML_CMN_INFO 0xe +#define H2C_FUNC_FW_RFE_TYPE 0x1b#define H2C_CL_OUTSRC_RF_REG_A 0x8#define H2C_CL_OUTSRC_RF_REG_B 0x9
@@ -5568,6 +5574,7 @@ int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);int rtw89_fw_h2c_fwips (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link,bool enable); +int rtw89_fw_h2c_phy_rfe_type (struct rtw89_dev *rtwdev);struct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr (struct rtw89_dev *rtwdev,u32 len);struct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr (struct rtw89_dev *rtwdev,u32 len); int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/rtw8922d.c +2 -0
@@ -2504,6 +2504,8 @@ static void rtw8922d_bb_sethw(struct rtw89_dev *rtwdev)enum rtw89_phy_idx phy_idx;u32 reg; +rtw89_fw_h2c_phy_rfe_type (rtwdev); + reg =rtw89_mac_reg_by_idx (rtwdev,R_BE_PWR_BOOST ,RTW89_PHY_0 );rtw89_write32_clr (rtwdev, reg,B_BE_PWR_CTRL_SEL ); reg =rtw89_mac_reg_by_idx (rtwdev,R_BE_PWR_BOOST ,RTW89_PHY_1 );
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 9/14 wifi: rtw89: 8922d: bypass RX IQK when scan
In reply to Ping-Ke ShihSimilar to TX IQK, when connected to an AP and a scan is triggered, the FW may fail to receive frames because switching channels may load an uninitialized RX IQK table. Therefore, bypass RXIQK during scanning to avoid using invalid calibration values.
--- drivers/net/wireless/realtek/rtw89/phy.c | 5 ++ drivers/net/wireless/realtek/rtw89/reg.h | 4 ++ drivers/net/wireless/realtek/rtw89/rtw8922d.c | 60 +++++++++++++++++++ 3 files changed, 69 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +5 -0
@@ -3575,6 +3575,8 @@ static void rtw89_phy_c2h_rfk_rpt_log(struct rtw89_dev *rtwdev, "[IQK] iqk->fwk_status = %x\n", iqk->fwk_status);for (i =0 ; i <2 ; i++) { +struct rtw89_iqk_info *iqk_info = &rtwdev->iqk; +rtw89_debug (rtwdev,RTW89_DBG_RFK ,"[IQK] ======== Path %x ========\n" , i); rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK] iqk->iqk_band[%d] = %x\n",
@@ -3593,6 +3595,9 @@ static void rtw89_phy_c2h_rfk_rpt_log(struct rtw89_dev *rtwdev, i, iqk->iqk_tx_fail[i]);rtw89_debug (rtwdev,RTW89_DBG_RFK ,"[IQK] iqk->iqk_rx_fail[%d] = %x\n" , i, iqk->iqk_rx_fail[i]); + + iqk_info->iqk_rx_fail[0 ][i] = iqk->iqk_rx_fail[i]; +for (j =0 ; j <6 ; j++) rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK] iqk->rftxgain[%d][%d] = %x\n",
drivers/net/wireless/realtek/rtw89/reg.h +4 -0
@@ -11072,13 +11072,17 @@#define B_KTBL0_RST BIT(31)#define R_CFIR_CTRL_A_BE4 0x38124#define R_CFIR_CTRL_B_BE4 0x38224 +#define B_CFIR_CTRL_RXKIDX0_EN BIT(0)#define B_CFIR_CTRL_KIDX0_EN BIT(8) +#define B_CFIR_CTRL_RXKIDX1_EN BIT(16)#define B_CFIR_CTRL_KIDX1_EN BIT(24)#define R_TX_IQC_A_BE4 0x38138#define R_TX_IQC_B_BE4 0x38238#define B_TX_IQC_X GENMASK(31, 20)#define B_TX_IQC_Y GENMASK(19, 8)#define B_TX_IQC_DPK BIT(3) +#define R_RX_IQC_A_BE4 0x3813c +#define R_RX_IQC_B_BE4 0x3823c#define R_KTBL1A_BE4 0x38154#define R_KTBL1B_BE4 0x38254#define B_KTBL1_TBL0 BIT(3)
drivers/net/wireless/realtek/rtw89/rtw8922d.c +60 -0
75 lines not on this page · raw message
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 10/14 wifi: rtw89: 8922d: correct selection of CCK rate circuit
In reply to Ping-Ke ShihThe RTL8922D has single one shared CCK rate circuit. When operating on 0+2 mode, the selection should be on RTW89_PHY_1. For 1+1 operating mode, select RTW89_PHY_1 only if PHY0 isn't on 2GHz band but PHY1 does.
Also, change the operating mode of debugging value from decimal to hexadecimal to be easier to read.
--- drivers/net/wireless/realtek/rtw89/chan.c | 2 +- drivers/net/wireless/realtek/rtw89/rtw8922d.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +1 -1
@@ -527,7 +527,7 @@ static void rtw89_entity_recalc_mlo_dbcc_mode(struct rtw89_dev *rtwdev) mode =rtw89_entity_sel_mlo_dbcc_mode (rtwdev, active_hws); rtwdev->mlo_dbcc_mode = mode; -rtw89_debug (rtwdev,RTW89_DBG_STATE ,"recalc mlo dbcc mode to %d\n" , mode); +rtw89_debug (rtwdev,RTW89_DBG_STATE ,"recalc mlo dbcc mode to 0x%x\n" , mode); }static void rtw89_entity_recalc_mgnt_roles (struct rtw89_dev *rtwdev)
drivers/net/wireless/realtek/rtw89/rtw8922d.c +3 -2
@@ -2471,14 +2471,15 @@ static int rtw8922d_ctrl_mlo(struct rtw89_dev *rtwdev, enum rtw89_mlo_dbcc_modertw89_write32_mask (rtwdev, reg1,B_BBWRAP_ELMSR_EN_BE4 ,0 ); }else if (mode ==MLO_0_PLUS_2_1RF ) {rtw89_phy_write32_mask (rtwdev,R_SYS_DBCC_BE4 , -B_SYS_DBCC_24G_BAND_SEL_BE4 ,RTW89_PHY_0 ); +B_SYS_DBCC_24G_BAND_SEL_BE4 ,RTW89_PHY_1 );rtw89_write32_mask (rtwdev, reg0,B_BBWRAP_ELMSR_EN_BE4 ,0 );rtw89_write32_mask (rtwdev, reg1,B_BBWRAP_ELMSR_EN_BE4 ,0 ); }else if ((mode ==MLO_1_PLUS_1_1RF ) || (mode ==DBCC_LEGACY )) {struct rtw89_entity_conf conf;rtw89_entity_get_conf (rtwdev, &conf); - cck_phy_idx = conf.chans[1 ]->band_type ==RTW89_BAND_2G ? + cck_phy_idx = conf.chans[0 ]->band_type !=RTW89_BAND_2G && + conf.chans[1 ]->band_type ==RTW89_BAND_2G ?RTW89_PHY_1 :RTW89_PHY_0 ; rtw89_phy_write32_mask(rtwdev, R_SYS_DBCC_BE4,
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 11/14 wifi: rtw89: chan: introduce helper and refine active list iteration
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
Add a helper macro to iterate active vifs. Some chanctx handling iterated all vifs and then checked if the link is active. In logical, it means only the active vifs need to be counted there. So, also refine them to iterate only active list.
--- drivers/net/wireless/realtek/rtw89/chan.c | 14 ++++++-------- drivers/net/wireless/realtek/rtw89/debug.c | 3 +-- drivers/net/wireless/realtek/rtw89/fw.c | 6 ++---- drivers/net/wireless/realtek/rtw89/util.h | 4 ++++ 4 files changed, 13 insertions(+), 14 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +6 -8
@@ -185,7 +185,7 @@ static void rtw89_chan_update_punctured(struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif;unsigned int link_id; -rtw89_for_each_rtwvif (rtwdev, rtwvif) { +rtw89_for_each_active_rtwvif (rtwdev, rtwvif) {rtw89_vif_for_each_link (rtwvif, rtwvif_link, link_id) {if (!rtwvif_link->chanctx_assigned || rtwvif_link->chanctx_idx != idx)
@@ -358,10 +358,8 @@ static void rtw89_entity_calculate_weight(struct rtw89_dev *rtwdev, w->active_chanctxs++; } -rtw89_for_each_rtwvif (rtwdev, rtwvif) { -if (rtw89_vif_is_active_role (rtwvif)) - w->active_roles++; - } +rtw89_for_each_active_rtwvif (rtwdev, rtwvif) + w->active_roles++; } static void rtw89_normalize_link_chanctx(struct rtw89_dev *rtwdev,
@@ -553,7 +551,7 @@ static void rtw89_entity_recalc_mgnt_roles(struct rtw89_dev *rtwdev)* which uses RTW89_CHANCTX_0 to put at position 0 and its designated * link take RTW89_CHANCTX_0. (normalizing) */ -list_for_each_entry (role, &mgnt->active_list, mgnt_entry) { +rtw89_for_each_active_rtwvif (rtwdev, role) {for (i =0 ; i < role->links_inst_valid_num; i++) { link =rtw89_vif_get_link_inst (role, i);if (!link || !link->chanctx_assigned)
@@ -570,7 +568,7 @@ static void rtw89_entity_recalc_mgnt_roles(struct rtw89_dev *rtwdev) } fill: -list_for_each_entry (role, &mgnt->active_list, mgnt_entry) { +rtw89_for_each_active_rtwvif (rtwdev, role) {if (unlikely (pos >=RTW89_MAX_INTERFACE_NUM )) { rtw89_warn(rtwdev, "%s: active roles are over max iface num\n",
@@ -3335,7 +3333,7 @@ static void rtw89_swap_chanctx(struct rtw89_dev *rtwdev,swap (hal->chanctx[idx1], hal->chanctx[idx2]); -rtw89_for_each_rtwvif (rtwdev, rtwvif) +rtw89_for_each_active_rtwvif (rtwdev, rtwvif)__rtw89_swap_chanctx (rtwvif, idx1, idx2); cur =atomic_read (&hal->roc_chanctx_idx);
drivers/net/wireless/realtek/rtw89/debug.c +1 -2
@@ -5463,12 +5463,11 @@ rtw89_debug_priv_diag_rf_get(struct rtw89_dev *rtwdev,static void rtw89_dbg_diag_rf_set_rfk (struct rtw89_dev *rtwdev) { -struct rtw89_entity_mgnt *mgnt = &rtwdev->hal.entity_mgnt;struct rtw89_vif_link *rtwvif_link;struct rtw89_vif *rtwvif;unsigned int link_id; -list_for_each_entry (rtwvif, &mgnt->active_list, mgnt_entry) +rtw89_for_each_active_rtwvif (rtwdev, rtwvif)rtw89_vif_for_each_link (rtwvif, rtwvif_link, link_id)rtw89_chip_rfk_channel (rtwdev, rtwvif_link); }
drivers/net/wireless/realtek/rtw89/fw.c +2 -4
@@ -10343,7 +10343,6 @@ static void rtw89_hw_scan_update_link_beacon_noa(struct rtw89_dev *rtwdev,static void rtw89_hw_scan_update_beacon_noa (struct rtw89_dev *rtwdev,bool scan) { -const struct rtw89_entity_mgnt *mgnt = &rtwdev->hal.entity_mgnt;const struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;const struct rtw89_chip_info *chip = rtwdev->chip;struct rtw89_mac_chinfo_ax *chinfo_ax;
@@ -10383,7 +10382,7 @@ static void rtw89_hw_scan_update_beacon_noa(struct rtw89_dev *rtwdev, bool scan) } update: -list_for_each_entry (rtwvif, &mgnt->active_list, mgnt_entry) { +rtw89_for_each_active_rtwvif (rtwdev, rtwvif) {unsigned int link_id; vif =rtwvif_to_vif (rtwvif);
@@ -10400,7 +10399,6 @@ static void rtw89_hw_scan_set_extra_op_info(struct rtw89_dev *rtwdev,struct rtw89_vif *scan_rtwvif, const struct rtw89_chan *scan_op) { - struct rtw89_entity_mgnt *mgnt = &rtwdev->hal.entity_mgnt; struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;struct rtw89_hw_scan_extra_op *ext = &scan_info->extra_op;struct rtw89_vif *tmp;
@@ -10409,7 +10407,7 @@ static void rtw89_hw_scan_set_extra_op_info(struct rtw89_dev *rtwdev,if (!RTW89_CHK_FW_FEATURE (SCAN_OFFLOAD_EXTRA_OP , &rtwdev->fw))return ; -list_for_each_entry (tmp, &mgnt->active_list, mgnt_entry) { +rtw89_for_each_active_rtwvif (rtwdev, tmp) {const struct rtw89_chan *tmp_chan;struct rtw89_vif_link *tmp_link;
drivers/net/wireless/realtek/rtw89/util.h +4 -0
@@ -21,6 +21,10 @@#define rtw89_for_each_rtwvif (rtwdev, rtwvif) \ list_for_each_entry(rtwvif, &(rtwdev)->rtwvifs_list, list) +/* call this function with wiphy mutex is held */ +#define rtw89_for_each_active_rtwvif (rtwdev, rtwvif) \ + list_for_each_entry(rtwvif, &(rtwdev)->hal.entity_mgnt.active_list, mgnt_entry) +/* 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.
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 12/14 wifi: rtw89: regd: check only active vifs when recalculating 6 GHz power type
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
Originally, recalculating 6 GHz power type iterates all vifs including idle ones and takes an intersection. However, driver chanctx management will treat idle vifs as ones who also use the first chanctx which might be 6 GHz. Since idle vifs have no 6 GHz power type, default power type will be taken for them. Then, intersection result would be the default one. It means the strictest 6 GHz power type. So, fix it by iterating only active vifs.
--- drivers/net/wireless/realtek/rtw89/regd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/regd.c +1 -1
@@ -1091,7 +1091,7 @@ static bool __rtw89_reg_6ghz_power_recalc(struct rtw89_dev *rtwdev)int count =0 ;u8 index; -rtw89_for_each_rtwvif (rtwdev, rtwvif) { +rtw89_for_each_active_rtwvif (rtwdev, rtwvif) {rtw89_vif_for_each_link (rtwvif, rtwvif_link, link_id) { chan =rtw89_chan_get (rtwdev, rtwvif_link->chanctx_idx);if (chan->band_type !=RTW89_BAND_6G )
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 13/14 wifi: rtw89: skip tracking things when entity is paused
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
In some situation, such as HW scan/ROC, entity will temporarily be paused. They usually have special handling on chanctx. However, things in tracking work focus on the operating channel. It would be better not to count these temporary periods. So, add a check before doing tracking things. Also, LPS will be expected to be off before pausing entity and during the period when entity is paused.
Besides, since the flow where to call rtw89_recalc_lps() is based on iface adding/removing, disabling has no need to depend on whether entity mode has became MCC. Before MCC starts, there must be at least two ifaces first. If two ifaces exist, rtw89_recalc_lps() will have already disabled LPS.
--- drivers/net/wireless/realtek/rtw89/chan.c | 12 ++++++++++++ drivers/net/wireless/realtek/rtw89/chan.h | 1 + drivers/net/wireless/realtek/rtw89/core.c | 6 ++++++ drivers/net/wireless/realtek/rtw89/ps.c | 6 ------ 4 files changed, 19 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +12 -0
@@ -3230,6 +3230,9 @@ void rtw89_chanctx_pause(struct rtw89_dev *rtwdev,lockdep_assert_wiphy (rtwdev->hw->wiphy); +if (test_bit (RTW89_FLAG_LEISURE_PS , rtwdev->flags)) +rtw89_warn (rtwdev,"LPS isn't off when pausing chanctx\n" ); +if (hal->entity_pause)return ;
@@ -3247,6 +3250,15 @@ void rtw89_chanctx_pause(struct rtw89_dev *rtwdev, hal->entity_pause = true; } +bool rtw89_chanctx_paused (struct rtw89_dev *rtwdev) +{ +struct rtw89_hal *hal = &rtwdev->hal; + +lockdep_assert_wiphy (rtwdev->hw->wiphy); + +return hal->entity_pause; +} +static void rtw89_chanctx_proceed_cb (struct rtw89_dev *rtwdev,const struct rtw89_chanctx_cb_parm *parm) {
drivers/net/wireless/realtek/rtw89/chan.h +1 -0
@@ -185,6 +185,7 @@ void rtw89_query_mr_chanctx_info(struct rtw89_dev *rtwdev, u8 inst_idx,void rtw89_chanctx_track (struct rtw89_dev *rtwdev);void rtw89_chanctx_pause (struct rtw89_dev *rtwdev,const struct rtw89_chanctx_pause_parm *parm); +bool __must_check rtw89_chanctx_paused (struct rtw89_dev *rtwdev);void rtw89_chanctx_proceed (struct rtw89_dev *rtwdev,const struct rtw89_chanctx_cb_parm *cb_parm);
drivers/net/wireless/realtek/rtw89/core.c +6 -0
@@ -5496,6 +5496,9 @@ static void rtw89_track_ps_work(struct wiphy *wiphy, struct wiphy_work *work)if (rtwdev->scanning)return ; +if (rtw89_chanctx_paused (rtwdev)) +return ; +if (rtwdev->lps_enabled && !rtwdev->btc.btc_ctrl_lps)rtw89_enter_lps_track (rtwdev,RTW89_TFC_INTERVAL_100MS ); }
@@ -5521,6 +5524,9 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)if (rtwdev->scanning)return ; +if (rtw89_chanctx_paused (rtwdev)) +return ; +rtw89_leave_lps (rtwdev);if (tfc_changed) {
drivers/net/wireless/realtek/rtw89/ps.c +0 -6
@@ -363,13 +363,8 @@ void rtw89_recalc_lps(struct rtw89_dev *rtwdev) {struct ieee80211_vif *vif, *found_vif =NULL ;struct rtw89_vif *rtwvif; -enum rtw89_entity_mode mode;int count =0 ; - mode =rtw89_get_entity_mode (rtwdev); -if (mode ==RTW89_ENTITY_MODE_MCC ) - goto disable_lps; -rtw89_for_each_rtwvif (rtwdev, rtwvif) { vif =rtwvif_to_vif (rtwvif);
@@ -387,7 +382,6 @@ void rtw89_recalc_lps(struct rtw89_dev *rtwdev)return ; } -disable_lps:rtw89_leave_lps (rtwdev); rtwdev->lps_enabled = false; }
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v2 14/14 wifi: rtw89: add p2p device declaration
In reply to Ping-Ke ShihFrom: Po-Hao Huang <[email protected]>
Use separate interface for P2P operations. This is required for concurrent operations under MLO, so that address conversion can be applied to correct frames. The wpa_cli commands for P2P operations should be changed to under p2p-dev-<interface> after this commit.
--- drivers/net/wireless/realtek/rtw89/core.c | 16 +++++++++++++++- drivers/net/wireless/realtek/rtw89/core.h | 2 +- drivers/net/wireless/realtek/rtw89/ps.c | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +15 -1
@@ -176,6 +176,10 @@ static const struct ieee80211_iface_limit rtw89_iface_limits[] = {BIT (NL80211_IFTYPE_P2P_GO ) | BIT(NL80211_IFTYPE_AP), }, + { + .max = 1, + .types = BIT(NL80211_IFTYPE_P2P_DEVICE), + }, };static const struct ieee80211_iface_limit rtw89_iface_limits_mcc[] = {
@@ -188,6 +192,10 @@ static const struct ieee80211_iface_limit rtw89_iface_limits_mcc[] = { .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO), }, + { + .max = 1, + .types = BIT(NL80211_IFTYPE_P2P_DEVICE), + }, };static const struct ieee80211_iface_combination rtw89_iface_combs[] = {
@@ -5697,6 +5705,7 @@ void rtw89_vif_type_mapping(struct rtw89_vif_link *rtwvif_link, bool assoc)else rtwvif_link->wifi_role =RTW89_WIFI_ROLE_AP ;break ; +RTW89_TYPE_MAPPING (P2P_DEVICE );RTW89_TYPE_MAPPING (ADHOC );RTW89_TYPE_MAPPING (MONITOR );RTW89_TYPE_MAPPING (MESH_POINT );
@@ -5730,6 +5739,10 @@ void rtw89_vif_type_mapping(struct rtw89_vif_link *rtwvif_link, bool assoc) rtwvif_link->self_role =RTW89_SELF_ROLE_CLIENT ; rtwvif_link->addr_cam.sec_ent_mode =RTW89_ADDR_CAM_SEC_NORMAL ;break ; +case NL80211_IFTYPE_P2P_DEVICE : + rtwvif_link->net_type =RTW89_NET_TYPE_NO_LINK ; + rtwvif_link->self_role =RTW89_SELF_ROLE_CLIENT ; +break ;case NL80211_IFTYPE_MONITOR :break ;default :
@@ -7523,7 +7536,8 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev) hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) |BIT (NL80211_IFTYPE_AP ) |BIT (NL80211_IFTYPE_P2P_CLIENT ) | -BIT (NL80211_IFTYPE_P2P_GO ); +BIT (NL80211_IFTYPE_P2P_GO ) | +BIT (NL80211_IFTYPE_P2P_DEVICE );if (hal->ant_diversity) { hw->wiphy->available_antennas_tx =0x3 ;
drivers/net/wireless/realtek/rtw89/core.h +1 -1
@@ -6340,7 +6340,7 @@ enum rtw89_entity_mode { RTW89_ENTITY_MODE_UNHANDLED = -ESRCH, }; -#define RTW89_MAX_INTERFACE_NUM 2 +#define RTW89_MAX_INTERFACE_NUM 3/* only valid when running with chanctx_ops */ struct rtw89_entity_mgnt {
drivers/net/wireless/realtek/rtw89/ps.c +2 -0
@@ -367,6 +367,8 @@ void rtw89_recalc_lps(struct rtw89_dev *rtwdev)rtw89_for_each_rtwvif (rtwdev, rtwvif) { vif =rtwvif_to_vif (rtwvif); +if (vif->type ==NL80211_IFTYPE_P2P_DEVICE ) +continue ;if (vif->type !=NL80211_IFTYPE_STATION ) { count =0 ;
Signature · 1 line
2.25.1
Quoted 2 lines · Ping-Ke Shih
This series updates RTL8922D capabilities and settings, and enables P2P device.
Tested the chip-independent parts of this series on RTL8851BE (rtw89_8851be), a 1x1 Wi-Fi 6 part, since patches 3 and 11-14 touch common code and thus change behaviour for every rtw89 device. The 8922d-specific patches (1-2, 4-10) were not exercised, I don't have that hardware.
Applied on top of rtw-next commit 81510c3d6f21 ("wifi: rtw88: debugfs:
don't vzalloc(0) when rsvd_page is read unconfigured"). All 14 patches applied cleanly and the build is free of new warnings.
Patch 3 and 14, interface combinations as reported by 'iw phy':
before:
#{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1,
total <= 2, #channels <= 1after:
#{ managed } <= 2, #{ AP, P2P-client, P2P-GO } <= 1,
#{ P2P-device } <= 1, total <= 3, #channels <= 1Patch 3, two station interfaces in SCC. Second station vif added with 'iw interface add', given its own MAC and associated to the same BSSID as the first one, so both links are on the same channel by construction (5180 MHz). Both associate, and both carry traffic at the same time:
30 s of concurrent ping to the gateway, one flow per interface
wlp2s0 90 packets transmitted, 90 received, 0% packet loss
wlan1 90 packets transmitted, 90 received, 0% packet loss
station dump after the run
wlp2s0 rx 1225221 tx 27526 tx failed 1 beacon loss 15
wlan1 rx 128239 tx 16140 tx failed 2 beacon loss 0The first interface is unaffected when the second one is torn down.
Patch 14, P2P device. wpa_supplicant creates it on its own during boot now that the driver advertises the iftype, and NetworkManager lists it as a wifi-p2p device. The driver runs with three vifs at once (two managed plus the P2P device) without complaints.
No WARNs, no backtraces and no rtw89 error messages in dmesg during any of this. Association, DHCP and switching between 2.4 GHz and 5 GHz all keep working.
Patches 11-13 were only exercised indirectly, through the absence of regressions in association and channel switching. Patch 12 is a no-op here, RTL8851BE has no 6 GHz band.
One observation that may be worth a note in the cover letter. Since patch 14 declares #{ P2P-device } <= 1, a second wpa_supplicant instance on the same phy cannot start: it tries to create its own P2P device, hits the limit, and then gives up on the whole interface rather than falling back:
nl80211: Could not set interface 'p2p-dev-wlan1' UP
P2P: Failed to enable P2P Device interface
p2p-dev-wlan1: Failed to initialize driver interface
So the two-station setup that patch 3 enables needs p2p_disabled=1 in the second supplicant config. The driver behaves correctly here, it just means the new capability is not reachable with a default wpa_supplicant, which someone trying this out is likely to hit.
Thanks,
Maxim