From patchwork Mon Dec 23 16:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13919154 X-Patchwork-Delegate: quic_jjohnson@quicinc.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 B5C3E1B393A; Mon, 23 Dec 2024 16:21:57 +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=1734970919; cv=none; b=jVN+Pwo8GE7jB140BffZL98Ay31hzbTy12HF+OClM0I2lMbjSeOgFYy5qlYKKD3d8cskSkRLBMzI/gLEgeqlvJC3mkVVsOsZsk8RHFgY0SOgRSjSQpF3ce1VilTvAXuZDD0Xf1CKpZ6u/RzK20VzAN86rblEKyiF5FvkeTsVHVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970919; c=relaxed/simple; bh=VBtmSNvyK87gcmLdo87vooYow1dFoNZpwSxYw3RXC0k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=E24W74W5HrZr63sGZexJ7nNqeH5f7GvXrif6BCfu9jnhtEaJMpQYZUtwcJdk9iQIiGpvh7huvquXas1RgXQSp2Ca4RImG8LapHYj9J2awFqvjwBHT5VIEeMrIjkz9DDfU2r+6Y2IVyU2feXhanIDVI9y70OvN5l/QQ4gr14rYhk= 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=dOA+pAju; 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="dOA+pAju" 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 4BNCatDi004224; Mon, 23 Dec 2024 16:21:52 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= FGehVTF7zvHWf49ABnoTQ81cLNNR/YoCUkt+Ee59IpI=; b=dOA+pAjusXvAEaLz mvFwanZaGY+eVHJY9W78oiomaNQAE6MorhPTfjSp6dYbi0HcH2GGp8hkrblTtZL5 JIfxseAn/DaYFvsyz/ee2yyYKGRh5AlH2gcNLF4y8eIo1jYn6dwbGrmjUxviyo4b qnQrOm9g1q3Hi21laKHBpIIaIGdMd32BFxlyl1B8TP0WNeNwgsAFzQ1Ni0bgjVT1 7PZYpxKMXPT+uBY/iniLYGQHFL64wClRXdQuZw8dTfXC6+LRNaCeoUl0s4OZGTdK RXJamf0cW13R5DgR4OcjpqbNG+eD1InmulV2lowdsBN5QnA9NY3HNVbDonG6NwwK 3IKsrQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43q8168vns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:51 +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 4BNGLoOU021556 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:50 GMT Received: from hu-adisi-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, 23 Dec 2024 08:21:48 -0800 From: Aditya Kumar Singh Date: Mon, 23 Dec 2024 21:51:36 +0530 Subject: [PATCH 1/4] wifi: ath12k: update beacon template function to use arvif structure Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241223-ath12k_mlo_csa-v1-1-78b6d7515568@quicinc.com> References: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> In-Reply-To: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> To: Kalle Valo , Jeff Johnson CC: , , , Aditya Kumar Singh X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: 0_F3w6VbgKH9ECMcHIBFpc-NT4um87Ip X-Proofpoint-GUID: 0_F3w6VbgKH9ECMcHIBFpc-NT4um87Ip 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 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 mlxscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230146 The current code has ath12k_wmi_bcn_tmpl() accepting separate ar and vdev_id parameters. However, ath12k_link_vif structure can be used to derive both of these. Hence, simplify the function signature. Later change needs arvif pointer access within the function hence it is better if arvif is directly passed now. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/mac.c | 5 ++--- drivers/net/wireless/ath/ath12k/wmi.c | 4 +++- drivers/net/wireless/ath/ath12k/wmi.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 6f10813d937820476afe8084ec4030b8eb9548a0..9420566952faecc02356e885bee138d3ba79b097 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -1579,8 +1579,7 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif) ema_args.bcn_cnt = beacons->cnt; ema_args.bcn_index = i; - ret = ath12k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, - &beacons->bcn[i].offs, + ret = ath12k_wmi_bcn_tmpl(tx_arvif, &beacons->bcn[i].offs, beacons->bcn[i].skb, &ema_args); if (ret) { ath12k_warn(tx_arvif->ar->ab, @@ -1674,7 +1673,7 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif) } } - ret = ath12k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, NULL); + ret = ath12k_wmi_bcn_tmpl(arvif, &offs, bcn, NULL); if (ret) ath12k_warn(ab, "failed to submit beacon template command: %d\n", diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 562b0615ed065d094f5d7709cafeb22c41f02d17..d06ab4db7db40219bd30079b4eb048f20637d42d 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1888,14 +1888,16 @@ int ath12k_wmi_p2p_go_bcn_ie(struct ath12k *ar, u32 vdev_id, return ret; } -int ath12k_wmi_bcn_tmpl(struct ath12k *ar, u32 vdev_id, +int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, struct ieee80211_mutable_offsets *offs, struct sk_buff *bcn, struct ath12k_wmi_bcn_tmpl_ema_arg *ema_args) { + struct ath12k *ar = arvif->ar; struct ath12k_wmi_pdev *wmi = ar->wmi; struct wmi_bcn_tmpl_cmd *cmd; struct ath12k_wmi_bcn_prb_info_params *bcn_prb_info; + u32 vdev_id = arvif->vdev_id; struct wmi_tlv *tlv; struct sk_buff *skb; u32 ema_params = 0; diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h index b6a197389277b4520bd3fb20b21a504092680531..742fdea272cb7a47b41d4446e1a3865f83827456 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -5640,7 +5640,7 @@ int ath12k_wmi_mgmt_send(struct ath12k *ar, u32 vdev_id, u32 buf_id, struct sk_buff *frame); int ath12k_wmi_p2p_go_bcn_ie(struct ath12k *ar, u32 vdev_id, const u8 *p2p_ie); -int ath12k_wmi_bcn_tmpl(struct ath12k *ar, u32 vdev_id, +int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, struct ieee80211_mutable_offsets *offs, struct sk_buff *bcn, struct ath12k_wmi_bcn_tmpl_ema_arg *ema_args); From patchwork Mon Dec 23 16:21:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13919155 X-Patchwork-Delegate: quic_jjohnson@quicinc.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 6DD1C1B87CB; Mon, 23 Dec 2024 16:21:59 +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=1734970921; cv=none; b=PQR7kaSX3zUP8gvjcDJpO8feYtnSs6h/PQ0co788rymnpZ2mnAUDBL69QC5cghRoKsxbPghetr9in6rQE3mLxXu6oLAHwUqkkZEL2gY1Qy2BdihrZdnb9rHDfk1BgTBs4nq33myElPY9mNrMvF7nXBIdiV+f36oy4548Ueoh7mQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970921; c=relaxed/simple; bh=RhH7PEST9CsM0TuLVQT920XhH3yHAeAZ5Ilc095evMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=K7sJzrm8/iKYpoRtrIyaqHDukcs1BCAaHj49c/YhOPVBcFjDBvaMs7pIeK+djekcbfufW/pbrxjfSrgD9hYo166CH4gicwrrIdJFphyurd/QgU4WrX1b7s8lmVR2p24PiMjNSY6dGwEQnQ3WfYyqUAhEOkeEKFu57r1bB5I4UyE= 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=oZk8WVUU; 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="oZk8WVUU" 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 4BNCv059002415; Mon, 23 Dec 2024 16:21:54 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= SxiF3GLS5OjBZJV0T+jJbED7JKPYbviS39caYHjQfi8=; b=oZk8WVUUwDMEmUtx QbC0WqHDKqnDogCIiCYvujHv/mEx1N5kzVHcRbfM8arwhw5fCM1CqNQyaXptNyLy eVFzYrroa+yRP9IbRgVZaF6RkgPCh66c4iWimyBeA5LqiuTKnxSd7XDhoNB4alVM kBUihz9P3rR93O9WAc56FYXzHjfgAUmoN3Uxu/dsCvu/Zls991br6P5OmiR/8MlH An4HUR5H4PZxO118DUk4O1xCOBlj+b7c78Wde4FHJA5HAnpcbiT/6zS4D41zAYUZ q7IyOfn0GY7xbNUgt3yQ2FIrfzxpLDYf6wEEpOm7dAbW+5L7pR45JqZ6j2GU8Ug6 6/8AnA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43q8ah8tqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:53 +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 4BNGLrf2025213 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:53 GMT Received: from hu-adisi-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, 23 Dec 2024 08:21:50 -0800 From: Aditya Kumar Singh Date: Mon, 23 Dec 2024 21:51:37 +0530 Subject: [PATCH 2/4] wifi: ath12k: fix handling of CSA offsets in beacon template command Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241223-ath12k_mlo_csa-v1-2-78b6d7515568@quicinc.com> References: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> In-Reply-To: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> To: Kalle Valo , Jeff Johnson CC: , , , Aditya Kumar Singh X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: C2X6Rc9bvwdPdkTuFHjXWyERXnAPa-Th X-Proofpoint-ORIG-GUID: C2X6Rc9bvwdPdkTuFHjXWyERXnAPa-Th 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 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 adultscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230146 The driver is informed of the counter offsets in the beacon during CSA through the ieee80211_mutable_offsets structure. According to the documentation for the cntdwn_counter_offs member, "This array can contain zero values which should be ignored." However, the current implementation uses these values unconditionally, without checking for zeros. Whenever CSA is active, these offsets are guaranteed to be set. Therefore, add a check for CSA active status before setting the CSA switch count offsets. This ensures that the offsets are only set when CSA is active, preventing incorrect configurations. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/mac.c | 2 +- drivers/net/wireless/ath/ath12k/mac.h | 1 + drivers/net/wireless/ath/ath12k/wmi.c | 23 ++++++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 9420566952faecc02356e885bee138d3ba79b097..ec37b2cc1457f1247fa80e707d79cd88dfddf2fb 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -501,7 +501,7 @@ static int ath12k_mac_vif_link_chan(struct ieee80211_vif *vif, u8 link_id, return 0; } -static struct ieee80211_bss_conf * +struct ieee80211_bss_conf * ath12k_mac_get_link_bss_conf(struct ath12k_link_vif *arvif) { struct ieee80211_vif *vif = arvif->ahvif->vif; diff --git a/drivers/net/wireless/ath/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h index 81cfb950e6cddfcf31747e46c7a9a805b94f55dd..9bd70a7d9874af491af98834f137894cd6280ad3 100644 --- a/drivers/net/wireless/ath/ath12k/mac.h +++ b/drivers/net/wireless/ath/ath12k/mac.h @@ -100,5 +100,6 @@ int ath12k_mac_mlo_setup(struct ath12k_hw_group *ag); int ath12k_mac_mlo_ready(struct ath12k_hw_group *ag); void ath12k_mac_mlo_teardown(struct ath12k_hw_group *ag); int ath12k_mac_vdev_stop(struct ath12k_link_vif *arvif); +struct ieee80211_bss_conf *ath12k_mac_get_link_bss_conf(struct ath12k_link_vif *arvif); #endif diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index d06ab4db7db40219bd30079b4eb048f20637d42d..ff973372a01a85bede15fde72bbe7db99bcfb300 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1895,8 +1895,11 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, { struct ath12k *ar = arvif->ar; struct ath12k_wmi_pdev *wmi = ar->wmi; + struct ath12k_base *ab = ar->ab; struct wmi_bcn_tmpl_cmd *cmd; struct ath12k_wmi_bcn_prb_info_params *bcn_prb_info; + struct ath12k_vif *ahvif = arvif->ahvif; + struct ieee80211_bss_conf *conf; u32 vdev_id = arvif->vdev_id; struct wmi_tlv *tlv; struct sk_buff *skb; @@ -1905,6 +1908,14 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, int ret, len; size_t aligned_len = roundup(bcn->len, 4); + conf = ath12k_mac_get_link_bss_conf(arvif); + if (!conf) { + ath12k_warn(ab, + "unable to access bss link conf in beacon template command for vif %pM link %u\n", + ahvif->vif->addr, arvif->link_id); + return -EINVAL; + } + len = sizeof(*cmd) + sizeof(*bcn_prb_info) + TLV_HDR_SIZE + aligned_len; skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len); @@ -1916,8 +1927,14 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, sizeof(*cmd)); cmd->vdev_id = cpu_to_le32(vdev_id); cmd->tim_ie_offset = cpu_to_le32(offs->tim_offset); - cmd->csa_switch_count_offset = cpu_to_le32(offs->cntdwn_counter_offs[0]); - cmd->ext_csa_switch_count_offset = cpu_to_le32(offs->cntdwn_counter_offs[1]); + + if (conf->csa_active) { + cmd->csa_switch_count_offset = + cpu_to_le32(offs->cntdwn_counter_offs[0]); + cmd->ext_csa_switch_count_offset = + cpu_to_le32(offs->cntdwn_counter_offs[1]); + } + cmd->buf_len = cpu_to_le32(bcn->len); cmd->mbssid_ie_offset = cpu_to_le32(offs->mbssid_off); if (ema_args) { @@ -1947,7 +1964,7 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, ret = ath12k_wmi_cmd_send(wmi, skb, WMI_BCN_TMPL_CMDID); if (ret) { - ath12k_warn(ar->ab, "failed to send WMI_BCN_TMPL_CMDID\n"); + ath12k_warn(ab, "failed to send WMI_BCN_TMPL_CMDID\n"); dev_kfree_skb(skb); } From patchwork Mon Dec 23 16:21:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13919156 X-Patchwork-Delegate: quic_jjohnson@quicinc.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 730E21C54A4; Mon, 23 Dec 2024 16:22:02 +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=1734970924; cv=none; b=rK+gL9tR8sibbjMxPRuiUMOPO/kvq2qIJr2xbvU0aHXPMLMRCaj1I8ojYimg4eBhwVcoy/a0ItJgMlWFUMFaVS1y0D1ojgxKrZM5YQBFEmT/VsaceDMyi2HJ39iDqfQ90kUIawXD+pUoHNQlElSSKxX5G3E4ri3fvjZYVysDWLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970924; c=relaxed/simple; bh=Q4Zn9Tc2or5sQeV7bU0GK7FKVS6Fsl6KbiN9kdkzQrI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=oykd5urzuxVSP23y0PDhyT29zddcFfNG4v/FKEwIpo9LHGF+MUAxeR0vbjZbizfm0CBnBkyL2SpiocdgJ0pDwwemYUmaHPo2BzjwkFvPklDJe4rHWhPrWN2dTmhYlKg9TCUyAugRZOqvoD5Jm3JfX9aaVYEXjsCkg3nIwGpFoOw= 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=eYd2GYxs; 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="eYd2GYxs" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BNBgeP4025279; Mon, 23 Dec 2024 16:21:56 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= m4LH3u2csEVYMvumO2dpdbOmUHBzlaSzLqwCcCPqEFA=; b=eYd2GYxseyOccO5y olDpA67kmBAfMqHIB3lpWUsDLV64MlEpbNEm0NGdWoX9flLSvUs+YD1enq4q4o0a T97ZQBju/mXSof1yXCthNVAMuQ9PPelCiBtfV/51sCGB4beRbPpm4fs4nytTXv0c qr/96wa4xxcLVKNi3tDtY6RnUr4sRk2XMx22blRXPBNaowV20B/06HFMDKU25vUi re7OFApPJJgXHpQvPz8M3pn+SBu377WVCrKBmkeOwHtVWy6IZfi8phARvqEaM0bK e5xS1udgWGkTc6iAkOMvavjcYtBipuNoyejaG2tFvoyI19f79hVh02key5QfHA08 ogJNtw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43q77rh23m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:56 +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 4BNGLtJS011400 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:55 GMT Received: from hu-adisi-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, 23 Dec 2024 08:21:53 -0800 From: Aditya Kumar Singh Date: Mon, 23 Dec 2024 21:51:38 +0530 Subject: [PATCH 3/4] wifi: ath12k: update the latest CSA counter Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241223-ath12k_mlo_csa-v1-3-78b6d7515568@quicinc.com> References: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> In-Reply-To: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> To: Kalle Valo , Jeff Johnson CC: , , , Aditya Kumar Singh X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: IZ_6088-tyEmXbGOw7yAsKXlRgKrCJ0C X-Proofpoint-ORIG-GUID: IZ_6088-tyEmXbGOw7yAsKXlRgKrCJ0C 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 malwarescore=0 spamscore=0 bulkscore=0 impostorscore=0 mlxscore=0 adultscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230145 At present, the driver configures the firmware to send the Channel Switch (CS) count event only when the count reaches zero during a Channel Switch Announcement (CSA). For frames managed by the upper layer, where the driver does not update the counter, the CS count in these frames remains unchanged throughout the entire CSA period. This is because the upper layer is not aware of the latest ongoing count. Indicating same count value throughout the CSA time is wrong and could lead to connection instabilities. Fix this by configuring firmware to send CS count event for every count and then accordingly decrementing the count in mac80211. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/wmi.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index ff973372a01a85bede15fde72bbe7db99bcfb300..99f6dc2fbbe3d0aa71ab96e500cfaa8e4bf9930f 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1933,6 +1933,7 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, cpu_to_le32(offs->cntdwn_counter_offs[0]); cmd->ext_csa_switch_count_offset = cpu_to_le32(offs->cntdwn_counter_offs[1]); + cmd->csa_event_bitmap = cpu_to_le32(0xFFFFFFFF); } cmd->buf_len = cpu_to_le32(bcn->len); @@ -6876,17 +6877,15 @@ ath12k_wmi_process_csa_switch_count_event(struct ath12k_base *ab, const struct ath12k_wmi_pdev_csa_event *ev, const u32 *vdev_ids) { - int i; + u32 current_switch_count = le32_to_cpu(ev->current_switch_count); + u32 num_vdevs = le32_to_cpu(ev->num_vdevs); struct ieee80211_bss_conf *conf; struct ath12k_link_vif *arvif; struct ath12k_vif *ahvif; - - /* Finish CSA once the switch count becomes NULL */ - if (ev->current_switch_count) - return; + int i; rcu_read_lock(); - for (i = 0; i < le32_to_cpu(ev->num_vdevs); i++) { + for (i = 0; i < num_vdevs; i++) { arvif = ath12k_mac_get_arvif_by_vdev_id(ab, vdev_ids[i]); if (!arvif) { @@ -6909,8 +6908,14 @@ ath12k_wmi_process_csa_switch_count_event(struct ath12k_base *ab, continue; } - if (arvif->is_up && conf->csa_active) - ieee80211_csa_finish(ahvif->vif, 0); + if (!arvif->is_up || !conf->csa_active) + continue; + + /* Finish CSA when counter reaches zero */ + if (!current_switch_count) + ieee80211_csa_finish(ahvif->vif, arvif->link_id); + else if (current_switch_count > 1) + ieee80211_beacon_update_cntdwn(ahvif->vif, arvif->link_id); } rcu_read_unlock(); } From patchwork Mon Dec 23 16:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13919157 X-Patchwork-Delegate: quic_jjohnson@quicinc.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 CD1D61C5CD6; Mon, 23 Dec 2024 16:22:03 +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=1734970925; cv=none; b=HrW0i7Z9Gp+1tlm7ct6UOfdJtUbC3WAxakSkgIYuCm9muWPSbd77PIaVAA+xY+lAs1awpSGpe4Ay0FeUYeRAt1Vw/qc0FrIjpq9ovjgaweKOhaNE8N7y2hsD+jUt+K8sCiG6pQIz3ymB1ZVgc/8nz6if05Gvx7I7mZpamId8RHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734970925; c=relaxed/simple; bh=70w7R33lXSSzqb9MRpqnWrVZzFp/qKw931lPuyMjbeI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rwTt/NaEQ7RfAoXofWLI+v1toyTHcGmFFt1j7v6spdXmdA4OnIE9GVUtMMd+wxDKuYyK5k5ufPCWGHEzIrcuGQNlZhQt5R2dURreNqTyt0dEl4xBhvGiJZG3xdl6AX69Zq2pFMMg9Qpe/9QJGWZ1hngFhVrxt/uCJ/yTHsI36wA= 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=jtVnve3B; 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="jtVnve3B" 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 4BNCahNG004009; Mon, 23 Dec 2024 16:21:59 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= L6uYF29f9et72+SEQzet3hQ1OKO/acLLyHYfWfsblww=; b=jtVnve3BM1ARwz3/ 0bPVTtyAFNXMPRrRD9fJid42XDYEwi3rfvHlc6kDcTI8iN4eZSFYq/cZFM/Lj3LM phGo5auGudjfBUc4Q6Al8wbS+/D0xIW1dCtD86hIFE0y/k7gMF/keJAJ7ZGM887t icSIOd3Fik5RKD48JHEaU4ms7rkhtVd7N69WOlmPXKl9SAOrZADsmpeBGSbM4pD2 qLm8us2H9C8vEf3P8TTqq0WHhx3cgw6uPctJI+JE0Tb8kripD6LUL8ZNEsdO7yRR Kem5yhKGDf56bkZtcYwJXmNgP1e2S5Rx+LC/iKNXwduUZ9vZu3ird6frMMafkmr9 c1bnbg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43q8168vp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:58 +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 4BNGLvPA011415 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 16:21:57 GMT Received: from hu-adisi-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, 23 Dec 2024 08:21:55 -0800 From: Aditya Kumar Singh Date: Mon, 23 Dec 2024 21:51:39 +0530 Subject: [PATCH 4/4] wifi: ath12k: prevent CSA counter to reach 0 and hit WARN_ON_ONCE Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241223-ath12k_mlo_csa-v1-4-78b6d7515568@quicinc.com> References: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> In-Reply-To: <20241223-ath12k_mlo_csa-v1-0-78b6d7515568@quicinc.com> To: Kalle Valo , Jeff Johnson CC: , , , Aditya Kumar Singh X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: jBGF_yed_wbkBG75ybDcTSMCFkcdY8VN X-Proofpoint-GUID: jBGF_yed_wbkBG75ybDcTSMCFkcdY8VN 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 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 mlxscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230146 Currently, when the driver receives a channel switch count WMI event from the firmware with a count greater than 1, it calls ieee80211_beacon_update_cntdwn(). If the beacon transmission fails, the event will be received again with the previous count value. In this scenario, the host decrements the mac80211 counter again, causing it to move ahead of the firmware counter. Ultimately, when the firmware count reaches 1, the mac80211 counter will reach zero, triggering a WARN_ON_ONCE(). Therefore, there is a need to check the count value in the event. Hence to fix this, maintain the current ongoing counter in arvif. If the count in the event does not match the expected value, silently discard the event. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.h | 2 ++ drivers/net/wireless/ath/ath12k/wmi.c | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index b789b375b891c87a4c00374ba81ea12ef0f994f9..61f07d378aaa9676385bcb0b597170ad20febbe3 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -298,6 +298,8 @@ struct ath12k_link_vif { u8 link_id; struct ath12k_vif *ahvif; struct ath12k_rekey_data rekey_data; + + u8 current_cntdown_counter; }; struct ath12k_vif { diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 99f6dc2fbbe3d0aa71ab96e500cfaa8e4bf9930f..d0f328fc9f379cacd1c3beeaeb64a025f2fcef06 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1934,6 +1934,7 @@ int ath12k_wmi_bcn_tmpl(struct ath12k_link_vif *arvif, cmd->ext_csa_switch_count_offset = cpu_to_le32(offs->cntdwn_counter_offs[1]); cmd->csa_event_bitmap = cpu_to_le32(0xFFFFFFFF); + arvif->current_cntdown_counter = bcn->data[offs->cntdwn_counter_offs[0]]; } cmd->buf_len = cpu_to_le32(bcn->len); @@ -6912,10 +6913,22 @@ ath12k_wmi_process_csa_switch_count_event(struct ath12k_base *ab, continue; /* Finish CSA when counter reaches zero */ - if (!current_switch_count) + if (!current_switch_count) { ieee80211_csa_finish(ahvif->vif, arvif->link_id); - else if (current_switch_count > 1) - ieee80211_beacon_update_cntdwn(ahvif->vif, arvif->link_id); + arvif->current_cntdown_counter = 0; + } else if (current_switch_count > 1) { + /* If the count in event is not what we expect, don't update the + * mac80211 count. Since during beacon Tx failure, count in the + * firmware will not decrement and this event will come with the + * previous count value again + */ + if (current_switch_count != arvif->current_cntdown_counter) + continue; + + arvif->current_cntdown_counter = + ieee80211_beacon_update_cntdwn(ahvif->vif, + arvif->link_id); + } } rcu_read_unlock(); }