From patchwork Tue Sep 22 19:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 11792997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B19651668 for ; Tue, 22 Sep 2020 19:21:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C9052071A for ; Tue, 22 Sep 2020 19:21:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Em8XHa6P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="O0ZX+rnr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C9052071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=candelatech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=3JhUokZCC+8mANVGM/CeHH9Wi8m+bcbIAn4zEAX0+TU=; b=Em8XHa6PJSbbpuFv/NyHoaknjm qgmIALRADs79AmtlKWlaCE5KiIzcU8DS3ibo4eEQ2+a38dYn5y1Q8HHXQzob4QdYB/7Gy6hAUw6Ns RMnlxcJw18o7/iwLQu2oFTjHZYAVV/4I8zcPimkI1/GNPh+ZnLDbUQufhNQDcJSlK3cK2beyMAdiZ DstsBQTESVzTxAOGT3giTZM/m8ReRXFN0p9d3XowUwzIEU6xbD6kML+pcEIS+ZXottlk440YqZmS3 /DyG0yPuHlI5q2dEWvpVr5QTx7y9tzjEsazvwFEGuBAz1WWzH0Rh+vyWZ/3kUxZP2vTJpl+DPAEF9 NUJhTUXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKnpn-000112-HQ; Tue, 22 Sep 2020 19:20:15 +0000 Received: from mail2.candelatech.com ([208.74.158.173] helo=mail3.candelatech.com) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKnpj-0000zT-0i for ath10k@lists.infradead.org; Tue, 22 Sep 2020 19:20:12 +0000 Received: from ben-dt4.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 79C9C13C2B0; Tue, 22 Sep 2020 12:20:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 79C9C13C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1600802400; bh=/hsZNWlMO8q90+AR3z0NSM2bW5UCcwsFE4SclNmOotk=; h=From:To:Cc:Subject:Date:From; b=O0ZX+rnrhSQhPhAaqQadI6/YcIYSC8plVgVYkT7uTPF8pLKg+qLBeRriFE0gv2+g9 DelK4zJw4qHI2nrjNOtERUDIM29YZs1WdJTrcYfVlc6fQrnrZ4M4YQST5vWY+g6xND 4PhYXVhiMJFo4/k2mt2JJ8ftTP26nUXyfYAa/goM= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 1/2] mac80211: Support not iterating over not-sdata-in-driver ifaces Date: Tue, 22 Sep 2020 12:19:56 -0700 Message-Id: <20200922191957.25257-1-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_152011_225868_3803B93A X-CRM114-Status: GOOD ( 14.36 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org From: Ben Greear Allow drivers to request that interface-iterator does NOT iterate over interfaces that are not sdata-in-driver. This will allow us to fix crashes in ath10k (and possibly other drivers). To summarize Johannes' explanation: Consider add interface wlan0 add interface wlan1 iterate active interfaces -> wlan0 wlan1 add interface wlan2 iterate active interfaces -> wlan0 wlan1 wlan2 If you apply this scenario to a restart, which ought to be functionally equivalent to the normal startup, just compressed in time, you're basically saying that today you get add interface wlan0 add interface wlan1 iterate active interfaces -> wlan0 wlan1 wlan2 << problem here add interface wlan2 iterate active interfaces -> wlan0 wlan1 wlan2 which yeah, totally seems wrong. But fixing that to be add interface wlan0 add interface wlan1 iterate active interfaces -> add interface wlan2 iterate active interfaces -> (or maybe -> wlan0 wlan1 wlan2 if the reconfig already completed) This is also at least somewhat wrong, but better to not iterate over something that exists in the driver than iterate over something that does not. Originally the first issue was causing crashes in testing with lots of station vdevs on an ath10k radio, combined with firmware crashing. I ran with a similar patch for years with no obvious bad results, including significant testing with ath9k and ath10k. Signed-off-by: Ben Greear --- include/net/mac80211.h | 4 ++++ net/mac80211/util.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 66e2bfd165e82..9c4bffcaed404 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -5344,11 +5344,15 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all * interfaces, even if they haven't been re-added to the driver yet. * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up). + * @IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER: Skip any interfaces where SDATA + * is not in the driver. This may fix crashes during firmware recovery + * for instance. */ enum ieee80211_interface_iteration_flags { IEEE80211_IFACE_ITER_NORMAL = 0, IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0), IEEE80211_IFACE_ITER_ACTIVE = BIT(1), + IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), }; /** diff --git a/net/mac80211/util.c b/net/mac80211/util.c index c8504ffc71a11..f3bc05217f741 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -733,6 +733,9 @@ static void __iterate_interfaces(struct ieee80211_local *local, if (!(iter_flags & IEEE80211_IFACE_ITER_RESUME_ALL) && active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) continue; + if ((iter_flags & IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER) && + !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) + continue; if (ieee80211_sdata_running(sdata) || !active_only) iterator(data, sdata->vif.addr, &sdata->vif);