fix(async): complete block writes from OUTPUT_LAST status#84
Conversation
d60690b to
febe8f5
Compare
febe8f5 to
22db267
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0236dca2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (tailCommand != HW::OHCIDescriptor::kCmdOutputLast || | ||
| HW::AT_xferStatus(*tailState.desc) == 0) { | ||
| return false; |
There was a problem hiding this comment.
Preserve recognized chains while OUTPUT_LAST is pending
When the watchdog scans after hardware has advanced CommandPtr from an OUTPUT_MORE header to its still-pending OUTPUT_LAST, the zero terminal status makes this helper return false; ScanCompletion() then invokes HandlePendingDescriptor(), whose pointer-mismatch check clears the header and advances the ring head. Under sustained submissions those prematurely freed blocks can be reused before the terminal descriptor completes, overwriting the immediate header used to recover the tLabel and causing a lost or misattributed completion. Distinguish a recognized-but-pending chain from an unrecognized descriptor and return without orphan cleanup until the terminal status becomes nonzero. CLAUDE.mdL230-L232
Useful? React with 👍 / 👎.
Summary
OUTPUT_LASTdescriptorOUTPUT_MORE→OUTPUT_LASTchainsRoot cause
ASFW scans AT completions from the ring head. For a block write, the ring head is an immediate
OUTPUT_MOREheader and the payload is anOUTPUT_LASTdescriptor. The tested OHCI controller records the completion status onOUTPUT_LASTwhile leaving the precursor status at zero. The scanner therefore treated a completed packet as pending forever, so the SBP-2 ORB_POINTER write kept its tLabel outstanding and the command path stalled after the first successful INQUIRY.This behavior matches the Linux OHCI implementation, which assigns and reads packet completion from the chain's last descriptor. The same compatibility handling existed in the earlier SBP-2 bring-up work from #14 but was lost during the later async-stack refactor.
Impact
The fix is transport-level and applies to any async block write that uses the standard immediate-header plus payload descriptor chain. It does not add SBP-2-specific knowledge to the async layer.
Validation
Host and build
ATContextCompletionTests: 2/2 passedHardware
Validated on an Epson V750 Pro / GT-X970 SBP-2 scanner with the rebuilt dext installed:
0.2.0/2activated and enabledsystem_profilerdroppedRecords = 0The original hardware blocker is resolved. This PR is ready for review.
CI organization and merge order
Shared CI workflow cleanup is tracked separately in #88. This PR is marked ready now so code review can proceed while #88 awaits owner action.
The intended merge order remains:
mainand drop the duplicated CI commits;Please do not merge #84 before that rebase.