-
Notifications
You must be signed in to change notification settings - Fork 447
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
Fault-free packet ingress #483
Conversation
Maybe we can change
fn consume<F>(self, timestamp: Instant, f: F)
where F: FnOnce(&mut [u8]); The current Device trait can "fail" in 2 places:
Looking at impls in the field:
So yeah, simplifying the trait would ensure consistency among impls on this. |
What about some implementation using an external network stack in raw mode (e.g. W5500)? What if a From what I understand, the That being said, what would we expect the corrective action is if the token consumption fails? In this implementation, we log and silently ignore the failure. In the current implementation, the error gets bubbled up the network stack (albeit, the error is a I don't have any problem with implementation an interface that requires an infallible PHY API, it's just something we should consciously decide here. |
In any case, I think we should consider changing the PHY API in a different PR. That ends up touching a lot of other code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to split in multiple PRs, this change is already useful indivifually. Thank you! :)
Well, the docs can be certainly improved on this. The way I see it (or the way I think it should work) is:
For receive, yes. For transmit there's one slight difference: TcpSocket knows the transmit has failed, so it skips updating internal state. This makes it so it'll immediately try to transmit the same packet again next time, instead of having to wait for timeout. However if drivers only return TxToken when transmit is guaranteed to succeed, this is no longer an issue. tldr: IMO drivers should only return tokens when rx/tx is guaranteed to succeed, so consume should be infallible. |
This PR addresses portions of #281 by implementing fail-free packet ingression. In this model, all available RX tokens are ingressed in a fail-free manner. Any failures are logged to the debug interface.
Open questions: