2022-09-06 22:01:30

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH] Bluetooth: Enable LE 2M PHY by default

From: Luiz Augusto von Dentz <[email protected]>

This enables 2M PHY by default and in case the controller doesn't
support HCI_OP_LE_SET_DEFAULT_PHY then default to just 1M PHY.

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/bluetooth/hci_core.c | 4 ++--
net/bluetooth/hci_sync.c | 9 +++++++--
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 3803e54f23c0..d2d017621c08 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2469,8 +2469,8 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
hdev->le_max_rx_time = 0x0148;
hdev->le_max_key_size = SMP_MAX_ENC_KEY_SIZE;
hdev->le_min_key_size = SMP_MIN_ENC_KEY_SIZE;
- hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M;
- hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M;
+ hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M | HCI_LE_SET_PHY_2M;
+ hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M | HCI_LE_SET_PHY_2M;
hdev->le_num_of_adv_sets = HCI_MAX_ADV_INSTANCES;
hdev->def_multi_adv_rotation_duration = HCI_DEFAULT_ADV_DURATION;
hdev->def_le_autoconnect_timeout = HCI_LE_AUTOCONN_TIMEOUT;
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 41b6d19c70b0..4eab893cb10e 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4348,13 +4348,18 @@ static int hci_le_set_write_def_data_len_sync(struct hci_dev *hdev)
sizeof(cp), &cp, HCI_CMD_TIMEOUT);
}

-/* Set Default PHY parameters if command is supported */
+/* Set Default PHY parameters if command is supported, if not supported default
+ * to 1M.
+ */
static int hci_le_set_default_phy_sync(struct hci_dev *hdev)
{
struct hci_cp_le_set_default_phy cp;

- if (!(hdev->commands[35] & 0x20))
+ if (!(hdev->commands[35] & 0x20)) {
+ hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M;
+ hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M;
return 0;
+ }

memset(&cp, 0, sizeof(cp));
cp.all_phys = 0x00;
--
2.37.2


2022-09-06 23:24:59

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: Enable LE 2M PHY by default

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=674664

---Test result---

Test Summary:
CheckPatch PASS 1.77 seconds
GitLint PASS 0.98 seconds
SubjectPrefix PASS 0.87 seconds
BuildKernel PASS 36.43 seconds
BuildKernel32 PASS 32.20 seconds
Incremental Build with patchesPASS 48.59 seconds
TestRunner: Setup PASS 529.00 seconds
TestRunner: l2cap-tester PASS 17.66 seconds
TestRunner: iso-tester PASS 16.81 seconds
TestRunner: bnep-tester PASS 6.67 seconds
TestRunner: mgmt-tester FAIL 108.08 seconds
TestRunner: rfcomm-tester PASS 10.39 seconds
TestRunner: sco-tester PASS 9.98 seconds
TestRunner: smp-tester PASS 9.92 seconds
TestRunner: userchan-tester PASS 6.90 seconds

Details
##############################
Test: TestRunner: mgmt-tester - FAIL - 108.08 seconds
Run test-runner with mgmt-tester
Total: 494, Passed: 492 (99.6%), Failed: 2, Not Run: 0

Failed Test Cases
Get PHY Success Failed 0.120 seconds
Set PHY 2m Success Timed out 2.402 seconds



---
Regards,
Linux Bluetooth