Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayush1325
Copy link
Contributor

  • Implement timeout support for read, write and connect.
  • A software implementation using Instant.

- Implement timeout support for read, write and connect.
- A software implementation using Instant.

Signed-off-by: Ayush Singh <[email protected]>
@rustbot
Copy link
Collaborator

rustbot commented Jul 7, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 7, 2025
@tgross35
Copy link
Contributor

tgross35 commented Jul 7, 2025

Cc @nicholasbishop for UEFI

@@ -167,6 +168,31 @@ impl Tcp4 {
}
}

unsafe fn wait_or_cancel(
Copy link
Contributor

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.


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 };
Copy link
Contributor

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants