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

64 Commits

Author SHA1 Message Date
Brandon Schlinker
68d660c46d Count number of packets sent and lost by type
Summary:
We currently have a count of the number of packets retransmitted, and the number of packets marked as lost spuriously, but we do *not* have the total number of packets sent or lost, which is necessary to calculate statistics such as % of packets retransmitted % of losses that are spurious.

At the moment, we do not count loss events for D6D packets. Will likely add a separate counter for those in a subsequent diff.

Reviewed By: xttjsn

Differential Revision: D25540531

fbshipit-source-id: 80db729eb8c91f7805d342f4aab302a5b3ca4347
2020-12-14 16:32:55 -08:00
Xiaoting Tang
f4086dc092 Make commonly-used d6d types individual target
Summary: This reduces dependencies for both testing and instrumentation.

Reviewed By: mjoras

Differential Revision: D23997313

fbshipit-source-id: 5eb3a790c7bb2569dc1e941e3911ad4aac4e9258
2020-09-30 09:32:50 -07:00
Xiaoting Tang
37cd692593 Refactor d6d pending events into a single struct
Summary: As a drive-by: fixed a bug where I didn't cancel the pending event when timeouts expire.

Reviewed By: mjoras

Differential Revision: D23910767

fbshipit-source-id: 233e590c17a6c6b7a5f4a251bd8f78f6dfae3c0b
2020-09-25 13:36:13 -07: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
Xiaoting Tang
1aec6b57f0 send d6d probe packets via writeD6DProbingDataToSocket
Summary:
This is the transport function that sends d6d probe to socket. It
- checks if there's the pending event `sendD6DProbePacket`, which will be set by upon d6d's probe timer expiration.
- uses the current probeSize to instantiate a D6DProbeScheduler, which will be changed by a small d6d state machine.

Reviewed By: yangchi

Differential Revision: D23193967

fbshipit-source-id: dfe6ce831cfd6ff0470e801644b95d4e8da34e87
2020-09-14 22:29:28 -07:00
Yang Chi
8616a9b3aa Consider ack delay in BBR bandwidth calculation
Summary:
it turns out some client can delay ack for long time, randomly, which
may make us miss a good bandwidth update

Reviewed By: mjoras

Differential Revision: D23686348

fbshipit-source-id: 6524d08b6db03ede59a72049b4af98609740463a
2020-09-14 22:04:28 -07:00
Xiaoting Tang
9cdb922288 Special treatment to d6d probe in tx/rx path via isD6DProbe flag in OutstandingPacket
Summary:
According to the spec, loss of d6d probe packet should not affect congestion
control, but AFAIU its ack should be considered a normal ack and has all the
implications of an ack (e.g. sample srtt, increment largest ack num).

Additionally, although d6d probe uses ping frame, neither sending a d6d probe
nor receiving the ack should have any bearing on either pendingEvents.sendPing
or pendingEvents.cancelPingTimeout.

To differentiate a d6d probe from a normal packet in tx/rx path, the isD6DProbe
flag is added. I also added a new struct to store d6d specific states (1 field
in this diff, more to come in subsequent diffs). In updateConnection, we
identify a d6d probe by comparing the packet sequence num with the sequence num
stored in the lastProbe field of the d6d state.

Reviewed By: mjoras

Differential Revision: D22551400

fbshipit-source-id: 85ec30c185666c3d5cf827bf03b4f92e6f22d4ec
2020-09-14 16:06:21 -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
Yang Chi
95f3730569 Fix bad probe sending condition in crypto writes
Summary: Wrong parenthesis

Reviewed By: mjoras

Differential Revision: D23655249

fbshipit-source-id: 03480601ed50053d7f19fe79d77f831d6349aa6e
2020-09-12 17:27:07 -07:00
Matt Joras
325a6465ec Always send flow control updates again when lost.
Summary: This was probably a premature optimization and introduces complexity for dubious gain. Additionally a sequence of losses could potentially cause multiple updates to be delayed.

Reviewed By: yangchi

Differential Revision: D23628058

fbshipit-source-id: d6cf70baec8c34f0209ea791dadc724795fe0c21
2020-09-10 14:58:59 -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
Luca Niccolini
c47c3cf5c6 Revert PMTU and size-enforced packet builder
Differential Revision: D23283619

fbshipit-source-id: b7fe31871dad5711016234a2d10ae84edc4fd24c
2020-08-22 16:55:54 -07:00
Xiaoting Tang
4762cfb927 Introduce PMTU as a variable
Summary:
First step towards d6d. Semantically we need to separate the old `udpSendPacketLen` into `peerMaxPacketSize` as well as `currPMTU`. The former is directly tied to the peer's max_packet_size transport parameter whereas the second is controlled by d6d. To get the actual udp mss, call `conn_->getUdpSendPacketLen()`, which will use the minimum of the two if d6d is enabled, otherwise it will fallback to use `peerMaxPacketSize` only.

During processClientInitialParams and processServerInitialParams, we no longer need to check whether `canIgnorePathMTU` is set because that logic is moved to `setUdpSendPacketLen`. If d6d is enabled, we set both `peerMaxPacketSize` and `currPMTU` to `packetSize` because receiving an initial packet of size x indicates both that the peer accepts x-sized packet and that the PMTU is at least x.

Many call sites and tests are changed.

Faebook:
For now, d6d is considered enabled if `canIgnorePathMTU==false` and `turnoffPMTUD==true`. Down the road, from semantic & practical POV at least one of them should be renamed to something like `enableD6D`, since enabling d6d implies turning off PMTUD and that we should not ignore PMTU. We can keep one for the sake of testing.

Reviewed By: mjoras

Differential Revision: D22049806

fbshipit-source-id: 7a9b30b7e2519c132101509be56a9e63b803dc93
2020-08-17 16:15:24 -07:00
Matt Joras
015ff4a808 Lowercase qlog strings.
Summary: In the spec these are now lowercase.

Reviewed By: avasylev

Differential Revision: D22104880

fbshipit-source-id: adc9bbcd7bd9e7babb1946648d2867ec7dc9336b
2020-07-14 16:12:25 -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
b8fef40c6d Clone Quic handshake packets
Summary:
On loss timer, currently we knock all handshake packets out of the OP
list and resend everything. This means miss RTT sampling opportunities during
handshake if loss timer fires, and given our initial loss timer is likely not a
good fit for many networks, it probably fires a lot.

This diff keeps handshake packets in the OP list, and add packet cloning
support to handshake packets so we can clone them and send as probes.

With this, the handshake alarm is finally removed. PTO will take care of all
packet number space.

The diff also fixes a bug in the CloningScheduler where we missed cipher
overhead setting. That broke a few unit tests once we started to clone
handshake packets.

The writeProbingDataToSocket API is also changed to support passing a token to
it so when we clone Initial, token is added correctly. This is because during
packet cloning, we only clone frames. Headers are fresh built.

The diff also changed the cloning behavior when there is only one outstanding
packet. Currently we clone it twice and send two packets. There is no point of
doing that. Now when loss timer fires and when there is only one outstanding
packet, we only clone once.

The PacketEvent, which was an alias of PacketNumber, is now a real type that
has both PacketNumber and PacketNumberSpace to support cloning of handshake
packets. I think in the long term we should refactor PacketNumber itself into a
real type.

Reviewed By: mjoras

Differential Revision: D19863693

fbshipit-source-id: e427bb392021445a9388c15e7ea807852ddcbd08
2020-06-18 15:30:44 -07:00
Yang Chi
4790a5792d Do not fallback to Ping if any probe is written, or if we don't have probe
Summary: as title.

Reviewed By: mjoras

Differential Revision: D22044917

fbshipit-source-id: 18a4c988633c04233591bc596fd811ebe98c1171
2020-06-18 15:30:44 -07:00
Yang Chi
25a646f96a No more Pending mode in Quic ack writing
Summary:
The AckScheduler right now has two modes: Immediate mode which always
write acks into the current packet, pending mode which only write if
needsToSendAckImmediately is true. The FrameScheduler choose the Immdiate mode
if there are other data to write as well. Otherwise, it chooses the Pending
mode. But if there is no other data to write and needsToSendAckImmediately is
false, the FrameScheduler will end up writing nothing.

This isn't a problem today because to be on the write path, the shouldWriteData
function would make sure we either have non-ack data to write, or
needsToSendAckImmediately is true for a packet number space. But once we allow
packets in Initial and Handshake space to be cloned, we would be on the write
path when there are probe quota. The FrameScheduler's hasData function doesn't
check needsToSendAckImmediately. It will think it has data to write as long as
AckState has changed, but can ends up writing nothing with the Pending ack
mode.

I think given the write looper won't be schedule to loop when there is no
non-ack data to write and needsToSendAckImmediately is true, it's safe to
remove Pending ack mode from AckScheduler.

Reviewed By: mjoras

Differential Revision: D22044741

fbshipit-source-id: 26fcaabdd5c45c1cae12d459ee5924a30936e209
2020-06-18 15:30:43 -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
Xiaoting Tang
03e3bb6547 make largestAckedByPeer and largestSent optional
Summary: 0 is now a valid packet number, so we should make these optional. In cases where they are needed to construct packet builder, it should be safe to use 0 as default since it's only used for computing `twiceDistance` in PacketNumber.cpp.

Reviewed By: yangchi

Differential Revision: D21948454

fbshipit-source-id: af9fdc3e28ff85f1594296c4d436f24685a0acd6
2020-06-10 10:30:10 -07:00
Yang Chi
7bfeec366a Use QuicInplacePacketBuilder for write path
Summary: as title

Reviewed By: mjoras

Differential Revision: D21211415

fbshipit-source-id: 15814f951adca2eb4ded8228e2d291a9c1514011
2020-05-12 07:04:57 -07:00
Yang Chi
62d122a0c4 Fallback to write a Ping frame if Quic Probe doesn't write anything
Summary: as title

Reviewed By: mjoras

Differential Revision: D21464423

fbshipit-source-id: 48cec75f6c8ff0be1e41a5d5a6da0fabf064973a
2020-05-10 09:32:05 -07:00
Yang Chi
fd41b0e324 Quic Probing can write frames other than stream frames
Summary:
During PTO, when we try to write new data, we have been limiting to
only stream data and crypto data. This diff adds a few more types of data to
write during probes if they are available: Simple frame, Window updates, Rst
and Blocked frames.

Right now Acks won't be included here.

Reviewed By: mjoras

Differential Revision: D21460861

fbshipit-source-id: d75a296e96375690eee5e609efd7d1b5c103e8da
2020-05-10 09:32:05 -07:00
Matt Joras
b7389426dc Move retransmission buffer CHECK
Summary: This is just in wrong place. There can be multiple frames per packet that we may be implicitly ACKing.

Reviewed By: lnicco

Differential Revision: D21493553

fbshipit-source-id: 89befab01c5a27d400089478717110bca8137d99
2020-05-09 23:26:40 -07:00
Matt Joras
19dae4b3a0 Clear loss buffer on handshake done.
Summary: Without doing this the loss buffer can potentially carry data indefinitely.

Reviewed By: yangchi

Differential Revision: D21484470

fbshipit-source-id: 85ac9f274c9badb51eb431b85f67a654c399a018
2020-05-09 17:19:42 -07:00
Yang Chi
7bb0dddf34 Check cipher presence before decide to fire write looper for crypto
Summary: they now can be dropped

Reviewed By: mjoras

Differential Revision: D21476334

fbshipit-source-id: 646b993573fea460b0cd967bdb312cd849ac35d3
2020-05-08 16:17:44 -07:00
Yang Chi
46b9fb69f4 Skip a packet number for Quic probe packets
Summary: to elicit acks

Reviewed By: mjoras

Differential Revision: D21309835

fbshipit-source-id: fd56de66c806d5e03292298c79eab49014291b75
2020-05-08 11:41:04 -07:00
Yang Chi
2a1529068d Move Quic packet header encoding out of builder constructor
Summary:
Currently the packet builder contructor will encode the packet
builder. This is fine when the builder creates its own output buffer. If later
on we decides not to use this builder, or it fails to build packet, the buffer
will be thrown away. But once the builder uses a buffer provided by caller, and
will be reused, we can no longer just throw it away if we decide not to use
this builder. So we have to delay the header encoding until we know we will use
the builder.

This is still not enough to solve the case where we want to use this builder,
it builds, then it fails . For that, we will need to retreat the tail position
of the IOBuf.

Reviewed By: mjoras

Differential Revision: D21000658

fbshipit-source-id: 4d758b3e260463b17c870618ba68bd4b898a7d4c
2020-04-28 22:14:21 -07:00
Matt Joras
524bf84c44 Implement an explicit inplace encrypt in Aead.
Summary: This is useful when you want to ensure that the IOBuf you pass in is encrypted inplace, as opposed to potentially creating a new one.

Reviewed By: yangchi

Differential Revision: D21135253

fbshipit-source-id: 89b6e718fc8da1324685c390c721a564bb77d01d
2020-04-21 21:43:59 -07:00
Luca Niccolini
5ca21a5278 rename infoCallback to statsCallback
Summary:
```
find ./quic | xargs -I{} sed -i "s/infoCallback/statsCallback/g" {}
find ./quic | xargs -I{} sed -i "s/InfoCallback/StatsCallback/g" {}
```

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D20860675

fbshipit-source-id: 4fe99a375b5983da51b6727d7f40788f89083ab3
2020-04-11 11:16:51 -07:00
Matt Joras
49d552c3f4 Store unique_ptr<StreamBuffer> in retransmissionBuffer.
Summary:
As it turns out, the extra indirection from storing a unique_ptr is not worse than the gain from using an `F14ValueMap` versus an `F14VectorMap`.

This reduces the `find` cost measurably in profiles, and doesn't appear to have any real negative effects otherwise.

Reviewed By: yangchi

Differential Revision: D20923854

fbshipit-source-id: a75c4649ea3dbf0e6c89ebfe0d31d082bbdc31fd
2020-04-08 14:35:16 -07:00
Yang Chi
df865c4e34 Round up Quic congestion control writable bytes to nearest multiple of packet
Summary:
Currently we return the exact writable bytes number from a real
congestion controller or Path Challenger. This diff round the number up to the
nearest multiple of packet length. Doing so can greatly reduce weird bytes
counting/checking bugs we have around packet writing.

Reviewed By: mjoras

Differential Revision: D20265678

fbshipit-source-id: 2973dde3acc4b2008337127482185f34e16efb43
2020-03-05 12:42:52 -08: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
Yang Chi
04e487dc71 Move MockQuicStates to quic/state/test directory
Summary:
our convention has always been to put the mock in the test dir under
the real class

Reviewed By: lnicco

Differential Revision: D20104476

fbshipit-source-id: 5215ffc9af7a6d7a5ac41109723a71f68f852af7
2020-02-25 19:02:59 -08:00
Matt Joras
6827637d45 Use NiceMock in more tests
Summary: When we don't use NiceMock we end up with a ton of spam in failing tests for every callback that we didn't EXPECT. This makes failed test output extremely noisy.

Reviewed By: sharmafb

Differential Revision: D19977113

fbshipit-source-id: 1a083fba13308cd3f2859da364c8106e349775bb
2020-02-19 21:46:46 -08:00
Yang Chi
d5b454a9c0 Back out "Quic pacing refactor"
Summary: Original commit changeset: b83e4a01fc81

Reviewed By: mjoras

Differential Revision: D19644828

fbshipit-source-id: 83d5a3454c6f9a8364e970d236cba008aef85fbd
2020-01-30 18:32:03 -08:00
Yang Chi
edb5104858 Quic pacing refactor
Summary:
(1) The first change is the pacing rate calculation is simplified. It
removes the interval calculation and just uses the timer tick as the interval.
Then it calculates the burst size from there.  For most cases these two
calculation should land at the same result, except when the
`cwnd < minBurstSize * tick / RTT`. In that case, the current calculation would
spread writes evenly across one RTT, assuming no new Ack arrives during the RTT;
while the new calculation uses the first a few ticks to finish the cwnd amount
of data.

(2) Then this diff changes how we compensate late timer. Now the pacer will
maintain a nextWriteTime_ and lastWriteTime_, which makes it easier to
calculate time elapsed since last write. Then each time writer tries to write,
it will be allowed to write timeElapsed * pacingRate. This is much more
intuitive than the current logic.

(3) The diff also adds pacing limited tracking into the pacer. An expected
pacing rate is cached when pacing rate is refreshed by congestion controller.
Then with packets sent out, Pacer keeps calculating the current send rate. When
the send rate is lower, Pacer sets pacingLimited_ to true. Otherwise false.

Only when the connection is not pacing limited, the lastWriteTime_ will be
packet sent time, otherwise it will be set to the last nextWriteTime_. In other
words: if the send rate is lower than expected, we use the expected send time
instead of real send time to calculate time elapsed, to allow higher late
timer compenstation, to give pacer a chance to catch up.

(4) Finally this diff removes the token collecting behavior in the pacer. I
think having tokens increaed, instead of reset, when an ack refreshes the pacing
rate or when we compensate late time, is quite confusing to some people. After
all the above changes, I found tperf can still sustain good throughput without
always increase tokens, and rally actualy gives even better results. So i think
we can remove this part of the pacer that's potentially very confusing to
people who don't know how we got there.

Reviewed By: mjoras

Differential Revision: D19252744

fbshipit-source-id: b83e4a01fc812fc52117f3ec0f5c3be1badf211f
2020-01-17 10:11:35 -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
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
68e0a1add2 Limit write loop time by a fraction of RTT
Summary:
Before we have pacing, we limit write function to loop at most 5
times. Then pacing came in, and pacing burst is used as the limit when pacing
is enabled. Then pacing token was introduced to increase send rate when pacing
is enabled. Then when cwnd is large enough, pacing burst size can be really
large, that means this write function can loop for long time. When use loopback
as network interface, for example, the write function can loop more than 1 RTT,
which delays receive time when peer packets already arrived, which leads to
both wrong RTT estimation and wrong BBR bandwidth estimation.

This diff limits the write to a fraction of RTT as well, and current default
value will be 1/25 SRTT.

Reviewed By: mjoras

Differential Revision: D18864699

fbshipit-source-id: 0b57ee4138e4788d132152a4aa363959065f6f7f
2019-12-30 15:11:50 -08:00
Matt Joras
a2b6dc5453 Inline getPacketSequenceNum and getPacketNumSpace
Summary: As it turns out these end up being hot functions. Most of the hotness is it taking the cache miss, but we're able to reduce it from .9% exclusive each to .1-.3% exclusive each by inlining it (which eliminates a `callq` instruction for each).

Reviewed By: yangchi

Differential Revision: D19069685

fbshipit-source-id: c971a4d1c26a7e48008c36a129e0a842a27ca87f
2019-12-14 20:17:32 -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
Matt Joras
cc73527122 Store stream state in F14FastMap
Summary: `F14FastMap` is faster than `F14NodeMap` as it requires one fewer allocations. We don't need the reference stability of `F14NodeMap`. We need to make the `QuicStreamLike` movable to use it.

Reviewed By: siyengar

Differential Revision: D18681242

fbshipit-source-id: e155d0bdec905c6a2f42d7169741c130bc9cc86d
2019-11-27 00:25:25 -08:00
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
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
1c0794abd7 Write control streams before other streams.`
Summary: For protocols like HTTP/3, lacking an actual priority scheme, it's a good idea to write control streams before non control streams. Implement this in a round robin fashion in the same way we do for other streams.

Reviewed By: afrind

Differential Revision: D18236010

fbshipit-source-id: faee9af7fff7736679bfea262ac18d677a7cbf78
2019-11-04 14:20:49 -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
Yang Chi
537e178a5f Introduce Tokens in Quic Pacer
Summary:
Add a token value into the pacer. This is so that when there is not
enough application data to consume all the burst size in current event loop, we
can accumulate the unused sending credit and use the later when new data comes
in. Each time a packet is sent, we consume 1 token. On pakcet loss, we clear
all tokens. Each time there is an ack and we refresh pacing rate, token
increases by calculated burst size. It is also increased when timer drifts
during writes. When there is available tokens, there is no delay of writing out
packets, and the burst size is current token amount.

Reviewed By: siyengar

Differential Revision: D17670053

fbshipit-source-id: 6abc3acce39e0ece90248c52c3d73935a9878e02
2019-10-10 22:08:11 -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