Skip to content

Commit fe84413

Browse files
committed
uefi-test-runner: SNP: improve doc (what's going on)
1 parent 0512dc3 commit fe84413

File tree

1 file changed

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

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
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")) {
@@ -74,7 +76,6 @@ pub fn test() {
7476
.start()
7577
.expect("Failed to start Simple Network");
7678

77-
// Check initialize
7879
simple_network
7980
.initialize(0, 0)
8081
.expect("Failed to initialize Simple Network");
@@ -97,6 +98,12 @@ pub fn test() {
9798
)
9899
.expect("Failed to set receive filters");
99100

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

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

157165
// Get stats

0 commit comments

Comments
 (0)