From patchwork Thu Mar 20 11:24:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roopni Devanathan X-Patchwork-Id: 875214 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 8552921CA00 for ; Thu, 20 Mar 2025 11:24: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=1742469889; cv=none; b=VYVOD6Q/VVZU0y8VaGsG051V45XzYirfHnKvft2EjbTvMq7QVhVek51SmM6+CybvhuK2CoTKrfr0Dc+d+lE4JC2p/X/WaZudaTmuwOn0oZSVfO93eXhi+QxEC7JJIXEx4T1QMrhHgNv/oqBNFbUySL/xWHxNtmWPRzldPgd7dMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742469889; c=relaxed/simple; bh=iMWd5M9XSiKFxKOHbCfQgtcn3xo2y9jTJIxoQHW0dcg=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=eSfCI4HHvwebWtXir2AshEzUKCO+16z2ytC2I/AiAO856Hn01PR6AU7gOgfR3QkBQWzXJ9iU7l+Zs/SOtbxINxYqLs1z/wRQzgS8oiPkytky7ot5hX+8fUr5k8ymUFsLzE1WODSmcq98iL5ACYp2q1HKXu91WNryf2XRi0XzysQ= 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=JbCimqim; 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="JbCimqim" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52K6Z6o6025362; Thu, 20 Mar 2025 11:24:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=uAL0kXjOB7ukn1nv1cP+dx H8i59o4DdxP4cjsTVeYXw=; b=JbCimqim9C5odX0xaD/aE8ArPr7WhEw84cMOod CYEF5Etz7ssEmA73dIomw6RNdVjJSHZfKezNE0kfsFsKifex0RuZyyRoLAstllOw sOpy9PwvL7wyISYMFfk5AEqIvSEgLOrtAl9Iupt9BKbKZJ1wURBLpDyet7Ejt0kB BAwLM3BCuYLQCNgDgin8S6+sMMVvSTPOpWWDX/f4C6SEJMbW13Qbvn0RLK8k4zcE VpnuxRZsYZ13ENCLL0yclhD2vZNSj/Rw07MxNXN2b3xI1VFIN/4yb2HExIG/QodN K99q2P41VlKE+2M40JopmGAnCkxxyFZavtJHncvg/Np4gw7A== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45g15y2r42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Mar 2025 11:24:43 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52KBOfsp004378 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Mar 2025 11:24:41 GMT Received: from hu-rdevanat-blr.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 20 Mar 2025 04:24:40 -0700 From: Roopni Devanathan To: CC: , Pradeep Kumar Chitrapu , Roopni Devanathan Subject: [PATCH ath-next v3] wifi: ath12k: Fix incorrect rates sent to firmware Date: Thu, 20 Mar 2025 16:54:26 +0530 Message-ID: <20250320112426.1956961-1-quic_rdevanat@quicinc.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-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: LpSQMjf8nssh4suKMa8gQd0dHegtxGVx X-Proofpoint-ORIG-GUID: LpSQMjf8nssh4suKMa8gQd0dHegtxGVx X-Authority-Analysis: v=2.4 cv=VaD3PEp9 c=1 sm=1 tr=0 ts=67dbfafb cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=QoxrLkrA485RN3J7F1AA:9 a=v6Fpk0e4ntcIGe5OSANj:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-20_03,2025-03-19_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503200070 From: Pradeep Kumar Chitrapu Before firmware assert, if there is a station interface in the device which is not associated with an AP, the basic rates are set to zero. Following this, during firmware recovery, when basic rates are zero, ath12k driver is sending invalid rate codes, which are negative values, to firmware. This results in firmware assert. Fix this by checking if rate codes are valid, before sending them to the firmware. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Pradeep Kumar Chitrapu Signed-off-by: Roopni Devanathan Reviewed-by: Ping-Ke Shih Reviewed-by: Vasanthakumar Thiagarajan --- v3: - Modified the use of API ffs(). v2: - Replaced API ffs() to API __ffs(). --- drivers/net/wireless/ath/ath12k/mac.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) base-commit: b6f473c96421b8b451a8df8ccb620bcd71d4b3f4 diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 9fda97667d4e..b7e4bb00e87c 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -3450,7 +3450,10 @@ static void ath12k_recalculate_mgmt_rate(struct ath12k *ar, } sband = hw->wiphy->bands[def->chan->band]; - basic_rate_idx = ffs(bss_conf->basic_rates) - 1; + if (bss_conf->basic_rates) + basic_rate_idx = __ffs(bss_conf->basic_rates); + else + basic_rate_idx = 0; bitrate = sband->bitrates[basic_rate_idx].bitrate; hw_rate_code = ath12k_mac_get_rate_hw_value(bitrate); @@ -3983,10 +3986,14 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar, band = def.chan->band; mcast_rate = info->mcast_rate[band]; - if (mcast_rate > 0) + if (mcast_rate > 0) { rateidx = mcast_rate - 1; - else - rateidx = ffs(info->basic_rates) - 1; + } else { + if (info->basic_rates) + rateidx = __ffs(info->basic_rates); + else + rateidx = 0; + } if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) rateidx += ATH12K_MAC_FIRST_OFDM_RATE_IDX;