Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1765408rdd; Thu, 11 Jan 2024 08:36:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtjb5nI2NvX1cOHbtcW02NXLHpfix20VOcwOQSyxDhTedtUqanRjjCYza5J8sBTZhDb7f0 X-Received: by 2002:a05:620a:370f:b0:783:30ab:e7dc with SMTP id de15-20020a05620a370f00b0078330abe7dcmr141090qkb.16.1704991005452; Thu, 11 Jan 2024 08:36:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704991005; cv=none; d=google.com; s=arc-20160816; b=pbGY0SmtFpUJ46qLWI8Likxasm1KnKIC/7GH3RpPU+KKhwp3SZte/bsinHcgX/yMH3 WPl0cbQVLw7DVgJmscNQEEnFH1w09nWZ6wp+OJauiuuYy0sk/JE6EHDXbF/npfrlfC7N LL9FbdBKreNaYWdtjz2NGPeh1ZcNVzDD2TCA+SyoiuAa99F5x1JEKpYK+f4VAp0Wi7HB GjQuYo+WrFk9OiLY1Doj0Pdj6QbxrfdShgCrtVnQx8lH81d8DgBzP6l2lIY23G1OPjkK NLfPcf4N2iMr9oGBARWLw2yg2z/GeNulyLelEYdC6fpILXZQ9Hhx9F3mR5fhTDvG/T1G i9UA== ARC-Message-Signature: i=1; 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:dkim-signature:dkim-signature:from; bh=iN6GSIO/rEn/FcRbHBi0y7MwzsWweP0cE1KUmloGCF0=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=Taj69sW1LBUnji/BFPhEEfW88dw1Xb7xRBeeF+xOfFQ3Y6ufgeDy1CV1zpHJlVJ9kt b8NFKTlYidJH2JB0kgBkFLQ3grApvDORY0HYWWowRjGNCkF1owtUu4Z8tducQXNr/PO8 mCr2SvOvVAQBKMU/Yfk0AGYyCjVec7ib17QdSq61/fANpxu2eq5uRE23vYh61sum1O2E 629WRaZY+qGhJ6I19IFRLdt7cZr67tM/DY/GiWKNoxcC+y0mMOENWzT45nToe3/O9r70 owj6IVKKFXTfJ6C+/QiYNQNWzCwKa0GLEyJuAlU8fQ8V3wqn25vjZL+exRLb5O9C4Jex a/bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2ToKuYFl; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1738-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1738-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id qp28-20020a05620a389c00b00781e293c517si1120442qkn.471.2024.01.11.08.36.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:36:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1738-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=@linutronix.de header.s=2020 header.b=2ToKuYFl; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1738-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1738-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 371C41C227EB for ; Thu, 11 Jan 2024 16:36:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 738CC5025B; Thu, 11 Jan 2024 16:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2ToKuYFl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Bzo6R+uD" X-Original-To: linux-wireless@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C183D5024E for ; Thu, 11 Jan 2024 16:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1704990995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iN6GSIO/rEn/FcRbHBi0y7MwzsWweP0cE1KUmloGCF0=; b=2ToKuYFlV3v6Pq8WobWdM4MVtHPU8oeZBPxk2DeXQrWICkodoqwE2oa3+5E5x15PFwabvV L8LOsyCDXwHS77vVv7ZOcsKAjR/OqodXfsB9+nLeHrX+caLo9TOGfRLosy5YVqzh2mu96M BQedoj29CxyhQs+/Ng3YvB1hH72RvWU7gD8NwfQ0Hf1jyh/bU6SkOyzRswmSCVvScwjjSv kFy4to/OoEnDQQYcHkCnkdTirXijU2ncNNQrl87i+sGKkdZHFmSsRNNB0dQcpoUKsHMIrG bX6c84O2GRxwJ34FzV8KDAAOR8UpOioZffDuWbd46jB2VKtuXxaJ5EG6w5wfqw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1704990995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iN6GSIO/rEn/FcRbHBi0y7MwzsWweP0cE1KUmloGCF0=; b=Bzo6R+uDm5fpOaGT5eDX6doGtUDi5xX0jqCZUCO4IHvBfKQOVA++sCS7WHWpzk2xGzTJno CESXe1PuGUf979Bw== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v3 2/2] wifi: rtl8xxxu: enable channel switch support Date: Thu, 11 Jan 2024 17:36:28 +0100 Message-Id: <20240111163628.320697-3-martin.kaistra@linutronix.de> In-Reply-To: <20240111163628.320697-1-martin.kaistra@linutronix.de> References: <20240111163628.320697-1-martin.kaistra@linutronix.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The CSA countdown in the beacon frames, which are sent out by firmware, needs to get updated by the driver. To achieve this, convert update_beacon_work to delayed_work and schedule it with the beacon interval in case CSA is active and the countdown is not complete. Signed-off-by: Martin Kaistra --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 803c76b3209c4..03307da67c2c3 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1900,7 +1900,7 @@ struct rtl8xxxu_priv { struct delayed_work ra_watchdog; struct work_struct c2hcmd_work; struct sk_buff_head c2hcmd_queue; - struct work_struct update_beacon_work; + struct delayed_work update_beacon_work; struct rtl8xxxu_btcoex bt_coex; struct rtl8xxxu_ra_report ra_report; struct rtl8xxxu_cfo_tracking cfo_tracking; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 757ebd46452eb..521faa48803c7 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4605,7 +4605,7 @@ static int rtl8xxxu_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, { struct rtl8xxxu_priv *priv = hw->priv; - schedule_work(&priv->update_beacon_work); + schedule_delayed_work(&priv->update_beacon_work, 0); return 0; } @@ -5107,7 +5107,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } if (changed & BSS_CHANGED_BEACON) - schedule_work(&priv->update_beacon_work); + schedule_delayed_work(&priv->update_beacon_work, 0); error: return; @@ -5726,7 +5726,7 @@ static void rtl8xxxu_send_beacon_frame(struct ieee80211_hw *hw, static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work) { struct rtl8xxxu_priv *priv = - container_of(work, struct rtl8xxxu_priv, update_beacon_work); + container_of(work, struct rtl8xxxu_priv, update_beacon_work.work); struct ieee80211_hw *hw = priv->hw; struct ieee80211_vif *vif = priv->vifs[0]; @@ -5735,6 +5735,14 @@ static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work) return; } + if (vif->bss_conf.csa_active) { + if (ieee80211_beacon_cntdwn_is_complete(vif)) { + ieee80211_csa_finish(vif); + return; + } + schedule_delayed_work(&priv->update_beacon_work, + msecs_to_jiffies(vif->bss_conf.beacon_int)); + } rtl8xxxu_send_beacon_frame(hw, vif); } @@ -7482,6 +7490,7 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw) cancel_work_sync(&priv->c2hcmd_work); cancel_delayed_work_sync(&priv->ra_watchdog); + cancel_delayed_work_sync(&priv->update_beacon_work); rtl8xxxu_free_rx_resources(priv); rtl8xxxu_free_tx_resources(priv); @@ -7764,7 +7773,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface, spin_lock_init(&priv->rx_urb_lock); INIT_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work); INIT_DELAYED_WORK(&priv->ra_watchdog, rtl8xxxu_watchdog_callback); - INIT_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback); + INIT_DELAYED_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback); skb_queue_head_init(&priv->c2hcmd_queue); usb_set_intfdata(interface, hw); @@ -7825,6 +7834,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface, hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP); hw->queues = 4; + hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + if (priv->fops->supports_concurrent) { hw->wiphy->iface_combinations = rtl8xxxu_combinations; hw->wiphy->n_iface_combinations = ARRAY_SIZE(rtl8xxxu_combinations); -- 2.39.2