aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/cc
Commit message (Collapse)AuthorAgeFilesLines
* cc_cubic: sync to the new specification of RFC9438 for TCP CUBIC.Cheng Cui2025-06-162-143/+181
| | | | | Reviewed by: rscheff Differential Revision: https://reviews.freebsd.org/D49540
* tcp cc: use tcp_compute_pipe() for pipe in xx_post_recovery() directlyCheng Cui2025-03-173-20/+3
| | | | | | | | This follows up with commit 67787d200488, and obsoletes the non-default pipe calculation from commit 46f584823798 nearly 25 years ago. Reviewed by: rscheff Differential Revision: https://reviews.freebsd.org/D49247
* tcp: make inflight data (pipe) calculation consistentCheng Cui2025-02-285-35/+5
| | | | | Reviewed by: glebius, rrs, tuexen Differential Revision: https://reviews.freebsd.org/D49047
* cc_cubic: remove redundant codeCheng Cui2025-02-202-15/+0
| | | | | | | | | | | | | | | During my progress on updating cc_cubic to RFC9438, found such redundancy as: - W_est: we use the alternative stack local variable `W_est` in `cubic_ack_received()`. - cwnd_prior: it is used for Reno-Friendly Region in RFC9438 Section 4.3, but we use the alternative cwnd from NewReno for Reno-Friendly as in commit ee45061051715be4704ba22d2fcd1c373e29079d. No functional change intended. Reviewed by: rscheff, tuexen Differential Revision: https://reviews.freebsd.org/D49008
* cc_cubic: remove redundant calls of tcp_fixed_maxseg()Cheng Cui2025-02-121-3/+2
| | | | | | | | | | Summary: No functional change intended. Reviewed by: rscheff, tuexen Subscribers: imp, melifaro, glebius Differential Revision: https://reviews.freebsd.org/D48967
* tcp: Use segment size excluding tcp options for all cwnd calculationsRichard Scheffenegger2024-11-148-53/+60
| | | | | | | | | | Avoid sending small segments by making sure that cwnd is usually calculated in full (data) segment sizes. Especially during loss recovery and retransmission scenarios. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47474
* tcp cc: Remove a stray semicolonZhenlei Huang2024-10-241-1/+1
| | | | MFC after: 1 week
* cc_cubic: use newreno to emulate AIMD in TCP-friendly regionCheng Cui2024-09-172-35/+27
| | | | | Reviewed by: rscheff, tuexen Differential Revision: https://reviews.freebsd.org/D46546
* tcp cc: re-organize newreno functions into parts that can be re-usedCheng Cui2024-09-172-73/+118
| | | | | Reviewed by: rscheff, tuexen Differential Revision: https://reviews.freebsd.org/D46046
* tcp cc: clean up some un-used cc_var flagsCheng Cui2024-08-151-4/+4
| | | | | Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D46299
* tcp cc: remove non-working sctp supportMichael Tuexen2024-07-2810-52/+32
| | | | | | | | | | | | As suggested by lstewart, remove the non-working SCTP support in the TCP congestion control modules. SCTP has a similar functionality (although not using kernel loadable modules), on which the TCP stuff was built on, but the integration was never done. No functional change intended. Reviewed by: Peter Lei, cc Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46142
* cc_cubic: remove the redundant variable num_cong_events from struct cubic.Cheng Cui2024-07-252-4/+0
| | | | | | | | | | Summary: This variable was added by commit eb5bfdd06565, but unnecessarily needed. No functional change. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D46042
* sys/netinet/cc: Switch from deprecated random() to prng32()Henrich Hartzer2024-05-233-10/+14
| | | | | | | | Related: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277655 Signed-off-by: henrichhartzer@tuta.io Reviewed by: imp, mav Pull Request: https://github.com/freebsd/freebsd-src/pull/1162
* tcp: need default in switch statement for enum.Richard Scheffenegger2024-02-251-0/+2
| | | | | | | fix clang error after c9b6241e250a4f1156e2150ccdbad0d3029dcef6 Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D44081
* tcp: address enum-int-mismatchRichard Scheffenegger2024-02-251-1/+1
| | | | fix gcc13 error after f74352fbcf15341accaf5a92240871f98323215d
* tcp: retain some CC signals outside of kernel scopeRichard Scheffenegger2024-02-241-1/+3
| | | | | | | | | | Summary: fix build error after f74352fbcf15341accaf5a92240871f98323215d Reviewers: #transport! Subscribers: imp, melifaro, glebius Differential Revision: https://reviews.freebsd.org/D44066
* tcp: cubic - restart epoch after RTORichard Scheffenegger2024-02-241-0/+1
| | | | | | | | | | | | | | This is a migitation to avoid sudden extreme jumps in cwnd, as t_epoch can be very out of date after an RTO. Per RFC9438, sec 4.8, t_epoch is to be reset whenever cwnd grows beyond ssthresh (CC phase transitions from slow start to congestion avoidance), to be fixed with the upcoming cc_cubic changes. MFC after: 3 days Reviewed By: cc, #transport Sponsored by: NetApp, Inc Differential Revision: https://reviews.freebsd.org/D44023
* tcp: use enum for all congestion control signalsRichard Scheffenegger2024-02-2410-56/+66
| | | | | | | | | | | | | Facilitate easier troubleshooting by enumerating all congestion control signals. Typecast the enum to int, when a congestion control module uses private signals. No external change. Reviewed By: glebius, tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43838
* tcp: prevent div by zero in cc_htcpRichard Scheffenegger2024-02-241-3/+3
| | | | | | | | | | | | | Make sure the divident is at least one. While cwnd should never be smaller than t_maxseg, this can happen during Path MTU Discovery, or when TCP options are considered in other parts of the stack. PR: 276674 MFC after: 3 days Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43797
* tcp: fix RTO ssthresh for non-6675 pipe calculationRichard Scheffenegger2024-02-145-5/+5
| | | | | | | | | | | Follow up on D43768 to properly deal with the non-default pipe calculation. When CC_RTO is processed, the timeout will have already pulled back snd_nxt. Further, snd_fack is not pulled along with snd_una. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43876
* tcp: calculate ssthresh on RTO according to RFC5681Richard Scheffenegger2024-02-085-21/+61
| | | | | | | | | | | per RFC5681, only adjust ssthresh on the initital retransmission timeout. Since RTO often happens during loss recovery, while cwnd no longer tracks all data in flight, calculcate pipe properly. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43768
* tcp: use tcp_fixed_maxseg instead of tcp_maxseg in cc modulesRichard Scheffenegger2024-02-084-4/+4
| | | | | | | | | | | | tcp_fixed_maxseg() is the streamlined calculation of typical tcp options and more suitable for heavy use in the congestion control modules on every received packet. No external functional change. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43779
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-278-8/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-169-17/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-164-8/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* tcp: Add and update cubic module variable namesRichard Scheffenegger2023-06-062-80/+103
| | | | | | | | | | | | | | | | | Prepare the cubic congestion control module to better align with the specifications in RFC8312bis. Rename a few cubic state variables to the variable names found in the RFC8312bis specification. This makes the code more understandable for someone reading the RFC and the code. It also makes the variable naming convention more uniform. Add some variables needed subsequently. No functional change. Submitted By: Bhaskar Pardeshi, VMware Inc. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D40436
* cc_cubic: Use units of micro seconds (usecs) instead of ticks in rtt.Cheng Cui2023-06-012-43/+50
| | | | | | | | | | This improves TCP friendly cwnd in cases of low latency high drop rate networks. Tests show +42% and +37% better performance in 1Gpbs and 10Gbps cases. Reported by: Bhaskar Pardeshi from VMware. Reviewed By: rscheff, tuexen Approved by: rscheff (mentor), tuexen (mentor)
* There are congestion control algorithms will that pull in srtt, and this can ↵Randall Stewart2023-05-192-7/+7
| | | | | | | | | | | | | cause issues with rack. When using rack, cubic and htcp will grab the srtt, but they think it is in ticks. For rack it is in micro-seconds (which we should probably move all stacks to actually). This causes issues so instead lets make a new interface so that any CC module can pull the srtt in whatever granularity they want. Reviewed by: tuexen Sponsored by: Netflix Inc Differential Revision:https://reviews.freebsd.org/D40146
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1210-10/+10
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Move access to tcp's t_logstate into inline functions and provide new ↵Randall Stewart2023-03-162-2/+2
| | | | | | | | | | | | tracepoint and bbpoint capabilities. The TCP stacks have long accessed t_logstate directly, but in order to do tracepoints and the new bbpoints we need to move to using the new inline functions. This adds them and moves rack to now use the tcp_tracepoints. Reviewed by: tuexen, gallatin Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D38831
* Rack cannot be loaded without cc_newreno compiled into the kernel.Randall Stewart2022-12-141-6/+2
| | | | | | | | | | | | Right now rack will fail to load due to its hack in accessing symbol names in cc_newreno. This was fine when newreno was always compiled into the kernel but now ... not so much. Instead lets fix up rack to use the socket option queries to get the information it wants and set the parameters. We also fix the CC parameter so they are always settable. Reviewed by: tuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D37622
* tcp: embed inpcb into tcpcbGleb Smirnoff2022-12-075-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the TCP protocol inpcb storage specify allocation size that would provide space to most of the data a TCP connection needs, embedding into struct tcpcb several structures, that previously were allocated separately. The most import one is the inpcb itself. With embedding we can provide strong guarantee that with a valid TCP inpcb the tcpcb is always valid and vice versa. Also we reduce number of allocs/frees per connection. The embedded inpcb is placed in the beginning of the struct tcpcb, since in_pcballoc() requires that. However, later we may want to move it around for cache line efficiency, and this can be done with a little effort. The new intotcpcb() macro is ready for such move. The congestion algorithm data, the TCP timers and osd(9) data are also embedded into tcpcb, and temprorary struct tcpcb_mem goes away. There was no extra allocation here, but we went through extra pointer every time we accessed this data. One interesting side effect is that now TCP data is allocated from SMR-protected zone. Potentially this allows the TCP stacks or other TCP related modules to utilize that for their own synchronization. Large part of the change was done with sed script: s/tp->ccv->/tp->t_ccv./g s/tp->ccv/\&tp->t_ccv/g s/tp->cc_algo/tp->t_cc/g s/tp->t_timers->tt_/tp->tt_/g s/CCV\(ccv, osd\)/\&CCV(ccv, t_osd)/g Dependency side effect is that code that needs to know struct tcpcb should also know struct inpcb, that added several <netinet/in_pcb.h>. Differential revision: https://reviews.freebsd.org/D37127
* tcp: provide macros to access inpcb and socket from a tcpcbGleb Smirnoff2022-11-087-11/+11
| | | | | | | There should be no functional changes with this commit. Reviewed by: rscheff Differential revision: https://reviews.freebsd.org/D37123
* tcp: allow packets to be marked as ECT1 instead of ECT0Richard Scheffenegger2022-11-081-1/+11
| | | | | | | | | | | | This adds the capability for a modular congestion control to select which variant of ECN-capable-transport it wants to use when sending out elegible segments. As an initial CC to utilize this, DCTCP was selected. Event: IETF 115 Hackathon Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D24869
* tcp: make RACK loadable again using the default configurationMichael Tuexen2022-09-262-1/+2
| | | | | | | | | | Without this patch, loading the RACK stack required the newreno CC module to be compiled into the kernel. This is not the case anymore since CUBIC is the default now. Reviewed by: rscheff@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D36707
* tcp: make CUBIC the default congestion control mechanism.Richard Scheffenegger2022-09-131-1/+1
| | | | | | | | | | | | | This changes the default TCP Congestion Control (CC) to CUBIC. For small, transactional exchanges (e.g. web objects <15kB), this will not have a material effect. However, for long duration data transfers, CUBIC allocates a slightly higher fraction of the available bandwidth, when competing against NewReno CC. Reviewed By: tuexen, mav, #transport, guest-ccui, emaste Relnotes: Yes Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D36537
* tcp: Make all references to CUBIC uppercaseRichard Scheffenegger2022-09-133-3/+3
| | | | | | | | | | | Consistently refer to the CUBIC congestion control mechanism in uppercase throughout all comments. No functional change. Reviewed By: #transport, tuexen, mav, guest-ccui, emaste Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D36547
* tcp cc: don't recurse on non recursive mutexMichael Tuexen2022-04-051-10/+19
| | | | | | | | This issue was found by syzkaller. Reviewed by: rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D34743
* Revert "sctp: remove a test, which isn't safe"Michael Tuexen2022-04-021-19/+10
| | | | | It included unrelated changes still under review. This reverts commit b1fe92b28ba2e77395598db1c2ff1976b55c86ab.
* sctp: remove a test, which isn't safeMichael Tuexen2022-04-021-10/+19
| | | | | | | We can't ensure the stcb is still around. This issue was found by syzkaller. MFC after: 3 days
* cc_vegas(4): Fix a typo in a source code commentGordon Bergling2022-04-021-1/+1
| | | | | | - s/measurment/measurement/ MFC after: 3 days
* Opps sorry, typo in the cc_cubic fix when morphing it from nreno.Randall Stewart2022-04-011-1/+1
|
* hystart++ may not properly exit CSS back to slowstart.Randall Stewart2022-04-012-0/+2
| | | | | | | | | | | | In the changes to get hystart++ into cubic an inadvertent line was removed in the conditional to figure out if you need to exit hystart++ back to slowstart. The line of course is the most crucial one (the others are valid but not critical) i.e. is the new rtt less than the point where we entered hystart++. Without the line we end up bouncing in and out of CSS. Reported By: Reese Enghardt Sponsored By: Netflix Inc.
* tcp: Congestion control move to using reference counting.Randall Stewart2022-02-212-64/+143
| | | | | | | | | | | | | | | | | | | | | | In the transport call on 12/3 Gleb asked to move the CC modules towards using reference counting to prevent folks from unloading a module in use. It was also agreed that Michael would do a user space utility like tcp_drop that could be used to move all connections that are using a specific CC to some other CC. This is the half I committed to doing, making it so that we maintain a refcount on a cc module every time a pcb refers to it and decrementing that every time a pcb no longer uses a cc module. This also helps us simplify the whole unloading process by getting rid of tcp_ccunload() which munged through all the tcb's. Instead we mark a module as being removed and prevent further references to it. We also make sure that if a module is marked as being removed it cannot be made as the default and also the opposite of that, if its a default it fails and does not mark it as being removed. Reviewed by: Michael Tuexen, Gleb Smirnoff Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D33249
* tcp: Add hystart++ to our cubic implementation.Randall Stewart2022-02-076-130/+389
| | | | | | | | | | | | As promised to the transport call on 11/4/22 here is an implementation of hystart++ for cubic. It also cleans up the tcp_congestion function to have a better name. Common variables are moved into the general cc.h structure so that both cubic and newreno can use them for hystart++ Reviewed by: Michael Tuexen, Richard Scheffenegger Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D33035
* Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"Cy Schubert2021-12-021-4/+3
| | | | | | | | This reverts commit 266f97b5e9a7958e365e78288616a459b40d924a, reversing changes made to a10253cffea84c0c980a36ba6776b00ed96c3e3b. A mismerge of a merge to catch up to main resulted in files being committed which should not have been.
* wpa: Import wpa_supplicant/hostapd commit 14ab4a816Cy Schubert2021-12-021-3/+4
| | | | | | This is the November update to vendor/wpa committed upstream 2021-11-26. MFC after: 1 month
* tcp: unloading a module that is set to default should error.Randall Stewart2021-12-021-4/+3
| | | | | | | | | | I just discovered that the return of the EBUSY error was incorrectly rigged so that you could unload a CC module that was set to default. Its supposed to be an EBUSY error. Make it so. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D33229
* cc_newreno(4): Fix a typo in a source code commentGordon Bergling2021-11-191-1/+1
| | | | | | - s/conditons/conditions/ MFC after: 3 days
* tcp: Ensure that vnets have an initialized V_default_cc_ptrMark Johnston2021-11-121-0/+17
| | | | | | | | | This causes new vnets to inherit the cc algorithm from vnet0. This is a temporary patch to fix vnet jail creation. With encouragement from: glebius Fixes: b8d60729deef ("tcp: Congestion control cleanup.") Differential Revision: https://reviews.freebsd.org/D32970