Skip to contentSkip to conversation

Bluetooth: Provide access to reassembled Rx packets

RFC In review Suraj Sumangala 2 participants 8 messages Jul 26, 2010 – Jul 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC v2 1/1 Bluetooth: Provide access to reassembled Rx packets

Provide the HCI transport driver access to reassembled Rx packets before sending to Host.

---
 include/net/bluetooth/hci_core.h |    1 +
 net/bluetooth/hci_core.c         |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
index 350b3e6..532169c 100644
@@ -156,6 +156,7 @@ struct hci_dev {
 	int (*close)(struct hci_dev *hdev);
 	int (*flush)(struct hci_dev *hdev);
 	int (*send)(struct sk_buff *skb);
+	int (*recv)(struct sk_buff *skb);
 	void (*destruct)(struct hci_dev *hdev);
 	void (*notify)(struct hci_dev *hdev, unsigned int evt);
 	int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
net/bluetooth/hci_core.c +4 -0
index 995c9f9..85e09ef 100644
@@ -1132,6 +1132,10 @@ static int hci_reassembly(struct hci_dev *hdev, int type, void *data,
 			/* Complete frame */
 
 			bt_cb(skb)->pkt_type = type;
+
+			if (hdev->recv)
+				hdev->recv(skb);
+
 			hci_recv_frame(skb);
 
 			hdev->reassembly[index] = NULL;
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw

Hi Suraj,

Quoted 2 lines

Provide the HCI transport driver access to reassembled Rx packets before sending to Host.

you still haven't answered my question on why you want this. It makes no sense to me to relay all packets back to the driver. That is just a waste of CPU cycles.

Regards

Marcel

author
#2 lore raw

Hi Marcel,

Quoted 5 lines · Marcel Holtmann

Hi Suraj,

Quoted 2 lines

Provide the HCI transport driver access to reassembled Rx packets before sending to Host.

Quoted 9 lines

you still haven't answered my question on why you want this. It makes no sense to me to relay all packets back to the driver. That is just a waste of CPU cycles.

Regards

Marcel

The requirement is simple. The driver need to know the status of certain vendor specific commands by checking the parameters of Command complete events.

We also have a requirements to verify the status of HCI RESET command to update power management feature.

If you are concerned about CPU cycle, we can limit this only for HCI events and not for ACL/SCO packets.

Please do let me know if you think there is an alternate way so that the HCI transport driver can access to HCI events.

Regards
Suraj

maintainer
#3 lore raw

Hi Suraj,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Provide the HCI transport driver access to reassembled Rx packets before sending to Host.

you still haven't answered my question on why you want this. It makes no sense to me to relay all packets back to the driver. That is just a waste of CPU cycles.

The requirement is simple. The driver need to know the status of certain vendor specific commands by checking the parameters of Command complete events.

then implement something that handles vendor specific commands and events properly. This proposal is insane and will not get merged.

Quoted 2 lines

We also have a requirements to verify the status of HCI RESET command to update power management feature.

Then implement something that can track the status of HCI reset properly.

Quoted 5 lines

If you are concerned about CPU cycle, we can limit this only for HCI events and not for ACL/SCO packets.

Please do let me know if you think there is an alternate way so that the HCI transport driver can access to HCI events.

So first of all, lets make something perfectly clear. All Bluetooth drivers are _transport_ drivers. They don't need to know what they are transporting. And in addition you should not look into the packets that you are sending or receiving. The Bluetooth core does that HCI packet parsing.

This is how I want it and how this is going to stay. Everything else is an insane approach and cost every single driver overhead. In addition the lifetime rules of SKBs become more and more complicated. That is a pretty bad thing. It will result in excessive memory usage and will cause problems.

Regards

Marcel

author
#4 lore raw

Hi Marcel,

Quoted 13 lines · Marcel Holtmann

Hi Suraj,

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Provide the HCI transport driver access to reassembled Rx packets before sending to Host.

you still haven't answered my question on why you want this. It makes no sense to me to relay all packets back to the driver. That is just a waste of CPU cycles.

The requirement is simple. The driver need to know the status of certain vendor specific commands by checking the parameters of Command complete events.

Quoted 8 lines

then implement something that handles vendor specific commands and events properly. This proposal is insane and will not get merged.

Quoted 2 lines

We also have a requirements to verify the status of HCI RESET command to update power management feature.

Then implement something that can track the status of HCI reset properly.

Is there any option for the transport driver to get status of certain commands from the HCI core?

if it is not there, can you advice how that can be done efficiently?

Quoted 4 lines
Quoted 4 lines

If you are concerned about CPU cycle, we can limit this only for HCI events and not for ACL/SCO packets.

Quoted 8 lines
Quoted 2 lines

Please do let me know if you think there is an alternate way so that the HCI transport driver can access to HCI events.

So first of all, lets make something perfectly clear. All Bluetooth drivers are _transport_ drivers. They don't need to know what they are transporting. And in addition you should not look into the packets that you are sending or receiving. The Bluetooth core does that HCI packet parsing.

If that is the case, should we be implementing something similar to the way HCI_LL protocol does it? By defining custom packet types and parsing it to get board specific information?

Quoted 7 lines

This is how I want it and how this is going to stay. Everything else is an insane approach and cost every single driver overhead. In addition the lifetime rules of SKBs become more and more complicated. That is a pretty bad thing. It will result in excessive memory usage and will cause problems.

Quoted 5 lines

Regards

Marcel

Regards
Suraj

author
#5 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 11 lines · Marcel Holtmann

So first of all, lets make something perfectly clear. All Bluetooth drivers are _transport_ drivers. They don't need to know what they are transporting. And in addition you should not look into the packets that you are sending or receiving. The Bluetooth core does that HCI packet parsing.

This is how I want it and how this is going to stay. Everything else is an insane approach and cost every single driver overhead. In addition the lifetime rules of SKBs become more and more complicated. That is a pretty bad thing. It will result in excessive memory usage and will cause problems.

I understand the point that you are making. But If I am not mistaken, HCI transport driver is the only part of the system that could be vendor specific ( HCI ATH3K, HCI LL etc). So a vendor specific command or event makes more sense to a transport driver than anybody else.

Is there anyway this requirement can be sufficed without causing the issues you have mentioned above?

Quoted 6 lines

Regards

Marcel

Regards
Suraj

maintainer
#6 lore raw

Hi Suraj,

Quoted 12 lines
Quoted 11 lines

So first of all, lets make something perfectly clear. All Bluetooth drivers are _transport_ drivers. They don't need to know what they are transporting. And in addition you should not look into the packets that you are sending or receiving. The Bluetooth core does that HCI packet parsing.

This is how I want it and how this is going to stay. Everything else is an insane approach and cost every single driver overhead. In addition the lifetime rules of SKBs become more and more complicated. That is a pretty bad thing. It will result in excessive memory usage and will cause problems.

Quoted 7 lines

I understand the point that you are making. But If I am not mistaken, HCI transport driver is the only part of the system that could be vendor specific ( HCI ATH3K, HCI LL etc). So a vendor specific command or event makes more sense to a transport driver than anybody else.

Is there anyway this requirement can be sufficed without causing the issues you have mentioned above?

so you might be able to convince me if you implement something proper for handling vendor commands. The basic assumption is still that a HCI driver is a pure transport driver.

However you have access to hci_dev. So if you create some functions to execute vendor commands and retrieve the results then this might be a way. The core already processes vendor commands and events. But keep in mind that there is no requirement to get a command status or command complete event for vendor commands. For example CSR doesn't send them for their vendor commands.

Regards

Marcel

author
#7 lore raw

Hi Marcel,

Quoted 19 lines · Marcel Holtmann

Hi Suraj,

Quoted 17 lines
Quoted 11 lines

So first of all, lets make something perfectly clear. All Bluetooth drivers are _transport_ drivers. They don't need to know what they are transporting. And in addition you should not look into the packets that you are sending or receiving. The Bluetooth core does that HCI packet parsing.

This is how I want it and how this is going to stay. Everything else is an insane approach and cost every single driver overhead. In addition the lifetime rules of SKBs become more and more complicated. That is a pretty bad thing. It will result in excessive memory usage and will cause problems.

I understand the point that you are making. But If I am not mistaken, HCI transport driver is the only part of the system that could be vendor specific ( HCI ATH3K, HCI LL etc). So a vendor specific command or event makes more sense to a transport driver than anybody else.

Quoted 6 lines
Quoted 2 lines

Is there anyway this requirement can be sufficed without causing the issues you have mentioned above?

so you might be able to convince me if you implement something proper for handling vendor commands. The basic assumption is still that a HCI driver is a pure transport driver.

My requirement is basically to use the command complete event of HCI_RESET to trigger a vendor specific command and verify its status by checking the status of the VSC.

So, does it makes sense to register a callback with HCI core with required Event ID so that HCI core can call the callback when it receives the corresponding Event? This would still make sure that HCI packets are handled by HCI core and "driver/whoever registers the callback" will be notified by the HCI core as and when required.

Not sure this would address the concern you have raised.

Quoted 7 lines

However you have access to hci_dev. So if you create some functions to execute vendor commands and retrieve the results then this might be a way. The core already processes vendor commands and events. But keep in mind that there is no requirement to get a command status or command complete event for vendor commands. For example CSR doesn't send them for their vendor commands.

Thanks,

Quoted 6 lines

Regards

Marcel

Regards
Suraj