aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@nokia.com>2011-01-03 04:14:36 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-02-07 22:40:04 -0500
commite702112ff68a554bcac16bb03ddc2b8e5425bcbf (patch)
tree872f93640d646326167d41b7797d5a7eea75b751 /include/net
parentb2c60d42db0fea1e6c4345739601024863566a13 (diff)
Bluetooth: Use non-flushable by default L2CAP data packets
Modification of Nick Pelly <npelly@google.com> patch. With Bluetooth 2.1 ACL packets can be flushable or non-flushable. This commit makes ACL data packets non-flushable by default on compatible chipsets, and adds the BT_FLUSHABLE socket option to explicitly request flushable ACL data packets for a given L2CAP socket. This is useful for A2DP data which can be safely discarded if it can not be delivered within a short time (while other ACL data should not be discarded). Note that making ACL data flushable has no effect unless the automatic flush timeout for that ACL link is changed from its default of 0 (infinite). Default packet types (for compatible chipsets): Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits) Bluetooth HCI H4 Bluetooth HCI ACL Packet .... 0000 0000 0010 = Connection Handle: 0x0002 ..00 .... .... .... = PB Flag: First Non-automatically Flushable Packet (0) 00.. .... .... .... = BC Flag: Point-To-Point (0) Data Total Length: 8 Bluetooth L2CAP Packet After setting BT_FLUSHABLE (sock.setsockopt(274 /*SOL_BLUETOOTH*/, 8 /* BT_FLUSHABLE */, 1 /* flush */)) Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits) Bluetooth HCI H4 Bluetooth HCI ACL Packet .... 0000 0000 0010 = Connection Handle: 0x0002 ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2) 00.. .... .... .... = BC Flag: Point-To-Point (0) Data Total Length: 8 Bluetooth L2CAP Packet Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--include/net/bluetooth/l2cap.h1
4 files changed, 9 insertions, 0 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 0c5e72503b77..ed7d775337e0 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -64,6 +64,11 @@ struct bt_security {
64 64
65#define BT_DEFER_SETUP 7 65#define BT_DEFER_SETUP 7
66 66
67#define BT_FLUSHABLE 8
68
69#define BT_FLUSHABLE_OFF 0
70#define BT_FLUSHABLE_ON 1
71
67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 72#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 73#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 74#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 29a7a8ca0438..5d033dc9d43b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -150,6 +150,7 @@ enum {
150#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 150#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
151 151
152/* ACL flags */ 152/* ACL flags */
153#define ACL_START_NO_FLUSH 0x00
153#define ACL_CONT 0x01 154#define ACL_CONT 0x01
154#define ACL_START 0x02 155#define ACL_START 0x02
155#define ACL_ACTIVE_BCAST 0x04 156#define ACL_ACTIVE_BCAST 0x04
@@ -194,6 +195,7 @@ enum {
194#define LMP_EDR_3S_ESCO 0x80 195#define LMP_EDR_3S_ESCO 0x80
195 196
196#define LMP_SIMPLE_PAIR 0x08 197#define LMP_SIMPLE_PAIR 0x08
198#define LMP_NO_FLUSH 0x40
197 199
198/* Connection modes */ 200/* Connection modes */
199#define HCI_CM_ACTIVE 0x0000 201#define HCI_CM_ACTIVE 0x0000
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d2cf88407690..4e14610baece 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -458,6 +458,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
458#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 458#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
459#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 459#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
460#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 460#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
461#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
461 462
462/* ----- HCI protocols ----- */ 463/* ----- HCI protocols ----- */
463struct hci_proto { 464struct hci_proto {
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ad25ca60ec0..7f88a87d7a46 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -327,6 +327,7 @@ struct l2cap_pinfo {
327 __u8 sec_level; 327 __u8 sec_level;
328 __u8 role_switch; 328 __u8 role_switch;
329 __u8 force_reliable; 329 __u8 force_reliable;
330 __u8 flushable;
330 331
331 __u8 conf_req[64]; 332 __u8 conf_req[64];
332 __u8 conf_len; 333 __u8 conf_len;