Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1032464rdb; Tue, 30 Jan 2024 06:11:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNPIPwvUhFG55i2t4A9+X+Eul0IKgOnojjaEzSPZ9RJrb0GN93/qS6DRvyYfyZL0Cu7z48 X-Received: by 2002:a05:6830:118e:b0:6e1:1252:2f64 with SMTP id u14-20020a056830118e00b006e112522f64mr9171182otq.61.1706623904475; Tue, 30 Jan 2024 06:11:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706623904; cv=pass; d=google.com; s=arc-20160816; b=x8HJ9YGq3tTF+pSILEPWxVEEq+rxBK3gKEe8wFZHdKcQSnWR0IX/FrI424uU+pNRN4 LqRGiQoCNgvCXglKWrG1aZ53I+qOHtjEZ632RKgIFvJHoghxI+/s0gDxqQRvK3A81AVM Yn3u7x9hLL9ceXH8sft0srVUIec2VK6HbCQcIJGf9fKfQlF14Asofu+c3ovmuLmimUoM p0i7FyvNOVxzKrwWggov/MO6CgTw28veCla4QJdWE/40BlPZ0z0dWQwKVxlfCtYRAXlU 5gi/FDusMrPk4KnSfXRjhNZv2Yr+RVt1vz+9G5eBt32b7p/PQT6Y2E4b9ls8i3uvLzuK Y21w== 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=vtK5enC/ymXkqjp9fBl9IjXWX9xyabiR1gp9BTr2PtE=; fh=SSeTAk0Ka8HRIMgQX2s6kEdmcjicHSAlKOmU20bSVB4=; b=ALF2F2WAQMJJT29FVG8x6xzgc1/2TYLGdfD0fcj8jZ9eId0Qana2SrOTYeTZk/cvjN hicaNKK0cnb323okVMo9FPOgGwTDuHiMjUCx7k7jqmkD7MhqJ1nyeD+84kxDfIeDF9bu 5uIwexMDt7nnH1rSXE9/VWeiR0cxdEfq6SjtXV2j1aJCRcRVA9OpQ+z63af8XK4q7Z1M 0dmu1BesWyP/VmHNWkVwCr6KbN+/SXR4WW5CpnomY6w5ldcKsOECFiSculdvDfkZFBx1 n/PcGDaohgvzQcu2rKt980L74Lw/2/hOpERa53xeqbaDJaqyTqkiHVObli5AJYWCGWol DlVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WDPutT9Q; 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-2820-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2820-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; AJvYcCXaZPoNjfrrftW/p6/H5tAFCvaUQ12vJMYRAFeqh+jqihcjhrFXAbXyzlxX9fEHbHZcqIs7k5KTyoZgz59A47rufUfBqvPSZs08BrD4Tg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ey1-20020a0562140b6100b0068c593417d7si3031898qvb.37.2024.01.30.06.11.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2820-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WDPutT9Q; 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-2820-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2820-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 23D0A1C25FAD for ; Tue, 30 Jan 2024 14:10:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ECBF6DCE8; Tue, 30 Jan 2024 14:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="WDPutT9Q" 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 B8D2E6DD06 for ; Tue, 30 Jan 2024 14:09:53 +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=1706623795; cv=none; b=pxS6BMwqO05lT19MhtTKgiZXu0thoOhVRC8+NzQ/z+AUIsiNDUSNemvyvn8Qt59dE2sPqdzdIMwialM/CKHJ6oXYRLgqoO2xMeatxKbIu0M+Yx0m4frWx6oOCAcxO/G18dWdjU7jppsBuR5Lf/jkbJjbZznOeKKkrQ4Qb1GZnnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706623795; c=relaxed/simple; bh=SL5L/tg3WhGiqZsxZXg/dZ15NltDhCVtav5zbKRh6F4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i5rL6BUxrMc0NWqf6l+duMUukdN6bcSxiwoH8iWJF1gpMq/3xhIY7wjBK6pFBme+WOo1ERA8FK8s1ezrGA5oBaSiYAk3ovPN6AyxfBbW673w7Om7OQF4Ba/+zlmeVMvFw8bn2nqNaaaG+DJcPFauV+f/lX8dj2MfP4/PYmaQVT4= 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=WDPutT9Q; 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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40UAWaCw009474; Tue, 30 Jan 2024 14:09:49 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=vtK5enC/ymXkqjp9fBl9IjXWX9xyabiR1gp9BTr2PtE=; b=WD PutT9Qph5Qpw7dbMMK41Q0hhqvxvi18ACu+PaozharPlS4RO8fs34504cLG+PtOu NSjjK+RdEfw+gbNFu2pj1qIqKmDe2CAnmwsL1gFJp/vY+VIWq52oz3tAXODtwxJ7 SosVC60G7YoZvTwoFYlXgAcWk29aEQr8rnBfb6kQ0qUfK/2OgSnPFrf8+gsA+RRK GXR6Tvm0RpzJL3YkIN3tHS+Iq/vbbCXE8s55heMB6FnGiObC5QNo5grgOzNwVQqh EcPStl0sa6BdlO7fyKeWkCIowtb+2F+oHumSPG4YCGJSCXZflvXM0nVf2kTy0CGR XvWHwkpHfXR+JZhDO80Q== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vxydh0fw6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 14:09:49 +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 40UE9nfm006235 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 14:09:49 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:47 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH v8 4/5] wifi: mac80211: start and finalize channel switch on link basis Date: Tue, 30 Jan 2024 19:39:17 +0530 Message-ID: <20240130140918.1172387-5-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-ORIG-GUID: tq_aPfIFYXjcpPo1RvirQpbi6pA98K8H X-Proofpoint-GUID: tq_aPfIFYXjcpPo1RvirQpbi6pA98K8H 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 bulkscore=0 phishscore=0 mlxscore=0 malwarescore=0 clxscore=1015 spamscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=696 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401300104 Add changes to start a channel switch as well as finalize it on link basis in order to support CSA with MLO as well. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 69 ++++++++++++++++++++++++++------------------- net/mac80211/link.c | 2 ++ 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a5d510932cbe..4427259154e2 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3629,6 +3629,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data) { struct ieee80211_sub_if_data *sdata = link_data->sdata; struct ieee80211_local *local = sdata->local; + struct ieee80211_bss_conf *link_conf = link_data->conf; u64 changed = 0; int err; @@ -3650,22 +3651,21 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data) if (link_data->reserved_ready) return 0; - return ieee80211_link_use_reserved_context(&sdata->deflink); + return ieee80211_link_use_reserved_context(link_data); } - if (!cfg80211_chandef_identical(&link_data->conf->chandef, + if (!cfg80211_chandef_identical(&link_conf->chandef, &link_data->csa_chandef)) return -EINVAL; - sdata->vif.bss_conf.csa_active = false; + link_conf->csa_active = false; - err = ieee80211_set_after_csa_beacon(&sdata->deflink, &changed); + err = ieee80211_set_after_csa_beacon(link_data, &changed); if (err) return err; - if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) { - sdata->vif.bss_conf.eht_puncturing = - sdata->vif.bss_conf.csa_punct_bitmap; + if (link_conf->eht_puncturing != link_conf->csa_punct_bitmap) { + link_conf->eht_puncturing = link_conf->csa_punct_bitmap; changed |= BSS_CHANGED_EHT_PUNCTURING; } @@ -3693,7 +3693,8 @@ static void ieee80211_csa_finalize(struct ieee80211_link_data *link_data) struct ieee80211_sub_if_data *sdata = link_data->sdata; if (__ieee80211_csa_finalize(link_data)) { - sdata_info(sdata, "failed to finalize CSA, disconnecting\n"); + sdata_info(sdata, "failed to finalize CSA on link %d, disconnecting\n", + link_data->link_id); cfg80211_stop_iface(sdata->local->hw.wiphy, &sdata->wdev, GFP_KERNEL); } @@ -3869,7 +3870,10 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_channel_switch ch_switch; struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx *chanctx; + struct ieee80211_bss_conf *link_conf; + struct ieee80211_link_data *link_data; u64 changed = 0; + u8 link_id = params->link_id; int err; lockdep_assert_wiphy(local->hw.wiphy); @@ -3880,16 +3884,23 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, if (sdata->wdev.cac_started) return -EBUSY; - if (cfg80211_chandef_identical(¶ms->chandef, - &sdata->vif.bss_conf.chandef)) + if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) + return -EINVAL; + + link_data = wiphy_dereference(wiphy, sdata->link[link_id]); + if (!link_data) + return -ENOLINK; + + link_conf = link_data->conf; + + if (cfg80211_chandef_identical(¶ms->chandef, &link_conf->chandef)) return -EINVAL; /* don't allow another channel switch if one is already active. */ - if (sdata->vif.bss_conf.csa_active) + if (link_conf->csa_active) return -EBUSY; - conf = rcu_dereference_protected(sdata->vif.bss_conf.chanctx_conf, - lockdep_is_held(&local->hw.wiphy->mtx)); + conf = wiphy_dereference(wiphy, link_conf->chanctx_conf); if (!conf) { err = -EBUSY; goto out; @@ -3913,7 +3924,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, if (err) goto out; - err = ieee80211_link_reserve_chanctx(&sdata->deflink, ¶ms->chandef, + err = ieee80211_link_reserve_chanctx(link_data, ¶ms->chandef, chanctx->mode, params->radar_required); if (err) @@ -3922,44 +3933,44 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, /* if reservation is invalid then this will fail */ err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0); if (err) { - ieee80211_link_unreserve_chanctx(&sdata->deflink); + ieee80211_link_unreserve_chanctx(link_data); goto out; } /* if there is a color change in progress, abort it */ - if (sdata->vif.bss_conf.color_change_active) + if (link_conf->color_change_active) ieee80211_color_change_abort(sdata); - err = ieee80211_set_csa_beacon(&sdata->deflink, params, &changed); + err = ieee80211_set_csa_beacon(link_data, params, &changed); if (err) { - ieee80211_link_unreserve_chanctx(&sdata->deflink); + ieee80211_link_unreserve_chanctx(link_data); goto out; } - if (params->punct_bitmap && !sdata->vif.bss_conf.eht_support) + if (params->punct_bitmap && link_conf->eht_support) goto out; - sdata->deflink.csa_chandef = params->chandef; - sdata->deflink.csa_block_tx = params->block_tx; - sdata->vif.bss_conf.csa_active = true; - sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap; + link_data->csa_chandef = params->chandef; + link_data->csa_block_tx = params->block_tx; + link_conf->csa_active = true; + link_conf->csa_punct_bitmap = params->punct_bitmap; - if (sdata->deflink.csa_block_tx) + if (link_data->csa_block_tx) ieee80211_stop_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA); cfg80211_ch_switch_started_notify(sdata->dev, - &sdata->deflink.csa_chandef, 0, + &link_data->csa_chandef, link_id, params->count, params->block_tx, - sdata->vif.bss_conf.csa_punct_bitmap); + link_conf->csa_punct_bitmap); if (changed) { - ieee80211_link_info_change_notify(sdata, &sdata->deflink, - changed); + ieee80211_link_info_change_notify(sdata, link_data, changed); + /* link_id to be passed here? */ drv_channel_switch_beacon(sdata, ¶ms->chandef); } else { /* if the beacon didn't change, we can finalize immediately */ - ieee80211_csa_finalize(&sdata->deflink); + ieee80211_csa_finalize(link_data); } out: diff --git a/net/mac80211/link.c b/net/mac80211/link.c index d4f86955afa6..0a1d0ef09d9f 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -73,6 +73,8 @@ void ieee80211_link_stop(struct ieee80211_link_data *link) ieee80211_mgd_stop_link(link); cancel_delayed_work_sync(&link->color_collision_detect_work); + wiphy_work_cancel(link->sdata->local->hw.wiphy, + &link->csa_finalize_work); ieee80211_link_release_channel(link); } -- 2.25.1