Skip to content

Commit 9667263

Browse files
pbrkrPaolo Abeni
authored andcommitted
net: ravb: Allocate RX buffers via page pool
This patch makes multiple changes that can't be separated: 1) Allocate plain RX buffers via a page pool instead of allocating SKBs, then use build_skb() when a packet is received. 2) For GbEth IP, reduce the RX buffer size to 2kB. 3) For GbEth IP, merge packets which span more than one RX descriptor as SKB fragments instead of copying data. Implementing (1) without (2) would require the use of an order-1 page pool (instead of an order-0 page pool split into page fragments) for GbEth. Implementing (2) without (3) would leave us no space to re-assemble packets which span more than one RX descriptor. Implementing (3) without (1) would not be possible as the network stack expects to use put_page() or page_pool_put_page() to free SKB fragments after an SKB is consumed. RX checksum offload support is adjusted to handle both linear and nonlinear (fragmented) packets. This patch gives the following improvements during testing with iperf3. * RZ/G2L: * TCP RX: same bandwidth at -43% CPU load (70% -> 40%) * UDP RX: same bandwidth at -17% CPU load (88% -> 74%) * RZ/G2UL: * TCP RX: +30% bandwidth (726Mbps -> 941Mbps) * UDP RX: +417% bandwidth (108Mbps -> 558Mbps) * RZ/G3S: * TCP RX: +64% bandwidth (562Mbps -> 920Mbps) * UDP RX: +420% bandwidth (90Mbps -> 468Mbps) * RZ/Five: * TCP RX: +217% bandwidth (145Mbps -> 459Mbps) * UDP RX: +470% bandwidth (20Mbps -> 114Mbps) There is no significant impact on bandwidth or CPU load in testing on RZ/G2H or R-Car M3N. Signed-off-by: Paul Barker <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 65c482b commit 9667263

File tree

2 files changed

+175
-96
lines changed

2 files changed

+175
-96
lines changed

drivers/net/ethernet/renesas/ravb.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/phy.h>
2020
#include <linux/platform_device.h>
2121
#include <linux/ptp_clock_kernel.h>
22+
#include <net/page_pool/types.h>
2223

2324
#define BE_TX_RING_SIZE 64 /* TX ring size for Best Effort */
2425
#define BE_RX_RING_SIZE 1024 /* RX ring size for Best Effort */
@@ -1051,7 +1052,7 @@ struct ravb_hw_info {
10511052
int stats_len;
10521053
u32 tccr_mask;
10531054
u32 rx_max_frame_size;
1054-
u32 rx_max_desc_use;
1055+
u32 rx_buffer_size;
10551056
u32 rx_desc_size;
10561057
unsigned aligned_tx: 1;
10571058
unsigned coalesce_irqs:1; /* Needs software IRQ coalescing */
@@ -1071,6 +1072,11 @@ struct ravb_hw_info {
10711072
unsigned half_duplex:1; /* E-MAC supports half duplex mode */
10721073
};
10731074

1075+
struct ravb_rx_buffer {
1076+
struct page *page;
1077+
unsigned int offset;
1078+
};
1079+
10741080
struct ravb_private {
10751081
struct net_device *ndev;
10761082
struct platform_device *pdev;
@@ -1094,7 +1100,8 @@ struct ravb_private {
10941100
struct ravb_tx_desc *tx_ring[NUM_TX_QUEUE];
10951101
void *tx_align[NUM_TX_QUEUE];
10961102
struct sk_buff *rx_1st_skb;
1097-
struct sk_buff **rx_skb[NUM_RX_QUEUE];
1103+
struct page_pool *rx_pool[NUM_RX_QUEUE];
1104+
struct ravb_rx_buffer *rx_buffers[NUM_RX_QUEUE];
10981105
struct sk_buff **tx_skb[NUM_TX_QUEUE];
10991106
u32 rx_over_errors;
11001107
u32 rx_fifo_errors;

0 commit comments

Comments
 (0)