Skip to content

Commit d26a207

Browse files
committed
udp gso/gro: replace hard-coded 1472 with DEFAULT_UDP_BLKSIZE fallback
Use the existing DEFAULT_UDP_BLKSIZE for GSO datagram-size fallback instead of the literal 1472. Rationale: avoids a magic number and keeps a conservative, widely safe default across IPv4/IPv6 when the control socket MSS is unavailable. In normal operation UDP blksize is derived from the control TCP MSS; this constant fallback is only used when MSS cannot be determined or when the computed gso_dg_size ends up 0 (unlimited case). Behavior notes: - If the user sets -l/--length, that value drives both UDP block size and gso_dg_size. - Otherwise, gso_dg_size tracks the chosen blksize; it falls back to DEFAULT_UDP_BLKSIZE only when the computed value is 0. Files: - src/iperf_api.c: update two fallback sites - src/iperf_client_api.c: update fallback site
1 parent 6445eee commit d26a207

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/iperf_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
19311931
test->settings->gso_bf_size = (test->settings->gso_bf_size / test->settings->gso_dg_size) * test->settings->gso_dg_size;
19321932
} else {
19331933
/* If gso_dg_size is 0 (unlimited bandwidth), use default UDP datagram size */
1934-
test->settings->gso_dg_size = 1472; /* Standard UDP payload size for Ethernet MTU */
1934+
test->settings->gso_dg_size = DEFAULT_UDP_BLKSIZE;
19351935
}
19361936
}
19371937
#endif
@@ -2610,7 +2610,7 @@ get_parameters(struct iperf_test *test)
26102610
test->settings->gso_bf_size = (test->settings->gso_bf_size / test->settings->gso_dg_size) * test->settings->gso_dg_size;
26112611
} else {
26122612
/* If gso_dg_size is 0 (unlimited bandwidth), use default UDP datagram size */
2613-
test->settings->gso_dg_size = 1472; /* Standard UDP payload size for Ethernet MTU */
2613+
test->settings->gso_dg_size = DEFAULT_UDP_BLKSIZE;
26142614
}
26152615
}
26162616
#endif

src/iperf_client_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ iperf_connect(struct iperf_test *test)
524524
test->settings->gso_bf_size = (test->settings->gso_bf_size / test->settings->gso_dg_size) * test->settings->gso_dg_size;
525525
} else {
526526
/* If gso_dg_size is 0 (unlimited bandwidth), use default UDP datagram size */
527-
test->settings->gso_dg_size = 1472; /* Standard UDP payload size for Ethernet MTU */
527+
test->settings->gso_dg_size = DEFAULT_UDP_BLKSIZE;
528528
}
529529
}
530530
#endif

0 commit comments

Comments
 (0)