diff mbox series

[1/4] Bluetooth: Fix incorrect parsing of LE_PHY params

Message ID 20210722053843.6691-2-ayush.garg@samsung.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: Support for LE Set Preferred PHY | expand

Commit Message

Ayush Garg July 22, 2021, 5:38 a.m. UTC
This change is fixing the parsing of PHY LE CODED which is
represented with value 0x03 instead of 0x04 in LE PHY Update
Complete event.

> HCI Event: LE Meta Event (0x3e) plen 6
	  LE PHY Update Complete (0x0c)
		Status: Success (0x00)
		Handle: 0
		TX PHY: LE Coded (0x03)
		RX PHY: LE Coded (0x03)

Reviewed-by: Anupam Roy <anupam.r@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
---
 include/net/bluetooth/hci.h |  4 ++++
 net/bluetooth/hci_conn.c    | 21 +++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

Comments

bluez.test.bot@gmail.com July 22, 2021, 7:20 a.m. UTC | #1
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=519481

---Test result---

Test Summary:
CheckPatch                    PASS      3.62 seconds
GitLint                       FAIL      0.49 seconds
BuildKernel                   PASS      675.81 seconds
TestRunner: Setup             PASS      439.04 seconds
TestRunner: l2cap-tester      PASS      3.18 seconds
TestRunner: bnep-tester       PASS      2.18 seconds
TestRunner: mgmt-tester       PASS      34.44 seconds
TestRunner: rfcomm-tester     PASS      2.46 seconds
TestRunner: sco-tester        PASS      2.34 seconds
TestRunner: smp-tester        FAIL      2.54 seconds
TestRunner: userchan-tester   PASS      2.24 seconds

Details
##############################
Test: CheckPatch - PASS - 3.62 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - FAIL - 0.49 seconds
Run gitlint with rule in .gitlint
Bluetooth: Fix incorrect parsing of LE_PHY params
8: B3 Line contains hard tab characters (\t): "	  LE PHY Update Complete (0x0c)"
9: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
10: B3 Line contains hard tab characters (\t): "		Handle: 0"
11: B3 Line contains hard tab characters (\t): "		TX PHY: LE Coded (0x03)"
12: B3 Line contains hard tab characters (\t): "		RX PHY: LE Coded (0x03)"

Bluetooth: Implement BT_PHY setsocket option
7: B3 Line contains hard tab characters (\t): "		Handle: 0"
8: B3 Line contains hard tab characters (\t): "		All PHYs preference: 0x00"
9: B3 Line contains hard tab characters (\t): "		TX PHYs preference: 0x02"
10: B3 Line contains hard tab characters (\t): "		  LE 2M"
11: B3 Line contains hard tab characters (\t): "		RX PHYs preference: 0x02"
12: B3 Line contains hard tab characters (\t): "		  LE 2M"
13: B3 Line contains hard tab characters (\t): "		PHY options preference: Reserved (0x0000)"
15: B3 Line contains hard tab characters (\t): "	  LE Set PHY (0x08|0x0032) ncmd 1"
16: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
18: B3 Line contains hard tab characters (\t): "	  LE PHY Update Complete (0x0c)"
19: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
20: B3 Line contains hard tab characters (\t): "		Handle: 0"
21: B3 Line contains hard tab characters (\t): "		TX PHY: LE 2M (0x02)"
22: B3 Line contains hard tab characters (\t): "		RX PHY: LE 2M (0x02)"

Bluetooth: Add support for sending LE PHY Update event over mgmt
10: B3 Line contains hard tab characters (\t): "	  LE PHY Update Complete (0x0c)"
11: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
12: B3 Line contains hard tab characters (\t): "		Handle: 0"
13: B3 Line contains hard tab characters (\t): "		TX PHY: LE 2M (0x02)"
14: B3 Line contains hard tab characters (\t): "		RX PHY: LE 2M (0x02)"
16: B3 Line contains hard tab characters (\t): "		LE Address: 45:18:F8:CF:23:7E (Resolvable)"
17: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
18: B3 Line contains hard tab characters (\t): "		Updated PHYs: 0x1800"
19: B3 Line contains hard tab characters (\t): "		  LE 2M TX"
20: B3 Line contains hard tab characters (\t): "		  LE 2M RX"

Bluetooth: Update LE TX & RX PHYs when connection established
11: B3 Line contains hard tab characters (\t): "		Handle: 0"
13: B3 Line contains hard tab characters (\t): "	  LE Read PHY (0x08|0x0030) ncmd 1"
14: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
15: B3 Line contains hard tab characters (\t): "		Handle: 0"
16: B3 Line contains hard tab characters (\t): "		TX PHY: LE 1M (0x01)"
17: B3 Line contains hard tab characters (\t): "		RX PHY: LE 1M (0x01)"
19: B3 Line contains hard tab characters (\t): "		LE Address: 45:18:F8:CF:23:7E (Resolvable)"
20: B3 Line contains hard tab characters (\t): "		Status: Success (0x00)"
21: B3 Line contains hard tab characters (\t): "		Updated PHYs: 0x0600"
22: B3 Line contains hard tab characters (\t): "		  LE 1M TX"
23: B3 Line contains hard tab characters (\t): "		  LE 1M RX"


##############################
Test: BuildKernel - PASS - 675.81 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 439.04 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 3.18 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 2.18 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - PASS - 34.44 seconds
Run test-runner with mgmt-tester
Total: 448, Passed: 445 (99.3%), Failed: 0, Not Run: 3

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.46 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.34 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - FAIL - 2.54 seconds
Run test-runner with smp-tester
Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0

Failed Test Cases
SMP Client - SC Request 2                            Failed       0.036 seconds

##############################
Test: TestRunner: userchan-tester - PASS - 2.24 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index b80415011dcd..56542a09ec43 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1681,6 +1681,10 @@  struct hci_cp_le_set_default_phy {
 #define HCI_LE_SET_PHY_2M		0x02
 #define HCI_LE_SET_PHY_CODED		0x04
 
+#define HCI_LE_READ_PHY_1M		0x01
+#define HCI_LE_READ_PHY_2M		0x02
+#define HCI_LE_READ_PHY_CODED		0x03
+
 #define HCI_OP_LE_SET_EXT_SCAN_PARAMS   0x2041
 struct hci_cp_le_set_ext_scan_params {
 	__u8    own_addr_type;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 2b5059a56cda..383efd969840 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1915,22 +1915,19 @@  u32 hci_conn_get_phy(struct hci_conn *conn)
 		break;
 
 	case LE_LINK:
-		if (conn->le_tx_phy & HCI_LE_SET_PHY_1M)
-			phys |= BT_PHY_LE_1M_TX;
-
-		if (conn->le_rx_phy & HCI_LE_SET_PHY_1M)
-			phys |= BT_PHY_LE_1M_RX;
 
-		if (conn->le_tx_phy & HCI_LE_SET_PHY_2M)
+		if (conn->le_tx_phy == HCI_LE_READ_PHY_1M)
+			phys |= BT_PHY_LE_1M_TX;
+		else if (conn->le_tx_phy == HCI_LE_READ_PHY_2M)
 			phys |= BT_PHY_LE_2M_TX;
-
-		if (conn->le_rx_phy & HCI_LE_SET_PHY_2M)
-			phys |= BT_PHY_LE_2M_RX;
-
-		if (conn->le_tx_phy & HCI_LE_SET_PHY_CODED)
+		else if (conn->le_tx_phy == HCI_LE_READ_PHY_CODED)
 			phys |= BT_PHY_LE_CODED_TX;
 
-		if (conn->le_rx_phy & HCI_LE_SET_PHY_CODED)
+		if (conn->le_rx_phy == HCI_LE_READ_PHY_1M)
+			phys |= BT_PHY_LE_1M_RX;
+		else if (conn->le_rx_phy == HCI_LE_READ_PHY_2M)
+			phys |= BT_PHY_LE_2M_RX;
+		else if (conn->le_rx_phy == HCI_LE_READ_PHY_CODED)
 			phys |= BT_PHY_LE_CODED_RX;
 
 		break;