[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <HE1PR0401MB226587C107FF6E4C8E67CECEFF330@HE1PR0401MB2265.eurprd04.prod.outlook.com>
Date: Thu, 7 Dec 2017 03:02:58 +0000
From: Andy Duan <fugang.duan@....com>
To: Lucas Stach <l.stach@...gutronix.de>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "patchwork-lst@...gutronix.de" <patchwork-lst@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>
Subject: RE: [PATCH 2/2] net: fec: optimize IRQ handler
From: Lucas Stach <l.stach@...gutronix.de> Sent: Thursday, December 07, 2017 1:25 AM
>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@...gutronix.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
The patch seems fine, and patch#1 is better to cache imask as David's comment.
Thanks.
Acked-by: Fugang Duan <fugang.duan@....com>
Powered by blists - more mailing lists