Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore multi-packet I/O #1693

Open
1 of 7 tasks
mxinden opened this issue Feb 28, 2024 · 0 comments
Open
1 of 7 tasks

Explore multi-packet I/O #1693

mxinden opened this issue Feb 28, 2024 · 0 comments

Comments

@mxinden
Copy link
Collaborator

mxinden commented Feb 28, 2024

Summary

Explore multi-packet at (a) the I/O layer (sendmmsg, recvmmsg, GSO, GRO) and (b) within the Neqo state machines.

Very early draft

Have a fixed sized send and fixed sized receive buffer.

write: [Box<[u8; MAX_MTU * MAX_GSO_SEGMENTS]>; MAX_SENDMMSG_BATCH_SIZE],
read: [Box<[u8; MAX_MTU * MAX_GRO_SEGMENTS]>; MAX_RECVMMSG_BATCH_SIZE],
  • can be used across multiple connections, e.g. one pair per process
  • would this be too much per Firefox tab?

Have fn process take a set of input Datagram's and a set of to-be-written-to output Datagrams.

fn process<'a>(&mut self, input: impl Iterator<Item = &'a Datagram>, output: impl Iterator<Item = &'a mut Datagram>, now: Instant) -> Option<Duration>
  • process datagrams in batches
  • input Datagrams are a view into the read buffer and output Datagrams are a view into the write buffer thus no allocation
  • we can as well wrap the iterators in separate types, offering stricter access methods to prevent misuse

Have Socket::send and Socket::recv take write and read buffer respectively.

Have Datagram carry a segment_size (taken from quinn-udp).

  #[derive(Clone, PartialEq, Eq)]
  pub struct Datagram {
      src: SocketAddr,
      dst: SocketAddr,
      tos: IpTos,
      ttl: Option<u8>,
      d: Vec<u8>,
+     /// The segment size if this transmission contains multiple datagrams.
+     /// This is `None` if the [`Datagram`] only contains a single datagram
+     segment_size: Option<usize>,
  }
  • a single process call can write one or more (same size) datagrams for a single destination into a single Datagram

Next steps

Past discussions

mxinden added a commit to mxinden/neqo that referenced this issue May 13, 2024
`neqo-bin` has been importing `quinn-udp` as a git reference, in order to
include quinn-rs/quinn#1765. The quinn project has since
released `quinn-udp` `v0.5.0`.

This commit upgrades `neqo-bin` to use `quinn-udp` `v0.5.0`.

`quinn-udp` has dropped `sendmmsg` support in the `v0.5.0`
release (quinn-rs/quinn@ee08826).
`neqo-bin` does not (yet) use `sendmmsg`. This might change in the
future (mozilla#1693).
mxinden added a commit to mxinden/neqo that referenced this issue May 13, 2024
`neqo-bin` has been importing `quinn-udp` as a git reference, in order to
include quinn-rs/quinn#1765. The quinn project has since
released `quinn-udp` `v0.5.0`.

This commit upgrades `neqo-bin` to use `quinn-udp` `v0.5.0`.

`quinn-udp` now takes a data reference (`&[u8]`) instead of owned
data (`bytes::Bytes`) on its send path, thus no longer requiring `neqo-bin` to
convert, but simply pass a reference. See
quinn-rs/quinn#1729 (comment) for details.

`quinn-udp` has dropped `sendmmsg` support in the `v0.5.0`
release (quinn-rs/quinn@ee08826).
`neqo-bin` does not (yet) use `sendmmsg`. This might change in the
future (mozilla#1693).
github-merge-queue bot pushed a commit that referenced this issue May 13, 2024
* feat(bin): use quinn-udp crates.io release instead of git ref

`neqo-bin` has been importing `quinn-udp` as a git reference, in order to
include quinn-rs/quinn#1765. The quinn project has since
released `quinn-udp` `v0.5.0`.

This commit upgrades `neqo-bin` to use `quinn-udp` `v0.5.0`.

`quinn-udp` now takes a data reference (`&[u8]`) instead of owned
data (`bytes::Bytes`) on its send path, thus no longer requiring `neqo-bin` to
convert, but simply pass a reference. See
quinn-rs/quinn#1729 (comment) for details.

`quinn-udp` has dropped `sendmmsg` support in the `v0.5.0`
release (quinn-rs/quinn@ee08826).
`neqo-bin` does not (yet) use `sendmmsg`. This might change in the
future (#1693).

* remove impl From<Datagram> for Vec<u8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant