Skip to content

Commit ae2e17e

Browse files
committed
uefi: SNP transmit: document parameters
1 parent 262bc0b commit ae2e17e

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

uefi/src/proto/network/snp.rs

+26-3
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,36 @@ impl SimpleNetwork {
186186
status.to_result_with_val(|| NonNull::new(tx_buf.cast()))
187187
}
188188

189-
/// Place a packet in the transmit queue of a network interface.
189+
/// Place a packet in the transmit queue of the network interface.
190+
///
191+
/// The packet structure depends on the type of network interface, but
192+
/// effectively this is always a (wired) ethernet interface. In these cases,
193+
/// this function transmits ethernet frames.
194+
///
195+
/// The header of the packet can be filled by the function with the given
196+
/// parameters, but the buffer must already reserve the space for the
197+
/// header.
198+
///
199+
/// # Arguments
200+
/// - `header_size`: The size in bytes of the media header to be filled by
201+
/// the `transmit()` function. If this is `0`, the (ethernet frame) header
202+
/// will not be filled by the function and taken as-is from the buffer.
203+
/// If it is nonzero, then it must be equal to `media_header_size` of
204+
/// the corresponding [`NetworkMode`] and the `dst_addr` and `protocol`
205+
/// parameters must not be `None`.
206+
/// - `buffer`: The buffer containing the whole network packet with all
207+
/// its payload including the header for the medium.
208+
/// - `src_addr`: The optional source address.
209+
/// - `dst_addr`: The optional destination address.
210+
/// - `protocol`: Ether Type as of RFC 3232. See
211+
/// <https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1>
212+
/// for examples. Typically, this is `0x0800` (IPv4) or `0x0806` (ARP).
190213
pub fn transmit(
191214
&self,
192215
header_size: usize,
193216
buffer: &[u8],
194217
src_addr: Option<MacAddress>,
195-
dest_addr: Option<MacAddress>,
218+
dst_addr: Option<MacAddress>,
196219
protocol: Option<u16>,
197220
) -> Result {
198221
unsafe {
@@ -202,7 +225,7 @@ impl SimpleNetwork {
202225
buffer.len(),
203226
buffer.as_ptr().cast(),
204227
src_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()),
205-
dest_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()),
228+
dst_addr.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()),
206229
protocol.as_ref().map(ptr::from_ref).unwrap_or(ptr::null()),
207230
)
208231
}

0 commit comments

Comments
 (0)