Skip to content

Commit 05542af

Browse files
committed
uefi: SNP transmit: demystify parameters
1 parent 5440cc2 commit 05542af

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

uefi/src/proto/network/snp.rs

+20-3
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,30 @@ impl SimpleNetwork {
213213
status.to_result_with_val(|| NonNull::new(tx_buf.cast()))
214214
}
215215

216-
/// Place a packet in the transmit queue of a network interface.
216+
/// Place a packet in the transmit queue of the network interface.
217+
///
218+
/// This depends on the type of network interface. Typically, this takes
219+
/// ethernet frames and send them over the ethernet network interface.
220+
///
221+
/// The header of the packet is filled by the function with the given
222+
/// parameters, but the buffer must contain the space for this header.
223+
///
224+
/// # Arguments
225+
/// - `header_size`: The size in bytes of the media header to be filled by
226+
/// the transmit() function.
227+
/// - `buffer`: The buffer containing the whole network packet with all
228+
/// its payload including the header for the medium.
229+
/// - `src_addr`: The optional source address.
230+
/// - `dst_addr`: The optional destination address.
231+
/// - `protocol`: Ether Type as of RFC 3232. See
232+
/// https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1
233+
/// for examples. Typically, this is `0x0800` (IPv4).
217234
pub fn transmit(
218235
&self,
219236
header_size: usize,
220237
buffer: &[u8],
221238
src_addr: Option<MacAddress>,
222-
dest_addr: Option<MacAddress>,
239+
dst_addr: Option<MacAddress>,
223240
protocol: Option<u16>,
224241
) -> Result {
225242
(self.transmit)(
@@ -228,7 +245,7 @@ impl SimpleNetwork {
228245
buffer.len(),
229246
buffer.as_ptr().cast(),
230247
src_addr.as_ref(),
231-
dest_addr.as_ref(),
248+
dst_addr.as_ref(),
232249
protocol.as_ref(),
233250
)
234251
.to_result()

0 commit comments

Comments
 (0)