aboutsummaryrefslogtreecommitdiff
path: root/embassy-net/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-01-10 14:06:15 +0100
committerDario Nieuwenhuis <[email protected]>2024-01-10 14:06:15 +0100
commit01b0af5a84409a13264d799a8156bb965ad7989f (patch)
treebe6018abc7ac2924bf4793a6e49d016110ac4280 /embassy-net/src
parent0027a76bb61f19fcae1fe588ba3ff62660d7f7e3 (diff)
net: add packet-trace feature.
Diffstat (limited to 'embassy-net/src')
-rw-r--r--embassy-net/src/device.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/embassy-net/src/device.rs b/embassy-net/src/device.rs
index 54a0c47e8..3b1d3c47c 100644
--- a/embassy-net/src/device.rs
+++ b/embassy-net/src/device.rs
@@ -76,7 +76,11 @@ where
76 where 76 where
77 F: FnOnce(&mut [u8]) -> R, 77 F: FnOnce(&mut [u8]) -> R,
78 { 78 {
79 self.0.consume(|buf| f(buf)) 79 self.0.consume(|buf| {
80 #[cfg(feature = "packet-trace")]
81 trace!("rx: {:?}", buf);
82 f(buf)
83 })
80 } 84 }
81} 85}
82 86
@@ -92,6 +96,11 @@ where
92 where 96 where
93 F: FnOnce(&mut [u8]) -> R, 97 F: FnOnce(&mut [u8]) -> R,
94 { 98 {
95 self.0.consume(len, |buf| f(buf)) 99 self.0.consume(len, |buf| {
100 let r = f(buf);
101 #[cfg(feature = "packet-trace")]
102 trace!("tx: {:?}", buf);
103 r
104 })
96 } 105 }
97} 106}