Skip to content

Commit ada5df4

Browse files
committed
uefi-test-runner: SNP: improve doc (what's going on)
1 parent 2b604a3 commit ada5df4

File tree

1 file changed

+9
-0
lines changed
  • uefi-test-runner/src/proto/network

1 file changed

+9
-0
lines changed

uefi-test-runner/src/proto/network/snp.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ fn find_network_device() -> Option<ScopedProtocol<SimpleNetwork>> {
4141
maybe_handle
4242
}
4343

44+
/// This test sends a simple UDP/IP packet to the `EchoService` (created by
45+
/// `cargo xtask run`) and receives its response.
4446
pub fn test() {
4547
// This test currently depends on the PXE test running first.
4648
if cfg!(not(feature = "pxe")) {
@@ -97,6 +99,12 @@ pub fn test() {
9799
)
98100
.expect("Failed to set receive filters");
99101

102+
// EthernetFrame(IPv4Packet(UDPPacket(Payload))).
103+
// The ethernet frame header will be filled by `transmit()`.
104+
// The UDP packet contains the byte sequence `4, 4, 3, 2, 1`.
105+
//
106+
// The packet is sent to the `EchoService` created by
107+
// `cargo xtask run`. It runs on UDP port 21572.
100108
let payload = b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
101109
\x45\x00\
102110
\x00\x21\
@@ -152,6 +160,7 @@ pub fn test() {
152160
.unwrap();
153161
}
154162

163+
// Check payload in UDP packet that was reversed by our EchoService.
155164
assert_eq!(buffer[42..47], [4, 4, 3, 2, 1]);
156165

157166
// Get stats

0 commit comments

Comments
 (0)