diff mbox series

[3/4] mt76: mt7663s: disable interrupt during txrx_worker processing

Message ID f47d7b9c84155c9c6239ed0aa3f378ad3da5bb0e.1601132347.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series convert mt76 sdio to mt76 workers APIs | expand

Commit Message

Lorenzo Bianconi Sept. 26, 2020, 3:06 p.m. UTC
In order to reduce sdio bus contention, disable interrupts during
txrx_worker processing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../wireless/mediatek/mt76/mt7615/sdio_txrx.c | 27 +++++++------------
 1 file changed, 9 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
index 10ed211d7d11..d8f9148fe777 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c
@@ -105,10 +105,7 @@  static int mt7663s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid,
 
 	buf = page_address(page);
 
-	sdio_claim_host(sdio->func);
 	err = sdio_readsb(sdio->func, buf, MCR_WRDR(qid), len);
-	sdio_release_host(sdio->func);
-
 	if (err < 0) {
 		dev_err(dev->dev, "sdio read data failed:%d\n", err);
 		__free_pages(page, order);
@@ -144,14 +141,9 @@  static int mt7663s_rx_handler(struct mt76_dev *dev)
 	struct mt76s_intr *intr = sdio->intr_data;
 	int nframes = 0, ret;
 
-	/* disable interrupt */
-	sdio_claim_host(sdio->func);
-	sdio_writel(sdio->func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, NULL);
 	ret = sdio_readsb(sdio->func, intr, MCR_WHISR, sizeof(*intr));
-	sdio_release_host(sdio->func);
-
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	trace_dev_irq(dev, intr->isr, 0);
 
@@ -173,12 +165,6 @@  static int mt7663s_rx_handler(struct mt76_dev *dev)
 
 	nframes += !!mt7663s_refill_sched_quota(dev, intr->tx.wtqcr);
 
-out:
-	/* enable interrupt */
-	sdio_claim_host(sdio->func);
-	sdio_writel(sdio->func, WHLPCR_INT_EN_SET, MCR_WHLPCR, NULL);
-	sdio_release_host(sdio->func);
-
 	return nframes;
 }
 
@@ -225,10 +211,7 @@  static int __mt7663s_xmit_queue(struct mt76_dev *dev, u8 *data, int len)
 	if (len > sdio->func->cur_blksize)
 		len = roundup(len, sdio->func->cur_blksize);
 
-	sdio_claim_host(sdio->func);
 	err = sdio_writesb(sdio->func, MCR_WTDR1, data, len);
-	sdio_release_host(sdio->func);
-
 	if (err)
 		dev_err(dev->dev, "sdio write failed: %d\n", err);
 
@@ -298,6 +281,10 @@  void mt7663s_txrx_worker(struct mt76_worker *w)
 	struct mt76_dev *dev = container_of(sdio, struct mt76_dev, sdio);
 	int i, nframes, ret;
 
+	/* disable interrupt */
+	sdio_claim_host(sdio->func);
+	sdio_writel(sdio->func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, NULL);
+
 	do {
 		nframes = 0;
 
@@ -313,6 +300,10 @@  void mt7663s_txrx_worker(struct mt76_worker *w)
 		if (ret > 0)
 			nframes += ret;
 	} while (nframes > 0);
+
+	/* enable interrupt */
+	sdio_writel(sdio->func, WHLPCR_INT_EN_SET, MCR_WHLPCR, NULL);
+	sdio_release_host(sdio->func);
 }
 
 void mt7663s_sdio_irq(struct sdio_func *func)