Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6159568yba; Wed, 1 May 2019 07:07:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlM4h8CfegZhYDKZf0kVCBlL3hJoRM2OgYkp0rv5e6GuvPNVlFqMnlb508Hce9OouH3LKo X-Received: by 2002:a63:5c4c:: with SMTP id n12mr14558430pgm.111.1556719652770; Wed, 01 May 2019 07:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556719652; cv=none; d=google.com; s=arc-20160816; b=AS4D7kR7uJ0GqRsVHT6da99Xms5yjm5C+u+4vuPOSPrmsgF+K4qIuxswS5llP2liuL IfPbOyY9W1k60m7WjAMQRpnDSJL3q/LEZNTY7gj2fcxOa/WEqUhvm+uvV+pUOX6U8JwA 5EbbMlANakhKW/tWsBfzKCJ5L/4iHhd60hqnbIDiycSkbE+PKjDtPlQQnlD9K0tS8059 X6cZFhgq/7g2rXHj+i+AqRavcajZspvZSJOamHNAJOOxvmhyPTaNg6d4N6n6hqrsi/4N zBHi8woee5HKHJ4YIm1FF4vn/mjWdQgyC+mdb7Q+9YzvMBBO3gEcExD4uyqq0yIl1bxD Z5Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aarz0sRNFXkYPadgqErPO9B0iI3dvbhYA+eBZEKilDU=; b=Wn5JXYjP0SIwCLSrX5/LdnCBm2XsLXWHWm1V4Di+HLln7CtqB4Aeubmn/kShm2TTru x2N3Cq74jB8/xW/UE6NiRL9hPGvLgP6VL6qKe3AfA2Dp4jSY6aUQQu+zu9QF4WYmwVHE hLbZK/7Ro7+2JZ5dIIIR388cLpJhv8dbDOq/tRTuQGbPGG1/Ou4CpYfYL/TPknsugFPg A0HHK4DkUkb+70eBylNPY1XrMr27+TUd5dIvYWcU1IIqf2Ptv7IH/PubaUfsADnMWRCe h3NTiBamzP+FmDfpBf/F9wZV/+2z37ySO7bEkUqTQnaGL8kaXPeJYYJN9psZ5/HEUnSE 643A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nI7tZfMS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63si11666470pld.163.2019.05.01.07.07.17; Wed, 01 May 2019 07:07:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=nI7tZfMS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbfEAOGg (ORCPT + 99 others); Wed, 1 May 2019 10:06:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbfEAOGf (ORCPT ); Wed, 1 May 2019 10:06:35 -0400 Received: from localhost.localdomain (unknown [151.66.22.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74D7A21743; Wed, 1 May 2019 14:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556719594; bh=6GX7v7/QsbdqdUMosA0N0lZ4+59+x84xLBID8hIHyrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nI7tZfMSIKOj5W5cRHnLD/HHDggCWkyleJNr6Q+jENH7EIhFxfEXVC66Ugav09ZZ6 KOnr61zPtP2iwdLpYXSAH0nI1xsHzM4Uwf5bhkoKqeXrW5QlSQMe+eIBxiyht9brP2 k/J7VVfIosGwjpmki+hfEGWSw702C32kOz+Sl37k= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com Subject: [PATCH 3/4] mt76: mt7615: use napi polling for tx cleanup Date: Wed, 1 May 2019 16:06:22 +0200 Message-Id: <488b198a0efdeebe3d7696f6e4169367c286f35c.1556718795.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This allows tx scheduling and tx cleanup to run concurrently Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7615/dma.c | 24 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7615/pci.c | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c index 3ec6582afd8f..9c565c93988a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/dma.c @@ -93,18 +93,33 @@ void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, static void mt7615_tx_tasklet(unsigned long data) { struct mt7615_dev *dev = (struct mt7615_dev *)data; + + mt76_txq_schedule_all(&dev->mt76); +} + +static int mt7615_poll_tx(struct napi_struct *napi, int budget) +{ static const u8 queue_map[] = { MT_TXQ_MCU, MT_TXQ_BE }; + struct mt7615_dev *dev; int i; + dev = container_of(napi, struct mt7615_dev, mt76.tx_napi); + for (i = 0; i < ARRAY_SIZE(queue_map); i++) mt76_queue_tx_cleanup(dev, queue_map[i], false); - mt76_txq_schedule_all(&dev->mt76); + if (napi_complete_done(napi, 0)) + mt7615_irq_enable(dev, MT_INT_TX_DONE_ALL); - mt7615_irq_enable(dev, MT_INT_TX_DONE_ALL); + for (i = 0; i < ARRAY_SIZE(queue_map); i++) + mt76_queue_tx_cleanup(dev, queue_map[i], false); + + tasklet_schedule(&dev->mt76.tx_tasklet); + + return 0; } int mt7615_dma_init(struct mt7615_dev *dev) @@ -178,6 +193,10 @@ int mt7615_dma_init(struct mt7615_dev *dev) if (ret < 0) return ret; + netif_tx_napi_add(&dev->mt76.napi_dev, &dev->mt76.tx_napi, + mt7615_poll_tx, NAPI_POLL_WEIGHT); + napi_enable(&dev->mt76.tx_napi); + mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY | MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 1000); @@ -201,5 +220,6 @@ void mt7615_dma_cleanup(struct mt7615_dev *dev) mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_SW_RESET); tasklet_kill(&dev->mt76.tx_tasklet); + netif_napi_del(&dev->mt76.tx_napi); mt76_dma_cleanup(&dev->mt76); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci.c index 11122bd2d727..10a249e13a43 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci.c @@ -49,7 +49,7 @@ irqreturn_t mt7615_irq_handler(int irq, void *dev_instance) if (intr & MT_INT_TX_DONE_ALL) { mt7615_irq_disable(dev, MT_INT_TX_DONE_ALL); - tasklet_schedule(&dev->mt76.tx_tasklet); + napi_schedule(&dev->mt76.tx_napi); } if (intr & MT_INT_RX_DONE(0)) { -- 2.20.1