1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00
Commit Graph

83 Commits

Author SHA1 Message Date
Konstantin Tsoy
21ea1990ab Add a useSplitConnectionCallbacks to mvfst
Summary:
This change just adds a (currently no-op) flag that will be used in diffs up the stack.

The idea here is that I'll add split QUIC connection callback interfaces that will live side by side with existing single monolithic callback for now. We will experiment with split callbacks on small scale to see that there is no regressions and then will phase out the old callback gradually.

This flag is to control which callback(s) to use.

Reviewed By: mjoras

Differential Revision: D30399667

fbshipit-source-id: 8fc4e4a005e93cf6d48a987f49edee33b90dbbf1
2021-08-31 18:27:40 -07:00
Konstantin Tsoy
ee59ae43c6 resetConnectionCallbacks() util function
Summary: In preparation for split callbacks

Reviewed By: mjoras, lnicco

Differential Revision: D30398849

fbshipit-source-id: 684c289283d0b06b5935fc1b8ab2dcbd126ec0ce
2021-08-25 16:15:42 -07:00
Joseph Beshay
5e2f5719b7 Remove all remaining references to QuicVersion::MVFST_D24
Summary:
- Remove QuicVersion::MVFST_D24 (3625d9e7af) constant
- Remove all references in QUIC code
- Remove external references
- Change Liger defaults that referred to the removed constant value

Reviewed By: mjoras

Differential Revision: D29767833

fbshipit-source-id: 980b3c4a7f190442577c3dede14127e77ce472fa
2021-07-20 13:31:10 -07:00
Matt Joras
003f012cb7 TODO comment cleanup.
Summary:
These are either no longer relevant, are unlikely to be done, or are spculative enough that they don't deserve code space.

Hope here is to make our search for TODOs higher signal.

Reviewed By: lnicco

Differential Revision: D29769792

fbshipit-source-id: 7cfa62cdc15e72d8b7b0cd5dbb5913ea3ca3dc5a
2021-07-20 10:27:32 -07:00
Joseph Beshay
9e2ba784e0 Add transport knob to control MAX_PACING_RATE
Summary: Add a new transport knob (MAX_PACING_RATE_KNOB) to allow the client to suggest a limit on the pacing rate used by the server, if it has pacing enabled.

Reviewed By: mjoras

Differential Revision: D29335469

fbshipit-source-id: 8f0a881e8235e0d787ea86ba1e268a36eecf6151
2021-07-07 18:26:56 -07:00
Matt Joras
bb4dec79ac Bail if we are missing either CID.
Summary:
This function actually assumes both are there. This mostly happens in unit tests anyway.

(Note: this ignores all push blocking failures!)

Reviewed By: yangchi

Differential Revision: D29187689

fbshipit-source-id: a7ca516c18de4f0261ffec985f1d4e9f63b071d9
2021-06-17 19:57:43 -07:00
Udip Pant
1241731b18 reduce log spam in QuicServerTransport
Summary: Reduced the log level on transport knob updates to avoid excessive logs

Reviewed By: lnicco

Differential Revision: D29151246

fbshipit-source-id: f718792736c1aa7e03511c409912b58a981c2c64
2021-06-16 13:10:35 -07:00
Joseph Beshay
38440d787c Add transport knob for totalBufferSpaceAvailable to test an equivalent of TCP's NOTSENT_LOWAT
Summary:
Add a new transport knob `NOTSENT_BUFFER_SIZE_KNOB` that will allow us to run quick experiments for different buffer sizes on the server side.

## Background
In TCP, the send buffer accounts for both the unacked and unsent data. SO_SNDBUF is the sum of both and is statically configured for the socket. TCP_NOTSENT_LOWAT only limits the unsent data which still allows the SO_SNDBUF to still accommodate a big BDP.

In mvfst, the buffer usage we currently track (sumCurStreamBufferLen) is only for unsent data. Its size is controlled by the TransportSetting totalBufferSpaceAvailable. Unacked packets are tracked as outstanding packets and do not count toward that buffer space. Effectively, a limit on this buffer achieves the same effect as TCP's NOTSENT_LOWAT socket option.

Reviewed By: mjoras, yangchi

Differential Revision: D28843244

fbshipit-source-id: 3b61619038f3b41508fe76c2873e41486ae97739
2021-06-03 17:37:43 -07:00
Frank Cangialosi
d5177fd458 add new transport knobs: cc type and rtt factor
Summary:
add 3 new transport knobs:
1. set congestion control algorithm (string algorithm name)
2. set pacing rtt factor to be used during "startup" phase of congestion control, right now only used by bbr and copa
3. set pacing rtt factor to be used by default during congestion control, right now only used by bbr and copa

Reviewed By: yangchi

Differential Revision: D28462540

fbshipit-source-id: 2c861885e472cb2bce0b51daeef2b143e9628080
2021-05-18 17:57:55 -07:00
Yang Chi
f5fbaeb5e8 Move QUIC DSR Scheduler, PacketBuilder, WriteCodec and WriteFunctions to
Summary: make space for backend subdir

Reviewed By: mjoras

Differential Revision: D27999777

fbshipit-source-id: 1d270b8ce3349980a1e4c68035a1f39c095237b5
2021-05-10 16:55:12 -07:00
Yang Chi
38c903ba2f Remove all QUIC_TRACEs
Summary: no longer used

Reviewed By: lnicco

Differential Revision: D28141008

fbshipit-source-id: 870d6574cc1657914a08f1ef5ee581cfef96aad1
2021-05-10 12:46:08 -07:00
Yang Chi
047c654d05 Put QUIC packetization requests writing behind a TransportSettings flag
Summary: disable by default

Reviewed By: mjoras

Differential Revision: D27896833

fbshipit-source-id: 4a16e9661abb5f211972426d5c70b6a479fb969d
2021-05-04 18:38:59 -07:00
Yang Chi
cdacec015a QuicServerTransport write DSR packetization requests
Summary:
This diff hooks the DSR write function into QuicServerTransport's
write path.

Reviewed By: mjoras

Differential Revision: D27890711

fbshipit-source-id: ac4452373c0baafe091f93fb54fccf87be604a9c
2021-05-04 01:08:16 -07:00
Yang Chi
a16f502393 Adding control of the starting packet number in a server connection
Summary: as title, this is a testing only API

Reviewed By: mjoras

Differential Revision: D27746039

fbshipit-source-id: cf87836810a4579f622152ccb17aca49a0d605e3
2021-04-27 13:57:51 -07:00
Yang Chi
cc4f57811d Custom crypto factory
Summary:
as title. This also moves a FizzCryptoTestFactory from FizzCryptoFactoryTest to TestUtils so that it can be used in other test code

This change has an unfortunate side-effect that cryptoFactory_ in both client and server will be moved from stack to heap.

Reviewed By: mjoras

Differential Revision: D27264488

fbshipit-source-id: febc307fb02cb136d58fe70bee648d35431acff0
2021-04-27 13:57:51 -07:00
Matt Joras
d4df9b9ef9 Don't vary server packet length based on v4/v6.
Summary: This seems to cause some issues with CGNAT type networks where the client is actually using v6 or v4.

Reviewed By: yangchi

Differential Revision: D27772485

fbshipit-source-id: ac118441caad38301f2a22e657cefb398a5210da
2021-04-14 18:10:52 -07:00
Matt Joras
55e0fa070e Send probes on all spaces take 2.
Summary:
As before we will now aggressively send probes on all spaces with probes available when the PTO timer fires.

This time with more unit tests and some bug fixes.

Reviewed By: yangchi

Differential Revision: D27338523

fbshipit-source-id: 8a9ccb90ed691e996fab4afa2f132c0f99044fbc
2021-04-02 14:59:57 -07:00
Matt Joras
a92a24bdd5 Back out "Send probes for all spaces."
Summary: As in title. There's a bug here somewhere with empty write loops we need to find.

Reviewed By: yangchi

Differential Revision: D27279100

fbshipit-source-id: e1d26fbf8d6df1590d464a6504a8b940b46794e0
2021-03-23 16:10:12 -07:00
Matt Joras
bceb00346b Send probes for all spaces.
Summary:
Previously we would only send probes for the first space which had one available, i.e. Initial before Handshake before AppData. Since we only have one PTO timer this can lead to situations where we perpetually probe with only Initials, which can significantly delay the handshake if we should have probed with Handshakes.

With this diff we will keep the single PTO timer but aggressively write more probes from all spaces if they are available.

Additionally this refactors some counters into EnumArrays

Reviewed By: yangchi

Differential Revision: D27235199

fbshipit-source-id: ef3614a833bf0f02f5806846a1335fa7ac2a4dc8
2021-03-23 12:51:36 -07:00
Andrii Vasylevskyi
10a6feed49 Reset congestion controller after setting factory
Summary:
Before the change, there's no good way to recreate Cubic CC instance with custom CC factory, because Cubic is created by default.

On client side this requires calling setCongestionControl() or setTransportSettings() after calling setCongestionControllerFactory(), which is normally the case.

Reviewed By: yangchi

Differential Revision: D26401996

fbshipit-source-id: dfda39be835c67b9db42f726b3ac64c7b3d37c2f
2021-02-19 17:55:10 -08:00
Andrii Vasylevskyi
b1a364b9dd QuicConnectionStats type change from string to the "native"
Reviewed By: lnicco

Differential Revision: D26379617

fbshipit-source-id: 308d53ca86c2a2e774e3618038eece7091482ed8
2021-02-19 10:47:02 -08:00
Andrii Vasylevskyi
ba71671bb2 QuicConnectionStats for client socket
Summary: Adding QuiConnectionStats to client transport. Moving getConnectionsStats() logic from server worker into transport base class.

Reviewed By: lnicco

Differential Revision: D26316635

fbshipit-source-id: a384eee5d1bc7b23d908e0b03fafcc4ee962b0b9
2021-02-19 10:47:02 -08:00
Sridhar Srinivasan
bd1ed4b7c0 Make the important Observer callbacks configurable
Summary:
Given the large number of callbacks that are being triggered from the Observer
this change makes it possible to enable through a simple config, just the
subset of callbacks that a consumer is interested in receiving.

Observer and Socket Lifecycle callbacks are enabled by default, they are not
configurable.

Reviewed By: bschlinker

Differential Revision: D25879382

fbshipit-source-id: abe79ed92e958ddc96475c347f8ec7204400cdfa
2021-01-13 15:35:06 -08:00
Sridhar Srinivasan
27fe474171 Migrate the QUIC and TransportMonitor libraries to use the new unified Observer callback class
Summary:
We were using the LifecycleObserver and InstrumentationObserver classes
separately, to generate and receive callbacks.

This change migrates both these to use the unified Observer callback class and
adjusts the unit tests.

Reviewed By: bschlinker

Differential Revision: D25845845

fbshipit-source-id: c489400f5d70bccadbcc1d957136c5ade36b65ff
2021-01-13 15:35:06 -08:00
Yang Chi
711f03dc91 Keep stats of unfinished handshake in Quic server transport
Summary: as title

Reviewed By: avasylev

Differential Revision: D25674498

fbshipit-source-id: d0ac116462bf5f95ee67f5f2c5510e7a1701f2fd
2020-12-22 12:13:07 -08:00
Xiaoting Tang
bc70f0be9d Add stats for transport knobs
Summary:
This adds visibility over the transport knobs. Will be helpful when we add more knobs (e.g. canary token).

I'll remove them for the sake of storage once we're sure the plumbing works.

Reviewed By: avasylev

Differential Revision: D24929923

fbshipit-source-id: a64bb6e613f3a69a47bf9b32e8c31890ad1afdfc
2020-11-13 12:17:33 -08:00
Xiaoting Tang
beb9fb3b48 Check for empty knob in client and server
Summary: ^

Reviewed By: mjoras

Differential Revision: D24707524

fbshipit-source-id: ae8fd88ed1f1b05e44f8f5a7f8523c654d6de937
2020-11-05 12:45:18 -08:00
Xiaoting Tang
d985a8fcc1 Add transport knob to enforce udp payload size
Summary: Adds another knob param to enforce udp payload size. This is basically a "canIgnorePathMTU" knob that client has.

Reviewed By: mjoras

Differential Revision: D24586165

fbshipit-source-id: befb265a24fae8f450f323cf2d652a8b448e698c
2020-11-05 12:45:18 -08:00
Xiaoting Tang
df1811b3b8 Add transport knob to turn off blackhole detection
Summary: Blackhole detection has quite a lot false positives, we want to have a way to run d6d without it.

Reviewed By: mjoras

Differential Revision: D24584357

fbshipit-source-id: ab27655ec38d62fd6deffe41cb156de0c981cf6d
2020-11-02 15:50:42 -08:00
Xiaoting Tang
3b1db55d76 Server handling of transport knob params
Summary: To scale well when we have more transport knob params, server can maintain a map from param id -> handler function. The handler function should avoid storing states / perform proper checking if it does. Most use cases should be covered by the "server_conn" param.

Reviewed By: mjoras

Differential Revision: D24584358

fbshipit-source-id: e45da50deb6ebd385b6a71e1b48f4650bc6ace91
2020-11-02 11:48:19 -08:00
Xiaoting Tang
0e2363b634 Deserialize transport knob
Summary: Temporarily, we use a simple json-format for transport knob. Currently it's limited to a single packet, but that should be enough for current usage.

Reviewed By: mjoras

Differential Revision: D24584261

fbshipit-source-id: f51ed0fb7560cda2ca447a49d9ad6575c1b2a59f
2020-11-02 11:48:19 -08:00
Xiaoting Tang
6a782bda39 Add pmtuProbingStarted event to instrumentation observer
Summary: ^

Reviewed By: bschlinker

Differential Revision: D24464391

fbshipit-source-id: c976b9496031290cb4b6c3f29862c1f7d4ebf065
2020-10-22 10:18:57 -07:00
Xiaoting Tang
bcb7a8f08a Fix flaky d6d test
Summary: The D6DEnabled integration test was flaky because of a race condition between stats callback and client's transportReady callback. Simple fix by ~~send some data and wait for echo~~ calling terminateLoopSoon in onConnectionD6DStarted. Still, it makes sense to make transportReady the last callback in server so I switched the order.

Reviewed By: yangchi

Differential Revision: D24198017

fbshipit-source-id: 36a7b6377c970b2f2f5d072f03d8bc8b0837fd79
2020-10-08 15:14:24 -07:00
Xiaoting Tang
179d0aceef Add quic stats for d6d events
Summary: This increases visibility over d6d lifecycle.

Reviewed By: avasylev

Differential Revision: D24026410

fbshipit-source-id: ee382a5fb60e48d4ee441ad760251673a10c85da
2020-10-01 22:35:07 -07:00
Xiaoting Tang
f4086dc092 Make commonly-used d6d types individual target
Summary: This reduces dependencies for both testing and instrumentation.

Reviewed By: mjoras

Differential Revision: D23997313

fbshipit-source-id: 5eb3a790c7bb2569dc1e941e3911ad4aac4e9258
2020-09-30 09:32:50 -07:00
Xiaoting Tang
f4ae0d7172 Always delay before sending the next probe
Summary:
After some experiments where probes are obviously causing congestion, it now
makes sense to pose some delay before sending the next probe. This is not
mentioned in the d6d spec, but in a related spec rfc4821 iirc, where consecutive
probes should have 1sec delay.

Reviewed By: mjoras

Differential Revision: D23910766

fbshipit-source-id: dcf5d05c4590489be503563c98144e12c3987cff
2020-09-25 13:36:13 -07:00
Xiaoting Tang
37cd692593 Refactor d6d pending events into a single struct
Summary: As a drive-by: fixed a bug where I didn't cancel the pending event when timeouts expire.

Reviewed By: mjoras

Differential Revision: D23910767

fbshipit-source-id: 233e590c17a6c6b7a5f4a251bd8f78f6dfae3c0b
2020-09-25 13:36:13 -07:00
Xiaoting Tang
5317134c84 Timeouts that drive d6d lifecycle
Summary:
This glues together the d6d lifecycle via probe timeout and raise timeout.
Had to put these two timeouts in the base transport because it has all the
necessary accountings (e.g. check close state, process callbacks) that should
happen before scheduling timeouts.

Other notable changes (included here because code is simple):
- Keep track of d6d probes in loss state. Upon second thought, it makes more
sense because we are reducing the available bandwidth as a result of sending
probes anyway. And not tracking them imposes a delay on congestion controller.
I think this does not violate the d6d spec's point of not penalizing congestion
window for d6d probes, because
    - 1. we don't put losses of d6d probes in loss event. Therefore from the POV of
congestion controller, d6d probes never get lost.
    - there will be at most kDefaultD6DMaxOutstandingProbes losses (i.e.  2)
that we don't tell congestion controller about. Even if those are actually
caused by congestion, it should have minimal impact because 2 is small and if there's really a congestion, the loss of normal packets should provide the signal.
- Pacing d6d probes
- Kick off d6d after a delay of 1s. This should filter out short-lived connections where probing is relatively expensive and less useful.

Reviewed By: mjoras

Differential Revision: D23736656

fbshipit-source-id: 8121fa8bcebab10a56a4e046c32c4e99ed6c3013
2020-09-22 08:44:25 -07:00
Xiaoting Tang
4edeb4b056 Add hasReadCipher
Summary:
This is one of the pre-condition of starting d6d probing. Starting d6d once
hasWriterCipher() is too early becaue an overlarge PMTU could potentially
cause the server to send oversized handshake packet and disrupt handshake.

Reviewed By: yangchi

Differential Revision: D23698784

fbshipit-source-id: f18824a8ef516421832d8cc769f4880a0841e492
2020-09-16 09:26:01 -07:00
Amaury Séchet
a92dfc18eb Pass FizzServerContext using FizzServerQuicHandshakeContext (#165)
Summary:
This remove one more fizz specific element from the common API

Depends on https://github.com/facebookincubator/mvfst/issues/162

Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/165

Reviewed By: yangchi

Differential Revision: D23637314

Pulled By: xttjsn

fbshipit-source-id: a3436510accc37687f6e3ea770fd120fa314ecdc
2020-09-14 13:08:46 -07:00
Amaury Séchet
04c63839e4 Start splitting the fizz specific parts of the server (#160)
Summary:
This is following a similar pattern than what was done for the client side.

Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/160

Reviewed By: yangchi

Differential Revision: D23560951

Pulled By: xttjsn

fbshipit-source-id: 351417cbfa3230112fff4c4de59b307f88389cf6
2020-09-08 17:17:47 -07:00
Xiangyu Bu
54ec33e474 Add API to get client cert from QuicSocket.
Summary: This diff adds an API to expose client certificate from QuicSocket.

Reviewed By: mjoras, lnicco

Differential Revision: D20374792

fbshipit-source-id: 1b0691bba49ef57cb824aba8563644afc7b1962b
2020-08-31 12:25:05 -07:00
Luca Niccolini
c47c3cf5c6 Revert PMTU and size-enforced packet builder
Differential Revision: D23283619

fbshipit-source-id: b7fe31871dad5711016234a2d10ae84edc4fd24c
2020-08-22 16:55:54 -07:00
Xiaoting Tang
4762cfb927 Introduce PMTU as a variable
Summary:
First step towards d6d. Semantically we need to separate the old `udpSendPacketLen` into `peerMaxPacketSize` as well as `currPMTU`. The former is directly tied to the peer's max_packet_size transport parameter whereas the second is controlled by d6d. To get the actual udp mss, call `conn_->getUdpSendPacketLen()`, which will use the minimum of the two if d6d is enabled, otherwise it will fallback to use `peerMaxPacketSize` only.

During processClientInitialParams and processServerInitialParams, we no longer need to check whether `canIgnorePathMTU` is set because that logic is moved to `setUdpSendPacketLen`. If d6d is enabled, we set both `peerMaxPacketSize` and `currPMTU` to `packetSize` because receiving an initial packet of size x indicates both that the peer accepts x-sized packet and that the PMTU is at least x.

Many call sites and tests are changed.

Faebook:
For now, d6d is considered enabled if `canIgnorePathMTU==false` and `turnoffPMTUD==true`. Down the road, from semantic & practical POV at least one of them should be renamed to something like `enableD6D`, since enabling d6d implies turning off PMTUD and that we should not ignore PMTU. We can keep one for the sake of testing.

Reviewed By: mjoras

Differential Revision: D22049806

fbshipit-source-id: 7a9b30b7e2519c132101509be56a9e63b803dc93
2020-08-17 16:15:24 -07:00
Frank Cangialosi
aea1b1cef8 add ccpDatapath to QuicConnectionStateBase and add setters/getters
Summary:
The way libccp is structured, it requires each instance of the QuicCCP cc algorithm to access a field (`ccpDatapath`) from the corresponding ServerWorker handling that connection. However, the constructor for cc algorithms only takes a single input, a `QuicConnectionStateBase`. So, the only way to pass it through without changing the API is to add it as a field to this struct.

On the server, the QCSB will always be an instance of the subclass `QuicServerConnectionState` -- since CCP will only ever be used on the server side, we can add `ccpDatapath` to QSCS and then in QuicCCP we can `static_cast` the `QCSB` to a `QSCS` to access it. This makes it possible to build the client without any dependency on CCP related things.

Reviewed By: udippant

Differential Revision: D21854348

fbshipit-source-id: a1f44ac177459880d850660039ce7477e6f57132
2020-07-16 12:30:32 -07:00
Yang Chi
b8fef40c6d Clone Quic handshake packets
Summary:
On loss timer, currently we knock all handshake packets out of the OP
list and resend everything. This means miss RTT sampling opportunities during
handshake if loss timer fires, and given our initial loss timer is likely not a
good fit for many networks, it probably fires a lot.

This diff keeps handshake packets in the OP list, and add packet cloning
support to handshake packets so we can clone them and send as probes.

With this, the handshake alarm is finally removed. PTO will take care of all
packet number space.

The diff also fixes a bug in the CloningScheduler where we missed cipher
overhead setting. That broke a few unit tests once we started to clone
handshake packets.

The writeProbingDataToSocket API is also changed to support passing a token to
it so when we clone Initial, token is added correctly. This is because during
packet cloning, we only clone frames. Headers are fresh built.

The diff also changed the cloning behavior when there is only one outstanding
packet. Currently we clone it twice and send two packets. There is no point of
doing that. Now when loss timer fires and when there is only one outstanding
packet, we only clone once.

The PacketEvent, which was an alias of PacketNumber, is now a real type that
has both PacketNumber and PacketNumberSpace to support cloning of handshake
packets. I think in the long term we should refactor PacketNumber itself into a
real type.

Reviewed By: mjoras

Differential Revision: D19863693

fbshipit-source-id: e427bb392021445a9388c15e7ea807852ddcbd08
2020-06-18 15:30:44 -07:00
Matt Joras
50d5c29346 Cipher dropping take 2
Summary:
Now we won't have a zero PTO and we will properly clear out the outstanding packets.

Note that this cipher dropping is not what the draft prescribes, instead dropping both the initial and handshake ciphers when we know 1-rtt communication is functioning.

Reviewed By: yangchi

Differential Revision: D20388737

fbshipit-source-id: 0b89eb80c8faa796ab09eda3eaa10a00dcf7bae9
2020-05-06 11:14:20 -07:00
Yang Chi
081b63ffce Give QuicServerWorker an output buffer for GSO write with continuous memory
Summary: as title

Reviewed By: mjoras

Differential Revision: D20919833

fbshipit-source-id: 8cd9674d7bccf115cbdac5b976ba70e5dcb70e14
2020-04-28 22:14:20 -07:00
Luca Niccolini
5ca21a5278 rename infoCallback to statsCallback
Summary:
```
find ./quic | xargs -I{} sed -i "s/infoCallback/statsCallback/g" {}
find ./quic | xargs -I{} sed -i "s/InfoCallback/StatsCallback/g" {}
```

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D20860675

fbshipit-source-id: 4fe99a375b5983da51b6727d7f40788f89083ab3
2020-04-11 11:16:51 -07:00
Junqi Wang
eff7f6166b active conn id limit includes the one negotiated during handshake
Summary: https://tools.ietf.org/html/draft-ietf-quic-transport-27#section-18.1

Reviewed By: vchynarov

Differential Revision: D20671649

fbshipit-source-id: 23cf96e4e13201aedf0bb6a1e31dfe2f2feaa987
2020-03-26 21:57:28 -07:00