Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp929408lql; Tue, 12 Mar 2024 02:14:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYZF8229/7yJs8uNGT0ggJvtbfAufor2Uaz2sSv5tsoWY2bBfrxqpnx0T0ErOJi5HteF3ilgPoLITIaJb90khd0F+IyDQTmTdDD/gGCw== X-Google-Smtp-Source: AGHT+IH0+r04LAi8NcdNTZqJj0hJx4lZpHpJOptwbDYVMXR5l5TBiS9Ssdmd23ny7hqVtTmJZo9y X-Received: by 2002:a05:6358:75a2:b0:17e:6a4c:e96d with SMTP id x34-20020a05635875a200b0017e6a4ce96dmr3969454rwf.30.1710234859297; Tue, 12 Mar 2024 02:14:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710234859; cv=pass; d=google.com; s=arc-20160816; b=yuIp8Gm9KqkapF926QlWpbLAQUTe4ljG5RR4vSQ0kpIDl1yrXhN/6UYoRuCODCNcP4 /1CKm96LZRKpYnFZ3BkFtH8Memm//XC8j3pn79v9LVxzYlF0+GFXjvZGV05IUNLL8qRc 6WAxyD+rclgBc80219JqaO8D7CDTx2i+ph1Ib1YR7TEUXGEVTECP3HDodffsMBmU8GPx oDwcMhLjHQj1Ja/rNrqoE7n6RcT6PvPESHHHh6NQmUtHgDaIZ6SgIqnnh3pHTS0pWb0Z FwhZ8wuCHrVyRqlmzG560SWlFRYFghMENR23Ze2y+sGs9vbkED8ZV3omfYudatlp0G81 bQHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=X2da5FMJB4EIPg9LTpbxDKx7c28kqgLmjTeHq8PP9oY=; fh=AbPIYUmLJBwTg11YE+PxpxKzNq+ErB2KX7qIU43oOA8=; b=KvzY0jJ0jYqLq9Yjm5Q7nl1i7YqscbaWVi+VK5kmekAnknG4hCtN2F5owLKmHt6WCp uca8saMvCBCKkoZ/2Se0MjM57zkcZ2oWST+/dNwA8SsYjK0Y0EjVID6EsG1n4H1Stj9t ZGyU18KW4kLmU6KcqhHo9pWd9yKqdg7P549PzEM4WD8meSP+z26kHLOHJrR1WAUmxvS6 EukQL09kcLXyaTkgySh03MAyLI/ovYZYPoOfb2zE96Pd3WMPZqURhdtYmg/npBD8KgBw +giaRvcUsZ14WU5azH+BOLqBEvXdJjyFgHiBHPz7BzByA48ys0mC3iE4UO8qdk2Vueuq tdEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FCyNwPZK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4599-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m186-20020a6326c3000000b005b95ee3edc6si6663370pgm.628.2024.03.12.02.14.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FCyNwPZK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4599-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4599-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 615B12842D5 for ; Tue, 12 Mar 2024 09:05:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 586557826D; Tue, 12 Mar 2024 09:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FCyNwPZK" X-Original-To: linux-wireless@vger.kernel.org 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 A49E978669 for ; Tue, 12 Mar 2024 09:04:38 +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=1710234280; cv=none; b=Qq0mAKMBEgLf1Ka5M4piMNGD8fu35eV7WBkxk4zHbhwhRfS5s+u2aSZApUXK1hy4Grn1G945ckKzp4iDoFc168QNRg6Yoq8Hi9wOrRpOHG+J6gcdX1tHSfklh1TjpMRhmJgWXNZZQ9kL+bhFlwJCGjjHsvxVlc05jiTSjWjv3rM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710234280; c=relaxed/simple; bh=t2IDIOKKTnB+tUXhOLCDU3leIoUtyjzk3Xy1QXgrv4w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WPD0/DvjQraoC9gGP+i8bK1TPdZ4oKrdRcozcM4/1WGNgMngzyWEdBZx+FKHe18ACLME7UklLrC/lyU3XQHw0TPxvJZX4fdTURF4ysj/hakSb0oK64YXk+gktBL32mYKlFqv7yJdx66mD9CfQp+7MqweBm42lMmiX62RoSuMdSs= 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=FCyNwPZK; 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 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42C4oN6k016181; Tue, 12 Mar 2024 09:04:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=X2da5FMJB4EIPg9LTpbxDKx7c28kqgLmjTeHq8PP9oY=; b=FC yNwPZKJxyrvq/mhyjxz79B02rxwgsoatRCTuXIceWmSx7sgmhAVrUjvYxJPamwc6 5hZ5VBhNTyAw7/xbuTmXvo6XdqXIGU/3gfFsp9M/bCRMZNhsY1Q0d4nIpB+LZGZP Ugj6/aGp1QAdf1yzRDcxf6Wn4tx6CsyanzBuItea2Wgdm9Eb02FeTjoHjwJDqDe8 D5n9JL2t6NYVxxFirEaviFSmcn8jOJ1Dz0UkrRPflHZXqiiSKgkc4lk7zENLZ0Vn wGOisKONKXfOw2/HpBcmu1dWyDG7JgkPZ4FGvPgBuu8FlNsphI64ZHS46m4SYB3d 9evzxi1y5fO2fi8Vjhnw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wtgc3gej2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:36 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42C94ZdK013497 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:35 GMT Received: from hu-ramess-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.1118.40; Tue, 12 Mar 2024 02:04:33 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R Subject: [PATCH v3 08/12] wifi: ath12k: Add additional checks for vif and sta iterators Date: Tue, 12 Mar 2024 14:33:47 +0530 Message-ID: <20240312090351.1620218-9-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312090351.1620218-1-quic_ramess@quicinc.com> References: <20240312090351.1620218-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: pUxRppZ0FEyl5WRjYjLTSCgXLtM0P4ds X-Proofpoint-GUID: pUxRppZ0FEyl5WRjYjLTSCgXLtM0P4ds X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-12_08,2024-03-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 bulkscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=758 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403120070 From: Sriram R Since vif and sta objects of different radios are added to same local hw list in mac80211, additional checks need to be done in driver to ensure we are processing the intended vif and sta corresponding to the radio when the vif and sta mac80211 iterator utils are used from driver. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/mac.c | 22 ++++++++++++++++++++-- drivers/net/wireless/ath/ath12k/p2p.c | 3 ++- drivers/net/wireless/ath/ath12k/p2p.h | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index fe151aa90687..4b21e7bcec3f 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -291,6 +291,7 @@ struct ath12k_vif { struct ath12k_vif_iter { u32 vdev_id; + struct ath12k *ar; struct ath12k_vif *arvif; }; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index fab92f08fdb7..a77d6dbaea46 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -533,7 +533,8 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac, struct ath12k_vif_iter *arvif_iter = data; struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); - if (arvif->vdev_id == arvif_iter->vdev_id) + if (arvif->vdev_id == arvif_iter->vdev_id && + arvif->ar == arvif_iter->ar) arvif_iter->arvif = arvif; } @@ -543,6 +544,7 @@ struct ath12k_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id) u32 flags; arvif_iter.vdev_id = vdev_id; + arvif_iter.ar = ar; flags = IEEE80211_IFACE_ITER_RESUME_ALL; ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar), @@ -6818,14 +6820,19 @@ struct ath12k_mac_change_chanctx_arg { struct ieee80211_vif_chanctx_switch *vifs; int n_vifs; int next_vif; + struct ath12k *ar; }; static void ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, struct ieee80211_vif *vif) { + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_mac_change_chanctx_arg *arg = data; + if (arvif->ar != arg->ar) + return; + if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) return; @@ -6836,9 +6843,13 @@ static void ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac, struct ieee80211_vif *vif) { + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_mac_change_chanctx_arg *arg = data; struct ieee80211_chanctx_conf *ctx; + if (arvif->ar != arg->ar) + return; + ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); if (ctx != arg->ctx) return; @@ -6957,7 +6968,7 @@ static void ath12k_mac_update_active_vif_chan(struct ath12k *ar, struct ieee80211_chanctx_conf *ctx) { - struct ath12k_mac_change_chanctx_arg arg = { .ctx = ctx }; + struct ath12k_mac_change_chanctx_arg arg = { .ctx = ctx, .ar = ar }; struct ieee80211_hw *hw = ath12k_ar_to_hw(ar); lockdep_assert_held(&ar->conf_mutex); @@ -7533,6 +7544,9 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data, struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); struct ath12k *ar = arvif->ar; + if (arsta->arvif != arvif) + return; + spin_lock_bh(&ar->data_lock); arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; spin_unlock_bh(&ar->data_lock); @@ -7543,10 +7557,14 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data, static void ath12k_mac_disable_peer_fixed_rate(void *data, struct ieee80211_sta *sta) { + struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); struct ath12k_vif *arvif = data; struct ath12k *ar = arvif->ar; int ret; + if (arsta->arvif != arvif) + return; + ret = ath12k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, WMI_PEER_PARAM_FIXED_RATE, diff --git a/drivers/net/wireless/ath/ath12k/p2p.c b/drivers/net/wireless/ath/ath12k/p2p.c index d334df720032..3a851ee15b2f 100644 --- a/drivers/net/wireless/ath/ath12k/p2p.c +++ b/drivers/net/wireless/ath/ath12k/p2p.c @@ -121,7 +121,7 @@ static void ath12k_p2p_noa_update_vdev_iter(void *data, u8 *mac, struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_p2p_noa_arg *arg = data; - if (arvif->vdev_id != arg->vdev_id) + if (arvif->ar != arg->ar || arvif->vdev_id != arg->vdev_id) return; ath12k_p2p_noa_update(arvif, arg->noa); @@ -132,6 +132,7 @@ void ath12k_p2p_noa_update_by_vdev_id(struct ath12k *ar, u32 vdev_id, { struct ath12k_p2p_noa_arg arg = { .vdev_id = vdev_id, + .ar = ar, .noa = noa, }; diff --git a/drivers/net/wireless/ath/ath12k/p2p.h b/drivers/net/wireless/ath/ath12k/p2p.h index 5768139a7844..b2eec51a9900 100644 --- a/drivers/net/wireless/ath/ath12k/p2p.h +++ b/drivers/net/wireless/ath/ath12k/p2p.h @@ -12,6 +12,7 @@ struct ath12k_wmi_p2p_noa_info; struct ath12k_p2p_noa_arg { u32 vdev_id; + struct ath12k *ar; const struct ath12k_wmi_p2p_noa_info *noa; }; -- 2.25.1