net: lib: zperf: fix internal UDP header definition
Fix the zperf UDP datagram header definition, as iperf introduced a backwards incompatible format change in version 2.0.10 (August 2017). ``` struct UDP_datagram { // used to reference the 4 byte ID number we place in UDP datagrams // Support 64 bit seqno on machines that support them uint32_t id; uint32_t tv_sec; uint32_t tv_usec; uint32_t id2; }; ``` Update the header to the new format, with a Kconfig option to fall back to the previous header definition. The response decoding was testd with a nRF7002 client and `iperf-2.2.1-win64.exe` server, with the output statistics struct now containing the same information as reported on the PC server. Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
parent
5f20f41808
commit
5c8b7cdd89
2 changed files with 12 additions and 1 deletions
|
@ -13,6 +13,14 @@ menuconfig NET_ZPERF
|
||||||
|
|
||||||
if NET_ZPERF
|
if NET_ZPERF
|
||||||
|
|
||||||
|
config NET_ZPERF_LEGACY_HEADER_COMPAT
|
||||||
|
bool "Legacy iperf UDP header format"
|
||||||
|
help
|
||||||
|
iperf 2.0.10 (2017) updated the UDP header format in a
|
||||||
|
backwards incompatible manner that cannot be automatically
|
||||||
|
detected. This option reverts the header format for use with
|
||||||
|
iperf version 2.0.9 and earlier.
|
||||||
|
|
||||||
config ZPERF_WORK_Q_THREAD_PRIORITY
|
config ZPERF_WORK_Q_THREAD_PRIORITY
|
||||||
int "zperf work queue thread priority"
|
int "zperf work queue thread priority"
|
||||||
default NUM_PREEMPT_PRIORITIES
|
default NUM_PREEMPT_PRIORITIES
|
||||||
|
|
|
@ -54,9 +54,12 @@
|
||||||
#define ZPERF_VERSION "1.1"
|
#define ZPERF_VERSION "1.1"
|
||||||
|
|
||||||
struct zperf_udp_datagram {
|
struct zperf_udp_datagram {
|
||||||
int32_t id;
|
uint32_t id;
|
||||||
uint32_t tv_sec;
|
uint32_t tv_sec;
|
||||||
uint32_t tv_usec;
|
uint32_t tv_usec;
|
||||||
|
#ifndef CONFIG_NET_ZPERF_LEGACY_HEADER_COMPAT
|
||||||
|
uint32_t id2;
|
||||||
|
#endif
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
BUILD_ASSERT(sizeof(struct zperf_udp_datagram) <= PACKET_SIZE_MAX, "Invalid PACKET_SIZE_MAX");
|
BUILD_ASSERT(sizeof(struct zperf_udp_datagram) <= PACKET_SIZE_MAX, "Invalid PACKET_SIZE_MAX");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue