Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4150955pxa; Mon, 10 Aug 2020 02:00:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZPbSlwWeQ1QQVnZ1nE4xhBmAnfkjGc3/klOnq58iF23OZPGu/UeBUSgj/A7rQ2q6sufgH X-Received: by 2002:a17:906:f847:: with SMTP id ks7mr21694517ejb.402.1597050024659; Mon, 10 Aug 2020 02:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597050024; cv=none; d=google.com; s=arc-20160816; b=x0nGKhv94TVDXTMNtyJ/oDBsSAMXIFgq1S6jT9Oc1gXSt4D2NU8AKx+xvz2Nh7J2u+ e7Qa3l1DALknzGu5Tjz3RwfT2+sdQm4z11INIlPdA3e2dvsxoRIbxLL8ooQRZix6qYjT AaD/PmbGYDWPSP8xI9gSN3psHPkqFK00fYrhohYhUXIciv3nzhU+5GNnqqSHN5Zo7Bcx IvWP0CxrSipiCAMlA4RfkmaT5YAfb+8rAWqqLKxe3i4DHeY7gUkVSOgtR0WGGm5EqQN5 lwvhqpS3OhGgzmS4jEZZeup5hwTfSSfbk5kVI12H2Dx25MOdbfy1d24PSfknqXbT4V8Q 94/w== 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:to:from :dkim-signature; bh=eygD9HeAHdonIJ/fF2KL4r1c9/o5pFJ/6XhIOIYvZEM=; b=vs0Ley0QMEWXBJjfRK3sQ0JX471FFynhbVi3AbHIxQ/XzI+iI8R9X11fyKh8Tj/FI+ waBbayXgExN1STbcIQ0/zndtAoscrRWeMfgPWk2iOnWxxq7iPZf4xHUuGHsHMEvgxTwO J7sM1WeDZxfELkSZ3ksNyeUjwr/njLIeCGD82tFdg+fy4s95xqHQrkB0cXUo/O4ZiqZF kOqLxqCgbb29aOJPikY+8CAdPg5VrYB9QxCv7WhdFotT9iE7sh5mG4qrRnP8Zdv7Eitt mSAa5Dt6j00HvqBNxfR90+Vw5KtHG5gq/bp0EI5fsu9xIYFm7gcyf8x7TC8NU+cxfPt9 02kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=K86tOoWF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si11723326ejq.427.2020.08.10.02.00.01; Mon, 10 Aug 2020 02:00:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=K86tOoWF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbgHJI6i (ORCPT + 99 others); Mon, 10 Aug 2020 04:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbgHJI6h (ORCPT ); Mon, 10 Aug 2020 04:58:37 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D022C06178A for ; Mon, 10 Aug 2020 01:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eygD9HeAHdonIJ/fF2KL4r1c9/o5pFJ/6XhIOIYvZEM=; b=K86tOoWFxzFfRu3gmIPqSTugsN 6dOYpNSEb6WvWy3nFbJmm4+SUeNI6pVDx/ufn5xN6/YU7x7WybzTk4thwWcTmq/tpNuy7gqW4qlcY uf4K0QuYwOnIkUGTh6Y+4I7F/kgET3kFKSbZaaBnWXcRmmUh53PqA6yoFhnzrz52AuHM=; Received: from p54ae996c.dip0.t-ipconnect.de ([84.174.153.108] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1k53da-0003XJ-E4 for linux-wireless@vger.kernel.org; Mon, 10 Aug 2020 10:58:34 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 4/6] mt76: mt76x02: clean up and fix interrupt masking in the irq handler Date: Mon, 10 Aug 2020 10:58:30 +0200 Message-Id: <20200810085832.65662-4-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810085832.65662-1-nbd@nbd.name> References: <20200810085832.65662-1-nbd@nbd.name> 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 Only clear unmasked interrupts. If an interrupt is temporarily masked, its pending events need to be processed later, even if another interrupt happened in the mean time. Disable interrupts in one call before scheduling Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c index 99611515a093..20db80849b09 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c @@ -263,9 +263,10 @@ EXPORT_SYMBOL_GPL(mt76x02_rx_poll_complete); irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) { struct mt76x02_dev *dev = dev_instance; - u32 intr; + u32 intr, mask; intr = mt76_rr(dev, MT_INT_SOURCE_CSR); + intr &= dev->mt76.mmio.irqmask; mt76_wr(dev, MT_INT_SOURCE_CSR, intr); if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) @@ -273,17 +274,17 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask); - intr &= dev->mt76.mmio.irqmask; + mask = intr & (MT_INT_RX_DONE_ALL | MT_INT_GPTIMER); + if (intr & (MT_INT_TX_DONE_ALL | MT_INT_TX_STAT)) + mask |= MT_INT_TX_DONE_ALL; + + mt76x02_irq_disable(dev, mask); - if (intr & MT_INT_RX_DONE(0)) { - mt76x02_irq_disable(dev, MT_INT_RX_DONE(0)); + if (intr & MT_INT_RX_DONE(0)) napi_schedule(&dev->mt76.napi[0]); - } - if (intr & MT_INT_RX_DONE(1)) { - mt76x02_irq_disable(dev, MT_INT_RX_DONE(1)); + if (intr & MT_INT_RX_DONE(1)) napi_schedule(&dev->mt76.napi[1]); - } if (intr & MT_INT_PRE_TBTT) tasklet_schedule(&dev->mt76.pre_tbtt_tasklet); @@ -299,15 +300,11 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) if (intr & MT_INT_TX_STAT) mt76x02_mac_poll_tx_status(dev, true); - if (intr & (MT_INT_TX_STAT | MT_INT_TX_DONE_ALL)) { - mt76x02_irq_disable(dev, MT_INT_TX_DONE_ALL); + if (intr & (MT_INT_TX_STAT | MT_INT_TX_DONE_ALL)) napi_schedule(&dev->mt76.tx_napi); - } - if (intr & MT_INT_GPTIMER) { - mt76x02_irq_disable(dev, MT_INT_GPTIMER); + if (intr & MT_INT_GPTIMER) tasklet_schedule(&dev->dfs_pd.dfs_tasklet); - } return IRQ_HANDLED; } -- 2.28.0