Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp140886lqe; Tue, 9 Apr 2024 18:14:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWD+ltgSadAFGxwv2Tj7GfottEcAWRPq5xlGB2wzGFt9FmD9DNekpAkZjoeRwqXxB2Li5tyFEgwEThPyeux0ntQ3QHIxdEcZD5BrEEP+Q== X-Google-Smtp-Source: AGHT+IHw3z9Nv5vQbC7rKPpAQInUGXrpOJK97bGwIbd/Ymq5guoHDJKWnE2RAEs22rCd7TbSlry7 X-Received: by 2002:a54:400d:0:b0:3c6:64e:a9ec with SMTP id x13-20020a54400d000000b003c6064ea9ecmr1127906oie.58.1712711688584; Tue, 09 Apr 2024 18:14:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712711688; cv=pass; d=google.com; s=arc-20160816; b=sk9HU2XwPVlaR/H9St3nXjXOoQas50uSIIfCUpGWOGPc0jtfEptBp6bfx+c3lJfoed zbeU4BUA8ZhdXRbTHA2HgF6Ny9X/uCPJTEw9TBKQSE73OTP8GPtt6/NVbejt3tMrQi5D cF4YSFdytc3lkPwXw+LvVCWBHNQRQcBO4T0gGx2g71gDpYz0oBSqIl4HnNqwlWpN2eD+ 09nDFFKS2suUmx/0/dw+73Q21kH6ryqCbFLfwSxhn6FDXa52VU6V319MxWl7sYiInWwj UFZxKasMLjpWxzs2eKhULZfOQtN8s7GiIVwI1g0ZRMzenozj/ssqcxyE834+bPHRyXw9 o+5w== 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:to:from; bh=xkWg+voS19EROF4wktSzYEA8iN7OkQvGGDNVnX4VziA=; fh=i+pR0Y9t94OKZsARqUkLMEmtPQHvmw7bpTYa9QkhXpo=; b=USFCLqKnFghkCmMGyVpHdHqMzRZ3lIATc5S3H1PbzqcUpxiDh1OBVhEeXjN4Cw7TKA FTAepCVzigRSJEMtwOAvphA/J6scZyrA5gBpo6GVEGwUPpVVRSPGfD3+ZHnvH/3TF1bB LlvA/qFHj+SMN/A00c4+T7Z4xCP5OVXJYw5e1LBpq2p/G3Q8g+NrR0FwYtji09i0655+ yzSc+WIu/PtBMIA55kTkUDHc8hEnX/BiIJ20w8iuFMC8MDKa5Yif7goDwsB+dFSTtjcU PORg0c1TaWpfgjQ/gYWJYHSXqR2X7Gny7W2JveC/e0Rx84hpJTcrY9PMYsFdvDsUkYV6 nLGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6057-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u20-20020a05622a011400b004347a55f3e3si7991893qtw.375.2024.04.09.18.14.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 18:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6057-linux.lists.archive=gmail.com@vger.kernel.org" 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 3B2C11C21267 for ; Wed, 10 Apr 2024 01:14:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3270739B; Wed, 10 Apr 2024 01:14:45 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31E7938D for ; Wed, 10 Apr 2024 01:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712711685; cv=none; b=tvVcTq4Mn6+O3zUr7nKMVKni0jpcJzJl9n1yfVQHdMsVlMUOV+0yea/8GhwZDw/Q0kRHAO7oUJSljjr85mbTrSGPyQMfxPvM+teh5VcNdjiphtBnEmi0VJBzOJQgh+p1eOjuJUOmePMhzYP15X19n9jRekN9cXEE4B2dmGg20Cg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712711685; c=relaxed/simple; bh=rib4XnTpF/aKeutgzCqbtNAqCBPwVHZEj1QZ8HiV64Y=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DO+v0YJmzJlZOkGnuvaeOARC9GJqTMFtfah/rF6rcBJJXyIUk8uvQdpjKKscHIR02QYYlLPOut9Qkr6Z/bkEl+mP6av8GxAEyBkhLKr/Tgzl2fBM04jRvZuR6Zy40F+p2+Ow+SvqK8lmHSNQf7LolNR7JWXYtAsoVPeoJeHicYU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 43A1EcBbA3470120, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 43A1EcBbA3470120 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Apr 2024 09:14:38 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Apr 2024 09:14:39 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Apr 2024 09:14:39 +0800 From: Ping-Ke Shih To: Subject: [PATCH] wifi: rtw89: pci: correct TX resource checking for PCI DMA channel of firmware command Date: Wed, 10 Apr 2024 09:13:16 +0800 Message-ID: <20240410011316.9906-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.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 Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) The DMA channel of firmware command doesn't use TX WD (WiFi descriptor), so don't need to consider number of TX WD as factor of TX resource. Otherwise, during pause state (a transient state to switch to/from low power mode) firmware commands could be dropped and driver throws warnings suddenly: rtw89_8852ce 0000:04:00.0: no tx fwcmd resource rtw89_8852ce 0000:04:00.0: failed to send h2c The case we met is that driver sends RSSI strength of firmware command at RX path that could be running concurrently with switching low power mode. The missing of this firmware command doesn't affect user experiences, because the RSSI strength will be updated again after a while. The DMA descriptors of normal packets has three layers like: +-------+ | TX BD | (*n elements) +-------+ | | +-------+ +-> | TX WD | (*m elements) +-------+ | | +--------+ +-> | SKB | +--------+ And, firmware command queue (TXCH 12) is a special queue that has only two layers: +-------+ | TX BD | (*n elements) +-------+ | | +------------------+ +-> | firmware command | +------------------+ Fixes: 4a29213cd775 ("wifi: rtw89: pci: correct TX resource checking in low power mode") Cc: stable@vger.kernel.org Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index c734f6702546..7b00476a5dee 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -1114,7 +1114,8 @@ u32 __rtw89_pci_check_and_reclaim_tx_resource_noio(struct rtw89_dev *rtwdev, spin_lock_bh(&rtwpci->trx_lock); cnt = rtw89_pci_get_avail_txbd_num(tx_ring); - cnt = min(cnt, wd_ring->curr_num); + if (txch != RTW89_TXCH_CH12) + cnt = min(cnt, wd_ring->curr_num); spin_unlock_bh(&rtwpci->trx_lock); return cnt; -- 2.25.1