From patchwork Tue Dec 17 03:59:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13910959 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 9A30812E1CD for ; Tue, 17 Dec 2024 03:59:42 +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=1734407984; cv=none; b=asfEBNdZvCl4uQGMXWsZgHhhxyLtUs3v7kINpo6mMmRDQmDGp1kFnz4gcLzAKak00rkW7e0LGHVHY6IQ0CJ1fFCVsyrr3xDUyP1KJ1EubHwbZ0H4ci76xYKXkT9NrDdszKJKPqEeIh21gUS6TGcZX5kq3gMZobGdeL1wCsYYSTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734407984; c=relaxed/simple; bh=UmrY3OCgQYBmFqblk4iW/5lG6UlTf5tOJDKqk0r7yY8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FdZEYrUUOidwi7gVWPorEE32WfYOh2Mvq5+WAEyS8UKOs9IcRQhLv/Gy+UmrTcUC1DvNj2ZYNvux7wCosYaTvZNpM9hDgNeiqFLuV+kO82QKYcOZrSwgfSzA7MO3TY8N4T1kXmaZfWUlJ/AY8OsCZ17ozx3o9oysawYZUI4BzfI= 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=GthtFaCY; 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="GthtFaCY" 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 4BH2AU6g029279; Tue, 17 Dec 2024 03:59:39 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= wbUB2ufcYBkl+AYPK5HcuwiuIgImA2o2x5Sa62H+dT0=; b=GthtFaCY9bp7PaBX Nub6usBz69BccGdCyX9C6puuOvj2TZw2GjJGMLx3cmCkE4fKWx4vQ2qgEquK+yxr VxjrVZKmXlsS5LKK5nsaNhKX062QEqLM3t/ZKyP93bi0XLhfcuMQ176oFV6wtLUG w4uk/8jFgHtFFz1N1kbUGSwVXrSbGId8prXwh7RKWeenwUnUn8EGKULHI61Oz5iC 5MLgR3le+E95pW0pJzdPDHVK6NQLb/6DwHDj0/5bXydrwzwlock++qYIqqzciD8j 2Z0FpZoUyBXLvBGDBRKvGcT54ubgl2Xds8u5sDwDq6CLt+Wgt0XJlHNL/IAaQhqe OIepmg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43k09mr742-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:39 +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 4BH3xcZj007936 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:38 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; Mon, 16 Dec 2024 19:59:36 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH v2 1/4] wifi: ath12k: Refactor ath12k_hw set helper function argument Date: Tue, 17 Dec 2024 09:29:17 +0530 Message-ID: <20241217035920.2683568-2-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217035920.2683568-1-quic_periyasa@quicinc.com> References: <20241217035920.2683568-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: o71PgjhYUCWYM_swzOJXoBvhzAk3v9mM X-Proofpoint-ORIG-GUID: o71PgjhYUCWYM_swzOJXoBvhzAk3v9mM 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 clxscore=1015 lowpriorityscore=0 mlxlogscore=801 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170030 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 ec61ad3d82c3..efc273957b9c 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1203,10 +1203,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 186765fa95f5..cd22d4849ee6 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -11346,7 +11346,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); } } @@ -11427,7 +11427,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 Tue Dec 17 03:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13910960 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 E80C11474B8 for ; Tue, 17 Dec 2024 03:59:44 +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=1734407986; cv=none; b=qeezL667pbvadcgEQYL4ilrpbBeJ0lJXBiKfmTrV5KGO4JXUepzs1AHkkeNd6LOCpghRRv5KINLJ/JrxIpWNiY2p+3nGOBFjjCa+I/SwElAtpWFbaQadWRF/ocIngqrUuiHMGKgjhqQWXwW31SWlDRID0aBrbPQEg/hNgFAG+Q4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734407986; c=relaxed/simple; bh=d9DyEwb1XlQoWz6iUeSWPYX+hCAR0I6KrLhc3HY9ZaU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n4aXRHnZiHwcYb7K9VpJ226HkJL160CMWp8DQ3gfoxPyr4HljH4saq5iks3uy0//N0HaTccPM3U6zeX5PzsuQLPEZTW3l+87eq2Ykywr9kRFVjVdgK9luOs3OBnMp1gZvZlwTE1XqMYjP3qFeR9BoDLWAHWJxSXOBBt0DFHq5tw= 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=b0vGbafm; 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="b0vGbafm" 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 4BGNsgWf003430; Tue, 17 Dec 2024 03:59:41 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= d4JLGUyr5CV33G/wlyAkoW+IZ5o+c84y93aMiXGyJig=; b=b0vGbafmCsksgnBI 6kLraPC4rn+DFIDr3cvKusWOf+4+rH7DD7OA0+WbMfaCScLPBcMBfS0HlfnFJaa+ f7aaldLo/26FMS6xGUdb48z28bac22/TUVxkNMS7gOkJHTE8GxrzBFch6YLv42Ne mAablNT0qk/J43296CfSiqG7jok3TDPR8z4PcwPPQkzHIjoHQWUFNS0WXVsINC+Z Th1teZvrbRXTHgm8b/fio6uxV8Pw3ZSDq9t99RWVfFt8nWgjVJDMDrMtw5WCaI3a s1t6PLdhSLSMnwHUOqUGGC5Mkgafiwi8eeP1AvfZkI2zracSKhlCiIqSGgsTn3bw eafZyA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43jx9ygfdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:41 +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 4BH3xe7M003840 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:40 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; Mon, 16 Dec 2024 19:59:38 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH v2 2/4] wifi: ath12k: Refactor the ath12k_hw get helper function argument Date: Tue, 17 Dec 2024 09:29:18 +0530 Message-ID: <20241217035920.2683568-3-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217035920.2683568-1-quic_periyasa@quicinc.com> References: <20241217035920.2683568-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: 1qQGQMm5FhfpLMsKcBD2cmwQFPPIZz-S X-Proofpoint-ORIG-GUID: 1qQGQMm5FhfpLMsKcBD2cmwQFPPIZz-S 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 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=975 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170030 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 0c6b35aac96e..af49e7db4928 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1184,7 +1184,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; @@ -1236,7 +1236,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; @@ -1275,7 +1275,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; @@ -1337,7 +1337,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 efc273957b9c..6b31e053d6da 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1198,9 +1198,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 cd22d4849ee6..99159663ecad 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -11228,7 +11228,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) @@ -11241,7 +11241,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; @@ -11260,7 +11260,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; @@ -11341,7 +11341,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; @@ -11422,7 +11422,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 Tue Dec 17 03:59:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13910961 X-Patchwork-Delegate: kvalo@adurom.com Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 9B37E12E1CD for ; Tue, 17 Dec 2024 03:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734407988; cv=none; b=m4PikeLGK+CxBmxmZGfkaRJOAbyXpPVi4dtQZ/ZGXWZdO+Fnb7ZlMgtGt0L4IsYcfYEGSe+rCKfbq91op127Ry/khCoPvsCOlFjjamAP3f2LLaX64jB4du72ZnorbU5hZAjHyxPo49/vCfs1K5N2lhq04SyfLzKaxHP11oX2uBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734407988; c=relaxed/simple; bh=HyuTwIS2oxYr7YzoL3menAyhMJ9rd8wKq1mgIVMe2Co=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PwGKFFZfGcTeMYCsBNvG/oX6+1UcBEFuhhUhtAOBO80NGuDuDHjbHPkSxUkSRGOV4HDEntvRUP5aCZSp0T7vQG/M6mmiHXWfsNTjEXBORap9MZnohVlNe6Ir4nl8CJ/sxzcHzmOs2b9YHtpt3lPQJkuO8ErZ39gUSkqtzFUb/wo= 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=UKDvqUkH; arc=none smtp.client-ip=205.220.168.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="UKDvqUkH" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGNs4DZ029742; Tue, 17 Dec 2024 03:59:43 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= T8HVPdnyKeu87Vz1e6tZXwA1EGHkZ4aNE7FXvPCBSto=; b=UKDvqUkHGGQsYHhA k+MWcb2vZ6SGYPQTghjgPpg1V2sOoIrqulu7YawgE8o5QbUlBvGGdHkH4Zu1/LOo LB++VQfVK/qeqW1R2PJ6NtB3RMJ8oTS7SF+7G7xf9P4Ki1tCurhU61F6NVjnjlGh B4EbXa1BljX/XMSLGqHPKLVD3hJKR2NRaUk82UQh5Fyt+Z8V3KHXSia7d1UShSWf N6Di4proOQwl5Ez5Jb3gxzg8VDLY+3xxYKVPFAzThGtGz2XR26L1deyduYM0Agxz ajK8hORkaGLxWA2IoVmJTGeSQcHIOSQTdkMbl3teSTVdGjXP+usGADU8DVBolSdt kkolyA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43jx9dgfwt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:42 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BH3xgsH025848 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:42 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; Mon, 16 Dec 2024 19:59:40 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy , Dan Carpenter Subject: [PATCH v2 3/4] wifi: ath12k: Refactor ath12k_get_num_hw() helper function argument Date: Tue, 17 Dec 2024 09:29:19 +0530 Message-ID: <20241217035920.2683568-4-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217035920.2683568-1-quic_periyasa@quicinc.com> References: <20241217035920.2683568-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: g4llMOBXVkQW-fPT2dTocc_6ScIVrhBj X-Proofpoint-ORIG-GUID: g4llMOBXVkQW-fPT2dTocc_6ScIVrhBj 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 malwarescore=0 adultscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170030 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 af49e7db4928..7b482637676a 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1183,7 +1183,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; @@ -1235,7 +1235,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; @@ -1274,7 +1274,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; @@ -1336,7 +1336,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 6b31e053d6da..f37a50f3eabb 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1209,9 +1209,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 99159663ecad..c4eb54480ad1 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -11227,7 +11227,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); @@ -11259,7 +11259,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; @@ -11340,7 +11340,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 Tue Dec 17 03:59:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Periyasamy X-Patchwork-Id: 13910962 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 224F21474B8 for ; Tue, 17 Dec 2024 03:59:47 +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=1734407989; cv=none; b=mnw49HTAIfPMLfDNMEA1mXCzGJBaQo7D2y/AV1VbwGyYtd83Y76VyQwqKn/lawtrQZ2Bkf7Y17TLnyobK+kQZODnwuk7RwLF0ppyysrvInk46oh3EVZT70uymF/bDHMyV0j45kxFBiVkYbgEkBURI4+FD2qR2ewqwVYB4hVuF1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734407989; c=relaxed/simple; bh=yeXzXByIGfZ0r6xeARDiCWp+ozSmO43CZ/B3QPUlMxY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SloQePMRny9iMDtM1Giid0fMVP1+cAd6ZgX6xWegOQs+60Pky/MDRMIXKl1QEspyDVoQUexwR8ZVflUsGGjsgwNolqrp/C1LXvougrXc/OOcLl3u/EqRyAgu3MbFGkicq22tkRKcAOhsvMkOQ6tZhIQorDa7aYzHqnflQnhwmjU= 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=CVII4Ym4; 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="CVII4Ym4" 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 4BGNtAZm003816; Tue, 17 Dec 2024 03:59:45 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= bpueHRJcq+W49ScKVZWKgx/bQG37WTlOAOvQFxJ6bU0=; b=CVII4Ym4wWtfhwEg NX06q5IyVFh4UQLFVN1/GNMhKu/zTxyMB14e9eHVgR1tf92kBZuFqY1ll/YRgNqm ZiyDEdos9iK+y/JvcZffcL+S8WL0fpoOuRpfeY8RhsuqKp97y/xf9CUV+LsFMxOl WiVQ21ZaTUE8erptdZ9u3tfj8w0v7NeYXqp+LoSIzsx9rjIjJSarUx+nS5pxoJGU IB7veozD74oXBWQuqOsTuiRbJkRHquD12KgAD6aNltQ0TDVSUjk9Ildwcl2GbxY8 teHvTTEE9rztuLLmAO4q+uFTQZl3ePz3xdR6cp//+8/lbQtBx36GPmoneQjdBNmb I1cbWw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43jx9ygfdu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:45 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4BH3xiEB024985 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 03:59:44 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; Mon, 16 Dec 2024 19:59:42 -0800 From: Karthikeyan Periyasamy To: CC: , Karthikeyan Periyasamy Subject: [PATCH v2 4/4] wifi: ath12k: Fix uninitialized variable access in ath12k_mac_allocate() function Date: Tue, 17 Dec 2024 09:29:20 +0530 Message-ID: <20241217035920.2683568-5-quic_periyasa@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217035920.2683568-1-quic_periyasa@quicinc.com> References: <20241217035920.2683568-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: LuJyH8KnzWBwJxkns3D2bWc0eZusCEB7 X-Proofpoint-ORIG-GUID: LuJyH8KnzWBwJxkns3D2bWc0eZusCEB7 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 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170030 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 c4eb54480ad1..1eb4ddf65065 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -11367,8 +11367,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 @@ -11381,14 +11393,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; @@ -11400,10 +11414,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",