Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1031409rdb; Tue, 30 Jan 2024 06:10:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1JlcrqCgRn5gAl6ozjeAVa7r1kEVR3l+m8gg+yZvjD8/0abw69x2Mf7leeioVI46w+6Hq X-Received: by 2002:a17:906:bcda:b0:a35:53c8:dbd with SMTP id lw26-20020a170906bcda00b00a3553c80dbdmr6294170ejb.35.1706623817697; Tue, 30 Jan 2024 06:10:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706623817; cv=pass; d=google.com; s=arc-20160816; b=K2Fv0Wej+D4sADkxOxSVch4oCxgMAwlk+aiheX764tYnpau7+M/Y42ND8Km+2LvQG5 SQh5SfjAjOET9cYMppu177njT3uL10MKMbSH3YUWjrNQ0Vr+3KanaYdqg+fDsdAlwnh3 BZXybOOM4AYm4DEa90qXJA2Cwos6kX4/FwyVe7NxcwNFvbK3LTych/fLs8qmC7U/SP6y hL8tnYUw5sdfxP4wls28VgAi6kw/ZIG9UJ2/twfmXDBUlLNCAqJmbn+kCkwVIcMtjW3J WO07/LVJjVtjjRfu7al2HVJDHliUeQgPklNTy56Uc2fNoYDKE0tCLT2ACNWgE5p8RdNf 5UYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RFUu2Lf8ug+0Fc1G04IcAO7dAIkADV+f0+6z+rRW/VE=; fh=vq0+xMtYG6vs1jTsVcbEHzJDe0zQay6ssvWL7nL1c0Q=; b=QvTzbf52IDGriNlE4fO6rkQ7cxhXN9Y6TFh12LmcEkbxsXXiNcwmnYdkjPJ1haOWNK 6M/AWcYZmEK7wElQws100Y3fqs4MgVKc2/EVy1Q7xz67KTJ+qmF4H6p3IQuSlgzHM2sz XXRxICQkmzc5VVKcJd+Yz9nbLK+jkr1Sas7OsgqN6QqDjtujmG4y0Icf0/xVkE17wjnX XKeygGn+8iIGJmLqJj/0vweXzoNSPOTJseuAlz4eL/aW9ijJ8VY0vGFTlu5AzGcA/nHZ ps5ZKVVkgu/6501HSdX1KifaWxDxmU1r9Xb2K/ThtowluCfBI/FQ+9hpMRuv2gRV8/1Z z++Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UM345DaK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-2818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCV0Ph98/jFJagWrk/uO1KjnX05q2LMWCk0XmN72XMHIXC29NuTwcStvuRGD9K5qQ7exJnkVyTJ6HTC+Ie1ZLLR9Km9vX3SCul5+WUv2WA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f21-20020a1709067f9500b00a35f73c6131si1197717ejr.198.2024.01.30.06.10.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:10:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UM345DaK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-2818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4A3991F25548 for ; Tue, 30 Jan 2024 14:10:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A03906D1B1; Tue, 30 Jan 2024 14:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="UM345DaK" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA1AC6DCFB for ; Tue, 30 Jan 2024 14:09:49 +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=1706623791; cv=none; b=eeudvpPZmuIDRNexpdViNciWC9NJ9Evw7A741G0CLM68RGHD7fqHzwj0319ArSWtGdU55McCia8vDSXhJTvMDGLYCwOTTfAp5Kgab2RTOw/NntosIxDpSzawxg9ROy+e+yf9BLCoYxnwF6jIbwCtr0fo8GLNpkkwc40VCeKMno0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706623791; c=relaxed/simple; bh=NAYhnN1QdxPtYoAR1fkTpKKUnvEbQGfy/NUmYjYGzIE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gQ1R888NoFcYWIR7/n5Wqxx/eh6J9mcEVc/vHiqRTPj79nppFu+vj+NNTiiFhAQi5JfRkLRvrslfNHZXngjj5bq0w44EaoWAOcU1ZHtG0PVxFekh9+btk6geWbt5gMK3rMygyqb2crN9tf4cXSUhT254quFkjaHflBhB8JVAiUc= 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=UM345DaK; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40U9RubP028932; Tue, 30 Jan 2024 14:09:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=RFUu2Lf8ug+0Fc1G04IcAO7dAIkADV+f0+6z+rRW/VE=; b=UM 345DaKN5HHnt9xsaQsY7C0lXCO+Y50yfH7Z6O5mxTFDpzFwh537F7hH+5UA43l7n lmz2JnuPpjNFSAUuoRhneWb/s3t3dxy/RTbSCFfQbBQPm6aEjF0dDvsPe2nUJ40z 5Sg5c3qMed1stdC2pF7khbyUd7Fq73SJqdtPKTDLsIXHKIzthoC62BSgSJBEadiT q3dBK+IY4g1cJAPORfIIf25PNrnkyVADpnWp8O8HlXrm9G/7KchGGRbC10KLXk19 m1toJCFAYq0srbWCWz8q2qspiAM79EfSP8OP1ihXmUtFLI5p6NxHE+RA9ukOpqTK fCbFsbDkYqcMHWA2CwjA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vxvsr0uew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 14:09:45 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40UE9jbM006184 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 14:09:45 GMT Received: from cdcwlex322514-lin.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 30 Jan 2024 06:09:43 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH v8 2/5] wifi: mac80211: update beacon counters per link basis Date: Tue, 30 Jan 2024 19:39:15 +0530 Message-ID: <20240130140918.1172387-3-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240130140918.1172387-1-quic_adisi@quicinc.com> References: <20240130140918.1172387-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: cydOKC_K4HGg-3WIE0VaEd01x4QVYPvl X-Proofpoint-ORIG-GUID: cydOKC_K4HGg-3WIE0VaEd01x4QVYPvl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-30_07,2024-01-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=735 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 malwarescore=0 clxscore=1015 impostorscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401300104 Currently, function to update beacon counter uses deflink to fetch the beacon and then update the counter. However, with MLO, there is a need to update the counter for the beacon in a particular link. Add support to use link_id in order to fetch the beacon from a particular link data during beacon update counter. Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath10k/mac.c | 2 +- drivers/net/wireless/ath/ath11k/mac.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 2 +- include/net/mac80211.h | 4 +++- net/mac80211/tx.c | 14 +++++++++++--- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 090bcf148d0c..e32e8c70986d 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2035,7 +2035,7 @@ static void ath10k_mac_vif_ap_csa_count_down(struct ath10k_vif *arvif) return; if (!ieee80211_beacon_cntdwn_is_complete(vif)) { - ieee80211_beacon_update_cntdwn(vif); + ieee80211_beacon_update_cntdwn(vif, 0); ret = ath10k_mac_setup_bcn_tmpl(arvif); if (ret) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index b13525bbbb80..0ea2ae40f2ad 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1589,7 +1589,7 @@ void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) arvif->bcca_zero_sent = false; if (vif->bss_conf.color_change_active) - ieee80211_beacon_update_cntdwn(vif); + ieee80211_beacon_update_cntdwn(vif, 0); ath11k_mac_setup_bcn_tmpl(arvif); } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index c4f96125cf33..581c2d3fc534 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -1467,7 +1467,7 @@ static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm, mvmvif->csa_countdown = true; if (!ieee80211_beacon_cntdwn_is_complete(csa_vif)) { - int c = ieee80211_beacon_update_cntdwn(csa_vif); + int c = ieee80211_beacon_update_cntdwn(csa_vif, 0); iwl_mvm_mac_ctxt_beacon_changed(mvm, csa_vif, &csa_vif->bss_conf); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8d6ae22c09bf..ad70dea96a46 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -5507,6 +5507,7 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, /** * ieee80211_beacon_update_cntdwn - request mac80211 to decrement the beacon countdown * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * @link_id: valid link_id during MLO or 0 for non-MLO * * The beacon counter should be updated after each beacon transmission. * This function is called implicitly when @@ -5516,7 +5517,8 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, * * Return: new countdown value */ -u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif); +u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, + unsigned int link_id); /** * ieee80211_beacon_set_cntdwn - request mac80211 to set beacon countdown diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 68a48abc7287..ac5bdacf4b8c 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5030,16 +5030,24 @@ static u8 __ieee80211_beacon_update_cntdwn(struct beacon_data *beacon) return beacon->cntdwn_current_counter; } -u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif) +u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, unsigned int link_id) { struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); + struct ieee80211_link_data *link; struct beacon_data *beacon = NULL; u8 count = 0; + if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) + return 0; + rcu_read_lock(); + link = rcu_dereference(sdata->link[link_id]); + if (!link) + goto unlock; + if (sdata->vif.type == NL80211_IFTYPE_AP) - beacon = rcu_dereference(sdata->deflink.u.ap.beacon); + beacon = rcu_dereference(link->u.ap.beacon); else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) beacon = rcu_dereference(sdata->u.ibss.presp); else if (ieee80211_vif_is_mesh(&sdata->vif)) @@ -5280,7 +5288,7 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, if (beacon->cntdwn_counter_offsets[0]) { if (!is_template) - ieee80211_beacon_update_cntdwn(vif); + ieee80211_beacon_update_cntdwn(vif, link->link_id); ieee80211_set_beacon_cntdwn(sdata, beacon, link); } -- 2.25.1