1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-09 20:42:44 +03:00
Commit Graph

126 Commits

Author SHA1 Message Date
Aman Sharma
d0270692a7 Remove unused fields in OutstandingPacketMetadata [3/n]
Summary: Neither QUIC nor TransportMonitor uses the `finObserved` field in the `StreamDetails`

Reviewed By: hanidamlaj

Differential Revision: D55936040

fbshipit-source-id: 0902bf7c30f85ada63cd3e9234f6a059b425cce5
2024-04-15 15:44:35 -07:00
Aman Sharma
9cdb1cd251 Remove unused fields in OutstandingPacketMetadata [2/n]
Summary: Neither QUIC not TransportMonitor is using the `packetsInflight` field of the `OutstandingPacketMetadata`

Reviewed By: hanidamlaj

Differential Revision: D55926288

fbshipit-source-id: 32efd66add1e6374a8d3446ff635fe582b36e644
2024-04-12 16:29:04 -07:00
Aman Sharma
5fc474a2f9 Remove unused fields in OutstandingPacketMetadata [1/n]
Summary: Neither QUIC not TransportMonitor is using the `totalBodyBytesSent` field of the `OutstandingPacketMetadata`

Reviewed By: hanidamlaj

Differential Revision: D55897240

fbshipit-source-id: 521f8a016f838dd1fe0593daa7a4e45c4fd222cf
2024-04-12 14:19:16 -07: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
Aman Sharma
303c405e10 Create IOBuf on the stack using folly::IOBuf::wrapBufferAsValue for body
Summary: This is similar to the previous commit. We use a stack-based IOBuf instead of allocating one on the heap. This saves CPU because allocations/deallocations on the stack are a lot cheaper.

Reviewed By: hanidamlaj

Differential Revision: D53101722

fbshipit-source-id: dd59a7eca6498db19472a62f954db3e2f2f27a42
2024-01-29 15:19:12 -08:00
Aman Sharma
b2db063139 Create IOBuf on the stack using folly::IOBuf::wrapBufferAsValue for headers
Summary: Creating an IOBuf on the heap when we use `folly::IOBuf::wrapBuffer` is expensive.

Reviewed By: hanidamlaj

Differential Revision: D52506216

fbshipit-source-id: eed2b77beae0419b542b0461303785cc175e3518
2024-01-26 14:01:08 -08:00
Joseph Beshay
ead139adef Move all mvfst use-cases to the new Eventbase, Timer, and Socket interfaces
Summary:
This is the major transition that updates mvfst code to use the new interfaces. The new Folly implementations of the interfaces maintain all the existing behavior of folly types so this should not introduce any functional change. The core changes are:
- Update the BatchWriters to use the new interfaces.
- Update the FunctionLooper to use the new interfaces.
- Change QuicServerTransport to take the folly types and wrap them in the new types for use in the QuicTransportBase.

The rest of the diff is for updating all the existing uses of the QuicTrasnport to initialize the necessary types and pass them to the QUIC transport instead of directly passing folly types.

Reviewed By: mjoras

Differential Revision: D51413481

fbshipit-source-id: 5ed607e12b9a52b96148ad9b4f8f43899655d936
2023-12-14 00:24:12 -08: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
Brandon Schlinker
a1445434b0 Cleanup and modularize receive path, improve timestamp support [5/x]
Summary:
This diff changes `QuicAsyncUDPSocketWrapper` so that it is an abstraction layer that inherits from `QuicAsyncUDPSocketType`, instead of simply being a container with aliases.
- Key changes in `QuicAsyncUDPSocketWrapper.h`, the rest of the updates switch us from using `QuicAsyncUDPSocketType` to `QuicAsyncUDPSocketWrapper`.
- It's difficult to mock the UDP socket today given that we expose the entire `folly::AsyncUDPSocket` type to the higher layers of the QUIC stack. This complicates testing and emulation because any mock / fake has to implement low level primitives like `recvmmsg`, and because the `folly::AsyncUDPSocket` interface can change over time.
- Pure virtual functions will be defined in `QuicAsyncUDPSocketWrapper` in a follow up diff to start creating an interface between the higher layers of the mvfst QUIC stack and the UDP socket, and this interface will abstract away lower layer details such as `cmsgs` and `io_vec`, and instead focus on populating higher layer structures such as `NetworkData` and `ReceivedPacket` (D48714615). This will make it easier for us to mock or fake the UDP socket.

This diff relies on changes to `folly::MockAsyncUDPSocket` introduced in D48717389.

--

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, hanidamlaj

Differential Revision: D48717388

fbshipit-source-id: 4f34182a69ab1e619e454da19e357a6a2ee2b9ab
2023-09-21 07:57:58 -07:00
Ashkan Nikravesh
7af4ddc0e0 Incorporate throttling signal into BBRv1: limit the writable bytes by the available tokens
Summary:
This limits the writableBytes by the available tokens (ie `ThrottlingSignalProvider::bytesToSend`), if the connection is being throttled and that value is provided by the throttling signal provider.

Note that these throttling signals to the transport are provided only for the connections that belong to a specific QE experiment.

Reviewed By: silver23arrow

Differential Revision: D47850261

fbshipit-source-id: 8c52e66198db6d1fee252cacea69b82963a1601a
2023-08-30 17:01:06 -07:00
Matt Joras
df49cb664f Always call writeGSO
Summary: There's no need to call write when there's only one packet, since write just wraps writeGSO. This simplifies the use of options and will allow for setting a TXTIME when there's only one packet to send.

Reviewed By: kvtsoy

Differential Revision: D48526018

fbshipit-source-id: d934ddce8d3a35febb58ff253fc7a9bed3ef975c
2023-08-21 16:13:38 -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
Dan Melnic
d47d381da9 Use WriteOptions instead of a single int to allow for txTime setting too
Summary: Use WriteOptions instead of a single int to allow for txTime setting too

Reviewed By: mjoras

Differential Revision: D48218906

fbshipit-source-id: 00a1d4905b54ec0614860f9cdd8b58c9d6e6ef9a
2023-08-16 13:19:12 -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
Facebook Community Bot
9d89b66485 Re-sync with internal repository 2023-07-25 09:45:22 -07:00
Konstantin Tsoy
4a0dd1e2a4 QuicAsyncUDPSocketWrapper
Reviewed By: jbeshay

Differential Revision: D46379200

fbshipit-source-id: f6a7c1cf68108872e05e6fd8adb7f00aae22b2ed
2023-07-11 15:21:15 -07:00
Crystal Jin
0fd6ba7f78 Use finalWriteOffset for stream bytes sent
Reviewed By: JunqiWang

Differential Revision: D46663584

fbshipit-source-id: 1b22eb90501a9b904c17818991d01e5a0fbf2734
2023-06-13 08:16:16 -07:00
Matt Joras
d31f2f7f16 Fix bytesWritten return
Summary: Turns out these functions have been returning 0 for bytes written for a while. Nothing was using them (yet), so there wasn't any functional breakage.

Reviewed By: kvtsoy

Differential Revision: D46653336

fbshipit-source-id: 765b3363c1fc0729e8239d1293ddcc4ae4bb9c79
2023-06-12 17:02:16 -07:00
Matt Joras
a088596b7d Deflake write time limit test
Summary:
As in title.

(Note: this ignores all push blocking failures!)

Reviewed By: hanidamlaj, lnicco

Differential Revision: D46111136

fbshipit-source-id: b5aec9f1daa32acd200dd1550eb0bb3a9a44a4f2
2023-05-23 09:51:28 -07:00
Matt Joras
96b2c1b37d Control write loop time limit from knob.
Summary:
This has been hardcoded to SRTT/25 for a long time. However, especially when using DSR this might not be the most appropriate since it can start to get close to real world SRTTs.

Control it via a knob, and also add the behavior such that setting it to 0 effectively disables the time limit.

Reviewed By: jbeshay

Differential Revision: D46084438

fbshipit-source-id: 7dc619fdff1bd5c3f8654c4936200e0340ef94f2
2023-05-22 16:15:24 -07:00
Matt Joras
372075b690 IMMEDIATE_ACK probes
Summary:
When using ACK_FREQUENCY and high reordering thresholds, the normal tricks for drawing ACKs with PTOs are slightly defeated.

Thankfully we can get around this by issuing IMMEDIATE_ACKs when probing. The strategy is basically to replace one of the usual probes with an IMMEDIATE_ACK probe.

Also, include ACKs in these probes (and the PING probes), since there's not much reason not to.

Reviewed By: jbeshay

Differential Revision: D45965703

fbshipit-source-id: 9b98473312a239e17a0b8040f45d197b1a2c8484
2023-05-22 13:14:00 -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
Crystal Jin
3c43db2b15 Add new stream bytes sent per stream
Reviewed By: hanidamlaj

Differential Revision: D43851342

fbshipit-source-id: 204a5d821c69928a4e9de44f461c4eb8181ef277
2023-03-08 15:39:11 -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
Richard Barnes
182b8c0ea0 Remove unused variables in quic/api/test/QuicTransportFunctionsTest.cpp
Summary:
LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.

This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: luciang

Differential Revision: D42465115

fbshipit-source-id: 0379c82451b1902c185bc3b083c7ee68264b8977
2023-01-11 16:48:34 -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
Brandon Schlinker
eb3009484a Application limited time in packet metadata
Summary:
Track the total (cumulative) amount of time that the connection has been application limited and store this information in `OutstandingPacketMetadata`. If this value is the same for two `OutstandingPacketMetadata` then we know that the transport did not become application limited between when those two packets were sent (or, less likely, the transport was application limited for less than one microsecond given the microsecond resolution of the timestamp).

We store the amount of time spent application limited instead of a count of the number of application limited events because the implications of being application limited are time dependent.

Tests show that we need to be able to inject a mockable clock. That's been an issue for some time; will work on in a subsequent diff.

Differential Revision: D41714879

fbshipit-source-id: 9fd4fe321d85639dc9fb5c2cd51713c481cbeb22
2022-12-08 18:55:22 -08:00
Konstantin Tsoy
003c12fb22 Move setCustomTransportParameter() to free functions
Summary: Move setCustomTransportParameter() to free functions

Reviewed By: mjoras

Differential Revision: D36204576

fbshipit-source-id: 513c11852a339d441af9f3fc948679814da98900
2022-05-19 20:01:28 -07:00
Matt Joras
78bed75ef7 Use a reserved std::vector in RegularQuicWritePacket
Summary: The code has changed since this was made an inlined vector. We now see higher cost from copy operations due to this rather than being able to move the data around.

Reviewed By: bschlinker

Differential Revision: D36151209

fbshipit-source-id: 0b10558c6bd8ebfea9bb960aac36a6c4044fc95f
2022-05-05 16:22:02 -07:00
Hani Damlaj
747c41c30d Fix Probing Bytes Limit
Summary:
- PTOs should not be subject to congestion control limits
- Quickly recover from PTOs being writableBytesLimited by calling onPTOAlarm() as soon as we become unblocked

Reviewed By: mjoras

Differential Revision: D35480409

fbshipit-source-id: 51500db6fff17a7badefea8bda7f63141e97f746
2022-04-19 00:50:36 -07:00
Hani Damlaj
c8bf098e5d Change Implementation of WritableBytesLimit
Summary: - updating usage of WritableBytesLimit

Reviewed By: mjoras

Differential Revision: D33079816

fbshipit-source-id: 1854f40a7b00526afb2167764aeddf55edb1771f
2022-04-04 16:18:52 -07:00
Kyle Mirzakhanian
777f776784 Ship short header padding
Summary:
QE result post: https://fb.workplace.com/groups/646964542156536/permalink/1989360141250296/

We are going ahead with shipping this, with a default value of 32 for paddingModulo.

Leaving the transport knob settings still in place in case vips want to selectively disable the feature (not sure if that is the proper way to config that but I think so it is?)

Reviewed By: mjoras

Differential Revision: D34596608

fbshipit-source-id: 5603bb391113c29830f43a67e73c0f50154dcca1
2022-03-23 19:27:50 -07:00
Hani Damlaj
00e67c1bf9 mvfst License Header Update
Reviewed By: lnicco

Differential Revision: D33587012

fbshipit-source-id: 972eb440f0156c9c04aa6e8787561b18295c1a97
2022-01-18 13:56:12 -08:00
Hani Damlaj
2660a288b3 Update Company Name
Summary: - as title

Reviewed By: lnicco

Differential Revision: D33513410

fbshipit-source-id: 282b6f512cf83b9abb7990402661135b658f7bd1
2022-01-13 12:07:48 -08:00
Hani Damlaj
f60c254c49 Log Server Handshake Size
Summary: - logging number of bytes the server sent during the handshake for insight.

Reviewed By: mjoras

Differential Revision: D33069800

fbshipit-source-id: e7e8f25183ee30de99e2971bae3c6b93882f6e63
2022-01-06 10:34:06 -08:00
Matt Joras
ca4705af0b If there's lost data, we have data to write, take 2.
Summary:
This is a bug that could prevent us from writing data if we ran out of connection flow control while we had lost data.

The last attempt missed a mistake in the scheduling of sequential priority streams.

Reviewed By: kvtsoy

Differential Revision: D33030784

fbshipit-source-id: e1b82234346a604875a9ffe9ab7bc5fb398450ed
2021-12-14 09:18:01 -08:00
Brandon Schlinker
1c8e70ac02 Tests for StreamIntervals in OutstandingPacketMetadata::StreamDetails
Summary: Tests for functionality added in D31887096 (ff8eee7c59)

Reviewed By: mjoras

Differential Revision: D31916966

fbshipit-source-id: 8be021f62898c0d4e643df9452cbe71ebb9f05a9
2021-12-11 22:40:44 -08:00
Brandon Schlinker
bdd073a7fd Throw if start offset of written frame > stream.currentWriteOffset
Summary: As titled. Simple logic to prevent confusion when writing tests.

Reviewed By: jbeshay

Differential Revision: D31916968

fbshipit-source-id: 6f4fb84402b6fe2f5f9af9f57ff8a1d2f1838464
2021-12-11 22:40:44 -08:00
Brandon Schlinker
f19b20b107 Change OutstandingPacketMetadata::DetailsPerStream into a map
Summary: As titled. Reduces confusion around `DetailsPerStream` containing a map that must be accessed through `get`, and instead just uses a similar approach as `quic::IntervalSet` — inheriting from the underlying data structure. While there's some disadvantages of this approach, they're minimized by only exposing a subset of accessors from the underlying data structure.

Reviewed By: afrind, mjoras

Differential Revision: D31887098

fbshipit-source-id: 51bdab35e6276926b6d85095d062971326be1b64
2021-12-11 22:40:44 -08:00
Brandon Schlinker
82fd138b5e Make OutstandingPacketMetadata::DetailsPerStream non-optional
Summary: As titled. Reduces confusion, as we always expect this to be populated.

Differential Revision: D31887097

fbshipit-source-id: 153b05bae8abd559fe49d2c07c64d2ad0d92a809
2021-12-11 22:40:44 -08:00
Matt Joras
5b9a9705a0 Back out "If there's lost data, we have data to write."
Summary: This is causing empty write loops for some reason.

Reviewed By: jbeshay, lnicco

Differential Revision: D32990291

fbshipit-source-id: 2a183d591de54c7fe0ca54aea828a697a4cd9af0
2021-12-09 14:35:24 -08:00
Matt Joras
d6a876f201 If there's lost data, we have data to write.
Summary: This is an edge case we weren't handling properly. This can lead to situations where we run out of conn flow control, the peer hasn't received all data, and then we never write the data to trigger a flow control update.

Reviewed By: afrind

Differential Revision: D32887140

fbshipit-source-id: df5dfad8e0775ef43e5ca6ab98b8ca6b5987ce31
2021-12-07 18:19:58 -08:00
Luca Niccolini
21124bf671 s/transportInfoCb/quicStats/g
Summary: rename test local variables to be self documenting

Reviewed By: mjoras

Differential Revision: D32750782

fbshipit-source-id: 94ff5bbd34dbc804cd0229d8abd0ffd9891a44fc
2021-12-01 09:28:53 -08:00
Matt Joras
a4c8583f91 Fix time-based write limit test.
Summary: Turns out the optimized builds of this test were running too fast and getting limited by flow control first rather than the intention which was to be limited by the time limit. Fix this by unlimiting them on flow control and giving some more headroom to hit the time limit.

Reviewed By: lnicco

Differential Revision: D32599440

fbshipit-source-id: 1ab2b15661cecdb44a62e3ca6048dc8424cceb1e
2021-11-22 13:32:55 -08:00
Matt Joras
6afecccd25 Track loop limit time across functions.
Summary: Otherwise we can end up in a situation where the non-DSR scheduler was limited by the loop time while the DSR scheduler is not, leading to an inconsistency.

Reviewed By: lnicco

Differential Revision: D32570027

fbshipit-source-id: f43d2517589c22bac0f2bb76626cc55c2a21fa5d
2021-11-19 19:04:37 -08:00
Luca Niccolini
dc3b4dded0 Write DATAGRAM frames when available
Summary:
Right now we are waiting for another write event to write datagrams.
Introduced a Write Reason for the case when only DATAGRAMS are pending

Reviewed By: mjoras

Differential Revision: D29091822

fbshipit-source-id: 0de6b88d93acae0ba240b9cdf9dbc8e74feaf5ac
2021-06-13 21:13:19 -07:00
Sridhar Srinivasan
7246cd5e3c Record stream details in packet metadata
Summary:
Introruced a new DetailsPerStream struct inside the outstanding packet metadata
so we can easily track all streams carrying app data within a packet and each
stream's bytes sent (both new and total).

With this, consumers can easily deduce the number of retransmitted bytes per
stream using the StreamDetails members:
newStreamBytesSent - streamBytesSent.

Reviewed By: bschlinker

Differential Revision: D28063916

fbshipit-source-id: d915514f85f24f4889cfac2f7a66bfd2d6b0a4af
2021-05-14 11:55:17 -07:00
Brandon Schlinker
5590b9f573 Track stream bytes written
Summary:
Track the number of stream bytes written to the wire and expose in `quic::TransportInfo`.

Implemented as two counters:
- `totalStreamBytesSent` is a count of all stream bytes written to the wire; the sum of the lengths of stream frames in all packets sent
- `totalNewStreamBytesSent` is a count of all *new* stream bytes written to the wire -- a stream byte is new if it has not been transmitted before; the sum of the lengths of stream frames that have never been transmitted before in all packets sent

We can derive the total number of stream bytes retransmitted as `totalStreamBytesSent - totalNewStreamBytesSent`. We may want to deprecate the existing `totalBytesRetransmitted` counter because the name of that counter does not make it clear that it is stream bytes, and because only includes some types of retransmissions.

While `totalNewStreamBytesSent` is already captured as `flowControlState.sumCurWriteOffset`, I am not reusing that counter here to avoid having a dependency on the information we track for flow control, and to allow all relevant information to be captured in `LossState` (where other relevant fields already exist).

Reviewed By: yangchi

Differential Revision: D28061085

fbshipit-source-id: 73486a4ba3fc8f12959f68702dc58e61fdc21b65
2021-05-04 23:24:06 -07:00