From: Tobias Waldekranz <tobias@waldekranz.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, fugang.duan@nxp.com
Subject: [PATCH net-next] net: ethernet: fec: prevent tx starvation under high rx load
Date: Thu, 25 Jun 2020 10:57:28 +0200 [thread overview]
Message-ID: <20200625085728.9869-1-tobias@waldekranz.com> (raw)
In the ISR, we poll the event register for the queues in need of
service and then enter polled mode. After this point, the event
register will never be read again until we exit polled mode.
In a scenario where a UDP flow is routed back out through the same
interface, i.e. "router-on-a-stick" we'll typically only see an rx
queue event initially. Once we start to process the incoming flow
we'll be locked polled mode, but we'll never clean the tx rings since
that event is never caught.
Eventually the netdev watchdog will trip, causing all buffers to be
dropped and then the process starts over again.
By adding a poll of the active events at each NAPI call, we avoid the
starvation.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
drivers/net/ethernet/freescale/fec_main.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 9f80a33c5b16..328fb12ef8db 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1616,8 +1616,17 @@ fec_enet_rx(struct net_device *ndev, int budget)
}
static bool
-fec_enet_collect_events(struct fec_enet_private *fep, uint int_events)
+fec_enet_collect_events(struct fec_enet_private *fep)
{
+ uint int_events;
+
+ int_events = readl(fep->hwp + FEC_IEVENT);
+
+ /* Don't clear MDIO events, we poll for those */
+ int_events &= ~FEC_ENET_MII;
+
+ writel(int_events, fep->hwp + FEC_IEVENT);
+
if (int_events == 0)
return false;
@@ -1643,16 +1652,9 @@ fec_enet_interrupt(int irq, void *dev_id)
{
struct net_device *ndev = dev_id;
struct fec_enet_private *fep = netdev_priv(ndev);
- uint int_events;
irqreturn_t ret = IRQ_NONE;
- int_events = readl(fep->hwp + FEC_IEVENT);
-
- /* Don't clear MDIO events, we poll for those */
- int_events &= ~FEC_ENET_MII;
-
- writel(int_events, fep->hwp + FEC_IEVENT);
- fec_enet_collect_events(fep, int_events);
+ fec_enet_collect_events(fep);
if ((fep->work_tx || fep->work_rx) && fep->link) {
ret = IRQ_HANDLED;
@@ -1673,6 +1675,8 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
struct fec_enet_private *fep = netdev_priv(ndev);
int pkts;
+ fec_enet_collect_events(fep);
+
pkts = fec_enet_rx(ndev, budget);
fec_enet_tx(ndev);
--
2.17.1
next reply other threads:[~2020-06-25 8:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 8:57 Tobias Waldekranz [this message]
2020-06-25 19:19 ` [PATCH net-next] net: ethernet: fec: prevent tx starvation under high rx load David Miller
2020-06-28 6:23 ` [EXT] " Andy Duan
2020-06-29 16:29 ` Tobias Waldekranz
2020-06-30 6:27 ` Andy Duan
2020-06-30 7:30 ` Tobias Waldekranz
2020-06-30 8:26 ` Andy Duan
2020-06-30 8:55 ` Tobias Waldekranz
2020-06-30 9:02 ` Andy Duan
2020-06-30 9:12 ` Tobias Waldekranz
2020-06-30 9:47 ` Andy Duan
2020-06-30 11:01 ` Tobias Waldekranz
2020-07-01 1:27 ` Andy Duan
2020-06-30 13:45 ` Tobias Waldekranz
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=20200625085728.9869-1-tobias@waldekranz.com \
--to=tobias@waldekranz.com \
--cc=davem@davemloft.net \
--cc=fugang.duan@nxp.com \
--cc=netdev@vger.kernel.org \
/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