-
-
Notifications
You must be signed in to change notification settings - Fork 24
rx.parse_abort: count the abandoned-aggregate RX loss on every generation #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #ifndef DEVOURER_RX_PARSE_ABORT_H | ||
| #define DEVOURER_RX_PARSE_ABORT_H | ||
|
|
||
| /* rx.parse_abort — the RX descriptor walk hit a malformed/truncated | ||
| * descriptor mid-aggregate and abandoned the rest of the bulk-IN buffer. | ||
| * Every abandoned frame was already admitted by the chip (and, with an ACK | ||
| * responder armed, already ACKed to the peer), so this is post-admission | ||
| * loss a hardware-ARQ peer counts as delivered — it must never be silent. | ||
| * Normal end-of-aggregate zero padding (all-zero remainder) is excluded. | ||
| * Shared by every generation's RX walk; schema: docs/logging.md. */ | ||
|
|
||
| #include <cstddef> | ||
| #include <cstdint> | ||
|
|
||
| #include "Event.h" | ||
|
|
||
| namespace devourer { | ||
|
|
||
| /* Returns true when the remainder was a real abort (event emitted), | ||
| * false for benign all-zero padding. `total` is the caller's cumulative | ||
| * abort counter, incremented on emit. */ | ||
| inline bool emit_rx_parse_abort(EventSink &sink, const uint8_t *rem, | ||
| size_t rem_len, long long off, | ||
| long long buf_len, long long frame_len, | ||
| long long drvinfo, long long shift, | ||
| long long &total) { | ||
| if (!sink.enabled()) | ||
| return false; | ||
| bool all_zero = true; | ||
| for (size_t i = 0; i < rem_len; ++i) | ||
| if (rem[i] != 0) { | ||
| all_zero = false; | ||
| break; | ||
| } | ||
| if (all_zero) | ||
| return false; | ||
| ++total; | ||
| Ev(sink, "rx.parse_abort") | ||
| .t() | ||
| .f("off", off) | ||
| .f("buf_len", buf_len) | ||
| .f("remaining", static_cast<long long>(rem_len)) | ||
| .f("frame_len", frame_len) | ||
| .f("drvinfo", drvinfo) | ||
| .f("shift", shift) | ||
| .f("total", total); | ||
| return true; | ||
| } | ||
|
|
||
| } // namespace devourer | ||
|
|
||
| #endif /* DEVOURER_RX_PARSE_ABORT_H */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # parse_abort_smoke.sh — per-generation ambient-RX smoke for rx.parse_abort. | ||
| # | ||
| # The rx.parse_abort event (src/RxParseAbort.h) fires when a generation's RX | ||
| # descriptor walk abandons a bulk-IN buffer on a malformed descriptor. Two | ||
| # properties need hardware on every family: frames still flow (the walk is | ||
| # untouched on the success path), and the all-zero-padding exclusion holds for | ||
| # that family's aggregate format (no spurious event flood on ambient traffic). | ||
| # | ||
| # sudo bash tests/parse_abort_smoke.sh # every known plugged DUT | ||
| # DUTS="0x8813 0xb812" sudo bash tests/parse_abort_smoke.sh | ||
| set -u | ||
|
|
||
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | ||
| BUILD=${BUILD:-$ROOT/build} | ||
| CH=${CH:-6} # 2.4 GHz: ambient beacons guarantee RX traffic | ||
| DWELL_S=${DWELL_S:-20} | ||
| # J1 8814AU, J2 8822BU, J3 8812CU, Kestrel. The J3 default is the 8812CU, not | ||
| # the 8822EU: the 8822E's DPDT front end decodes no ambient 2.4 GHz on this | ||
| # bench (green init, DIG sees energy, zero frames) while its 5 GHz RX is | ||
| # proven — the walk under test is identical on both dies. | ||
| DUTS=${DUTS:-"0x8813 0xb812 0xc812 0x0101"} | ||
| OUT=${OUT:-/tmp/parse-abort-smoke} | ||
|
|
||
| [ "$(id -u)" = 0 ] || { echo "must run as root"; exit 3; } | ||
| [ -x "$BUILD/rxdemo" ] || { echo "build rxdemo first"; exit 3; } | ||
| mkdir -p "$OUT" | ||
|
|
||
| MODS="rtw88_8812au rtw88_8821au rtw88_8822bu rtw88_8814au rtw88_8822cu rtw88_8822eu rtw89_8852bu rtw89_8852cu" | ||
| BLACKLIST=/run/modprobe.d/zz-temp-blacklist-pabort.conf | ||
| cleanup() { | ||
| trap - EXIT INT TERM | ||
| esc_build=$(printf '%s' "$BUILD" | sed 's/[][\\.^$*+?(){}|]/\\&/g') | ||
| pkill -f "^$esc_build/rxdemo" 2>/dev/null | ||
| rm -f "$BLACKLIST" | ||
| wait 2>/dev/null | ||
| } | ||
| trap cleanup EXIT INT TERM | ||
| mkdir -p "$(dirname "$BLACKLIST")" | ||
| : > "$BLACKLIST" | ||
| for m in $MODS; do echo "blacklist $m" >> "$BLACKLIST"; modprobe -r "$m" 2>/dev/null; done | ||
|
|
||
| rc=0 | ||
| for pid in $DUTS; do | ||
| vid=0x0bda | ||
| [ "$pid" = "0x0101" ] && vid=0x35bc | ||
| log="$OUT/rx-${vid#0x}${pid#0x}.jsonl" | ||
| echo "[pabort] DUT $vid:$pid — ${DWELL_S}s ambient RX on ch$CH" | ||
| env DEVOURER_VID="$vid" DEVOURER_PID="$pid" DEVOURER_CHANNEL="$CH" \ | ||
| DEVOURER_RX_AGG_SA=any \ | ||
| DEVOURER_LOG_LEVEL=warn DEVOURER_EVENTS=stdout \ | ||
| timeout -s INT "$DWELL_S" "$BUILD/rxdemo" >"$log" 2>"$OUT/rx-${vid#0x}${pid#0x}.err" | ||
| pkts=$(grep -cF '"ev":"rx.pkt"' "$log" || true) | ||
| frames=$(grep -cF '"ev":"rx.frame"' "$log" || true) | ||
| aborts=$(grep -cF '"ev":"rx.parse_abort"' "$log" || true) | ||
| verdict=OK | ||
| # rx.pkt samples (first 10 + every 100th) — >=2 proves the walk delivers. | ||
| [ "${pkts:-0}" -ge 2 ] || { verdict="FAIL(no-rx)"; rc=1; } | ||
| [ "${aborts:-0}" -eq 0 ] || { verdict="FAIL(aborts=$aborts)"; rc=1; } | ||
| echo "[pabort] $vid:$pid rx.pkt=$pkts rx.frame=$frames parse_aborts=$aborts -> $verdict" | ||
| done | ||
| echo "[pabort] logs: $OUT" | ||
| exit "$rc" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.