From patchwork Wed Jun 19 04:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 805955 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 B7E282A8D3 for ; Wed, 19 Jun 2024 04:10:32 +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=1718770234; cv=none; b=SGABneuGgVP7ahtnhSzsXV5ZQzEntOratnRaYuO0pO+77+FWAzAaH2Db+uz5TtPFFl69egU6kErMjJrBuPc1nWYRNOGvonIVGSNaEiwhCORLWR/ImbixAPoXTZnEw7MHWNeCVZm/nBpu843SBFzj4tQjJMbUDsQJXX0umzn9J8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770234; c=relaxed/simple; bh=OsbiQ4rdeloGebk25SCZ+C6ln2uSEIhbWS9P3eR+QaU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aiq7uH0T20noFPKgMLW/Ja/m60T6ztoPOiE6UMbOi1CG1lZuxXu0OvQ8wMRDFiHz5ZGQ2bXUr5Ydc2scWJTGVUTDEAJt+HxbLb5pniNm35XdweSxwNfIhKT+3l5LlDg+boDkFn0HcjfRLoJN7FvXokqBDEFaxfTbcbZfN+K+Nxs= 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=Jo0AOngK; 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="Jo0AOngK" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45J1CHR1007598; Wed, 19 Jun 2024 04:10:28 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= yqH+cDG/lNIyc/ZNGQQqdZObRgM6U4U7+xwXCAtPSII=; b=Jo0AOngKieTy6Po8 p1+vp3to0RS6T/jFXU/zkk7H6jEc1Y/pM9ZlEORr6UFvl/IAOs5+yex1PsHFiPQU OXxCbf1PRNDCkz9LYEtKyzfrzuISolyOrmpw8i+Ns8dv+WULVF9n6jp8Z3i+03L1 cT25/+FWhmx3istxgOEQL3rhqQNqxTryODzqlh12PicZwa5DwHUceqejYY/nUzx9 bFtSYge8LVN50gWsKg0prSkdvk5eyUKj2oYSIrPtr1mRCsjXIVtAbJd6Y9sRXWgC JVo3ukJnnx1b/n6MVh6rBmpZ7E61yJykSA3A4mHkp1sX2xu4uxNFWuLlUDfDAGNL ctbD5g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9x0kg5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:28 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4ARr5013292 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:27 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; Tue, 18 Jun 2024 21:10:26 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 1/9] Revert "wifi: mac80211: move radar detect work to sdata" Date: Wed, 19 Jun 2024 09:39:51 +0530 Message-ID: <20240619040959.1457547-2-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: sMv1IncwE7AQdL6-scZFpjv2YhPwAx6i X-Proofpoint-GUID: sMv1IncwE7AQdL6-scZFpjv2YhPwAx6i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 This reverts commit ce9e660ef32e87441bf59b04f67a24113e82546a. To enable radar detection with MLO, it’s essential to handle it on a per-link basis. This is because when using MLO, multiple links may already be active and beaconing. In this scenario, another link should be able to initiate a radar detection. Also, if underlying links are associated with different hardware devices but grouped together for MLO, they could potentially start radar detection simultaneously. Therefore, it makes sense to manage radar detection settings separately for each link by moving them back to a per-link data structure. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 6 +++--- net/mac80211/ieee80211_i.h | 3 +-- net/mac80211/iface.c | 4 +--- net/mac80211/link.c | 2 ++ net/mac80211/mlme.c | 9 +++++---- net/mac80211/util.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 3236477424b8..6fba3203401b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1671,7 +1671,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, if (sdata->wdev.cac_started) { chandef = link_conf->chanreq.oper; - wiphy_delayed_work_cancel(wiphy, &sdata->dfs_cac_timer_work); + wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); @@ -3489,7 +3489,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, if (err) goto out_unlock; - wiphy_delayed_work_queue(wiphy, &sdata->dfs_cac_timer_work, + wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, msecs_to_jiffies(cac_time_ms)); out_unlock: @@ -3506,7 +3506,7 @@ static void ieee80211_end_cac(struct wiphy *wiphy, list_for_each_entry(sdata, &local->interfaces, list) { wiphy_delayed_work_cancel(wiphy, - &sdata->dfs_cac_timer_work); + &sdata->deflink.dfs_cac_timer_work); if (sdata->wdev.cac_started) { ieee80211_link_release_channel(&sdata->deflink); diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 3e735c9436d3..4af0f9bd434d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1067,6 +1067,7 @@ struct ieee80211_link_data { int ap_power_level; /* in dBm */ bool radar_required; + struct wiphy_delayed_work dfs_cac_timer_work; union { struct ieee80211_link_data_managed mgd; @@ -1165,8 +1166,6 @@ struct ieee80211_sub_if_data { struct ieee80211_link_data deflink; struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; - struct wiphy_delayed_work dfs_cac_timer_work; - /* for ieee80211_set_active_links_async() */ struct wiphy_work activate_links_work; u16 desired_active_links; diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 6b7580c61e0c..bee9268b624c 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -554,7 +554,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.color_change_finalize_work); wiphy_delayed_work_cancel(local->hw.wiphy, - &sdata->dfs_cac_timer_work); + &sdata->deflink.dfs_cac_timer_work); if (sdata->wdev.cac_started) { chandef = sdata->vif.bss_conf.chanreq.oper; @@ -1731,8 +1731,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, wiphy_work_init(&sdata->work, ieee80211_iface_work); wiphy_work_init(&sdata->activate_links_work, ieee80211_activate_links_work); - wiphy_delayed_work_init(&sdata->dfs_cac_timer_work, - ieee80211_dfs_cac_timer_work); switch (type) { case NL80211_IFTYPE_P2P_GO: diff --git a/net/mac80211/link.c b/net/mac80211/link.c index 2e6e92defbca..8871cc1a0454 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -45,6 +45,8 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata, ieee80211_color_collision_detection_work); INIT_LIST_HEAD(&link->assigned_chanctx_list); INIT_LIST_HEAD(&link->reserved_chanctx_list); + wiphy_delayed_work_init(&link->dfs_cac_timer_work, + ieee80211_dfs_cac_timer_work); if (!deflink) { switch (sdata->vif.type) { diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ef3280fafbe9..fb49005074c8 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3010,15 +3010,16 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t) void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) { - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, + struct ieee80211_link_data *link = + container_of(work, struct ieee80211_link_data, dfs_cac_timer_work.work); - struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chanreq.oper; + struct cfg80211_chan_def chandef = link->conf->chanreq.oper; + struct ieee80211_sub_if_data *sdata = link->sdata; lockdep_assert_wiphy(sdata->local->hw.wiphy); if (sdata->wdev.cac_started) { - ieee80211_link_release_channel(&sdata->deflink); + ieee80211_link_release_channel(link); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index c73ff7dfbdba..a914a5804841 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3458,7 +3458,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) list_for_each_entry(sdata, &local->interfaces, list) { wiphy_delayed_work_cancel(local->hw.wiphy, - &sdata->dfs_cac_timer_work); + &sdata->deflink.dfs_cac_timer_work); if (sdata->wdev.cac_started) { chandef = sdata->vif.bss_conf.chanreq.oper; From patchwork Wed Jun 19 04:09:52 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: 806311 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 4F41450280 for ; Wed, 19 Jun 2024 04:10:34 +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=1718770236; cv=none; b=RUEyx9IhmPogSiAYr99W6FwA1NGjbB++PSqgMZir/x6KdgsoMNxfzwjwqEyxJnQ8QvU7DAGP7PTq7Fd1bLuU5YbELMA4VhPNnWPUajt0z+qFNzyRKuMCTHcqkCE3ViuLNqh3wquXoXOph14h2uqPAam8eOgr7fryan+laDPtxms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770236; c=relaxed/simple; bh=f6nvnxC3j1b4WH7sofifFmrsavEHcGDNVsUKAiR7wq8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qnw82JQxcl7y07KBcjLJozONuWhhv3q53qYy3IuKeKqMi8tj7c9oYy19mhwkvQlWAFtJuuD56GZv4DIX75xgGupDtDTROffDKgKDu0oqIwMCPSvZ6oSdjSYZvSLQoaVdZeNXuf59d1kpX04JJfnTOUsKoSWJHKw1NlQlrJdNO6Y= 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=nVh+HajX; 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="nVh+HajX" 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 45ILaD53027004; Wed, 19 Jun 2024 04:10:30 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= JknEIT25Th065qnzTUQXimKBuvx6XYOFHOn/ovtDbag=; b=nVh+HajXiqciZJI0 LTC+FdQ1O/Gyww8QI2xtfzqPJcDlKCABZpdXtNwMRCpj4Rm8uKpv42VfjJDRsmZp MWSnU0MaZVz8kJS882H+DTVo9BcfF+67H/BAXNRMyPrXBY3E4EbPYwITd9laHJbe F2yz3djbnxzgJ1ppBCcvI+3uLqZfk7gnM2WJ0FEqI51OJVkj+ZkbDBXCwjuYPqkR MZUinNfXRJHdvjrXlkYJae0KakKCK1VYvFAhYZZXPQY/Pp+o7WCA0scwMsthZJPz XgXJ14YN5+/GiKtTfbMmBC0aNqjk7TDljIl2oPvyZ2nQ4HwDVdmLWQBYN0ybJ5DC iNFRvg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9yrktf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:30 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4ATYK013315 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:29 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; Tue, 18 Jun 2024 21:10:28 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 2/9] wifi: cfg80211: move DFS related members to links[] in wireless_dev Date: Wed, 19 Jun 2024 09:39:52 +0530 Message-ID: <20240619040959.1457547-3-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: pDm971zlNhxm02GbqSjs0mLHBcoyYKcu X-Proofpoint-GUID: pDm971zlNhxm02GbqSjs0mLHBcoyYKcu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 clxscore=1015 bulkscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 A few members related to DFS handling are currently under per wireless device data structure. However, in order to support DFS with MLO, there is a need to have them on a per-link manner. Hence, as a preliminary step, move members cac_started, cac_start_time and cac_time_ms to be on a per-link basis. Since currently, link ID is not known at all places, use default value of 0 for now. If link ID is available, use that instead is such places. Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/marvell/mwifiex/11h.c | 4 ++-- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++-- drivers/net/wireless/quantenna/qtnfmac/event.c | 6 +++--- include/net/cfg80211.h | 17 +++++++++-------- net/mac80211/cfg.c | 8 ++++---- net/mac80211/iface.c | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/scan.c | 2 +- net/mac80211/util.c | 2 +- net/wireless/ibss.c | 2 +- net/wireless/mesh.c | 2 +- net/wireless/mlme.c | 11 ++++++----- net/wireless/nl80211.c | 10 +++++----- net/wireless/reg.c | 2 +- 14 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c index b90f922f1cdc..fb2cad096758 100644 --- a/drivers/net/wireless/marvell/mwifiex/11h.c +++ b/drivers/net/wireless/marvell/mwifiex/11h.c @@ -117,7 +117,7 @@ void mwifiex_dfs_cac_work_queue(struct work_struct *work) dfs_cac_work); chandef = priv->dfs_chandef; - if (priv->wdev.cac_started) { + if (priv->wdev.links[0].cac_started) { mwifiex_dbg(priv->adapter, MSG, "CAC timer finished; No radar detected\n"); cfg80211_cac_event(priv->netdev, &chandef, @@ -174,7 +174,7 @@ int mwifiex_stop_radar_detection(struct mwifiex_private *priv, */ void mwifiex_abort_cac(struct mwifiex_private *priv) { - if (priv->wdev.cac_started) { + if (priv->wdev.links[0].cac_started) { if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef)) mwifiex_dbg(priv->adapter, ERROR, "failed to stop CAC in FW\n"); diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 155eb0fab12a..3880fe7384e1 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1880,7 +1880,7 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, struct mwifiex_sta_node *sta_node; u8 deauth_mac[ETH_ALEN]; - if (!priv->bss_started && priv->wdev.cac_started) { + if (!priv->bss_started && priv->wdev.links[0].cac_started) { mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); mwifiex_abort_cac(priv); } @@ -3978,7 +3978,7 @@ mwifiex_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, return -EBUSY; } - if (priv->wdev.cac_started) + if (priv->wdev.links[0].cac_started) return -EBUSY; if (cfg80211_chandef_identical(¶ms->chandef, diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 76b07db284f8..8bd1e14e5de9 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -520,21 +520,21 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif, cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); break; case QLINK_RADAR_CAC_FINISHED: - if (!vif->wdev.cac_started) + if (!vif->wdev.links[0].cac_started) break; cfg80211_cac_event(vif->netdev, &chandef, NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); break; case QLINK_RADAR_CAC_ABORTED: - if (!vif->wdev.cac_started) + if (!vif->wdev.links[0].cac_started) break; cfg80211_cac_event(vif->netdev, &chandef, NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); break; case QLINK_RADAR_CAC_STARTED: - if (vif->wdev.cac_started) + if (vif->wdev.links[0].cac_started) break; if (!wiphy_ext_feature_isset(wiphy, diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 6f992aff74ae..d03d525de4d3 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -6149,9 +6149,6 @@ enum ieee80211_ap_reg_power { * @address: The address for this device, valid only if @netdev is %NULL * @is_running: true if this is a non-netdev device that has been started, e.g. * the P2P Device. - * @cac_started: true if DFS channel availability check has been started - * @cac_start_time: timestamp (jiffies) when the dfs state was entered. - * @cac_time_ms: CAC time in ms * @ps: powersave mode is enabled * @ps_timeout: dynamic powersave timeout * @ap_unexpected_nlportid: (private) netlink port ID of application @@ -6175,6 +6172,11 @@ enum ieee80211_ap_reg_power { * unprotected beacon report * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr * @ap and @client for each link + * @links[].cac_started: true if DFS channel availability check has been + * started + * @links[].cac_start_time: timestamp (jiffies) when the dfs state was + * entered. + * @links[].cac_time_ms: CAC time in ms * @valid_links: bitmap describing what elements of @links are valid */ struct wireless_dev { @@ -6216,11 +6218,6 @@ struct wireless_dev { u32 owner_nlportid; bool nl_owner_dead; - /* FIXME: need to rework radar detection for MLO */ - bool cac_started; - unsigned long cac_start_time; - unsigned int cac_time_ms; - #ifdef CONFIG_CFG80211_WEXT /* wext data */ struct { @@ -6287,6 +6284,10 @@ struct wireless_dev { struct cfg80211_internal_bss *current_bss; } client; }; + + bool cac_started; + unsigned long cac_start_time; + unsigned int cac_time_ms; } links[IEEE80211_MLD_MAX_NUM_LINKS]; u16 valid_links; }; diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 6fba3203401b..a75b11071373 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1669,7 +1669,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, ieee80211_link_info_change_notify(sdata, link, BSS_CHANGED_BEACON_ENABLED); - if (sdata->wdev.cac_started) { + if (sdata->wdev.links[link_id].cac_started) { chandef = link_conf->chanreq.oper; wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); cfg80211_cac_event(sdata->dev, &chandef, @@ -3508,9 +3508,9 @@ static void ieee80211_end_cac(struct wiphy *wiphy, wiphy_delayed_work_cancel(wiphy, &sdata->deflink.dfs_cac_timer_work); - if (sdata->wdev.cac_started) { + if (sdata->wdev.links[0].cac_started) { ieee80211_link_release_channel(&sdata->deflink); - sdata->wdev.cac_started = false; + sdata->wdev.links[0].cac_started = false; } } } @@ -3969,7 +3969,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, if (!list_empty(&local->roc_list) || local->scanning) return -EBUSY; - if (sdata->wdev.cac_started) + if (sdata->wdev.links[link_id].cac_started) return -EBUSY; if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index bee9268b624c..9d13425d923f 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -556,7 +556,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do wiphy_delayed_work_cancel(local->hw.wiphy, &sdata->deflink.dfs_cac_timer_work); - if (sdata->wdev.cac_started) { + if (sdata->wdev.links[0].cac_started) { chandef = sdata->vif.bss_conf.chanreq.oper; WARN_ON(local->suspended); ieee80211_link_release_channel(&sdata->deflink); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index fb49005074c8..f7c20b6962f7 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3018,7 +3018,7 @@ void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) lockdep_assert_wiphy(sdata->local->hw.wiphy); - if (sdata->wdev.cac_started) { + if (sdata->wdev.links[link->link_id].cac_started) { ieee80211_link_release_channel(link); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_FINISHED, diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 8ecc4b710b0e..e79b07349b49 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -584,7 +584,7 @@ static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata) return false; list_for_each_entry(sdata_iter, &local->interfaces, list) { - if (sdata_iter->wdev.cac_started) + if (sdata_iter->wdev.links[0].cac_started) return false; } diff --git a/net/mac80211/util.c b/net/mac80211/util.c index a914a5804841..b03d91dfdd35 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3460,7 +3460,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) wiphy_delayed_work_cancel(local->hw.wiphy, &sdata->deflink.dfs_cac_timer_work); - if (sdata->wdev.cac_started) { + if (sdata->wdev.links[0].cac_started) { chandef = sdata->vif.bss_conf.chanreq.oper; ieee80211_link_release_channel(&sdata->deflink); cfg80211_cac_event(sdata->dev, diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 34e5acff3935..1e3ed29f7cfc 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c @@ -94,7 +94,7 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, lockdep_assert_held(&rdev->wiphy.mtx); - if (wdev->cac_started) + if (wdev->links[0].cac_started) return -EBUSY; if (wdev->u.ibss.ssid_len) diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index aaca65b66af4..2c6654075ca9 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c @@ -127,7 +127,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, if (!rdev->ops->join_mesh) return -EOPNOTSUPP; - if (wdev->cac_started) + if (wdev->links[0].cac_started) return -EBUSY; if (!setup->chandef.chan) { diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 4052041a19ea..fddd6a62b942 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -1123,13 +1123,14 @@ void cfg80211_cac_event(struct net_device *netdev, trace_cfg80211_cac_event(netdev, event); - if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED)) + if (WARN_ON(!wdev->links[0].cac_started && + event != NL80211_RADAR_CAC_STARTED)) return; switch (event) { case NL80211_RADAR_CAC_FINISHED: - timeout = wdev->cac_start_time + - msecs_to_jiffies(wdev->cac_time_ms); + timeout = wdev->links[0].cac_start_time + + msecs_to_jiffies(wdev->links[0].cac_time_ms); WARN_ON(!time_after_eq(jiffies, timeout)); cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); memcpy(&rdev->cac_done_chandef, chandef, @@ -1138,10 +1139,10 @@ void cfg80211_cac_event(struct net_device *netdev, cfg80211_sched_dfs_chan_update(rdev); fallthrough; case NL80211_RADAR_CAC_ABORTED: - wdev->cac_started = false; + wdev->links[0].cac_started = false; break; case NL80211_RADAR_CAC_STARTED: - wdev->cac_started = true; + wdev->links[0].cac_started = true; break; default: WARN_ON(1); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fcac7dedcd61..b44332dc52be 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -5970,7 +5970,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) if (!rdev->ops->start_ap) return -EOPNOTSUPP; - if (wdev->cac_started) + if (wdev->links[link_id].cac_started) return -EBUSY; if (wdev->links[link_id].ap.beacon_interval) @@ -10025,7 +10025,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, goto unlock; } - if (cfg80211_beaconing_iface_active(wdev) || wdev->cac_started) { + if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { err = -EBUSY; goto unlock; } @@ -10048,9 +10048,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); if (!err) { wdev->links[0].ap.chandef = chandef; - wdev->cac_started = true; - wdev->cac_start_time = jiffies; - wdev->cac_time_ms = cac_time_ms; + wdev->links[0].cac_started = true; + wdev->links[0].cac_start_time = jiffies; + wdev->links[0].cac_time_ms = cac_time_ms; } unlock: wiphy_unlock(wiphy); diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 4a27f3823e25..898abc6d0609 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -4241,7 +4241,7 @@ static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { struct cfg80211_chan_def *chandef; - if (!wdev->cac_started) + if (!wdev->links[0].cac_started) continue; /* FIXME: radar detection is tied to link 0 for now */ From patchwork Wed Jun 19 04:09:53 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: 805954 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 4AE0355884 for ; Wed, 19 Jun 2024 04:10:36 +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=1718770237; cv=none; b=auNMpKreHkN8E1GGvAH1kuGUy1xhnr3sXRNJEEYM+ocEZrg/ZBihkodNSwOCYS/6th61gaF+tafsexlRfHhiEHamL6NSsTIBBWgi/Nvh3vap8SB52m/3g3R2vMW72HCtHvAbFsu19GjG20vJ62h7BQ7dpAeIF4EPkB4MG5vlMuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770237; c=relaxed/simple; bh=p9VeLXrVXqZ7v2vt2XZuMm8Dj/imrcQzP0sjO5qPR7c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MNmpOu6XrO3O6fFifCxmzDxDHxnpFwIEFDD+LGFdZknB+xQrcZ8eBaza+6IpAVuYMi+hPDfn052icz7tPibz7byonFfputJWFshObBhj0ubmEBUtDSy2QAV5mzfDtfgYCuZEQimbbw4nfjyhy+1gYTeXJIWsvKBxO9zrT9vhz3k= 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=GVf03ovv; 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="GVf03ovv" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ILaK2k014853; Wed, 19 Jun 2024 04:10:32 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= pgyljzOsemmbt3W+YQVcYHcVAxp7HdhcfwGrCh8plvs=; b=GVf03ovvZUrGSasu l+Ks/h1WuIP1yZgtOj1yRnnYTsXhfCay9N3emGPXu89ekzrAVBoSQyl0FPRd9wRR uxftYXvjI5f/1+iG4DmgHCPMIcrjXxZa7Filz34yiDv/Trf7cg7CxzTh1T8N5w9q Y2Wdwx/7HQyVZFaxKQsmXxs3mpL77TVHMCZRU/CB7kxFKpX9c/YKNHCGMMBuLOxQ P+eZK8q8YlZZEqs+k2O3sGXwif1qBwj910leZnIf8CP+MzLNgSobeqNrXPRJ/uDJ t4iTVsCNl7ITqeQAo4m5yUoCS9zJLXhs0VfvvSpbcEw1CKaXe1cNMX7IxxQ4UgkV +ugXlw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9x0kg7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:32 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AV8F022842 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:31 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; Tue, 18 Jun 2024 21:10:30 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 3/9] wifi: nl80211: allow CAC while other links are beaconing during MLO Date: Wed, 19 Jun 2024 09:39:53 +0530 Message-ID: <20240619040959.1457547-4-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: rflR5LnhiFcoMA62Dr1E2WbYgQNruiFO X-Proofpoint-GUID: rflR5LnhiFcoMA62Dr1E2WbYgQNruiFO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=987 impostorscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 Currently if any of the link is beaconing, CAC can not be started. However, with MLO, it is possible that interface is beaconing already on a link that did not require CAC, but now another link is being started that does require CAC. Hence, same check does not apply to MLO. Add changes to check the link under consideration is beaconing or not in case of MLO. Signed-off-by: Aditya Kumar Singh --- net/wireless/nl80211.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b44332dc52be..7420a966997f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10025,7 +10025,20 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, goto unlock; } - if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { + if (cfg80211_beaconing_iface_active(wdev)) { + /* During MLO other link(s) can beacon, only the current link + * can not already beacon + */ + if (wdev->valid_links && + !wdev->links[0].ap.beacon_interval) { + /* nothing */ + } else { + err = -EBUSY; + goto unlock; + } + } + + if (wdev->links[0].cac_started) { err = -EBUSY; goto unlock; } From patchwork Wed Jun 19 04:09:54 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: 806310 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 70142558B6 for ; Wed, 19 Jun 2024 04:10:38 +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=1718770239; cv=none; b=utjOmtpHYRZYZYQ38I7ik65ZlPX8Nd3S9DintibMIk1aAxy7/jGwioGtoNQemyKM59e1YgI24Ym/pEe7LP7vo2UnEeTatuw3ooRNdd4K7aACmW+P9U9QwgZttvtJBXZqFObeXOFGY0HK9XNypp8l7772NqPGa+OXltl6n66BQzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770239; c=relaxed/simple; bh=zkLAkb1nTfqNgGdJtc1gUbkky9UrsB/ORpd3FP0TySs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iV7OmvQpVMflzlDCdrF0GEm2R+0Xhg5rq9YyLj+eMGmgQa+FwycaB3qGLZNwbVb/0FDae9lJWCZlgqYJVA1mDKV2OBa6evzsVUa8TuGAzK3FL8fR/V8B2VeIqbdheg2H7JG4nHbDjmc7wr/bZAYE8UMCetidv7Jls5G9f4T6UJM= 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=lpS61KPv; 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="lpS61KPv" 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 45ILaNKT001114; Wed, 19 Jun 2024 04:10:34 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= vyydDZF4diJD/3AJVLQuRvbHf/UWvXyuKC1a0l/Qgus=; b=lpS61KPvd2/xbSnp t7wYvpXuV1iJ94zeyG59xiFaQgLghg/9/L/qnp4ja005t85Xlka8uBrA9bMZcu8H KpqUP9fO6yPr5jVVNJPyDUynGExu+DURd0nQvr1sArJOIRfcdr1qKKkh5dAoG6oc snVz4NsrXtEcMqCMhAONzgdyqRnN+Az1dxqZbvcZ0kL4ugt1hUyhwUtTcCKD5Adf P4P47OWulbQqF4fB+nqiJpZaTsOaxmpcQjEkKcVb2RS6u29T6yePH1hXBD1UoVT+ o2TcwCaE837YrPrP3LwDm8nS0gU9pPscE+fIYYPd5uexhlrPKPyNtsRNoENDzA8q EomiSA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuja28kda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:34 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AXQL013158 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:33 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; Tue, 18 Jun 2024 21:10:31 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 4/9] wifi: trace: unlink rdev_end_cac trace event from wiphy_netdev_evt class Date: Wed, 19 Jun 2024 09:39:54 +0530 Message-ID: <20240619040959.1457547-5-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: wzET9Or9YS6TOYlaspcj4UPvslXB1uqE X-Proofpoint-ORIG-GUID: wzET9Or9YS6TOYlaspcj4UPvslXB1uqE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=799 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 rdev_end_cac trace event is linked with wiphy_netdev_evt event class. There is no option to pass link ID currently to wiphy_netdev_evt class. A subsequent change would pass link ID to rdev_end_cac event and hence it can no longer derive the event class from wiphy_netdev_evt. Therefore, unlink rdev_end_cac event from wiphy_netdev_evt and define it's own independent trace event. Link ID would be passed in subsequent change. Signed-off-by: Aditya Kumar Singh --- net/wireless/trace.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 5c26f065bd68..7fc7de9bcc34 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -805,9 +805,18 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa, TP_ARGS(wiphy, netdev) ); -DEFINE_EVENT(wiphy_netdev_evt, rdev_end_cac, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), - TP_ARGS(wiphy, netdev) +TRACE_EVENT(rdev_end_cac, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), + TP_ARGS(wiphy, netdev), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) ); DECLARE_EVENT_CLASS(station_add_change, From patchwork Wed Jun 19 04:09:55 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: 805953 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 B1B8255897 for ; Wed, 19 Jun 2024 04:10:40 +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=1718770242; cv=none; b=HcqMFFaxVlX3v5cUK5wjV8bvMFLZ+wtU9lUPAuwicCr8lwadXCo+GUOU1R7bzCQ6YZ7cxf0PXrv/HP14wwBNS6osoGzoUWaE5jv35g05yNH24dRUl3QrYK7OHdsTXJYYsSFXX42HoRNBlVqotZK2gTVievHBG+qKjbl0Vuua76I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770242; c=relaxed/simple; bh=Vkxg8/mB9CggHrwebi8BjVjVWGVv0NtbTTZ+RK4+XeI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Oo5vDQxjGW5Vp/3SDs0ywU4FkqJd0Y1E28J2HTR2miij1+7CYGCBMs98Piomnp4CPu3P8ZeY1SB7PY/ae07AUClmljWeZcHfm7weiyxgt0IkV/GptL8MBukd/ftb95FZonod9Vv+6ft62U4mfQ5QcbigDP7ZVe2zInjNoPHXxJ4= 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=I3Au29is; 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="I3Au29is" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ILa58g009248; Wed, 19 Jun 2024 04:10:36 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= Su2+vLT0tyrkwRP6GuRX+chmo9rqvmIXeonGX9xA3mg=; b=I3Au29is7HkE6EtM yMLa9aCmO5h2HZz0QkQWjMH3pWqJTYhKTpd6sQeMQ0Cc4iY3g11+P4Q3ympcTXEv WQ/1iJlinv6Xz4xXS+tPzkmmhVfrzAabzjwF9HmOmH4WxSxIscl19UwymxUPvemt QRvhzFWCtA3OwGVNmRpGsnb11R+0HsQPL6xiUigniWJu/3aPWdOUpprTg0WtZnsw rkXclSxzAKjaCJWr1u6imKN+54+WWqiZO5GjcYMmb7UohKHI8fgKzxo430TK1Tfa odHfVNIWn407YOxMvPTu40VLehwcbcMJQ8gosUEOk5uZKH7j+Co34dSrgXaeF13s AMHXIA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9tgkkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:36 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AavP022867 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:36 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; Tue, 18 Jun 2024 21:10:33 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 5/9] wifi: cfg80211: handle DFS on per link Date: Wed, 19 Jun 2024 09:39:55 +0530 Message-ID: <20240619040959.1457547-6-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: 5R9cs6ku-cOjUVhp6sZC1quZto0oDSS7 X-Proofpoint-ORIG-GUID: 5R9cs6ku-cOjUVhp6sZC1quZto0oDSS7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 Currently, during starting a radar detection, no link id information is parsed and passed down. In order to support starting radar detection during Multi Link Operation, it is required to pass link id as well. Add changes to first parse and then pass link id in the start radar detection path. Additionally, update notification APIs to allow drivers/mac80211 to pass the link ID. Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/marvell/mwifiex/11h.c | 7 +++-- .../net/wireless/marvell/mwifiex/cfg80211.c | 2 +- .../net/wireless/quantenna/qtnfmac/cfg80211.c | 2 +- .../net/wireless/quantenna/qtnfmac/event.c | 6 ++-- include/net/cfg80211.h | 8 +++-- net/mac80211/cfg.c | 6 ++-- net/mac80211/iface.c | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/util.c | 2 +- net/wireless/mlme.c | 19 ++++++------ net/wireless/nl80211.c | 22 +++++++------ net/wireless/rdev-ops.h | 13 ++++---- net/wireless/reg.c | 19 +++++++----- net/wireless/trace.h | 31 ++++++++++++------- 14 files changed, 80 insertions(+), 61 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c index fb2cad096758..032b93a41d99 100644 --- a/drivers/net/wireless/marvell/mwifiex/11h.c +++ b/drivers/net/wireless/marvell/mwifiex/11h.c @@ -122,7 +122,7 @@ void mwifiex_dfs_cac_work_queue(struct work_struct *work) "CAC timer finished; No radar detected\n"); cfg80211_cac_event(priv->netdev, &chandef, NL80211_RADAR_CAC_FINISHED, - GFP_KERNEL); + GFP_KERNEL, 0); } } @@ -182,7 +182,8 @@ void mwifiex_abort_cac(struct mwifiex_private *priv) "Aborting delayed work for CAC.\n"); cancel_delayed_work_sync(&priv->dfs_cac_work); cfg80211_cac_event(priv->netdev, &priv->dfs_chandef, - NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, + 0); } } @@ -221,7 +222,7 @@ int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv, cfg80211_cac_event(priv->netdev, &priv->dfs_chandef, NL80211_RADAR_DETECTED, - GFP_KERNEL); + GFP_KERNEL, 0); } break; default: diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 3880fe7384e1..46a83bdf4a81 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4145,7 +4145,7 @@ static int mwifiex_cfg80211_start_radar_detection(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms) + u32 cac_time_ms, int link_id) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_radar_params radar_params; diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 663d77770fce..8b97accf6638 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -837,7 +837,7 @@ static int qtnf_channel_switch(struct wiphy *wiphy, struct net_device *dev, static int qtnf_start_radar_detection(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms) + u32 cac_time_ms, int link_id) { struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); int ret; diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 8bd1e14e5de9..71840f41b73c 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -524,14 +524,14 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif, break; cfg80211_cac_event(vif->netdev, &chandef, - NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); + NL80211_RADAR_CAC_FINISHED, GFP_KERNEL, 0); break; case QLINK_RADAR_CAC_ABORTED: if (!vif->wdev.links[0].cac_started) break; cfg80211_cac_event(vif->netdev, &chandef, - NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, 0); break; case QLINK_RADAR_CAC_STARTED: if (vif->wdev.links[0].cac_started) @@ -542,7 +542,7 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif, break; cfg80211_cac_event(vif->netdev, &chandef, - NL80211_RADAR_CAC_STARTED, GFP_KERNEL); + NL80211_RADAR_CAC_STARTED, GFP_KERNEL, 0); break; default: pr_warn("%s: unhandled radar event %u\n", diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d03d525de4d3..f348e25ee9c9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4833,9 +4833,9 @@ struct cfg80211_ops { int (*start_radar_detection)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms); + u32 cac_time_ms, int link_id); void (*end_cac)(struct wiphy *wiphy, - struct net_device *dev); + struct net_device *dev, unsigned int link_id); int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_update_ft_ies_params *ftie); int (*crit_proto_start)(struct wiphy *wiphy, @@ -8685,6 +8685,7 @@ void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, * @chandef: chandef for the current channel * @event: type of event * @gfp: context flags + * @link_id: valid link_id for MLO operation or 0 otherwise. * * This function is called when a Channel availability check (CAC) is finished * or aborted. This must be called to notify the completion of a CAC process, @@ -8692,7 +8693,8 @@ void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, */ void cfg80211_cac_event(struct net_device *netdev, const struct cfg80211_chan_def *chandef, - enum nl80211_radar_event event, gfp_t gfp); + enum nl80211_radar_event event, gfp_t gfp, + unsigned int link_id); /** * cfg80211_background_cac_abort - Channel Availability Check offchan abort event diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a75b11071373..c2af768add96 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1674,7 +1674,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); + GFP_KERNEL, link_id); } drv_stop_ap(sdata->local, sdata, link_conf); @@ -3466,7 +3466,7 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, static int ieee80211_start_radar_detection(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms) + u32 cac_time_ms, int link_id) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_chan_req chanreq = { .oper = *chandef }; @@ -3497,7 +3497,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, } static void ieee80211_end_cac(struct wiphy *wiphy, - struct net_device *dev) + struct net_device *dev, unsigned int link_id) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_local *local = sdata->local; diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 9d13425d923f..69cb94318823 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -562,7 +562,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ieee80211_link_release_channel(&sdata->deflink); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); + GFP_KERNEL, 0); } if (sdata->vif.type == NL80211_IFTYPE_AP) { diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f7c20b6962f7..96fea00b62fd 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3022,7 +3022,7 @@ void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) ieee80211_link_release_channel(link); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_FINISHED, - GFP_KERNEL); + GFP_KERNEL, link->link_id); } } diff --git a/net/mac80211/util.c b/net/mac80211/util.c index b03d91dfdd35..1dfb61082a9c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3466,7 +3466,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); + GFP_KERNEL, 0); } } } diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index fddd6a62b942..4dac81854721 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -1110,27 +1110,28 @@ EXPORT_SYMBOL(__cfg80211_radar_event); void cfg80211_cac_event(struct net_device *netdev, const struct cfg80211_chan_def *chandef, - enum nl80211_radar_event event, gfp_t gfp) + enum nl80211_radar_event event, gfp_t gfp, + unsigned int link_id) { struct wireless_dev *wdev = netdev->ieee80211_ptr; struct wiphy *wiphy = wdev->wiphy; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); unsigned long timeout; - /* not yet supported */ - if (wdev->valid_links) + if (WARN_ON(wdev->valid_links && + !(wdev->valid_links & BIT(link_id)))) return; - trace_cfg80211_cac_event(netdev, event); + trace_cfg80211_cac_event(netdev, event, link_id); - if (WARN_ON(!wdev->links[0].cac_started && + if (WARN_ON(!wdev->links[link_id].cac_started && event != NL80211_RADAR_CAC_STARTED)) return; switch (event) { case NL80211_RADAR_CAC_FINISHED: - timeout = wdev->links[0].cac_start_time + - msecs_to_jiffies(wdev->links[0].cac_time_ms); + timeout = wdev->links[link_id].cac_start_time + + msecs_to_jiffies(wdev->links[link_id].cac_time_ms); WARN_ON(!time_after_eq(jiffies, timeout)); cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); memcpy(&rdev->cac_done_chandef, chandef, @@ -1139,10 +1140,10 @@ void cfg80211_cac_event(struct net_device *netdev, cfg80211_sched_dfs_chan_update(rdev); fallthrough; case NL80211_RADAR_CAC_ABORTED: - wdev->links[0].cac_started = false; + wdev->links[link_id].cac_started = false; break; case NL80211_RADAR_CAC_STARTED: - wdev->links[0].cac_started = true; + wdev->links[link_id].cac_started = true; break; default: WARN_ON(1); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7420a966997f..08c0d25924d6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -9978,6 +9978,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, struct wireless_dev *wdev = dev->ieee80211_ptr; struct wiphy *wiphy = wdev->wiphy; struct cfg80211_chan_def chandef; + int link_id = nl80211_link_id(info->attrs); enum nl80211_dfs_regions dfs_region; unsigned int cac_time_ms; int err = -EINVAL; @@ -10030,7 +10031,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, * can not already beacon */ if (wdev->valid_links && - !wdev->links[0].ap.beacon_interval) { + !wdev->links[link_id].ap.beacon_interval) { /* nothing */ } else { err = -EBUSY; @@ -10038,7 +10039,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, } } - if (wdev->links[0].cac_started) { + if (wdev->links[link_id].cac_started) { err = -EBUSY; goto unlock; } @@ -10058,12 +10059,13 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, if (WARN_ON(!cac_time_ms)) cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; - err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); + err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms, + link_id); if (!err) { - wdev->links[0].ap.chandef = chandef; - wdev->links[0].cac_started = true; - wdev->links[0].cac_start_time = jiffies; - wdev->links[0].cac_time_ms = cac_time_ms; + wdev->links[link_id].ap.chandef = chandef; + wdev->links[link_id].cac_started = true; + wdev->links[link_id].cac_start_time = jiffies; + wdev->links[link_id].cac_time_ms = cac_time_ms; } unlock: wiphy_unlock(wiphy); @@ -16415,10 +16417,10 @@ nl80211_set_ttlm(struct sk_buff *skb, struct genl_info *info) SELECTOR(__sel, NETDEV_UP_NOTMX, \ NL80211_FLAG_NEED_NETDEV_UP | \ NL80211_FLAG_NO_WIPHY_MTX) \ - SELECTOR(__sel, NETDEV_UP_NOTMX_NOMLO, \ + SELECTOR(__sel, NETDEV_UP_NOTMX_MLO, \ NL80211_FLAG_NEED_NETDEV_UP | \ NL80211_FLAG_NO_WIPHY_MTX | \ - NL80211_FLAG_MLO_UNSUPPORTED) \ + NL80211_FLAG_MLO_VALID_LINK_ID) \ SELECTOR(__sel, NETDEV_UP_CLEAR, \ NL80211_FLAG_NEED_NETDEV_UP | \ NL80211_FLAG_CLEAR_SKB) \ @@ -17313,7 +17315,7 @@ static const struct genl_small_ops nl80211_small_ops[] = { .flags = GENL_UNS_ADMIN_PERM, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_NO_WIPHY_MTX | - NL80211_FLAG_MLO_UNSUPPORTED), + NL80211_FLAG_MLO_VALID_LINK_ID), }, { .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 755af47b88b9..cce5a21bcb0f 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -1202,26 +1202,27 @@ static inline int rdev_start_radar_detection(struct cfg80211_registered_device *rdev, struct net_device *dev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms) + u32 cac_time_ms, int link_id) { int ret = -EOPNOTSUPP; trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef, - cac_time_ms); + cac_time_ms, link_id); if (rdev->ops->start_radar_detection) ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev, - chandef, cac_time_ms); + chandef, cac_time_ms, + link_id); trace_rdev_return_int(&rdev->wiphy, ret); return ret; } static inline void rdev_end_cac(struct cfg80211_registered_device *rdev, - struct net_device *dev) + struct net_device *dev, unsigned int link_id) { - trace_rdev_end_cac(&rdev->wiphy, dev); + trace_rdev_end_cac(&rdev->wiphy, dev, link_id); if (rdev->ops->end_cac) - rdev->ops->end_cac(&rdev->wiphy, dev); + rdev->ops->end_cac(&rdev->wiphy, dev, link_id); trace_rdev_return_void(&rdev->wiphy); } diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 898abc6d0609..6489ba943a63 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -4229,6 +4229,8 @@ EXPORT_SYMBOL(regulatory_pre_cac_allowed); static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) { struct wireless_dev *wdev; + unsigned int link_id; + /* If we finished CAC or received radar, we should end any * CAC running on the same channels. * the check !cfg80211_chandef_dfs_usable contain 2 options: @@ -4241,16 +4243,17 @@ static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { struct cfg80211_chan_def *chandef; - if (!wdev->links[0].cac_started) - continue; + for_each_valid_link(wdev, link_id) { + if (!wdev->links[link_id].cac_started) + continue; - /* FIXME: radar detection is tied to link 0 for now */ - chandef = wdev_chandef(wdev, 0); - if (!chandef) - continue; + chandef = wdev_chandef(wdev, link_id); + if (!chandef) + continue; - if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) - rdev_end_cac(rdev, wdev->netdev); + if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) + rdev_end_cac(rdev, wdev->netdev, link_id); + } } } diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 7fc7de9bcc34..97c21b627791 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -806,17 +806,21 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa, ); TRACE_EVENT(rdev_end_cac, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), - TP_ARGS(wiphy, netdev), + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + unsigned int link_id), + TP_ARGS(wiphy, netdev, link_id), TP_STRUCT__entry( WIPHY_ENTRY NETDEV_ENTRY + __field(unsigned int, link_id) ), TP_fast_assign( WIPHY_ASSIGN; NETDEV_ASSIGN; + __entry->link_id = link_id; ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d", + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id) ); DECLARE_EVENT_CLASS(station_add_change, @@ -2661,24 +2665,26 @@ TRACE_EVENT(rdev_external_auth, TRACE_EVENT(rdev_start_radar_detection, TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_chan_def *chandef, - u32 cac_time_ms), - TP_ARGS(wiphy, netdev, chandef, cac_time_ms), + u32 cac_time_ms, int link_id), + TP_ARGS(wiphy, netdev, chandef, cac_time_ms, link_id), TP_STRUCT__entry( WIPHY_ENTRY NETDEV_ENTRY CHAN_DEF_ENTRY __field(u32, cac_time_ms) + __field(int, link_id) ), TP_fast_assign( WIPHY_ASSIGN; NETDEV_ASSIGN; CHAN_DEF_ASSIGN(chandef); __entry->cac_time_ms = cac_time_ms; + __entry->link_id = link_id; ), TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT - ", cac_time_ms=%u", + ", cac_time_ms=%u, link_id=%d", WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG, - __entry->cac_time_ms) + __entry->cac_time_ms, __entry->link_id) ); TRACE_EVENT(rdev_set_mcast_rate, @@ -3492,18 +3498,21 @@ TRACE_EVENT(cfg80211_radar_event, ); TRACE_EVENT(cfg80211_cac_event, - TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt), - TP_ARGS(netdev, evt), + TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt, + unsigned int link_id), + TP_ARGS(netdev, evt, link_id), TP_STRUCT__entry( NETDEV_ENTRY __field(enum nl80211_radar_event, evt) + __field(unsigned int, link_id) ), TP_fast_assign( NETDEV_ASSIGN; __entry->evt = evt; + __entry->link_id = link_id; ), - TP_printk(NETDEV_PR_FMT ", event: %d", - NETDEV_PR_ARG, __entry->evt) + TP_printk(NETDEV_PR_FMT ", event: %d, link_id=%u", + NETDEV_PR_ARG, __entry->evt, __entry->link_id) ); DECLARE_EVENT_CLASS(cfg80211_rx_evt, From patchwork Wed Jun 19 04:09:56 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: 806309 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 3FF6741C69 for ; Wed, 19 Jun 2024 04:10:42 +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=1718770243; cv=none; b=d1mPBkXg07IZeGuF/kk2fNrhsHyc6FvhewYzrAUi+yKF0TEj34Ved1rgkl2lSmHIxLjIX+36l3aNXIRpgF9T/1ofO5gYIj/Yl0HXQdHYZ/6WmBplYyXE8cLXMIOnHNrBKddqf9ZHQb6BYJMp0CnNMjRngTcppqhfRVh1rBYByOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770243; c=relaxed/simple; bh=PhmKTGrPCh+Hd2UvmxGPMy4Hf+9muQAX4p1A+sQaufY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P14wlB+idHoOomOodKaeINwoh2J/ce6LL3HiEpCwLMKqGdY+8O0PYQGxQPyg0RWQURGIrp+7PtpAtGJ/phODZoSARr3xC5roM9bZ8E3X2RgP6vRJ4bhYj4b5/KKrWMPpz3xdxr7XHUBFBknmyt1zFYYF9/MPiMWw5gRVA7H0fWU= 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=KuWsrtAC; 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="KuWsrtAC" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ILaB4A006182; Wed, 19 Jun 2024 04:10:38 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= SdqvF7iIvNXlSn2pjemToDlDeU2XCB99QSrBCfu8TW0=; b=KuWsrtACV6LR2rxl VmGxzea3qyKM9lgYclnK4p5CEYZhDuzpKhUF4Keg2i/pVFyKZSA8svGkzpiiNHLa zCDwzOyn0LwDM3lNHiHFmOXG/gCpvwEGeJNaAjDdQA8hLdNd7W8oc5eEZSoUQJFX S1d2tG9paU1ziNXM2kXb2WRNIUvedd3kPfAhKUI+HJBwfk0NmPUs1mWTO400fzHr S+6TNTTs4YYU/A2PSZ56Dt7J6xcrf0a1r3o80dIdKdAJJGDpC6sCkZaPTcqTj+o8 Vl0p8GXkHCzZNhLkre8fiXmmIPVhihEZf/hR//KbKM8sMUg9K+4cK118wBFfaVGZ VuxXzQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9u0ksy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:38 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AbCa025007 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:37 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; Tue, 18 Jun 2024 21:10:36 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 6/9] wifi: mac80211: fix label name in ieee80211_start_radar_detection() Date: Wed, 19 Jun 2024 09:39:56 +0530 Message-ID: <20240619040959.1457547-7-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: yY_-q92ifx6cxI_W1A0h4weF0rk-jBMm X-Proofpoint-ORIG-GUID: yY_-q92ifx6cxI_W1A0h4weF0rk-jBMm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 impostorscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 After locks rework [1], ieee80211_start_radar_detection() function is no longer acquiring any lock as such explicitly. Hence, it is not unlocking anything as well. However, label "out_unlock" is still used which creates confusion. Rename the label to "return_err". [1]: https://lore.kernel.org/all/20230828135928.b1c6efffe9ad.I4aec875e25abc9ef0b5ad1e70b5747fd483fbd3c@changeid/ Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c2af768add96..b2cd43d807ed 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3477,7 +3477,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, if (!list_empty(&local->roc_list) || local->scanning) { err = -EBUSY; - goto out_unlock; + goto return_err; } /* whatever, but channel contexts should not complain about that one */ @@ -3487,12 +3487,12 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, IEEE80211_CHANCTX_SHARED); if (err) - goto out_unlock; + goto return_err; wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, msecs_to_jiffies(cac_time_ms)); - out_unlock: + return_err: return err; } From patchwork Wed Jun 19 04:09:57 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: 805952 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 BA29B558B6 for ; Wed, 19 Jun 2024 04:10:44 +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=1718770246; cv=none; b=cZmNBH1wwAryXF9wUlzgq4aNuGBvd2sYzt62WO+g9MGbae0Oy5q58+6Ggvyv6xu14gp/9Zc1vzzKD6+WawN/eLSPbdWPIY4mn1sx5K86ZglRnYUyeIB4XAz6XxdwZkuYCppPYKk9oeV2qVnWjH44D2ozhjd2j1MrnXehgNTsm0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770246; c=relaxed/simple; bh=402vBh7JvSmcBHcYIk6PdUqQZz5sG0w+0mAhyByM+38=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZPe0+NUK5QwflpDDMgEbhwayfW1ozOBH6i3o1clE7dPyDY4iiglqc2JDe4AdkLtNl5MPyb5VDRDFisGaB7yip2nnscbxsagLaePVPJz46B7mSSqCLfmVU47yV2GimqhSkgGUtf1o/Sgc2wXkwqBslzBrvyyGwOPFxKsrQS/Y7rQ= 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=bIGCmsrf; 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="bIGCmsrf" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ILa58h009248; Wed, 19 Jun 2024 04:10:40 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= bz7256KgkfBIx3/pS2xL6J9YBpclKvvKAfFeXpCEeD4=; b=bIGCmsrfH6rF3nkq 4EsbjBQkIGHCNf3Wcra7cFhvxWSbjfvifrD6mF/YkskI2dqDdLAPLKEhdgmQByAC gHNxavJT0dcwrvDqFkP3i0a21wIfxsm2AYbHPys7YW9MVX9odA+t1GugX4LMYVX/ 5tQcP5IjrgnkCc876/Xd2T7bWgw9c4OYKfslgP2WoQj9EPHE8m3E75nMlt9kkM0S movks9ZrPHj1hdAAp46JjuwfZ06r2Izfv9IJps/scswEdNhgu0+H1qHi2R1ZZeXL zj2+N71wIyB7NLI5jW2z1pVVaCLmghutECD+7upMe3w6KQ0/WAiivpfiK6q0PTmZ iG8iJw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuj9tgkkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:40 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AdXw013216 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:39 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; Tue, 18 Jun 2024 21:10:38 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 7/9] wifi: mac80211: handle DFS on per link Date: Wed, 19 Jun 2024 09:39:57 +0530 Message-ID: <20240619040959.1457547-8-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: iUilT3Tdbskmh0m543zoAAeYU4F79xj6 X-Proofpoint-ORIG-GUID: iUilT3Tdbskmh0m543zoAAeYU4F79xj6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_01,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 In order to support DFS with MLO, handle the link ID now passed from cfg80211, adjust the code to do everything per link and call the notifications to cfg80211 correctly. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 28 ++++++++++++++++++++-------- net/mac80211/util.c | 29 +++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index b2cd43d807ed..091508481f43 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3471,6 +3471,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_chan_req chanreq = { .oper = *chandef }; struct ieee80211_local *local = sdata->local; + struct ieee80211_link_data *link_data; int err; lockdep_assert_wiphy(local->hw.wiphy); @@ -3480,16 +3481,22 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, goto return_err; } + link_data = sdata_dereference(sdata->link[link_id], sdata); + if (!link_data) { + err = -ENOLINK; + goto return_err; + } + /* whatever, but channel contexts should not complain about that one */ - sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; - sdata->deflink.needed_rx_chains = local->rx_chains; + link_data->smps_mode = IEEE80211_SMPS_OFF; + link_data->needed_rx_chains = local->rx_chains; - err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, + err = ieee80211_link_use_channel(link_data, &chanreq, IEEE80211_CHANCTX_SHARED); if (err) goto return_err; - wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, + wiphy_delayed_work_queue(wiphy, &link_data->dfs_cac_timer_work, msecs_to_jiffies(cac_time_ms)); return_err: @@ -3501,16 +3508,21 @@ static void ieee80211_end_cac(struct wiphy *wiphy, { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_local *local = sdata->local; + struct ieee80211_link_data *link_data; lockdep_assert_wiphy(local->hw.wiphy); list_for_each_entry(sdata, &local->interfaces, list) { + link_data = sdata_dereference(sdata->link[link_id], sdata); + if (!link_data) + continue; + wiphy_delayed_work_cancel(wiphy, - &sdata->deflink.dfs_cac_timer_work); + &link_data->dfs_cac_timer_work); - if (sdata->wdev.links[0].cac_started) { - ieee80211_link_release_channel(&sdata->deflink); - sdata->wdev.links[0].cac_started = false; + if (sdata->wdev.links[link_id].cac_started) { + ieee80211_link_release_channel(link_data); + sdata->wdev.links[link_id].cac_started = false; } } } diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 1dfb61082a9c..3d34e07f441b 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3453,20 +3453,37 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) { struct ieee80211_sub_if_data *sdata; struct cfg80211_chan_def chandef; + struct ieee80211_link_data *link_data; + struct ieee80211_bss_conf *link_conf; + unsigned int link_id; lockdep_assert_wiphy(local->hw.wiphy); list_for_each_entry(sdata, &local->interfaces, list) { - wiphy_delayed_work_cancel(local->hw.wiphy, - &sdata->deflink.dfs_cac_timer_work); + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; + link_id++) { + link_data = sdata_dereference(sdata->link[link_id], + sdata); + if (!link_data) + continue; + + wiphy_delayed_work_cancel(local->hw.wiphy, + &link_data->dfs_cac_timer_work); + + if (!sdata->wdev.links[link_id].cac_started) + continue; + + link_conf = + rcu_dereference(sdata->vif.link_conf[link_id]); + if (!link_conf) + continue; - if (sdata->wdev.links[0].cac_started) { - chandef = sdata->vif.bss_conf.chanreq.oper; - ieee80211_link_release_channel(&sdata->deflink); + chandef = link_conf->chanreq.oper; + ieee80211_link_release_channel(link_data); cfg80211_cac_event(sdata->dev, &chandef, NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL, 0); + GFP_KERNEL, link_id); } } } From patchwork Wed Jun 19 04:09:58 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: 806308 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 65DA6558B6 for ; Wed, 19 Jun 2024 04:10: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=1718770249; cv=none; b=rqYOtaRrqXIpMCrkC6D+ZwX8qjW6a+zJ5DcXS/ZZEN9hqfMcyNy8NAMxedd0NvmI/ehe/Yuk0vOmpc5Km9ec9TX9bXDbECzSXTvQoLGiLIGBxmE9K5//rPA45mFPaf1GeF8F23AQQE5J/XreST7pwaHXUdAk3O6AT4xe4Ima6Lk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770249; c=relaxed/simple; bh=KP6PPIsAaBEmLfe4xQN/bfeaVpd1HI3mU8SVMfEst38=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PNlwwTqiT0/mhGGbK164nO0qtmMYr+79bv1fPo++Mty81SRNt0MKb+RgC/ZWyHYK0SeFR0+jB5fRPGud4Gsv14o0iF6AdQhPL/DaJqO+E1t2dj3SWI0sHM6W8vkJ0Cb2bvsdEzgKihUmzkvtgafSJ043Ly3PjU3vrSuXK4+KePo= 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=fC5Nct+1; 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="fC5Nct+1" 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 45ILaiLL005118; Wed, 19 Jun 2024 04:10: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= frZ2/HaLWjGCDMN8R1S9Zm48D0g+1KZni2EbWMvlJy0=; b=fC5Nct+1hUM6h7dC A55j0s4foS1CXUojq5brDVV+Hqpaohph8h4kfqSPOd6VC+0uqIiDzltfdbcfGxbc HU5+Upx9aM5fY5rKLflKavtUqkNOMO+SUCtqPKhzW0oqWPk5JuFz42vEcRaRGg3M FWsA3PYDFnjwuNOUpfZaP/+F1gnSQ373+ZOM9gCODCvhadmGz2qKXECpx/+ynDkr ZvJPwOwuG1cat5533B9DPhGlU07agp7/V+1BK6Tt1xZpNMmEVh8/Mcuz3rovhEWL eEeYQ2sU82XeIALWYxLu1EBdJZGqo3wRbENkHNVL1pekvTB2sYwaSSlZlDlCOtcq IY+1aw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yuja78kfd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:42 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AfB6013243 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:41 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; Tue, 18 Jun 2024 21:10:40 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 8/9] wifi: mac80211: handle ieee80211_radar_detected() for MLO Date: Wed, 19 Jun 2024 09:39:58 +0530 Message-ID: <20240619040959.1457547-9-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: -tDBG4elYaxarPvWBjmn_Vscp4EH8Dve X-Proofpoint-GUID: -tDBG4elYaxarPvWBjmn_Vscp4EH8Dve X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-18_08,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190028 Currently DFS works under assumption there could be only one channel context in the hardware. Hence, drivers just calls the function ieee80211_radar_detected() passing the hardware structure. However, with MLO, this obviously will not work since number of channel contexts will be more than one and hence drivers would need to pass the channel information as well on which the radar is detected. Hence, in order to support DFS with MLO, do the following changes - * Add channel pointer as an argument to the function ieee80211_radar_detected(). During MLO, drivers would have to pass on which channel radar is detected. * In order to pass on this channel information to the radar detected worker later on, introduce a linked list 'radar_info' in the structure local. * When driver calls radar detected, a node is created and added to this list and work is scheduled. The work handler takes care to process each node and take further action. * This would also help in scenarios where there is split phy 5 GHz radio, which is capable of DFS channels in both lower and upper band. In this case, simultaneous radars can be detected. Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath10k/debug.c | 4 +- drivers/net/wireless/ath/ath10k/mac.c | 2 +- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 2 +- drivers/net/wireless/ath/ath12k/wmi.c | 2 +- drivers/net/wireless/ath/ath9k/dfs.c | 2 +- drivers/net/wireless/ath/ath9k/dfs_debug.c | 2 +- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +- .../net/wireless/mediatek/mt76/mt76x02_dfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +- drivers/net/wireless/ti/wl18xx/event.c | 2 +- drivers/net/wireless/virtual/mac80211_hwsim.c | 2 +- include/net/mac80211.h | 5 +- net/mac80211/ieee80211_i.h | 6 ++ net/mac80211/main.c | 8 +++ net/mac80211/util.c | 64 ++++++++++++++++--- 17 files changed, 88 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index b93a64bf8190..35bfe7232e95 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -3,7 +3,7 @@ * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. * Copyright (c) 2018, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -1774,7 +1774,7 @@ static ssize_t ath10k_write_simulate_radar(struct file *file, if (!arvif->is_started) return -EINVAL; - ieee80211_radar_detected(ar->hw); + ieee80211_radar_detected(ar->hw, NULL); return count; } diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 3bf67b2ecd6d..21109e0842f1 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -1437,7 +1437,7 @@ static void ath10k_recalc_radar_detection(struct ath10k *ar) * by indicating that radar was detected. */ ath10k_warn(ar, "failed to start CAC: %d\n", ret); - ieee80211_radar_detected(ar->hw); + ieee80211_radar_detected(ar->hw, NULL); } } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index fe2344598364..4861179b2217 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3990,7 +3990,7 @@ static void ath10k_radar_detected(struct ath10k *ar) if (ar->dfs_block_radar_events) ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); else - ieee80211_radar_detected(ar->hw); + ieee80211_radar_detected(ar->hw, NULL); } static void ath10k_radar_confirmation_work(struct work_struct *work) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 38f175dd1557..8839825c22fa 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -8356,7 +8356,7 @@ ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_base *ab, struct sk_buff if (ar->dfs_block_radar_events) ath11k_info(ab, "DFS Radar detected, but ignored as requested\n"); else - ieee80211_radar_detected(ar->hw); + ieee80211_radar_detected(ar->hw, NULL); exit: rcu_read_unlock(); diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index d6e1d1398cdb..013f46ab982a 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -6785,7 +6785,7 @@ ath12k_wmi_pdev_dfs_radar_detected_event(struct ath12k_base *ab, struct sk_buff if (ar->dfs_block_radar_events) ath12k_info(ab, "DFS Radar detected, but ignored as requested\n"); else - ieee80211_radar_detected(ath12k_ar_to_hw(ar)); + ieee80211_radar_detected(ath12k_ar_to_hw(ar), NULL); exit: rcu_read_unlock(); diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c index 11349218bc21..3689e12db9f7 100644 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ b/drivers/net/wireless/ath/ath9k/dfs.c @@ -280,7 +280,7 @@ ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe) if (!pd->add_pulse(pd, pe, NULL)) return; DFS_STAT_INC(sc, radar_detected); - ieee80211_radar_detected(sc->hw); + ieee80211_radar_detected(sc->hw, NULL); } /* diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c index 8e18e9b4ef48..426caa057396 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c @@ -116,7 +116,7 @@ static ssize_t write_file_simulate_radar(struct file *file, { struct ath_softc *sc = file->private_data; - ieee80211_radar_detected(sc->hw); + ieee80211_radar_detected(sc->hw, NULL); return count; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index c807bd8d928d..282d9eb336bb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -394,7 +394,7 @@ mt7615_mcu_rx_radar_detected(struct mt7615_dev *dev, struct sk_buff *skb) if (mt76_phy_dfs_state(mphy) < MT_DFS_STATE_CAC) return; - ieee80211_radar_detected(mphy->hw); + ieee80211_radar_detected(mphy->hw, NULL); dev->hw_pattern++; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c index 024a5c0a5a57..7a07636d09c6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c @@ -630,7 +630,7 @@ static void mt76x02_dfs_tasklet(struct tasklet_struct *t) radar_detected = mt76x02_dfs_check_detection(dev); if (radar_detected) { /* sw detector rx radar pattern */ - ieee80211_radar_detected(dev->mt76.hw); + ieee80211_radar_detected(dev->mt76.hw, NULL); mt76x02_dfs_detector_reset(dev); return; @@ -658,7 +658,7 @@ static void mt76x02_dfs_tasklet(struct tasklet_struct *t) /* hw detector rx radar pattern */ dfs_pd->stats[i].hw_pattern++; - ieee80211_radar_detected(dev->mt76.hw); + ieee80211_radar_detected(dev->mt76.hw, NULL); mt76x02_dfs_detector_reset(dev); return; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 9599adf104b1..35fdd7df0a1e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -293,7 +293,7 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb) &dev->rdd2_chandef, GFP_ATOMIC); else - ieee80211_radar_detected(mphy->hw); + ieee80211_radar_detected(mphy->hw, NULL); dev->hw_pattern++; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 2c8578677800..bae7b2eeb02d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -371,7 +371,7 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb) &dev->rdd2_chandef, GFP_ATOMIC); else - ieee80211_radar_detected(mphy->hw); + ieee80211_radar_detected(mphy->hw, NULL); dev->hw_pattern++; } diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c index 34d95f458e1a..a9f090e15cbb 100644 --- a/drivers/net/wireless/ti/wl18xx/event.c +++ b/drivers/net/wireless/ti/wl18xx/event.c @@ -142,7 +142,7 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl) wl18xx_radar_type_decode(mbox->radar_type)); if (!wl->radar_debug_mode) - ieee80211_radar_detected(wl->hw); + ieee80211_radar_detected(wl->hw, NULL); } if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index fbf24870209d..f405acdfd4e6 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -1137,7 +1137,7 @@ static int hwsim_write_simulate_radar(void *dat, u64 val) { struct mac80211_hwsim_data *data = dat; - ieee80211_radar_detected(data->hw); + ieee80211_radar_detected(data->hw, NULL); return 0; } diff --git a/include/net/mac80211.h b/include/net/mac80211.h index ecfa65ade226..f46f61c8e3db 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -6724,8 +6724,11 @@ void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp); * ieee80211_radar_detected - inform that a radar was detected * * @hw: pointer as obtained from ieee80211_alloc_hw() + * @radar_channel: Channel pointer on which radar is detected. Mandatory to + * pass a valid pointer during MLO. For non-MLO %NULL can be passed */ -void ieee80211_radar_detected(struct ieee80211_hw *hw); +void ieee80211_radar_detected(struct ieee80211_hw *hw, + struct ieee80211_channel *radar_channel); /** * ieee80211_chswitch_done - Complete channel switch process diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4af0f9bd434d..0e6a54f03eb7 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1329,6 +1329,11 @@ enum mac80211_scan_state { DECLARE_STATIC_KEY_FALSE(aql_disable); +struct radar_info { + struct list_head list; + struct ieee80211_channel *channel; +}; + struct ieee80211_local { /* embed the driver visible part. * don't cast (use the static inlines below), but we keep @@ -1430,6 +1435,7 @@ struct ieee80211_local { bool wowlan; struct wiphy_work radar_detected_work; + struct list_head radar_info_list; /* number of RX chains the hardware has */ u8 rx_chains; diff --git a/net/mac80211/main.c b/net/mac80211/main.c index c8cb091b5ea3..30b383f1e27d 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -943,6 +943,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, INIT_LIST_HEAD(&local->interfaces); INIT_LIST_HEAD(&local->mon_list); + INIT_LIST_HEAD(&local->radar_info_list); __hw_addr_init(&local->mc_list); @@ -1638,6 +1639,7 @@ EXPORT_SYMBOL(ieee80211_register_hw); void ieee80211_unregister_hw(struct ieee80211_hw *hw) { struct ieee80211_local *local = hw_to_local(hw); + struct radar_info *radar_info, *temp; tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); @@ -1673,6 +1675,12 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) ieee80211_clear_tx_pending(local); rate_control_deinitialize(local); + list_for_each_entry_safe(radar_info, temp, &local->radar_info_list, + list) { + list_del(&radar_info->list); + kfree(radar_info); + } + if (skb_queue_len(&local->skb_queue) || skb_queue_len(&local->skb_queue_unreliable)) wiphy_warn(local->hw.wiphy, "skb_queue not empty\n"); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 3d34e07f441b..a39845465d2b 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3488,12 +3488,12 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) } } -void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, - struct wiphy_work *work) +static void +ieee80211_dfs_handle_radar_detection(struct ieee80211_local *local, + struct ieee80211_channel *radar_channel) { - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, radar_detected_work); struct cfg80211_chan_def chandef = local->hw.conf.chandef; + struct cfg80211_chan_def *radar_chandef = NULL; struct ieee80211_chanctx *ctx; int num_chanctx = 0; @@ -3505,23 +3505,69 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, num_chanctx++; chandef = ctx->conf.def; + + if (radar_channel && + (chandef.chan == radar_channel)) + radar_chandef = &ctx->conf.def; } ieee80211_dfs_cac_cancel(local); - if (num_chanctx > 1) - /* XXX: multi-channel is not supported yet */ - WARN_ON(1); - else + if (num_chanctx > 1) { + if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) { + if (WARN_ON(!radar_chandef)) + return; + + cfg80211_radar_event(local->hw.wiphy, radar_chandef, GFP_KERNEL); + } else { + /* XXX: multi-channel is not supported yet */ + WARN_ON(1); + } + } else { cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); + } } -void ieee80211_radar_detected(struct ieee80211_hw *hw) +void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, + struct wiphy_work *work) +{ + struct ieee80211_local *local = + container_of(work, struct ieee80211_local, radar_detected_work); + struct radar_info *radar_info, *temp; + struct ieee80211_channel *radar_channel; + + lockdep_assert_wiphy(local->hw.wiphy); + + if (list_empty(&local->radar_info_list)) { + ieee80211_dfs_handle_radar_detection(local, NULL); + return; + } + + list_for_each_entry_safe(radar_info, temp, &local->radar_info_list, + list) { + radar_channel = radar_info->channel; + ieee80211_dfs_handle_radar_detection(local, radar_channel); + list_del(&radar_info->list); + kfree(radar_info); + } +} + +void ieee80211_radar_detected(struct ieee80211_hw *hw, + struct ieee80211_channel *radar_channel) { struct ieee80211_local *local = hw_to_local(hw); + struct radar_info *radar_info; trace_api_radar_detected(local); + radar_info = kzalloc(sizeof(*radar_info), GFP_ATOMIC); + if (!radar_info) + return; + + INIT_LIST_HEAD(&radar_info->list); + radar_info->channel = radar_channel; + list_add_tail(&radar_info->list, &local->radar_info_list); + wiphy_work_queue(hw->wiphy, &local->radar_detected_work); } EXPORT_SYMBOL(ieee80211_radar_detected); From patchwork Wed Jun 19 04:09:59 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: 805951 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 BCED755882 for ; Wed, 19 Jun 2024 04:10:48 +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=1718770250; cv=none; b=cxPOzVM2r3RLly8dXbgBJiGxmmKkgL+aFvKjgjloUlxZo1MnIqkGtzg+AYdEXcuCp6oMxMT1KCVoQpUzsX4fJQC46RKqqMOAkfnXvomTpMioKrWNetYQmTv4SvbIB0gw5yzyN+ba11tZsQ9qg5BE+gy+zMVZD7r/ET5UnvQRuaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718770250; c=relaxed/simple; bh=YDLHKtCIPLrnk6kh4WzOWYZSpISXjaBgNI8IVrOMqkM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ulEPOPYnNX8EcLu47mpX1K/W3oVFxwcM975I+bshMDtqR6uqzKi0++G+304uTfFtp2gU10d+qg3ZAHQ3fZOOlWXwqxb1dQaZ5NJgYj4YjKq/SmIP/99VBQuoFM1fos5M0Jd7Lqroyl+XWRSPN4PQXkqG16nxrh4pCTgFfQlna/I= 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=FLudy2Vq; 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="FLudy2Vq" 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 45ILcZGt009524; Wed, 19 Jun 2024 04:10: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= y7nNMpzxRtRrWVVJATkbpBxyTIP2qgaf6ch4grZIH+Y=; b=FLudy2Vq9RSISqmK uvP3sbtvrEgEa6GN1Sc7yultsyQ2QwcN/U6FhyazzB25LSRQkn1U6yoh9boZQqcj 9ILKAJFNLcSTAVZtkTNLLjdMpO9vNIGHtstJrOm9mqjc/yx1n9hL6JUBMLDUlBNI sOI6AsEvYZSmr+qqGocEqL43mFp01QhOeo9SnjUX4yxsWayzFE3je/xji093tTg/ HvAU22j3AOFsRHF30KTKgICJMlZsls1+fHqW6z5bDIX/oVp8MDX98wyNMhlACnce a/1x1HDI3t1ur2t4OTdU/KLD6jol4maExJlgvbho+8an9AaKY7W8nyNU844I7FXj Wqnveg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yujag0k7n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:44 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J4AhEn013863 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 04:10:43 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; Tue, 18 Jun 2024 21:10:42 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 9/9] wifi: mac80211: abort active CAC while freeing the links during MLO Date: Wed, 19 Jun 2024 09:39:59 +0530 Message-ID: <20240619040959.1457547-10-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619040959.1457547-1-quic_adisi@quicinc.com> References: <20240619040959.1457547-1-quic_adisi@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: DbgN5xWkqR4X6d-AsGtVj_gCBeyrMUM7 X-Proofpoint-ORIG-GUID: DbgN5xWkqR4X6d-AsGtVj_gCBeyrMUM7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-18_08,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=984 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190029 If CAC is started and the interface is brought down, currently, CAC started on link 0 is aborted in function ieee80211_do_stop(). Technically, by the time execution reaches the above function, all links are already teared down and hence link 0 (or deflink) alone is handled. Also, since links are teared down, information on other links is also not available. Hence there is a need to handle this in function ieee80211_free_links(). Add changes in ieee80211_free_links() function which cancels any scheduled dfs_cac_timer_work on the link and if CAC is started, aborts it. Signed-off-by: Aditya Kumar Singh --- net/mac80211/link.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/net/mac80211/link.c b/net/mac80211/link.c index 8871cc1a0454..6c68887f051c 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -111,10 +111,32 @@ static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata, static void ieee80211_free_links(struct ieee80211_sub_if_data *sdata, struct link_container **links) { + struct ieee80211_bss_conf *link_conf; + struct ieee80211_link_data *link_data; + struct cfg80211_chan_def chandef; unsigned int link_id; - for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { + link_data = &links[link_id]->data; + link_conf = &links[link_id]->conf; + + if (!link_data || !link_conf) + continue; + + wiphy_delayed_work_cancel(sdata->local->hw.wiphy, + &link_data->dfs_cac_timer_work); + + if (sdata->wdev.links[link_id].cac_started) { + chandef = link_conf->chanreq.oper; + ieee80211_link_release_channel(link_data); + cfg80211_cac_event(sdata->dev, + &chandef, + NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL, link_id); + } + kfree(links[link_id]); + } } static int ieee80211_check_dup_link_addrs(struct ieee80211_sub_if_data *sdata)