Repository navigation
Bluetooth: btcentauri_t6050: skip malformed RX descriptors and fall back to host duplicate filtering - #3945
Conversation
One event descriptor with a bad length stopped the transport: the work handler cleared running and left HCI registered. The bad descriptor stayed at rx_head, so a reset or reopen hit it again and Bluetooth was dead until the module was reloaded. The LE ACL ring and the auxiliary ACL, SCO and ISO rings did the same for a length above the footer. Count such a descriptor as an RX error, log it rate-limited, and return the slot to the firmware the same way as a consumed packet. An invalid ring index still stops the transport. Signed-off-by: vlad <tulituvlad@gmail.com>
When the firmware refuses the vendor command that flushes its duplicate filter, reset_dup_filter returned the error and hci_sync gave up before sending LE Scan Enable. LE scanning then failed, so BLE discovery and HID reconnects did not work. A refusal arrives as a negative errno from bt_to_errno(). For Unknown Command, Command Disallowed, Unsupported Feature and Invalid Parameters, log it once, remember it and return 0. While the fallback is set, clear Filter_Duplicates in the copy of LE Set Scan Enable and LE Set Extended Scan Enable written to the command ring, so the host handles repeated reports. Send, cancel and timeout errors are still returned. Signed-off-by: vlad <tulituvlad@gmail.com>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed at 4ce92d06cd6d (non-author, 12-01 bar).
Malformed RX descriptors on event, LE ACL, and aux rings now count err_rx, rate-limit log, and advance/repost the slot instead of wedging the transport while keeping invalid ring indices fatal. cen_hci_reset_dup_filter() catches only the four firmware-refusal errnos (-EBADRQC, -EBUSY, -EOPNOTSUPP, -EINVAL), passes transport/timeout errors through, and clears byte 4 (Filter_Duplicates) on enabled LE_SET_SCAN_ENABLE / LE_SET_EXT_SCAN_ENABLE commands (guarded by skb->len >= 5). Exact-head J714s row at 4ce92d06cd6d passes (3 LE scans, 0 Bluetooth errors).
|
Merged as f345d04 ( Tree: main 2f5b01a merged with #3944 (a040d04) and #3945 (4ce92d0), giving local merge c1d4e460 (tree 3388cb36). Both merges were clean with Build: arm64
|
What: Two error path fixes in the t6050 Bluetooth transport. One malformed RX descriptor stopped Bluetooth until the module was reloaded; it is now counted, logged and handed back to the firmware. When the firmware refuses the vendor command that flushes its duplicate filter, LE scanning no longer fails; the host filters duplicate reports instead.
Tested: J714s (MacBook Pro 14-inch, M5 Pro) at 4ce92d0, loaded as a module next to the stock Wi-Fi module on a local 7.3 kernel: controller powered,
btmgmt find -lfound 34, 34 and 31 LE devices in 3 scans, no Bluetooth kernel errors.Risk: two-way door · Macs that bind
btcentauri_t6050(M5 Pro, M5 Max)Not yet: neither error path was hit on hardware; both bugs were found by reading the code. CI runs no Apple build for this PR, because
drivers/bluetooth/**is not in the apple-build path filter; the only build is the local one under Evidence.Details
RX descriptors: the work handler cleared
runningon a bad event length and left HCI registered. The bad descriptor stayed atrx_head, so a reset or reopen hit it again. The LE ACL ring and the auxiliary ACL, SCO and ISO rings did the same for a length above the footer. Such a descriptor now counts as an RX error, is logged rate limited, and its slot goes back to the firmware like a consumed packet. An invalid ring index still stops the transport.Duplicate filter:
reset_dup_filterreturned the firmware's refusal, andhci_syncgave up before LE Scan Enable. For Unknown Command, Command Disallowed, Unsupported Feature and Invalid Parameters the driver now logs once, remembers it and returns 0. While that fallback is set, it clears Filter_Duplicates in the copy of LE Set Scan Enable and LE Set Extended Scan Enable written to the command ring. Send, cancel and timeout errors are still returned.Evidence
At 4ce92d0 on the J714s, module built against the running kernel and swapped in live (the module showed the out-of-tree taint, so this build ran): controller powered in all 3 checks,
btmgmt find -l34 / 34 / 31 LE devices. The only Bluetooth kernel line isHCI Enhanced Setup Synchronous Connection command is advertised, but not supported, which the stock module prints on every load too.Earlier, on a local 7.3 kernel with the same driver file:
btmgmt find -l, LE devices, 3 scansThe LE device count follows the devices in the room, not the driver. An earlier module swap in the same session found 10 / 11 / 10 and 16 / 17 / 15 with the change, around a stock block of 16 / 18 / 13.
At this head:
make LLVM=1 W=1module build ofbtcentauri_t6050.owith 0 warnings;checkpatch.pl --stricton both commits: 0 errors, 0 warnings.