Skip to content

Commit 2d74230

Browse files
committed
Merge tag 'for-net-2024-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - MGMT: Add error handling to pair_device() - HCI: Invert LE State quirk to be opt-out rather then opt-in - hci_core: Fix LE quote calculation - SMP: Fix assumption of Central always being Initiator * tag 'for-net-2024-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: MGMT: Add error handling to pair_device() Bluetooth: SMP: Fix assumption of Central always being Initiator Bluetooth: hci_core: Fix LE quote calculation Bluetooth: HCI: Invert LE State quirk to be opt-out rather then opt-in ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a0c9fe5 + 538fd39 commit 2d74230

File tree

13 files changed

+99
-116
lines changed

13 files changed

+99
-116
lines changed

drivers/bluetooth/btintel.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,9 +2945,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)
29452945
INTEL_ROM_LEGACY_NO_WBS_SUPPORT))
29462946
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
29472947
&hdev->quirks);
2948-
if (ver.hw_variant == 0x08 && ver.fw_variant == 0x22)
2949-
set_bit(HCI_QUIRK_VALID_LE_STATES,
2950-
&hdev->quirks);
29512948

29522949
err = btintel_legacy_rom_setup(hdev, &ver);
29532950
break;
@@ -2956,7 +2953,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)
29562953
case 0x12: /* ThP */
29572954
case 0x13: /* HrP */
29582955
case 0x14: /* CcP */
2959-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
29602956
fallthrough;
29612957
case 0x0c: /* WsP */
29622958
/* Apply the device specific HCI quirks
@@ -3048,9 +3044,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)
30483044
/* These variants don't seem to support LE Coded PHY */
30493045
set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
30503046

3051-
/* Set Valid LE States quirk */
3052-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
3053-
30543047
/* Setup MSFT Extension support */
30553048
btintel_set_msft_opcode(hdev, ver.hw_variant);
30563049

@@ -3076,9 +3069,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)
30763069
*/
30773070
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
30783071

3079-
/* Apply LE States quirk from solar onwards */
3080-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
3081-
30823072
/* Setup MSFT Extension support */
30833073
btintel_set_msft_opcode(hdev,
30843074
INTEL_HW_VARIANT(ver_tlv.cnvi_bt));

drivers/bluetooth/btintel_pcie.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,6 @@ static int btintel_pcie_setup(struct hci_dev *hdev)
11801180
*/
11811181
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
11821182

1183-
/* Apply LE States quirk from solar onwards */
1184-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
1185-
11861183
/* Setup MSFT Extension support */
11871184
btintel_set_msft_opcode(hdev,
11881185
INTEL_HW_VARIANT(ver_tlv.cnvi_bt));

drivers/bluetooth/btmtksdio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,6 @@ static int btmtksdio_setup(struct hci_dev *hdev)
11481148
}
11491149
}
11501150

1151-
/* Valid LE States quirk for MediaTek 7921 */
1152-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
1153-
11541151
break;
11551152
case 0x7663:
11561153
case 0x7668:

drivers/bluetooth/btrtl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,6 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
12871287
case CHIP_ID_8852C:
12881288
case CHIP_ID_8851B:
12891289
case CHIP_ID_8852BT:
1290-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
12911290
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
12921291

12931292
/* RTL8852C needs to transmit mSBC data continuously without

drivers/bluetooth/btusb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,8 +3956,8 @@ static int btusb_probe(struct usb_interface *intf,
39563956
if (id->driver_info & BTUSB_WIDEBAND_SPEECH)
39573957
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
39583958

3959-
if (id->driver_info & BTUSB_VALID_LE_STATES)
3960-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
3959+
if (!(id->driver_info & BTUSB_VALID_LE_STATES))
3960+
set_bit(HCI_QUIRK_BROKEN_LE_STATES, &hdev->quirks);
39613961

39623962
if (id->driver_info & BTUSB_DIGIANSWER) {
39633963
data->cmdreq_type = USB_TYPE_VENDOR;

drivers/bluetooth/hci_qca.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,8 +2474,8 @@ static int qca_serdev_probe(struct serdev_device *serdev)
24742474
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
24752475
&hdev->quirks);
24762476

2477-
if (data->capabilities & QCA_CAP_VALID_LE_STATES)
2478-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
2477+
if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
2478+
set_bit(HCI_QUIRK_BROKEN_LE_STATES, &hdev->quirks);
24792479
}
24802480

24812481
return 0;

drivers/bluetooth/hci_vhci.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,6 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
425425
if (opcode & 0x80)
426426
set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
427427

428-
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
429-
430428
if (hci_register_dev(hdev) < 0) {
431429
BT_ERR("Can't register HCI device");
432430
hci_free_dev(hdev);

include/net/bluetooth/hci.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,17 @@ enum {
206206
*/
207207
HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
208208

209-
/* When this quirk is set, the controller has validated that
210-
* LE states reported through the HCI_LE_READ_SUPPORTED_STATES are
211-
* valid. This mechanism is necessary as many controllers have
212-
* been seen has having trouble initiating a connectable
213-
* advertisement despite the state combination being reported as
214-
* supported.
209+
/* When this quirk is set, the LE states reported through the
210+
* HCI_LE_READ_SUPPORTED_STATES are invalid/broken.
211+
*
212+
* This mechanism is necessary as many controllers have been seen has
213+
* having trouble initiating a connectable advertisement despite the
214+
* state combination being reported as supported.
215+
*
216+
* This quirk can be set before hci_register_dev is called or
217+
* during the hdev->setup vendor callback.
215218
*/
216-
HCI_QUIRK_VALID_LE_STATES,
219+
HCI_QUIRK_BROKEN_LE_STATES,
217220

218221
/* When this quirk is set, then erroneous data reporting
219222
* is ignored. This is mainly due to the fact that the HCI

include/net/bluetooth/hci_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ extern struct mutex hci_cb_list_lock;
825825
} while (0)
826826

827827
#define hci_dev_le_state_simultaneous(hdev) \
828-
(test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) && \
828+
(!test_bit(HCI_QUIRK_BROKEN_LE_STATES, &hdev->quirks) && \
829829
(hdev->le_states[4] & 0x08) && /* Central */ \
830830
(hdev->le_states[4] & 0x40) && /* Peripheral */ \
831831
(hdev->le_states[3] & 0x10)) /* Simultaneous */

net/bluetooth/hci_core.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,19 +3664,19 @@ static void hci_sched_le(struct hci_dev *hdev)
36643664
{
36653665
struct hci_chan *chan;
36663666
struct sk_buff *skb;
3667-
int quote, cnt, tmp;
3667+
int quote, *cnt, tmp;
36683668

36693669
BT_DBG("%s", hdev->name);
36703670

36713671
if (!hci_conn_num(hdev, LE_LINK))
36723672
return;
36733673

3674-
cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt;
3674+
cnt = hdev->le_pkts ? &hdev->le_cnt : &hdev->acl_cnt;
36753675

3676-
__check_timeout(hdev, cnt, LE_LINK);
3676+
__check_timeout(hdev, *cnt, LE_LINK);
36773677

3678-
tmp = cnt;
3679-
while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, &quote))) {
3678+
tmp = *cnt;
3679+
while (*cnt && (chan = hci_chan_sent(hdev, LE_LINK, &quote))) {
36803680
u32 priority = (skb_peek(&chan->data_q))->priority;
36813681
while (quote-- && (skb = skb_peek(&chan->data_q))) {
36823682
BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
@@ -3691,7 +3691,7 @@ static void hci_sched_le(struct hci_dev *hdev)
36913691
hci_send_frame(hdev, skb);
36923692
hdev->le_last_tx = jiffies;
36933693

3694-
cnt--;
3694+
(*cnt)--;
36953695
chan->sent++;
36963696
chan->conn->sent++;
36973697

@@ -3701,12 +3701,7 @@ static void hci_sched_le(struct hci_dev *hdev)
37013701
}
37023702
}
37033703

3704-
if (hdev->le_pkts)
3705-
hdev->le_cnt = cnt;
3706-
else
3707-
hdev->acl_cnt = cnt;
3708-
3709-
if (cnt != tmp)
3704+
if (*cnt != tmp)
37103705
hci_prio_recalculate(hdev, LE_LINK);
37113706
}
37123707

0 commit comments

Comments
 (0)