Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1288230lqp; Mon, 15 Apr 2024 01:28:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqiG2DCfPmmGCckHZmDTVJxqZ3tmt0TDkvvwmBOwTPN4kqrmPYkdaDcjTIe2E7e+bk+y0RKkkLEcGD4Lt6wHk3dLVyrGpz2mavxYiNvQ== X-Google-Smtp-Source: AGHT+IEp0R9KpAVzTlC4b8tibM6jjlYO8LJ6QP3MoKTNZXgbfMNWuZKrR3ht6qSVaR5nO0SocG/r X-Received: by 2002:a17:906:c346:b0:a52:3ff7:744d with SMTP id ci6-20020a170906c34600b00a523ff7744dmr3972254ejb.4.1713169714658; Mon, 15 Apr 2024 01:28:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713169714; cv=pass; d=google.com; s=arc-20160816; b=mNaWR0fEHV0WUSgTiR3Vl1Zw+Rrl7va3OpcSPIepP0fbi41nuAJvjNKWjUYvsR6mJX d2XuW7xAuteFFh8O/VGYDOq/VJPI9i4pxyzOIi0ourtKvmyiDJ5E7Bmj4YPZH+MovEe2 H3j++kSKd4e6lvZtC9b0qNwEID6V4mE/hX8urwv5zaEKvioik91apBlJ370Oljcbn3aq Y6GucMyDwzErh0ulATLc1PDMlOLl9jXWo9nu2jdF8XA+/50j5N/eICLUkkLMpOrp/Hri irlWfNDVLDoMgcaSaRRWJTZIyLPPxGpgts+i1m2H84mYmTCNmxCD8eA5Rwf94iAAf9xn Go3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=nWrzL//c1u8IDxUixD1V3FBQO5wuQnOu1CMprsjzMz8=; fh=XwhrcOa2XvQCrpFgIB6LfmqW6XC6AohXSgvbFj2WExc=; b=GeKIUtzsgiSiYspm7HMn1rPBs1rXNL9p2OJB+rRlVFlEJ88y8tSokteO7QTDnP3Q9g dUrv8m2199LHZ/V4ro6g+12OEy1Hll+LQBT/sVyjEpg6aVTSoBe+4wO+jZzI31uxU7ji Ljv/mLbrPLp6/3xzRe9+/0k5NFiPv+A5nhdIXl9oevgkaVuLcPliUim6KBGpbhdlUBk/ VOUiACt8e+xYfOWAblF0ieG8yGlUkHrCXyCQF7XXi61xpFuGQWNsdRN8+BnMVejhFANq IWx74vwFMJbipaUqQcHFW2Mtuw8j4+vWkSJtwf4BVmA3IHN659i3+qN4VjKQtj/wVu03 TtwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VM8Gu7jE; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-6305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sh15-20020a1709076e8f00b00a4e7dfb0e74si4574169ejc.724.2024.04.15.01.28.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 01:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VM8Gu7jE; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-6305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 F14C31F24866 for ; Mon, 15 Apr 2024 08:27:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5020F381BE; Mon, 15 Apr 2024 08:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VM8Gu7jE" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.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 C1E95376E7 for ; Mon, 15 Apr 2024 08:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713169654; cv=none; b=Ur+ETRqdqUwCPXEcj+EEIz8smsk0/912k3bcxFmQgbhbKWWbXDHcKTTFl6n61InY8KHXC/vsRm+pndXb7+I/4Rb8un5uAz8PSUJdavAp+wQG493982ltlyqfpr5m31h/BF3gOmuJeoCX5n0dvYqZBfCAEw/Uv23DrJcuD7LHtc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713169654; c=relaxed/simple; bh=ew1RbLFTU0+AZV9E5Rnzod+YD3LIJuhMEd8isCcMhx4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ApLXGkfYtWTQ3eMIjrFQtIs/ksRrTFr434GK6juYQj+D20rkCoKUlsWczgvnLm/YL9e72R3L2UbYIJIx8dUh8A6YeDKL+BL49jktXRDo9lsmVgJEx/tc47aiaGeHpBG5yd8nZVdQNnZLH+B99/sEEtGkshfjUwPoGB6JfSGFwdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VM8Gu7jE; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713169653; x=1744705653; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ew1RbLFTU0+AZV9E5Rnzod+YD3LIJuhMEd8isCcMhx4=; b=VM8Gu7jEjZvrsDrUm53chnD2sozxkRfUTiWQzJK8LPGOTZs7/wUW6Wgz ZoRBcEH+AdauNrG8lvqKP/Wrh06S1y0TZ31CMtLjejcwmv1nLC30a9rUp 95e8afB6qo6PYmrwpLX1gwW9mRD9OZnXRVfjcaFAeFWVCUBphrmQuRSGO stJPmr93M9BxxnbpdY0yghp3m9cMujJGdyRbDUk/0272Mz+qyWgNFT6Ls waHKZztaW8CAb7uB8CPsJuTHy3Ct49nwDXVadEODqh2By2SmMBG9ItyXK /YBppYYd5/FEUg3UbQgDVe2sYONj9OkHn4aDt7kLRJSkJb/W3jI6T4U6B w==; X-CSE-ConnectionGUID: gSm+FcSWSmSwTLZLfwn94A== X-CSE-MsgGUID: aWLkKxUgSWOc5SoUoRA9MA== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="9097277" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="9097277" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 01:27:32 -0700 X-CSE-ConnectionGUID: Dy+K9Nt/RpG7nGiNldKaeA== X-CSE-MsgGUID: ikPSiJIhQwSz3RIDJc7BnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="26403251" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 01:27:31 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Subject: [PATCH 3/3] wifi: mac80211: defer link switch work in reconfig Date: Mon, 15 Apr 2024 11:27:13 +0300 Message-Id: <20240415112355.1ef1008e3a0a.I19add3f2152dcfd55a759de97b1d09265c1cde98@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240415082713.3822598-1-miriam.rachel.korenblit@intel.com> References: <20240415082713.3822598-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit If a link switch work was queued, and then a restart happened, the worker might be executed before the reconfig, and obviously it will fail (the HW might not respond to updates etc.) So, don't perform the switch if we are in reconfig, instead - do it at the end of the reconfig. Signed-off-by: Miri Korenblit --- net/mac80211/iface.c | 5 +++++ net/mac80211/util.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index ef6b0fc82d02..dc42902e2693 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1699,8 +1699,13 @@ static void ieee80211_activate_links_work(struct wiphy *wiphy, struct ieee80211_sub_if_data *sdata = container_of(work, struct ieee80211_sub_if_data, activate_links_work); + struct ieee80211_local *local = wiphy_priv(wiphy); + + if (local->in_reconfig) + return; ieee80211_set_active_links(&sdata->vif, sdata->desired_active_links); + sdata->desired_active_links = 0; } /* diff --git a/net/mac80211/util.c b/net/mac80211/util.c index cda398d8f60d..0b893e958959 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2106,6 +2106,13 @@ int ieee80211_reconfig(struct ieee80211_local *local) if (sdata->restart_active_links) ieee80211_set_active_links(&sdata->vif, sdata->restart_active_links); + /* + * If a link switch was scheduled before the restart, and ran + * before reconfig, it will do nothing, so re-schedule. + */ + if (sdata->desired_active_links) + wiphy_work_queue(sdata->local->hw.wiphy, + &sdata->activate_links_work); } /* Reconfigure sched scan if it was interrupted by FW restart */ -- 2.34.1