Bluetooth: HCI: Invert LE State quirk to be opt-out rather then opt-in
Subsystems (4)
Luiz Augusto von Dentz
maintainerPATCH 1/1 Bluetooth: HCI: Invert LE State quirk to be opt-out rather then opt-in
From: Luiz Augusto von Dentz <[email protected]>
This inverts the LE State quirk so by default we assume the controllers would report valid states rather than invalid which is how quirks normally behave, also this would result in HCI command failing it the LE States are really broken thus exposing the controllers that are really broken in this respect.
--- drivers/bluetooth/btintel.c | 10 ---------- drivers/bluetooth/btintel_pcie.c | 3 --- drivers/bluetooth/btmtksdio.c | 3 --- drivers/bluetooth/btrtl.c | 1 - drivers/bluetooth/btusb.c | 4 ++-- drivers/bluetooth/hci_qca.c | 4 ++-- drivers/bluetooth/hci_vhci.c | 2 -- include/net/bluetooth/hci.h | 17 ++++++++++------- include/net/bluetooth/hci_core.h | 2 +- net/bluetooth/hci_event.c | 2 +- 10 files changed, 16 insertions(+), 32 deletions(-)
drivers/bluetooth/btintel.c +0 -10
@@ -3069,9 +3069,6 @@ static int btintel_setup_combined(struct hci_dev *hdev) INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); -if (ver.hw_variant ==0x08 && ver.fw_variant ==0x22 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , - &hdev->quirks); err =btintel_legacy_rom_setup (hdev, &ver);break ;
@@ -3080,7 +3077,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)case 0x12 :/* ThP */ case 0x13 :/* HrP */ case 0x14 :/* CcP */ -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); fallthrough;case 0x0c :/* WsP */ /* Apply the device specific HCI quirks
@@ -3172,9 +3168,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)/* These variants don't seem to support LE Coded PHY */ set_bit (HCI_QUIRK_BROKEN_LE_CODED , &hdev->quirks); -/* Set Valid LE States quirk */ -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); -/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev, ver.hw_variant);
@@ -3200,9 +3193,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Apply LE States quirk from solar onwards */ -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); -/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev,INTEL_HW_VARIANT (ver_tlv.cnvi_bt));
drivers/bluetooth/btintel_pcie.c +0 -3
@@ -1196,9 +1196,6 @@ static int btintel_pcie_setup(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Apply LE States quirk from solar onwards */ -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); -/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev,INTEL_HW_VARIANT (ver_tlv.cnvi_bt));
drivers/bluetooth/btmtksdio.c +0 -3
@@ -1148,9 +1148,6 @@ static int btmtksdio_setup(struct hci_dev *hdev) } } -/* Valid LE States quirk for MediaTek 7921 */ -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); -break ;case 0x7663 :case 0x7668 :
drivers/bluetooth/btrtl.c +0 -1
@@ -1287,7 +1287,6 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)case CHIP_ID_8852C :case CHIP_ID_8851B :case CHIP_ID_8852BT : -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks);/* RTL8852C needs to transmit mSBC data continuously without
drivers/bluetooth/btusb.c +2 -2
@@ -3959,8 +3959,8 @@ static int btusb_probe(struct usb_interface *intf,if (id->driver_info &BTUSB_WIDEBAND_SPEECH )set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -if (id->driver_info &BTUSB_VALID_LE_STATES ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +if (!(id->driver_info &BTUSB_VALID_LE_STATES )) +set_bit (HCI_QUIRK_BROKEN_LE_STATES , &hdev->quirks);if (id->driver_info &BTUSB_DIGIANSWER ) { data->cmdreq_type =USB_TYPE_VENDOR ;
drivers/bluetooth/hci_qca.c +2 -2
@@ -2474,8 +2474,8 @@ static int qca_serdev_probe(struct serdev_device *serdev)set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -if (data->capabilities &QCA_CAP_VALID_LE_STATES ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +if (!(data->capabilities &QCA_CAP_VALID_LE_STATES )) +set_bit (HCI_QUIRK_BROKEN_LE_STATES , &hdev->quirks); }return 0 ;
drivers/bluetooth/hci_vhci.c +0 -2
@@ -425,8 +425,6 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)if (opcode &0x80 )set_bit (HCI_QUIRK_RAW_DEVICE , &hdev->quirks); -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); -if (hci_register_dev (hdev) <0 ) {BT_ERR ("Can't register HCI device" );hci_free_dev (hdev);
include/net/bluetooth/hci.h +10 -7
@@ -206,14 +206,17 @@ enum {*/ HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , -/* When this quirk is set, the controller has validated that -* LE states reported through the HCI_LE_READ_SUPPORTED_STATES are -* valid. This mechanism is necessary as many controllers have -* been seen has having trouble initiating a connectable -* advertisement despite the state combination being reported as -* supported. +/* When this quirk is set, the LE states reported through the +* HCI_LE_READ_SUPPORTED_STATES are invalid/broken. +* +* This mechanism is necessary as many controllers have been seen has +* having trouble initiating a connectable advertisement despite the +* state combination being reported as supported. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. */ - HCI_QUIRK_VALID_LE_STATES, + HCI_QUIRK_BROKEN_LE_STATES,/* When this quirk is set, then erroneous data reporting * is ignored. This is mainly due to the fact that the HCI
include/net/bluetooth/hci_core.h +1 -1
@@ -825,7 +825,7 @@ extern struct mutex hci_cb_list_lock; }while (0 ) #define hci_dev_le_state_simultaneous(hdev) \ - (test_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks) && \ + (!test_bit (HCI_QUIRK_BROKEN_LE_STATES , &hdev->quirks) && \ (hdev->le_states[4 ] &0x08 ) &&/* Central */ \ (hdev->le_states[4 ] &0x40 ) &&/* Peripheral */ \ (hdev->le_states[3 ] &0x10 ))/* Simultaneous */
net/bluetooth/hci_event.c +1 -1
@@ -5920,7 +5920,7 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,* while we have an existing one in peripheral role. */ if (hdev->conn_hash.le_num_peripheral >0 && - (!test_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks) || + (test_bit (HCI_QUIRK_BROKEN_LE_STATES , &hdev->quirks) || !(hdev->le_states[3 ] &0x10 )))return NULL ;
Signature · 1 line
2.46.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=878842
---Test result---
Test Summary:
CheckPatch PASS 18.81 seconds GitLint PASS 28.13 seconds SubjectPrefix PENDING 32.31 seconds BuildKernel PASS 54.78 seconds CheckAllWarning PASS 52.60 seconds CheckSparse WARNING 45.15 seconds CheckSmatch WARNING 127.26 seconds BuildKernel32 PASS 42.69 seconds TestRunnerSetup PASS 531.38 seconds TestRunner_l2cap-tester PASS 22.04 seconds TestRunner_iso-tester FAIL 35.36 seconds TestRunner_bnep-tester PASS 4.86 seconds TestRunner_mgmt-tester PASS 109.25 seconds TestRunner_rfcomm-tester PASS 7.47 seconds TestRunner_sco-tester PASS 15.15 seconds TestRunner_ioctl-tester PASS 7.97 seconds TestRunner_mesh-tester PASS 5.94 seconds TestRunner_smp-tester PASS 7.05 seconds TestRunner_userchan-tester PASS 5.09 seconds IncrementalBuild PASS 28.92 seconds
Details
##############################
Test: SubjectPrefix - PENDING
Desc: Check subject contains "Bluetooth" prefix Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4
Failed Test Cases
ISO Connect2 Suspend - Success Failed 4.230 seconds
---
Regards,
Linux Bluetooth