Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp134967pxy; Wed, 21 Apr 2021 21:14:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/YkbuZsdIlknoTuj3TFFPo6A1Zz4tqgQ9QvBssDwHHQNNCq7mmRLmusFBWGaO+qDm8eX6 X-Received: by 2002:a17:906:70c4:: with SMTP id g4mr1179595ejk.443.1619064875562; Wed, 21 Apr 2021 21:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619064875; cv=none; d=google.com; s=arc-20160816; b=KQ6W4xOyfGrwIr0yuxqgLYwaNZskRQSWVYTj+qEkHqE3u5coxzFXr3eh6/UUuCQuc3 KCYumTg7tiIaSaNqI8EP3kt+T3sHjdq8m7npWVWo4e6nRp39vQy9UL4+2crQeivjUpSt 1VFYa4tjhlVcTteQ5nmKPj8AtvSp19fYUsOq7/h6akTq96A+ZqWLLr0ILR7aPMtEinbp 4Hp+HpoIhgn2TQ3COWWShtr/KEoTLl2XMvFImGt14wxeR9JlN/+JnHLImh//aQgKJkQC 1LQPamcghvBFMZ04kfOE5nZn8hAz7RM/0U+4TCfTkHeWPxOWv3nznRrFfXReXLU+U0q4 x0OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9BOejhcXoXhyXTSBmLuvv47XDq5x1HtwxwRsIb2foI0=; b=GV/uuvgo6A6c8cgMg3P26JUv8sggIqHSjiWCgRByYNoPAcFLg/YxX3wuiimsRoS4kh 86GtLgalNgwcveiBx6wbExgAuy0V7fXYykTLXje1FrKc0QGGB4nOCZoIE5/eVHwQLZu+ cSR+/G2YUTHscTVe3cGIQuQAw0EjcAqbc3CGMy2k2Kr7tEw4jF3pGlUIALZBkC0f56ky SvoWz2NtV2GM727F0vR9eeCHc9wClf5ubL8UsS+4es4wht8/QU+YawJlZlJd519DVzxb eMMnxVsukxdoXAsHuFqOQUOtRLtUJ5icuM3TOlrKQtGZ9DQ1GxXMr5yhQIYutC7P7peM dK7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kXLXNAS4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si1169691ejv.401.2021.04.21.21.14.12; Wed, 21 Apr 2021 21:14:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kXLXNAS4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235169AbhDVEL0 (ORCPT + 99 others); Thu, 22 Apr 2021 00:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234686AbhDVEKW (ORCPT ); Thu, 22 Apr 2021 00:10:22 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC25C06138B; Wed, 21 Apr 2021 21:09:48 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id em21-20020a17090b0155b029014e204a81e6so2020419pjb.1; Wed, 21 Apr 2021 21:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9BOejhcXoXhyXTSBmLuvv47XDq5x1HtwxwRsIb2foI0=; b=kXLXNAS45PBewZl46uLw8yvajpf7UbKUWcXnUL7NxHB1rIq7y4NE3XI+kwO9y5mIlr RFcLwrUkVE1FEoXGQ9mEy9cMIlCyCFFXVssKp7SbCTUr+Zwn7ROumRk88XmThh3lNj8E zmiYac46vrstHv+nl9kQ0eUJjTYTvTkE28VYEbN/Hx295dvNUAcJgZOINDnWx1CxcvvJ SWp845sDxxvOJIJQmKZcd0XUBr/HqiijzZLkKAU3gCuJbguTny1vspGg+up5NkSh2TPy IyJIfofltt2JleFHax76OlALlkddx/4UeMcD46q3mtt6v/MHccEkq9y7Uiz3ZjHOoToD qVVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9BOejhcXoXhyXTSBmLuvv47XDq5x1HtwxwRsIb2foI0=; b=Z8GwnZdDo6nqwMhiWUfSoGIooXMUZDMr+Lbe/oN69wMzVTFFn8OHIIQep86PCKUw7w QV6yM7SE4kyGLwPGb70jxO8Ac9OvWuJZ2rcfICfgi0aNISoClQ29LR2TcgNaUdUrfoDT WTX1TM4pP2xDmq3Y+SNVgxVflE7pj4/cJLRSNv4yHWNJXkpJblYHPQ3QsSH3eMrEWt8R PnXWFXzGd+yE8954WsBFR73ENgW5nOLL0STuMYwoTc0PjDew9p075wAtYYOhq7e2Gc0S pyfJAIZfLyQUzYfhXribZLi5i6YMgSC5lVahA8I0PmsrFZtcInNtFqv4+uiOf+9ORPgK 07Kg== X-Gm-Message-State: AOAM530wlrh7uKcN+izOtK5BeusaHM4SKLMwXXbvOHJS5M5q5fCfh76j zkdS0VjIxx5BDyGMbGZ6zpM= X-Received: by 2002:a17:902:cec3:b029:eb:5441:9897 with SMTP id d3-20020a170902cec3b02900eb54419897mr1387610plg.48.1619064587945; Wed, 21 Apr 2021 21:09:47 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id i17sm635354pfd.84.2021.04.21.21.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 21:09:47 -0700 (PDT) From: Ilya Lipnitskiy To: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: Ilya Lipnitskiy Subject: [PATCH net-next 12/14] net: ethernet: mtk_eth_soc: reduce unnecessary interrupts Date: Wed, 21 Apr 2021 21:09:12 -0700 Message-Id: <20210422040914.47788-13-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210422040914.47788-1-ilya.lipnitskiy@gmail.com> References: <20210422040914.47788-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau Avoid rearming interrupt if napi_complete returns false Signed-off-by: Felix Fietkau Signed-off-by: Ilya Lipnitskiy --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 5a531bb83348..88a437f478fd 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1517,8 +1517,8 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget) if (status & MTK_TX_DONE_INT) return budget; - napi_complete(napi); - mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); + if (napi_complete(napi)) + mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); return tx_done; } @@ -1551,8 +1551,9 @@ static int mtk_napi_rx(struct napi_struct *napi, int budget) remain_budget -= rx_done; goto poll_again; } - napi_complete(napi); - mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); + + if (napi_complete(napi)) + mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); return rx_done + budget - remain_budget; } -- 2.31.1