From: Aleksander Jan Bajkowski Date: Mon, 4 May 2026 11:12:41 +0000 (+0200) Subject: iperf3: backport GSO/GRO fix for small packets X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=d357f023463c1d06d7d9bdba8c37a1e159ac9758;p=openwrt-packages.git iperf3: backport GSO/GRO fix for small packets Backport GSO/GRO fix for packets smaller than 508 bytes. Signed-off-by: Aleksander Jan Bajkowski --- diff --git a/net/iperf3/Makefile b/net/iperf3/Makefile index 519e89ce5..accbb6538 100644 --- a/net/iperf3/Makefile +++ b/net/iperf3/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iperf PKG_VERSION:=3.21 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf diff --git a/net/iperf3/patches/0001-Limit-UDP-GSO-number-of-segments-in-a-message-to-the.patch b/net/iperf3/patches/0001-Limit-UDP-GSO-number-of-segments-in-a-message-to-the.patch new file mode 100644 index 000000000..3750093cf --- /dev/null +++ b/net/iperf3/patches/0001-Limit-UDP-GSO-number-of-segments-in-a-message-to-the.patch @@ -0,0 +1,45 @@ +From 212a2fe3ae2e600617a1fde7e6a1a0a1488a341f Mon Sep 17 00:00:00 2001 +From: DavidBar-On +Date: Sat, 2 May 2026 12:12:39 +0300 +Subject: [PATCH] Limit UDP GSO number of segments in a message to the allowed + value + +--- + src/iperf.h | 1 + + src/iperf_client_api.c | 8 ++++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +--- a/src/iperf.h ++++ b/src/iperf.h +@@ -494,6 +494,7 @@ extern int gerror; /* error value from g + /* In Reverse mode, maximum number of packets to wait for "accept" response - to handle out of order packets */ + #define MAX_REVERSE_OUT_OF_ORDER_PACKETS 2 + ++#define GSO_MAX_DG_IN_BF (1 << 7UL) // 128 - the Linux Kernel limit hardcoded as `UDP_MAX_SEGMENTS (1 << 7UL)` in `udpgso.c` + #define GSO_BF_MAX_SIZE MAX_UDP_BLOCKSIZE + #define GRO_BF_MAX_SIZE MAX_UDP_BLOCKSIZE + +--- a/src/iperf_client_api.c ++++ b/src/iperf_client_api.c +@@ -420,7 +420,7 @@ iperf_handle_message_client(struct iperf + int + iperf_connect(struct iperf_test *test) + { +- int opt; ++ int opt, n; + socklen_t len; + + if (NULL == test) +@@ -526,7 +526,11 @@ iperf_connect(struct iperf_test *test) + test->settings->gso_dg_size = test->settings->blksize; + /* use the multiple of datagram size for the best efficiency. */ + if (test->settings->gso_dg_size > 0) { +- test->settings->gso_bf_size = (test->settings->gso_bf_size / test->settings->gso_dg_size) * test->settings->gso_dg_size; ++ n = test->settings->gso_bf_size / test->settings->gso_dg_size; ++ if (n > GSO_MAX_DG_IN_BF) { ++ n = GSO_MAX_DG_IN_BF; ++ } ++ test->settings->gso_bf_size = n * test->settings->gso_dg_size; + } else { + /* If gso_dg_size is 0 (unlimited bandwidth), use default UDP datagram size */ + test->settings->gso_dg_size = DEFAULT_UDP_BLKSIZE;