Skip to content

Commit c8741bc

Browse files
vlrplnbuchwitz
authored andcommitted
net: macb: Add page pool support handle multi-descriptor frame rx
Use the page pool allocator for the data buffers and enable skb recycling support, instead of relying on netdev_alloc_skb allocating the entire skb during the refill. The patch also add support for receiving network frames that span multiple DMA descriptors in the Cadence MACB/GEM Ethernet driver. The patch removes the requirement that limited frame reception to a single descriptor (RX_SOF && RX_EOF), also avoiding potential contiguous multi-page allocation for large frames. Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
1 parent b5fcf6e commit c8741bc

File tree

3 files changed

+290
-115
lines changed

3 files changed

+290
-115
lines changed

drivers/net/ethernet/cadence/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ config MACB
2525
depends on PTP_1588_CLOCK_OPTIONAL
2626
select PHYLINK
2727
select CRC32
28+
select PAGE_POOL
2829
help
2930
The Cadence MACB ethernet interface is found on many Atmel AT32 and
3031
AT91 parts. This driver also supports the Cadence GEM (Gigabit

drivers/net/ethernet/cadence/macb.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/phy/phy.h>
1616
#include <linux/workqueue.h>
17+
#include <net/page_pool/helpers.h>
1718

1819
#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
1920
#define MACB_EXT_DESC
@@ -1305,6 +1306,8 @@ struct macb_queue {
13051306
void *rx_buffers;
13061307
struct napi_struct napi_rx;
13071308
struct queue_stats stats;
1309+
struct page_pool *page_pool;
1310+
struct sk_buff *skb;
13081311
};
13091312

13101313
struct ethtool_rx_fs_item {
@@ -1328,6 +1331,8 @@ struct macb {
13281331
struct macb_dma_desc *rx_ring_tieoff;
13291332
dma_addr_t rx_ring_tieoff_dma;
13301333
size_t rx_buffer_size;
1334+
size_t rx_headroom;
1335+
unsigned int rx_ip_align;
13311336

13321337
unsigned int rx_ring_size;
13331338
unsigned int tx_ring_size;

0 commit comments

Comments
 (0)