Skip to contentSkip to conversation

Bluetooth: Provide HCI command opcode information to driver

PATCH Applied Marcel Holtmann 2 participants 2 messages Sep 14, 2014 – Sep 15, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Provide HCI command opcode information to driver

The Bluetooth core already does processing of the HCI command header and puts it together before sending it to the driver. It is not really efficient for the driver to look at the HCI command header again in case it has to make certain decisions about certain commands. To make this easier, just provide the opcode as part of the SKB control buffer information. The extra information about the opcode is optional and only provided for HCI commands.

---
 include/net/bluetooth/bluetooth.h | 1 +
 net/bluetooth/hci_core.c          | 1 +
 2 files changed, 2 insertions(+)
include/net/bluetooth/bluetooth.h +1 -0
index 373000de610d..7e666d06b97f 100644
@@ -284,6 +284,7 @@ struct hci_req_ctrl {
 struct bt_skb_cb {
 	__u8 pkt_type;
 	__u8 incoming;
+	__u16 opcode;
 	__u16 expect;
 	__u8 force_active;
 	struct l2cap_chan *chan;
net/bluetooth/hci_core.c +1 -0
index 067526d9680d..41948678f514 100644
@@ -4547,6 +4547,7 @@ static struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode,
 	BT_DBG("skb len %d", skb->len);
 
 	bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
+	bt_cb(skb)->opcode = opcode;
 
 	return skb;
 }
Signature · 1 line
1.9.3
#1 lore raw

Hi Marcel,

Quoted 8 lines · Marcel Holtmann

The Bluetooth core already does processing of the HCI command header and puts it together before sending it to the driver. It is not really efficient for the driver to look at the HCI command header again in case it has to make certain decisions about certain commands. To make this easier, just provide the opcode as part of the SKB control buffer information. The extra information about the opcode is optional and only provided for HCI commands.

Quoted 5 lines
---
 include/net/bluetooth/bluetooth.h | 1 +
 net/bluetooth/hci_core.c          | 1 +
 2 files changed, 2 insertions(+)

Applied to bluetooth-next. Thanks.

Johan