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

51 Commits

Author SHA1 Message Date
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
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
Matt Joras
e3d67efb5a Track a sequence number for non-DSR packets.
Summary:
This is essentially a further extension of the previous idead of having a sequence number per-DSR stream.

The rationale is the same -- to reduce spurious loss declared from the reordering threshold.

The primary case this works around is the following

```
<!DSR><!DSR><!DSR><DSR><DSR><DSR><!DSR>
```

Suppose we get an ACK for [0-1,3-5] leaving only packet number 2 remaining.

The naive reordering threshold will declare packet number 2 as lost. However, in principle this is arguably wrong since when considered on the timeline of !DSR packets, the gap does not exceed the reordering threshold.

To accomodate this we need to track a monotonically increasing sequence number for each non-DSR packet written, and store that in the packet metadata. This way we can use that for the reordering comparison rather than the packet number itself.

When there is no DSR packets ever written to a connection this should devolve to an identical result to using the packet number, as they will increment together.

Reviewed By: kvtsoy

Differential Revision: D46742386

fbshipit-source-id: 2983746081c7b6282358416e2bb1bcc80861be58
2023-06-27 16:56:11 -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
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
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
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
af166b026b Fix updateLargestReceivedPacketNum() For First Packet
Summary:
- change how `updateLargestReceivedPacketNum()` treats first packet from peer
- re-gate skip ack-only initial behind transportSettings for later experimentation

Reviewed By: mjoras

Differential Revision: D38921135

fbshipit-source-id: 1ced6adc2367a696474d0d52ccf46f8a7f4c703d
2022-08-30 20:45:39 -07:00
Brandon Schlinker
feb8455dc6 Add RTT with ACK delay removed to TransportInfo
Summary: Make `min(minRTT - ACK delay)` obsered so far over the life of the connection available in `TransportInfo`. In addition, expose the last RTT and last RTT's AckDelay value as well.

Reviewed By: mjoras

Differential Revision: D28385923

fbshipit-source-id: a58000ac8bd9fdc63caa0b636bdb83905cd6b448
2022-03-28 23:26:30 -07:00
Brandon Schlinker
dc0b888cfa Improve / fix smoothed_rtt calculation
Summary:
RFC9002 states the following in section 5.3

> 5.3. Estimating smoothed_rtt and rttvar
> Therefore, when adjusting an RTT sample using peer-reported acknowledgment delays, an endpoint [...] MUST NOT subtract the acknowledgment delay from the RTT sample if the resulting value is smaller than the min_rtt. This limits the underestimation of the smoothed_rtt due to a misreporting peer

However, today we subtract the ACK delay from an RTT sample used to estimate `smoothed_rtt` if it is the first RTT sample, as we will not yet have a minimum. This can lead to underestimation of `smoothed_rtt` if the peer is misreporting, and furthermore can create a situation during which `smoothed_rtt` is lower than `min_rtt`.

Resolving by not allowing `smoothed_rtt` to be adjusted by ACK delay for the first RTT sample, since doing so would lead to `smoothed_rtt` being lower than `min_rtt`.

Reviewed By: jbeshay

Differential Revision: D34792648

fbshipit-source-id: e0d6207ff73cdc13e0b40193abd27abce7142499
2022-03-28 23:26:30 -07:00
Luca Niccolini
7127a107fb fix OSS build
Reviewed By: jbeshay

Differential Revision: D34739371

fbshipit-source-id: 9e60ee1c0b664785751b2da1f3b9d9d67386c436
2022-03-08 22:17:19 -08:00
Gilson Takaasi Gil
7f2f302f96 Revert D34351084: Migrate from googletest 1.8 to googletest 1.10
Differential Revision:
D34351084 (715dec85be)

Original commit changeset: 939b3985ab63

Original Phabricator Diff: D34351084 (715dec85be)

fbshipit-source-id: 2fd17e0ccd9d1f1d643f4a372d84cb95f5add1f8
2022-03-03 04:41:46 -08:00
Dimitri Bouche
715dec85be Migrate from googletest 1.8 to googletest 1.10 (#67)
Summary:
X-link: https://github.com/facebookincubator/hsthrift/pull/67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
2022-03-03 03:46:03 -08:00
Luca Niccolini
63ee419d75 Fix includes
Summary:
```
find quic -name \*.h -o -name \*.cpp | xargs sed -i'' -E "s/#include \"(.*)\"/#include <\1>/"
arc lint -a --paths-cmd 'hg files quic/'
```

Reviewed By: mjoras

Differential Revision: D34199869

fbshipit-source-id: 3633cb8429b86c03ab367211d6a46dbe4fdd5ff2
2022-02-14 23:56:30 -08:00
Hani Damlaj
fec4289d46 Skip Crypto Ack Initial
Summary: - shipping skip crypto ack initial

Reviewed By: mjoras

Differential Revision: D33173043

fbshipit-source-id: 5add8a7355b1e06b8aa28a809fa0f621ff11f027
2022-01-19 17:06:04 -08: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
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
Hani Damlaj
fd32adc85f Skip ACK-Only Initial Crypto
Summary:
- Skip ACK-only response to initial crypto data from client
- Enabled through experimental transport settings

Reviewed By: mjoras

Differential Revision: D31863653

fbshipit-source-id: b290db0399dd7a3be41078c4a839b484da864f2f
2021-12-07 13:12:05 -08:00
Konstantin Tsoy
ed7c1bb60e Add -Wunused-value
Summary: Add -Wunused-value

Reviewed By: mjoras

Differential Revision: D32011346

fbshipit-source-id: 2a86d68602e4dc654a7a63a9a95e347248bb83cc
2021-10-29 14:55:03 -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
Dongchang He
49c73da3eb Skip updating ackState.needsToSendAckImmediately if ever set to true
Summary:
The goal of this change is to fix the bug that ```ackState.needsToSendActImmediately``` can be set to false even if it has been set to true. It leads to an issue when a batch of packets are consumed.

**Changes**
1. No longer set **false** for ```ackState.needsToSendAckImmediately```. If it is ever set to **true**, it continues to be **true**. Otherwise, it sticks to the default value of **false**.
1. Set ```ackState.scheduleAckTimeout``` to **true** only if ```ackState.needsToSendAckImmediately``` is **false**.
1. Always set ```ackState.numRxPacketsRecvd``` and ```ackState.numNonRxPacketsRecvd``` to **0** if ```ackState.needsToSendAckImmediately``` is **true**.

Reviewed By: yangchi

Differential Revision: D28241894

fbshipit-source-id: 988ac973beaa6b4348d99aa0bd6036318a6e1778
2021-05-07 12:46:57 -07:00
Sridhar Srinivasan
f7a08066ce Track body bytes sent and acked
Summary:
Previously, we maintained state and counters to count both, header and body
bytes together. This commit introduces additional counters and state to keep
track of just the body bytes that were sent and acked etc. Body bytes received
will be implemented later.

Reviewed By: bschlinker

Differential Revision: D27312049

fbshipit-source-id: 33f169c9168dfda625e86de45df7c00d1897ba7e
2021-03-29 16:58:04 -07:00
Matt Joras
21f190220e Implement basic ACK_FREQUENCY support.
Summary: As in title. This doesn't actually send any frames, but implements basic support for the transport parameter and responding to the frames.

Reviewed By: yangchi

Differential Revision: D26134787

fbshipit-source-id: 2c48e01084034317c8f36f89c69d172e3cb42278
2021-02-02 19:02:40 -08:00
Brandon Schlinker
f206c5125b Packets inflight, packets sent in OutstandingPacketMetadata
Summary:
- Adds counter of the number of ack-eliciting packets sent; useful for understanding lost / retransmission numbers
- Adds the following to `OutstandingPacketMetadata`
  - # of packets sent and # of ack-eliciting packets sent; this enables indexing of each packet when processed by an observer on loss / RTT event, including understanding its ordering in the flow of sent packets.
  - # of packets in flight; useful during loss analysis to understand if self-induced congestion could be culprit
- Fixes the inflightBytes counter in `OutstandingPacketMetadata`; it was previously _not_ including the packets own bytes, despite saying that it was.

Right now we are passing multiple integers into the `OutstandingPacket` constructor. I've switched to passing in `LossState` to avoid passing in two more integers, although I will need to come back and clean up the existing ones.

Differential Revision: D25861702

fbshipit-source-id: e34c0edcb136bc1a2a6aeb898ecbb4cf11d0aa2c
2021-01-21 21:11:56 -08:00
Yang Chi
c1223a2f78 Remove trailing _E from QUIC variant type
Summary:
I think this should just work without the trailing `_E`. It was added
when we mixed up our own union based variant and boost::variant. Some compiler
flags didn't like that. Now we no longer have mixed up cases, this should be
fine

Reviewed By: lnicco

Differential Revision: D25589393

fbshipit-source-id: 6430dc20f8e81af0329d89e6990c16826da168b8
2020-12-16 18:03:05 -08:00
vaz985
a8d5c156a1 Adding packet rtt sampling to instrumentationObserver (#178)
Summary:
Due to high number of RTT samples I refactored the OutstandingPacket to
split the packet data and packet metrics. We know have access to metrics
without the need of saving the packet data.

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

Reviewed By: mjoras

Differential Revision: D23711641

Pulled By: bschlinker

fbshipit-source-id: 53791f1f6f6e184f37afca991a873af05909fbd2
2020-09-22 18:39:00 -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
Xiaoting Tang
2d00d56fbd Put outstanding packets, events and associated counters in one class
Summary: ^

Reviewed By: yangchi

Differential Revision: D21956286

fbshipit-source-id: 305b879ad11df23aae8e0c3aac4645c0136b3012
2020-06-10 12:45:28 -07:00
TJ Yin
a396f62335 Replace folly::Optional::hasValue() by has_value()
Differential Revision: D19882830

fbshipit-source-id: 031217f9890351022bc8d171f0ccd7e045dd6972
2020-02-26 08:40:44 -08:00
Andrejs Krasilnikovs
8114c3e3d0 Changed last packet sent times to bet per-packet-number-space andthe PTO timer calculation from them
Summary:
This diff:
1) introduces `EnumArray` - effectively an `std::array` indexed by an enum
2) changes loss times and `lastRetransmittablePacketSentTime` inside `LossState`  to be an `EnumArray` indexed by `PacketNumberSpace`
3) makes the method `isHandshakeDone()` available for both client and server handshakes.
4) uses all those inputs to determine PTO timers in `earliestTimeAndSpace()`

Reviewed By: yangchi

Differential Revision: D19650864

fbshipit-source-id: d72e4a0cf61d2dcb76f0a7f4037c36a7c8156942
2020-02-10 12:28:43 -08:00
Matt Joras
1265d150d8 Tunable parameter for ACK generation
Summary:
It is useful to be able to control the ACK generation frequency based on how many packets have been received. This adds 3 tunables: a threshold, and an ACK frequency below and above that thresold.

Note this keeps the default so there is no behavior change.

Reviewed By: yangchi

Differential Revision: D19455514

fbshipit-source-id: 53b765d4c872bc6b7c19d5ea859f8eee86d9b5ff
2020-01-18 17:50:09 -08:00
Mirko Andjic
3f419b2eb2 Add vantage point to qlog.
Summary: Landing an outstanding diff

Reviewed By: yangchi

Differential Revision: D19261395

fbshipit-source-id: 437461222ff04f5c3271567d3bb064bceaf80029
2020-01-07 11:19:13 -08:00
Yang Chi
d7d19c74b5 Stop tracking pure ack packets in Quic
Summary:
Previously we track them since we thought we can get some additional
RTT samples. But these are bad RTT samples since peer can delays the acking of
pure acks. Now we no longer trust such RTT samples, there is no reason to keep
tracking pure ack packets.

Reviewed By: mjoras

Differential Revision: D18946081

fbshipit-source-id: 0a92d88e709edf8475d67791ba064c3e8b7f627a
2019-12-12 13:20:09 -08:00
Aman Sharma
69ac8aeb62 De-templatize stream state machine logic
Summary: The state machine logic is quite abstruse, this modifies it to make it more readable.

Reviewed By: siyengar

Differential Revision: D18488301

fbshipit-source-id: c6fd52973880931e34904713e8b147f56d0c4629
2019-11-19 20:18:11 -08:00
Huzefa Zakir
42bfa9dc4a Limit Quic PacketNumber to 2^62 -1
Summary: inspect PN, and when it reaches 2^62 -2 trigger a transport close through a pending event.

Reviewed By: yangchi

Differential Revision: D18239661

fbshipit-source-id: 1a218678099016693149e12ff121e2a39b95aecc
2019-11-06 19:35:45 -08:00
Yang Chi
9247b8f49b Change Quic qlogger vantage point to enum
Summary: To prevent adhoc string passed in

Reviewed By: sharma95

Differential Revision: D18013615

fbshipit-source-id: 6f5512468755c2b1ecbba3ba42188fa22f4e94b9
2019-10-23 10:16:58 -07:00
Subodh Iyengar
3100cb6769 Fix first sample minrtt
Summary: This fixes an issue with rtt computation. The first rtt sample was incorrect because minrtt gets set to the first rtt sample, hence ack delay never get subtracted. This diff allows ack delay to be subtracted if the minrtt is the first one.

Reviewed By: yangchi

Differential Revision: D17610197

fbshipit-source-id: 3e7087f37ef14848d80c0ab33094834a4fc8974b
2019-10-17 14:36:50 -07:00
Yang Chi
62cfa01091 Remove canBePaced API from CongestionController
Summary: Centralize this logic into the pacer interface. But instead of having an explicit canBePaced() function (and we already have a dozen other canBePaced functions or boolean flags in other layers), the pacer just use 0us and default write batch size per loop to answer pacing rate queries when it doesn't meet the condition to properly pace the transport writes.

Reviewed By: mjoras

Differential Revision: D16912631

fbshipit-source-id: 0343b126ca5de315af6823067316526b1004cc6c
2019-08-30 15:10:55 -07:00
Luca Niccolini
cf842aab47 cleanup some unused includes and using
Reviewed By: yangchi

Differential Revision: D16976466

fbshipit-source-id: c1fc2ee0795997f498ac7431542bbfbf1f0d2fb2
2019-08-24 02:03:39 -07:00
Bonnie Xu
0a624a5e24 Add metricUpdate event
Summary: Add metricUpdate event for qlog.

Reviewed By: mjoras

Differential Revision: D16447267

fbshipit-source-id: c355b4bd846cb191f1c9b1386d2289ca16841097
2019-07-27 11:59:22 -07:00
Bonnie Xu
0929100b18 Add transportStateUpdate event
Summary: Add transportStateUpdate event so it can be part of qlog.

Reviewed By: mjoras

Differential Revision: D16342467

fbshipit-source-id: 109189275d44996850b82646bab4a733a3a4c7a1
2019-07-25 11:52:19 -07:00
Yang Chi
42b2617e44 Handle lossTime before crypto timer in Quic
Summary:
Currently we handle crypto timer before loss timer. And currently loss
time is for AppData only since for the other two Packet Number spaces, crypto
timer will take care of it. This diff extends loss times to 3 loss times, and
handle them before handle crypto timer. The rational here is that loss time is
shorter than crypto timer, so this will make retransmission during crypto
handshake more aggressive. For app data, this diff doesn't change anything.

Reviewed By: sharma95

Differential Revision: D15552405

fbshipit-source-id: bd5c24b0622c72325ffdea36d0802d4939bae854
2019-06-17 18:07:28 -07:00
Bonnie Xu
2762cc1597 Setup stateless reset token
Summary: Replace hard coded stateless reset token with a token from the stateless reset token generator.

Reviewed By: yangchi

Differential Revision: D15481858

fbshipit-source-id: 30c96843c38c616600466b2fabb6defd5fcc5799
2019-06-13 08:44:53 -07:00
Bonnie Xu
f4ae0a1efd Updated files to change syntax.
Summary: Changed existing chrono syntax to chrono_literals syntax.

Reviewed By: mjoras, sharma95

Differential Revision: D15374649

fbshipit-source-id: 40033e90cca226266ef85e4fec629f290bc5dae6
2019-05-20 12:10:46 -07:00
Alan Frindell
6603c4f452 Stop sending rst on rst
Summary: This is no longer part of the spec.  It's up to the application how to handle reset

Reviewed By: lnicco

Differential Revision: D15107164

fbshipit-source-id: 2a1fe0c552bd7f054e84ef86a01a78c379b0a483
2019-05-06 14:05:31 -07:00
Alan Frindell
90e5e1b3f1 Split stream state machine into send and receive state machines
Summary: This is step 1 for removing reset on reset, since the send side may need to transition to waiting for a reset ack while the read side is an any state.

Reviewed By: lnicco

Differential Revision: D15075849

fbshipit-source-id: 1e094942a8a1ca9a01d4161cd6309b4136a9cfbf
2019-05-06 14:05:31 -07:00
udippant
79032c7b9b fbshipit-source-id: f498ac5e677b2931d937ba78edd4373ba04dca2a 2019-04-25 21:33:43 -07:00