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

206 Commits

Author SHA1 Message Date
Joseph Beshay
aeacf40ae8 Key update support: Add support for initiating periodic key updates for both client and server [4/x]
Summary:
Allow the server/client transport to initiate periodic key update. It's defaulted to being disabled.

The new logic for initiating and verifying a key update was handled correctly by the peer is consolidated in QuicTransportFunctions.

Reviewed By: mjoras

Differential Revision: D53109624

fbshipit-source-id: 0c3a944978fc0e0a84252da953dc116aa7c26379
2024-02-01 15:41:27 -08:00
Joseph Beshay
bff30c1f7a Key update support: Server response to key updates [1/x]
Summary:
This stack adds key update support to Mvfst client and server. This diff adds the main logic for detecting key updates in the QuicReadCodec. When an update is successful, the server transport reacts to it by updating the write phase and cipher.

The high level design is as follows:
- The QuicReadCodec is responsible for detecting incoming key update attempts by the peer, as well as tracking any ongoing locally-initiated key updates.
- Upon detecting a successful key update, the QuicReadCodec updates its state. The Server/Client transport reacts to this change by updating its write phase and cipher.
- A locally initiated key update starts with updating the write phase and key, and signaling the read codec that a key update has been initiated.
- The read codec keeps this in a pending state until a packet is successfully received in the new phase.
- Functions for syncing the read/write phase on incoming key updates, as well as initiating and verifying outgoing key updates are abstracted in QuicTransportFunctions and are used by both the client and server transports.
- Common handshake functions used for rotating the keys are now in HandshakeLayer that is shared by both client and server handshakes.

Reviewed By: mjoras

Differential Revision: D53016559

fbshipit-source-id: 134e965dabd62917193544a9655a4eb8868ab7f8
2024-02-01 15:41:27 -08:00
Hani Damlaj
6a3fd0b7f2 consolidate setSupportedExtensionTransportParameters
Summary: - remove duplicated function `setSupportedExtensionTransportParameters` in QuicClient & QuicServer

Reviewed By: jbeshay

Differential Revision: D50933970

fbshipit-source-id: f5ae1a9739d316165a5759c68076ec2152f641c6
2023-12-03 22:26:40 -08:00
Brandon Schlinker
83ad2ad99d Cleanup and modularize receive path, improve timestamp support [20/x]
Summary:
This diff renames `ReceivedPacket` to `ReceivedUdpPacket` to clarify that it maps to a UDP packet and not a QUIC packet. A single UDP packet can contain multiple QUIC packets due to coalescing.

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps.

Reviewed By: silver23arrow

Differential Revision: D48788809

fbshipit-source-id: 3793c30212d545e226f3e5337289bc2601dfa553
2023-11-28 07:47:57 -08:00
Brandon Schlinker
d9f0575c62 Cleanup and modularize receive path, improve timestamp support [19/x]
Summary:
This diff renames `updateLargestReceivedPacketNum` to `addPacketToAckState`, and changes the function signature so that it takes the structure of `ReceivedPacket::Timings` instead of just a single receive timestamp. This allows us to plumb through steady clock and socket timestamps.

The current caller to `updateLargestReceivedPacketNum` had a `ReceivedPacket::Timings` and just passed the`receiveTimePoint` field from that structure to to `updateLargestReceivedPacketNum`

```
uint64_t distanceFromExpectedPacketNum = updateLargestReceivedPacketNum(
    conn, ackState, packetNum, readData.udpPacket.timings.receiveTimePoint);
```

Now, we just pass the entire `ReceivedPacket::Timings` structure and extract `receiveTimePoint` inside:

```
uint64_t distanceFromExpectedPacketNum = addPacketToAckState(
    conn, ackState, packetNum, readData.udpPacket.timings);
```

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps.

Differential Revision: D48785086

fbshipit-source-id: 48a424e3e27918a8efe41918e0bcfa57337d9337
2023-11-28 07:47:57 -08:00
Joseph Beshay
c1432e1c7b Do not update handshake-related transport settings from the 0-rtt ticket
Summary:
When the server accepts a 0-rtt ticket, it updates the connection's transport settings with the contents of the ticket. This is the value used included in the next ticket it sends the client. However, the handshake layer has a copy of the original transport parameters that was created with the first received packet. This copy in the handshake layer does not get updated. This can cause a mismatch between the value sent to the client in the handshake, and the value encoded inside the ticket.

This change avoid using the 0-rtt ticket for updating any transport settings that are also included in the handshake transport params.

Reviewed By: hanidamlaj

Differential Revision: D51121317

fbshipit-source-id: 55e71965185dff553d16d4c5fbcb1e2f9acdc690
2023-11-10 14:27:23 -08:00
Hani Damlaj
4eefa3bebd remove QuicVersion::QUIC_DRAFT
Summary: - as title, deprecate QuicVersion::QUIC_DRAFT

Reviewed By: jbeshay

Differential Revision: D50466992

fbshipit-source-id: 2b2776d142142bc07fd27053a68dd635959a7f31
2023-11-09 19:30:07 -08:00
Brandon Schlinker
04facac67d Cleanup and modularize receive path, improve timestamp support [15/x]
Summary:
This diff drops `NetworkDataSingle` in favor of `ReceivedPacket`. The latter contains a `ReceivedPacket::Timings` field that has the same `receiveTimePoint` currently in `NetworkDataSingle`, while also providing other useful signals.

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps

Reviewed By: silver23arrow

Differential Revision: D48739219

fbshipit-source-id: fc2cdb7b425d68c729dd3bec00b6c6ff3c4bf8ec
2023-11-05 19:58:46 -08:00
Brandon Schlinker
05b98a99db Cleanup and modularize receive path, improve timestamp support [11/x]
Summary:
This diff:
1. Introduces a new `ReceivedPacket::Timings` structure, which will be expanded upon in subsequent diffs.
2. Adds a `ReceivedPacket::Timings` field to each `ReceivedPacket`
3. Uses the accessors added in the previous diff (D48724715) to populate the `ReceivedPacket::Timings` structure in each `ReceivedPacket` held by a `NetworkData` object. This is done by propagating the `NetworkData::receiveTimePoint` field to all `ReceivedPacket` held in a `NetworkData.` This propagation occurs each time a `ReceivedPacket` is added. The value is propagated again if the `NetworkData::receiveTimePoint` field is updated by looping over all previously added `ReceivedPacket`.

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps.

Reviewed By: jbeshay

Differential Revision: D48725209

fbshipit-source-id: 580e7d7d1f3587f9947774b5ed19e9985df404c9
2023-11-05 19:58:46 -08:00
Paul Farcasanu
77b0940dc5 log cwnd hint bytes to ODS
Reviewed By: jbeshay

Differential Revision: D50753856

fbshipit-source-id: 6e2aba9138f96b175ecb4a7667579ca4547eaa70
2023-11-03 16:15:42 -07:00
Hani Damlaj
8f742114d9 remove CustomTransportParameter
Summary: deprecate CustomTransportParameter in favour of ::encodeIntegerParameter

Reviewed By: mjoras

Differential Revision: D50461613

fbshipit-source-id: 86ac95e6f871cef9cb819673387d65f5de42a0b8
2023-11-02 06:01:16 -07:00
Hani Damlaj
905554ecd3 remove setCustomTransportParameter helper function
Summary:
- Remove setCustomTransportParameter, which (based on the quic v19 rfc), verifies whether a parameter is within the private range [0xff00, 0xffff]

> Values with the first byte in the range 0x00 to 0xfe (in hexadecimal) are assigned via the Specification Required policy [RFC8126].

- Consolidating adding MaxStreamGroups transport parameter into all other transport parameters extension.

More specifically, `QuicClientTransport::maybeEnableStreamGroups()` logic is now moved into `QuicClientTransport::setSupportedExtensionTransportParameters()`

Reviewed By: mjoras

Differential Revision: D50461610

fbshipit-source-id: 802b546c8364586cdcf36a230b156ca140c57ce4
2023-11-02 06:01:16 -07:00
Joseph Beshay
71e0934e13 Allow including a cwnd_hint in the 0-rtt app token
Summary: This enables the server to include a cwnd hint in the 0-rtt ticket it sends to the client.

Reviewed By: mjoras

Differential Revision: D43131826

fbshipit-source-id: 742e4e531027ec6618a1b761c450b507368e5a2f
2023-10-25 09:45:07 -07:00
Matt Joras
3a1431d77d Optionally only drop migration attempts during a handshake
Summary: The default behavior we have is to close the existing connection, which is probably excessive. Add a setting to allow simply dropping the packet instead.

Reviewed By: kvtsoy

Differential Revision: D47082159

fbshipit-source-id: 76b3589d2dcf216f425d296435de843ddd21b272
2023-10-05 14:27:09 -07:00
Brandon Schlinker
086822ca76 Cleanup and modularize receive path, improve timestamp support [2/x]
Summary:
This diff:
- Changes `NetworkDataSingle` to have `ReceivedPacket` instead of `Buf`, in line with earlier change to `NetworkData` in D48714615

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps.

Reviewed By: mjoras

Differential Revision: D48714796

fbshipit-source-id: d96c2abc81e7c27a01bcd0dd552f274a0c1ede26
2023-09-21 07:57:58 -07:00
Konstantin Tsoy
264bf20d9a Update flow control settings names to reflect that these are indeed flow
Summary: Update flow control settings names to reflect that these are indeed flow control

Reviewed By: jbeshay

Differential Revision: D48137685

fbshipit-source-id: a48372e21cdd529480e25785a9bd5de456427ef3
2023-08-18 10:21:24 -07:00
Hani Damlaj
6581135968 send transport parameter if disable migration
Summary: - send a transport parameter indicating server doesn't support client migration iff TransportSettings::disableMigration = true;

Reviewed By: kvtsoy

Differential Revision: D48356934

fbshipit-source-id: 45a42f0d1ce9011031af0863fb22bbb9d021c861
2023-08-17 15:37:50 -07:00
Ilango Purushothaman
1216d25d47 Control the max Ack Rx timestamps stored via MC ( android_fb4a_csti)
Summary:
Previously, the maximum stored rx timestamps was controlled by a constant `kMaxReceivedPktsTimestampsStored`. Make this programmable via MC so different values can be pushed based on server and client criteria (via GK groups).

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D45343231

fbshipit-source-id: aafa799925da2c11e14394d11fa4855f7107daf4
2023-07-27 07:12:16 -07:00
Christian Clauss
b8396fc119 Fix typos discovered by codespell
Summary:
`codespell --ignore-words-list=arithmetics,atleast,crate,crated,deriver,ect,hel,onl,startin,whats --skip="*.lock"`
* https://pypi.org/project/codespell

X-link: https://github.com/facebookincubator/mvfst/pull/307

Reviewed By: hanidamlaj, lnicco

Differential Revision: D47809078

Pulled By: kvtsoy

fbshipit-source-id: 566557f2389746db541ff265a5dec8d6404b3701
2023-07-26 17:10:41 -07:00
Konstantin Tsoy
73edee8252 Back out "Fix typos discovered by codespell"
Summary:
Original commit changeset: 337824bc37bc

Original Phabricator Diff: D47722462

Reviewed By: jbeshay, terrelln, lnicco

Differential Revision: D47801753

fbshipit-source-id: 795ffcccbc2223608e2a707ec2e5bcc7dd974eb3
2023-07-26 12:49:13 -07:00
Luca Niccolini
3d091f18bc Tune transport for MVFST_EXPERIMENTAL version
Reviewed By: jbeshay

Differential Revision: D47611543

fbshipit-source-id: acc07ffba064f95d6ce6ad4f212642ae49412ffc
2023-07-26 02:41:56 -07:00
Facebook Community Bot
9d89b66485 Re-sync with internal repository 2023-07-25 09:45:22 -07:00
Joseph Beshay
c3ea605df1 Store tokens in new token frames as IoBuf and hexlify when including in qlogger
Summary:
As title. This changes the NewTokenFrame (for writing) to hold the toke as an IOBuf instead of a string. This makes it consistent with the read side.

In the same change, the qlogger now hexlifies this buffer when writing the token to the qlog.

Reviewed By: hanidamlaj, mjoras

Differential Revision: D46955172

fbshipit-source-id: 8f5f575ad2f0a4ec3b4c01cb67defa1f4425cd74
2023-06-27 13:12:10 -07:00
Hani Damlaj
c88d675119 fix gcc warnings
Summary: - add folly::unreachable() statements where applicable

Reviewed By: mjoras

Differential Revision: D46911632

fbshipit-source-id: 22b337f4c255e973da19cc15cc928c847091472b
2023-06-26 18:59:24 -07:00
Fei Chen
ad6f14e93e increase connid encoding retry limit from 16 to 32
Summary: also add a counter to monitor the actual number of connid encoding retries

Reviewed By: mjoras

Differential Revision: D46227574

fbshipit-source-id: c6c063ee45c7e8a9bd3af994f67755336720a740
2023-06-08 09:34:05 -07:00
Matt Joras
b257b1fe24 Unify and move receive timestamp config
Summary: We shouldn't have config in the codec types. Instead solve the plumbing problem more explicitly, and only define the config in one place.

Reviewed By: jbeshay

Differential Revision: D45881730

fbshipit-source-id: fab6c967a38172f16e57a8978b10460fd196902e
2023-05-17 11:59:53 -07:00
Matt Joras
e41ea339f8 Don't close via exception on receiving a close.
Summary: This is a dumb shortcut. Just check whether it's happened after reading data and call close that way.

Reviewed By: kvtsoy

Differential Revision: D45205285

fbshipit-source-id: 57edafc50f5e5e9cdaf9ac7e46781b762acd30d8
2023-04-24 13:59:02 -07:00
Matt Joras
5fb246b019 Implement duplicate packet stat.
Summary:
Somehow we never implemented this stat despite having it for ages.

It's relatively easy to do, we just need to check whether an entry was inserted to the IntervalSet we are already using for tracking what to ACK.

Note that this has the limitation that when the ACK interval set is cleared out (on ACK of ACK), we will no longer be able to detect duplicates. This is something we can tune later.

Reviewed By: kvtsoy

Differential Revision: D45131856

fbshipit-source-id: aad4e07e1a9cd5b2dc5dec60424f7cee15906c7e
2023-04-20 11:48:45 -07:00
Joseph Beshay
b6c657fd23 Allow the server to indicate that it supports minAckDelay to the client
Summary: When the server transport settings has a minAckDelay set, send the minAckDelay parameter to the client to allow the client to send ACK_FREQUENCY frames.

Reviewed By: mjoras

Differential Revision: D44765256

fbshipit-source-id: 05c3c2da8e8a93dddb12260e13f218d560a410d6
2023-04-07 12:10:50 -07:00
Luca Niccolini
b1e0def2ea restore max datagram size transport param
Reviewed By: jalopezsilva, hanidamlaj

Differential Revision: D44230239

fbshipit-source-id: 3137f8639d263cd6d0944923e2cdc7976e1137fb
2023-03-20 16:20:22 -07:00
Hani Damlaj
104b9848bc fix connection migration deadlock
Summary: Currently, we can enter a deadlock situation where a client rx's a PathChallenge frame, but the packet containing its respective PathResposne frame is lost/delayed. Clients should re-tx the PathResponse frame upon PTO/loss.

Reviewed By: jbeshay

Differential Revision: D43718357

fbshipit-source-id: 26b4bc64dbf48417558eda02744f321f1cb73148
2023-03-17 20:36:56 -07:00
Hani Damlaj
6cd4f47735 elide malloc calls
Summary: - optimizing `setSupportedExtensionTransportParameters()` to elide invocations to malloc()

Reviewed By: mjoras

Differential Revision: D43844018

fbshipit-source-id: 38da5c62786f795a3a79e7592d06d4da1d7487ba
2023-03-15 15:58:02 -07:00
Ilango Purushothaman
e1fd9c7880 Create OutstandingPacket wrapper
Summary:
To get reliable packet destruction events, created a `OutstandingPacketWrapper` wrapper that wraps the current `OutstandingPacket` class, so callback functions can be added to the wrapper instead of the underlying object itself.

#### Why do we need this wrapper?

`std::deque::erase` does not guarantee that appropriate object destructors will be called (only that the number of destructions = number of objects erased). This is a real problem as packet destruction events are then no longer reliable (OutstandingPacket object is wrong!). The wrapper class handles this condition by detecting it in the move assignment constructor (called during erase) and calls the appropriate packet destruction callback before packets are moved. If we did the same fix in the old OutstandingPacket, we have to make sure the callback is called before all the fields of OutstandingPacket are moved - this is not scaleable. Hence a wrapper with the underlying object and a destruction callback function.
I also disabled copy construction for OutstandingPacket (otherwise we will get duplicate OnPacketDestroyed callbacks and cannot track packets reliably). Removing packet copies also improves performance. Some code changes (in tests mostly) are mostly in service of this particular change.

Reviewed By: bschlinker

Differential Revision: D43896148

fbshipit-source-id: c295d3c4dba2368aa66f06df5fc82b473a03fb4d
2023-03-15 03:10:18 -07:00
Hani Damlaj
a0e456bc03 migrate folly::none assignment operator to .reset()
Summary: - .reset() is probably fractionally less costly than the assignment operator?

Reviewed By: sharmafb

Differential Revision: D43579041

fbshipit-source-id: 4838b6c21e94197782cf56866950be1dbf65b106
2023-03-03 05:39:57 -08:00
Konstantin Tsoy
377260f704 Remove d6d code
Summary: we're not using it

Reviewed By: mjoras

Differential Revision: D43482344

fbshipit-source-id: 05ac6792848e32e7c1bcf53a2df172852b5def62
2023-02-23 20:11:24 -08:00
Paul Farcasanu
2556adfc7f cleanup initCwnd experimentation
Summary:
**Context**
Perf wins:
 - https://fb.workplace.com/groups/750841812056515/permalink/1581186975688657/
 - https://fb.workplace.com/groups/750841812056515/permalink/1580000729140615/

now clean it up, since we are shipping via config

Reviewed By: hanidamlaj

Differential Revision: D43237402

fbshipit-source-id: abfa5df982668ee87afe24b3a2b88a3762bed12c
2023-02-16 00:59:16 -08:00
Hani Damlaj
d2e3bc36bf peer address changed
Summary: - add stats counter for when we detect peer address has changed

Reviewed By: jbeshay

Differential Revision: D43012530

fbshipit-source-id: 84f026e8094219b62643449002c97cef6e1a59e5
2023-02-06 12:30:13 -08:00
Joseph Beshay
239f2b5b55 Add transport parameter for knob frame support
Summary: Decide if knob frames are supported based upon a transport parameter instead of relying on the QUIC version. This is a cleaner approach, at the cost of an additional transport parameter.

Reviewed By: mjoras

Differential Revision: D42465442

fbshipit-source-id: bfd1d177bdbe198e5eb47e63113410b5738dcede
2023-01-26 12:22:38 -08:00
Joseph Beshay
b801d9b61d Update naming of maxStreamGroupsAdvertized to match that of similar variables
Summary: This is a cosmetic change to make the naming consistent for all the advertised* variables in the transport settings.

Reviewed By: sharmafb

Differential Revision: D42465443

fbshipit-source-id: d570cbb1a2ca017105ac335b8efc404cb73f3c57
2023-01-26 12:22:38 -08:00
Joseph Beshay
a0a319d58b Consolidate stream groups enabled transport parameter into the TransportParameterId enum
Summary: Use TransportParameterId enum as the source of truth for all the parameter ids. This basically moved the stream groups enabled parameter to the enum.

Reviewed By: kvtsoy

Differential Revision: D42465425

fbshipit-source-id: 94f9968326ac61f92587ef380a7288dd8ab38eef
2023-01-17 21:10:12 -08:00
Matt Joras
1275798146 Make the AckState for Initial/Handshake a unique_ptr
Summary:
We don't need to carry these states after the handshake is confirmed, so make them pointers instead. This will facilitate adding a structure to the AckState for tracking duplicate packets.

(Note: this ignores all push blocking failures!)

Reviewed By: hanidamlaj

Differential Revision: D41626895

fbshipit-source-id: d8ac960b3672b9bb9adaaececa53a1203ec801e0
2022-12-20 11:08:43 -08:00
Paul Farcasanu
da474a06b1 experiment with initialCwnd=20
Summary: Perf testing.

Reviewed By: mjoras

Differential Revision: D41654491

fbshipit-source-id: b356671c085da31ed6f0a7956e7ed1b3edfc0cf1
2022-12-02 13:17:08 -08:00
Sharad Jaiswal (Eng)
96abc8160d Codec changes to support ACK_RECEIVE_TIMESTAMPS
Summary: Create a new ACK_RECEIVE_TIMESTAMPS frame, as outlined in https://www.ietf.org/archive/id/draft-smith-quic-receive-ts-00.html#name-ack_receive_timestamps-fram

Reviewed By: mjoras

Differential Revision: D37799050

fbshipit-source-id: 0157c7fa7c4e489bb310f7c9cd6c0c1877e4967f
2022-11-16 13:02:27 -08:00
Sharad Jaiswal (Eng)
328c78d0e2 Add received packets timestamps to AckState
Summary:
Store timestamps/packet numbers of recently received packets in AckState.

 - The maximum number of packets stored is controlled by kMaxReceivedPktsTimestampsStored.
- The packet number of entries in the deque is guarenteed to increase
   monotonically because an entry is only added for a received packet
  if the packet number is greater than the packet number of the last
  element in the deque (e.g., entries are not added for packets that
  arrive out of order relative to previously received packets).

Reviewed By: bschlinker

Differential Revision: D37799023

fbshipit-source-id: 3b6bf2ba8ea15219a87bbdc2724fe23eebe66b70
2022-11-15 20:14:57 -08:00
Hani Damlaj
729623ca26 MaxNumMigrationsAllowed Transport Setting
Summary: - add configurable `maxNumMigrationsAllowed` to transport settings

Reviewed By: kvtsoy

Differential Revision: D41137450

fbshipit-source-id: a82c97e0b58c13f5df3c4cd075d3f17702eca009
2022-11-10 16:55:07 -08:00
Mitch Campbell
1335937f74 converted PacketDropReason to better_enum and moved into QuicConstants.h
Summary: PacketDropReason was converted to a Better_Enum

Reviewed By: jbeshay

Differential Revision: D40350056

fbshipit-source-id: a6af9ccf0fc7c4358a0481de5cca6f69d1beb438
2022-10-18 11:51:44 -07:00
Duc Nguyen
e3d2b6b3ee Fix -Wmissing-prototypes error
Reviewed By: bschlinker

Differential Revision: D40363029

fbshipit-source-id: 27b41f99b5d279f4e204561b3e93b179345ec784
2022-10-18 09:30:47 -07:00
Hani Damlaj
a3d9e3d650 Enable Skip Ack-Only Initial
Summary: - enable skip ack-only initial feature by default

Reviewed By: mjoras

Differential Revision: D40185260

fbshipit-source-id: 6429c50fe9f6edff9e945f15c0d44cb54aa9e460
2022-10-13 15:48:38 -07:00
Joseph Beshay
bd56a9bd4e Fix logic for handling the ACK_FREQUENCY frame reorder threshold
Summary:
The current logic for handling the ACK_FREQUENCY frame mistakenly uses the frame's reorderThreshold for deciding losses, rather than triggering immediate acknowledgements.

This change fixes the logic by tracking the out-of-order distance and comparing that against the reorderThreshold.

Reviewed By: mjoras

Differential Revision: D39331920

fbshipit-source-id: 125fd99dce9b2725ea0d5b26236f48f72db53c48
2022-09-08 11:15:23 -07:00
Hani Damlaj
254a44aea0 Reject Migrating Peer
Summary: - refactor code path that drops packet when rejecting a migrating peer

Reviewed By: mjoras

Differential Revision: D38959058

fbshipit-source-id: e9e04a0cd433f4618721827612e40511f0c8ba5e
2022-09-06 13:42:26 -07:00