From patchwork Wed Jun 4 10:16:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Kathirvel X-Patchwork-Id: 894167 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10DC92AE84 for ; Wed, 4 Jun 2025 10:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749032196; cv=none; b=lfMdF5Ogcwo6Vins0hFv+27gXtZb3QWKIAJs2ORXUPw7C4Ghs1bKJFnSwl4eZjEZwYiXTod1n49cKKOrp1Q/Kr4iKl2i8e3Fr50Tujtufs3WV65TdKGIgMFW8zzGv1bj/gAC4HyIEeRMUIuRNomRCGNGfGqAPJGhz1ydptmGodk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749032196; c=relaxed/simple; bh=A/OJN5kUyOlE3EQxo2WwWTJcMLp4SUpQV5xaIHt0D6A=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=l5yFdo7EdZR1Zz413eB7PEuapjCR4Dp5gcbtmQQr1veYKfBmSap1rZVevqHvormHLZJ1MwGIJC0uFP8JkIjh8nAA5kDtUViv7IboRGba/Evw4Ap58BEMzaJYYzGNQ8hJf7rusS+UkVtDypr4PGM+W1765fZnWjxryM+cDBeYGjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=QiVB3aDA; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="QiVB3aDA" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5547gUWi000686 for ; Wed, 4 Jun 2025 10:16:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=zojVgYdtyymHQOWW+wijIZvxnRfclQDSOWD AxN8iJ24=; b=QiVB3aDAl+rnWx8F3JhQzCzlqMIwinnHydLB6s9ophxX9GGooEi mJBoDiCbCiCO7gVENQV4//FY3pAhdmp0IVRFnseejQgsF9NLJ1owXZjp+7rb605o 78sq9zh4N926XY8l77ciDogaJvSs6emHpmCOSQ6XWss/QnE8NU4l5Hsa3BTIVogg 0ovzFfC2dHp6F/QgT35SMAc3BUcPyiklkj5xHGk/iMunSAZ3S4kRQCbwORHz1PeJ 8GVBw6jmVI/6/GWT1wfGHWwGBTaNGKobP3sTju5WKeVi+bD7ickPYKITPipyl3C5 F/Ur9Gbmq1S5kx4m+x3CIUJWbJtlFs2TLnw== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 471g8q5q9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 04 Jun 2025 10:16:33 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-b0e5f28841dso4088453a12.2 for ; Wed, 04 Jun 2025 03:16:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749032192; x=1749636992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zojVgYdtyymHQOWW+wijIZvxnRfclQDSOWDAxN8iJ24=; b=vG3OtObBHOQTTngT5KMKU8xrZcqhgUMk+OkoUgz0FlCYtsBkKQ1pvQJtxndCLRBQa7 YwQaTlgwcuDmNraI+x7OTOh+o+CwYPumKJxCDIhQMDGGuKf9yqCf2ROtytdECKuaV2Cj C1JM46YoqujFX6gGINayY8pwxNKY9JWIMx4pjgdPd97nDf0QAbTuTdgrirjzRWBbfyv9 FOoLnN3fMROcIhcAVVCoERRdwo46/jii1GdVM1qDLS8tEPYYaUF+PDsuyjQXWGaWqIOm eGQjUlzsmuahKD1ZYsotmHKIGi1zymnAAwViMFdJqPZxDmTUdp4yPhivKz/QFd6fFVCj lG2w== X-Gm-Message-State: AOJu0YwivJz/JlVus0ffB136fFHCcYnLjj2mNwX5WRTanKh8lxZvH82t M5xrdQ+ndSEQ2d0TBXiiI93AjB3v+ReebFhh/JwGuHX7P4IrtcRTZsXhX6N/vma99+wo/WMAh7m +OeAwJm3L5LYAug5FKphIFi1KyXyR6mGB7bMU2giZMdYjXCXkTJc91MVTR3Nuc7wl3fkHVvO3uZ HrrQ== X-Gm-Gg: ASbGncsGkCzuZNgVDAXtCI9KNRMvyDoGPmrZIbLiZ8gFE1aURm0rft885kjVV1BElV8 AGXkUptTUiPExnV40kH1O+3CKyUCj3SThS0I4gUidW4iszSW9iTGrKkm3WY9x2aREv61599++7e /Y0Uj+Vq3FcG1tQVggKkMqvEcZLiHuE6Rgo52paepSptFwaWEJJGsTfc/R9Vhtk+jBW8eOTC4// vm3pWJLCAtfGA+0WnRPUGxLyxljKPjexceqSAnLpVS1w/BCCu0h/Y0toMXUZ3IlcLXZed6qB4Y+ YTD8ODgCclI4kpOiVkLOKXfuXsrRCJr9gTO8eGPyi1ZLsGMAcmp4GN9n X-Received: by 2002:a05:6a00:398f:b0:740:a023:5d60 with SMTP id d2e1a72fcca58-7480b452f9amr3307473b3a.19.1749032191890; Wed, 04 Jun 2025 03:16:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELzsvg1zF4KZg7wEw2FDFrHoqH23ECWsCxPuNuTNOnyESjcGQ3U5AY2XEybLA/RLfXgikDOg== X-Received: by 2002:a05:6a00:398f:b0:740:a023:5d60 with SMTP id d2e1a72fcca58-7480b452f9amr3307439b3a.19.1749032191427; Wed, 04 Jun 2025 03:16:31 -0700 (PDT) Received: from hu-kathirve-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b2eceb96fa2sm8393528a12.51.2025.06.04.03.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jun 2025 03:16:30 -0700 (PDT) From: Karthikeyan Kathirvel To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Kathirvel Subject: [PATCH ath-next v2] wifi: ath12k: allow beacon protection keys to be installed in hardware Date: Wed, 4 Jun 2025 15:46:20 +0530 Message-Id: <20250604101620.2948103-1-karthikeyan.kathirvel@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: xWaS4h2zBfTNxcrfAvmR2O8oN4VdW4jI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA0MDA3NyBTYWx0ZWRfX8eDC0fGuBwwt TcPIcOieP7p1Izhr+RHhmeVqrDyqNYo/XRc3HfAcNovo8S0q89C30leekbwnxvJgWdPLzeKi7yk B01K1dXku8cDxnuxTprV2J98DpyfniD1Y5YxCl+Qg735cGoyj5hVP/pZDYWwHWi8n6TT6G4ycTL KJqIc2AzOQ3Ozhlh0Bn4mklrOsVQ1w+3AvJ6YqVNkRwGfjmlMFYO3Fv5gcmkQs0WpWQp48JLCfg nHTftmU7zTXjJf+nQ6YoZKkM+JefI0823Ab/KxSJxFKm9W8A/BZ03dgwVQqGeAY9HCZBc0d04Mm Qp2iBhnXut7i26CRFvB55ahamtemNPPG8hqeShWyllHaN6e3HDw7Vm2u5HG2tys2Adh37M7/XZz hUIhICwZgA/kTDKJRrirRMe182QrK2YkI9lcerKYA0oQFkhUXhEsJsnRKPfbEwmu4aQiQj9I X-Proofpoint-ORIG-GUID: xWaS4h2zBfTNxcrfAvmR2O8oN4VdW4jI X-Authority-Analysis: v=2.4 cv=PrmTbxM3 c=1 sm=1 tr=0 ts=68401d01 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=N4hopNKjJsku8qVRZDMA:9 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-04_02,2025-06-03_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506040077 Install beacon protection keys in hardware for AP modes only if hardware supports it, as indicated by the WMI service bit WMI_TLV_SERVICE_BEACON_PROTECTION_SUPPORT. Allow keyidx up to 7, since beacon protection uses keyidx 6 and 7. Control this feature by setting bit 0 of feature_enable_bitmap when sending the WMI_BCN_TMPL_CMDID command to firmware. Check for the beacon protection enabled bit in both tx and non-tx profiles for MBSSID cases. If set in either profile, enable the beacon protection feature in firmware for transmitted vif. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Kathirvel --- v2: - IGTK hardware offload is not working because a firmware bug that gets triggered during IGTK key installation, which leads to corruption of the GTK keys in firmware. So as of now relying on software crypto till firmware fixes available in uptream - Made alignment fix --- drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/mac.c | 52 ++++++++++++++++++++------ drivers/net/wireless/ath/ath12k/wmi.c | 3 ++ drivers/net/wireless/ath/ath12k/wmi.h | 5 ++- 4 files changed, 48 insertions(+), 13 deletions(-) base-commit: c3910de7bab78afbc106206aed5ec8e79458fbee diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 941db6e49d6e..697bad921d82 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -316,6 +316,7 @@ struct ath12k_link_vif { int bank_id; u8 vdev_id_check_en; + bool beacon_prot; struct wmi_wmm_params_all_arg wmm_params; struct list_head list; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 88b59f3ff87a..58392484dbb5 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -1454,11 +1454,13 @@ static int ath12k_mac_remove_vendor_ie(struct sk_buff *skb, unsigned int oui, return 0; } -static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, struct sk_buff *bcn, +static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, + struct ath12k_link_vif *tx_arvif, + struct sk_buff *bcn, u8 bssid_index, bool *nontx_profile_found) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)bcn->data; - const struct element *elem, *nontx, *index, *nie; + const struct element *elem, *nontx, *index, *nie, *ext_cap_ie; const u8 *start, *tail; u16 rem_len; u8 i; @@ -1476,6 +1478,11 @@ static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, struct sk_bu start, rem_len)) arvif->wpaie_present = true; + ext_cap_ie = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, start, rem_len); + if (ext_cap_ie && ext_cap_ie->datalen >= 11 && + (ext_cap_ie->data[10] & WLAN_EXT_CAPA11_BCN_PROTECT)) + tx_arvif->beacon_prot = true; + /* Return from here for the transmitted profile */ if (!bssid_index) return; @@ -1518,6 +1525,19 @@ static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, struct sk_bu if (index->data[0] == bssid_index) { *nontx_profile_found = true; + + /* Check if nontx BSS has beacon protection enabled */ + if (!tx_arvif->beacon_prot) { + ext_cap_ie = + cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, + nontx->data, + nontx->datalen); + if (ext_cap_ie && ext_cap_ie->datalen >= 11 && + (ext_cap_ie->data[10] & + WLAN_EXT_CAPA11_BCN_PROTECT)) + tx_arvif->beacon_prot = true; + } + if (cfg80211_find_ie(WLAN_EID_RSN, nontx->data, nontx->datalen)) { @@ -1566,11 +1586,11 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif, } if (tx_arvif == arvif) - ath12k_mac_set_arvif_ies(arvif, beacons->bcn[0].skb, 0, NULL); + ath12k_mac_set_arvif_ies(arvif, tx_arvif, beacons->bcn[0].skb, 0, NULL); for (i = 0; i < beacons->cnt; i++) { if (tx_arvif != arvif && !nontx_profile_found) - ath12k_mac_set_arvif_ies(arvif, beacons->bcn[i].skb, + ath12k_mac_set_arvif_ies(arvif, tx_arvif, beacons->bcn[i].skb, bssid_index, &nontx_profile_found); @@ -1639,9 +1659,9 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif) } if (tx_arvif == arvif) { - ath12k_mac_set_arvif_ies(arvif, bcn, 0, NULL); + ath12k_mac_set_arvif_ies(arvif, tx_arvif, bcn, 0, NULL); } else { - ath12k_mac_set_arvif_ies(arvif, bcn, + ath12k_mac_set_arvif_ies(arvif, tx_arvif, bcn, link_conf->bssid_index, &nontx_profile_found); if (!nontx_profile_found) @@ -4766,6 +4786,16 @@ static int ath12k_install_key(struct ath12k_link_vif *arvif, arg.key_cipher = WMI_CIPHER_AES_GCM; key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; break; + case WLAN_CIPHER_SUITE_AES_CMAC: + arg.key_cipher = WMI_CIPHER_AES_CMAC; + break; + case WLAN_CIPHER_SUITE_BIP_GMAC_128: + case WLAN_CIPHER_SUITE_BIP_GMAC_256: + arg.key_cipher = WMI_CIPHER_AES_GMAC; + break; + case WLAN_CIPHER_SUITE_BIP_CMAC_256: + arg.key_cipher = WMI_CIPHER_AES_CMAC; + break; default: ath12k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); return -EOPNOTSUPP; @@ -4997,13 +5027,9 @@ static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, lockdep_assert_wiphy(hw->wiphy); - /* BIP needs to be done in software */ - if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || - key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || - key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || - key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) { + /* IGTK needs to be done in host software */ + if (key->keyidx == 4 || key->keyidx == 5) return 1; - } if (key->keyidx > WMI_MAX_KEY_INDEX) return -ENOSPC; @@ -12089,6 +12115,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah) } wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_PUNCT); + if (test_bit(WMI_TLV_SERVICE_BEACON_PROTECTION_SUPPORT, ab->wmi_ab.svc_map)) + wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION); ath12k_reg_init(hw); diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 60e2444fe08c..bd16d41d42ec 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -2008,6 +2008,9 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, u32p_replace_bits(&ema_params, 1, WMI_EMA_BEACON_LAST); cmd->ema_params = cpu_to_le32(ema_params); } + cmd->feature_enable_bitmap = + cpu_to_le32(u32_encode_bits(arvif->beacon_prot, + WMI_BEACON_PROTECTION_EN_BIT)); ptr = skb->data + sizeof(*cmd); diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h index ac18f75e0449..cf42c1b402ea 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -2216,6 +2216,7 @@ enum wmi_tlv_service { WMI_TLV_SERVICE_PER_PEER_HTT_STATS_RESET = 213, WMI_TLV_SERVICE_FREQINFO_IN_METADATA = 219, WMI_TLV_SERVICE_EXT2_MSG = 220, + WMI_TLV_SERVICE_BEACON_PROTECTION_SUPPORT = 244, WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253, WMI_MAX_EXT_SERVICE = 256, @@ -3689,6 +3690,8 @@ struct ath12k_wmi_ftm_event { #define WMI_EMA_BEACON_FIRST GENMASK(23, 16) #define WMI_EMA_BEACON_LAST GENMASK(31, 24) +#define WMI_BEACON_PROTECTION_EN_BIT BIT(0) + struct ath12k_wmi_bcn_tmpl_ema_arg { u8 bcn_cnt; u8 bcn_index; @@ -4656,7 +4659,7 @@ enum wmi_ap_ps_peer_param { #define DISABLE_SIFS_RESPONSE_TRIGGER 0 -#define WMI_MAX_KEY_INDEX 3 +#define WMI_MAX_KEY_INDEX 7 #define WMI_MAX_KEY_LEN 32 enum wmi_key_type {