wifi: rtw89: add support for HW TKIP crypto

For 8852BTE, 8852CE, and 8922AE, TKIP encryption and decryption
will be handled by hardware. All other chips will retain their
existing software-based encryption and decryption.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250220062344.15836-1-pkshih@realtek.com
This commit is contained in:
Kuan-Chung Chen 2025-02-20 14:23:44 +08:00 committed by Ping-Ke Shih
parent c374281f82
commit 9e9877bd82
9 changed files with 15 additions and 2 deletions

View file

@ -476,6 +476,12 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
case WLAN_CIPHER_SUITE_WEP104:
hw_key_type = RTW89_SEC_KEY_TYPE_WEP104;
break;
case WLAN_CIPHER_SUITE_TKIP:
if (!chip->hw_tkip_crypto)
return -EOPNOTSUPP;
hw_key_type = RTW89_SEC_KEY_TYPE_TKIP;
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
break;
case WLAN_CIPHER_SUITE_CCMP:
hw_key_type = RTW89_SEC_KEY_TYPE_CCMP128;
if (!chip->hw_mgmt_tx_encrypt)

View file

@ -4285,6 +4285,7 @@ struct rtw89_chip_info {
bool ul_tb_pwr_diff;
bool hw_sec_hdr;
bool hw_mgmt_tx_encrypt;
bool hw_tkip_crypto;
u8 rf_path_num;
u8 tx_nss;
u8 rx_nss;

View file

@ -708,8 +708,8 @@ static int sec_eng_init_be(struct rtw89_dev *rtwdev)
val32 |= B_BE_CLK_EN_CGCMP | B_BE_CLK_EN_WAPI | B_BE_CLK_EN_WEP_TKIP |
B_BE_SEC_TX_ENC | B_BE_SEC_RX_DEC |
B_BE_MC_DEC | B_BE_BC_DEC |
B_BE_BMC_MGNT_DEC | B_BE_UC_MGNT_DEC;
val32 &= ~B_BE_SEC_PRE_ENQUE_TX;
B_BE_BMC_MGNT_DEC | B_BE_UC_MGNT_DEC |
B_BE_SEC_PRE_ENQUE_TX;
rtw89_write32(rtwdev, R_BE_SEC_ENG_CTRL, val32);
rtw89_write32_set(rtwdev, R_BE_SEC_MPDU_PROC, B_BE_APPEND_ICV | B_BE_APPEND_MIC);

View file

@ -2502,6 +2502,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
.ul_tb_pwr_diff = false,
.hw_sec_hdr = false,
.hw_mgmt_tx_encrypt = false,
.hw_tkip_crypto = false,
.rf_path_num = 1,
.tx_nss = 1,
.rx_nss = 1,

View file

@ -2220,6 +2220,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
.ul_tb_pwr_diff = false,
.hw_sec_hdr = false,
.hw_mgmt_tx_encrypt = false,
.hw_tkip_crypto = false,
.rf_path_num = 2,
.tx_nss = 2,
.rx_nss = 2,

View file

@ -856,6 +856,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
.ul_tb_pwr_diff = false,
.hw_sec_hdr = false,
.hw_mgmt_tx_encrypt = false,
.hw_tkip_crypto = false,
.rf_path_num = 2,
.tx_nss = 2,
.rx_nss = 2,

View file

@ -789,6 +789,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
.ul_tb_pwr_diff = false,
.hw_sec_hdr = false,
.hw_mgmt_tx_encrypt = false,
.hw_tkip_crypto = true,
.rf_path_num = 2,
.tx_nss = 2,
.rx_nss = 2,

View file

@ -3015,6 +3015,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
.ul_tb_pwr_diff = true,
.hw_sec_hdr = true,
.hw_mgmt_tx_encrypt = true,
.hw_tkip_crypto = true,
.rf_path_num = 2,
.tx_nss = 2,
.rx_nss = 2,

View file

@ -2774,6 +2774,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
.ul_tb_pwr_diff = false,
.hw_sec_hdr = true,
.hw_mgmt_tx_encrypt = true,
.hw_tkip_crypto = true,
.rf_path_num = 2,
.tx_nss = 2,
.rx_nss = 2,