Skip to contentSkip to conversation

Bluetooth: MGMT: Add initial implementation of MGMT_OP_HCI_CMD_SYNC

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Nov 14, 2024

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/1 Bluetooth: MGMT: Add initial implementation of MGMT_OP_HCI_CMD_SYNC

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

This adds the initial implementation of MGMT_OP_HCI_CMD_SYNC as documented in mgmt-api (BlueZ tree):

Send HCI command and wait for event Command
===========================================

Command Code: 0x005B
Controller Index: <controller id>
Command Parameters: Opcode (2 Octets)
Event (1 Octet) Timeout (1 Octet) Parameter Length (2 Octets) Parameter (variable)
Return Parameters: Response (1-variable Octets)

This command may be used to send a HCI command and wait for an (optional) event.

The HCI command is specified by the Opcode, any arbitrary is supported including vendor commands, but contrary to the like of Raw/User channel it is run as an HCI command send by the kernel since it uses its command synchronization thus it is possible to wait for a specific event as a response.

Setting event to 0x00 will cause the command to wait for either HCI Command Status or HCI Command Complete.

Timeout is specified in seconds, setting it to 0 will cause the default timeout to be used.

Possible errors: Failed
Invalid Parameters

---
 include/net/bluetooth/mgmt.h | 10 ++++++
 net/bluetooth/mgmt.c         | 60 ++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
include/net/bluetooth/mgmt.h +10 -0
index d382679efd2b..affac861efdc 100644
@@ -878,6 +878,16 @@ struct mgmt_cp_mesh_send_cancel {
 } __packed;
 #define MGMT_MESH_SEND_CANCEL_SIZE	1
 
+#define MGMT_OP_HCI_CMD_SYNC		0x005B
+struct mgmt_cp_hci_cmd_sync {
+	__le16 opcode;
+	__u8   event;
+	__u8   timeout;
+	__le16 params_len;
+	__u8   params[];
+} __packed;
+#define MGMT_HCI_CMD_SYNC_SIZE		6
+
 #define MGMT_EV_CMD_COMPLETE		0x0001
 struct mgmt_ev_cmd_complete {
 	__le16	opcode;
net/bluetooth/mgmt.c +60 -0

78 lines not on this page · raw message

Signature · 1 line
2.47.0
#1 lore raw

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

---Test result---

Test Summary:

CheckPatch                    PENDING   0.24 seconds
GitLint                       PENDING   0.21 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      25.17 seconds
CheckAllWarning               PASS      27.64 seconds
CheckSparse                   PASS      31.12 seconds
BuildKernel32                 PASS      25.07 seconds
TestRunnerSetup               PASS      442.04 seconds
TestRunner_l2cap-tester       PASS      22.44 seconds
TestRunner_iso-tester         FAIL      28.51 seconds
TestRunner_bnep-tester        PASS      4.82 seconds
TestRunner_mgmt-tester        PASS      119.38 seconds
TestRunner_rfcomm-tester      PASS      7.63 seconds
TestRunner_sco-tester         PASS      11.47 seconds
TestRunner_ioctl-tester       PASS      8.29 seconds
TestRunner_mesh-tester        FAIL      6.21 seconds
TestRunner_smp-tester         PASS      7.02 seconds
TestRunner_userchan-tester    PASS      5.09 seconds
IncrementalBuild              PENDING   0.39 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
Total: 124, Passed: 120 (96.8%), Failed: 0, Not Run: 4
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:

BUG: KASAN: slab-use-after-free in run_timer_softirq+0x76c/0x7d0
WARNING: CPU: 0 PID: 63 at kernel/workqueue.c:2257 __queue_work+0x687/0xb40

Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1 Failed 0.104 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Thu, 14 Nov 2024 13:40:46 -0500 you wrote:

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

This adds the initial implementation of MGMT_OP_HCI_CMD_SYNC as documented in mgmt-api (BlueZ tree):

Send HCI command and wait for event Command
===========================================

[...]

Here is the summary with links:
- [v2] Bluetooth: MGMT: Add initial implementation of MGMT_OP_HCI_CMD_SYNC

    https://git.kernel.org/bluetooth/bluetooth-next/c/f8e802a53b3f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html