Skip to contentSkip to conversation

Bad performance in RX with sfc 40G

PATCH Superseded Íñigo Huguet 5 participants 15 messages Nov 18, 2021 – Feb 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello,

Doing some tests a few weeks ago I noticed a very low performance in RX using 40G Solarflare NICs. Doing tests with iperf3 I got more than 30Gbps in TX, but just around 15Gbps in RX. Other NICs from other vendors could send and receive over 30Gbps.

I was doing the tests with multiple threads in iperf3 (-P 8).

The models used are SFC9140 and SFC9220.

Perf showed that most of the time was being expended in native_queued_spin_lock_slowpath. Tracing the calls to it with bpftrace I got that most of the calls were from __napi_poll > efx_poll

Quoted 1 line

efx_fast_push_rx_descriptors > __alloc_pages >

get_page_from_freelist > ...

Please can you help me investigate the issue? At first sight, it seems a not very optimal memory allocation strategy, or maybe a failure in pages recycling strategy...

This is the output of bpftrace, the 2 call chains that repeat more times, both from sfc

@[

    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    start_kernel+2465
    secondary_startup_64_no_verify+194
]: 2650
@[
    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    secondary_startup_64_no_verify+194

]: 17119

--
Íñigo Huguet

#1 lore raw
Quoted 64 lines · Íñigo Huguet

Hello,

Doing some tests a few weeks ago I noticed a very low performance in RX using 40G Solarflare NICs. Doing tests with iperf3 I got more than 30Gbps in TX, but just around 15Gbps in RX. Other NICs from other vendors could send and receive over 30Gbps.

I was doing the tests with multiple threads in iperf3 (-P 8).

The models used are SFC9140 and SFC9220.

Perf showed that most of the time was being expended in native_queued_spin_lock_slowpath. Tracing the calls to it with bpftrace I got that most of the calls were from __napi_poll > efx_poll

Quoted 1 line

efx_fast_push_rx_descriptors > __alloc_pages >

get_page_from_freelist > ...

Please can you help me investigate the issue? At first sight, it seems a not very optimal memory allocation strategy, or maybe a failure in pages recycling strategy...

This is the output of bpftrace, the 2 call chains that repeat more times, both from sfc

@[

    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    start_kernel+2465
    secondary_startup_64_no_verify+194
]: 2650
@[
    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    secondary_startup_64_no_verify+194
Quoted 5 lines

]: 17119

--
Íñigo Huguet

You could try to :

Make the RX ring buffers bigger (ethtool -G eth0 rx 8192)

and/or

Make sure your tcp socket receive buffer is smaller than number of frames in the ring buffer

echo "4096 131072 2097152" >/proc/sys/net/ipv4/tcp_rmem

You can also try latest net-next, as TCP got something to help this case.

f35f821935d8df76f9c92e2431a225bdff938169 tcp: defer skb freeing after socket lock is released

#2 lore raw

Hi,

Quoted 9 lines · Eric Dumazet

You could try to :

Make the RX ring buffers bigger (ethtool -G eth0 rx 8192)

and/or

Make sure your tcp socket receive buffer is smaller than number of frames in the ring buffer

echo "4096 131072 2097152" >/proc/sys/net/ipv4/tcp_rmem

Thanks for the suggestion. Sadly, the results are almost the same.

Quoted 3 lines

You can also try latest net-next, as TCP got something to help this case.

f35f821935d8df76f9c92e2431a225bdff938169 tcp: defer skb freeing after socket lock is released

I'll try ASAP, but I will need some days. Thanks

Signature · 1 line
Íñigo Huguet
#3 lore raw
In reply to Íñigo Huguet
Quoted 14 lines · Íñigo Huguet

Hello,

Doing some tests a few weeks ago I noticed a very low performance in RX using 40G Solarflare NICs. Doing tests with iperf3 I got more than 30Gbps in TX, but just around 15Gbps in RX. Other NICs from other vendors could send and receive over 30Gbps.

I was doing the tests with multiple threads in iperf3 (-P 8).

The models used are SFC9140 and SFC9220.

Perf showed that most of the time was being expended in native_queued_spin_lock_slowpath. Tracing the calls to it with bpftrace I got that most of the calls were from __napi_poll > efx_poll

Quoted 6 lines
Quoted 1 line

efx_fast_push_rx_descriptors > __alloc_pages >

get_page_from_freelist > ...

Please can you help me investigate the issue? At first sight, it seems a not very optimal memory allocation strategy, or maybe a failure in pages recycling strategy...

Apologies for the late reply. I'm having trouble digging out a machine to test this.
If you're testing without the IOMMU enabled I suspect the recycle ring size may be too small. Can your try the patch below?

Martin

drivers/net/ethernet/sfc/rx_common.c +1 -1
index 68fc7d317693..e37702bf3380 100644
@@ -28,7 +28,7 @@ MODULE_PARM_DESC(rx_refill_threshold,
  * the number of pages to store in the RX page recycle ring.
  */
 #define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
+#define EFX_RECYCLE_RING_SIZE_NOIOMMU 1024
 
 /* RX maximum head room required.
  *
Quoted 48 lines

This is the output of bpftrace, the 2 call chains that repeat more times, both from sfc

@[

    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    start_kernel+2465
    secondary_startup_64_no_verify+194
]: 2650
@[
    native_queued_spin_lock_slowpath+1
    _raw_spin_lock+26
    rmqueue_bulk+76
    get_page_from_freelist+2295
    __alloc_pages+214
    efx_fast_push_rx_descriptors+640
    efx_poll+660
    __napi_poll+42
    net_rx_action+547
    __softirqentry_text_start+208
    __irq_exit_rcu+179
    common_interrupt+131
    asm_common_interrupt+30
    cpuidle_enter_state+199
    cpuidle_enter+41
    do_idle+462
    cpu_startup_entry+25
    secondary_startup_64_no_verify+194

]: 17119

--
Íñigo Huguet

#4 lore raw

Hi,

Quoted 2 lines · Martin Habets

If you're testing without the IOMMU enabled I suspect the recycle ring size may be too small. Can your try the patch below?

Sorry for the very late reply, but I've had to be out of work for many days.

This patch has improved the performance a lot, reaching the same 30Gbps than in TX. However, it seems sometimes a bit erratic, still dropping to 15Gbps sometimes, specially after module remove & probe, or from one iperf call to another. But not being all the times, I didn't found a clear pattern. Anyway, it clearly improves things.

Can this patch be applied as is or it's just a test?

--
Íñigo Huguet

#5 lore raw

Hi Martin,

I replied this a few weeks ago, but it seems that, for some reason, I didn't CCd you.

Quoted 19 lines · Íñigo Huguet

Hi,

Quoted 2 lines · Martin Habets

If you're testing without the IOMMU enabled I suspect the recycle ring size may be too small. Can your try the patch below?

Sorry for the very late reply, but I've had to be out of work for many days.

This patch has improved the performance a lot, reaching the same 30Gbps than in TX. However, it seems sometimes a bit erratic, still dropping to 15Gbps sometimes, specially after module remove & probe, or from one iperf call to another. But not being all the times, I didn't found a clear pattern. Anyway, it clearly improves things.

Can this patch be applied as is or it's just a test?

--
Íñigo Huguet

Signature · 1 line
Íñigo Huguet
#6 lore raw

Hi Íñigo,

Quoted 4 lines · Íñigo Huguet

Hi Martin,

I replied this a few weeks ago, but it seems that, for some reason, I didn't CCd you.

I'm just getting back to work after my holidays. Happy new year!

Quoted 8 lines · Íñigo Huguet
Quoted 7 lines

Hi,

Quoted 2 lines · Martin Habets

If you're testing without the IOMMU enabled I suspect the recycle ring size may be too small. Can your try the patch below?

Quoted 7 lines
Quoted 7 lines

Sorry for the very late reply, but I've had to be out of work for many days.

This patch has improved the performance a lot, reaching the same 30Gbps than in TX. However, it seems sometimes a bit erratic, still dropping to 15Gbps sometimes, specially after module remove & probe, or from one iperf call to another. But not being all the times, I didn't found a clear pattern. Anyway, it clearly improves things.

Thanks for the feedback. After module probe the RX cache is cold (empty), as pages only get recycled as they come in.
The issue you see between iperf calls could be related to the NUMA locality of the cache. After the 1st run the cache will contain pages for the NUMA node that iperf ran on. If a subsequent run executes on a different NUMA node the pages in the cache are further away. This is where pinning the iperf runs to cores on the same NUMA node will help.

Quoted 1 line
Quoted 1 line

Can this patch be applied as is or it's just a test?

The patch is good for a 40G NIC. But it won't be good enough on a 100G NIC, and for a 10G NIC the size can be smaller.
I've been puzzling over the way to code this link speed dependency best. We create this page ring when the interface is brought up, which is before the driver knows the link speed. So I think it is best to size it for the maximum speed of a given NIC.
In short, I'll work on a better patch for this.

Martin

#7 lore raw

PATCH 1/1 sfc: The size of the RX recycle ring should be more flexible

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

---
 drivers/net/ethernet/sfc/ef10.c       |   31 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef100_nic.c  |    9 +++++++++
 drivers/net/ethernet/sfc/net_driver.h |    2 ++
 drivers/net/ethernet/sfc/nic_common.h |    5 +++++
 drivers/net/ethernet/sfc/rx_common.c  |   18 +-----------------
 drivers/net/ethernet/sfc/rx_common.h  |    6 ++++++
 drivers/net/ethernet/sfc/siena.c      |    8 ++++++++
 7 files changed, 62 insertions(+), 17 deletions(-)
drivers/net/ethernet/sfc/ef10.c +31 -0
index cf366ed2557c..dc3f95503d9c 100644
@@ -3990,6 +3990,35 @@ static unsigned int ef10_check_caps(const struct efx_nic *efx,
 	}
 }
 
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+	unsigned int ret;
+
+	/* There is no difference between PFs and VFs. The side is based on
+	 * the maximum link speed of a given NIC.
+	 */
+	switch (efx->pci_dev->device & 0xfff) {
+	case 0x0903:	/* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	case 0x0923:	/* Greenport can do up to 40G */
+	case 0x0a03:	/* Medford can do up to 40G */
+#ifdef CONFIG_PPC64
+		ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	default:	/* Medford2 can do up to 100G */
+		ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+	}
+	return ret;
+}
+
 #define EF10_OFFLOAD_FEATURES		\
 	(NETIF_F_IP_CSUM |		\
 	 NETIF_F_HW_VLAN_CTAG_FILTER |	\
@@ -4106,6 +4135,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
 	.check_caps = ef10_check_caps,
 	.print_additional_fwver = efx_ef10_print_additional_fwver,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
 
 const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4243,4 +4273,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.check_caps = ef10_check_caps,
 	.print_additional_fwver = efx_ef10_print_additional_fwver,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
drivers/net/ethernet/sfc/ef100_nic.c +9 -0
index f79b14a119ae..a07cbf45a326 100644
@@ -23,6 +23,7 @@
 #include "ef100_rx.h"
 #include "ef100_tx.h"
 #include "ef100_netdev.h"
+#include "rx_common.h"
 
 #define EF100_MAX_VIS 4096
 #define EF100_NUM_MCDI_BUFFERS	1
@@ -696,6 +697,12 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
 	}
 }
 
+static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx)
+{
+	/* Maximum link speed for Riverhead is 100G */
+	return 10 * EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /*	NIC level access functions
  */
 #define EF100_OFFLOAD_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_RXCSUM |	\
@@ -770,6 +777,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
 	.rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config,
 	.rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config,
 	.rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+	.rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
 	.reconfigure_mac = ef100_reconfigure_mac,
 	.reconfigure_port = efx_mcdi_port_reconfigure,
@@ -849,6 +857,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
 	.rx_pull_rss_config = efx_mcdi_rx_pull_rss_config,
 	.rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config,
 	.rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+	.rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
 	.reconfigure_mac = ef100_reconfigure_mac,
 	.test_nvram = efx_new_mcdi_nvram_test_all,
drivers/net/ethernet/sfc/net_driver.h +2 -0
index cc15ee8812d9..c75dc75e2857 100644
@@ -1282,6 +1282,7 @@ struct efx_udp_tunnel {
  * @udp_tnl_has_port: Check if a port has been added as UDP tunnel
  * @print_additional_fwver: Dump NIC-specific additional FW version info
  * @sensor_event: Handle a sensor event from MCDI
+ * @rx_recycle_ring_size: Size of the RX recycle ring
  * @revision: Hardware architecture revision
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
@@ -1460,6 +1461,7 @@ struct efx_nic_type {
 	size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf,
 					 size_t len);
 	void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev);
+	unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx);
 
 	int revision;
 	unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic_common.h +5 -0
index b9cafe9cd568..0cef35c0c559 100644
@@ -195,6 +195,11 @@ static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
 		efx->type->sensor_event(efx, ev);
 }
 
+static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx)
+{
+	return efx->type->rx_recycle_ring_size(efx);
+}
+
 /* Some statistics are computed as A - B where A and B each increase
  * linearly with some hardware counter(s) and the counters are read
  * asynchronously.  If the counters contributing to B are always read
drivers/net/ethernet/sfc/rx_common.c +1 -17
index 633ca77a26fd..1b22c7be0088 100644
@@ -23,13 +23,6 @@ module_param(rx_refill_threshold, uint, 0444);
 MODULE_PARM_DESC(rx_refill_threshold,
 		 "RX descriptor ring refill threshold (%)");
 
-/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
- * ring, this number is divided by the number of buffers per page to calculate
- * the number of pages to store in the RX page recycle ring.
- */
-#define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
-
 /* RX maximum head room required.
  *
  * This must be at least 1 to prevent overflow, plus one packet-worth
@@ -141,16 +134,7 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
 	unsigned int bufs_in_recycle_ring, page_ring_size;
 	struct efx_nic *efx = rx_queue->efx;
 
-	/* Set the RX recycle ring size */
-#ifdef CONFIG_PPC64
-	bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-#else
-	if (iommu_present(&pci_bus_type))
-		bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-	else
-		bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU;
-#endif /* CONFIG_PPC64 */
-
+	bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx);
 	page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring /
 					    efx->rx_bufs_per_page);
 	rx_queue->page_ring = kcalloc(page_ring_size,
drivers/net/ethernet/sfc/rx_common.h +6 -0
index 207ccd8ba062..fbd2769307f9 100644
@@ -18,6 +18,12 @@
 #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \
 				      EFX_RX_USR_BUF_SIZE)
 
+/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
+ * ring, this number is divided by the number of buffers per page to calculate
+ * the number of pages to store in the RX page recycle ring.
+ */
+#define EFX_RECYCLE_RING_SIZE_10G	256
+
 static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
 {
 	return page_address(buf->page) + buf->page_offset;
drivers/net/ethernet/sfc/siena.c +8 -0
index 16347a6d0c47..ce3060e15b54 100644
@@ -25,6 +25,7 @@
 #include "mcdi_port_common.h"
 #include "selftest.h"
 #include "siena_sriov.h"
+#include "rx_common.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -958,6 +959,12 @@ static unsigned int siena_check_caps(const struct efx_nic *efx,
 	return 0;
 }
 
+static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx)
+{
+	/* Maximum link speed is 10G */
+	return EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -1098,4 +1105,5 @@ const struct efx_nic_type siena_a0_nic_type = {
 	.rx_hash_key_size = 16,
 	.check_caps = siena_check_caps,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_siena_recycle_ring_size,
 };
#8 lore raw

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

Hi Martin, thanks for the quick fix.

Quoted 6 lines · Martin Habets

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

Quoted 7 lines

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

Although the problem seemed to be mainly in the case of IOMMU not present, this patch also changes the ring size for the IOMMU present case, using the same size for both. Have you checked that performance is not reduced in the second case?

Quoted 228 lines
---
 drivers/net/ethernet/sfc/ef10.c       |   31 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef100_nic.c  |    9 +++++++++
 drivers/net/ethernet/sfc/net_driver.h |    2 ++
 drivers/net/ethernet/sfc/nic_common.h |    5 +++++
 drivers/net/ethernet/sfc/rx_common.c  |   18 +-----------------
 drivers/net/ethernet/sfc/rx_common.h  |    6 ++++++
 drivers/net/ethernet/sfc/siena.c      |    8 ++++++++
 7 files changed, 62 insertions(+), 17 deletions(-)
drivers/net/ethernet/sfc/ef10.c +31 -0
index cf366ed2557c..dc3f95503d9c 100644
@@ -3990,6 +3990,35 @@ static unsigned int ef10_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+       unsigned int ret;
+
+       /* There is no difference between PFs and VFs. The side is based on
+        * the maximum link speed of a given NIC.
+        */
+       switch (efx->pci_dev->device & 0xfff) {
+       case 0x0903:    /* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       case 0x0923:    /* Greenport can do up to 40G */
+       case 0x0a03:    /* Medford can do up to 40G */
+#ifdef CONFIG_PPC64
+               ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       default:        /* Medford2 can do up to 100G */
+               ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+       }
+       return ret;
+}
+
 #define EF10_OFFLOAD_FEATURES          \
        (NETIF_F_IP_CSUM |              \
         NETIF_F_HW_VLAN_CTAG_FILTER |  \
@@ -4106,6 +4135,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
 
 const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4243,4 +4273,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
drivers/net/ethernet/sfc/ef100_nic.c +9 -0
index f79b14a119ae..a07cbf45a326 100644
@@ -23,6 +23,7 @@
 #include "ef100_rx.h"
 #include "ef100_tx.h"
 #include "ef100_netdev.h"
+#include "rx_common.h"
 
 #define EF100_MAX_VIS 4096
 #define EF100_NUM_MCDI_BUFFERS 1
@@ -696,6 +697,12 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed for Riverhead is 100G */
+       return 10 * EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /*     NIC level access functions
  */
 #define EF100_OFFLOAD_FEATURES (NETIF_F_HW_CSUM | NETIF_F_RXCSUM |     \
@@ -770,6 +777,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
        .rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config,
        .rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .reconfigure_port = efx_mcdi_port_reconfigure,
@@ -849,6 +857,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
        .rx_pull_rss_config = efx_mcdi_rx_pull_rss_config,
        .rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .test_nvram = efx_new_mcdi_nvram_test_all,
drivers/net/ethernet/sfc/net_driver.h +2 -0
index cc15ee8812d9..c75dc75e2857 100644
@@ -1282,6 +1282,7 @@ struct efx_udp_tunnel {
  * @udp_tnl_has_port: Check if a port has been added as UDP tunnel
  * @print_additional_fwver: Dump NIC-specific additional FW version info
  * @sensor_event: Handle a sensor event from MCDI
+ * @rx_recycle_ring_size: Size of the RX recycle ring
  * @revision: Hardware architecture revision
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
@@ -1460,6 +1461,7 @@ struct efx_nic_type {
        size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf,
                                         size_t len);
        void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev);
+       unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx);
 
        int revision;
        unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic_common.h +5 -0
index b9cafe9cd568..0cef35c0c559 100644
@@ -195,6 +195,11 @@ static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
                efx->type->sensor_event(efx, ev);
 }
 
+static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx)
+{
+       return efx->type->rx_recycle_ring_size(efx);
+}
+
 /* Some statistics are computed as A - B where A and B each increase
  * linearly with some hardware counter(s) and the counters are read
  * asynchronously.  If the counters contributing to B are always read
drivers/net/ethernet/sfc/rx_common.c +1 -17
index 633ca77a26fd..1b22c7be0088 100644
@@ -23,13 +23,6 @@ module_param(rx_refill_threshold, uint, 0444);
 MODULE_PARM_DESC(rx_refill_threshold,
                 "RX descriptor ring refill threshold (%)");
 
-/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
- * ring, this number is divided by the number of buffers per page to calculate
- * the number of pages to store in the RX page recycle ring.
- */
-#define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
-
 /* RX maximum head room required.
  *
  * This must be at least 1 to prevent overflow, plus one packet-worth
@@ -141,16 +134,7 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
        unsigned int bufs_in_recycle_ring, page_ring_size;
        struct efx_nic *efx = rx_queue->efx;
 
-       /* Set the RX recycle ring size */
-#ifdef CONFIG_PPC64
-       bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-#else
-       if (iommu_present(&pci_bus_type))
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-       else
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU;
-#endif /* CONFIG_PPC64 */
-
+       bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx);
        page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring /
                                            efx->rx_bufs_per_page);
        rx_queue->page_ring = kcalloc(page_ring_size,
drivers/net/ethernet/sfc/rx_common.h +6 -0
index 207ccd8ba062..fbd2769307f9 100644
@@ -18,6 +18,12 @@
 #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \
                                      EFX_RX_USR_BUF_SIZE)
 
+/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
+ * ring, this number is divided by the number of buffers per page to calculate
+ * the number of pages to store in the RX page recycle ring.
+ */
+#define EFX_RECYCLE_RING_SIZE_10G      256
+
 static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
 {
        return page_address(buf->page) + buf->page_offset;
drivers/net/ethernet/sfc/siena.c +8 -0
index 16347a6d0c47..ce3060e15b54 100644
@@ -25,6 +25,7 @@
 #include "mcdi_port_common.h"
 #include "selftest.h"
 #include "siena_sriov.h"
+#include "rx_common.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -958,6 +959,12 @@ static unsigned int siena_check_caps(const struct efx_nic *efx,
        return 0;
 }
 
+static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed is 10G */
+       return EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -1098,4 +1105,5 @@ const struct efx_nic_type siena_a0_nic_type = {
        .rx_hash_key_size = 16,
        .check_caps = siena_check_caps,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_siena_recycle_ring_size,
 };
Signature · 1 line
Íñigo Huguet
#9 lore raw

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

Hi Íñigo,

Quoted 17 lines · Íñigo Huguet

Hi Martin, thanks for the quick fix.

Quoted 6 lines · Martin Habets

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

Quoted 7 lines

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

Quoted 4 lines

Although the problem seemed to be mainly in the case of IOMMU not present, this patch also changes the ring size for the IOMMU present case, using the same size for both. Have you checked that performance is not reduced in the second case?

I have not checked that yet, it will take longer. I expect the performance will be similar to the ones without IOMMU enabled.

Martin

Quoted 232 lines
Quoted 228 lines
---
 drivers/net/ethernet/sfc/ef10.c       |   31 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef100_nic.c  |    9 +++++++++
 drivers/net/ethernet/sfc/net_driver.h |    2 ++
 drivers/net/ethernet/sfc/nic_common.h |    5 +++++
 drivers/net/ethernet/sfc/rx_common.c  |   18 +-----------------
 drivers/net/ethernet/sfc/rx_common.h  |    6 ++++++
 drivers/net/ethernet/sfc/siena.c      |    8 ++++++++
 7 files changed, 62 insertions(+), 17 deletions(-)
drivers/net/ethernet/sfc/ef10.c +31 -0
index cf366ed2557c..dc3f95503d9c 100644
@@ -3990,6 +3990,35 @@ static unsigned int ef10_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+       unsigned int ret;
+
+       /* There is no difference between PFs and VFs. The side is based on
+        * the maximum link speed of a given NIC.
+        */
+       switch (efx->pci_dev->device & 0xfff) {
+       case 0x0903:    /* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       case 0x0923:    /* Greenport can do up to 40G */
+       case 0x0a03:    /* Medford can do up to 40G */
+#ifdef CONFIG_PPC64
+               ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       default:        /* Medford2 can do up to 100G */
+               ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+       }
+       return ret;
+}
+
 #define EF10_OFFLOAD_FEATURES          \
        (NETIF_F_IP_CSUM |              \
         NETIF_F_HW_VLAN_CTAG_FILTER |  \
@@ -4106,6 +4135,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
 
 const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4243,4 +4273,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
drivers/net/ethernet/sfc/ef100_nic.c +9 -0
index f79b14a119ae..a07cbf45a326 100644
@@ -23,6 +23,7 @@
 #include "ef100_rx.h"
 #include "ef100_tx.h"
 #include "ef100_netdev.h"
+#include "rx_common.h"
 
 #define EF100_MAX_VIS 4096
 #define EF100_NUM_MCDI_BUFFERS 1
@@ -696,6 +697,12 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed for Riverhead is 100G */
+       return 10 * EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /*     NIC level access functions
  */
 #define EF100_OFFLOAD_FEATURES (NETIF_F_HW_CSUM | NETIF_F_RXCSUM |     \
@@ -770,6 +777,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
        .rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config,
        .rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .reconfigure_port = efx_mcdi_port_reconfigure,
@@ -849,6 +857,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
        .rx_pull_rss_config = efx_mcdi_rx_pull_rss_config,
        .rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .test_nvram = efx_new_mcdi_nvram_test_all,
drivers/net/ethernet/sfc/net_driver.h +2 -0
index cc15ee8812d9..c75dc75e2857 100644
@@ -1282,6 +1282,7 @@ struct efx_udp_tunnel {
  * @udp_tnl_has_port: Check if a port has been added as UDP tunnel
  * @print_additional_fwver: Dump NIC-specific additional FW version info
  * @sensor_event: Handle a sensor event from MCDI
+ * @rx_recycle_ring_size: Size of the RX recycle ring
  * @revision: Hardware architecture revision
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
@@ -1460,6 +1461,7 @@ struct efx_nic_type {
        size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf,
                                         size_t len);
        void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev);
+       unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx);
 
        int revision;
        unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic_common.h +5 -0
index b9cafe9cd568..0cef35c0c559 100644
@@ -195,6 +195,11 @@ static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
                efx->type->sensor_event(efx, ev);
 }
 
+static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx)
+{
+       return efx->type->rx_recycle_ring_size(efx);
+}
+
 /* Some statistics are computed as A - B where A and B each increase
  * linearly with some hardware counter(s) and the counters are read
  * asynchronously.  If the counters contributing to B are always read
drivers/net/ethernet/sfc/rx_common.c +1 -17
index 633ca77a26fd..1b22c7be0088 100644
@@ -23,13 +23,6 @@ module_param(rx_refill_threshold, uint, 0444);
 MODULE_PARM_DESC(rx_refill_threshold,
                 "RX descriptor ring refill threshold (%)");
 
-/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
- * ring, this number is divided by the number of buffers per page to calculate
- * the number of pages to store in the RX page recycle ring.
- */
-#define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
-
 /* RX maximum head room required.
  *
  * This must be at least 1 to prevent overflow, plus one packet-worth
@@ -141,16 +134,7 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
        unsigned int bufs_in_recycle_ring, page_ring_size;
        struct efx_nic *efx = rx_queue->efx;
 
-       /* Set the RX recycle ring size */
-#ifdef CONFIG_PPC64
-       bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-#else
-       if (iommu_present(&pci_bus_type))
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-       else
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU;
-#endif /* CONFIG_PPC64 */
-
+       bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx);
        page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring /
                                            efx->rx_bufs_per_page);
        rx_queue->page_ring = kcalloc(page_ring_size,
drivers/net/ethernet/sfc/rx_common.h +6 -0
index 207ccd8ba062..fbd2769307f9 100644
@@ -18,6 +18,12 @@
 #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \
                                      EFX_RX_USR_BUF_SIZE)
 
+/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
+ * ring, this number is divided by the number of buffers per page to calculate
+ * the number of pages to store in the RX page recycle ring.
+ */
+#define EFX_RECYCLE_RING_SIZE_10G      256
+
 static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
 {
        return page_address(buf->page) + buf->page_offset;
drivers/net/ethernet/sfc/siena.c +8 -0
index 16347a6d0c47..ce3060e15b54 100644
@@ -25,6 +25,7 @@
 #include "mcdi_port_common.h"
 #include "selftest.h"
 #include "siena_sriov.h"
+#include "rx_common.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -958,6 +959,12 @@ static unsigned int siena_check_caps(const struct efx_nic *efx,
        return 0;
 }
 
+static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed is 10G */
+       return EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -1098,4 +1105,5 @@ const struct efx_nic_type siena_a0_nic_type = {
        .rx_hash_key_size = 16,
        .check_caps = siena_check_caps,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_siena_recycle_ring_size,
 };
Signature · 1 line
Íñigo Huguet
#10 lore raw

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

In reply to Íñigo Huguet
Quoted 17 lines · Íñigo Huguet

Hi Martin, thanks for the quick fix.

Quoted 6 lines · Martin Habets

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

Quoted 7 lines

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

Quoted 4 lines

Although the problem seemed to be mainly in the case of IOMMU not present, this patch also changes the ring size for the IOMMU present case, using the same size for both. Have you checked that performance is not reduced in the second case?

With the IOMMU enabled calls to __alloc_pages are at a whopping 0.01%. No change in performance was measured.

Martin

Quoted 232 lines
Quoted 228 lines
---
 drivers/net/ethernet/sfc/ef10.c       |   31 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef100_nic.c  |    9 +++++++++
 drivers/net/ethernet/sfc/net_driver.h |    2 ++
 drivers/net/ethernet/sfc/nic_common.h |    5 +++++
 drivers/net/ethernet/sfc/rx_common.c  |   18 +-----------------
 drivers/net/ethernet/sfc/rx_common.h  |    6 ++++++
 drivers/net/ethernet/sfc/siena.c      |    8 ++++++++
 7 files changed, 62 insertions(+), 17 deletions(-)
drivers/net/ethernet/sfc/ef10.c +31 -0
index cf366ed2557c..dc3f95503d9c 100644
@@ -3990,6 +3990,35 @@ static unsigned int ef10_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+       unsigned int ret;
+
+       /* There is no difference between PFs and VFs. The side is based on
+        * the maximum link speed of a given NIC.
+        */
+       switch (efx->pci_dev->device & 0xfff) {
+       case 0x0903:    /* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       case 0x0923:    /* Greenport can do up to 40G */
+       case 0x0a03:    /* Medford can do up to 40G */
+#ifdef CONFIG_PPC64
+               ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+               ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+               break;
+       default:        /* Medford2 can do up to 100G */
+               ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+       }
+       return ret;
+}
+
 #define EF10_OFFLOAD_FEATURES          \
        (NETIF_F_IP_CSUM |              \
         NETIF_F_HW_VLAN_CTAG_FILTER |  \
@@ -4106,6 +4135,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
 
 const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4243,4 +4273,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
        .check_caps = ef10_check_caps,
        .print_additional_fwver = efx_ef10_print_additional_fwver,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
drivers/net/ethernet/sfc/ef100_nic.c +9 -0
index f79b14a119ae..a07cbf45a326 100644
@@ -23,6 +23,7 @@
 #include "ef100_rx.h"
 #include "ef100_tx.h"
 #include "ef100_netdev.h"
+#include "rx_common.h"
 
 #define EF100_MAX_VIS 4096
 #define EF100_NUM_MCDI_BUFFERS 1
@@ -696,6 +697,12 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
        }
 }
 
+static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed for Riverhead is 100G */
+       return 10 * EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /*     NIC level access functions
  */
 #define EF100_OFFLOAD_FEATURES (NETIF_F_HW_CSUM | NETIF_F_RXCSUM |     \
@@ -770,6 +777,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
        .rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config,
        .rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .reconfigure_port = efx_mcdi_port_reconfigure,
@@ -849,6 +857,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
        .rx_pull_rss_config = efx_mcdi_rx_pull_rss_config,
        .rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config,
        .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+       .rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
        .reconfigure_mac = ef100_reconfigure_mac,
        .test_nvram = efx_new_mcdi_nvram_test_all,
drivers/net/ethernet/sfc/net_driver.h +2 -0
index cc15ee8812d9..c75dc75e2857 100644
@@ -1282,6 +1282,7 @@ struct efx_udp_tunnel {
  * @udp_tnl_has_port: Check if a port has been added as UDP tunnel
  * @print_additional_fwver: Dump NIC-specific additional FW version info
  * @sensor_event: Handle a sensor event from MCDI
+ * @rx_recycle_ring_size: Size of the RX recycle ring
  * @revision: Hardware architecture revision
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
@@ -1460,6 +1461,7 @@ struct efx_nic_type {
        size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf,
                                         size_t len);
        void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev);
+       unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx);
 
        int revision;
        unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic_common.h +5 -0
index b9cafe9cd568..0cef35c0c559 100644
@@ -195,6 +195,11 @@ static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
                efx->type->sensor_event(efx, ev);
 }
 
+static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx)
+{
+       return efx->type->rx_recycle_ring_size(efx);
+}
+
 /* Some statistics are computed as A - B where A and B each increase
  * linearly with some hardware counter(s) and the counters are read
  * asynchronously.  If the counters contributing to B are always read
drivers/net/ethernet/sfc/rx_common.c +1 -17
index 633ca77a26fd..1b22c7be0088 100644
@@ -23,13 +23,6 @@ module_param(rx_refill_threshold, uint, 0444);
 MODULE_PARM_DESC(rx_refill_threshold,
                 "RX descriptor ring refill threshold (%)");
 
-/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
- * ring, this number is divided by the number of buffers per page to calculate
- * the number of pages to store in the RX page recycle ring.
- */
-#define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
-
 /* RX maximum head room required.
  *
  * This must be at least 1 to prevent overflow, plus one packet-worth
@@ -141,16 +134,7 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
        unsigned int bufs_in_recycle_ring, page_ring_size;
        struct efx_nic *efx = rx_queue->efx;
 
-       /* Set the RX recycle ring size */
-#ifdef CONFIG_PPC64
-       bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-#else
-       if (iommu_present(&pci_bus_type))
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-       else
-               bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU;
-#endif /* CONFIG_PPC64 */
-
+       bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx);
        page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring /
                                            efx->rx_bufs_per_page);
        rx_queue->page_ring = kcalloc(page_ring_size,
drivers/net/ethernet/sfc/rx_common.h +6 -0
index 207ccd8ba062..fbd2769307f9 100644
@@ -18,6 +18,12 @@
 #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \
                                      EFX_RX_USR_BUF_SIZE)
 
+/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
+ * ring, this number is divided by the number of buffers per page to calculate
+ * the number of pages to store in the RX page recycle ring.
+ */
+#define EFX_RECYCLE_RING_SIZE_10G      256
+
 static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
 {
        return page_address(buf->page) + buf->page_offset;
drivers/net/ethernet/sfc/siena.c +8 -0
index 16347a6d0c47..ce3060e15b54 100644
@@ -25,6 +25,7 @@
 #include "mcdi_port_common.h"
 #include "selftest.h"
 #include "siena_sriov.h"
+#include "rx_common.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -958,6 +959,12 @@ static unsigned int siena_check_caps(const struct efx_nic *efx,
        return 0;
 }
 
+static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx)
+{
+       /* Maximum link speed is 10G */
+       return EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -1098,4 +1105,5 @@ const struct efx_nic_type siena_a0_nic_type = {
        .rx_hash_key_size = 16,
        .check_caps = siena_check_caps,
        .sensor_event = efx_mcdi_sensor_event,
+       .rx_recycle_ring_size = efx_siena_recycle_ring_size,
 };
Signature · 1 line
Íñigo Huguet
maintainer
#11 lore raw

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

In reply to Martin Habets
Quoted 18 lines · On Mon, 10 Jan 2022 08:58:21 +0000 Martin Habets wrote:
drivers/net/ethernet/sfc/ef10.c +18 -0
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+	unsigned int ret;
+
+	/* There is no difference between PFs and VFs. The side is based on
+	 * the maximum link speed of a given NIC.
+	 */
+	switch (efx->pci_dev->device & 0xfff) {
+	case 0x0903:	/* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	case 0x0923:	/* Greenport can do up to 40G */
+	case 0x0a03:	/* Medford can do up to 40G */
+#ifdef CONFIG_PPC64

drivers/net/ethernet/sfc/ef10.c static unsigned int ef10_check_caps(const struct efx_nic *efx, · line 4020

Quoted 10 lines
drivers/net/ethernet/sfc/ef10.c +10 -0
+		ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	default:	/* Medford2 can do up to 100G */
+		ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+	}
+	return ret;
+}

Why not factor out the 4x scaling for powerpc outside of the switch?

The callback could return the scaling factor but failing that:

static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)

{
	unsigned int ret = EFX_RECYCLE_RING_SIZE_10G;;

	/* There is no difference between PFs and VFs. The side is based on
	 * the maximum link speed of a given NIC.
	 */
	switch (efx->pci_dev->device & 0xfff) {
	case 0x0903:	/* Farmingdale can do up to 10G */
		break;
	case 0x0923:	/* Greenport can do up to 40G */
	case 0x0a03:	/* Medford can do up to 40G */
		ret *= 4;
		break;
	default:	/* Medford2 can do up to 100G */
		ret *= 10;
	}

	if (IS_ENABLED(CONFIG_PPC64))
		ret *= 4;

	return ret;
}

Other than that - net-next is closed, please switch to RFC postings until it opens back up once 5.17-rc1 is cut. Thanks!

#12 lore raw

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

Quoted 49 lines · Jakub Kicinski
Quoted 18 lines · On Mon, 10 Jan 2022 08:58:21 +0000 Martin Habets wrote:
drivers/net/ethernet/sfc/ef10.c +18 -0
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+	unsigned int ret;
+
+	/* There is no difference between PFs and VFs. The side is based on
+	 * the maximum link speed of a given NIC.
+	 */
+	switch (efx->pci_dev->device & 0xfff) {
+	case 0x0903:	/* Farmingdale can do up to 10G */
+#ifdef CONFIG_PPC64
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	case 0x0923:	/* Greenport can do up to 40G */
+	case 0x0a03:	/* Medford can do up to 40G */
+#ifdef CONFIG_PPC64

drivers/net/ethernet/sfc/ef10.c static unsigned int ef10_check_caps(const struct efx_nic *efx, · line 4020

Quoted 10 lines
drivers/net/ethernet/sfc/ef10.c +10 -0
+		ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
+#else
+		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
+#endif
+		break;
+	default:	/* Medford2 can do up to 100G */
+		ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
+	}
+	return ret;
+}

Why not factor out the 4x scaling for powerpc outside of the switch?

The callback could return the scaling factor but failing that:

static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)

{
	unsigned int ret = EFX_RECYCLE_RING_SIZE_10G;;

	/* There is no difference between PFs and VFs. The side is based on
	 * the maximum link speed of a given NIC.
	 */
	switch (efx->pci_dev->device & 0xfff) {
	case 0x0903:	/* Farmingdale can do up to 10G */
		break;
	case 0x0923:	/* Greenport can do up to 40G */
	case 0x0a03:	/* Medford can do up to 40G */
		ret *= 4;
		break;
	default:	/* Medford2 can do up to 100G */
Quoted 8 lines
		ret *= 10;
	}

	if (IS_ENABLED(CONFIG_PPC64))
		ret *= 4;

	return ret;
}

Thanks, will do.

Quoted 2 lines

Other than that - net-next is closed, please switch to RFC postings until it opens back up once 5.17-rc1 is cut. Thanks!

I knew it had to be near closing, I even checked the weblink. ;) Will repost when net-next is open again.

Martin

#13 lore raw

PATCH v2 1/1 sfc: The size of the RX recycle ring should be more flexible

In reply to Martin Habets

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

Change from V1:
- Factored out the PowerPC scaling to be outside the swtich.

---
 drivers/net/ethernet/sfc/ef10.c       |   26 ++++++++++++++++++++++++++
 drivers/net/ethernet/sfc/ef100_nic.c  |    9 +++++++++
 drivers/net/ethernet/sfc/net_driver.h |    2 ++
 drivers/net/ethernet/sfc/nic_common.h |    5 +++++
 drivers/net/ethernet/sfc/rx_common.c  |   18 +-----------------
 drivers/net/ethernet/sfc/rx_common.h  |    6 ++++++
 drivers/net/ethernet/sfc/siena.c      |    8 ++++++++
 7 files changed, 57 insertions(+), 17 deletions(-)
drivers/net/ethernet/sfc/ef10.c +26 -0
index cf366ed2557c..50d535981a35 100644
@@ -3990,6 +3990,30 @@ static unsigned int ef10_check_caps(const struct efx_nic *efx,
 	}
 }
 
+static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
+{
+	unsigned int ret = EFX_RECYCLE_RING_SIZE_10G;
+
+	/* There is no difference between PFs and VFs. The side is based on
+	 * the maximum link speed of a given NIC.
+	 */
+	switch (efx->pci_dev->device & 0xfff) {
+	case 0x0903:	/* Farmingdale can do up to 10G */
+		break;
+	case 0x0923:	/* Greenport can do up to 40G */
+	case 0x0a03:	/* Medford can do up to 40G */
+		ret *= 4;
+		break;
+	default:	/* Medford2 can do up to 100G */
+		ret *= 10;
+	}
+
+	if (IS_ENABLED(CONFIG_PPC64))
+		ret *= 4;
+
+	return ret;
+}
+
 #define EF10_OFFLOAD_FEATURES		\
 	(NETIF_F_IP_CSUM |		\
 	 NETIF_F_HW_VLAN_CTAG_FILTER |	\
@@ -4106,6 +4130,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
 	.check_caps = ef10_check_caps,
 	.print_additional_fwver = efx_ef10_print_additional_fwver,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
 
 const struct efx_nic_type efx_hunt_a0_nic_type = {
@@ -4243,4 +4268,5 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
 	.check_caps = ef10_check_caps,
 	.print_additional_fwver = efx_ef10_print_additional_fwver,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_ef10_recycle_ring_size,
 };
drivers/net/ethernet/sfc/ef100_nic.c +9 -0
index f79b14a119ae..a07cbf45a326 100644
@@ -23,6 +23,7 @@
 #include "ef100_rx.h"
 #include "ef100_tx.h"
 #include "ef100_netdev.h"
+#include "rx_common.h"
 
 #define EF100_MAX_VIS 4096
 #define EF100_NUM_MCDI_BUFFERS	1
@@ -696,6 +697,12 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
 	}
 }
 
+static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx)
+{
+	/* Maximum link speed for Riverhead is 100G */
+	return 10 * EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /*	NIC level access functions
  */
 #define EF100_OFFLOAD_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_RXCSUM |	\
@@ -770,6 +777,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
 	.rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config,
 	.rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config,
 	.rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+	.rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
 	.reconfigure_mac = ef100_reconfigure_mac,
 	.reconfigure_port = efx_mcdi_port_reconfigure,
@@ -849,6 +857,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
 	.rx_pull_rss_config = efx_mcdi_rx_pull_rss_config,
 	.rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config,
 	.rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts,
+	.rx_recycle_ring_size = efx_ef100_recycle_ring_size,
 
 	.reconfigure_mac = ef100_reconfigure_mac,
 	.test_nvram = efx_new_mcdi_nvram_test_all,
drivers/net/ethernet/sfc/net_driver.h +2 -0
index cc15ee8812d9..c75dc75e2857 100644
@@ -1282,6 +1282,7 @@ struct efx_udp_tunnel {
  * @udp_tnl_has_port: Check if a port has been added as UDP tunnel
  * @print_additional_fwver: Dump NIC-specific additional FW version info
  * @sensor_event: Handle a sensor event from MCDI
+ * @rx_recycle_ring_size: Size of the RX recycle ring
  * @revision: Hardware architecture revision
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
@@ -1460,6 +1461,7 @@ struct efx_nic_type {
 	size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf,
 					 size_t len);
 	void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev);
+	unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx);
 
 	int revision;
 	unsigned int txd_ptr_tbl_base;
drivers/net/ethernet/sfc/nic_common.h +5 -0
index b9cafe9cd568..0cef35c0c559 100644
@@ -195,6 +195,11 @@ static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
 		efx->type->sensor_event(efx, ev);
 }
 
+static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx)
+{
+	return efx->type->rx_recycle_ring_size(efx);
+}
+
 /* Some statistics are computed as A - B where A and B each increase
  * linearly with some hardware counter(s) and the counters are read
  * asynchronously.  If the counters contributing to B are always read
drivers/net/ethernet/sfc/rx_common.c +1 -17
index 633ca77a26fd..1b22c7be0088 100644
@@ -23,13 +23,6 @@ module_param(rx_refill_threshold, uint, 0444);
 MODULE_PARM_DESC(rx_refill_threshold,
 		 "RX descriptor ring refill threshold (%)");
 
-/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
- * ring, this number is divided by the number of buffers per page to calculate
- * the number of pages to store in the RX page recycle ring.
- */
-#define EFX_RECYCLE_RING_SIZE_IOMMU 4096
-#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH)
-
 /* RX maximum head room required.
  *
  * This must be at least 1 to prevent overflow, plus one packet-worth
@@ -141,16 +134,7 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
 	unsigned int bufs_in_recycle_ring, page_ring_size;
 	struct efx_nic *efx = rx_queue->efx;
 
-	/* Set the RX recycle ring size */
-#ifdef CONFIG_PPC64
-	bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-#else
-	if (iommu_present(&pci_bus_type))
-		bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU;
-	else
-		bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU;
-#endif /* CONFIG_PPC64 */
-
+	bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx);
 	page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring /
 					    efx->rx_bufs_per_page);
 	rx_queue->page_ring = kcalloc(page_ring_size,
drivers/net/ethernet/sfc/rx_common.h +6 -0
index 207ccd8ba062..fbd2769307f9 100644
@@ -18,6 +18,12 @@
 #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \
 				      EFX_RX_USR_BUF_SIZE)
 
+/* Number of RX buffers to recycle pages for.  When creating the RX page recycle
+ * ring, this number is divided by the number of buffers per page to calculate
+ * the number of pages to store in the RX page recycle ring.
+ */
+#define EFX_RECYCLE_RING_SIZE_10G	256
+
 static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
 {
 	return page_address(buf->page) + buf->page_offset;
drivers/net/ethernet/sfc/siena.c +8 -0
index 16347a6d0c47..ce3060e15b54 100644
@@ -25,6 +25,7 @@
 #include "mcdi_port_common.h"
 #include "selftest.h"
 #include "siena_sriov.h"
+#include "rx_common.h"
 
 /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
 
@@ -958,6 +959,12 @@ static unsigned int siena_check_caps(const struct efx_nic *efx,
 	return 0;
 }
 
+static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx)
+{
+	/* Maximum link speed is 10G */
+	return EFX_RECYCLE_RING_SIZE_10G;
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -1098,4 +1105,5 @@ const struct efx_nic_type siena_a0_nic_type = {
 	.rx_hash_key_size = 16,
 	.check_caps = siena_check_caps,
 	.sensor_event = efx_mcdi_sensor_event,
+	.rx_recycle_ring_size = efx_siena_recycle_ring_size,
 };
#14 lore raw

Re: [PATCH V2 net-next] sfc: The size of the RX recycle ring should be more flexible

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 13 lines · On Mon, 31 Jan 2022 11:10:54 +0000 you wrote:

Ideally the size would depend on the link speed, but the recycle ring is created when the interface is brought up before the driver knows the link speed. So size it for the maximum speed of a given NIC. PowerPC is only supported on SFN7xxx and SFN8xxx NICs.

With this patch on a 40G NIC the number of calls to alloc_pages and friends went down from about 18% to under 2%.
On a 10G NIC the number of calls to alloc_pages and friends went down from about 15% to 0 (perf did not capture any calls during the 60 second test).
On a 100G NIC the number of calls to alloc_pages and friends went down from about 23% to 4%.

Quoted 1 line

[...]

Here is the summary with links:
- [V2,net-next] sfc: The size of the RX recycle ring should be more flexible

    https://git.kernel.org/netdev/net-next/c/000fe940e51f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html