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

feat(s2n-quic-dc): update MTU on dc path when MTU is updated #2327

Merged
merged 10 commits into from
Oct 10, 2024

Conversation

WesleyRosenblum
Copy link
Contributor

@WesleyRosenblum WesleyRosenblum commented Sep 21, 2024

Description of changes:

This change will update the MTU in the ApplicationParams on a dc Path when the MTU is updated as part of MTU probing.

Testing:

Added unit tests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


fn on_mtu_updated(&mut self, mtu: u16) {
let peers_guard = self.map.state.peers.guard();
if let Some(entry) = self.map.state.peers.get(&self.peer, &peers_guard) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this is right. If we detect a new MTU with a new handshake, this is updating a ~random path secret's MTU -- not the one associated with that handshake. IMO we should treat the ApplicationParams as immutable after insertion into the map as much as possible.

(In part, that's because it seems likely that we'll want to have a separate storage area for them and de-duplicate, since they're rather large, and this sort of thing will make that harder since the indirection/pointer then becomes mutable).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is updating a ~random path secret's MTU

it would be a random path secret, but its not a random path. The intention of this is to allow for higher MTUs even when there was some trouble confirming an MTU during the handshake. The MTU probing mechanism we have for the during the handshake is very conservative (to ensure the handshake can complete), if there is a single lost packet before the configured MTU can be confirmed, we drop down to the base MTU. This mechanism allows for us to continue with the more traditional MTU probing after we've already allowed the handshake to complete.

IMO we should treat the ApplicationParams as immutable after insertion into the map

would it be feasible/better to re-insert into the map then?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-inserting is going to be problematic too -- at least currently that would panic! since you're inserting a duplicate path secret ID.

I think we shoudl stick with this PR as-is, probably, but long-term we might want to have a separate(?) map for MTUs -- in particular I think we'd end up clamping to ~1200 byte MTUs or w/e for any in-progress handshakes, which feels a bit unfortunate. It feels true that we probably don't have any good testing in place for dynamically changing MTUs. OTOH, right now MTU is not yet used for anything I think, since it is only needed for dcQUIC streams over UDP, which aren't yet supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the MTU value to control TCP packet sizes, so there's a little less efficiency there. But we don't update MTUs mid-stream so only after the MTU probing is complete the flows would inherit the update.

@WesleyRosenblum WesleyRosenblum marked this pull request as ready for review October 1, 2024 16:22
dc/s2n-quic-dc/src/path/secret/map.rs Outdated Show resolved Hide resolved
self.map.state.rehandshake_period,
);
let entry = Arc::new(entry);
self.map.insert(entry);
}

fn on_mtu_updated(&mut self, mtu: u16) {
if let Some(entry) = self.map.state.peers.get_by_key(&self.peer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should store an Option<Arc<Entry>> on self for this... The way it is right now may have issues if we have some other handshake that are racing each other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd probably need that for #2314 too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly, though i haven't looked into that issue too much at this point

@WesleyRosenblum WesleyRosenblum merged commit 7752afb into main Oct 10, 2024
128 of 130 checks passed
@WesleyRosenblum WesleyRosenblum deleted the WesleyRosenblum/mtuupdate branch October 10, 2024 16:45
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

Successfully merging this pull request may close these issues.

3 participants