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

43 Commits

Author SHA1 Message Date
Matt Joras
b6e134fdee Use F14FastMap as the retranmission buffer.
Summary:
The retransmission buffer tracks stream frame data we have sent that is currently unacked. We keep this as a sorted `deque`. This isn't so bad for performance, but we can do better if we break ourselves of the requirement that it be sorted (removing a binary search on ACK).

To do this we make the buffer a map of offset -> `StreamBuffer`.

There were two places that were dependent on the sorted nature of the list.

1. For partial reliablity we call `shrinkBuffers` to remove all unacked buffers less than an offset. For this we now have to do it with a full traversal of the retransmission buffer instead of only having to do an O(offset) search. In the future we could make this better by only lazily deleting from the retransmission buffer on ACK or packet loss.

2. We used the start of the retransmission buffer to determine if a delivery callback could be fired for a given offset. We need some new state to track this. Instead of tracking unacked buffers, we now track acked ranges using the existing `IntervalSet`. This set should be small for the typical case, as we think most ACKs will come in order and just cause existing ranges to merge.

Reviewed By: yangchi

Differential Revision: D18609467

fbshipit-source-id: 13cd2164352f1183362be9f675c1bdc686426698
2019-11-27 00:25:25 -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
Viktor Chynarov
7504453972 Use Path Rate Limiter for conn migration
Summary:
Use the Path rate limiter introduced in the previous diff.

When we initialize path validation of an unvalidated peer address,
enable pathValidationRateLimit.

When we receive a proper PATH_RESPONSE frame, disable this limit.

If this limit is enabled, we will check the pathValidationLimiter for
the amount of bytes we are allowed to write.

Change the migration tests in QuicServerTransportTest to use this new limiter
instead of writableByteLimits.

Update shouldWriteData to directly use the new congestionControlWritableBytes
function.

Reviewed By: yangchi

Differential Revision: D18145774

fbshipit-source-id: 1fe4fd5be7486077c58b0d1285dfb03f6c62831c
2019-11-14 13:48:17 -08:00
Matt Joras
027fedad5b Search loss buffer before retransmission buffer when determining if a write is a clone.
Summary:
We maintain the invariant that a buffer cannot be in the loss buffer and retransmission buffers at the same time. As the retransmission buffer holds all unacknowledged data that isn't marked lost, it is very likely to be larger than the loss buffer. This makes the existing case to check for cloning very expensive.

Instead search the loss buffer first, change the search of the loss buffer to a binary search, and elide the double search.

Reviewed By: yangchi

Differential Revision: D18203444

fbshipit-source-id: 66a4e424d61c4b0e3cad12c7eca009ad3d6c5a0d
2019-10-29 12:33:34 -07: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
Matt Joras
c0a0919113 Fix stream scheduling round robin.
Summary:
The intention here was always to write to streams in a round robin fashion. However, this functionality has been effectively broken since introduction as `lastScheduledStream` was never set. We can fix this by having the `StreamFrameScheduler` set `nextScheduledStream` after it has written to the streams. Additionally we need to remove a check that kept us from moving past a stream if it still had data left to write.

In extreme cases this would cause streams to be completely starved, and ruin concurrency.

Reviewed By: siyengar

Differential Revision: D17748652

fbshipit-source-id: a3d05c54ee7eaed4d858df9d89035fe8f252c727
2019-10-08 12:30:55 -07:00
Subodh Iyengar
cbbc6b0c77 Custom variant for simple frames
Summary: Use a custom variant for simple frames

Reviewed By: mjoras

Differential Revision: D17781068

fbshipit-source-id: e059d33df4651c7e0a1c989cc8651c9cd661b14b
2019-10-07 22:43:32 -07:00
Subodh Iyengar
68c332acb1 Use custom variant type for write frames
Summary:
Use the custom variant type for write frames as well, now that
we use them for read frames.

Reviewed By: mjoras

Differential Revision: D17776862

fbshipit-source-id: 47093146d0f1565c22e5393ed012c70e2e23d279
2019-10-07 22:43:31 -07:00
Viktor Chynarov
56c18e96ef Back out "Revert D17636918: [quic] Create findFrameInPacketFunc helper function for unit tests"
Summary: Original commit changeset: dcc2b618c2a7

Reviewed By: lnicco

Differential Revision: D17688819

fbshipit-source-id: 9dd3dbcfd78549f5858a41b67db7fc4bc0647469
2019-10-01 11:11:06 -07:00
Viktor Chynarov
7ca3482f1d Back out "Revert D15268028: [quic] Process lost RetireConnectionIdFrame"
Summary: Original commit changeset: 0447c8666a58

Reviewed By: lnicco

Differential Revision: D17688744

fbshipit-source-id: 8fc2180f65b9a9c03f40f3d242ee020ee319765c
2019-10-01 11:11:06 -07:00
Viktor Chynarov
8af79b3436 Back out "Revert D15267963: [quic] Clone RetireConnectionIdFrame"
Summary: Original commit changeset: c9fb0a514788

Reviewed By: lnicco

Differential Revision: D17688756

fbshipit-source-id: fc098fa9804bf0076cb8f2ff0c6d6b8550021a34
2019-10-01 11:11:05 -07:00
Viktor Chynarov
7682c12bf5 Back out "Revert D15267820: [quic] Add unit test for sending RetireConnectionIdFrame"
Summary: Original commit changeset: 899b6773521a

Reviewed By: lnicco

Differential Revision: D17688590

fbshipit-source-id: fd96f34c97e0c9253cd576447cb8efb6564c3ed5
2019-10-01 11:11:05 -07:00
Shawn Shihang Wei
2bdb9b0dcc Revert D15267820: [quic] Add unit test for sending RetireConnectionIdFrame
Differential Revision:
D15267820

Original commit changeset: b885ca6b5dfa

fbshipit-source-id: 899b6773521a347f06972d69e6be8456dc4e9e7d
2019-09-30 18:49:59 -07:00
Shawn Shihang Wei
52a79997d8 Revert D15267963: [quic] Clone RetireConnectionIdFrame
Differential Revision:
D15267963

Original commit changeset: a2e9059900c0

fbshipit-source-id: c9fb0a514788dd32d5f1956dbea4dcefe34468c8
2019-09-30 18:49:59 -07:00
Shawn Shihang Wei
59f20c91c7 Revert D15268028: [quic] Process lost RetireConnectionIdFrame
Differential Revision:
D15268028

Original commit changeset: 238dcf524251

fbshipit-source-id: 0447c8666a5814e9f88e9f6decd61db54d5c0a34
2019-09-30 18:49:58 -07:00
Shawn Shihang Wei
3ca024e3b8 Revert D17636918: [quic] Create findFrameInPacketFunc helper function for unit tests
Differential Revision:
D17636918

Original commit changeset: 927b3a880ee0

fbshipit-source-id: dcc2b618c2a7accde254d01b5d549a08041dd589
2019-09-30 18:49:58 -07:00
Viktor Chynarov
5199ae5b8d Create findFrameInPacketFunc helper function for unit tests
Summary: Removes a lot of unnecessary code in UT.

Reviewed By: sharma95

Differential Revision: D17636918

fbshipit-source-id: 927b3a880ee0db23b18c81875254fd8b86317bd3
2019-09-30 17:40:14 -07:00
Viktor Chynarov
edb8104fe7 Process lost RetireConnectionIdFrame
Reviewed By: sharma95

Differential Revision: D15268028

fbshipit-source-id: 238dcf524251e6134d2685d5ad821658982c953e
2019-09-30 17:40:14 -07:00
Viktor Chynarov
fbd80f3428 Clone RetireConnectionIdFrame
Reviewed By: sharma95

Differential Revision: D15267963

fbshipit-source-id: a2e9059900c0c231e53d672a4d9495173ed546cc
2019-09-30 17:40:14 -07:00
Viktor Chynarov
d0c61cd8c7 Add unit test for sending RetireConnectionIdFrame
Reviewed By: sharma95

Differential Revision: D15267820

fbshipit-source-id: b885ca6b5dfa7262338168a796caedf391189d85
2019-09-30 17:40:14 -07:00
Subodh Iyengar
04baa15a04 Custom variant type for packetheader
Summary:
Make a custom variant type for PacketHeader. By not relying on boost::variant
this reduces the code size of the implementation.

This uses a combination of a union type as well as a enum type to emulate a variant

Reviewed By: yangchi

Differential Revision: D17187589

fbshipit-source-id: 00c2b9b8dd3f3e73af766d84888b13b9d867165a
2019-09-19 17:31:47 -07:00
Yang Chi
c0a659a30a Replace pacing related callsites with new Pacer interface
Summary:
Use the new Pacer interface in the transport where we currently
directly use CongestinoController interrace for paciner related APIs.

Reviewed By: mjoras

Differential Revision: D16918672

fbshipit-source-id: 410f72d567e71bdd3279e344f6e9abf5e132518e
2019-08-30 19:30:44 -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
Junqi Wang
346a51f63f Update NewConnectionIdFrame to D-22
Summary: ^

Reviewed By: sharma95

Differential Revision: D16466184

fbshipit-source-id: f5a9b8e65e92048393b78305b0d176ab2f4fe338
2019-07-25 11:52:20 -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
Matt Joras
ece3cbe387 Draft-22 varint error codes
Summary: These were changed to varints. To support this we need to do some extra horrible version plumbing. I don't want to keep this long term but it works for now.

Reviewed By: yangchi

Differential Revision: D16293568

fbshipit-source-id: a9ea9083be160aa3e6b338a7d70d7f00e44ec5ab
2019-07-18 12:07:57 -07:00
Yang Chi
2a97d4533c Quic busy write loop detector
Summary:
This diff adds a DebugState in the QuicConnectionState to track the
reason we schedule transport WriteLooper to run, the reason we end up not
writing and the number of times such write happens consecutively. And when it
reaches a predefined limit, we trigger a callback on a loop detector interface.

Reviewed By: kvtsoy

Differential Revision: D15433881

fbshipit-source-id: d903342c00bc4dccf8d7320726368d23295bec66
2019-07-17 15:18:57 -07:00
Junqi Wang
0cc3eabc56 Do not retransmit PATH_RESPONSE
Summary: https://github.com/quicwg/base-drafts/issues/2724

Reviewed By: mjoras

Differential Revision: D15719978

fbshipit-source-id: 1c57f3e2b497f1abfcd5fa3b5643d76aa51d11d9
2019-06-26 22:30:38 -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
Yang Chi
75ab1ce6d5 Reset is a unidirectional event
Summary:
Sending a reset shouldn't affect read states. Receiving a reset
shouldn't affect send states.

Reviewed By: afrind

Differential Revision: D15578287

fbshipit-source-id: 65c5e30666fd9e4c295317ba4c3e0653edbb78ff
2019-05-31 13:27:46 -07:00
Amaury Séchet
d6c88ab4b0 Decouple fizz:test::MockAead from MockAead. Use the former for code that actually needs fizz. (#15)
Summary:
This is based on top of #12 .

It logically split MockAead and fizz::MockAead in preparation for separation of the two.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/15

Reviewed By: yangchi

Differential Revision: D15474045

Pulled By: mjoras

fbshipit-source-id: b61a5cb08ddae0add66a6c37e156eddaef118e0c
2019-05-30 09:16:07 -07:00
Amaury Séchet
f26cd1f62d Add a bridge to fizz::Aead (#12)
Summary:
This introduce quic::Aead as a simple typedef to fizz::Aead and update the codebase to use quic::Aead . This should not impact the functionality of the code in any way.

This is a first step toward introducing an interface that is specific for mvfst so that mvfst can swap fizz for something else.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/12

Reviewed By: JunqiWang

Differential Revision: D15335324

Pulled By: mjoras

fbshipit-source-id: fef166a9a5c2cbae08ad9511d0abd749f330c221
2019-05-29 11:54:08 -07:00
Yang Chi
1dbe39fd76 Separate app-limited and app-idle
Summary:
Current app-limited is defined as the connection doesn't have a no
non-control stream. I'm changing this to be app-idle. And app-limited will be
changed to a state in connection where app isn't sending bytes fast enough to
keep congestion controller probing higher bandwidth.

Reviewed By: mjoras

Differential Revision: D15456199

fbshipit-source-id: e084bc133284ae37ee6da8ebb3c12f505011521e
2019-05-24 12:16:09 -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
Junqi Wang
90a5ba9b45 Process lost NewConnectionId
Reviewed By: sharma95

Differential Revision: D15177595

fbshipit-source-id: 5603111b68697da52619eb0f843f13d2f1779997
2019-05-10 19:07:43 -07:00
Junqi Wang
69333685f4 Clone NewConnectionIdFrame
Reviewed By: sharma95

Differential Revision: D15177440

fbshipit-source-id: 4bd511ec6263008b9a9c0960fc2fb27f14940931
2019-05-10 19:07:42 -07:00
Junqi Wang
57a553cd48 Add unit test for sending NewConnectionIdFrame
Reviewed By: sharma95

Differential Revision: D15177148

fbshipit-source-id: dbbc57a717f7fb5834aa7c5e8d1729ce75346044
2019-05-10 19:07:42 -07:00
Yang Chi
c35e3d6e84 Rename RTO to PTO
Summary: To conform to the current specs.

Reviewed By: mjoras

Differential Revision: D15215018

fbshipit-source-id: 4dcc495aea1cd7cebf2bc84f7367cb2e4a55df19
2019-05-06 18:50:35 -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
Udip Pant
4dd8efffcb remove targets built from headers only (part II)
Summary:
Some versions of compilers, linkers and cmake doesn't support. Required to
support OSX build

Reviewed By: afrind

Differential Revision: D15204709

fbshipit-source-id: a9cbb5a59a0df0fa82838eb38a78a22e619db4ec
2019-05-03 14:24:20 -07:00
Yang Chi
374c4e5b82 move cwnd blocked trace from Cubic to QuicTransportFunction
Summary:
So this trace is shared by all CongestionControllers. This also
changes what we log into the trace.

Reviewed By: siyengar

Differential Revision: D15184916

fbshipit-source-id: 6cbeb02ee2d24a6bf8d705ff883f5a57603988e7
2019-05-02 14:02:49 -07:00
udippant
79032c7b9b fbshipit-source-id: f498ac5e677b2931d937ba78edd4373ba04dca2a 2019-04-25 21:33:43 -07:00
udippant
50d4939e9e Initial commit of mvfst 2019-04-22 23:42:46 -07:00