From patchwork Thu Dec 12 00:49:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13904584 X-Patchwork-Delegate: kvalo@adurom.com 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 D2A0E558BB for ; Thu, 12 Dec 2024 00:49:28 +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=1733964570; cv=none; b=EkJYtkLuo7+FAkCs7+9tN5/6WOa2zBKL61n2sCxTrEUqbjPoMYfaZ57Lh/ymy/0IGbyMH7ZeDnRdAaKBkzjKBd6zPabHZya/waN4K6zriVnZCPaD/dQDMR6I+hnW5i37HiumKfeuCESG7wLcEAImOKvaezUxhcnExmhBe8jjaFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733964570; c=relaxed/simple; bh=+roJVi4IbrMFdHmeGX4fUCznsm0nooBiCDiI7IUTFNQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XmNnszOiO7/Od9xQqP7OYZsGK+J+vUV8DdyQs853xnQm9M6OksEpLj+n9Boo9c0GrMenxTJEiBYr8yoyee/S8AO9sdE8rwJAAMTTu0uiu948uFXYMr/XfgeMvHzP4bXmlpJQJqAhpm5+9w/I657I+DGiCDnsXRaBLVP5BsmrWcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=XSPBXbDE; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="XSPBXbDE" 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 4BBHD1Qc014897; Thu, 12 Dec 2024 00:49:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wvQMEuL7EfkS3JEi5c+IyVUsYAXkZpljmbSCKas1tzU=; b=XSPBXbDEgp4lviMc W80vZoL8gf/PDhez+cAPLEzfE2cJeprkC9CGjo4OLfBgHYY6nPuBX7Q5Ao8/BXA3 HSgbhThweUQSvhzPMLLJpm7qvNizyMGAaTOYOWxSmfPp2WHnzTV5wxjc1aCSJRqV WuDZwa6tH0yJgX7ZyKQWFEDUcXjf98fODBg/7GsNeFV9XMIJl/lR0e4LiSlmMgbs TB4nZvI14rMFG9fNE1vUzLYeccozTZFP8XiErciytc8HjBd2BrW351QfXO36LYnn NeB9YbKsF7IaHrAHjOjUQYPxoU7Gh5B8aORGtt83wS/p5fv885dc3e8Lb99dFgMF Tr5flQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43f7dpjfv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:25 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BC0nOIq006967 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:24 GMT Received: from hu-periyasa-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Dec 2024 16:49:22 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH 1/4] wifi: ath12k: Refactor ath12k_hw set helper function argument Date: Thu, 12 Dec 2024 06:19:03 +0530 Message-ID: <20241212004906.3087425-2-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241212004906.3087425-1-quic_periyasa@quicinc.com> References: <20241212004906.3087425-1-quic_periyasa@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: X6xDlWfk1ChazsyoieA8sgxrcWWdhCqO X-Proofpoint-ORIG-GUID: X6xDlWfk1ChazsyoieA8sgxrcWWdhCqO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxlogscore=783 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412120003 Currently, ath12k_hw is placed inside the ath12k_hw_group. However, the ath12k_hw set helper function takes the device handle and the index as parameters. Here, the index parameter is specific to the group handle. Therefore, change this helper function argument from the device handle to the group handle. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath12k/core.h | 4 ++-- drivers/net/wireless/ath/ath12k/mac.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 458e3d0071a8..3173d94989c9 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1175,10 +1175,10 @@ static inline struct ath12k_hw *ath12k_ab_to_ah(struct ath12k_base *ab, int idx) return ab->ag->ah[idx]; } -static inline void ath12k_ab_set_ah(struct ath12k_base *ab, int idx, +static inline void ath12k_ag_set_ah(struct ath12k_hw_group *ag, int idx, struct ath12k_hw *ah) { - ab->ag->ah[idx] = ah; + ag->ah[idx] = ah; } static inline int ath12k_get_num_hw(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index c4eab4c1c10e..8f2ca05617e6 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10941,7 +10941,7 @@ void ath12k_mac_destroy(struct ath12k_hw_group *ag) continue; ath12k_mac_hw_destroy(ah); - ath12k_ab_set_ah(ab, i, NULL); + ath12k_ag_set_ah(ag, i, NULL); } } @@ -11022,7 +11022,7 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag) continue; ath12k_mac_hw_destroy(ah); - ath12k_ab_set_ah(ab, i, NULL); + ath12k_ag_set_ah(ag, i, NULL); } return ret; From patchwork Thu Dec 12 00:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13904585 X-Patchwork-Delegate: kvalo@adurom.com 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 0F14355C29 for ; Thu, 12 Dec 2024 00:49:29 +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=1733964572; cv=none; b=hxG62KgKh+JI//iXlfsfxqGC2iD6IvfA5XT2ofk86X7+yIgiCHX7aLYUCW2YyqN1V/7imhBsKKE8gspZJcBDK7LYZF2e0TpexjvCGBDdfmZR7TyeZR8juckWGPUuHDIUPaZThpDvO64aGC9qrMvyoZq8Nt8yTxk0xLo3DNgte8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733964572; c=relaxed/simple; bh=YUWP2t3bTAfpSQ956fbqKuZYsTs3A/la2OdGxuC/x4k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lwz/AjZJoV6zyUxoGvcDQ7RYMLs9KdCE7n5mYwUrxgExw95jLKSwMyPaG1n9lEdc86Ec4Ik6X9ZpaXuVM5dWTumTUkhjTHBiVSer/kcHVOP66CZwWhSoSdP+g6pXhlJ8BULjVk6oo/cFQqXviFWaYyaICJsNVln9IyBEPvzh6zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=k3DNAs4n; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="k3DNAs4n" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BBHD5nP002087; Thu, 12 Dec 2024 00:49:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= XC9rAb9zCKZkZsLnw6isWKQVA7rvKja8/xZGMta4lLc=; b=k3DNAs4nepCo9n2F JZgdgR7bCrOk7dBATo7yiCxOYqWVl1Gm9LK756t4dueyzel8PMWM8uxg+IxU80uU AxQRdMCg8W8Fy4YwWUIs51QoyWgIqxxCMuzTyDVHto/XoHEH6JzIT1PJzTCDzGd+ 078cLr9Qz2Y1ylO+WYYcD1ki877nUfBf5w5PkPn3AnA+okZDfeJEHE8Cjn2jwfaW Z4h1dz+V4nv6D2ZcT6/chGdkzRCHH6bs4WynNFJgUvUtUo+hzbgv7EdEnotSugKN oFCiF45lWQZu2PYrfBSXozYfnjEDfXDCImVYdD70aisb9uHfSOcnh2ldqZQbOj19 Oa+13w== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43f0r9un7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:26 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BC0nQbf032238 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:26 GMT Received: from hu-periyasa-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Dec 2024 16:49:24 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH 2/4] wifi: ath12k: Refactor the ath12k_hw get helper function argument Date: Thu, 12 Dec 2024 06:19:04 +0530 Message-ID: <20241212004906.3087425-3-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241212004906.3087425-1-quic_periyasa@quicinc.com> References: <20241212004906.3087425-1-quic_periyasa@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: nnYMb81efKayg07ZJLZBK07n-gNQDMxy X-Proofpoint-GUID: nnYMb81efKayg07ZJLZBK07n-gNQDMxy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 spamscore=0 clxscore=1015 mlxlogscore=964 malwarescore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412120004 Currently, ath12k_hw is placed inside the ath12k_hw_group. However, the ath12k_hw get helper function takes the device handle and the index as parameters. Here, the index parameter is specific to the group handle. Therefore, change this helper function argument from the device handle to the group handle. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath12k/core.c | 8 ++++---- drivers/net/wireless/ath/ath12k/core.h | 4 ++-- drivers/net/wireless/ath/ath12k/mac.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 49d1ac15cb7a..bf391e6e8f72 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1109,7 +1109,7 @@ static void ath12k_rfkill_work(struct work_struct *work) spin_unlock_bh(&ab->base_lock); for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ab->ag, i); if (!ah) continue; @@ -1161,7 +1161,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ab->ag, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1200,7 +1200,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab) int i, j; for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ab->ag, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1262,7 +1262,7 @@ static void ath12k_core_restart(struct work_struct *work) } for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ab->ag, i); ieee80211_restart_hw(ah->hw); } } diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 3173d94989c9..56e740ec61e8 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1170,9 +1170,9 @@ static inline struct ieee80211_hw *ath12k_ar_to_hw(struct ath12k *ar) for ((index) = 0; ((index) < (ah)->num_radio && \ ((ar) = &(ah)->radio[(index)])); (index)++) -static inline struct ath12k_hw *ath12k_ab_to_ah(struct ath12k_base *ab, int idx) +static inline struct ath12k_hw *ath12k_ag_to_ah(struct ath12k_hw_group *ag, int idx) { - return ab->ag->ah[idx]; + return ag->ah[idx]; } static inline void ath12k_ag_set_ah(struct ath12k_hw_group *ag, int idx, diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 8f2ca05617e6..7116516b4c01 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10826,7 +10826,7 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) int ret; for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ag, i); ret = ath12k_mac_hw_register(ah); if (ret) @@ -10839,7 +10839,7 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) err: for (i = i - 1; i >= 0; i--) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; @@ -10858,7 +10858,7 @@ void ath12k_mac_unregister(struct ath12k_hw_group *ag) clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); for (i = ath12k_get_num_hw(ab) - 1; i >= 0; i--) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; @@ -10936,7 +10936,7 @@ void ath12k_mac_destroy(struct ath12k_hw_group *ag) } for (i = 0; i < ath12k_get_num_hw(ab); i++) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; @@ -11017,7 +11017,7 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag) err: for (i = i - 1; i >= 0; i--) { - ah = ath12k_ab_to_ah(ab, i); + ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; From patchwork Thu Dec 12 00:49:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13904586 X-Patchwork-Delegate: kvalo@adurom.com 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 E9A5B1E531 for ; Thu, 12 Dec 2024 00:49:32 +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=1733964574; cv=none; b=Qyzs5EM4HoNKUiGE2+KWb9Sqv+8mT+XPko3l81VQsFarYE7PIGyCl8f0EgJ4o1LQXzGx0GkjeFjDedR8DtT8FCl7ngY4oDZFXsE5j2zY4dbunk0O+Sya86vv/1pUC9e64eJplVevookjSkM5yjFoHp3dQjWzk5VBZRywZ3KYrD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733964574; c=relaxed/simple; bh=av+AWSqSkpLJfXqwT1T/JGtW4aMqSI7MrsguIf8inmo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cUX7mxpLVhTR3jxoAQP0iUfFyjAHq6GxhsiCeC80ncw+KpthIlwPTgVg7EAJFLoefJjZVXtR4TS/CTrxqXzxDVCt6FFvghScDOtyEK7J0SEGaTuabC3WvaUrwDcBr3kbbJ9/bCzInuJRssLWij3SAc1+wQZ9dnco7PjH6A8ffYg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ZyT2+hhc; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ZyT2+hhc" 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 4BBHD1SW014909; Thu, 12 Dec 2024 00:49:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= JKFBVD+PTEp5MWFMgyQ7AQLNjukhMu+5UMQ55/fVg1Y=; b=ZyT2+hhcZN8YXyJZ vtDQIMKsWR7lPi/Eht5bD16zuDlzP91Q7jiXV2BNCsvQX/gZcCSeql0L7HQhZ6iO 4KMGiJi3a5Jp/Wq+DfBDBIUrulmtKgfulUWXO9rssbNDN5IQTAguOoFYPnZLnMvN PmrDnOXWcv7LWQh1CSscaN+Bt9TFqEVLcmxQa+Bvm3AUKiohl5On9+0+KFlZdMmy crlLPnuqx0qx20wxfqPUFCHTeJTW/MiJ/l8wyn1T1nQju3F2kWxESp0VZnxSYyOR LcV892L3uqJRPRBoG+yZrYqCRRWOnv1vNPRwo+vkoIgU17JROgpQkeXgWXc6a0es UoAsxA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43f7dpjfv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:29 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BC0nSQD021425 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:28 GMT Received: from hu-periyasa-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Dec 2024 16:49:26 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy , Dan Carpenter Subject: [PATCH 3/4] wifi: ath12k: Refactor ath12k_get_num_hw() helper function argument Date: Thu, 12 Dec 2024 06:19:05 +0530 Message-ID: <20241212004906.3087425-4-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241212004906.3087425-1-quic_periyasa@quicinc.com> References: <20241212004906.3087425-1-quic_periyasa@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ijpNYNE1tjFU163UFQlNvIdEPtJhNjFq X-Proofpoint-ORIG-GUID: ijpNYNE1tjFU163UFQlNvIdEPtJhNjFq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412120003 Currently, the ath12k_get_num_hw() helper function takes the device handle as an argument. Here, the number of hardware is retrieved from the group handle. Demanding the device handle from the caller is unnecessary since in some cases the group handle is already available. Therefore, change this helper function argument from the device handle to the group handle. This also fixes the below Smatch static checker warning. Smatch warning: ath12k_mac_destroy() error: we previously assumed 'ab' could be null Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Reported-by: Dan Carpenter Closes: https://lore.kernel.org/ath12k/3e705de0-67d1-4437-97ff-4828d83ae2af@stanley.mountain/ Closes: https://scan7.scan.coverity.com/#/project-view/52682/11354?selectedIssue=1602340 Fixes: a343d97f27f5 ("wifi: ath12k: move struct ath12k_hw from per device to group") Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath12k/core.c | 8 ++++---- drivers/net/wireless/ath/ath12k/core.h | 4 ++-- drivers/net/wireless/ath/ath12k/mac.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index bf391e6e8f72..54309602eda4 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1108,7 +1108,7 @@ static void ath12k_rfkill_work(struct work_struct *work) rfkill_radio_on = ab->rfkill_radio_on; spin_unlock_bh(&ab->base_lock); - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ab->ag); i++) { ah = ath12k_ag_to_ah(ab->ag, i); if (!ah) continue; @@ -1160,7 +1160,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) if (ab->is_reset) set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ab->ag); i++) { ah = ath12k_ag_to_ah(ab->ag, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1199,7 +1199,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab) struct ath12k *ar; int i, j; - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ab->ag); i++) { ah = ath12k_ag_to_ah(ab->ag, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1261,7 +1261,7 @@ static void ath12k_core_restart(struct work_struct *work) ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset success\n"); } - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ab->ag); i++) { ah = ath12k_ag_to_ah(ab->ag, i); ieee80211_restart_hw(ah->hw); } diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 56e740ec61e8..6756bbb8a09b 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1181,9 +1181,9 @@ static inline void ath12k_ag_set_ah(struct ath12k_hw_group *ag, int idx, ag->ah[idx] = ah; } -static inline int ath12k_get_num_hw(struct ath12k_base *ab) +static inline int ath12k_get_num_hw(struct ath12k_hw_group *ag) { - return ab->ag->num_hw; + return ag->num_hw; } static inline struct ath12k_hw_group *ath12k_ab_to_ag(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 7116516b4c01..5cdc1c38b049 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10825,7 +10825,7 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) int i; int ret; - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ag); i++) { ah = ath12k_ag_to_ah(ag, i); ret = ath12k_mac_hw_register(ah); @@ -10857,7 +10857,7 @@ void ath12k_mac_unregister(struct ath12k_hw_group *ag) clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); - for (i = ath12k_get_num_hw(ab) - 1; i >= 0; i--) { + for (i = ath12k_get_num_hw(ag) - 1; i >= 0; i--) { ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; @@ -10935,7 +10935,7 @@ void ath12k_mac_destroy(struct ath12k_hw_group *ag) } } - for (i = 0; i < ath12k_get_num_hw(ab); i++) { + for (i = 0; i < ath12k_get_num_hw(ag); i++) { ah = ath12k_ag_to_ah(ag, i); if (!ah) continue; From patchwork Thu Dec 12 00:49:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13904587 X-Patchwork-Delegate: kvalo@adurom.com 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 2128A225D7 for ; Thu, 12 Dec 2024 00:49:33 +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=1733964575; cv=none; b=DLfHhfz+VGfb14ZRiDsjjeXD7BJwBacdFY093hPWWhtq8QIAp7dgJmvOOePXnEMdoflrwTRazmeNC5qPVp7YU4w0fWeQqG6a8SrUfHpL46JVA+W1P3pXQI4PEtYC2ym7A63hZ2UdtBiU6MLsayCtm7RoL0aBtHpb1LPHQGXTDIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733964575; c=relaxed/simple; bh=jr1hU5wx+cCULTdUrNNttLMV3YVicrhs11PROr2lt2w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EQOEx4/a/A9TbNEdEL/Y4TE6jCtmkTio3J6XaC3J6hRGOVsZjx1fol6Tn/eaZoQDWb0V4ZQ12ywjjTMI0rAH7UM4gnltXQdW9dA7fsR8vflhJIpi78uHxj5h3sgLfjr6gFPiBp2amvwc0oPdcCbm8PemddTsBSt0tu1qWA5ttWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=KdjMv0hP; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="KdjMv0hP" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BBHDDpW010709; Thu, 12 Dec 2024 00:49:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= g4bubB7HxTfp2qVzUUWbwlPS9OLKYPj1IaPi0pZsMzc=; b=KdjMv0hPNuJ05mta mWIcWXPLMn4iJzrutUl6zwgzrnW7Aw35T4XFBtW2ajtSYveWK9fL/a+RXMDo2sf8 qqxS8OLSh1jQ37LRo6nndSiwundADDgCzOilSf70DQUkQ6sR9CC08OG11iO+cCNs SYIJxc7BHtxU1eWiQHV9nGcZR1FAECfh7oapQcvV/5wu3opqy7K1o43u18zKTL7p SAsg6W8ef6C54Sw+BUVhFEtB+kY3AhtuHtIorKO0vpJ1Mfxb6B4068GpYZ8mi4fh qqsvBx01H6tXhZQHC9nAnrxFcY97C2iy5bNmCadEkrcovtsw2I1ks3H4XfIjFs5H sdP8/g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43f1xd3e2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:30 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BC0nTDM007030 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2024 00:49:30 GMT Received: from hu-periyasa-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Dec 2024 16:49:28 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH 4/4] wifi: ath12k: Fix uninitialized variable access in ath12k_mac_allocate() function Date: Thu, 12 Dec 2024 06:19:06 +0530 Message-ID: <20241212004906.3087425-5-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241212004906.3087425-1-quic_periyasa@quicinc.com> References: <20241212004906.3087425-1-quic_periyasa@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: I87xiaYzMLbomnasFc2kOTq9dVZVG5nL X-Proofpoint-GUID: I87xiaYzMLbomnasFc2kOTq9dVZVG5nL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 clxscore=1015 bulkscore=0 adultscore=0 suspectscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412120004 Currently, the uninitialized variable 'ab' is accessed in the ath12k_mac_allocate() function. Initialize 'ab' with the first radio device present in the hardware abstraction handle (ah). Additionally, move the default setting procedure from the pdev mapping iteration to the total radio calculating iteration for better code readability. Perform the maximum radio validation check for total_radio to ensure that both num_hw and radio_per_hw are validated indirectly, as these variables are derived from total_radio. This also fixes the below Smatch static checker warning. Smatch warning: ath12k_mac_allocate() error: uninitialized symbol 'ab' Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Fixes: a343d97f27f5 ("wifi: ath12k: move struct ath12k_hw from per device to group") Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath12k/mac.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 5cdc1c38b049..98b2f853d243 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10962,8 +10962,20 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag) u8 radio_per_hw; total_radio = 0; - for (i = 0; i < ag->num_devices; i++) - total_radio += ag->ab[i]->num_radios; + for (i = 0; i < ag->num_devices; i++) { + ab = ag->ab[i]; + if (!ab) + continue; + + ath12k_mac_set_device_defaults(ab); + total_radio += ab->num_radios; + } + + if (!total_radio) + return -EINVAL; + + if (WARN_ON(total_radio > ATH12K_GROUP_MAX_RADIO)) + return -ENOSPC; /* All pdev get combined and register as single wiphy based on * hardware group which participate in multi-link operation else @@ -10976,14 +10988,16 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag) num_hw = total_radio / radio_per_hw; - if (WARN_ON(num_hw >= ATH12K_GROUP_MAX_RADIO)) - return -ENOSPC; - ag->num_hw = 0; device_id = 0; mac_id = 0; for (i = 0; i < num_hw; i++) { for (j = 0; j < radio_per_hw; j++) { + if (device_id >= ag->num_devices || !ag->ab[device_id]) { + ret = -ENOSPC; + goto err; + } + ab = ag->ab[device_id]; pdev_map[j].ab = ab; pdev_map[j].pdev_idx = mac_id; @@ -10995,10 +11009,11 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag) if (mac_id >= ab->num_radios) { mac_id = 0; device_id++; - ath12k_mac_set_device_defaults(ab); } } + ab = pdev_map->ab; + ah = ath12k_mac_hw_allocate(ag, pdev_map, radio_per_hw); if (!ah) { ath12k_warn(ab, "failed to allocate mac80211 hw device for hw_idx %d\n",