From: Sven Van Asbroeck <thesven73@gmail.com>
To: Bryan Whitehead <bryan.whitehead@microchip.com>,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
David S Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: Sven Van Asbroeck <thesven73@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v1 1/2] lan743x: improve performance: fix rx_napi_poll/interrupt ping-pong
Date: Sat, 5 Dec 2020 22:44:07 -0500 [thread overview]
Message-ID: <20201206034408.31492-1-TheSven73@gmail.com> (raw)
From: Sven Van Asbroeck <thesven73@gmail.com>
Even if the rx ring is completely full, and there is more rx data
waiting on the chip, the rx napi poll fn will never run more than
once - it will always immediately bail out and re-enable interrupts.
Which results in ping-pong between napi and interrupt.
This defeats the purpose of napi, and is bad for performance.
Fix by addressing two separate issues:
1. Ensure the rx napi poll fn always updates the rx ring tail
when returning, even when not re-enabling interrupts.
2. Up to half of elements in a full rx ring are extension
frames, which do not generate any skbs. Limit the default
napi weight to the smallest no. of skbs that can be generated
by a full rx ring.
Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
---
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git # 905b2032fa42
To: Bryan Whitehead <bryan.whitehead@microchip.com>
To: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
To: "David S. Miller" <davem@davemloft.net>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
drivers/net/ethernet/microchip/lan743x_main.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 87b6c59a1e03..ebb5e0bc516b 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2260,10 +2260,11 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight)
INT_BIT_DMA_RX_(rx->channel_number));
}
+done:
/* update RX_TAIL */
lan743x_csr_write(adapter, RX_TAIL(rx->channel_number),
rx_tail_flags | rx->last_tail);
-done:
+
return count;
}
@@ -2405,9 +2406,15 @@ static int lan743x_rx_open(struct lan743x_rx *rx)
if (ret)
goto return_error;
+ /* up to half of elements in a full rx ring are
+ * extension frames. these do not generate skbs.
+ * to prevent napi/interrupt ping-pong, limit default
+ * weight to the smallest no. of skbs that can be
+ * generated by a full rx ring.
+ */
netif_napi_add(adapter->netdev,
&rx->napi, lan743x_rx_napi_poll,
- rx->ring_size - 1);
+ (rx->ring_size - 1) / 2);
lan743x_csr_write(adapter, DMAC_CMD,
DMAC_CMD_RX_SWR_(rx->channel_number));
--
2.17.1
next reply other threads:[~2020-12-06 4:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-06 3:44 Sven Van Asbroeck [this message]
2020-12-06 3:44 ` [PATCH net v1 2/2] lan743x: boost performance: limit PCIe bandwidth requirement Sven Van Asbroeck
2020-12-08 19:43 ` Jakub Kicinski
2020-12-08 21:54 ` Sven Van Asbroeck
2020-12-08 22:51 ` Andrew Lunn
2020-12-08 23:02 ` Sven Van Asbroeck
2020-12-08 23:07 ` Jakub Kicinski
2020-12-08 23:36 ` Florian Fainelli
2020-12-09 1:22 ` Andrew Lunn
2020-12-09 3:49 ` Sven Van Asbroeck
2020-12-09 14:09 ` Andrew Lunn
2020-12-17 0:57 ` Sven Van Asbroeck
2020-12-17 1:01 ` Florian Fainelli
2020-12-17 3:18 ` Sven Van Asbroeck
2020-12-08 23:13 ` Jakub Kicinski
2020-12-08 19:50 ` [PATCH net v1 1/2] lan743x: improve performance: fix rx_napi_poll/interrupt ping-pong Jakub Kicinski
2020-12-08 22:23 ` Sven Van Asbroeck
2020-12-08 23:29 ` Jakub Kicinski
2020-12-08 23:50 ` Eric Dumazet
2020-12-09 0:17 ` Sven Van Asbroeck
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=20201206034408.31492-1-TheSven73@gmail.com \
--to=thesven73@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).