Skip to content

Conversation

@JayKickliter
Copy link
Contributor

@JayKickliter JayKickliter commented Oct 21, 2025

This is PR 2 of 2 adding TCP to uefi-rs, and is a replacement for #1779. Note that this PR contains the commits from #1797 and will need to rebased before merging.

TODO before merging

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@phip1611 phip1611 marked this pull request as draft October 22, 2025 05:05
@phip1611
Copy link
Member

typically we mark PRs as draft when they wait to be rebased onto another PR - so I marked this PR as draft.

Thanks for working on this and splitting this into multiple PRs!

@JayKickliter JayKickliter force-pushed the jsk/uefi/add-tcpv4 branch 4 times, most recently from ebf20de to dee28f7 Compare October 22, 2025 18:15
@JayKickliter JayKickliter force-pushed the jsk/uefi/add-tcpv4 branch 2 times, most recently from 05b5155 to f547536 Compare November 11, 2025 18:30

impl Tcp4 {
/// See [Tcp4Protocol::configure].
pub fn configure(&mut self, config: &ConfigData, options: Option<&ConfigOptions>) -> Result {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realize this fn duplicates a lot of Ip4Config2::ifup() . Should I just make Tcp4 take a NIC Handle that's already been configured like Http does?

Copy link
Member

@phip1611 phip1611 Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. in uefi, we prefer to hide lower-level details of UEFI from public API. Convenient high-level abstractions are very appreciated

@JayKickliter JayKickliter force-pushed the jsk/uefi/add-tcpv4 branch 4 times, most recently from 327b902 to 7d9befe Compare November 18, 2025 16:52
@phip1611
Copy link
Member

#1797 is merged, please rebase

@JayKickliter
Copy link
Contributor Author

@phip1611 I had to move on to a different task for a bit but I am not done with this PR. I plan on getting back to it soonish, but I can close it in the meantime if you prefer

@phip1611
Copy link
Member

phip1611 commented Dec 9, 2025

@phip1611 I had to move on to a different task for a bit but I am not done with this PR. I plan on getting back to it soonish, but I can close it in the meantime if you prefer

No worries. We can keep it open. As a rule of thumb, I'd like to close PRs that are inactive for 6 months. So you still have some time

@phip1611 phip1611 changed the title uefi: add high-level TCP wrapper [STALE] uefi: add high-level TCP wrapper Jan 25, 2026
@phip1611
Copy link
Member

hi @JayKickliter
any plans to continue the work here?

@JayKickliter
Copy link
Contributor Author

hi @JayKickliter

any plans to continue the work here?

Absolutely. We're using this in production. I'll prioritize

@JayKickliter JayKickliter marked this pull request as ready for review January 30, 2026 01:04
@JayKickliter JayKickliter marked this pull request as draft January 30, 2026 01:06
@JayKickliter JayKickliter marked this pull request as ready for review January 30, 2026 01:16
@JayKickliter
Copy link
Contributor Author

I marked this PR ready for review

@phip1611 phip1611 changed the title [STALE] uefi: add high-level TCP wrapper uefi: add high-level TCP wrapper Jan 30, 2026
Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! You said you are using this in production? That's great!

Left a few remarks:

  • Please streamline function documentation. There are other parts in the code that use that pattern already
  • please list the error codes that can happen for each function (as listed in the UEFI spec)

I'd love if you have the capacity to add an integration test, but that could also be a follow-up.

/// boot, print, println,
/// proto::network::tcp4::{AccessPoint, ConfigData, Tcp4,
/// Tcp4ServiceBinding,
/// },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks broken?

Suggested change
/// },

unsafe { (self.0.configure)(self.this(), ptr::from_ref(&tcpv4_config_data) as *mut _) }
.to_result();
// Maximum timeout of 10 seconds.
for _ in 0..9 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for _ in 0..9 {
for _ in 0..10 {

or

Suggested change
for _ in 0..9 {
for _ in 0..=9 {

or

Suggested change
for _ in 0..9 {
// Maximum timeout of 9 seconds.

I prefer (A)

Ok(())
}

/// See [Tcp4Protocol::transmit].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// See [Tcp4Protocol::transmit].
/// See [`Tcp4Protocol::transmit`].

also same as above, please follow our documentation template

pub struct Tcp4(pub Tcp4Protocol);

impl Tcp4 {
/// See [Tcp4Protocol::configure].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// See [Tcp4Protocol::configure].
/// <high-level description in one sentence>
///
/// <if helpful, additional comments>
///
///
/// See [`Tcp4Protocol::configure`] for more details.
///
/// # Arguments
///
/// - `config`: the [`ConfigData`] to apply <if needed more explanation>
/// - `options`: the optional [`ConfigOptions`] <if needed more explanation>
///
/// # Errors
///
/// - [`Status::INVALID_PARAMETER`]: if ....
/// - <the other error status codes that can be returned here>

res
}

/// See [`Tcp4Protocol::connect`].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adapt this to the style I've mentioned above.

We are not 100% consistent with this yet in the code base unfortunately, but new code should follow that pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy, thanks for the review

Ok(rx_data_len)
}

/// Receives data from the remote connection. On success, returns
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

/// Receives data from the remote connection. On success, returns
/// the number of bytes read.
///
/// See [Tcp4Protocol::receive].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// See [Tcp4Protocol::receive].
/// See [`Tcp4Protocol::receive`].

self.receive_vectored(&[buf])
}

/// Receives the exact number of bytes required to fill `buf`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

pub struct Tcp4ServiceBinding(ServiceBindingProtocol);

impl Tcp4ServiceBinding {
/// Create TCPv4 Protocol Handle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, please follow our doc template

}
}

/// Destroy TCPv4 Protocol Handle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, please follow our doc template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants