netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Fugang Duan <fugang.duan@nxp.com>, netdev@vger.kernel.org
Cc: patchwork-lst@pengutronix.de, kernel@pengutronix.de
Subject: [PATCH 2/2] net: fec: optimize IRQ handler
Date: Wed,  6 Dec 2017 18:24:59 +0100	[thread overview]
Message-ID: <20171206172459.14059-2-l.stach@pengutronix.de> (raw)
In-Reply-To: <20171206172459.14059-1-l.stach@pengutronix.de>

fep->work_rx and fep->work_tx are both non-zero, as long as the NAPI
softirq hasn't finished its work. So if the current IRQ does not
signal any RX or TX completion, but some unrelated event, the path to
schedule the NAPI context is still entered.

The handler works correctly as in this case napi_schedule_prep() will
reject the scheduling attempt, but the flow can still be optimized by
not trying to schedule if the IRQ doesn't signal RX or TX completion.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 0b70c07eb703..2043e140e9bd 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1587,14 +1587,14 @@ fec_enet_interrupt(int irq, void *dev_id)
 	int_events = readl_relaxed(fep->hwp + FEC_IEVENT) &
 	             readl_relaxed(fep->hwp + FEC_IMASK);
 	writel(int_events, fep->hwp + FEC_IEVENT);
-	fec_enet_collect_events(fep, int_events);
 
-	if ((fep->work_tx || fep->work_rx) && fep->link) {
+	if ((int_events & (FEC_ENET_RXF | FEC_ENET_TXF)) && fep->link) {
 		ret = IRQ_HANDLED;
 
 		if (napi_schedule_prep(&fep->napi)) {
 			/* Disable the NAPI interrupts */
 			writel(FEC_NAPI_IMASK, fep->hwp + FEC_IMASK);
+			fec_enet_collect_events(fep, int_events);
 			__napi_schedule(&fep->napi);
 		}
 	}
-- 
2.11.0

  reply	other threads:[~2017-12-06 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 17:24 [PATCH 1/2] net: fec: don't ack masked interrupt events Lucas Stach
2017-12-06 17:24 ` Lucas Stach [this message]
2017-12-07  3:02   ` [PATCH 2/2] net: fec: optimize IRQ handler Andy Duan
2017-12-06 20:47 ` [PATCH 1/2] net: fec: don't ack masked interrupt events David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206172459.14059-2-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=fugang.duan@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=patchwork-lst@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).