HIL: measure device-to-host iperf rate for net_lwip_webserver

Open
#4,478 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c

Research direction

Start by reading check_iperf in test/hil/net_test.py and the cited lwiperf_tcp_recv in lib/lwip/src/apps/lwiperf/lwiperf.c; reproduce the reverse-mode failure and inspect the initial TCP segments with tcpdump in the board's network namespace. Choose and implement a device-to-host measurement approach, then confirm the check accepts only a complete CSV report and reports both rx and tx rates.

Written by the indexing model from the issue text.

Description

follow-up Prio 📌

The device/net_lwip_webserver HIL cell reports only the host-to-device TCP rate (#3918). Device-to-host is not measured: both iperf 2 modes that make lwiperf send fail against the rigs' iperf 2.2.1.

Evidence

ci.lan stm32f407disco (FS), net_lwip_webserver at 26adc208a+#3918, iperf 2.2.1 (4 Nov 2024) inside the board's network namespace (host 192.168.7.2, device 192.168.7.1), 2026-11-10:

$ iperf -c 192.168.7.1 -t 3 -y C
20261110074851,192.168.7.2,38608,192.168.7.1,5001,1,0.0-3.3,1441856,3538660      # host->device works
$ iperf -c 192.168.7.1 -t 3 -r
[  1] tcp write failed
[  1] shutdown failed: Transport endpoint is not connected
[  1] 0.0000-0.0127 sec  74.1 KBytes  47.9 Mbits/sec
ERROR: expected reverse connect did not occur                                     # rc 0
$ iperf -c 192.168.7.1 -t 3 -d -y C
[  1] tcp write failed
20261110074859,192.168.7.2,52588,192.168.7.1,5001,1,0.0-0.0,75920,87921250
20261110074903,192.168.7.1,49153,192.168.7.2,5001,2,0.0-4.0,24,48                  # rc 0

-e -r fails the same way. In both modes the device drops the client's connection after ~74 KB, before the 128 KiB header recheck in lwiperf_tcp_recv (lib/lwip/src/apps/lwiperf/lwiperf.c), and its reverse leg sends only the 24-byte header. Not root-caused: the likely cause is iperf 2.1+'s extended client header, which lwiperf (written for iperf 2.0.5) does not parse. iperf 2.1+'s -R reverse uses a protocol flag lwiperf does not support.

Remaining work

  • Confirm the cause, e.g. tcpdump in the namespace of the first segments of a -r run.
  • Pick a way to measure device-to-host, then add it to check_iperf in test/hil/net_test.py (the cell becomes rx/tx). Options:
    • make lwiperf accept iperf 2.1+'s header (a patch to the lwIP dependency);
    • have the firmware start lwiperf_start_tcp_client toward a host iperf -s on request;
    • serve a large generated HTTP body and time its download.
  • Keep check_iperf's rule that only a whole CSV report counts: iperf 2 exits 0 on all the failures above.
Dominant language
C
Stars
7.3k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
67

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hathach/tinyusb

All issues in hathach/tinyusb

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.