Commit Graph

3653 Commits

Author SHA1 Message Date
Dirkjan Ochtman a11abc648e quinn-proto: inline single-use flow_blocked() method 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman cc1218ed12 quinn-proto: inline single-use poll_unblocked() method 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 29e8a914d8 quinn-proto: standardize on ch suffix 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 5a7b888934 quinn-proto: extract separate RecvStream interface type 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 0b350e5d11 quinn-proto: extract separate SendStream interface type 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 8131bcc7b6 quinn-proto: split streams module into two parts 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman d4bfc25d6a quinn-proto: move API logic into Streams 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 8bbe908dbd quinn-proto: add public Streams interface 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 584b889494 quinn-proto: rename Streams to StreamsState 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman dde27bf919 quinn-proto: refactor handling of peer parameters 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 1b9293366f quinn-proto: inline single-use congestion_blocked() method 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 5a7a80ec1e quinn-proto: move probe queueing logic into PacketSpace 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman d22800ac79 quinn-proto: move more methods into PacketBuilder 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 7e0f3fa7ab quinn-proto: move finish_packet() into PacketBuilder 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman e1df56f40c quinn-proto: move PacketBuilder into a separate module 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 6bddfdea1a quinn-proto: handle handshake packets separately 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 816e570151 quinn-proto: inline single-use reject_0rtt() method 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 18ed973568 quinn-proto: refactor how ACKs are passed to the congestion controller 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 4e6b8c6fe4 quinn-proto: add comment to clarify need for custom iteration 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman c4af9ecb1c fuzz: change config syntax to allow merging 2021-03-01 13:06:10 -08:00
Matthias Einwag 0020e1ee39 Add a Bytes array based send interface to quinn-proto
This change modifies quinn-proto to allow callers to submit a list
of one or more owned `Bytes` chunks for transmission instead of
pure byte slices. This will provide a more efficient zero-copy
interface for applications which already make use of owned
`Bytes` buffers.

The internals of quinn-proto have been refactored in order to keep
the ability to pass `&[u8]` buffers and defer the conversion into
`Bytes` as long as possible, in order to avoid unnecessary allocations
if no data can be stored due to flow control.
2021-03-01 09:20:20 +01:00
Matthias Einwag eb1911d416 Write Bytes into SendBuffer
This changes the interface from SendBuffer to directly accept owned
`Bytes` buffers, instead of converting to them.
2021-03-01 09:20:20 +01:00
Benjamin Saunders a9aaf40943 Implement perf protocol for standardized benchmarking 2021-02-28 22:31:43 +01:00
Dirkjan Ochtman 14db88562d quinn: split streams module in send/recv parts 2021-02-25 12:06:38 -08:00
Dirkjan Ochtman 24cf82ef83 Expose iterator-like read API 2021-02-25 12:06:38 -08:00
Dirkjan Ochtman dd23094007 quinn-proto: remove unnecessary RecvState::Closed 2021-02-25 12:06:38 -08:00
Benjamin Saunders 241cc9cad1 Fix premature abandoment of STOP_SENDING transmission 2021-02-25 16:02:00 +01:00
Benjamin Saunders dd67e91425 Fix state leak for receive streams stopped after being finished 2021-02-25 16:02:00 +01:00
Benjamin Saunders 589534ff4e Tweak method name to avoid confusion with having received FIN 2021-02-25 16:02:00 +01:00
Joshua Koo b54e363cff Fixed typo allow_wpin -> allow_spin 2021-02-25 05:13:00 +01:00
Matthias Einwag be27d52134 Do not send any packets after a close frame
Since the loop was not exited after a close frame was transmitted,
other data in the same space could have been transmitted after
the frame. This adds a `break` to fix this.
2021-02-24 21:04:30 +01:00
Matthias Einwag 8e7c970e83 Make TestEndpoint GSO compatible
The TestEndpoint so far tried to send a single big datagram instead of using
proper GSO sending to emit multiple datagrams.

In order to avoid relying on platform GSO support, this change will simply
split up GSO transmissions into multiple Transmits in the endpoint.
2021-02-24 09:27:57 +01:00
Benjamin Saunders 2adc1bc3cc Remove unnecessary send stream state 2021-02-24 07:09:51 +01:00
Benjamin Saunders c2467fa61d Apply client initial padding consistently
Fixes unconditional padding of close packets
2021-02-24 07:08:26 +01:00
Benjamin Saunders 4d3a57cfaf Fix regression in application of padding to congestion control
These was broken in 095f402a9f, and
rendered needlessly complex by
f1628f87a2 before it.
2021-02-24 07:08:26 +01:00
Benjamin Saunders 799b5bb2b4 Fix mangled error Display impls
These were formatting the literal integer 0 instead of the inner data.
2021-02-24 07:08:26 +01:00
Benjamin Saunders 05ace6a111 Padding application style tweak
Deduplicates some logic and adds a sanity-check.
2021-02-24 07:08:26 +01:00
Timon ad16714b35 Networking Introduction Book Chapter (#917) 2021-02-23 09:52:40 +01:00
Timon 1a62da82a0 Quinn Introduction Chapter, Data transfer (#922) 2021-02-23 09:51:23 +01:00
Benjamin Saunders 696d511ca9 Fix possible handshake deadlock on loss of first server flight 2021-02-23 07:05:29 +01:00
Benjamin Saunders 7217d428d4 Remove redundant anti-amplification check
We check this during the packet encoding loop below.
2021-02-23 07:05:29 +01:00
Benjamin Saunders 633e5a6c81 Formatting tweak 2021-02-22 20:24:50 +01:00
Benjamin Saunders e6e1019725 String panic messages
These can be more reliably displayed in useful ways.
2021-02-22 20:24:50 +01:00
Benjamin Saunders ef91537e73 Remove dead state 2021-02-22 20:24:50 +01:00
Benjamin Saunders 0968a34ac0 Remove dead stream state
We immediately dispose send streams when their reset is ACKed, so we
don't need to represent this explicitly.
2021-02-22 20:24:50 +01:00
Dirkjan Ochtman 095f402a9f quinn-proto: inline single-use method 2021-02-22 10:44:51 -08:00
Dirkjan Ochtman 8630946571 quinn-proto: return early from finish_and_track_packet() 2021-02-22 10:44:51 -08:00
Dirkjan Ochtman 34f910bae6 quinn-proto: unpack logic for Connection::space_can_send() 2021-02-22 10:44:51 -08:00
Matthias Einwag f830910ea2 Generic Send Offload (GSO) Support
This change implements an initial version of GSO support [1][2][3]
for Linux, which improves the effiency of sending data.

The approach taken in this change is to create a buffer which contains
multiple datagrams in `Connection::poll_transmit`. This was picked
over trying to merge packets in the endpoint task, since packets
seem to need to be padded to a common segment size in order to
make them sendable via GSO.

In order to to this in an efficient fashion, the `poll_transmit`
method was restructred. Instead of selecting spaces upfront, it
will now loop through all possible packet spaces, check if there is
pending data to send and create packets and datagrams out of this.

The last packet which was written to a datagram buffer is not
finalized until it is clear whether follow-up packets need to be
written, since we need to know whether this packet should get padded
to MTU length or not.

This change doesn't enable GSO yet, since it will only produce a
single datagram. I will create a separate change for this.

Performance measurements:

**No GSO:**

```
Sent 1073741824 bytes on 1 streams in 4.31s (237.66 MiB/s)
```

**With GSO (up to 8 packets):**

```
Sent 1073741824 bytes on 1 streams in 3.02s (339.18 MiB/s)
```

[1] http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf
[2] http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-presentation-20181104.pdf
[3] https://lwn.net/Articles/752956/
2021-02-22 13:24:38 +01:00
Matthias Einwag f1628f87a2 Change padding logic
This change defers padding packets as a runtime decision
while the packet is populated.

For individual packets, we store in `SentFrames` whether a padding is
required. If padding is required a `min_datagram_size` variable is
increased, which will later on assure that only the last packet in a
datagram gets padded.
2021-02-22 13:24:38 +01:00