-
-
Notifications
You must be signed in to change notification settings - Fork 170
uefi: SNP transmit: document parameters #1664
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
phip1611
wants to merge
1
commit into
main
Choose a base branch
from
snp-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,13 +186,36 @@ impl SimpleNetwork { | |
status.to_result_with_val(|| NonNull::new(tx_buf.cast())) | ||
} | ||
|
||
/// Place a packet in the transmit queue of a network interface. | ||
/// Place a packet in the transmit queue of the network interface. | ||
/// | ||
/// The packet structure depends on the type of network interface, but | ||
/// effectively this is always a (wired) ethernet interface. In these cases, | ||
/// this function transmits ethernet frames. | ||
/// | ||
/// The header of the packet can be filled by the function with the given | ||
/// parameters, but the buffer must already reserve the space for the | ||
/// header. | ||
/// | ||
/// # Arguments | ||
/// - `header_size`: The size in bytes of the media header to be filled by | ||
/// the `transmit()` function. If this is `0`, the (ethernet frame) header | ||
/// will not be filled by the function and taken as-is from the buffer. | ||
/// If it is nonzero, then it must be equal to `media_header_size` of | ||
/// the corresponding [`NetworkMode`] and the `dst_addr` and `protocol` | ||
/// parameters must not be `None`. | ||
/// - `buffer`: The buffer containing the whole network packet with all | ||
/// its payload including the header for the medium. | ||
/// - `src_addr`: The optional source address. | ||
/// - `dst_addr`: The optional destination address. | ||
/// - `protocol`: Ether Type as of RFC 3232. See | ||
/// <https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: For nicer rendering, how about changing to a named link like |
||
/// for examples. Typically, this is `0x0800` (IPv4) or `0x0806` (ARP). | ||
pub fn transmit( | ||
&self, | ||
header_size: usize, | ||
buffer: &[u8], | ||
src_addr: Option<MacAddress>, | ||
dest_addr: Option<MacAddress>, | ||
dst_addr: Option<MacAddress>, | ||
protocol: Option<u16>, | ||
) -> Result { | ||
unsafe { | ||
|
@@ -202,7 +225,7 @@ impl SimpleNetwork { | |
buffer.len(), | ||
buffer.as_ptr().cast(), | ||
src_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()), | ||
dest_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()), | ||
dst_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()), | ||
protocol.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()), | ||
) | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there some citation we can point to for this paragraph? In particular, is true that it's always wired? (I wouldn't be terribly surprised if some enterprising motherboard manufacturers supported wifi netboot, for example.)
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 my understanding, WiFis packet structure makes effective use incompatible with the SNP interface.
Therefore, we have
EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
. Would you prefer it if I rephrase it as "in most cases, this refers to an Ethernet interface"?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 didn't know that a wifi interface would be incompatible. "in most cases, this refers to an Ethernet interface" sounds good to me