From patchwork Mon Jun 5 12:17:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaradhana Sahu X-Patchwork-Id: 13267270 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6283FC77B73 for ; Mon, 5 Jun 2023 12:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbjFEMR4 (ORCPT ); Mon, 5 Jun 2023 08:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbjFEMRy (ORCPT ); Mon, 5 Jun 2023 08:17:54 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E866DDA for ; Mon, 5 Jun 2023 05:17:52 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 355C1jpl016819; Mon, 5 Jun 2023 12:17:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=BB3+lszmKQtAlx4U5sSVdW+Zu5pz4AUF2nLwLE014z4=; b=W2Zzq/bSDdcgUBSeZP5WRNzCAmBrmqqge8ejtHoHFWFIhbgTut/wZEC9qTAjDGmRLC4o rxY7zx6jzwo00h2xFlEX7u6aF/3BBRs3KwSTmHW/QnhzqLrEKa83y1pPCuGU3Ety5tvs s6ywyT+9iRwd/UpiSAoOt47jmo021OU0hNUXLl7Y8yR/JlvvtU60CuXzV9nh2uxZsfKQ W/Kko9j+orWFwkepDwkWTiJvn4Sv7IjhwGj396QhX0jsY6NKWU1l9V53ZMIk+ir67b1K oO6lwLNDIFOAy9w+6vUTd1PnNFNgp5RU6iBBTuwUo0kD+lQD99Ye6t+ZoKC+yV3oBaJu jg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qyw46bjrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Jun 2023 12:17:49 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 355CHmpY015722 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 5 Jun 2023 12:17:48 GMT Received: from aarasahu-linux.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 5 Jun 2023 05:17:46 -0700 From: Aaradhana Sahu To: CC: , Sathishkumar Muruganandam , Aaradhana Sahu Subject: [PATCH 3/3] wifi: ath11k: add 802.3 undecap support to fix TKIP MIC error reporting Date: Mon, 5 Jun 2023 17:47:22 +0530 Message-ID: <20230605121722.20797-4-quic_aarasahu@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230605121722.20797-1-quic_aarasahu@quicinc.com> References: <20230605121722.20797-1-quic_aarasahu@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 0qkP562eGlAR_MPvsvOzlvbwRWZxdoR2 X-Proofpoint-GUID: 0qkP562eGlAR_MPvsvOzlvbwRWZxdoR2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-03_08,2023-06-02_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 bulkscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306050109 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sathishkumar Muruganandam Currently DECAP_TYPE_8023 frames with TKIP MIC error is not undecaped and hence fails to do TKIP MIC error reporting in ieee80211_rx_napi() path. Fix this by adding undecap support for ieee80211_rx_napi() to process these frames and perform TKIP counter-measures when there is MIC error reported. Tested with STA triggering TKIP MIC error frames (using debugfs "tkip_mic_test" in SW encryption mode) twice within a minute and verify TKIP counter-measures are performed as expected. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sathishkumar Muruganandam Signed-off-by: Aaradhana Sahu --- drivers/net/wireless/ath/ath11k/dp_rx.c | 39 ++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 03eeb3dfbb15..ce14cb09b9c1 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -2143,6 +2143,42 @@ static void ath11k_dp_rx_h_undecap_eth(struct ath11k *ar, ether_addr_copy(ieee80211_get_SA(hdr), sa); } +static void ath11k_dp_rx_h_undecap_snap(struct ath11k *ar, + struct sk_buff *msdu, + u8 *first_hdr, + enum hal_encrypt_type enctype, + struct ieee80211_rx_status *status) +{ + struct ieee80211_hdr *hdr; + size_t hdr_len; + u8 l3_pad_bytes; + struct hal_rx_desc *rx_desc; + + /* Delivered decapped frame: + * [amsdu header] <-- replaced with 802.11 hdr + * [rfc1042/llc] + * [payload] + */ + + rx_desc = (void *)msdu->data - sizeof(*rx_desc); + l3_pad_bytes = ath11k_dp_rx_h_msdu_end_l3pad(ar->ab, rx_desc); + + skb_put(msdu, l3_pad_bytes); + skb_pull(msdu, sizeof(struct ath11k_dp_amsdu_subframe_hdr) + l3_pad_bytes); + + hdr = (struct ieee80211_hdr *)first_hdr; + hdr_len = ieee80211_hdrlen(hdr->frame_control); + + if (!(status->flag & RX_FLAG_IV_STRIPPED)) { + memcpy(skb_push(msdu, + ath11k_dp_rx_crypto_param_len(ar, enctype)), + (void *)hdr + hdr_len, + ath11k_dp_rx_crypto_param_len(ar, enctype)); + } + + memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); +} + static void ath11k_dp_rx_h_undecap(struct ath11k *ar, struct sk_buff *msdu, struct hal_rx_desc *rx_desc, enum hal_encrypt_type enctype, @@ -2189,7 +2225,8 @@ static void ath11k_dp_rx_h_undecap(struct ath11k *ar, struct sk_buff *msdu, enctype, status); break; case DP_RX_DECAP_TYPE_8023: - /* TODO: Handle undecap for these formats */ + ath11k_dp_rx_h_undecap_snap(ar, msdu, first_hdr, + enctype, status); break; } }