Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <gary.chang@realtek.com>
Subject: [RFT rtw-next] wifi: rtw89: support TX of BIP-CMAC-128 management frames
Date: Thu, 29 Oct 2026 09:48:57 +0800	[thread overview]
Message-ID: <20261029014857.9753-1-pkshih@realtek.com> (raw)

From: Chih-Kang Chang <gary.chang@realtek.com>

A RFT patch for test purpose.

It needs software generate MMIC header but excluding 8-byte MIC space.

This only supported by WiFi 7 chips and later, but we have not yet added
this condition.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/cam.c  |  1 +
 drivers/net/wireless/realtek/rtw89/core.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireless/realtek/rtw89/cam.c
index 22f21a04a96d..10e1ba191a63 100644
--- a/drivers/net/wireless/realtek/rtw89/cam.c
+++ b/drivers/net/wireless/realtek/rtw89/cam.c
@@ -515,6 +515,7 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
 		break;
 	case WLAN_CIPHER_SUITE_AES_CMAC:
 		hw_key_type = RTW89_SEC_KEY_TYPE_BIP_CCMP128;
+		key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;
 		break;
 	default:
 		return -EOPNOTSUPP;
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 58ee5efc3b5e..4761a9f1c019 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -730,6 +730,9 @@ rtw89_core_tx_update_sec_key(struct rtw89_dev *rtwdev,
 	case WLAN_CIPHER_SUITE_GCMP_256:
 		sec_type = RTW89_SEC_KEY_TYPE_GCMP256;
 		break;
+	case WLAN_CIPHER_SUITE_AES_CMAC:
+		sec_type = RTW89_SEC_KEY_TYPE_BIP_CCMP128;
+		break;
 	default:
 		rtw89_warn(rtwdev, "key cipher not supported %d\n", key->cipher);
 		return;
@@ -906,6 +909,19 @@ u8 rtw89_core_get_ch_dma_v2(struct rtw89_dev *rtwdev, u8 qsel)
 }
 EXPORT_SYMBOL(rtw89_core_get_ch_dma_v2);
 
+static void rtw89_core_tx_trim_bip_mic(struct rtw89_core_tx_request *tx_req)
+{
+	const size_t mic_len = sizeof_field(struct ieee80211_mmie, mic);
+	struct sk_buff *skb = tx_req->skb;
+	struct ieee80211_key_conf *key = IEEE80211_SKB_CB(skb)->control.hw_key;
+
+	if (key->cipher != WLAN_CIPHER_SUITE_AES_CMAC)
+		return;
+
+	skb_trim(skb, skb->len - mic_len);
+	tx_req->desc_info.pkt_size = skb->len;
+}
+
 static void
 rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev,
 			       struct rtw89_core_tx_request *tx_req)
@@ -936,6 +952,7 @@ rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev,
 	desc_info->data_rate = rtw89_core_get_mgmt_rate(rtwdev, tx_req, chan);
 
 	if (chip->hw_mgmt_tx_encrypt && IEEE80211_SKB_CB(skb)->control.hw_key) {
+		rtw89_core_tx_trim_bip_mic(tx_req);
 		rtw89_core_tx_update_sec_key(rtwdev, tx_req);
 		rtw89_core_tx_update_llc_hdr(rtwdev, desc_info, skb);
 	}

base-commit: 9b0be45d4d52fd223994e151f169743a97abd290
-- 
2.25.1


                 reply	other threads:[~2026-10-29  1:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261029014857.9753-1-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=gary.chang@realtek.com \
    --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