From patchwork Tue Sep 26 22:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 726678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6BE8E7F143 for ; Tue, 26 Sep 2023 23:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbjIZXUL (ORCPT ); Tue, 26 Sep 2023 19:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbjIZXSK (ORCPT ); Tue, 26 Sep 2023 19:18:10 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A48F649C5 for ; Tue, 26 Sep 2023 15:20:35 -0700 (PDT) X-UUID: e50090465cba11ee8051498923ad61e6-20230927 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=wh7XXbbE9dPhO5x00gz66x2RM9r1g2P9zNdBAYceaHc=; b=CQdhlxEQ0/08MAcm7FY+C22YAfc8PZmuiWZd3xltME52oH0vYu3TvqDzy05BeCBQa/BYJUg42tz2Xt8xd88M+Tci69b6DXaa+jcgH6RB7Ptcp5yly5CfpPBHXttkyKrisXaEj7rBPD3XzN+R5P2NuhD1VdqVFLdY9UMHryHdQnQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32, REQID:97b0cf78-54b3-4d65-b032-d1c9e2c34124, IP:0, U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9, CLOUDID:d85d6814-4929-4845-9571-38c601e9c3c9, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: e50090465cba11ee8051498923ad61e6-20230927 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1377897361; Wed, 27 Sep 2023 06:20:27 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 27 Sep 2023 06:20:26 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 27 Sep 2023 06:20:26 +0800 From: To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH] wifi: mt76: reduce spin_lock_bh held up in mt76_dma_rx_cleanup Date: Wed, 27 Sep 2023 06:20:25 +0800 Message-ID: <4983e1bf8f5e707a67bf6b04a0cbdce359110f48.1695766375.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang mt76_dma_rx_cleanup would be frequenetly called up to reset the dma rings to be freshed as new ones when switching back from the deep sleep mode to the active mode on mt7921 and mt7922. Shrink the scope of spin_lock_bh in mt76_dma_rx_cleanup being held up to allow the kernel scheduler to be able to switch other tasks in time by reducing the latency. Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/dma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 643e18ebb5ee..5f31d4d6a640 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -739,16 +739,18 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q) if (!q->ndesc) return; - spin_lock_bh(&q->lock); - do { + spin_lock_bh(&q->lock); buf = mt76_dma_dequeue(dev, q, true, NULL, NULL, &more, NULL); + spin_unlock_bh(&q->lock); + if (!buf) break; mt76_put_page_pool_buf(buf, false); } while (1); + spin_lock_bh(&q->lock); if (q->rx_head) { dev_kfree_skb(q->rx_head); q->rx_head = NULL;