All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <kvalo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 09/19] rtw89: configure mac port HIQ registers
Date: Fri, 7 Jan 2022 11:42:29 +0800	[thread overview]
Message-ID: <20220107034239.22002-10-pkshih@realtek.com> (raw)
In-Reply-To: <20220107034239.22002-1-pkshih@realtek.com>

HIQ is short for high queue that is used to send broadcast/multicast
packets right after TBTT in AP mode. Two registers, DTIM and window size,
are configured accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/mac.c | 34 +++++++++++++++++++++++-
 drivers/net/wireless/realtek/rtw89/reg.h | 14 +++++++++-
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index a0ff3d8a3f61b..58aa24e71637d 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -2864,6 +2864,36 @@ static void rtw89_mac_port_cfg_bcn_intv(struct rtw89_dev *rtwdev,
 				bcn_int);
 }
 
+static void rtw89_mac_port_cfg_hiq_win(struct rtw89_dev *rtwdev,
+				       struct rtw89_vif *rtwvif)
+{
+	static const u32 hiq_win_addr[RTW89_PORT_NUM] = {
+		R_AX_P0MB_HGQ_WINDOW_CFG_0, R_AX_PORT_HGQ_WINDOW_CFG,
+		R_AX_PORT_HGQ_WINDOW_CFG + 1, R_AX_PORT_HGQ_WINDOW_CFG + 2,
+		R_AX_PORT_HGQ_WINDOW_CFG + 3,
+	};
+	u8 win = rtwvif->net_type == RTW89_NET_TYPE_AP_MODE ? 16 : 0;
+	u8 port = rtwvif->port;
+	u32 reg;
+
+	reg = rtw89_mac_reg_by_idx(hiq_win_addr[port], rtwvif->mac_idx);
+	rtw89_write8(rtwdev, reg, win);
+}
+
+static void rtw89_mac_port_cfg_hiq_dtim(struct rtw89_dev *rtwdev,
+					struct rtw89_vif *rtwvif)
+{
+	struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
+	const struct rtw89_port_reg *p = &rtw_port_base;
+	u32 addr;
+
+	addr = rtw89_mac_reg_by_idx(R_AX_MD_TSFT_STMP_CTL, rtwvif->mac_idx);
+	rtw89_write8_set(rtwdev, addr, B_AX_UPD_HGQMD | B_AX_UPD_TIMIE);
+
+	rtw89_write16_port_mask(rtwdev, rtwvif, p->dtim_ctrl, B_AX_DTIM_NUM_MASK,
+				vif->bss_conf.dtim_period);
+}
+
 static void rtw89_mac_port_cfg_bcn_setup_time(struct rtw89_dev *rtwdev,
 					      struct rtw89_vif *rtwvif)
 {
@@ -3034,13 +3064,15 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
 	rtw89_mac_port_cfg_rx_sync(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_tx_sw(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_bcn_intv(rtwdev, rtwvif);
+	rtw89_mac_port_cfg_hiq_win(rtwdev, rtwvif);
+	rtw89_mac_port_cfg_hiq_dtim(rtwdev, rtwvif);
+	rtw89_mac_port_cfg_hiq_drop(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_bcn_setup_time(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_bcn_hold_time(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_bcn_mask_area(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_tbtt_early(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_bss_color(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_mbssid(rtwdev, rtwvif);
-	rtw89_mac_port_cfg_hiq_drop(rtwdev, rtwvif);
 	rtw89_mac_port_cfg_func_en(rtwdev, rtwvif);
 	fsleep(BCN_ERLY_SET_DLY);
 	rtw89_mac_port_cfg_bcn_early(rtwdev, rtwvif);
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
index e0a416d37d0e8..5e5cb0fcfa859 100644
--- a/drivers/net/wireless/realtek/rtw89/reg.h
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
@@ -913,7 +913,7 @@
 #define R_AX_DTIM_CTRL_P2 0xC4A6
 #define R_AX_DTIM_CTRL_P3 0xC4E6
 #define R_AX_DTIM_CTRL_P4 0xC526
-#define B_AX_DTIM_NUM_MASK GENMASK(15, 0)
+#define B_AX_DTIM_NUM_MASK GENMASK(15, 8)
 #define B_AX_DTIM_CURRCNT_MASK GENMASK(7, 0)
 
 #define R_AX_TBTT_SHIFT_P0 0xC428
@@ -964,6 +964,11 @@
 #define B_AX_P0MB2_EN BIT(2)
 #define B_AX_P0MB1_EN BIT(1)
 
+#define R_AX_P0MB_HGQ_WINDOW_CFG_0 0xC590
+#define R_AX_P0MB_HGQ_WINDOW_CFG_0_C1 0xE590
+#define R_AX_PORT_HGQ_WINDOW_CFG 0xC5A0
+#define R_AX_PORT_HGQ_WINDOW_CFG_C1 0xE5A0
+
 #define R_AX_AMPDU_AGG_LIMIT 0xC610
 #define B_AX_AMPDU_MAX_TIME_MASK GENMASK(31, 24)
 #define B_AX_RA_TRY_RATE_AGG_LMT_MASK GENMASK(23, 16)
@@ -1080,6 +1085,13 @@
 #define B_AX_TCR_ZLD_USTIME_AFTERPHYTXON GENMASK(11, 8)
 #define B_AX_TCR_TXTIMEOUT GENMASK(7, 0)
 
+#define R_AX_MD_TSFT_STMP_CTL 0xCA08
+#define R_AX_MD_TSFT_STMP_CTL_C1 0xEA08
+#define B_AX_TSFT_OFS_MASK GENMASK(31, 16)
+#define B_AX_STMP_THSD_MASK GENMASK(15, 8)
+#define B_AX_UPD_HGQMD BIT(1)
+#define B_AX_UPD_TIMIE BIT(0)
+
 #define R_AX_PPWRBIT_SETTING 0xCA0C
 #define R_AX_PPWRBIT_SETTING_C1 0xEA0C
 
-- 
2.25.1


  parent reply	other threads:[~2022-01-07  3:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  3:42 [PATCH 00/19] rtw89: support AP mode Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 01/19] rtw89: configure rx_filter according to FIF_PROBE_REQ Ping-Ke Shih
2022-01-28 15:57   ` Kalle Valo
2022-01-07  3:42 ` [PATCH 02/19] rtw89: use hardware SSN to TX management frame Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 03/19] rtw89: download beacon content to firmware Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 04/19] rtw89: add C2H handle of BCN_CNT Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 05/19] rtw89: implement mac80211_ops::set_tim to indicate STA to receive packets Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 06/19] rtw89: allocate mac_id for each station in AP mode Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 07/19] rtw89: extend firmware commands on states of sta_assoc and sta_disconnect Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 08/19] rtw89: rename vif_maintain to role_maintain Ping-Ke Shih
2022-01-07  3:42 ` Ping-Ke Shih [this message]
2022-01-07  3:42 ` [PATCH 10/19] rtw89: send broadcast/multicast packets via HIQ if STAs are in sleep mode Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 11/19] rtw89: set mac_id and port ID to TXWD Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 12/19] rtw89: separate {init,deinit}_addr_cam functions Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 13/19] rtw89: extend role_maintain to support AP mode Ping-Ke Shih
2022-01-28 15:51   ` Kalle Valo
2022-01-29  3:36     ` Pkshih
2022-02-03  8:42       ` Kalle Valo
2022-02-03  9:41         ` Pkshih
2022-01-28 15:53   ` Kalle Valo
2022-01-07  3:42 ` [PATCH 14/19] rtw89: add addr_cam field to sta " Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 15/19] rtw89: only STA mode change vif_type mapping dynamically Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 16/19] rtw89: maintain assoc/disassoc STA states of firmware and hardware Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 17/19] rtw89: implement ieee80211_ops::start_ap and stop_ap Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 18/19] rtw89: debug: add stations entry to show ID assignment Ping-Ke Shih
2022-01-07  3:42 ` [PATCH 19/19] rtw89: declare AP mode support Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220107034239.22002-10-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.