Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
571277e3
Commit
571277e3
authored
Oct 16, 2002
by
Maksim Krasnyanskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consistent naming for Bluetooth HCI events, commands and parameters.
Cleanup unused HCI stuff. Optimize HCI receive path.
parent
26872595
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
219 additions
and
234 deletions
+219
-234
include/net/bluetooth/hci.h
include/net/bluetooth/hci.h
+80
-80
include/net/bluetooth/hci_core.h
include/net/bluetooth/hci_core.h
+53
-42
net/bluetooth/hci_conn.c
net/bluetooth/hci_conn.c
+11
-11
net/bluetooth/hci_core.c
net/bluetooth/hci_core.c
+17
-42
net/bluetooth/hci_event.c
net/bluetooth/hci_event.c
+52
-52
net/bluetooth/hci_sock.c
net/bluetooth/hci_sock.c
+6
-6
net/bluetooth/syms.c
net/bluetooth/syms.c
+0
-1
No files found.
include/net/bluetooth/hci.h
View file @
571277e3
...
@@ -167,7 +167,7 @@ enum {
...
@@ -167,7 +167,7 @@ enum {
#define OGF_INFO_PARAM 0x04
#define OGF_INFO_PARAM 0x04
#define OCF_READ_LOCAL_VERSION 0x0001
#define OCF_READ_LOCAL_VERSION 0x0001
struct
read_local_version_rp
{
struct
hci_rp_read_loc_version
{
__u8
status
;
__u8
status
;
__u8
hci_ver
;
__u8
hci_ver
;
__u16
hci_rev
;
__u16
hci_rev
;
...
@@ -177,13 +177,13 @@ struct read_local_version_rp {
...
@@ -177,13 +177,13 @@ struct read_local_version_rp {
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_LOCAL_FEATURES 0x0003
#define OCF_READ_LOCAL_FEATURES 0x0003
struct
read_local_features_rp
{
struct
hci_rp_read_loc_features
{
__u8
status
;
__u8
status
;
__u8
features
[
8
];
__u8
features
[
8
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_BUFFER_SIZE 0x0005
#define OCF_READ_BUFFER_SIZE 0x0005
struct
read_buffer_size_rp
{
struct
hci_rp_read_buffer_size
{
__u8
status
;
__u8
status
;
__u16
acl_mtu
;
__u16
acl_mtu
;
__u8
sco_mtu
;
__u8
sco_mtu
;
...
@@ -192,7 +192,7 @@ struct read_buffer_size_rp {
...
@@ -192,7 +192,7 @@ struct read_buffer_size_rp {
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_BD_ADDR 0x0009
#define OCF_READ_BD_ADDR 0x0009
struct
read_bd_addr_rp
{
struct
hci_rp_read_bd_addr
{
__u8
status
;
__u8
status
;
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
...
@@ -220,39 +220,39 @@ struct read_bd_addr_rp {
...
@@ -220,39 +220,39 @@ struct read_bd_addr_rp {
#define SCAN_PAGE 0x02
#define SCAN_PAGE 0x02
#define OCF_SET_EVENT_FLT 0x0005
#define OCF_SET_EVENT_FLT 0x0005
struct
set_event_flt_cp
{
struct
hci_cp_set_event_flt
{
__u8
flt_type
;
__u8
flt_type
;
__u8
cond_type
;
__u8
cond_type
;
__u8
condition
[
0
];
__u8
condition
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/* Filter types */
/* Filter types */
#define FLT_CLEAR_ALL 0x00
#define
HCI_
FLT_CLEAR_ALL 0x00
#define FLT_INQ_RESULT 0x01
#define
HCI_
FLT_INQ_RESULT 0x01
#define FLT_CONN_SETUP 0x02
#define
HCI_
FLT_CONN_SETUP 0x02
/* CONN_SETUP Condition types */
/* CONN_SETUP Condition types */
#define CONN_SETUP_ALLOW_ALL 0x00
#define
HCI_
CONN_SETUP_ALLOW_ALL 0x00
#define CONN_SETUP_ALLOW_CLASS 0x01
#define
HCI_
CONN_SETUP_ALLOW_CLASS 0x01
#define CONN_SETUP_ALLOW_BDADDR 0x02
#define
HCI_
CONN_SETUP_ALLOW_BDADDR 0x02
/* CONN_SETUP Conditions */
/* CONN_SETUP Conditions */
#define CONN_SETUP_AUTO_OFF 0x01
#define
HCI_
CONN_SETUP_AUTO_OFF 0x01
#define CONN_SETUP_AUTO_ON 0x02
#define
HCI_
CONN_SETUP_AUTO_ON 0x02
#define OCF_READ_CLASS_OF_DEV 0x0023
#define OCF_READ_CLASS_OF_DEV 0x0023
struct
read_class_of_dev_rp
{
struct
hci_rp_read_dev_class
{
__u8
status
;
__u8
status
;
__u8
dev_class
[
3
];
__u8
dev_class
[
3
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_WRITE_CLASS_OF_DEV 0x0024
#define OCF_WRITE_CLASS_OF_DEV 0x0024
struct
write_class_of_dev_cp
{
struct
hci_cp_write_dev_class
{
__u8
dev_class
[
3
];
__u8
dev_class
[
3
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_HOST_BUFFER_SIZE 0x0033
#define OCF_HOST_BUFFER_SIZE 0x0033
struct
h
ost_buffer_size_cp
{
struct
h
ci_cp_host_buffer_size
{
__u16
acl_mtu
;
__u16
acl_mtu
;
__u8
sco_mtu
;
__u8
sco_mtu
;
__u16
acl_max_pkt
;
__u16
acl_max_pkt
;
...
@@ -262,7 +262,7 @@ struct host_buffer_size_cp {
...
@@ -262,7 +262,7 @@ struct host_buffer_size_cp {
/* Link Control */
/* Link Control */
#define OGF_LINK_CTL 0x01
#define OGF_LINK_CTL 0x01
#define OCF_CREATE_CONN 0x0005
#define OCF_CREATE_CONN 0x0005
struct
create_conn_cp
{
struct
hci_cp_create_conn
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u16
pkt_type
;
__u16
pkt_type
;
__u8
pscan_rep_mode
;
__u8
pscan_rep_mode
;
...
@@ -272,31 +272,31 @@ struct create_conn_cp {
...
@@ -272,31 +272,31 @@ struct create_conn_cp {
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_ACCEPT_CONN_REQ 0x0009
#define OCF_ACCEPT_CONN_REQ 0x0009
struct
accept_conn_req_cp
{
struct
hci_cp_accept_conn_req
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
role
;
__u8
role
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_REJECT_CONN_REQ 0x000a
#define OCF_REJECT_CONN_REQ 0x000a
struct
reject_conn_req_cp
{
struct
hci_cp_reject_conn_req
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
reason
;
__u8
reason
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_DISCONNECT 0x0006
#define OCF_DISCONNECT 0x0006
struct
disconnect_cp
{
struct
hci_cp_disconnect
{
__u16
handle
;
__u16
handle
;
__u8
reason
;
__u8
reason
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_ADD_SCO 0x0007
#define OCF_ADD_SCO 0x0007
struct
add_sco_cp
{
struct
hci_cp_add_sco
{
__u16
handle
;
__u16
handle
;
__u16
pkt_type
;
__u16
pkt_type
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_INQUIRY 0x0001
#define OCF_INQUIRY 0x0001
struct
inquiry_cp
{
struct
hci_cp_inquiry
{
__u8
lap
[
3
];
__u8
lap
[
3
];
__u8
length
;
__u8
length
;
__u8
num_rsp
;
__u8
num_rsp
;
...
@@ -304,80 +304,80 @@ struct inquiry_cp {
...
@@ -304,80 +304,80 @@ struct inquiry_cp {
#define OCF_LINK_KEY_REPLY 0x000B
#define OCF_LINK_KEY_REPLY 0x000B
#define OCF_LINK_KEY_NEG_REPLY 0x000C
#define OCF_LINK_KEY_NEG_REPLY 0x000C
struct
link_key_reply_cp
{
struct
hci_cp_link_key_reply
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
link_key
[
16
];
__u8
link_key
[
16
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_PIN_CODE_REPLY 0x000D
#define OCF_PIN_CODE_REPLY 0x000D
#define OCF_PIN_CODE_NEG_REPLY 0x000E
#define OCF_PIN_CODE_NEG_REPLY 0x000E
struct
pin_code_reply_cp
{
struct
hci_cp_pin_code_reply
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
pin_len
;
__u8
pin_len
;
__u8
pin_code
[
16
];
__u8
pin_code
[
16
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_CHANGE_CONN_PTYPE 0x000F
#define OCF_CHANGE_CONN_PTYPE 0x000F
struct
change_conn_ptype_cp
{
struct
hci_cp_change_conn_ptype
{
__u16
handle
;
__u16
handle
;
__u16
pkt_type
;
__u16
pkt_type
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_AUTH_REQUESTED 0x0011
#define OCF_AUTH_REQUESTED 0x0011
struct
auth_requested_cp
{
struct
hci_cp_auth_requested
{
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_SET_CONN_ENCRYPT 0x0013
#define OCF_SET_CONN_ENCRYPT 0x0013
struct
set_conn_encrypt_cp
{
struct
hci_cp_set_conn_encrypt
{
__u16
handle
;
__u16
handle
;
__u8
encrypt
;
__u8
encrypt
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_REMOTE_FEATURES 0x001B
#define OCF_READ_REMOTE_FEATURES 0x001B
struct
read_remote_features_cp
{
struct
hci_cp_read_rmt_features
{
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_REMOTE_VERSION 0x001D
#define OCF_READ_REMOTE_VERSION 0x001D
struct
read_remote_version_cp
{
struct
hci_cp_read_rmt_version
{
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/* Link Policy */
/* Link Policy */
#define OGF_LINK_POLICY 0x02
#define OGF_LINK_POLICY 0x02
#define OCF_ROLE_DISCOVERY 0x0009
#define OCF_ROLE_DISCOVERY 0x0009
struct
role_discovery_cp
{
struct
hci_cp_role_discovery
{
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
role_discovery_rp
{
struct
hci_rp_role_discovery
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u8
role
;
__u8
role
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_READ_LINK_POLICY 0x000C
#define OCF_READ_LINK_POLICY 0x000C
struct
read_link_policy_cp
{
struct
hci_cp_read_link_policy
{
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
read_link_policy_rp
{
struct
hci_rp_read_link_policy
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u16
policy
;
__u16
policy
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_SWITCH_ROLE 0x000B
#define OCF_SWITCH_ROLE 0x000B
struct
switch_role_cp
{
struct
hci_cp_switch_role
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
role
;
__u8
role
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define OCF_WRITE_LINK_POLICY 0x000D
#define OCF_WRITE_LINK_POLICY 0x000D
struct
write_link_policy_cp
{
struct
hci_cp_write_link_policy
{
__u16
handle
;
__u16
handle
;
__u16
policy
;
__u16
policy
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
write_link_policy_rp
{
struct
hci_rp_write_link_policy
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
...
@@ -386,9 +386,9 @@ struct write_link_policy_rp {
...
@@ -386,9 +386,9 @@ struct write_link_policy_rp {
#define OGF_STATUS_PARAM 0x05
#define OGF_STATUS_PARAM 0x05
/* ---- HCI Events ---- */
/* ---- HCI Events ---- */
#define
EVT_INQUIRY_COMPLETE
0x01
#define
HCI_EV_INQUIRY_COMPLETE
0x01
#define
EVT_INQUIRY_RESULT
0x02
#define
HCI_EV_INQUIRY_RESULT
0x02
struct
inquiry_info
{
struct
inquiry_info
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
pscan_rep_mode
;
__u8
pscan_rep_mode
;
...
@@ -398,8 +398,8 @@ struct inquiry_info {
...
@@ -398,8 +398,8 @@ struct inquiry_info {
__u16
clock_offset
;
__u16
clock_offset
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_CONN_COMPLETE 0x03
#define
HCI_EV
_CONN_COMPLETE 0x03
struct
evt
_conn_complete
{
struct
hci_ev
_conn_complete
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
...
@@ -407,34 +407,34 @@ struct evt_conn_complete {
...
@@ -407,34 +407,34 @@ struct evt_conn_complete {
__u8
encr_mode
;
__u8
encr_mode
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_CONN_REQUEST 0x04
#define
HCI_EV
_CONN_REQUEST 0x04
struct
evt
_conn_request
{
struct
hci_ev
_conn_request
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
dev_class
[
3
];
__u8
dev_class
[
3
];
__u8
link_type
;
__u8
link_type
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_DISCONN_COMPLETE 0x05
#define
HCI_EV
_DISCONN_COMPLETE 0x05
struct
evt
_disconn_complete
{
struct
hci_ev
_disconn_complete
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u8
reason
;
__u8
reason
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_AUTH_COMPLETE 0x06
#define
HCI_EV
_AUTH_COMPLETE 0x06
struct
evt
_auth_complete
{
struct
hci_ev
_auth_complete
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_ENCRYPT_CHANGE 0x08
#define
HCI_EV
_ENCRYPT_CHANGE 0x08
struct
evt
_encrypt_change
{
struct
hci_ev
_encrypt_change
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u8
encrypt
;
__u8
encrypt
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_QOS_SETUP_COMPLETE 0x0D
#define
HCI_EV
_QOS_SETUP_COMPLETE 0x0D
struct
hci_qos
{
struct
hci_qos
{
__u8
service_type
;
__u8
service_type
;
__u32
token_rate
;
__u32
token_rate
;
...
@@ -442,64 +442,64 @@ struct hci_qos {
...
@@ -442,64 +442,64 @@ struct hci_qos {
__u32
latency
;
__u32
latency
;
__u32
delay_variation
;
__u32
delay_variation
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
evt
_qos_setup_complete
{
struct
hci_ev
_qos_setup_complete
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
struct
hci_qos
qos
;
struct
hci_qos
qos
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_CMD_COMPLETE 0x0e
#define
HCI_EV_CMD_COMPLETE 0x0E
struct
evt
_cmd_complete
{
struct
hci_ev
_cmd_complete
{
__u8
ncmd
;
__u8
ncmd
;
__u16
opcode
;
__u16
opcode
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_CMD_STATUS 0x0f
#define
HCI_EV_CMD_STATUS 0x0F
struct
evt
_cmd_status
{
struct
hci_ev
_cmd_status
{
__u8
status
;
__u8
status
;
__u8
ncmd
;
__u8
ncmd
;
__u16
opcode
;
__u16
opcode
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_NUM_COMP_PKTS 0x13
#define
HCI_EV
_NUM_COMP_PKTS 0x13
struct
evt
_num_comp_pkts
{
struct
hci_ev
_num_comp_pkts
{
__u8
num_hndl
;
__u8
num_hndl
;
/* variable length part */
/* variable length part */
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_ROLE_CHANGE
0x12
#define
HCI_EV_ROLE_CHANGE
0x12
struct
evt
_role_change
{
struct
hci_ev
_role_change
{
__u8
status
;
__u8
status
;
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
role
;
__u8
role
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_PIN_CODE_REQ
0x16
#define
HCI_EV_PIN_CODE_REQ
0x16
struct
evt
_pin_code_req
{
struct
hci_ev
_pin_code_req
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_LINK_KEY_REQ
0x17
#define
HCI_EV_LINK_KEY_REQ
0x17
struct
evt
_link_key_req
{
struct
hci_ev
_link_key_req
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_LINK_KEY_NOTIFY 0x18
#define
HCI_EV
_LINK_KEY_NOTIFY 0x18
struct
evt
_link_key_notify
{
struct
hci_ev
_link_key_notify
{
bdaddr_t
bdaddr
;
bdaddr_t
bdaddr
;
__u8
link_key
[
16
];
__u8
link_key
[
16
];
__u8
key_type
;
__u8
key_type
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_READ_REMOTE_FEATURES_COMPLETE
0x0B
#define
HCI_EV_RMT_FEATURES
0x0B
struct
evt_read_remote_features_complete
{
struct
hci_ev_rmt_features
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u8
features
[
8
];
__u8
features
[
8
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT_READ_REMOTE_VERSION_COMPLETE
0x0C
#define
HCI_EV_RMT_VERSION
0x0C
struct
evt_read_remote_version_complete
{
struct
hci_ev_rmt_version
{
__u8
status
;
__u8
status
;
__u16
handle
;
__u16
handle
;
__u8
lmp_ver
;
__u8
lmp_ver
;
...
@@ -508,20 +508,20 @@ struct evt_read_remote_version_complete {
...
@@ -508,20 +508,20 @@ struct evt_read_remote_version_complete {
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/* Internal events generated by Bluetooth stack */
/* Internal events generated by Bluetooth stack */
#define
EVT_STACK_INTERNAL 0xfd
#define
HCI_EV_STACK_INTERNAL 0xFD
struct
evt
_stack_internal
{
struct
hci_ev
_stack_internal
{
__u16
type
;
__u16
type
;
__u8
data
[
0
];
__u8
data
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_SI_DEVICE 0x01
#define
HCI_EV
_SI_DEVICE 0x01
struct
evt
_si_device
{
struct
hci_ev
_si_device
{
__u16
event
;
__u16
event
;
__u16
dev_id
;
__u16
dev_id
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define
EVT
_SI_SECURITY 0x02
#define
HCI_EV
_SI_SECURITY 0x02
struct
evt
_si_security
{
struct
hci_ev
_si_security
{
__u16
event
;
__u16
event
;
__u16
proto
;
__u16
proto
;
__u16
subproto
;
__u16
subproto
;
...
@@ -555,14 +555,14 @@ struct hci_sco_hdr {
...
@@ -555,14 +555,14 @@ struct hci_sco_hdr {
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/* Command opcode pack/unpack */
/* Command opcode pack/unpack */
#define
cmd
_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10))
#define
hci
_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10))
#define
cmd
_opcode_ogf(op) (op >> 10)
#define
hci
_opcode_ogf(op) (op >> 10)
#define
cmd
_opcode_ocf(op) (op & 0x03ff)
#define
hci
_opcode_ocf(op) (op & 0x03ff)
/* ACL handle and flags pack/unpack */
/* ACL handle and flags pack/unpack */
#define
acl
_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12))
#define
hci
_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12))
#define
acl
_handle(h) (h & 0x0fff)
#define
hci
_handle(h) (h & 0x0fff)
#define
acl
_flags(h) (h >> 12)
#define
hci
_flags(h) (h >> 12)
/* ---- HCI Sockets ---- */
/* ---- HCI Sockets ---- */
...
...
include/net/bluetooth/hci_core.h
View file @
571277e3
...
@@ -51,7 +51,7 @@ struct inquiry_cache {
...
@@ -51,7 +51,7 @@ struct inquiry_cache {
struct
inquiry_entry
*
list
;
struct
inquiry_entry
*
list
;
};
};
struct
conn_hash
{
struct
hci_
conn_hash
{
struct
list_head
list
;
struct
list_head
list
;
spinlock_t
lock
;
spinlock_t
lock
;
unsigned
int
num
;
unsigned
int
num
;
...
@@ -102,7 +102,7 @@ struct hci_dev {
...
@@ -102,7 +102,7 @@ struct hci_dev {
__u32
req_result
;
__u32
req_result
;
struct
inquiry_cache
inq_cache
;
struct
inquiry_cache
inq_cache
;
struct
conn_hash
conn_hash
;
struct
hci_
conn_hash
conn_hash
;
struct
hci_dev_stats
stat
;
struct
hci_dev_stats
stat
;
...
@@ -189,44 +189,34 @@ enum {
...
@@ -189,44 +189,34 @@ enum {
HCI_CONN_ENCRYPT_PEND
HCI_CONN_ENCRYPT_PEND
};
};
#define hci_conn_lock(c) spin_lock(&c->lock)
static
inline
void
hci_conn_hash_init
(
struct
hci_dev
*
hdev
)
#define hci_conn_unlock(c) spin_unlock(&c->lock)
#define hci_conn_lock_bh(c) spin_lock_bh(&c->lock)
#define hci_conn_unlock_bh(c) spin_unlock_bh(&c->lock)
#define conn_hash_lock(d) spin_lock(&d->conn_hash->lock)
#define conn_hash_unlock(d) spin_unlock(&d->conn_hash->lock)
#define conn_hash_lock_bh(d) spin_lock_bh(&d->conn_hash->lock)
#define conn_hash_unlock_bh(d) spin_unlock_bh(&d->conn_hash->lock)
static
inline
void
conn_hash_init
(
struct
hci_dev
*
hdev
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
INIT_LIST_HEAD
(
&
h
->
list
);
INIT_LIST_HEAD
(
&
h
->
list
);
spin_lock_init
(
&
h
->
lock
);
spin_lock_init
(
&
h
->
lock
);
h
->
num
=
0
;
h
->
num
=
0
;
}
}
static
inline
void
conn_hash_add
(
struct
hci_dev
*
hdev
,
struct
hci_conn
*
c
)
static
inline
void
hci_
conn_hash_add
(
struct
hci_dev
*
hdev
,
struct
hci_conn
*
c
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
list_add
(
&
c
->
list
,
&
h
->
list
);
list_add
(
&
c
->
list
,
&
h
->
list
);
h
->
num
++
;
h
->
num
++
;
}
}
static
inline
void
conn_hash_del
(
struct
hci_dev
*
hdev
,
struct
hci_conn
*
c
)
static
inline
void
hci_
conn_hash_del
(
struct
hci_dev
*
hdev
,
struct
hci_conn
*
c
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
list_del
(
&
c
->
list
);
list_del
(
&
c
->
list
);
h
->
num
--
;
h
->
num
--
;
}
}
static
inline
struct
hci_conn
*
conn_hash_lookup_handle
(
struct
hci_dev
*
hdev
,
static
inline
struct
hci_conn
*
hci_
conn_hash_lookup_handle
(
struct
hci_dev
*
hdev
,
__u16
handle
)
__u16
handle
)
{
{
register
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
register
struct
list_head
*
p
;
struct
list_head
*
p
;
register
struct
hci_conn
*
c
;
struct
hci_conn
*
c
;
list_for_each
(
p
,
&
h
->
list
)
{
list_for_each
(
p
,
&
h
->
list
)
{
c
=
list_entry
(
p
,
struct
hci_conn
,
list
);
c
=
list_entry
(
p
,
struct
hci_conn
,
list
);
...
@@ -236,12 +226,12 @@ static inline struct hci_conn *conn_hash_lookup_handle(struct hci_dev *hdev,
...
@@ -236,12 +226,12 @@ static inline struct hci_conn *conn_hash_lookup_handle(struct hci_dev *hdev,
return
NULL
;
return
NULL
;
}
}
static
inline
struct
hci_conn
*
conn_hash_lookup_ba
(
struct
hci_dev
*
hdev
,
static
inline
struct
hci_conn
*
hci_
conn_hash_lookup_ba
(
struct
hci_dev
*
hdev
,
__u8
type
,
bdaddr_t
*
ba
)
__u8
type
,
bdaddr_t
*
ba
)
{
{
register
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
register
struct
list_head
*
p
;
struct
list_head
*
p
;
register
struct
hci_conn
*
c
;
struct
hci_conn
*
c
;
list_for_each
(
p
,
&
h
->
list
)
{
list_for_each
(
p
,
&
h
->
list
)
{
c
=
list_entry
(
p
,
struct
hci_conn
,
list
);
c
=
list_entry
(
p
,
struct
hci_conn
,
list
);
...
@@ -285,6 +275,22 @@ static inline void hci_conn_put(struct hci_conn *conn)
...
@@ -285,6 +275,22 @@ static inline void hci_conn_put(struct hci_conn *conn)
hci_conn_set_timer
(
conn
,
HCI_DISCONN_TIMEOUT
);
hci_conn_set_timer
(
conn
,
HCI_DISCONN_TIMEOUT
);
}
}
/* ----- HCI tasks ----- */
static
inline
void
hci_sched_cmd
(
struct
hci_dev
*
hdev
)
{
tasklet_schedule
(
&
hdev
->
cmd_task
);
}
static
inline
void
hci_sched_rx
(
struct
hci_dev
*
hdev
)
{
tasklet_schedule
(
&
hdev
->
rx_task
);
}
static
inline
void
hci_sched_tx
(
struct
hci_dev
*
hdev
)
{
tasklet_schedule
(
&
hdev
->
tx_task
);
}
/* ----- HCI Devices ----- */
/* ----- HCI Devices ----- */
static
inline
void
hci_dev_put
(
struct
hci_dev
*
d
)
static
inline
void
hci_dev_put
(
struct
hci_dev
*
d
)
{
{
...
@@ -315,29 +321,34 @@ int hci_get_conn_list(unsigned long arg);
...
@@ -315,29 +321,34 @@ int hci_get_conn_list(unsigned long arg);
int
hci_get_conn_info
(
struct
hci_dev
*
hdev
,
unsigned
long
arg
);
int
hci_get_conn_info
(
struct
hci_dev
*
hdev
,
unsigned
long
arg
);
int
hci_inquiry
(
unsigned
long
arg
);
int
hci_inquiry
(
unsigned
long
arg
);
int
hci_recv_frame
(
struct
sk_buff
*
skb
);
void
hci_event_packet
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
);
void
hci_event_packet
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
);
/* ----- LMP capabilities ----- */
/* Receive frame from HCI drivers */
#define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH)
static
inline
int
hci_recv_frame
(
struct
sk_buff
*
skb
)
#define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT)
/* ----- HCI tasks ----- */
static
inline
void
hci_sched_cmd
(
struct
hci_dev
*
hdev
)
{
{
tasklet_schedule
(
&
hdev
->
cmd_task
);
struct
hci_dev
*
hdev
=
(
struct
hci_dev
*
)
skb
->
dev
;
}
if
(
!
hdev
||
(
!
test_bit
(
HCI_UP
,
&
hdev
->
flags
)
&&
!
test_bit
(
HCI_INIT
,
&
hdev
->
flags
)))
{
kfree_skb
(
skb
);
return
-
ENXIO
;
}
static
inline
void
hci_sched_rx
(
struct
hci_dev
*
hdev
)
/* Incomming skb */
{
bt_cb
(
skb
)
->
incoming
=
1
;
tasklet_schedule
(
&
hdev
->
rx_task
);
}
static
inline
void
hci_sched_tx
(
struct
hci_dev
*
hdev
)
/* Time stamp */
{
do_gettimeofday
(
&
skb
->
stamp
);
tasklet_schedule
(
&
hdev
->
tx_task
);
/* Queue frame for rx task */
skb_queue_tail
(
&
hdev
->
rx_q
,
skb
);
hci_sched_rx
(
hdev
);
return
0
;
}
}
/* ----- LMP capabilities ----- */
#define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH)
#define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT)
/* ----- HCI protocols ----- */
/* ----- HCI protocols ----- */
struct
hci_proto
{
struct
hci_proto
{
char
*
name
;
char
*
name
;
...
...
net/bluetooth/hci_conn.c
View file @
571277e3
...
@@ -61,7 +61,7 @@ void hci_acl_connect(struct hci_conn *conn)
...
@@ -61,7 +61,7 @@ void hci_acl_connect(struct hci_conn *conn)
{
{
struct
hci_dev
*
hdev
=
conn
->
hdev
;
struct
hci_dev
*
hdev
=
conn
->
hdev
;
struct
inquiry_entry
*
ie
;
struct
inquiry_entry
*
ie
;
struct
create_conn_cp
cp
;
struct
hci_cp_create_conn
cp
;
BT_DBG
(
"%p"
,
conn
);
BT_DBG
(
"%p"
,
conn
);
...
@@ -90,7 +90,7 @@ void hci_acl_connect(struct hci_conn *conn)
...
@@ -90,7 +90,7 @@ void hci_acl_connect(struct hci_conn *conn)
void
hci_acl_disconn
(
struct
hci_conn
*
conn
,
__u8
reason
)
void
hci_acl_disconn
(
struct
hci_conn
*
conn
,
__u8
reason
)
{
{
struct
disconnect_cp
cp
;
struct
hci_cp_disconnect
cp
;
BT_DBG
(
"%p"
,
conn
);
BT_DBG
(
"%p"
,
conn
);
...
@@ -104,7 +104,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
...
@@ -104,7 +104,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
void
hci_add_sco
(
struct
hci_conn
*
conn
,
__u16
handle
)
void
hci_add_sco
(
struct
hci_conn
*
conn
,
__u16
handle
)
{
{
struct
hci_dev
*
hdev
=
conn
->
hdev
;
struct
hci_dev
*
hdev
=
conn
->
hdev
;
struct
add_sco_cp
cp
;
struct
hci_cp_add_sco
cp
;
BT_DBG
(
"%p"
,
conn
);
BT_DBG
(
"%p"
,
conn
);
...
@@ -166,7 +166,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
...
@@ -166,7 +166,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
hci_dev_hold
(
hdev
);
hci_dev_hold
(
hdev
);
tasklet_disable
(
&
hdev
->
tx_task
);
tasklet_disable
(
&
hdev
->
tx_task
);
conn_hash_add
(
hdev
,
conn
);
hci_
conn_hash_add
(
hdev
,
conn
);
tasklet_enable
(
&
hdev
->
tx_task
);
tasklet_enable
(
&
hdev
->
tx_task
);
return
conn
;
return
conn
;
...
@@ -196,7 +196,7 @@ int hci_conn_del(struct hci_conn *conn)
...
@@ -196,7 +196,7 @@ int hci_conn_del(struct hci_conn *conn)
}
}
tasklet_disable
(
&
hdev
->
tx_task
);
tasklet_disable
(
&
hdev
->
tx_task
);
conn_hash_del
(
hdev
,
conn
);
hci_
conn_hash_del
(
hdev
,
conn
);
tasklet_enable
(
&
hdev
->
tx_task
);
tasklet_enable
(
&
hdev
->
tx_task
);
skb_queue_purge
(
&
conn
->
data_q
);
skb_queue_purge
(
&
conn
->
data_q
);
...
@@ -255,7 +255,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
...
@@ -255,7 +255,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
BT_DBG
(
"%s dst %s"
,
hdev
->
name
,
batostr
(
dst
));
BT_DBG
(
"%s dst %s"
,
hdev
->
name
,
batostr
(
dst
));
if
(
!
(
acl
=
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
dst
)))
{
if
(
!
(
acl
=
hci_
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
dst
)))
{
if
(
!
(
acl
=
hci_conn_add
(
hdev
,
ACL_LINK
,
dst
)))
if
(
!
(
acl
=
hci_conn_add
(
hdev
,
ACL_LINK
,
dst
)))
return
NULL
;
return
NULL
;
}
}
...
@@ -268,7 +268,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
...
@@ -268,7 +268,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
if
(
type
==
SCO_LINK
)
{
if
(
type
==
SCO_LINK
)
{
struct
hci_conn
*
sco
;
struct
hci_conn
*
sco
;
if
(
!
(
sco
=
conn_hash_lookup_ba
(
hdev
,
SCO_LINK
,
dst
)))
{
if
(
!
(
sco
=
hci_
conn_hash_lookup_ba
(
hdev
,
SCO_LINK
,
dst
)))
{
if
(
!
(
sco
=
hci_conn_add
(
hdev
,
SCO_LINK
,
dst
)))
{
if
(
!
(
sco
=
hci_conn_add
(
hdev
,
SCO_LINK
,
dst
)))
{
hci_conn_put
(
acl
);
hci_conn_put
(
acl
);
return
NULL
;
return
NULL
;
...
@@ -298,7 +298,7 @@ int hci_conn_auth(struct hci_conn *conn)
...
@@ -298,7 +298,7 @@ int hci_conn_auth(struct hci_conn *conn)
return
1
;
return
1
;
if
(
!
test_and_set_bit
(
HCI_CONN_AUTH_PEND
,
&
conn
->
pend
))
{
if
(
!
test_and_set_bit
(
HCI_CONN_AUTH_PEND
,
&
conn
->
pend
))
{
struct
auth_requested_cp
cp
;
struct
hci_cp_auth_requested
cp
;
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
OCF_AUTH_REQUESTED
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
OCF_AUTH_REQUESTED
,
sizeof
(
cp
),
&
cp
);
}
}
...
@@ -317,7 +317,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
...
@@ -317,7 +317,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
return
0
;
return
0
;
if
(
hci_conn_auth
(
conn
))
{
if
(
hci_conn_auth
(
conn
))
{
struct
set_conn_encrypt_cp
cp
;
struct
hci_cp_set_conn_encrypt
cp
;
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
cp
.
encrypt
=
1
;
cp
.
encrypt
=
1
;
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
OCF_SET_CONN_ENCRYPT
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
OCF_SET_CONN_ENCRYPT
,
sizeof
(
cp
),
&
cp
);
...
@@ -328,7 +328,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
...
@@ -328,7 +328,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
/* Drop all connection on the device */
/* Drop all connection on the device */
void
hci_conn_hash_flush
(
struct
hci_dev
*
hdev
)
void
hci_conn_hash_flush
(
struct
hci_dev
*
hdev
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
list_head
*
p
;
struct
list_head
*
p
;
BT_DBG
(
"hdev %s"
,
hdev
->
name
);
BT_DBG
(
"hdev %s"
,
hdev
->
name
);
...
@@ -411,7 +411,7 @@ int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg)
...
@@ -411,7 +411,7 @@ int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg)
return
-
EFAULT
;
return
-
EFAULT
;
hci_dev_lock_bh
(
hdev
);
hci_dev_lock_bh
(
hdev
);
conn
=
conn_hash_lookup_ba
(
hdev
,
req
.
type
,
&
req
.
bdaddr
);
conn
=
hci_
conn_hash_lookup_ba
(
hdev
,
req
.
type
,
&
req
.
bdaddr
);
if
(
conn
)
{
if
(
conn
)
{
bacpy
(
&
ci
.
bdaddr
,
&
conn
->
dst
);
bacpy
(
&
ci
.
bdaddr
,
&
conn
->
dst
);
ci
.
handle
=
conn
->
handle
;
ci
.
handle
=
conn
->
handle
;
...
...
net/bluetooth/hci_core.c
View file @
571277e3
...
@@ -145,7 +145,8 @@ void hci_req_cancel(struct hci_dev *hdev, int err)
...
@@ -145,7 +145,8 @@ void hci_req_cancel(struct hci_dev *hdev, int err)
}
}
/* Execute request and wait for completion. */
/* Execute request and wait for completion. */
static
int
__hci_request
(
struct
hci_dev
*
hdev
,
void
(
*
req
)(
struct
hci_dev
*
hdev
,
unsigned
long
opt
),
unsigned
long
opt
,
__u32
timeout
)
static
int
__hci_request
(
struct
hci_dev
*
hdev
,
void
(
*
req
)(
struct
hci_dev
*
hdev
,
unsigned
long
opt
),
unsigned
long
opt
,
__u32
timeout
)
{
{
DECLARE_WAITQUEUE
(
wait
,
current
);
DECLARE_WAITQUEUE
(
wait
,
current
);
int
err
=
0
;
int
err
=
0
;
...
@@ -225,7 +226,7 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
...
@@ -225,7 +226,7 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
#if 0
#if 0
/* Host buffer size */
/* Host buffer size */
{
{
struct h
ost_buffer_size_cp
cp;
struct h
ci_cp_host_buffer_size
cp;
cp.acl_mtu = __cpu_to_le16(HCI_MAX_ACL_SIZE);
cp.acl_mtu = __cpu_to_le16(HCI_MAX_ACL_SIZE);
cp.sco_mtu = HCI_MAX_SCO_SIZE;
cp.sco_mtu = HCI_MAX_SCO_SIZE;
cp.acl_max_pkt = __cpu_to_le16(0xffff);
cp.acl_max_pkt = __cpu_to_le16(0xffff);
...
@@ -241,8 +242,8 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
...
@@ -241,8 +242,8 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
/* Clear Event Filters */
/* Clear Event Filters */
{
{
struct
set_event_flt_cp
cp
;
struct
hci_cp_set_event_flt
cp
;
cp
.
flt_type
=
FLT_CLEAR_ALL
;
cp
.
flt_type
=
HCI_
FLT_CLEAR_ALL
;
hci_send_cmd
(
hdev
,
OGF_HOST_CTL
,
OCF_SET_EVENT_FLT
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
OGF_HOST_CTL
,
OCF_SET_EVENT_FLT
,
sizeof
(
cp
),
&
cp
);
}
}
...
@@ -377,7 +378,7 @@ int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf)
...
@@ -377,7 +378,7 @@ int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf)
static
void
hci_inq_req
(
struct
hci_dev
*
hdev
,
unsigned
long
opt
)
static
void
hci_inq_req
(
struct
hci_dev
*
hdev
,
unsigned
long
opt
)
{
{
struct
hci_inquiry_req
*
ir
=
(
struct
hci_inquiry_req
*
)
opt
;
struct
hci_inquiry_req
*
ir
=
(
struct
hci_inquiry_req
*
)
opt
;
struct
inquiry_cp
cp
;
struct
hci_cp_inquiry
cp
;
BT_DBG
(
"%s"
,
hdev
->
name
);
BT_DBG
(
"%s"
,
hdev
->
name
);
...
@@ -781,7 +782,6 @@ int hci_get_dev_info(unsigned long arg)
...
@@ -781,7 +782,6 @@ int hci_get_dev_info(unsigned long arg)
return
err
;
return
err
;
}
}
/* ---- Interface to HCI drivers ---- */
/* ---- Interface to HCI drivers ---- */
/* Register HCI device */
/* Register HCI device */
...
@@ -828,7 +828,7 @@ int hci_register_dev(struct hci_dev *hdev)
...
@@ -828,7 +828,7 @@ int hci_register_dev(struct hci_dev *hdev)
inquiry_cache_init
(
hdev
);
inquiry_cache_init
(
hdev
);
conn_hash_init
(
hdev
);
hci_
conn_hash_init
(
hdev
);
memset
(
&
hdev
->
stat
,
0
,
sizeof
(
struct
hci_dev_stats
));
memset
(
&
hdev
->
stat
,
0
,
sizeof
(
struct
hci_dev_stats
));
...
@@ -880,31 +880,6 @@ int hci_resume_dev(struct hci_dev *hdev)
...
@@ -880,31 +880,6 @@ int hci_resume_dev(struct hci_dev *hdev)
return
0
;
return
0
;
}
}
/* Receive frame from HCI drivers */
int
hci_recv_frame
(
struct
sk_buff
*
skb
)
{
struct
hci_dev
*
hdev
=
(
struct
hci_dev
*
)
skb
->
dev
;
if
(
!
hdev
||
(
!
test_bit
(
HCI_UP
,
&
hdev
->
flags
)
&&
!
test_bit
(
HCI_INIT
,
&
hdev
->
flags
))
)
{
kfree_skb
(
skb
);
return
-
1
;
}
BT_DBG
(
"%s type %d len %d"
,
hdev
->
name
,
skb
->
pkt_type
,
skb
->
len
);
/* Incomming skb */
bt_cb
(
skb
)
->
incoming
=
1
;
/* Time stamp */
do_gettimeofday
(
&
skb
->
stamp
);
/* Queue frame for rx task */
skb_queue_tail
(
&
hdev
->
rx_q
,
skb
);
hci_sched_rx
(
hdev
);
return
0
;
}
/* ---- Interface to upper protocols ---- */
/* ---- Interface to upper protocols ---- */
/* Register/Unregister protocols.
/* Register/Unregister protocols.
...
@@ -1025,7 +1000,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p
...
@@ -1025,7 +1000,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p
}
}
hdr
=
(
struct
hci_command_hdr
*
)
skb_put
(
skb
,
HCI_COMMAND_HDR_SIZE
);
hdr
=
(
struct
hci_command_hdr
*
)
skb_put
(
skb
,
HCI_COMMAND_HDR_SIZE
);
hdr
->
opcode
=
__cpu_to_le16
(
cmd
_opcode_pack
(
ogf
,
ocf
));
hdr
->
opcode
=
__cpu_to_le16
(
hci
_opcode_pack
(
ogf
,
ocf
));
hdr
->
plen
=
plen
;
hdr
->
plen
=
plen
;
if
(
plen
)
if
(
plen
)
...
@@ -1051,7 +1026,7 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
...
@@ -1051,7 +1026,7 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
hdr
=
(
void
*
)
hdev
->
sent_cmd
->
data
;
hdr
=
(
void
*
)
hdev
->
sent_cmd
->
data
;
if
(
hdr
->
opcode
!=
__cpu_to_le16
(
cmd
_opcode_pack
(
ogf
,
ocf
)))
if
(
hdr
->
opcode
!=
__cpu_to_le16
(
hci
_opcode_pack
(
ogf
,
ocf
)))
return
NULL
;
return
NULL
;
BT_DBG
(
"%s ogf 0x%x ocf 0x%x"
,
hdev
->
name
,
ogf
,
ocf
);
BT_DBG
(
"%s ogf 0x%x ocf 0x%x"
,
hdev
->
name
,
ogf
,
ocf
);
...
@@ -1066,7 +1041,7 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags)
...
@@ -1066,7 +1041,7 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags)
int
len
=
skb
->
len
;
int
len
=
skb
->
len
;
hdr
=
(
struct
hci_acl_hdr
*
)
skb_push
(
skb
,
HCI_ACL_HDR_SIZE
);
hdr
=
(
struct
hci_acl_hdr
*
)
skb_push
(
skb
,
HCI_ACL_HDR_SIZE
);
hdr
->
handle
=
__cpu_to_le16
(
acl
_handle_pack
(
handle
,
flags
));
hdr
->
handle
=
__cpu_to_le16
(
hci
_handle_pack
(
handle
,
flags
));
hdr
->
dlen
=
__cpu_to_le16
(
len
);
hdr
->
dlen
=
__cpu_to_le16
(
len
);
skb
->
h
.
raw
=
(
void
*
)
hdr
;
skb
->
h
.
raw
=
(
void
*
)
hdr
;
...
@@ -1148,7 +1123,7 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
...
@@ -1148,7 +1123,7 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
/* HCI Connection scheduler */
/* HCI Connection scheduler */
static
inline
struct
hci_conn
*
hci_low_sent
(
struct
hci_dev
*
hdev
,
__u8
type
,
int
*
quote
)
static
inline
struct
hci_conn
*
hci_low_sent
(
struct
hci_dev
*
hdev
,
__u8
type
,
int
*
quote
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
int
num
=
0
,
min
=
~
0
;
int
num
=
0
,
min
=
~
0
;
struct
list_head
*
p
;
struct
list_head
*
p
;
...
@@ -1183,7 +1158,7 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
...
@@ -1183,7 +1158,7 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
static
inline
void
hci_acl_tx_to
(
struct
hci_dev
*
hdev
)
static
inline
void
hci_acl_tx_to
(
struct
hci_dev
*
hdev
)
{
{
struct
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
hci_
conn_hash
*
h
=
&
hdev
->
conn_hash
;
struct
list_head
*
p
;
struct
list_head
*
p
;
struct
hci_conn
*
c
;
struct
hci_conn
*
c
;
...
@@ -1280,15 +1255,15 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -1280,15 +1255,15 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
skb_pull
(
skb
,
HCI_ACL_HDR_SIZE
);
skb_pull
(
skb
,
HCI_ACL_HDR_SIZE
);
handle
=
__le16_to_cpu
(
hdr
->
handle
);
handle
=
__le16_to_cpu
(
hdr
->
handle
);
flags
=
acl
_flags
(
handle
);
flags
=
hci
_flags
(
handle
);
handle
=
acl
_handle
(
handle
);
handle
=
hci
_handle
(
handle
);
BT_DBG
(
"%s len %d handle 0x%x flags 0x%x"
,
hdev
->
name
,
skb
->
len
,
handle
,
flags
);
BT_DBG
(
"%s len %d handle 0x%x flags 0x%x"
,
hdev
->
name
,
skb
->
len
,
handle
,
flags
);
hdev
->
stat
.
acl_rx
++
;
hdev
->
stat
.
acl_rx
++
;
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
hci_dev_unlock
(
hdev
);
hci_dev_unlock
(
hdev
);
if
(
conn
)
{
if
(
conn
)
{
...
@@ -1323,7 +1298,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -1323,7 +1298,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
hdev
->
stat
.
sco_rx
++
;
hdev
->
stat
.
sco_rx
++
;
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
hci_dev_unlock
(
hdev
);
hci_dev_unlock
(
hdev
);
if
(
conn
)
{
if
(
conn
)
{
...
...
net/bluetooth/hci_event.c
View file @
571277e3
...
@@ -75,7 +75,7 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
...
@@ -75,7 +75,7 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
static
void
hci_cc_link_policy
(
struct
hci_dev
*
hdev
,
__u16
ocf
,
struct
sk_buff
*
skb
)
static
void
hci_cc_link_policy
(
struct
hci_dev
*
hdev
,
__u16
ocf
,
struct
sk_buff
*
skb
)
{
{
struct
hci_conn
*
conn
;
struct
hci_conn
*
conn
;
struct
role_discovery_rp
*
rd
;
struct
hci_rp_role_discovery
*
rd
;
BT_DBG
(
"%s ocf 0x%x"
,
hdev
->
name
,
ocf
);
BT_DBG
(
"%s ocf 0x%x"
,
hdev
->
name
,
ocf
);
...
@@ -88,7 +88,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff *
...
@@ -88,7 +88,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff *
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
__le16_to_cpu
(
rd
->
handle
));
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
__le16_to_cpu
(
rd
->
handle
));
if
(
conn
)
{
if
(
conn
)
{
if
(
rd
->
role
)
if
(
rd
->
role
)
conn
->
link_mode
&=
~
HCI_LM_MASTER
;
conn
->
link_mode
&=
~
HCI_LM_MASTER
;
...
@@ -219,15 +219,15 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
...
@@ -219,15 +219,15 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
/* Command Complete OGF INFO_PARAM */
/* Command Complete OGF INFO_PARAM */
static
void
hci_cc_info_param
(
struct
hci_dev
*
hdev
,
__u16
ocf
,
struct
sk_buff
*
skb
)
static
void
hci_cc_info_param
(
struct
hci_dev
*
hdev
,
__u16
ocf
,
struct
sk_buff
*
skb
)
{
{
struct
read_local_features_rp
*
lf
;
struct
hci_rp_read_loc_features
*
lf
;
struct
read_buffer_size_rp
*
bs
;
struct
hci_rp_read_buffer_size
*
bs
;
struct
read_bd_addr_rp
*
ba
;
struct
hci_rp_read_bd_addr
*
ba
;
BT_DBG
(
"%s ocf 0x%x"
,
hdev
->
name
,
ocf
);
BT_DBG
(
"%s ocf 0x%x"
,
hdev
->
name
,
ocf
);
switch
(
ocf
)
{
switch
(
ocf
)
{
case
OCF_READ_LOCAL_FEATURES
:
case
OCF_READ_LOCAL_FEATURES
:
lf
=
(
struct
read_local_features_rp
*
)
skb
->
data
;
lf
=
(
struct
hci_rp_read_loc_features
*
)
skb
->
data
;
if
(
lf
->
status
)
{
if
(
lf
->
status
)
{
BT_DBG
(
"%s READ_LOCAL_FEATURES failed %d"
,
hdev
->
name
,
lf
->
status
);
BT_DBG
(
"%s READ_LOCAL_FEATURES failed %d"
,
hdev
->
name
,
lf
->
status
);
...
@@ -255,7 +255,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
...
@@ -255,7 +255,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
break
;
break
;
case
OCF_READ_BUFFER_SIZE
:
case
OCF_READ_BUFFER_SIZE
:
bs
=
(
struct
read_buffer_size_rp
*
)
skb
->
data
;
bs
=
(
struct
hci_rp_read_buffer_size
*
)
skb
->
data
;
if
(
bs
->
status
)
{
if
(
bs
->
status
)
{
BT_DBG
(
"%s READ_BUFFER_SIZE failed %d"
,
hdev
->
name
,
bs
->
status
);
BT_DBG
(
"%s READ_BUFFER_SIZE failed %d"
,
hdev
->
name
,
bs
->
status
);
...
@@ -273,7 +273,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
...
@@ -273,7 +273,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
break
;
break
;
case
OCF_READ_BD_ADDR
:
case
OCF_READ_BD_ADDR
:
ba
=
(
struct
read_bd_addr_rp
*
)
skb
->
data
;
ba
=
(
struct
hci_rp_read_bd_addr
*
)
skb
->
data
;
if
(
!
ba
->
status
)
{
if
(
!
ba
->
status
)
{
bacpy
(
&
hdev
->
bdaddr
,
&
ba
->
bdaddr
);
bacpy
(
&
hdev
->
bdaddr
,
&
ba
->
bdaddr
);
...
@@ -294,14 +294,14 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
...
@@ -294,14 +294,14 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
static
inline
void
hci_cs_create_conn
(
struct
hci_dev
*
hdev
,
__u8
status
)
static
inline
void
hci_cs_create_conn
(
struct
hci_dev
*
hdev
,
__u8
status
)
{
{
struct
hci_conn
*
conn
;
struct
hci_conn
*
conn
;
struct
create_conn_cp
*
cp
=
hci_sent_cmd_data
(
hdev
,
OGF_LINK_CTL
,
OCF_CREATE_CONN
);
struct
hci_cp_create_conn
*
cp
=
hci_sent_cmd_data
(
hdev
,
OGF_LINK_CTL
,
OCF_CREATE_CONN
);
if
(
!
cp
)
if
(
!
cp
)
return
;
return
;
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
cp
->
bdaddr
);
conn
=
hci_
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
cp
->
bdaddr
);
BT_DBG
(
"%s status 0x%x bdaddr %s conn %p"
,
hdev
->
name
,
BT_DBG
(
"%s status 0x%x bdaddr %s conn %p"
,
hdev
->
name
,
status
,
batostr
(
&
cc
->
bdaddr
),
conn
);
status
,
batostr
(
&
cc
->
bdaddr
),
conn
);
...
@@ -338,7 +338,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status)
...
@@ -338,7 +338,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status)
case
OCF_ADD_SCO
:
case
OCF_ADD_SCO
:
if
(
status
)
{
if
(
status
)
{
struct
hci_conn
*
acl
,
*
sco
;
struct
hci_conn
*
acl
,
*
sco
;
struct
add_sco_cp
*
cp
=
hci_sent_cmd_data
(
hdev
,
OGF_LINK_CTL
,
OCF_ADD_SCO
);
struct
hci_cp_add_sco
*
cp
=
hci_sent_cmd_data
(
hdev
,
OGF_LINK_CTL
,
OCF_ADD_SCO
);
__u16
handle
;
__u16
handle
;
if
(
!
cp
)
if
(
!
cp
)
...
@@ -350,7 +350,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status)
...
@@ -350,7 +350,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status)
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
acl
=
conn_hash_lookup_handle
(
hdev
,
handle
);
acl
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
if
(
acl
&&
(
sco
=
acl
->
link
))
{
if
(
acl
&&
(
sco
=
acl
->
link
))
{
sco
->
state
=
BT_CLOSED
;
sco
->
state
=
BT_CLOSED
;
...
@@ -442,7 +442,7 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
...
@@ -442,7 +442,7 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
/* Connect Request */
/* Connect Request */
static
inline
void
hci_conn_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_conn_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_conn_request
*
ev
=
(
struct
evt
_conn_request
*
)
skb
->
data
;
struct
hci_ev_conn_request
*
ev
=
(
struct
hci_ev
_conn_request
*
)
skb
->
data
;
int
mask
=
hdev
->
link_mode
;
int
mask
=
hdev
->
link_mode
;
BT_DBG
(
"%s Connection request: %s type 0x%x"
,
hdev
->
name
,
BT_DBG
(
"%s Connection request: %s type 0x%x"
,
hdev
->
name
,
...
@@ -453,10 +453,10 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
...
@@ -453,10 +453,10 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
if
(
mask
&
HCI_LM_ACCEPT
)
{
if
(
mask
&
HCI_LM_ACCEPT
)
{
/* Connection accepted */
/* Connection accepted */
struct
hci_conn
*
conn
;
struct
hci_conn
*
conn
;
struct
accept_conn_req_cp
cp
;
struct
hci_cp_accept_conn_req
cp
;
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_ba
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
);
conn
=
hci_
conn_hash_lookup_ba
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
);
if
(
!
conn
)
{
if
(
!
conn
)
{
if
(
!
(
conn
=
hci_conn_add
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
)))
{
if
(
!
(
conn
=
hci_conn_add
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
)))
{
BT_ERR
(
"No memmory for new connection"
);
BT_ERR
(
"No memmory for new connection"
);
...
@@ -477,7 +477,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
...
@@ -477,7 +477,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
hci_send_cmd
(
hdev
,
OGF_LINK_CTL
,
OCF_ACCEPT_CONN_REQ
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
OGF_LINK_CTL
,
OCF_ACCEPT_CONN_REQ
,
sizeof
(
cp
),
&
cp
);
}
else
{
}
else
{
/* Connection rejected */
/* Connection rejected */
struct
reject_conn_req_cp
cp
;
struct
hci_cp_reject_conn_req
cp
;
bacpy
(
&
cp
.
bdaddr
,
&
ev
->
bdaddr
);
bacpy
(
&
cp
.
bdaddr
,
&
ev
->
bdaddr
);
cp
.
reason
=
0x0f
;
cp
.
reason
=
0x0f
;
...
@@ -488,14 +488,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
...
@@ -488,14 +488,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
/* Connect Complete */
/* Connect Complete */
static
inline
void
hci_conn_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_conn_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_conn_complete
*
ev
=
(
struct
evt
_conn_complete
*
)
skb
->
data
;
struct
hci_ev_conn_complete
*
ev
=
(
struct
hci_ev
_conn_complete
*
)
skb
->
data
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
BT_DBG
(
"%s"
,
hdev
->
name
);
BT_DBG
(
"%s"
,
hdev
->
name
);
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_ba
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
);
conn
=
hci_
conn_hash_lookup_ba
(
hdev
,
ev
->
link_type
,
&
ev
->
bdaddr
);
if
(
!
conn
)
{
if
(
!
conn
)
{
hci_dev_unlock
(
hdev
);
hci_dev_unlock
(
hdev
);
return
;
return
;
...
@@ -514,7 +514,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -514,7 +514,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
/* Set link policy */
/* Set link policy */
if
(
conn
->
type
==
ACL_LINK
&&
hdev
->
link_policy
)
{
if
(
conn
->
type
==
ACL_LINK
&&
hdev
->
link_policy
)
{
struct
write_link_policy_cp
cp
;
struct
hci_cp_write_link_policy
cp
;
cp
.
handle
=
ev
->
handle
;
cp
.
handle
=
ev
->
handle
;
cp
.
policy
=
__cpu_to_le16
(
hdev
->
link_policy
);
cp
.
policy
=
__cpu_to_le16
(
hdev
->
link_policy
);
hci_send_cmd
(
hdev
,
OGF_LINK_POLICY
,
OCF_WRITE_LINK_POLICY
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
OGF_LINK_POLICY
,
OCF_WRITE_LINK_POLICY
,
sizeof
(
cp
),
&
cp
);
...
@@ -522,7 +522,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -522,7 +522,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
/* Set packet type for incomming connection */
/* Set packet type for incomming connection */
if
(
!
conn
->
out
)
{
if
(
!
conn
->
out
)
{
struct
change_conn_ptype_cp
cp
;
struct
hci_cp_change_conn_ptype
cp
;
cp
.
handle
=
ev
->
handle
;
cp
.
handle
=
ev
->
handle
;
cp
.
pkt_type
=
(
conn
->
type
==
ACL_LINK
)
?
cp
.
pkt_type
=
(
conn
->
type
==
ACL_LINK
)
?
__cpu_to_le16
(
hdev
->
pkt_type
&
ACL_PTYPE_MASK
)
:
__cpu_to_le16
(
hdev
->
pkt_type
&
ACL_PTYPE_MASK
)
:
...
@@ -555,7 +555,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -555,7 +555,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
/* Disconnect Complete */
/* Disconnect Complete */
static
inline
void
hci_disconn_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_disconn_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_disconn_complete
*
ev
=
(
struct
evt
_disconn_complete
*
)
skb
->
data
;
struct
hci_ev_disconn_complete
*
ev
=
(
struct
hci_ev
_disconn_complete
*
)
skb
->
data
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
...
@@ -566,7 +566,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
...
@@ -566,7 +566,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
if
(
conn
)
{
if
(
conn
)
{
conn
->
state
=
BT_CLOSED
;
conn
->
state
=
BT_CLOSED
;
hci_proto_disconn_ind
(
conn
,
ev
->
reason
);
hci_proto_disconn_ind
(
conn
,
ev
->
reason
);
...
@@ -579,7 +579,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
...
@@ -579,7 +579,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
/* Number of completed packets */
/* Number of completed packets */
static
inline
void
hci_num_comp_pkts_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_num_comp_pkts_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_num_comp_pkts
*
ev
=
(
struct
evt
_num_comp_pkts
*
)
skb
->
data
;
struct
hci_ev_num_comp_pkts
*
ev
=
(
struct
hci_ev
_num_comp_pkts
*
)
skb
->
data
;
__u16
*
ptr
;
__u16
*
ptr
;
int
i
;
int
i
;
...
@@ -601,7 +601,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -601,7 +601,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
handle
=
__le16_to_cpu
(
get_unaligned
(
ptr
++
));
handle
=
__le16_to_cpu
(
get_unaligned
(
ptr
++
));
count
=
__le16_to_cpu
(
get_unaligned
(
ptr
++
));
count
=
__le16_to_cpu
(
get_unaligned
(
ptr
++
));
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
if
(
conn
)
{
if
(
conn
)
{
conn
->
sent
-=
count
;
conn
->
sent
-=
count
;
...
@@ -622,7 +622,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -622,7 +622,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
/* Role Change */
/* Role Change */
static
inline
void
hci_role_change_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_role_change_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_role_change
*
ev
=
(
struct
evt
_role_change
*
)
skb
->
data
;
struct
hci_ev_role_change
*
ev
=
(
struct
hci_ev
_role_change
*
)
skb
->
data
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
BT_DBG
(
"%s status %d"
,
hdev
->
name
,
ev
->
status
);
BT_DBG
(
"%s status %d"
,
hdev
->
name
,
ev
->
status
);
...
@@ -632,7 +632,7 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
...
@@ -632,7 +632,7 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
ev
->
bdaddr
);
conn
=
hci_
conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
ev
->
bdaddr
);
if
(
conn
)
{
if
(
conn
)
{
if
(
ev
->
role
)
if
(
ev
->
role
)
conn
->
link_mode
&=
~
HCI_LM_MASTER
;
conn
->
link_mode
&=
~
HCI_LM_MASTER
;
...
@@ -646,7 +646,7 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
...
@@ -646,7 +646,7 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
/* Authentication Complete */
/* Authentication Complete */
static
inline
void
hci_auth_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_auth_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_auth_complete
*
ev
=
(
struct
evt
_auth_complete
*
)
skb
->
data
;
struct
hci_ev_auth_complete
*
ev
=
(
struct
hci_ev
_auth_complete
*
)
skb
->
data
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
...
@@ -654,7 +654,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -654,7 +654,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
if
(
conn
)
{
if
(
conn
)
{
if
(
!
ev
->
status
)
if
(
!
ev
->
status
)
conn
->
link_mode
|=
HCI_LM_AUTH
;
conn
->
link_mode
|=
HCI_LM_AUTH
;
...
@@ -664,7 +664,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -664,7 +664,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if
(
test_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
conn
->
pend
))
{
if
(
test_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
conn
->
pend
))
{
if
(
!
ev
->
status
)
{
if
(
!
ev
->
status
)
{
struct
set_conn_encrypt_cp
cp
;
struct
hci_cp_set_conn_encrypt
cp
;
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
cp
.
handle
=
__cpu_to_le16
(
conn
->
handle
);
cp
.
encrypt
=
1
;
cp
.
encrypt
=
1
;
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
hci_send_cmd
(
conn
->
hdev
,
OGF_LINK_CTL
,
...
@@ -683,7 +683,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -683,7 +683,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
/* Encryption Change */
/* Encryption Change */
static
inline
void
hci_encrypt_change_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_encrypt_change_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
evt_encrypt_change
*
ev
=
(
struct
evt
_encrypt_change
*
)
skb
->
data
;
struct
hci_ev_encrypt_change
*
ev
=
(
struct
hci_ev
_encrypt_change
*
)
skb
->
data
;
struct
hci_conn
*
conn
=
NULL
;
struct
hci_conn
*
conn
=
NULL
;
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
__u16
handle
=
__le16_to_cpu
(
ev
->
handle
);
...
@@ -691,7 +691,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
...
@@ -691,7 +691,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
hci_dev_lock
(
hdev
);
hci_dev_lock
(
hdev
);
conn
=
conn_hash_lookup_handle
(
hdev
,
handle
);
conn
=
hci_
conn_hash_lookup_handle
(
hdev
,
handle
);
if
(
conn
)
{
if
(
conn
)
{
if
(
!
ev
->
status
)
{
if
(
!
ev
->
status
)
{
if
(
ev
->
encrypt
)
if
(
ev
->
encrypt
)
...
@@ -710,8 +710,8 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
...
@@ -710,8 +710,8 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
void
hci_event_packet
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
void
hci_event_packet
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
hci_event_hdr
*
hdr
=
(
struct
hci_event_hdr
*
)
skb
->
data
;
struct
hci_event_hdr
*
hdr
=
(
struct
hci_event_hdr
*
)
skb
->
data
;
struct
evt
_cmd_complete
*
ec
;
struct
hci_ev
_cmd_complete
*
ec
;
struct
evt
_cmd_status
*
cs
;
struct
hci_ev
_cmd_status
*
cs
;
u16
opcode
,
ocf
,
ogf
;
u16
opcode
,
ocf
,
ogf
;
skb_pull
(
skb
,
HCI_EVENT_HDR_SIZE
);
skb_pull
(
skb
,
HCI_EVENT_HDR_SIZE
);
...
@@ -719,49 +719,49 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -719,49 +719,49 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
BT_DBG
(
"%s evt 0x%x"
,
hdev
->
name
,
hdr
->
evt
);
BT_DBG
(
"%s evt 0x%x"
,
hdev
->
name
,
hdr
->
evt
);
switch
(
hdr
->
evt
)
{
switch
(
hdr
->
evt
)
{
case
EVT
_NUM_COMP_PKTS
:
case
HCI_EV
_NUM_COMP_PKTS
:
hci_num_comp_pkts_evt
(
hdev
,
skb
);
hci_num_comp_pkts_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_INQUIRY_COMPLETE
:
case
HCI_EV
_INQUIRY_COMPLETE
:
hci_inquiry_complete_evt
(
hdev
,
skb
);
hci_inquiry_complete_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_INQUIRY_RESULT
:
case
HCI_EV
_INQUIRY_RESULT
:
hci_inquiry_result_evt
(
hdev
,
skb
);
hci_inquiry_result_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_CONN_REQUEST
:
case
HCI_EV
_CONN_REQUEST
:
hci_conn_request_evt
(
hdev
,
skb
);
hci_conn_request_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_CONN_COMPLETE
:
case
HCI_EV
_CONN_COMPLETE
:
hci_conn_complete_evt
(
hdev
,
skb
);
hci_conn_complete_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_DISCONN_COMPLETE
:
case
HCI_EV
_DISCONN_COMPLETE
:
hci_disconn_complete_evt
(
hdev
,
skb
);
hci_disconn_complete_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_ROLE_CHANGE
:
case
HCI_EV
_ROLE_CHANGE
:
hci_role_change_evt
(
hdev
,
skb
);
hci_role_change_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_AUTH_COMPLETE
:
case
HCI_EV
_AUTH_COMPLETE
:
hci_auth_complete_evt
(
hdev
,
skb
);
hci_auth_complete_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_ENCRYPT_CHANGE
:
case
HCI_EV
_ENCRYPT_CHANGE
:
hci_encrypt_change_evt
(
hdev
,
skb
);
hci_encrypt_change_evt
(
hdev
,
skb
);
break
;
break
;
case
EVT
_CMD_STATUS
:
case
HCI_EV
_CMD_STATUS
:
cs
=
(
struct
evt
_cmd_status
*
)
skb
->
data
;
cs
=
(
struct
hci_ev
_cmd_status
*
)
skb
->
data
;
skb_pull
(
skb
,
sizeof
(
cs
));
skb_pull
(
skb
,
sizeof
(
cs
));
opcode
=
__le16_to_cpu
(
cs
->
opcode
);
opcode
=
__le16_to_cpu
(
cs
->
opcode
);
ogf
=
cmd
_opcode_ogf
(
opcode
);
ogf
=
hci
_opcode_ogf
(
opcode
);
ocf
=
cmd
_opcode_ocf
(
opcode
);
ocf
=
hci
_opcode_ocf
(
opcode
);
switch
(
ogf
)
{
switch
(
ogf
)
{
case
OGF_INFO_PARAM
:
case
OGF_INFO_PARAM
:
...
@@ -792,13 +792,13 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -792,13 +792,13 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
}
}
break
;
break
;
case
EVT
_CMD_COMPLETE
:
case
HCI_EV
_CMD_COMPLETE
:
ec
=
(
struct
evt
_cmd_complete
*
)
skb
->
data
;
ec
=
(
struct
hci_ev
_cmd_complete
*
)
skb
->
data
;
skb_pull
(
skb
,
sizeof
(
*
ec
));
skb_pull
(
skb
,
sizeof
(
*
ec
));
opcode
=
__le16_to_cpu
(
ec
->
opcode
);
opcode
=
__le16_to_cpu
(
ec
->
opcode
);
ogf
=
cmd
_opcode_ogf
(
opcode
);
ogf
=
hci
_opcode_ogf
(
opcode
);
ocf
=
cmd
_opcode_ocf
(
opcode
);
ocf
=
hci
_opcode_ocf
(
opcode
);
switch
(
ogf
)
{
switch
(
ogf
)
{
case
OGF_INFO_PARAM
:
case
OGF_INFO_PARAM
:
...
@@ -838,7 +838,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -838,7 +838,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
void
hci_si_event
(
struct
hci_dev
*
hdev
,
int
type
,
int
dlen
,
void
*
data
)
void
hci_si_event
(
struct
hci_dev
*
hdev
,
int
type
,
int
dlen
,
void
*
data
)
{
{
struct
hci_event_hdr
*
hdr
;
struct
hci_event_hdr
*
hdr
;
struct
evt
_stack_internal
*
ev
;
struct
hci_ev
_stack_internal
*
ev
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
skb
=
bt_skb_alloc
(
HCI_EVENT_HDR_SIZE
+
sizeof
(
*
ev
)
+
dlen
,
GFP_ATOMIC
);
skb
=
bt_skb_alloc
(
HCI_EVENT_HDR_SIZE
+
sizeof
(
*
ev
)
+
dlen
,
GFP_ATOMIC
);
...
@@ -846,7 +846,7 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
...
@@ -846,7 +846,7 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
return
;
return
;
hdr
=
(
void
*
)
skb_put
(
skb
,
HCI_EVENT_HDR_SIZE
);
hdr
=
(
void
*
)
skb_put
(
skb
,
HCI_EVENT_HDR_SIZE
);
hdr
->
evt
=
EVT
_STACK_INTERNAL
;
hdr
->
evt
=
HCI_EV
_STACK_INTERNAL
;
hdr
->
plen
=
sizeof
(
*
ev
)
+
dlen
;
hdr
->
plen
=
sizeof
(
*
ev
)
+
dlen
;
ev
=
(
void
*
)
skb_put
(
skb
,
sizeof
(
*
ev
)
+
dlen
);
ev
=
(
void
*
)
skb_put
(
skb
,
sizeof
(
*
ev
)
+
dlen
);
...
...
net/bluetooth/hci_sock.c
View file @
571277e3
...
@@ -114,9 +114,9 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
...
@@ -114,9 +114,9 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
if
(
!
test_bit
(
evt
,
flt
->
event_mask
))
if
(
!
test_bit
(
evt
,
flt
->
event_mask
))
continue
;
continue
;
if
(
flt
->
opcode
&&
((
evt
==
EVT
_CMD_COMPLETE
&&
if
(
flt
->
opcode
&&
((
evt
==
HCI_EV
_CMD_COMPLETE
&&
flt
->
opcode
!=
*
(
__u16
*
)(
skb
->
data
+
3
))
||
flt
->
opcode
!=
*
(
__u16
*
)(
skb
->
data
+
3
))
||
(
evt
==
EVT
_CMD_STATUS
&&
(
evt
==
HCI_EV
_CMD_STATUS
&&
flt
->
opcode
!=
*
(
__u16
*
)(
skb
->
data
+
4
))))
flt
->
opcode
!=
*
(
__u16
*
)(
skb
->
data
+
4
))))
continue
;
continue
;
}
}
...
@@ -394,8 +394,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
...
@@ -394,8 +394,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
if
(
skb
->
pkt_type
==
HCI_COMMAND_PKT
)
{
if
(
skb
->
pkt_type
==
HCI_COMMAND_PKT
)
{
u16
opcode
=
__le16_to_cpu
(
*
(
__u16
*
)
skb
->
data
);
u16
opcode
=
__le16_to_cpu
(
*
(
__u16
*
)
skb
->
data
);
u16
ogf
=
cmd
_opcode_ogf
(
opcode
)
-
1
;
u16
ogf
=
hci
_opcode_ogf
(
opcode
)
-
1
;
u16
ocf
=
cmd
_opcode_ocf
(
opcode
)
&
HCI_FLT_OCF_BITS
;
u16
ocf
=
hci
_opcode_ocf
(
opcode
)
&
HCI_FLT_OCF_BITS
;
if
(
ogf
>
HCI_SFLT_MAX_OGF
||
if
(
ogf
>
HCI_SFLT_MAX_OGF
||
!
test_bit
(
ocf
,
hci_sec_filter
.
ocf_mask
[
ogf
]))
!
test_bit
(
ocf
,
hci_sec_filter
.
ocf_mask
[
ogf
]))
...
@@ -584,14 +584,14 @@ static int hci_sock_create(struct socket *sock, int protocol)
...
@@ -584,14 +584,14 @@ static int hci_sock_create(struct socket *sock, int protocol)
static
int
hci_sock_dev_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
static
int
hci_sock_dev_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
{
{
struct
hci_dev
*
hdev
=
(
struct
hci_dev
*
)
ptr
;
struct
hci_dev
*
hdev
=
(
struct
hci_dev
*
)
ptr
;
struct
evt
_si_device
ev
;
struct
hci_ev
_si_device
ev
;
BT_DBG
(
"hdev %s event %ld"
,
hdev
->
name
,
event
);
BT_DBG
(
"hdev %s event %ld"
,
hdev
->
name
,
event
);
/* Send event to sockets */
/* Send event to sockets */
ev
.
event
=
event
;
ev
.
event
=
event
;
ev
.
dev_id
=
hdev
->
id
;
ev
.
dev_id
=
hdev
->
id
;
hci_si_event
(
NULL
,
EVT
_SI_DEVICE
,
sizeof
(
ev
),
&
ev
);
hci_si_event
(
NULL
,
HCI_EV
_SI_DEVICE
,
sizeof
(
ev
),
&
ev
);
if
(
event
==
HCI_DEV_UNREG
)
{
if
(
event
==
HCI_DEV_UNREG
)
{
struct
sock
*
sk
;
struct
sock
*
sk
;
...
...
net/bluetooth/syms.c
View file @
571277e3
...
@@ -56,7 +56,6 @@ EXPORT_SYMBOL(hci_dev_get);
...
@@ -56,7 +56,6 @@ EXPORT_SYMBOL(hci_dev_get);
EXPORT_SYMBOL
(
hci_conn_auth
);
EXPORT_SYMBOL
(
hci_conn_auth
);
EXPORT_SYMBOL
(
hci_conn_encrypt
);
EXPORT_SYMBOL
(
hci_conn_encrypt
);
EXPORT_SYMBOL
(
hci_recv_frame
);
EXPORT_SYMBOL
(
hci_send_acl
);
EXPORT_SYMBOL
(
hci_send_acl
);
EXPORT_SYMBOL
(
hci_send_sco
);
EXPORT_SYMBOL
(
hci_send_sco
);
EXPORT_SYMBOL
(
hci_send_raw
);
EXPORT_SYMBOL
(
hci_send_raw
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment