linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <kvalo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 11/19] rtw89: set mac_id and port ID to TXWD
Date: Fri, 7 Jan 2022 11:42:31 +0800	[thread overview]
Message-ID: <20220107034239.22002-12-pkshih@realtek.com> (raw)
In-Reply-To: <20220107034239.22002-1-pkshih@realtek.com>

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>
---
 drivers/net/wireless/realtek/rtw89/core.c | 26 +++++++++++++++++++++--
 drivers/net/wireless/realtek/rtw89/core.h |  2 ++
 drivers/net/wireless/realtek/rtw89/txrx.h |  1 +
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 50bbc93196085..8f8891badf0e8 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -375,6 +375,8 @@ static void
 rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev,
 			       struct rtw89_core_tx_request *tx_req)
 {
+	struct ieee80211_vif *vif = tx_req->vif;
+	struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
 	struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
 	u8 qsel, ch_dma;
 
@@ -383,6 +385,7 @@ rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev,
 
 	desc_info->qsel = qsel;
 	desc_info->ch_dma = ch_dma;
+	desc_info->port = desc_info->hiq ? rtwvif->port : 0;
 	desc_info->hw_ssn_sel = RTW89_MGMT_HW_SSN_SEL;
 	desc_info->hw_seq_mode = RTW89_MGMT_HW_SEQ_MODE;
 
@@ -520,6 +523,21 @@ rtw89_core_tx_update_he_qos_htc(struct rtw89_dev *rtwdev,
 	desc_info->bk = true;
 }
 
+static u8 rtw89_core_tx_get_mac_id(struct rtw89_dev *rtwdev,
+				   struct rtw89_core_tx_request *tx_req)
+{
+	struct ieee80211_vif *vif = tx_req->vif;
+	struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
+	struct ieee80211_sta *sta = tx_req->sta;
+	struct rtw89_sta *rtwsta;
+
+	if (!sta)
+		return rtwvif->mac_id;
+
+	rtwsta = (struct rtw89_sta *)sta->drv_priv;
+	return rtwsta->mac_id;
+}
+
 static void
 rtw89_core_tx_update_data_info(struct rtw89_dev *rtwdev,
 			       struct rtw89_core_tx_request *tx_req)
@@ -541,6 +559,8 @@ rtw89_core_tx_update_data_info(struct rtw89_dev *rtwdev,
 	desc_info->ch_dma = ch_dma;
 	desc_info->tid_indicate = tid_indicate;
 	desc_info->qsel = qsel;
+	desc_info->mac_id = rtw89_core_tx_get_mac_id(rtwdev, tx_req);
+	desc_info->port = desc_info->hiq ? rtwvif->port : 0;
 
 	/* enable wd_info for AMPDU */
 	desc_info->en_wd_info = true;
@@ -723,7 +743,8 @@ static __le32 rtw89_build_txwd_body2(struct rtw89_tx_desc_info *desc_info)
 {
 	u32 dword = FIELD_PREP(RTW89_TXWD_BODY2_TID_INDICATE, desc_info->tid_indicate) |
 		    FIELD_PREP(RTW89_TXWD_BODY2_QSEL, desc_info->qsel) |
-		    FIELD_PREP(RTW89_TXWD_BODY2_TXPKT_SIZE, desc_info->pkt_size);
+		    FIELD_PREP(RTW89_TXWD_BODY2_TXPKT_SIZE, desc_info->pkt_size) |
+		    FIELD_PREP(RTW89_TXWD_BODY2_MACID, desc_info->mac_id);
 
 	return cpu_to_le32(dword);
 }
@@ -741,7 +762,8 @@ static __le32 rtw89_build_txwd_info0(struct rtw89_tx_desc_info *desc_info)
 {
 	u32 dword = FIELD_PREP(RTW89_TXWD_INFO0_USE_RATE, desc_info->use_rate) |
 		    FIELD_PREP(RTW89_TXWD_INFO0_DATA_RATE, desc_info->data_rate) |
-		    FIELD_PREP(RTW89_TXWD_INFO0_DISDATAFB, desc_info->dis_data_fb);
+		    FIELD_PREP(RTW89_TXWD_INFO0_DISDATAFB, desc_info->dis_data_fb) |
+		    FIELD_PREP(RTW89_TXWD_INFO0_MULTIPORT_ID, desc_info->port);
 
 	return cpu_to_le32(dword);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index cf795d2f14776..8cb907da6cb05 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -670,6 +670,7 @@ struct rtw89_rxdesc_long {
 struct rtw89_tx_desc_info {
 	u16 pkt_size;
 	u8 wp_offset;
+	u8 mac_id;
 	u8 qsel;
 	u8 ch_dma;
 	u8 hdr_llc_len;
@@ -696,6 +697,7 @@ struct rtw89_tx_desc_info {
 	u8 hw_seq_mode;
 #define RTW89_MGMT_HW_SEQ_MODE	1
 	bool hiq;
+	u8 port;
 };
 
 struct rtw89_core_tx_request {
diff --git a/drivers/net/wireless/realtek/rtw89/txrx.h b/drivers/net/wireless/realtek/rtw89/txrx.h
index fb92973e96c66..86e3d8b400d6c 100644
--- a/drivers/net/wireless/realtek/rtw89/txrx.h
+++ b/drivers/net/wireless/realtek/rtw89/txrx.h
@@ -58,6 +58,7 @@
 #define RTW89_TXWD_INFO0_GI_LTF GENMASK(27, 25)
 #define RTW89_TXWD_INFO0_DATA_RATE GENMASK(24, 16)
 #define RTW89_TXWD_INFO0_DISDATAFB BIT(10)
+#define RTW89_TXWD_INFO0_MULTIPORT_ID GENMASK(6, 4)
 
 /* TX WD INFO DWORD 1 */
 #define RTW89_TXWD_INFO1_DATA_RTY_LOWEST_RATE GENMASK(24, 16)
-- 
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 ` [PATCH 09/19] rtw89: configure mac port HIQ registers Ping-Ke Shih
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 ` Ping-Ke Shih [this message]
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-12-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).