Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP: simplify readahead #3948

Merged
merged 5 commits into from Jun 29, 2021
Merged

TCP: simplify readahead #3948

merged 5 commits into from Jun 29, 2021

Conversation

yamt
Copy link
Contributor

@yamt yamt commented Jun 18, 2021

Summary

tcp: simplify readahead

Do not bother to preserve segment boundaries in the tcp
readahead queues.

* Avoid wasting the tail IOB space for each segments.
  Instead, pack the newly received data into the tail space
  of the last IOB. Also, advertise the tail space as
  a part of the window.

* Use IOB chain directly. Eliminate IOB queue overhead.

* Allow to accept only a part of a segment.

* This change improves the memory efficiency.
  And probably more importantly, allows less-confusing
  recv window advertisement behavior.
  Previously, even when we advertise N bytes window,
  we often couldn't actually accept N bytes. Depending on
  the segment sizes and IOB configurations, it was causing
  segment drops.
  Also, the previous code was moving the right edge of the
  window back and forth too often, even when nothing in
  the system was competing on the IOBs. Shrinking the
  window that way is a kinda well known recipe to confuse
  the peer stack.

Impact

tcp

Testing

a few concurrent receiving connections on esp32

@yamt yamt force-pushed the tcp8 branch 2 times, most recently from 92d9fab to 2a305ee Compare June 18, 2021 16:12
yamt added 5 commits June 28, 2021 20:04
* Move the code to advance rcvseq for user data from tcp_input
  to receive handlers.
  Motivation: allow partial ack.

* If we drop a segment, ignore FIN as well. Note than tcp FIN bit is
  logically after the user data in the same segment.
I plan to use a simple IOB chain w/o IOB queue for tcp recv buffers.
for large configurations, uint16_t is not large enough to represent
the entire socket buffer.
Do not bother to preserve segment boundaries in the tcp
readahead queues.

* Avoid wasting the tail IOB space for each segments.
  Instead, pack the newly received data into the tail space
  of the last IOB. Also, advertise the tail space as
  a part of the window.

* Use IOB chain directly. Eliminate IOB queue overhead.

* Allow to accept only a part of a segment.

* This change improves the memory efficiency.
  And probably more importantly, allows less-confusing
  recv window advertisement behavior.
  Previously, even when we advertise N bytes window,
  we often couldn't actually accept N bytes. Depending on
  the segment sizes and IOB configurations, it was causing
  segment drops.
  Also, the previous code was moving the right edge of the
  window back and forth too often, even when nothing in
  the system was competing on the IOBs. Shrinking the
  window that way is a kinda well known recipe to confuse
  the peer stack.
@yamt yamt marked this pull request as ready for review June 28, 2021 11:25
@yamt yamt mentioned this pull request Jun 29, 2021
@masayuki2009
Copy link
Contributor

As discussed in #3991 (comment)
Let me merge this PR first.

@masayuki2009 masayuki2009 merged commit 4878b77 into apache:master Jun 29, 2021
@Ouss4 Ouss4 added this to To-Add in Release Notes - 10.2 Oct 11, 2021
@jerpelea jerpelea moved this from To-Add to fixes in Release Notes - 10.2 Oct 13, 2021
@jerpelea jerpelea moved this from fixes to Added in Release Notes - 10.2 Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants