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

63 Commits

Author SHA1 Message Date
Matt Joras
c9bee22de1 Use kernel receive timestamps for QuicServerWorker.
Summary:
Sometimes evb delays, e.g. from packet writing, can cause our timestamps to be very inaccurate relative to the RTT. Adjust for this by using the time from the packet.

This also tracks the largest received timestamp per-thread so that the packet receive times reported to the transport layer don't move backwards.

Reviewed By: yangchi

Differential Revision: D24628778

fbshipit-source-id: 5fa26091f9a0020cdfa456eaa88bb35fae836e30
2020-11-19 17:53:40 -08:00
Matt Joras
7d936f884b Add ability to disable IPV6_ONLY for QuicServer
Summary: As in title.

Reviewed By: yangchi

Differential Revision: D24371733

fbshipit-source-id: e0dbe4c4270cc52add80dc1fefbb59f89f706e77
2020-10-30 09:53:50 -07:00
Luca Niccolini
4c64fd3d7e add more connection stats
Summary: pipe more interesting connection level data

Reviewed By: xttjsn

Differential Revision: D24462971

fbshipit-source-id: c9182babdbd48713a43d30b3e765eaab187f9954
2020-10-28 18:39:26 -07:00
Dan Melnic
ddb282f31e Avoid duplicate code for UDP CMSG processing
Summary:
Avoid duplicate code for UDP CMSG processing

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D24394694

fbshipit-source-id: 80664109154e78ec4d6ee8d33cf9a5269f60195e
2020-10-28 13:06:35 -07:00
generatedunixname89002005325676
f14e0063cb Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D24357967

fbshipit-source-id: 9e6dacd40846f5192b67f77879e93f0b5c5be193
2020-10-16 12:14:25 -07:00
Luca Niccolini
a801f0256d export connection stats
Reviewed By: mjoras

Differential Revision: D24132106

fbshipit-source-id: c6fdb4b509217bf410d03239b439ec56281a68ff
2020-10-15 19:07:56 -07:00
Matt Joras
a0dfb03a97 Fix some VN and packet length checks.
Summary:
We shouldn't send a VN on receiving a VN, as this can cause VN ping pong.

Also, we need to check earlier whether a packet meets the minimum Initial size.

Reviewed By: yangchi

Differential Revision: D24196884

fbshipit-source-id: 222f38b6f341702e7d2dbaa9030557cef6438ee6
2020-10-08 16:18:41 -07:00
Andrii Vasylevskyi
b17e4594c9 Pass ConnectionIdVersion to the QuicServer
Summary:
Adding setter for QuicServer to pass down connection ID version.
Also updating hostId setter to uint32 from uint16, I've udpated ServerConnectionIdParams to uint32 earlier, but not server setters.

Reviewed By: udippant

Differential Revision: D23917110

fbshipit-source-id: e3bef08c91b52fccc3ef4b2f3cc6aa67e24c089d
2020-10-03 07:45:44 -07:00
Andrii Vasylevskyi
07ff0abdaf ConnectionId v2
Summary: Adding new version of CID, increasing L4 part from 16 to 24 bits. Also aligning at byte boundaries for easier parsing. See comment in DefaultConnectionIdAlgo.h.

Reviewed By: udippant

Differential Revision: D23177448

fbshipit-source-id: 706a8ed2b71a27bfc96eaf3a8822a3880730c0c6
2020-08-21 20:18:40 -07:00
Frank Cangialosi
eb1dd2c31b add ccpreader and connect to quicserver
Summary:
This is the second half of the actual support for CCP in mvfst.

As described in the previous diff, the CCPReader's job is to simply wait for messages from CCP, and then apply the changes (update cwnd or rate) to the correct connection.

Each server worker creates their own instance of CCPReader and thus each maintains their own separate connection to CCP (to avoid the use of a shared queue/lock between the workers).

This diff also adds the `ccpConfig` field to `QuicServer`, which is just a string that contains arguments to start CCP. If it is empty, ccp is disabled, and thus no instances of `CCPReader` are created.

Reviewed By: udippant

Differential Revision: D21854344

fbshipit-source-id: f1dd1e1bad00563db5f55f1514278e52ad11bb8b
2020-07-16 16:50:22 -07:00
Brandon Schlinker
9dd5d81d8e Accept observer
Summary:
Adds `quic::AcceptObserver`, an observer that is notified when a connection is accepted.

- Can be used by instrumentation that ties its lifetime to that of the transport; the observer can be used to initialize instrumentation and install additional observers on accept.
- `wangle::Acceptor` has a matching interface being added (D21652470), so instrumentation can follow the same paradigm for both QUIC and TCP.
- In the future, will extend to also be triggered when a transport becomes ready (e.g., TLS handshake complete), similar to what we have for `wangle::Acceptor`.

Reviewed By: mjoras

Differential Revision: D21656740

fbshipit-source-id: 46f30379551087e4f22b06d4493cf0263530639f
2020-07-16 10:25:45 -07:00
Matt Joras
4208ad861e Stats for QuicVersion
Summary: It is useful to know at what frequency we are receiving each version.

Reviewed By: yangchi

Differential Revision: D22071299

fbshipit-source-id: 1e6f909d2b3a65cf54decc35f7e2e321d0ff8f24
2020-06-16 17:05:41 -07:00
Udip Pant
bb06a1d81d log misrouting of packets at host level with increased verbosity
Reviewed By: lnicco

Differential Revision: D21988330

fbshipit-source-id: 33978dd66bf10f929994dd147ec531691b67a1ee
2020-06-10 18:12:18 -07:00
Matt Joras
1e4443e876 Further randomize stateless resets.
Summary:
We should randomize the size of the reset and the data in the first byte.

This also implements the latest recommendatioons from the spec around reset packet sizing.

Reviewed By: yangchi

Differential Revision: D21885631

fbshipit-source-id: ad82f3356203b6809eed746e3948ba47fbc31cf5
2020-06-08 15:01:30 -07:00
Dan Melnic
15a40e76bc QUIC server support for async recvmsg
Summary: QUIC server support for async recvmsg

Reviewed By: mjoras

Differential Revision: D21235170

fbshipit-source-id: df18fa2bf7e6b58a4c2b3a302dd3c1949204c563
2020-06-08 10:46:34 -07:00
Dan Melnic
4520c24378 Fix QuicServerWorker::getReadBuffer
Summary: Fix QuicServerWorker::getReadBuffer

Reviewed By: mjoras

Differential Revision: D21675710

fbshipit-source-id: 4272ba54fecc8fd116b47ece6c2b2291213e481a
2020-05-21 10:34:04 -07:00
Matt Joras
30bff94e85 Introduce new connection rate limits.
Summary:
This introduces a rate limit to new connections created by a worker.

Right now it will simply send a VN, but eventually this will only issue a RETRY for unverified initials.

Reviewed By: udippant

Differential Revision: D21614905

fbshipit-source-id: 1832fbdad525c53fb1cb810aa9d7bae868c267d6
2020-05-18 16:40:43 -07:00
Yang Chi
1f0f29c2bb Fallback to chained memory data path if the batching mode isn't GSO
Summary: safety check, in case someone passes in a bad config

Reviewed By: mjoras

Differential Revision: D21383830

fbshipit-source-id: 60ab9e9e350855d6013c39590fb5c0d4a8e4f1ef
2020-05-07 10:56:26 -07:00
Matt Joras
989352e12f Back out "avoid unnecessary userspace routing of packets"
Summary: As in title.

Reviewed By: lnicco

Differential Revision: D21337477

fbshipit-source-id: 6fa71a638172a9b017170ec2f8c6c6639a6e1d3d
2020-04-30 18:58:36 -07:00
Matt Joras
6339b8dd92 Back out "send reset instead of silently dropping packets due to misrouting"
Summary: As in title.

Reviewed By: udippant

Differential Revision: D21337383

fbshipit-source-id: fd66b91ef9520704e841c2976979959b846b9e12
2020-04-30 18:58:35 -07:00
Yang Chi
081b63ffce Give QuicServerWorker an output buffer for GSO write with continuous memory
Summary: as title

Reviewed By: mjoras

Differential Revision: D20919833

fbshipit-source-id: 8cd9674d7bccf115cbdac5b976ba70e5dcb70e14
2020-04-28 22:14:20 -07:00
Udip Pant
76037a9a1d send reset instead of silently dropping packets due to misrouting
Summary:
There were some TODOs left in the QuicServerWorker where we silently drop
packets.

Reviewed By: mjoras, yangchi

Differential Revision: D21235150

fbshipit-source-id: eb546ea6d792915cf3155370758e837318530a38
2020-04-27 11:25:28 -07:00
Udip Pant
1b57db5da4 avoid unnecessary userspace routing of packets
Summary:
for initial or zero-rtt packets, or in the case of short-header packets, if the
worker-id already matches, we do not need to do any userspace routing of
packets.

Reviewed By: mjoras

Differential Revision: D21219335

fbshipit-source-id: 988614530960a621a02c0375f4a507b333f66e69
2020-04-24 11:49:55 -07:00
Udip Pant
bf71c1364a cleanup logging of routing info in QuicServerWorker
Summary: Extract out logging of all relavent routing info into a separate method

Reviewed By: sharmafb

Differential Revision: D21217339

fbshipit-source-id: 7982a4d9a3f3549a470e543e0a14aac1c6dec5f0
2020-04-24 11:49:55 -07:00
Dan Melnic
1cbdf1cd0a Add quic client and server GRO support
Summary: Add quic client and server GRO support

Reviewed By: mjoras

Differential Revision: D20876123

fbshipit-source-id: d32f8ea8b6ede3df56465746166907b1e1754c57
2020-04-20 13:11:56 -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
a230720c3c Avoid throwing an exception on decoding Connection IDs
Summary: This can happen more often than we'd like, and there's no reason to force throwing the exception when we can instead validate the length first.

Reviewed By: udippant

Differential Revision: D20770869

fbshipit-source-id: 93e2349b02d6d2067f345b5fa9decee800c84ea6
2020-04-05 19:47:44 -07:00
Yang Chi
59a394e8f5 New Quic packet drop reason for the case TransportFactory refuses to create
Summary: as title

Reviewed By: mjoras

Differential Revision: D20629105

fbshipit-source-id: b156a03055dbe2c665aac51d924fd024ebf4e9b7
2020-03-31 00:04:43 -07:00
Yedidya Feldblum
ace2cc78a6 Unqualify uses of folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams
Summary: Unqualify nearly all uses of `folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams` since nearly all uses already have `OnDataAvailableParams` in scope.

Differential Revision: D20450063

fbshipit-source-id: c0fd49a7eace44a6edc8086762c44753224788dd
2020-03-16 02:57:30 -07:00
Dan Melnic
ba5ef797a5 Add UDP GRO support
Summary: Add UDP GRO support

Reviewed By: mjoras

Differential Revision: D20347326

fbshipit-source-id: be3c31f070c4f2c1ef84f9e2df60f49a5fcabd93
2020-03-13 10:12:22 -07:00
Yang Chi
9cea11f2bd QuicServerWorker rejects CID already present in CID Map
Summary:
The CID Algo can possibly generate a CID that's already in the map.
This diff adds a mechanism to reject such CID and try another one.
ServerStateMachine will loop encoding CIDs until either QuicServerWorker no
longer rejects, or encode fails

Reviewed By: udippant, vchynarov

Differential Revision: D20251043

fbshipit-source-id: a38e4e8b33007779a9710c32057d47f32f7d1774
2020-03-09 16:06:22 -07:00
Yang Chi
1b6810a828 Track bound QuicServerTransport with both raw pointers and weak_ptrs
Summary: For safety reason.

Reviewed By: mjoras

Differential Revision: D20041431

fbshipit-source-id: 6535afa25ab7ed80870912a6402ff21254dc9014
2020-03-04 17:07:29 -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
85117a7339 new quic stats callback for incoming client initials
Summary: as title

Reviewed By: lnicco

Differential Revision: D20104477

fbshipit-source-id: da43366447cfbd17d9e635f07c06b893e7138ea2
2020-02-25 19:02:59 -08:00
Viktor Chynarov
63899b41af QuicServerWorker error logging for duplicate CIDs
Summary:
The `QuicServerWorker` routing layer only retains mapping of a
single cid -> transport pair. However, in the case of two different
connections eventually having the same CID, both of those connections
will each believe they have that CID, while the routing layer
will only route to one of them.

When one connection is closed and the mappings are removed for all of its CIDs,
this MAY close the other connection inadvertently.

Reviewed By: yangchi

Differential Revision: D20046389

fbshipit-source-id: 2ab225725a4410d6665ee0a0536dc1f48c0c49ba
2020-02-25 12:20:32 -08:00
Luca Niccolini
39db4700c0 allow custom socket options
Summary: generic API for setting socket Options on both client and server

Reviewed By: yangchi

Differential Revision: D19763928

fbshipit-source-id: 7078eb8738aebc192bbace2498aaf9489526efff
2020-02-21 22:11:40 -08:00
Yang Chi
87e3e9f8af Replace deref parseCid result with explicit error checking
Summary: deref a folly::Expected can throw if it's an error

Reviewed By: mjoras

Differential Revision: D19977541

fbshipit-source-id: d8f841c1c685c91c4ebd7d3a2ceb4aa1110de06b
2020-02-19 15:54:12 -08:00
Yang Chi
5f51f4436f Exception-free Quic ConnIdAlgo
Summary: no more surprises in upper layer

Reviewed By: mjoras

Differential Revision: D19976510

fbshipit-source-id: 3487e9aa2cb28d7bc748f13bc2bbc393216b4a8a
2020-02-19 15:54:11 -08:00
Matt Joras
c1ec43136d Check if we can parse before parsing the DCID.
Summary: As in title.

Reviewed By: yangchi

Differential Revision: D19943642

fbshipit-source-id: f99699b3a7697970445ac1f9e0e15a916940d841
2020-02-17 21:07:35 -08:00
Yang Chi
65a6c9bfe2 Remove Sheding APIs from QuicServerTransport
Summary:
The current shedding APIs in the transport would accept a new
connection and then immediately close it. This will fail the request and waste server resources.

This diff
removes all the Shedding functions from transport and let upper layer handle
it.

Reviewed By: udippant

Differential Revision: D19729902

fbshipit-source-id: 6daab5902235b6daa8d059b51cc1229d1042f892
2020-02-05 17:29:17 -08:00
Udip Pant
21a7efb2e3 remove constraints of 4-bytes minimum len for connection-id
Summary:
New QUIC draft no longer has this limitation for connection-id, and allows
connid of len 0 -> 20.

This diff removes the constraints. I still kept the requirement for
*server-chosen* conn-id

Reviewed By: mjoras, lnicco

Differential Revision: D19507366

fbshipit-source-id: 4c73f45617f40b29d47d2d86b7598f6c95588d0a
2020-01-23 21:59:49 -08:00
Anton Frolov
1482011db5 Remove UNLIKELY and LIKELY calls from mvfst
Summary:
All instancesi of LIKELY and UNLIKELY probably should be removed. We will
add them back in if we see pathologies in performance profiles.

Reviewed By: mjoras

Differential Revision: D19163441

fbshipit-source-id: c4c2494d18ecfd28f00af1e68ecaf1e85c1a2e10
2020-01-06 17:44:07 -08:00
Yang Chi
332b3c340c Use original server cid chosen by client for source addr based routing
Summary:
Currently, before server generate the destination CID, we route packets with client's address, port and client's source connection ID. But now that client can use 0-len source connection ID, the different connections from the same client address and port will be routed to the same server connections.

This diff changes it to use client's initial destination connection ID as part of the routing key.

Reviewed By: udippant

Differential Revision: D19268354

fbshipit-source-id: 837f5bd2f1e3a74957afacf7aabad922b1719219
2020-01-06 08:58:12 -08:00
Udip Pant
ba79292fa9 reset existing (takeover) socket when rebinding to different address
Reviewed By: afrind

Differential Revision: D18925452

fbshipit-source-id: dc431cbf899eb8e21a18d421a640e4f0649743cb
2019-12-20 17:29:28 -08:00
Subodh Iyengar
d2fa2cbcd6 process multiple packets on recvmsg
Summary:
In the current client code we read one packet, go back to epoll, and then read
another packet. This is not very efficient.

This changes it so that we can read multiple packets in one go from an epoll
callback.

This only performs changes on the client

Reviewed By: mjoras

Differential Revision: D18797962

fbshipit-source-id: 81be82111064ade4fe3a07b1d9d3d01e180f29f5
2019-12-04 12:04:10 -08:00
Udip Pant
80b3a9f393 add more checks for internally forwarded data
Summary:
This adds checks for forwarded data on all the possible branches that lead to
forwarding of packets to another process

Reviewed By: mjoras

Differential Revision: D18416971

fbshipit-source-id: 22dc3fd63de615904a411f90164a138bf0ef56e0
2019-11-18 11:05:36 -08:00
Udip Pant
024bbbba29 retry few times if there's a conflict in takeover handler address
Reviewed By: sharma95

Differential Revision: D17403844

fbshipit-source-id: 3084335be30e2376a6888ba24e21aa63bb040e3e
2019-11-18 11:05:36 -08:00
Yang Chi
97cfde6af3 Remove Quic transport from source address map after usage of Cid data
Summary:
Before any CID is available, the source address routing
table might be the only owner of the transport. Removing the transport from
there deletes the transport. connectionIdData param is a const ref to a member
of the connection state owned by the transport. So deleting transport also
deletes this vector, which makes the const ref invalidated.

Reviewed By: vchynarov

Differential Revision: D18253200

fbshipit-source-id: 728b15d0872164ba6549a32e10a5a3611e808f27
2019-11-01 11:32:25 -07:00
Konstantin Tsoy
553352c2e5 Always create pacer timer on server worker start
Summary: Always create pacing timer on server worker start.

Reviewed By: yangchi

Differential Revision: D18231097

fbshipit-source-id: 598bf6f746f3b07020fa9336ebe33ba2283767e1
2019-10-31 11:19:17 -07:00
Viktor Chynarov
27536bc1e4 Delete all transport connIds from server connIdMap on unbound [3/3]
Summary:
This diff is the one that introduces+passes the test of multiple server conn
ids routing to a single transport.

Currently, there is still only one time in non-test code that more than one
server connection id is added. This diff ensures when we call connectionUnbound
we remove all associated connection ids.

Reviewed By: udippant

Differential Revision: D17479563

fbshipit-source-id: 8d0ebbf26251f7bef44cdea53dfd4ff93ab465ae
2019-10-09 08:25:07 -07:00