
Legacy TCP stack is bad. Here are some of the known issues: * tcp packet from other connection can break a current one * tcp send sequence always starts from zero * bad tcp options processing * strange assumptions on packet size for selective acknowledge * tcp interface assumes one of the two scenarios: - data downloading from remote host to a board - request-response exchange with a small packets so it's not possible to upload large amount of data from the board to remote host. * wget test generate bad tcp stream, test should fail but it passes instead
This series of patches fixes all of the above issues.
The benefits: * A lot of bug was fixed * Better and more reliable TCP state machine * Tcp clients becomes smaller/simpler * Data uploading was fixed (now it's possible to transmit a huge amount of data from the board to remote host)
Modification was verified with * firmware downloading via u-boot wget command * fastboot over tcp * netcat linux client using test netcat implementation (not included to this patch series) * Firefox/Chrome/Edge using test web-server implementation (not included to this patch series)
Changes v2: * cover letter was added * some patches were removed
Changes v3: * better cover letter
Changes v4: * fix bug in debug output * add more comments * code style fixes
Changes v5: * old patches were occasionally sent with v4 * add back web-server patches * fix bug in debug output * add more comments * code style fixes
Changes v6: * fix the wget test * improve description of "simplify tcp header filling code" patch
Changes v7: * fix include ordering * improve option descriptions * fix a lot of extra brackets and comparisons against NULL / 0 * add empty lines before final returns * fixed a bug with zero size httpd uploads
Changes v8: * [tcp] add function to restart rx inactivity timeout. This may help in the cases where remote peer waits for u-boot data, but u-boot is busy with long executing action * [httpd] add function returning underlying tcp stream from request id. This (with the above change) allows avoid connection break for the long processing post requests.
Changes v9: * rebase all changes on top of origin/next * update test/cmd/wget patch description (bad tcp ack/seq issue was already fixed in origin/next) * tcp: add rx/tx packet counters to a tcp_stream structure * wget: use tcp rx packet counter instead of own one * netcat: use tcp rx/tx packet counters instead of own one
Changes v10: * netcat: fix bug appeared after rx/tx packet counter addition * rebased on top of v2024.10
Changes v11: * fix spelling in cover letter
Changes v12: * rebase on top of master branch (3df6145db0e) * slightly change tcp->rx() & tcp->tx() callback declarations, this allow us to terminate a connection if something goes wrong in rx/tx paths. * set net_boot_file_size variable in httpd_upload * set filesize env variable to a proper value netcat and httpd_upload
Changes v13: * rebase on top of master branch (8573ea41058) * remove netcat support * remove example httpd server implementation
Changes v14: * fix issues found by github CI
Changes v15: * Rebase on top of next branch (5947cd76acd) * Add support of HTTP HEAD request to wget command. Thus it should work the same way as original wget from the next branch. Seems this is needed for efi http booting. * Parse HTTP status line in wget the same way as implemented in original wget from the next branch. Seems this is needed for efi http booting. * Fix bogus server response with an actual response from the HTTP server in test/cmd/wget. This makes a test more correct and beautifull. * Some debug messages were improved * Minor patches clenup
Mikhail Kshevetskiy (11): net/tcp: fix TCP options processing net/tcp: fix selective acknowledge net/tcp: put connection specific data into a tcp_stream structure net/tcp: add connection info to tcp_stream structure net/tcp: rename ack_edge and seq_init to more common rcv_nxt and irs net/tcp: improve tcp framework, use better state machine test/cmd/wget: fix the test test/cmd/wget: replace bogus response with an actual response from the HTTP server net/tcp: simplify tcp header filling code net/tcp: define a fallback value for rcv_wnd size net/net: fix include ordering
arch/sandbox/include/asm/eth.h | 4 + include/net-legacy.h | 5 +- include/net/tcp.h | 257 ++++++- include/net/wget.h | 8 - net/fastboot_tcp.c | 193 ++--- net/net.c | 45 +- net/tcp.c | 1297 ++++++++++++++++++++++---------- net/wget.c | 551 +++++--------- test/cmd/wget.c | 81 +- 9 files changed, 1504 insertions(+), 937 deletions(-)