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

55 Commits

Author SHA1 Message Date
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
Matt Joras
22ffdc1c41 Don't append frame metadata to builder.
Summary: There's no point in doing this for the DSR backend, as we don't use the frame metadata.

Reviewed By: hanidamlaj

Differential Revision: D46787595

fbshipit-source-id: 027fdc0dfe2e45b8b82d506446c8be9090cef939
2023-06-16 15:50:23 -07:00
Matt Joras
6ecdb35ade Minimum packets per stream before next() moves forward
Summary:
The idea here is to allow a way to do incremental stream priorities while switching between streams as aggressively.

Achieving this is somewhat tricky. The easiest place to track this is to make it so the iterator in QuicPriorityQueue no-op next() until a counter reaches an increment.

This is especially impacftul for DSR, where round robining per packet is almost pathologically bad both for CPU impact but also spurious losses and low bandwidth estimates.

Thoughts?

(Note: this ignores all push blocking failures!)

Reviewed By: kvtsoy

Differential Revision: D46268308

fbshipit-source-id: cd5b924141365f61f8a3363bc9cb38a62e5c94cf
2023-06-01 14:11:31 -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
bc1277caa0 Store less metadata for padding frames.
Summary:
Padding frames by definition have no semantics. There also can be quite a large number of them, which makes their storage expensive.

Optimize for this by effectively coalescing multiple contiguous padding frames into a single frame.

(Note: this ignores all push blocking failures!)

Reviewed By: kvtsoy

Differential Revision: D44636497

fbshipit-source-id: 4c1cd88123c4fdf40ec9c553885f46669f7326da
2023-04-18 11:47:11 -07:00
Brandon Schlinker
87d00ece35 Fix dependency loop and improve namings
Summary:
Fixing dependency loop introduced by D37799050 (96abc8160d)

Running `autodeps` yields the following patch:

```
 --- a/xplat/quic/state/TARGETS
+++ b/xplat/quic/state/TARGETS
@@ -43,8 +43,8 @@
     exported_deps = [
         "//folly:random",
         "//quic:constants",
+        "//quic/codec:codec",
         "//quic/codec:types",
-        "//quic/common:circular_deque",
         "//quic/common:interval_set",
     ],
 )
```

If this patch is applied, there is a circular dependency loop between `//quic/codec:codec` and `//quic/state:ack_states` by way of `//quic/codec:types`; this loop was introduced by D37799050 (96abc8160d).

Fixed by separating out headers files and targets. In parallel, renamed structures used for writing ACK frames (which were the reason this loop occurred) to make their role clear.

Differential Revision: D42281359

fbshipit-source-id: 8514c99f3fe72ff1d942d7f303e4a209838c7623
2023-01-05 15:20:44 -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
Hani Damlaj
0ae79027df Issue Conn IDs As Needed
Summary:
- continually issuing new connection ids to peer as old connections ids are retired through RETIRE_CONN_ID frames
- add logic to parse and act on receiving RETIRE_CONN_ID frame

Reviewed By: mjoras

Differential Revision: D38443561

fbshipit-source-id: 82fb679f482fd69c7b3a3385693d2e5575e92703
2022-08-25 17:47:45 -07:00
Joseph Beshay
abee1d8387 Add IMMEDIATE_ACK frame
Summary: Add the new IMMEDIATE_ACK frame from the ack frequency draft.

Reviewed By: mjoras

Differential Revision: D38523438

fbshipit-source-id: 79f4a26160ccf4333fb79897ab4ace2ed262fa01
2022-08-24 11:11:33 -07:00
Joseph Beshay
1e594fe1ba Update ACK_FREQUENCY frame
Summary:
- Use varint reordering threshold (this is still being discussed, using varint until a decision is made)
- Track server's minAckDelay on client
- Track ack frequency frame sequence number
- Improve frame parsing error logs
- Add some unit tests

Reviewed By: hanidamlaj

Differential Revision: D38289108

fbshipit-source-id: 274e45115022ffd4e15b60dc57f77f1cce69bd82
2022-08-24 11:11:33 -07:00
Konstantin Tsoy
4faaa83642 Codec writing/reading of stream group ids
Summary: Add writing and reading of stream group ids

Reviewed By: mjoras

Differential Revision: D36415929

fbshipit-source-id: 650bb8d6f81b2014741a517b165b4d27b7b6c0fe
2022-06-03 15:47:17 -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
58192de447 NewTokenFrame Encoding Fix
Summary:
- Wrap the TokenLength in a QuicInteger
- Validate token written by server equals token parsed by client codec

Reviewed By: mjoras

Differential Revision: D33134186

fbshipit-source-id: fc003979d9bacdb9ab9bb563a300cedd7a99d58a
2022-01-06 11:46:49 -08:00
Hani Damlaj
7233c55d29 Issue NewTokenFrame To Clients
Summary:
- Issuing NewTokenFrames to clients, allowing them to verify their address in subsequent connections by including the token.
- add NewTokenFrame struct in the union type QuicSimpleFrame.
- Issued only once when the crypto handshake is complete.
- Testing includes validating token serialization & deserialization and asserting that the NewTokenFrame is only issued once on handshake completeness.

Reviewed By: mjoras

Differential Revision: D31673160

fbshipit-source-id: 9401ab1a4b878d8b4380d55afa531ec768f5f4cd
2021-12-10 20:35:49 -08:00
Matt Joras
003f012cb7 TODO comment cleanup.
Summary:
These are either no longer relevant, are unlikely to be done, or are spculative enough that they don't deserve code space.

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

Reviewed By: lnicco

Differential Revision: D29769792

fbshipit-source-id: 7cfa62cdc15e72d8b7b0cd5dbb5913ea3ca3dc5a
2021-07-20 10:27:32 -07:00
Luca Niccolini
e39bf5f447 parse and write DATAGRAM Frames
Summary: This diff is the encode and decode support of Datagram frame.

Reviewed By: mjoras, yangchi

Differential Revision: D20983883

fbshipit-source-id: 1a72a87e6ce3601b71fececca872a9d20bf7820e
2021-05-04 10:53:00 -07:00
Matt Joras
382c1cdcc6 Remove partial reliability from mvfst.
Summary: As in title.

Reviewed By: yangchi

Differential Revision: D26701886

fbshipit-source-id: c7b36c616200b17fbf697eff4ba0d18695effb45
2021-03-03 15:30:21 -08:00
Yang Chi
e1b1cb1c89 QUIC DSR: writing a Send Instruction struct
Summary:
For now the SendInstruction only contains stream information. One
SendInstruction is intended for one QUIC packet. The packet that eventually
will be built by backend also can only have one frame: A Stream Frame. Thus the
data length is skipped.

Reviewed By: mjoras

Differential Revision: D25985035

fbshipit-source-id: 94ef638565899893eff5b429d210234ff3f7f5cd
2021-02-18 21:48:28 -08: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
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
Matt Joras
80c0b3185a Introducing the KnobFrame
Summary:
This introduces a new extension frame, the KnobFrame, and an implementation.

The idea with Knobs is that they are arbitrary key-values within a namespace that can be transmitted to the peer at any time. They provide an alternative to transport settings, by eschewing the standard transport setting space entirely.

The idea is simple, each knob has a "knobspace", "id", and value. The knobspace is a namespace in which the knob has semantic meaning (e.g. 0xfaceb00). The id and value are just that, arbitrary identifiers and values.

On receiving a knob it is the application's reponsibility to deal with it.

Reviewed By: mjoras

Differential Revision: D23601468

fbshipit-source-id: 63e5e4a7bdb76e11e8c952f1234f512a629ef348
2020-09-11 14:29:29 -07:00
Matt Joras
70f40cc1c2 Add some sanity checks around cipher dropping.
Summary: As in title, these shouldn't happen.

Reviewed By: oesh, yangchi

Differential Revision: D22138561

fbshipit-source-id: cb51f3e795a1784e3f2ece675a95ac18a4be2701
2020-06-22 09:10:22 -07:00
Yang Chi
51b917b0b3 PingFrame is not a simple frame
Summary:
The problem with Ping being a simple frame:
(1) All SimpleFrames are in the same scheduler. So sending ping means we may
also send other frames which can be problematic if we send in Initial or
Handshake space
(2) Ping isn't retranmisttable. But other Simple frames are. So we are
certainly setting this wrong when we send pure Ping packet today.

That being said, there are cases where we need to treat Ping as retransmittable.
One is when it comes to update ack state: If peer sends us Ping, we may want to
Ack early rather than late. so it makes sense to treat Ping as retransmittable.
Another place is insertion into OutstandingPackets list. When our API user sends
Ping, then also add a Ping timeout. Without adding pure Ping packets into OP list,
we won't be able to track the acks to our Pings.

Reviewed By: mjoras

Differential Revision: D21763935

fbshipit-source-id: a04e97b50cf4dd4e3974320a4d2cc16eda48eef9
2020-06-18 15:30:44 -07:00
Yang Chi
cd7339e454 Give caller some control over if writeStreamFrameHeader should write length
Summary:
Becuase when we clone an existing packet, the logic inside the current
writetStreamFrameHeader is no longer correct.

Reviewed By: mjoras

Differential Revision: D21383828

fbshipit-source-id: 8e6bbb048eefd97ca7cf17b89edc2f395f274a73
2020-05-07 10:56:26 -07:00
Matt Joras
d2879a0e8b Frame types can be > one byte.
Summary: We need to internally represent them as uint64_t, in addition to parsing them as var ints.

Reviewed By: yangchi

Differential Revision: D21261466

fbshipit-source-id: 4ff7b9350cbf1dc0b58cb7ce00674430afd3ba53
2020-04-28 10:45:05 -07:00
Yang Chi
726da8cbf7 Use BufQueue for Quic crypto frame writing as well
Summary:
Other frames have been using the BufQueue version of frame writing.
Change this for Crypto streams as well

Reviewed By: mjoras

Differential Revision: D20947921

fbshipit-source-id: 1cfa0f3806e8d74e8c8a4864498e1c06b55d5292
2020-04-10 09:16:16 -07:00
Yang Chi
db58ba1ca4 Move Quic Stream data writing from WriteCodec to PacketBuilder
Summary:
Different Builders now want to have its own way of writing or
appending write buffer. So let builders handle them.

This also add new APIs in BufWriter to copy data from IOBuf/BufQueue directly
into a destination IOBuf without cloning inbetween.

Reviewed By: mjoras

Differential Revision: D20821789

fbshipit-source-id: c0a24eb12378f64cf26c27d4232f610ed80fba84
2020-04-07 08:46:14 -07:00
Matt Joras
3b2ba3fe8b Implement handshake done
Summary: This is without cipher dropping, but the frame is parseable and the server will send it at the correct time.

Reviewed By: yangchi, lnicco

Differential Revision: D20235013

fbshipit-source-id: 696c11ec573a530b3ed9f4185a2f6847ee08819f
2020-03-04 22:08:33 -08:00
Matt Joras
61cd1a7289 Back out "Implement handshake done and cipher dropping."
Summary: This caused an increase in client errors.

Reviewed By: yangchi, lnicco

Differential Revision: D20186386

fbshipit-source-id: 737122a94c97498efba61292a6c292cfe482925c
2020-03-01 18:31:40 -08:00
Matt Joras
2b3b76cc4d Remove support for MVFST_OLD.
Summary:
This eliminatees some tech debt by completely removing the notion of version from the core transport parameters structure and the app token for zero rtt.

Note that for the draft-27 changes we will need to temporarily re-introduce it, but to a different layer (the extension encoding itself).

Reviewed By: JunqiWang

Differential Revision: D20073578

fbshipit-source-id: 2b55af621566bf1c20e21dd17251116de1788fa0
2020-02-28 09:52:34 -08:00
Matt Joras
472e40a902 Implement handshake done and cipher dropping.
Summary: This implements the handshake done signal and also cipher dropping.

Reviewed By: yangchi

Differential Revision: D19584922

fbshipit-source-id: a98bec8f1076393b051ff65a2d8aae7d572b42f5
2020-02-27 12:25:52 -08:00
Matt Joras
431acc838f Optimize ACK frame writing
Summary:
Previously we stored an `IntervalSet` in each `WriteAckFrame`. We don't need to do this, as by the time we are writing an `ACK` the `IntervalSet` is complete. Instead of bothering with the `IntervalSet` operations, we can simply serialize it to a reverse-sorted `vector.`

Additionally this has some micro-optimizations for filling the ACK frame, with a new function for getting varint size.

Reviewed By: yangchi

Differential Revision: D19397728

fbshipit-source-id: ba6958fb36a4681edaa8394b1bcbbec3472e177d
2020-01-16 10:40:40 -08:00
Matt Joras
9dae0abe05 Fix appliication close writing/parsing
Summary: There's no triggering frame type for application closes.

Reviewed By: yangchi, raghunallamothu

Differential Revision: D19191873

fbshipit-source-id: 66cc2098e1f7671fabab0a2309deaabe7922a18e
2019-12-20 18:58:54 -08:00
Matt Joras
f041ec17ef Use folly::small_vector for ack blocks
Summary: By modifying `IntervalSet` a bit we can make it so it takes a `folly::small_vector` as the container. We expect that for real traffic there will not generally be a lot of ACK blocks per frame, so optimize for that.

Reviewed By: siyengar

Differential Revision: D18919975

fbshipit-source-id: 199a2ea9ba5003382e2d7d99fc7a6de7e8aafdca
2019-12-12 12:06:31 -08:00
Raghu Nallamothu
e06de27550 Merge Application Close Frame and Connection Close Frame
Summary: As a part of Draft 17, application close frame has been removed, we use connection close frame to represent both application close and connection close.

Reviewed By: mjoras

Differential Revision: D18580856

fbshipit-source-id: d274fa2d3dbc59b926bca5a2b8a20328ae582703
2019-12-03 15:02:06 -08:00
Matt Joras
4dc04682a9 Replace IOBufQueue in writeBuffer
Summary: This isn't a huge source of cycles, but the flushing of the cache does show up in tperf. Turns out this is very easy to do, and exposed another minor problem which is that we were misusing `clear()` on the `IOBufQueue`. Instead we should have been using `move()` to reset it to being empty.

Reviewed By: siyengar

Differential Revision: D18758922

fbshipit-source-id: 6dcbc29e8bebd93b5787939176799e3df90ed94d
2019-12-02 18:16:24 -08:00
Matt Joras
cf783ae678 Replace IOBufQueue in retransmission buffer.
Summary:
`IOBufQueue` has some facilities for fast appending to the tail. This is not useful for us in the retransmission buffer usecase, and probably not at all. Flushing the tail cache from the `IOBufQueue` is expensive when we have to shuffle around the retransmission buffer queue on removal.

This diff replaces `IOBufQueue` with a bespoke version that only has some of the functionality.

This also changes the dependent peek APIs to use `IOBuf`s directly.

Reviewed By: siyengar, yangchi

Differential Revision: D18126437

fbshipit-source-id: a2fec0f45a72459855700c605bfd0d863a9067b7
2019-11-20 12:04:03 -08:00
Raghu Nallamothu
e06c0848e0 T24905463 - [quic][ping] Implement ping in Quic
Summary: Implement ping functionality in ping

Reviewed By: yangchi

Differential Revision: D17885286

fbshipit-source-id: 4c328d14a023057d6889818250c0129c06e60874
2019-10-21 17:07:12 -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
fa98978d6d Back out "Revert D15264935: [quic] Make RetireConnectionIdFrame a QuicSimpleFrame (for now)"
Summary: Original commit changeset: aa2ccf4bb39e

Reviewed By: lnicco

Differential Revision: D17688496

fbshipit-source-id: e627784cdfe208994cbae3f71062d74d312d3600
2019-10-01 11:11:05 -07:00
Shawn Shihang Wei
5cf3c6ce67 Revert D15264935: [quic] Make RetireConnectionIdFrame a QuicSimpleFrame (for now)
Differential Revision:
D15264935

Original commit changeset: 8c66c4604e24

fbshipit-source-id: aa2ccf4bb39ec3b0286baaed5cc42bf9065f4fcd
2019-09-30 18:49:59 -07:00
Viktor Chynarov
0ab06b6fc9 Make RetireConnectionIdFrame a QuicSimpleFrame (for now)
Reviewed By: sharma95

Differential Revision: D15264935

fbshipit-source-id: 8c66c4604e24442f4c77e8eb2d10901d1702adc7
2019-09-30 17:40:13 -07:00
Matt Joras
72e677df33 Send windowed stream limit updates
Summary:
Implement sending stream limit updates in a windowed fashion, so that as a peer exhausts its streams we will grant it additional credit. This is implemented by having the stream manager check if an update is needed on removing streams, and the api layer potentially sending an update after it initiates the check for closed streams.

This also makes some driveby changes to use `std::lower_bound` instead of `std::find` for the sorted collections in the stream manager.

Reviewed By: yangchi

Differential Revision: D16808229

fbshipit-source-id: f6e3460d43e4d165e362164be00c0cec27cf1e79
2019-09-18 11:33:03 -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
Matt Joras
049b512646 Write stream frame header and data separately.
Summary:
Prior to this diff we would clone out an entire flow control's worth of data from the writebuffer and then clone out a smaller portion of that to write into the packet builder. This is extremely wasteful when we have a large flow control window.

Additionally we would always write the stream data length field even when we are going to fill the remainder of the packet with the current stream frame. By first calculating the amount of data that needs to can be written and writing the header, we can now omit the data length field when we can fill the whole packet.

Reviewed By: yangchi

Differential Revision: D15769514

fbshipit-source-id: 95ac74eebcde87dd06de54405d7f69c42362e29c
2019-08-22 15:59:41 -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
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
Bonnie Xu
f2e6ba6de9 Changed to a more accurate variable name
Summary: Changed to a more accurate variable name.

Reviewed By: yangchi

Differential Revision: D15769818

fbshipit-source-id: 1d36c7011c45c723c35daba4ca2a5fc80a0bd7b4
2019-06-11 19:00:20 -07:00