Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp885594lqp; Thu, 23 May 2024 03:04:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgL4wuwAiUXRUS6DO8J4RTFj8AjG/e//iAKHc6Ao1np0Nm8+ZBK1vftWqWJF6nAhPB0W50POJFkZh8pWx0sEbZPbKqJUBQY5+iNAaXtg== X-Google-Smtp-Source: AGHT+IHO6o2sxVbU6dbgdAaHiKcIDFQhAvsWnKdCT8EG1kK9oS0nkMEawRPoc/33/+bRs+iYT1I0 X-Received: by 2002:a05:6214:5690:b0:6aa:dd7e:ddbd with SMTP id 6a1803df08f44-6ab7f358314mr47349486d6.15.1716458642105; Thu, 23 May 2024 03:04:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716458642; cv=pass; d=google.com; s=arc-20160816; b=s4o7HMp5e7X/56NItN8XihG5VuaEy3QK35mF2Ij/uA5gBxaWjXiCACDInzgkf8AQei lXSnFNMd0ayW1G54ZgFXaHsGRGstHDbHknmznfowkMyETihk7chYjtYPMeDmS+10bNwQ K7N+gnswypi0m6w63cuSzQUYzNqBqrXmrgLVTDtLNRd5yWNuFhEv+GlS4zYQgv+ETtK/ awo8IfCNnaf+SRK9VTgF7bDo/RVwddyfzdV/w8fhrPdHFIs0Vz9tiQzvppu6xKtagfly S4ZZ5S5S7mW8IIdpczXPEW1fIHQ0wQipk97bA/u5pBZo7pVWeesrK84HrMim3EmtoorI b7cQ== 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=NdNhGoVC59EX2cDSkBO16q5+J1dp5xpqAxyeGe+9zz4=; fh=0ZKV22Mpi0Z+/zRlCC9GRUAKl0wLMxmYgR1nXO1NAEs=; b=A9VroZ/xlvCXcGn2H2tzt0xlyvdNUDiDxzMiQ9IjP2/94JZr8kBVUqLMjQ06ce0x4r LkbRTzfVaXvuE4lyH8+MDpqf0qRlZSlsZPf8Bvec/k1/Q2P7R1ej8Z74pJ6FEbNe8Gnz aIGcT4V642TXnja653EdriG+xXA71hngjSOW1SO3sKPeUpIMhT57Pbx9R1XjOggOEInE 2c9EUfMy3dBlzsjPvxh+c1bsjhdZJiYQoLRimOhvBrmj1llDf0sYazsLl5iuYfRIrfAg lk5+8v4DUjK1MwNIQjUmzUge2F5ELtWRgBYgeYjVWznOMkvc3qAOXNPgLW6B3vT7Pxdg lSEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="VtmCJ/mv"; 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-7994-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7994-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 6a1803df08f44-6a15f29ca67si12317296d6.268.2024.05.23.03.04.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 03:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7994-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="VtmCJ/mv"; 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-7994-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7994-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 060CD1C20A8F for ; Thu, 23 May 2024 10:04:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C2BA13D2A8; Thu, 23 May 2024 10:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="VtmCJ/mv" 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 3C59313CA99 for ; Thu, 23 May 2024 10:03:56 +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=1716458639; cv=none; b=ioFXMpEBydcBpz3TxleZnunfSWzmEjUFF7f4ilFxgPvS0AT7NifjbSSBAIZeBFJTdSy48566k1dmvkGXQNnRlepTRop4LroDbUexW2FaTn4GABEMZDSLWrv3mUbZ+P2fieJzys9DXhYuKKVRmSl2kUXKOh1kk6lw6/ACDxtSdB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716458639; c=relaxed/simple; bh=P7962Bbz7IDd0BSPZEWS+AgDkYw+Rd/Hyk79fKdOK2g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Qj3NuuiwS4FQoyn2N66BUVATr00NBt6+itbjFwrZwAAOe0kKmimcHtCyZhmvQ7TixXnh3xflUDd4A9+awePEu1obYruC6iNyLyP8cn0N8aF8V1tHaD4RK7Gkdxd+Df0XnseVB5+3C7mN0XVzZ8go2FuXnZnMFqWiaxuV00e2XaI= 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=VtmCJ/mv; 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=NdNhGoVC59EX2cDSkBO16q5+J1dp5xpqAxyeGe+9zz4=; t=1716458637; x=1717668237; b=VtmCJ/mvrRuV3V4vjpiihwkVmI2fK2U8IiV8h1+GJ1n+b+USlT4FSnXNQqf/1lfX3ux/tmdh3J4 tw4NBVfBwDSm0jIwteCEwi5sGyET4fQsx8OrI5mSQRGgK5KLri6eAchTpcgaLEa8GnLLmnLGXcF7Z 1wgrbxH0otTMPaqAx7jjDZJdAIqXKOwW+L7QAomSI2BU7GQxP8k/dRDKmgDc0SYC7uA7dnM4uFbKR JgzXxqxmMPu46EsCIVAaY5xYTZ3vOBK4atsKHST+Oc9JoCdrUaom8SrDMZykj4GJF0yD4t+kJ5Fvw 8zPazlBRXqAA8IwVOoTCGL1Uq4w3B8MOYuOQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sA5Ig-00000005wEj-0DMk; Thu, 23 May 2024 12:03:54 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH] wifi: mac80211: handle HW restart during ROC Date: Thu, 23 May 2024 12:03:52 +0200 Message-ID: <20240523120352.f1924b5411ea.Ifc02a45a5ce23868dc7e428bad8d0e6996dd10f4@changeid> X-Mailer: git-send-email 2.45.1 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: Johannes Berg If we have a HW restart in the middle of a ROC period, then there are two cases: - if it's a software ROC, we really don't need to do anything, since the ROC work will still be queued and will run later, albeit with the interruption due to the restart; - if it's a hardware ROC, then it may have begun or not, if it did begin already we can only remove it and tell userspace about that. In both cases, this fixes the warning that would appear in ieee80211_start_next_roc() in this case. In the case of some drivers such as iwlwifi, the part of restarting is never going to happen since the driver will cancel the ROC, but flushing the work to ensure nothing is pending here will also result in no longer being able to trigger the warning in this case. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/ieee80211_i.h | 1 + net/mac80211/offchannel.c | 35 ++++++++++++++++++++++++++++++++++- net/mac80211/util.c | 3 +-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 76965d64a0fa..3fd7b1adbfab 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1978,6 +1978,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); void ieee80211_offchannel_return(struct ieee80211_local *local); void ieee80211_roc_setup(struct ieee80211_local *local); void ieee80211_start_next_roc(struct ieee80211_local *local); +void ieee80211_reconfig_roc(struct ieee80211_local *local); void ieee80211_roc_purge(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata); int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index 65e1e9e971fd..28d03196ef75 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c @@ -8,7 +8,7 @@ * Copyright 2006-2007 Jiri Benc * Copyright 2007, Michael Wu * Copyright 2009 Johannes Berg - * Copyright (C) 2019, 2022-2023 Intel Corporation + * Copyright (C) 2019, 2022-2024 Intel Corporation */ #include #include @@ -413,6 +413,39 @@ void ieee80211_start_next_roc(struct ieee80211_local *local) } } +void ieee80211_reconfig_roc(struct ieee80211_local *local) +{ + struct ieee80211_roc_work *roc, *tmp; + + /* + * In the software implementation can just continue with the + * interruption due to reconfig, roc_work is still queued if + * needed. + */ + if (!local->ops->remain_on_channel) + return; + + /* flush work so nothing from the driver is still pending */ + wiphy_work_flush(local->hw.wiphy, &local->hw_roc_start); + wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done); + + list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { + if (!roc->started) + break; + + if (!roc->hw_begun) { + /* it didn't start in HW yet, so we can restart it */ + roc->started = false; + continue; + } + + /* otherwise destroy it and tell userspace */ + ieee80211_roc_notify_destroy(roc); + } + + ieee80211_start_next_roc(local); +} + static void __ieee80211_roc_work(struct ieee80211_local *local) { struct ieee80211_roc_work *roc; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 43625ca87d5e..927f752a0209 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2175,8 +2175,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) local->in_reconfig = false; barrier(); - /* Restart deferred ROCs */ - ieee80211_start_next_roc(local); + ieee80211_reconfig_roc(local); /* Requeue all works */ list_for_each_entry(sdata, &local->interfaces, list) -- 2.45.1