mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Bluetooth: Enable 6LoWPAN support for BT LE devices
This is initial version of http://tools.ietf.org/html/draft-ietf-6lo-btle-00 By default the 6LoWPAN support is not activated and user needs to tweak /sys/kernel/debug/bluetooth/hci0/6lowpan file. The kernel needs IPv6 support before 6LoWPAN is usable. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
committed by
Marcel Holtmann
parent
e74bccb8a5
commit
18722c2470
@@ -131,6 +131,7 @@ enum {
|
|||||||
HCI_PERIODIC_INQ,
|
HCI_PERIODIC_INQ,
|
||||||
HCI_FAST_CONNECTABLE,
|
HCI_FAST_CONNECTABLE,
|
||||||
HCI_BREDR_ENABLED,
|
HCI_BREDR_ENABLED,
|
||||||
|
HCI_6LOWPAN_ENABLED,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A mask for the flags that are supposed to remain when a reset happens
|
/* A mask for the flags that are supposed to remain when a reset happens
|
||||||
|
|||||||
@@ -448,6 +448,7 @@ enum {
|
|||||||
HCI_CONN_SSP_ENABLED,
|
HCI_CONN_SSP_ENABLED,
|
||||||
HCI_CONN_POWER_SAVE,
|
HCI_CONN_POWER_SAVE,
|
||||||
HCI_CONN_REMOTE_OOB,
|
HCI_CONN_REMOTE_OOB,
|
||||||
|
HCI_CONN_6LOWPAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
|
static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ struct l2cap_conninfo {
|
|||||||
#define L2CAP_FC_L2CAP 0x02
|
#define L2CAP_FC_L2CAP 0x02
|
||||||
#define L2CAP_FC_CONNLESS 0x04
|
#define L2CAP_FC_CONNLESS 0x04
|
||||||
#define L2CAP_FC_A2MP 0x08
|
#define L2CAP_FC_A2MP 0x08
|
||||||
|
#define L2CAP_FC_6LOWPAN 0x3e /* reserved and temporary value */
|
||||||
|
|
||||||
/* L2CAP Control Field bit masks */
|
/* L2CAP Control Field bit masks */
|
||||||
#define L2CAP_CTRL_SAR 0xC000
|
#define L2CAP_CTRL_SAR 0xC000
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2013 Intel Corp.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License version 2 and
|
||||||
|
only version 2 as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __6LOWPAN_H
|
||||||
|
#define __6LOWPAN_H
|
||||||
|
|
||||||
|
#include <linux/skbuff.h>
|
||||||
|
#include <net/bluetooth/l2cap.h>
|
||||||
|
|
||||||
|
int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb);
|
||||||
|
int bt_6lowpan_add_conn(struct l2cap_conn *conn);
|
||||||
|
int bt_6lowpan_del_conn(struct l2cap_conn *conn);
|
||||||
|
int bt_6lowpan_init(void);
|
||||||
|
void bt_6lowpan_cleanup(void);
|
||||||
|
|
||||||
|
#endif /* __6LOWPAN_H */
|
||||||
@@ -10,6 +10,10 @@ obj-$(CONFIG_BT_HIDP) += hidp/
|
|||||||
|
|
||||||
bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
|
bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
|
||||||
hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
|
hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
|
||||||
a2mp.o amp.o
|
a2mp.o amp.o 6lowpan.o
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_IEEE802154_6LOWPAN),)
|
||||||
|
bluetooth-y += ../ieee802154/6lowpan_iphc.o
|
||||||
|
endif
|
||||||
|
|
||||||
subdir-ccflags-y += -D__CHECK_ENDIAN__
|
subdir-ccflags-y += -D__CHECK_ENDIAN__
|
||||||
|
|||||||
@@ -3533,6 +3533,9 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
|||||||
conn->handle = __le16_to_cpu(ev->handle);
|
conn->handle = __le16_to_cpu(ev->handle);
|
||||||
conn->state = BT_CONNECTED;
|
conn->state = BT_CONNECTED;
|
||||||
|
|
||||||
|
if (test_bit(HCI_6LOWPAN_ENABLED, &hdev->dev_flags))
|
||||||
|
set_bit(HCI_CONN_6LOWPAN, &conn->flags);
|
||||||
|
|
||||||
hci_conn_add_sysfs(conn);
|
hci_conn_add_sysfs(conn);
|
||||||
|
|
||||||
hci_proto_connect_cfm(conn, ev->status);
|
hci_proto_connect_cfm(conn, ev->status);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "smp.h"
|
#include "smp.h"
|
||||||
#include "a2mp.h"
|
#include "a2mp.h"
|
||||||
#include "amp.h"
|
#include "amp.h"
|
||||||
|
#include "6lowpan.h"
|
||||||
|
|
||||||
bool disable_ertm;
|
bool disable_ertm;
|
||||||
|
|
||||||
@@ -1468,6 +1469,8 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
|
|||||||
|
|
||||||
BT_DBG("");
|
BT_DBG("");
|
||||||
|
|
||||||
|
bt_6lowpan_add_conn(conn);
|
||||||
|
|
||||||
/* Check if we have socket listening on cid */
|
/* Check if we have socket listening on cid */
|
||||||
pchan = l2cap_global_chan_by_scid(BT_LISTEN, L2CAP_CID_ATT,
|
pchan = l2cap_global_chan_by_scid(BT_LISTEN, L2CAP_CID_ATT,
|
||||||
&hcon->src, &hcon->dst);
|
&hcon->src, &hcon->dst);
|
||||||
@@ -7119,6 +7122,10 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
|
|||||||
l2cap_conn_del(conn->hcon, EACCES);
|
l2cap_conn_del(conn->hcon, EACCES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case L2CAP_FC_6LOWPAN:
|
||||||
|
bt_6lowpan_recv(conn, skb);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
l2cap_data_channel(conn, cid, skb);
|
l2cap_data_channel(conn, cid, skb);
|
||||||
break;
|
break;
|
||||||
@@ -7186,6 +7193,8 @@ void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason)
|
|||||||
{
|
{
|
||||||
BT_DBG("hcon %p reason %d", hcon, reason);
|
BT_DBG("hcon %p reason %d", hcon, reason);
|
||||||
|
|
||||||
|
bt_6lowpan_del_conn(hcon->l2cap_data);
|
||||||
|
|
||||||
l2cap_conn_del(hcon, bt_to_errno(reason));
|
l2cap_conn_del(hcon, bt_to_errno(reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7467,11 +7476,14 @@ int __init l2cap_init(void)
|
|||||||
debugfs_create_u16("l2cap_le_default_mps", 0466, bt_debugfs,
|
debugfs_create_u16("l2cap_le_default_mps", 0466, bt_debugfs,
|
||||||
&le_default_mps);
|
&le_default_mps);
|
||||||
|
|
||||||
|
bt_6lowpan_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void l2cap_exit(void)
|
void l2cap_exit(void)
|
||||||
{
|
{
|
||||||
|
bt_6lowpan_cleanup();
|
||||||
debugfs_remove(l2cap_debugfs);
|
debugfs_remove(l2cap_debugfs);
|
||||||
l2cap_cleanup_sockets();
|
l2cap_cleanup_sockets();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user