From patchwork Wed Oct 19 08:25:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212835wrs; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DqHUIc1TKmSzTHhNSPIlvbiUGDnLVofcaByDIZYa0qDqk7WsCIwokzcppg7g1gx4RmHaU X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr6432117edo.2.1666170506082; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170506; cv=none; d=google.com; s=arc-20160816; b=ZAGApwnxVvLOMt+RwFK1CpudjC6/DfaRd+pgvQf224AShTiwQz3NgzBt7GMw/R0/l6 5vtQWth7fZtJtfFDFVr7+Ku0e0Z42OXeqq16h7mwJBdxf4W445Nhs+B5edPbHjErdBzm IYTIMQOQjUkcklkZ/jkiewrTaDReHUW1PuB8l0J6Fox7m4g0nrx9wmTZ+o7eu4Bs2YdK Js50shZpYXXRcbQPGhuifbA55RxNczoF1Q+nZk2/pIyWZ6pvu7V8Osh8VRI56YKsvzNB S2QEFuJwfUMgVyxoFLSR6tNDDlrmrrB5+0ZZZsyeNfYK59qCe5FYZPWceXRemkQLn/qo H5CA== 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=jP35xt3o2gnyjDDa78i6XfEaFjtys+hIX3YztqTlqmw=; b=P9PJwioTt3oJWNbRu6nf7xmuMWLkXhp51AH6gpT131QVwqd+KWOQgPUo/4bmFy61ih viaEf0Lltl7gw3naK/tUF7mOJJimN/PGxIWR1weoeP4acEFtBonedl0Br15i69V/htYV jCD2XJlKKTp+xxh0+lwY4XuJAox18P2lQBBjFau49sRBXSuEDMwN7ZZNLFoySWPe7vvr ngI/DXmvS5mc+Uu9O9iTtLkp1AgfBPLGaj9G2s+DtPI7s+EyWnmoCIB0mBQ7iDWHMz5z KsYqhIVVFW0t5M5+pdk6ocpyZSwhBXARez/qS61ejdaGrIivP4JpetZ9Z5Yx/JzDzNrf aDYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UQPw4dsQ; 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 dd3-20020a1709069b8300b00783d1a13d69si13931751ejc.231.2022.10.19.02.07.57; Wed, 19 Oct 2022 02:08:26 -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=UQPw4dsQ; 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 S232071AbiJSJCg (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbiJSI7t (ORCPT ); Wed, 19 Oct 2022 04:59:49 -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 33FEC57BDC; Wed, 19 Oct 2022 01:55:13 -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 92CC461861; Wed, 19 Oct 2022 08:50:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4979C433C1; Wed, 19 Oct 2022 08:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169400; bh=nEKjydNkPW4o0sHg6DBdaaxBgBMjm9DMWGeP35LsqpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQPw4dsQMnfrJIox3vIRIc1FcUF9+qhn5NkfIcSNdC9D5Bte9ojQ10b6btkau85gk cc8cAKqEyZdV74dwd7HzrO2f6R0eu1PS9N7JBQIdmnEtnxCxulxOp6DhfYe+gyq+DN 39+nkh/Iy/I8T2DLLGvWG3fIr9wsY9MRcV+z94rY= 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 6.0 261/862] wifi: rtw89: pci: correct TX resource checking in low power mode Date: Wed, 19 Oct 2022 10:25:48 +0200 Message-Id: <20221019083301.576592412@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747106404338089192?= X-GMAIL-MSGID: =?utf-8?q?1747106404338089192?= 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 8a093e1cb328..7bb1b494c5d1 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -926,10 +926,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;