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 2/2] lan743x: boost performance: limit PCIe bandwidth requirement
Date: Sat, 5 Dec 2020 22:44:08 -0500 [thread overview]
Message-ID: <20201206034408.31492-2-TheSven73@gmail.com> (raw)
In-Reply-To: <20201206034408.31492-1-TheSven73@gmail.com>
From: Sven Van Asbroeck <thesven73@gmail.com>
To support jumbo frames, each rx ring dma buffer is 9K in size.
But the chip only stores a single frame per dma buffer.
When the chip is working with the default 1500 byte MTU, a 9K
dma buffer goes from chip -> cpu per 1500 byte frame. This means
that to get 1G/s ethernet bandwidth, we need 6G/s PCIe bandwidth !
Fix by limiting the rx ring dma buffer size to the current MTU
size.
Tested with iperf3 on a freescale imx6 + lan7430, both sides
set to mtu 1500 bytes.
Before:
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 483 MBytes 203 Mbits/sec 0
After:
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 1.15 GBytes 496 Mbits/sec 0
And with both sides set to MTU 9000 bytes:
Before:
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 1.87 GBytes 803 Mbits/sec 27
After:
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 1.98 GBytes 849 Mbits/sec 0
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 | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index ebb5e0bc516b..2bded1c46784 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1957,11 +1957,11 @@ static int lan743x_rx_next_index(struct lan743x_rx *rx, int index)
static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx)
{
- int length = 0;
+ struct net_device *netdev = rx->adapter->netdev;
- length = (LAN743X_MAX_FRAME_SIZE + ETH_HLEN + 4 + RX_HEAD_PADDING);
- return __netdev_alloc_skb(rx->adapter->netdev,
- length, GFP_ATOMIC | GFP_DMA);
+ return __netdev_alloc_skb(netdev,
+ netdev->mtu + ETH_HLEN + 4 + RX_HEAD_PADDING,
+ GFP_ATOMIC | GFP_DMA);
}
static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index,
@@ -1969,9 +1969,10 @@ static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index,
{
struct lan743x_rx_buffer_info *buffer_info;
struct lan743x_rx_descriptor *descriptor;
- int length = 0;
+ struct net_device *netdev = rx->adapter->netdev;
+ int length;
- length = (LAN743X_MAX_FRAME_SIZE + ETH_HLEN + 4 + RX_HEAD_PADDING);
+ length = netdev->mtu + ETH_HLEN + 4 + RX_HEAD_PADDING;
descriptor = &rx->ring_cpu_ptr[index];
buffer_info = &rx->buffer_info[index];
buffer_info->skb = skb;
@@ -2157,8 +2158,8 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
int index = first_index;
/* multi buffer packet not supported */
- /* this should not happen since
- * buffers are allocated to be at least jumbo size
+ /* this should not happen since buffers are allocated
+ * to be at least the mtu size configured in the mac.
*/
/* clean up buffers */
@@ -2632,9 +2633,13 @@ static int lan743x_netdev_change_mtu(struct net_device *netdev, int new_mtu)
struct lan743x_adapter *adapter = netdev_priv(netdev);
int ret = 0;
+ if (netif_running(netdev))
+ return -EBUSY;
+
ret = lan743x_mac_set_mtu(adapter, new_mtu);
if (!ret)
netdev->mtu = new_mtu;
+
return ret;
}
--
2.17.1
next prev parent 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 [PATCH net v1 1/2] lan743x: improve performance: fix rx_napi_poll/interrupt ping-pong Sven Van Asbroeck
2020-12-06 3:44 ` Sven Van Asbroeck [this message]
2020-12-08 19:43 ` [PATCH net v1 2/2] lan743x: boost performance: limit PCIe bandwidth requirement 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-2-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).