Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795038249; b=f6M4MpuxllWvMXMhzebuRWR4x2UYjfd3TpkqvMm6Sjrr2aj/LkKm0SJF/euHbZIsr3Po s1U3k05uxknDilAW9p0GOSoF7ECgkbSDLfvw4yTB1UCuI0fefjoxkV4wwOwnd4Dc90v3y SaiRdqab2ks2DojFFA+PX5rJ7lmdrzBrptAgx0bQJPGOn8cZkhnq6fUfD5SUQP3nr8qt7 KEIZ6E5smuBQBij6gx+djLiY5Ypi+P/2pemI6yDiaWIcfVOG6GBklpV5ef4oWqZ6Qkam5 JKWJsAnLcPfh1Re1Hb8vvqVRBzv8siSUAzbMaF6337tmNgHqLT/R4YxseerJq7s9OlA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795038249; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=hFEukBmmmdXuQxbnUWF0w4LdxB+j4p8yhybCXQvrIms=; b=0YjVwkC40TCeZNcsPMQoJ7Y6oCvT3cJ9j/rGjioSS/JOJRsl5uQOthScX5VwkSmfOc6Q 10kMhe4oGbTfHvLbZDn+zoIwXJAXjWDC+RhZJHwuG6AnnsR3c7c3g0qYwXZ4gVFpk+KYg Lypm5DVtUxWtcnjSKOteL86wOJw/N6HDCR9W5x0Wzwnd5URjyilGhJYLLdIWLeeJzC9/f qDl5JtA8cZMJS7g99ZWVfh5f8GDVLJQiQyU3lWrQWSS0Pv8U2CisfFzZDtHsINqDTca7h F+Vdt2VYj/mYgUyPrxlNLemPzjEK5AdHUpeC//8Z78jchmWN3SFX21Gm08DDAldOivw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UIWyaYrv; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B2D1606A325; Wed, 18 Nov 2026 21:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UIWyaYrv Received: by smtp.kernel.org (Postfix) with ESMTPSA id A247D1F000C4; Wed, 18 Nov 2026 21:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795038249; bh=hFEukBmmmdXuQxbnUWF0w4LdxB+j4p8yhybCXQvrIms=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UIWyaYrvMu0u/gAzbAQE2L4OjQgVmxZfDw0BPuIH7qrfYCkfKxuax/MTtKVuUOzjW rbYT0kq5jWQXXYxAbTBnSRSF3KHH365IGYJHCNxdP5jff7DtYsLRzdKP9vrSVGp375 SO6gnbCuRXCf8cMbtw+CZqOqxZT77lyOT/qszQ/M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mehmet Fide , Ping-Ke Shih , Sasha Levin Subject: [PATCH 6.6 1677/3318] wifi: rtw88: usb: only let the frames a dozing station needs use the after-DTIM queue Date: Wed, 18 Nov 2026 15:38:19 +0100 Message-ID: <20261118150412.114168090@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mehmet Fide [ Upstream commit 185971f1b4eb4ea9059d76cf1a18f992eef998c1 ] With the budget in place the high queue can no longer take the chip down, but ordinary chatter still competes with the frames a sleeping station actually needs. mac80211 marks every broadcast and multicast frame with IEEE80211_TX_CTL_SEND_AFTER_DTIM while a station dozes, mDNS and SSDP included, so under normal traffic the budget is spent on frames nobody waits for. Do what the vendor driver does with its default "allow special" high queue filter: admit only ARP, EAPOL and DHCP to the after-DTIM path, the frames a station coming out of power save has to see; everything else goes out on its access category queue at line rate. The frames are classified the way rtw89_core_tx_btc_spec_pkt_notify() does it, from skb->protocol and the network and transport header offsets that mac80211 keeps from the netdev path; EAPOL is the control port flag. Frames the AP relays between its own stations arrive as ETH_P_802_3 and are not inspected, they leave on the access category queue. With the filter in place the page pool stays at 1803 through the same 180 second storm, a DHCP flood still takes the after-DTIM path (and is then held by the budget), and join/ping cycling without power save is unchanged (10/10). Signed-off-by: Mehmet Fide Acked-by: Ping-Ke Shih Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260910081716.769081-3-mehmet.fide@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/usb.c | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c index 117bcb2659dc6..6eb85096d5d58 100644 --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c @@ -2,9 +2,11 @@ /* Copyright(c) 2018-2019 Realtek Corporation */ +#include #include -#include #include +#include +#include #include "main.h" #include "debug.h" #include "reg.h" @@ -496,6 +498,27 @@ static int rtw_usb_write_data_h2c(struct rtw_dev *rtwdev, u8 *buf, u32 size) return rtw_usb_write_data(rtwdev, &pkt_info, buf); } +static bool rtw_usb_bmc_needs_dtim(struct sk_buff *skb) +{ + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct udphdr *udphdr; + + if (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO) + return true; + + if (skb->protocol == htons(ETH_P_ARP)) + return true; + + if (skb->protocol == htons(ETH_P_IP) && + ip_hdr(skb)->protocol == IPPROTO_UDP) { + udphdr = udp_hdr(skb); + + return udphdr->dest == htons(67) || udphdr->dest == htons(68); + } + + return false; +} + #define RTW_USB_HIQ_REFILL_INTERVAL (HZ / 10) /* one unit of budget per 100 ms */ #define RTW_USB_HIQ_BUDGET_MAX 16 @@ -538,7 +561,7 @@ static u8 rtw_usb_tx_queue_mapping_to_qsel(struct rtw_usb *rtwusb, else if (is_broadcast_ether_addr(hdr->addr1) || is_multicast_ether_addr(hdr->addr1)) qsel = (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) && - rtw_usb_hiq_take_budget(rtwusb) ? + rtw_usb_bmc_needs_dtim(skb) && rtw_usb_hiq_take_budget(rtwusb) ? TX_DESC_QSEL_HIGH : skb->priority; else if (skb_get_queue_mapping(skb) <= IEEE80211_AC_BK) qsel = skb->priority; -- 2.53.0