nic/ipxe: add throttle RX interrupt support

The commit adds support to throttle the rate of the RX IRQs to a specified
value. The effect is, that no RX IRQs below the time threshold will fire and
therefore the CPU load gets reduced on the host. Trade-off gaming between
cpu load, throughput, overload.

Modular Sculpt 23.10 on S938 as testcase. In brackets the CPU affinity is
denoted.

ipxe (0,0) -> nic_router (1,0) -> Debian VM vbox6 (3,0) and (3,1)

VM: iperf -C X.X.X.X -t 60 -R

iperf server X.X.X.X is outside Sculpt and sends data due to '-R' to VM

Non representative measure points:

cpu load   - ipxe  - nic_router - iperf throughput
--------------------------------------------------
w/o  patch -  ~80% -       ~50% - ~706 MBit/s - 0    -> throttling off by default on S938
patch 651  -  ~20% -       ~35% - ~763 MBit/s - 651  -> 0.166ms throttle RX IRQ
patch 5580 -  ~15% -       ~25% - ~650 MBit/s - 5580 -> 1.4ms   throttle RX IRQ

Issue #5149
This commit is contained in:
Alexander Boettcher 2024-02-07 14:44:37 +01:00 committed by Christian Helmuth
parent 31e8b50b7c
commit 5e5fe7291a
3 changed files with 45 additions and 2 deletions

View File

@ -0,0 +1,42 @@
--- a/src/drivers/net/intel.c
+++ b/src/drivers/net/intel.c
@@ -681,6 +681,27 @@
intel->force_icr = INTEL_IRQ_RXT0;
}
+ /*
+ * Intel PCI/PCI-X family of Gigabit Ethernet control Software Developers's
+ * Manual Rev 4.0
+ *
+ * 13.4.18 Interrupt Throttling Register
+ * advises - 651 to 5580 - for "optimal performance setting"
+ */
+
+ uint32_t const throttle_before = readl ( intel->regs + INTEL_ITR );
+ uint32_t const throttle = 651; /* 651 * 256µs -> 0.166 ms */
+
+ writel( throttle, intel->regs + INTEL_ITR );
+
+ uint64_t const value = readl ( intel->regs + INTEL_ITR );
+
+ dde_printf("throttle RX interrupt %luµs%s -> %luµs - %s\n",
+ 256ul * throttle_before / 1000ul,
+ throttle_before ? "" : "(off)",
+ 256ul * value / 1000ul,
+ value == throttle ? "succeeded" : "failed");
+
return 0;
intel_destroy_ring ( intel, &intel->rx );
--- a/src/drivers/net/intel.h
+++ b/src/drivers/net/intel.h
@@ -102,6 +102,9 @@
#define INTEL_IRQ_RXO 0x00000040UL /**< Receive overrun */
#define INTEL_IRQ_RXT0 0x00000080UL /**< Receive timer */
+/** Interrupt throttling Register */
+#define INTEL_ITR 0x000C4UL
+
/** Interrupt Mask Set/Read Register */
#define INTEL_IMS 0x000d0UL

View File

@ -1 +1 @@
c20a39b17bca4d9cefcee43f366f5c23296396e0
a7206d6c2a1b2de7fa7fde6733a3500411a64de2

View File

@ -11,7 +11,8 @@ PATCHES := patches/dde_ipxe.patch \
patches/intel_update.patch \
patches/tg3.patch \
patches/realtek.patch \
patches/intel_tx_batch.patch
patches/intel_tx_batch.patch \
patches/intel_rx_throttle.patch
PATCH_OPT := -p1 -d ${DIR(ipxe)}