Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1707188ybe; Tue, 3 Sep 2019 02:14:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFRaWCNASF41owDwfvvbnQokGL1z4YLVt4r9yCQGLOMF9/Z9PW9AmlaNYoHXFhzeb5VBEA X-Received: by 2002:aa7:800c:: with SMTP id j12mr36805272pfi.255.1567502096821; Tue, 03 Sep 2019 02:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567502096; cv=none; d=google.com; s=arc-20160816; b=KdGX10s6bwPH6chj/2HOlfwPQld6MYSjHs9GTBG7LgniU2Xs5MwlDLqyKG9sHfBxGK nBmtWtUZtHG95TZmq53XTmw4suaXWz+g3u6AG1xVVSox49E92DPAaNMPYrxmXzzoz/qi nBar1tfnJqqhCcPSm1PuIFFgE64HClnWtDdnQOf03Gy8e0nr6rSS8RtmzmbfpAPEfZjJ SE059Dhp9fzXLQcuO7DLbpErD0pJVP65Sti4MRw1DFWgzXYsJToLNvZsEM+F0RCIQON4 ckD2KtCg160PCuo+/FP3MBdAcAoIt5OS5qlArpLu/vfXV6REP3mLNhbQ18lnmU/hjD9L kQBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=Cj8mxfaYlzlx4Ndwqy6w5Tp4Zbu50ZAipfEbzbGuO3s=; b=M2iDhVPz8ahw1RquHTweqZXQ6EsTknVq4NqsAuDJ7aVRvq9E3OMJXZ5FQHfZhINd7S 7KNLeqK5SFpqAzXfVP/SdvtW5G4t9gnc17pdKBqCanqyGtIp2KoMQaGVUbQQTXtf0T31 OuitR45W6AioZPZ90F6hkL3fzhF3Y2NDJ9aOkQFjS8M3AOyw5WXZzONBGCz9qb1YJ6hP JDlbAa8jg2AnUVwolpopIAEPMG7tuZFR8ildghoO1Xn0SO6EvoHPEe9eA/2OTqLPNt0J 1z2yelwngOuQGtkjeRMCG2Ns1zIbd8HnkG+piQS2Tzq3odlgCe57kSihHRcWVt64LSSY cqMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si14353081pgf.249.2019.09.03.02.14.36; Tue, 03 Sep 2019 02:14:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbfICJO1 (ORCPT + 99 others); Tue, 3 Sep 2019 05:14:27 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:42347 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727005AbfICJO1 (ORCPT ); Tue, 3 Sep 2019 05:14:27 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x839EEDJ027801, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x839EEDJ027801 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 3 Sep 2019 17:14:14 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Tue, 3 Sep 2019 17:14:13 +0800 From: To: CC: , , , , , , , Subject: [PATCH rebased 1/2] rtw88: pci: Move a mass of jobs in hw IRQ to soft IRQ Date: Tue, 3 Sep 2019 17:14:06 +0800 Message-ID: <1567502047-24102-2-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1567502047-24102-1-git-send-email-yhchuang@realtek.com> References: <1567502047-24102-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jian-Hong Pan There is a mass of jobs between spin lock and unlock in the hardware IRQ which will occupy much time originally. To make system work more efficiently, this patch moves the jobs to the soft IRQ (bottom half) to reduce the time in hardware IRQ. Signed-off-by: Jian-Hong Pan Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/pci.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index 00ef229..955dd6c 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -866,12 +866,29 @@ static irqreturn_t rtw_pci_interrupt_handler(int irq, void *dev) { struct rtw_dev *rtwdev = dev; struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; - u32 irq_status[4]; spin_lock(&rtwpci->irq_lock); if (!rtwpci->irq_enabled) goto out; + /* disable RTW PCI interrupt to avoid more interrupts before the end of + * thread function + */ + rtw_pci_disable_interrupt(rtwdev, rtwpci); +out: + spin_unlock(&rtwpci->irq_lock); + + return IRQ_WAKE_THREAD; +} + +static irqreturn_t rtw_pci_interrupt_threadfn(int irq, void *dev) +{ + struct rtw_dev *rtwdev = dev; + struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; + unsigned long flags; + u32 irq_status[4]; + + spin_lock_irqsave(&rtwpci->irq_lock, flags); rtw_pci_irq_recognized(rtwdev, rtwpci, irq_status); if (irq_status[0] & IMR_MGNTDOK) @@ -891,8 +908,9 @@ static irqreturn_t rtw_pci_interrupt_handler(int irq, void *dev) if (irq_status[0] & IMR_ROK) rtw_pci_rx_isr(rtwdev, rtwpci, RTW_RX_QUEUE_MPDU); -out: - spin_unlock(&rtwpci->irq_lock); + /* all of the jobs for this interrupt have been done */ + rtw_pci_enable_interrupt(rtwdev, rtwpci); + spin_unlock_irqrestore(&rtwpci->irq_lock, flags); return IRQ_HANDLED; } @@ -1152,8 +1170,10 @@ static int rtw_pci_probe(struct pci_dev *pdev, goto err_destroy_pci; } - ret = request_irq(pdev->irq, &rtw_pci_interrupt_handler, - IRQF_SHARED, KBUILD_MODNAME, rtwdev); + ret = devm_request_threaded_irq(rtwdev->dev, pdev->irq, + rtw_pci_interrupt_handler, + rtw_pci_interrupt_threadfn, + IRQF_SHARED, KBUILD_MODNAME, rtwdev); if (ret) { ieee80211_unregister_hw(hw); goto err_destroy_pci; @@ -1192,7 +1212,7 @@ static void rtw_pci_remove(struct pci_dev *pdev) rtw_pci_disable_interrupt(rtwdev, rtwpci); rtw_pci_destroy(rtwdev, pdev); rtw_pci_declaim(rtwdev, pdev); - free_irq(rtwpci->pdev->irq, rtwdev); + devm_free_irq(rtwdev->dev, rtwpci->pdev->irq, rtwdev); rtw_core_deinit(rtwdev); ieee80211_free_hw(hw); } -- 2.7.4