Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2419108rbb; Wed, 28 Feb 2024 00:48:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWcZr+OrU1/uwjSvzHE48ZRb9NPA1R66gMkoXsd3+GkiegjGxu8IiaPQ3MwYs/sTw3AZyil8MBZIeOwra0smA5Zy6KrxwIiaMVqkwI5bw== X-Google-Smtp-Source: AGHT+IGX1BSZ1CF0TdqJlg5fstNSNAt3hfnl42eB0gt13Kf5eyIsOlF4jV18GWmPECpyV2sdvdqC X-Received: by 2002:a05:620a:4625:b0:787:e475:55ea with SMTP id br37-20020a05620a462500b00787e47555eamr5192948qkb.12.1709110083215; Wed, 28 Feb 2024 00:48:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709110083; cv=pass; d=google.com; s=arc-20160816; b=z0QNQeXqIwe82MyGWKfQ0M9aWLrM8ZxFcDpQxZsljO+rCFxNL8wsdjF/uiDk7xawmz 6TpSBGHv7MhABzZAFJa9DlCUJB/q+b431gPENPignoMmakF1u9sbyaBHa9nSUs//2Tow 2Xsrsx1cSv1vyYCLEHp0e6UBUjbvN3Cok7i+UyERavCTEmQ/imRsAtLo2gjmkdH8nkDK pot/0NlOWyBhOseAGjHs3SRq4La7L0PMFKSHoOHMBgdDq822OwSvkWppX6xwwfH8Pbmz NtpDBcwMsBdqF901oXRXWIssofRmz9iqCAhxBKLME8mThwH/XaTnR8c2VjcAC2VFiBwd J4hA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=p/sEAzCJvetYOeJJLZeGOQXLOFEuVNeRAlfGFdV0Yak=; fh=4kaEP0xkIsazZZseuh0UEa7Egkfw7yi3+Z5XsxeuP3k=; b=V3Vqx16lpHyKIyCmUvR4zU29FChPXTdVq7HsxDtvKCAy3GRrFgsLf7BPxlQ05115X7 DX9iOTj5ZYa0f8Y2JLfo8w0w7QxT9UF/GgI2IazNMfkPaqrVdoNTa0uv2GuXxiGVQgTW ybZHLUMqYES/Rw/p8tC7rZNdie/r8eiuIalDhbGFtCMO8S3lyCh4AVX2kWKp1mQlj847 rmFqzuj2HvpFGNQsVgGdIIskKN8JJJ9C0Vz0dJkWoouonk7e4QNSDi7N2GLlcYtqBTq0 xisTpNRDJJ32j0yK8xbHoMP0YvyLUPQlqLwZK5S57El00Dyker96HZtOIXDXjrNdCULu q1cA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=a4xcLJdf; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e14-20020a05620a208e00b00787c194daf9si8863447qka.606.2024.02.28.00.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4143-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=@sipsolutions.net header.s=mail header.b=a4xcLJdf; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net 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 E30D31C210FE for ; Wed, 28 Feb 2024 08:48:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431222377A; Wed, 28 Feb 2024 08:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="a4xcLJdf" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 A167E2D605 for ; Wed, 28 Feb 2024 08:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110080; cv=none; b=OSmdGHcRG2qsH9jcYZ5fdvaO2yTYeIXXjSdqQepCb9oVbLMQHByHPpY/xmPkBqOvE09ezg2uGctq7x5X1rEM+lDRv8gOSgf0n38s7/gFTVEKbnbr5S4OdBvKLExgNXMCQTVd6Al0s8gMslm0FHRWVKKlURqwG8nHZ7MpB7xenV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110080; c=relaxed/simple; bh=TStAacKcNujBTe/VAEEHtY2ZSJbuI0yd6MzSD84imGE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AxqePyH/1HzsWSRNn4R54nIac465D+KcY9GGvoU7C1eVndaHfxB+K+biZLE5rFNvZFbERNgBTvhEW+sHIti0ZMNqnc5qsR/uuWShN4DuOhssiSm9+AbjZAbAIpRwwQRv+U40ttP8BZsJoTh2y+nSZXtYLSuXELzkmwZSTOGhHDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=a4xcLJdf; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=p/sEAzCJvetYOeJJLZeGOQXLOFEuVNeRAlfGFdV0Yak=; t=1709110078; x=1710319678; b=a4xcLJdfa98rSCrb0rSs6jnmNu7w8sLmMJuZ3Q21AQOdv5UPGswq4ogHgT/D9IeXa6D0mhT5Ca7 LD06LSL4N23S+opjFYXK6KcFy3VovMGn7MWFUDFOmIF3XL/J9w/AImOaBV7RQE66aA0HGVIOpzrJu Rgo7RME6O28caxGuQwz3uHsJ6Se3skrIDbjdTlvNMvUXAY05OztExTjd0auvn3kJLLqB3MeajmKvg ldmGeRRE9wNtNn6UMvg+LKVbz94gLWxPNaKZ119F6Qb1vvC7sAn3jkaFoRMWrIRhPC17oOXa77K9b iK4G+GSlfx35DthipUHAqCg4fjG4pWEA6EVQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rfFbX-0000000C06w-2QDK; Wed, 28 Feb 2024 09:47:56 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Ilan Peer , Miriam Rachel Korenblit Subject: [PATCH] wifi: mac80211: Adjust CQM handling for MLO Date: Wed, 28 Feb 2024 09:47:54 +0100 Message-ID: <20240228094753.bf6a3fefe553.Id738810b73e1087e01d5885508b70a3631707627@changeid> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ilan Peer The CQM handling did not consider the MLO case and thus notified a not-existing link with the CQM change. To fix this, propagate the CQM notification to all the active links (handling both the non-MLO and MLO cases). TODO: this currently propagates the same configuration to all links regardless of the band. This might not be the correct approach as different links might need to be configured with different values. Signed-off-by: Ilan Peer Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/cfg.c | 79 +++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 0744113f3535..e57ba4f7a589 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3256,33 +3256,57 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, return 0; } +static void ieee80211_set_cqm_rssi_link(struct ieee80211_sub_if_data *sdata, + struct ieee80211_link_data *link, + s32 rssi_thold, u32 rssi_hyst, + s32 rssi_low, s32 rssi_high) +{ + struct ieee80211_bss_conf *conf; + + if (!link || !link->conf) + return; + + conf = link->conf; + + if (rssi_thold && rssi_hyst && + rssi_thold == conf->cqm_rssi_thold && + rssi_hyst == conf->cqm_rssi_hyst) + return; + + conf->cqm_rssi_thold = rssi_thold; + conf->cqm_rssi_hyst = rssi_hyst; + conf->cqm_rssi_low = rssi_low; + conf->cqm_rssi_high = rssi_high; + link->u.mgd.last_cqm_event_signal = 0; + + if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) + return; + + if (sdata->u.mgd.associated && + (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) + ieee80211_link_info_change_notify(sdata, link, BSS_CHANGED_CQM); +} + static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, s32 rssi_thold, u32 rssi_hyst) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_vif *vif = &sdata->vif; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; + int link_id; - if (rssi_thold == bss_conf->cqm_rssi_thold && - rssi_hyst == bss_conf->cqm_rssi_hyst) - return 0; - - if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER && - !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) + if (vif->driver_flags & IEEE80211_VIF_BEACON_FILTER && + !(vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) return -EOPNOTSUPP; - bss_conf->cqm_rssi_thold = rssi_thold; - bss_conf->cqm_rssi_hyst = rssi_hyst; - bss_conf->cqm_rssi_low = 0; - bss_conf->cqm_rssi_high = 0; - sdata->deflink.u.mgd.last_cqm_event_signal = 0; + /* For MLD, handle CQM change on all the active links */ + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { + struct ieee80211_link_data *link = + sdata_dereference(sdata->link[link_id], sdata); - /* tell the driver upon association, unless already associated */ - if (sdata->u.mgd.associated && - sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI) - ieee80211_link_info_change_notify(sdata, &sdata->deflink, - BSS_CHANGED_CQM); + ieee80211_set_cqm_rssi_link(sdata, link, rssi_thold, rssi_hyst, + 0, 0); + } return 0; } @@ -3293,22 +3317,19 @@ static int ieee80211_set_cqm_rssi_range_config(struct wiphy *wiphy, { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_vif *vif = &sdata->vif; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; + int link_id; - if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) + if (vif->driver_flags & IEEE80211_VIF_BEACON_FILTER) return -EOPNOTSUPP; - bss_conf->cqm_rssi_low = rssi_low; - bss_conf->cqm_rssi_high = rssi_high; - bss_conf->cqm_rssi_thold = 0; - bss_conf->cqm_rssi_hyst = 0; - sdata->deflink.u.mgd.last_cqm_event_signal = 0; + /* For MLD, handle CQM change on all the active links */ + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { + struct ieee80211_link_data *link = + sdata_dereference(sdata->link[link_id], sdata); - /* tell the driver upon association, unless already associated */ - if (sdata->u.mgd.associated && - sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI) - ieee80211_link_info_change_notify(sdata, &sdata->deflink, - BSS_CHANGED_CQM); + ieee80211_set_cqm_rssi_link(sdata, link, 0, 0, + rssi_low, rssi_high); + } return 0; } -- 2.43.2