-
Notifications
You must be signed in to change notification settings - Fork 414
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
MTU is ignored for new Device #383
Comments
I think this is a bug, yes. When sending packets, only the remote Win and MSS is taken into account. I think it should also take into account our own MTU, to not send packets larger than that. Should be easy to fix. Line 1561 in 1268fb3
|
@Dirbaio is correct. |
Thank you very much for the fast help and the fast fix! I am fairly new to open-source development and unsure about this. Once again. Thank you! And one further question:
|
Go ahead with the PR :)
Not sure what you mean. |
Also correct. Arguably the most important design principle of smoltcp is "only safe Rust in core code". That's not the only way to do a network stack (indeed it would be perfectly reasonable to have a network stack not abiding by this principle), but it is the way smoltcp works, chiefly because it was written as a response to inexplicable lwip-related memory corruption issues. And I don't believe there is any way to do this without unsafe code. |
Thank you both again for the quick reply. I can perfectly use these arguments in my thesis. Pull Request is made. |
You can set a timeut with |
Fixed by #384. |
Hello everybody,
I am having an issue, where it seems as if smoltcp is ignoring the provided MTU (provided by a Virtio device). The reason why this is important is, that I want to measure the performance of my driver, for small packets and for different MTU's.
Allthough I think the inability to send small packets is due to the current implementation of the kernel, as it seems as if it is not possible to set the "no_dealy" option, of rust's std::net::stream.
Short overview of the context of the problem:
I am working on a rust based unikernel, who uses smoltcp as its network stack in user-space. Smoltcp communicates via some syscalls, with a kernel based virtio network driver.
When I now set the MTU of the smoltcp device to a given value, it seems to be ignored. I only assume this, as the buffers, smoltcp requests for sending always follow the slow start pattern of TCP until they reach their maximum size of 1514 bytes, regardless which MTU is set in the smoltcp device.
Is this the expected behaviour? I wondered if I am not understanding the protocol correctly or something else?
I also digged through the smoltcp code-base, up to the point, where the ethernet interface dispatches. Here it seems as if the interface is checking with the device's MTU. I also read something about a hack (Something with differnces in buffer size and window size) needed because of the working of the TCP protocol.
I appreciate any help on the topic.
The smoltcp device is implemented as follows:
During init of the device, the MTU is evaluated by a syscal, which my driver will answer with the MTU set by Virtio device. I checked, and this call returns the value I assigned to the virtio device.
Thank you for your help!
Resources
Kernel: https://github.com/hermitcore
Device in Kernel: https://github.com/hermitcore/rusty-hermit/blob/master/hermit-sys/src/net/device.rs
Implementation of rust's network interface: https://github.com/rust-lang/rust/blob/master/library/std/src/sys/hermit/net.rs
Edited:
I updated the comment, as I noticed I missed providing resources and the problem of small packets not being used.
The text was updated successfully, but these errors were encountered: