-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std: sys: net: uefi: Implement TCP4 connect #139254
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
base: master
Are you sure you want to change the base?
Conversation
Ayush1325
commented
Apr 2, 2025
- Implement TCP4 connect using EFI_TCP4_PROTOCOL.
- Tested on QEMU setup with connecting to TCP server on host.
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
c00e658
to
0f3036c
Compare
@rustbot label +O-UEFI |
efi::EVT_NOTIFY_SIGNAL, | ||
efi::TPL_CALLBACK, | ||
Some(toggle_atomic_flag), | ||
Some(unsafe { NonNull::new_unchecked(self.flag.as_ptr().cast()) }), |
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.
That makes wait_for_flag
unsound – there is no guarantee that the structure will not be moved in the time between the calls, which would invalidate this pointer.
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.
Should I use Condvar then? Or is there a way to have Atomic on Heap or something?
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.
I'd remove the flag, make the notification function a no-op and use CheckEvent
on the event.
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.
The event is of type Signal. The CheckEvent doc states the following
If Event is of type EVT_NOTIFY_SIGNAL, then EFI_INVALID_PARAMETER is returned.
The reason the event is of type Signal is because the tcp4 protocol connect doc states the following
The Event to signal after request is finished and Status field is updated by the EFI TCPv4 Protocol driver. The
type of Event must be EVT_NOTIFY_SIGNAL, and its Task Priority Level (TPL) must be lower than or equal to TPL_CALLBACK.
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.
Ah, I missed that. Then the easiest way is probably just to ensure that the flag outlives the event. Why not just inline wait_for_flag
and make flag
a local variable? Alternatively, make create_evt
unsafe
.
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.
Ah, I missed that. Then the easiest way is probably just to ensure that the flag outlives the event. Why not just inline
wait_for_flag
and makeflag
a local variable? Alternatively, makecreate_evt
unsafe
.
I would prefer not to inline wait_for_flag
since that will be repeated in almost all other implementations soon enough (read, write, close, etc). I have made create_evt
unsafe. Is that ok?
- Implement TCP4 connect using EFI_TCP4_PROTOCOL. - Tested on QEMU setup with connecting to TCP server on host. Signed-off-by: Ayush Singh <[email protected]>
0f3036c
to
a1e459d
Compare
r? joboet |