From patchwork Sat Oct 22 07:21:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092405wrr; Sat, 22 Oct 2022 00:54:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4g4S8o/VzudfVcS3BA+86PHeqx7IS4y4oXQA3V5mnITtSvu/FW5tmyQ1MdwCcMUJG4XCOz X-Received: by 2002:a17:902:e5c5:b0:186:5f09:8468 with SMTP id u5-20020a170902e5c500b001865f098468mr14584155plf.122.1666425241228; Sat, 22 Oct 2022 00:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425241; cv=none; d=google.com; s=arc-20160816; b=D6CVkQ3jHboTTTF1XEGbvfJJneNXm7euIjVCSuNX1qMoj95CVKmoADZFibcLSmVDL6 1942Mir30B6A6HUU8BCacrQB3X+N946uBa5FrN7DgDTMfYrax3To7/u4tXE47t9mV4GN vHoCiE4Kw/8ToBZDIAMaIpzGl1GDtozWh3D/LKbyuXSVBw6RpoD4ek0AqPATHQ2oKBLE pq7t37vDhFCFmwyMDAdWTFchQ2clPW8nNfj+H2c4/b8vAFSP8ZNvlcUNRc7iGaXEIxr+ psIHqiOPFHgB8IBiPCOvDi9iOvJaejKcqRd57sUO7gJbpDorVmmOohdbTjHrhn9u22OR EM1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QpiBZfZVRfgjy/AxJugodVDoLnYT8datCg8RlGRLZU0=; b=kZS1aAB+k+qJC9GPqM7qXkgjpxLEuyzOlhiigMD8oC1ymOYhQPHi9nesqS+h+Yy46S EzKMQWh4lDOGV7bb/wkzVMU/rOtB/UtZ/7Darhf/CUlYmpaF+Oz+virrcaiCayWiWsFm kUUBnOlhwZWZPry6vmsq/9ZWPeqao36JTU6+ob8dVfXEuBFHUAdr6U4GbjIw2YSuSC2y 4vcYctI2BPszXwP0t1L442G8QmNj7M2fiDssKdIV7i/dH6ochcSo/BPRpyO8ZjcSofrc tNWhTkZAPvlndQKFX5FFmkNj56VGaaRqyrpVwukSH43mIafSXNheczXrOltBvtKCVJU9 1izg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E04x2Jxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a170903231000b0017f762e2dc6si32120465plh.613.2022.10.22.00.53.47; Sat, 22 Oct 2022 00:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E04x2Jxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232016AbiJVHxe (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbiJVHvU (ORCPT ); Sat, 22 Oct 2022 03:51:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1E57AC2AC; Sat, 22 Oct 2022 00:46:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C39E60ADB; Sat, 22 Oct 2022 07:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F1A9C433D6; Sat, 22 Oct 2022 07:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424655; bh=9B4auItuu6R+2k1KwQ4JjfFlpPatjo0qE5hU/icNkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E04x2Jxba970tn4ZmTAV5dlK8pwrCyR1QbCs08ZV+7SWC3XDz/wtWdnk1KVrsMC+7 aXtJO/EVBlKK277zQQ8o9AHmv0QjXnthtY+OWeKn/wQVDLO26oqngWm9SLP6Y+AoMy 5oTogm2dgXMYgRJT8eunL0sTClD9+VZVTomM/t1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 225/717] wifi: rtw89: pci: correct TX resource checking in low power mode Date: Sat, 22 Oct 2022 09:21:44 +0200 Message-Id: <20221022072454.934918734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373513873261525?= X-GMAIL-MSGID: =?utf-8?q?1747373513873261525?= From: Ping-Ke Shih [ Upstream commit 4a29213cd775cabcbe395229d175903accedbb9d ] Number of TX resource must be minimum of TX_BD and TX_WD. Only considering TX_BD could drop TX packets pulled from mac80211 if TX_WD is unavailable. Fixes: 52edbb9fb78a ("rtw89: ps: access TX/RX rings via another registers in low power mode") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220824063312.15784-2-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index 622f95bc3ffc..bc8132e91992 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -922,10 +922,12 @@ u32 __rtw89_pci_check_and_reclaim_tx_resource_noio(struct rtw89_dev *rtwdev, { struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch]; + struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; u32 cnt; spin_lock_bh(&rtwpci->trx_lock); cnt = rtw89_pci_get_avail_txbd_num(tx_ring); + cnt = min(cnt, wd_ring->curr_num); spin_unlock_bh(&rtwpci->trx_lock); return cnt;