-
Notifications
You must be signed in to change notification settings - Fork 13.5k
std: sys: net: uefi: tcp4: Add timeout support #143568
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
Conversation
Ayush1325
commented
Jul 7, 2025
- Implement timeout support for read, write and connect.
- A software implementation using Instant.
Cc @nicholasbishop for UEFI |
@@ -167,6 +168,31 @@ impl Tcp4 { | |||
} | |||
} | |||
|
|||
unsafe fn wait_or_cancel( |
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.
Here and on cancel
, a docstring that includes the # Safety
requirements would be good to add.
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.
Added
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.
Could you fill in the rest of the docstring (say what behavior is, not just the safety req).
nit: I don't think it's a safety requirement that the token come from connect/accept/transmit/receive, just a logical requirement. The spec says EFI_NOT_FOUND
is returned is the token is unknown, so the safety requirement is probably just that the token pointer is valid.
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.
Added
|
||
unsafe fn cancel(&self, event: r_efi::efi::Event) -> io::Result<()> { | ||
let protocol = self.protocol.as_ptr(); | ||
let mut completion_token = tcp4::CompletionToken { event, status: Status::SUCCESS }; |
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.
From https://uefi.org/specs/UEFI/2.11/28_Network_Protocols_TCP_IP_and_Configuration.html#efi-ip4-protocol-cancel: "Pointer to a token that has been issued by EFI_IP4_PROTOCOL.Transmit() or EFI_IP4_PROTOCOL.Receive()". I read that to mean that the completion_token
arg should be a pointer to the one created in the read
and write
methods above, not a new one.
(Also, if read literally it would seem like that means cancel can only be used for canceling receive/transmit, not connect. However, the edk2 implementation at least does not seem to have that restriction.)
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.
Fixed. Now passing the completion token.
For connect, you are looking at wrong protocol. The correct one is here: https://uefi.org/specs/UEFI/2.11/28_Network_Protocols_TCP_IP_and_Configuration.html#efi-tcp4-protocol-cancel
60cc9d7
to
298e2f7
Compare
- Implement timeout support for read, write and connect. - A software implementation using Instant. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
298e2f7
to
d8273d3
Compare
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.
UEFI lgtm
ping @tgross35 |
@bors r+ |
…oss35 std: sys: net: uefi: tcp4: Add timeout support - Implement timeout support for read, write and connect. - A software implementation using Instant.
Rollup of 7 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143301 (`tests/ui`: A New Order [26/N]) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143301 (`tests/ui`: A New Order [26/N]) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143611 (Mention more APIs in `ParseIntError` docs) - #143661 (chore: Improve how the other suggestions message gets rendered) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143611 (Mention more APIs in `ParseIntError` docs) - #143661 (chore: Improve how the other suggestions message gets rendered) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143611 (Mention more APIs in `ParseIntError` docs) - #143661 (chore: Improve how the other suggestions message gets rendered) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup try-job: i686-gnu-nopt-1 try-job: test-various
Rollup of 8 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143611 (Mention more APIs in `ParseIntError` docs) - #143661 (chore: Improve how the other suggestions message gets rendered) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup try-job: i686-gnu-nopt-1 try-job: test-various
Rollup of 8 pull requests Successful merges: - #142391 (rust: library: Add `setsid` method to `CommandExt` trait) - #143302 (`tests/ui`: A New Order [27/N]) - #143303 (`tests/ui`: A New Order [28/28] FINAL PART) - #143568 (std: sys: net: uefi: tcp4: Add timeout support) - #143611 (Mention more APIs in `ParseIntError` docs) - #143661 (chore: Improve how the other suggestions message gets rendered) - #143708 (fix: Include frontmatter in -Zunpretty output ) - #143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup try-job: i686-gnu-nopt-1 try-job: test-various
Rollup merge of #143568 - Ayush1325:uefi-tcp4-timeout, r=tgross35 std: sys: net: uefi: tcp4: Add timeout support - Implement timeout support for read, write and connect. - A software implementation using Instant.