diff options
| author | Len Brown <len.brown@intel.com> | 2012-06-04 00:35:19 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2012-06-04 00:35:19 -0400 |
| commit | 7e1bd6e38b1f30860ce25a014c6d6adfb0079f4a (patch) | |
| tree | 65c5898ba93007d4399150c7a127a670bcfbc30d /include/net/bluetooth | |
| parent | 301f33fbcf4ced53b3de114846ecece5d6aafeeb (diff) | |
| parent | f8f5701bdaf9134b1f90e5044a82c66324d2073f (diff) | |
Merge branch 'upstream' into bugfix-video
Update bugfix-video branch to 2.5-rc1
so I don't have to again resolve the
conflict in these patches vs. upstream.
Conflicts:
drivers/gpu/drm/gma500/psb_drv.c
text conflict: add comment vs delete neighboring line
keep just this:
/* igd_opregion_init(&dev_priv->opregion_dev); */
/* acpi_video_register(); */
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/net/bluetooth')
| -rw-r--r-- | include/net/bluetooth/bluetooth.h | 32 | ||||
| -rw-r--r-- | include/net/bluetooth/hci.h | 8 | ||||
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 67 | ||||
| -rw-r--r-- | include/net/bluetooth/l2cap.h | 93 | ||||
| -rw-r--r-- | include/net/bluetooth/mgmt.h | 9 | ||||
| -rw-r--r-- | include/net/bluetooth/smp.h | 2 |
6 files changed, 156 insertions, 55 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index a65910bda381..961669b648fd 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -163,6 +163,11 @@ typedef struct { | |||
| 163 | __u8 b[6]; | 163 | __u8 b[6]; |
| 164 | } __packed bdaddr_t; | 164 | } __packed bdaddr_t; |
| 165 | 165 | ||
| 166 | /* BD Address type */ | ||
| 167 | #define BDADDR_BREDR 0x00 | ||
| 168 | #define BDADDR_LE_PUBLIC 0x01 | ||
| 169 | #define BDADDR_LE_RANDOM 0x02 | ||
| 170 | |||
| 166 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) | 171 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) |
| 167 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) | 172 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) |
| 168 | 173 | ||
| @@ -178,7 +183,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) | |||
| 178 | 183 | ||
| 179 | void baswap(bdaddr_t *dst, bdaddr_t *src); | 184 | void baswap(bdaddr_t *dst, bdaddr_t *src); |
| 180 | char *batostr(bdaddr_t *ba); | 185 | char *batostr(bdaddr_t *ba); |
| 181 | bdaddr_t *strtoba(char *str); | ||
| 182 | 186 | ||
| 183 | /* Common socket structures and functions */ | 187 | /* Common socket structures and functions */ |
| 184 | 188 | ||
| @@ -190,8 +194,12 @@ struct bt_sock { | |||
| 190 | bdaddr_t dst; | 194 | bdaddr_t dst; |
| 191 | struct list_head accept_q; | 195 | struct list_head accept_q; |
| 192 | struct sock *parent; | 196 | struct sock *parent; |
| 193 | u32 defer_setup; | 197 | unsigned long flags; |
| 194 | bool suspended; | 198 | }; |
| 199 | |||
| 200 | enum { | ||
| 201 | BT_SK_DEFER_SETUP, | ||
| 202 | BT_SK_SUSPEND, | ||
| 195 | }; | 203 | }; |
| 196 | 204 | ||
| 197 | struct bt_sock_list { | 205 | struct bt_sock_list { |
| @@ -216,14 +224,24 @@ void bt_accept_unlink(struct sock *sk); | |||
| 216 | struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); | 224 | struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); |
| 217 | 225 | ||
| 218 | /* Skb helpers */ | 226 | /* Skb helpers */ |
| 227 | struct l2cap_ctrl { | ||
| 228 | unsigned int sframe : 1, | ||
| 229 | poll : 1, | ||
| 230 | final : 1, | ||
| 231 | fcs : 1, | ||
| 232 | sar : 2, | ||
| 233 | super : 2; | ||
| 234 | __u16 reqseq; | ||
| 235 | __u16 txseq; | ||
| 236 | __u8 retries; | ||
| 237 | }; | ||
| 238 | |||
| 219 | struct bt_skb_cb { | 239 | struct bt_skb_cb { |
| 220 | __u8 pkt_type; | 240 | __u8 pkt_type; |
| 221 | __u8 incoming; | 241 | __u8 incoming; |
| 222 | __u16 expect; | 242 | __u16 expect; |
| 223 | __u16 tx_seq; | ||
| 224 | __u8 retries; | ||
| 225 | __u8 sar; | ||
| 226 | __u8 force_active; | 243 | __u8 force_active; |
| 244 | struct l2cap_ctrl control; | ||
| 227 | }; | 245 | }; |
| 228 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 246 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
| 229 | 247 | ||
| @@ -243,12 +261,10 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, | |||
| 243 | { | 261 | { |
| 244 | struct sk_buff *skb; | 262 | struct sk_buff *skb; |
| 245 | 263 | ||
| 246 | release_sock(sk); | ||
| 247 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { | 264 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { |
| 248 | skb_reserve(skb, BT_SKB_RESERVE); | 265 | skb_reserve(skb, BT_SKB_RESERVE); |
| 249 | bt_cb(skb)->incoming = 0; | 266 | bt_cb(skb)->incoming = 0; |
| 250 | } | 267 | } |
| 251 | lock_sock(sk); | ||
| 252 | 268 | ||
| 253 | if (!skb && *err) | 269 | if (!skb && *err) |
| 254 | return NULL; | 270 | return NULL; |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index d47e523c9d83..66a7b579e31c 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -102,6 +102,7 @@ enum { | |||
| 102 | HCI_DISCOVERABLE, | 102 | HCI_DISCOVERABLE, |
| 103 | HCI_LINK_SECURITY, | 103 | HCI_LINK_SECURITY, |
| 104 | HCI_PENDING_CLASS, | 104 | HCI_PENDING_CLASS, |
| 105 | HCI_PERIODIC_INQ, | ||
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| 107 | /* HCI ioctl defines */ | 108 | /* HCI ioctl defines */ |
| @@ -324,6 +325,8 @@ struct hci_cp_inquiry { | |||
| 324 | 325 | ||
| 325 | #define HCI_OP_INQUIRY_CANCEL 0x0402 | 326 | #define HCI_OP_INQUIRY_CANCEL 0x0402 |
| 326 | 327 | ||
| 328 | #define HCI_OP_PERIODIC_INQ 0x0403 | ||
| 329 | |||
| 327 | #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 | 330 | #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 |
| 328 | 331 | ||
| 329 | #define HCI_OP_CREATE_CONN 0x0405 | 332 | #define HCI_OP_CREATE_CONN 0x0405 |
| @@ -717,6 +720,10 @@ struct hci_rp_read_local_oob_data { | |||
| 717 | } __packed; | 720 | } __packed; |
| 718 | 721 | ||
| 719 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | 722 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 |
| 723 | struct hci_rp_read_inq_rsp_tx_power { | ||
| 724 | __u8 status; | ||
| 725 | __s8 tx_power; | ||
| 726 | } __packed; | ||
| 720 | 727 | ||
| 721 | #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 | 728 | #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 |
| 722 | struct hci_rp_read_flow_control_mode { | 729 | struct hci_rp_read_flow_control_mode { |
| @@ -1431,6 +1438,5 @@ struct hci_inquiry_req { | |||
| 1431 | #define IREQ_CACHE_FLUSH 0x0001 | 1438 | #define IREQ_CACHE_FLUSH 0x0001 |
| 1432 | 1439 | ||
| 1433 | extern bool enable_hs; | 1440 | extern bool enable_hs; |
| 1434 | extern bool enable_le; | ||
| 1435 | 1441 | ||
| 1436 | #endif /* __HCI_H */ | 1442 | #endif /* __HCI_H */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index db1c5df45224..9fc7728f94e4 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -155,9 +155,14 @@ struct hci_dev { | |||
| 155 | __u16 hci_rev; | 155 | __u16 hci_rev; |
| 156 | __u8 lmp_ver; | 156 | __u8 lmp_ver; |
| 157 | __u16 manufacturer; | 157 | __u16 manufacturer; |
| 158 | __le16 lmp_subver; | 158 | __u16 lmp_subver; |
| 159 | __u16 voice_setting; | 159 | __u16 voice_setting; |
| 160 | __u8 io_capability; | 160 | __u8 io_capability; |
| 161 | __s8 inq_tx_power; | ||
| 162 | __u16 devid_source; | ||
| 163 | __u16 devid_vendor; | ||
| 164 | __u16 devid_product; | ||
| 165 | __u16 devid_version; | ||
| 161 | 166 | ||
| 162 | __u16 pkt_type; | 167 | __u16 pkt_type; |
| 163 | __u16 esco_type; | 168 | __u16 esco_type; |
| @@ -250,9 +255,6 @@ struct hci_dev { | |||
| 250 | 255 | ||
| 251 | struct list_head remote_oob_data; | 256 | struct list_head remote_oob_data; |
| 252 | 257 | ||
| 253 | struct list_head adv_entries; | ||
| 254 | struct delayed_work adv_work; | ||
| 255 | |||
| 256 | struct hci_dev_stats stat; | 258 | struct hci_dev_stats stat; |
| 257 | 259 | ||
| 258 | struct sk_buff_head driver_init; | 260 | struct sk_buff_head driver_init; |
| @@ -263,7 +265,6 @@ struct hci_dev { | |||
| 263 | 265 | ||
| 264 | struct dentry *debugfs; | 266 | struct dentry *debugfs; |
| 265 | 267 | ||
| 266 | struct device *parent; | ||
| 267 | struct device dev; | 268 | struct device dev; |
| 268 | 269 | ||
| 269 | struct rfkill *rfkill; | 270 | struct rfkill *rfkill; |
| @@ -571,7 +572,7 @@ int hci_chan_del(struct hci_chan *chan); | |||
| 571 | void hci_chan_list_flush(struct hci_conn *conn); | 572 | void hci_chan_list_flush(struct hci_conn *conn); |
| 572 | 573 | ||
| 573 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | 574 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
| 574 | __u8 sec_level, __u8 auth_type); | 575 | __u8 dst_type, __u8 sec_level, __u8 auth_type); |
| 575 | int hci_conn_check_link_mode(struct hci_conn *conn); | 576 | int hci_conn_check_link_mode(struct hci_conn *conn); |
| 576 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); | 577 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); |
| 577 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); | 578 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
| @@ -673,8 +674,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
| 673 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 674 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
| 674 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | 675 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); |
| 675 | int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, | 676 | int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, |
| 676 | int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, | 677 | int new_key, u8 authenticated, u8 tk[16], u8 enc_size, |
| 677 | u8 rand[8]); | 678 | __le16 ediv, u8 rand[8]); |
| 678 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, | 679 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, |
| 679 | u8 addr_type); | 680 | u8 addr_type); |
| 680 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); | 681 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); |
| @@ -688,14 +689,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | |||
| 688 | u8 *randomizer); | 689 | u8 *randomizer); |
| 689 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | 690 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); |
| 690 | 691 | ||
| 691 | #define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */ | ||
| 692 | int hci_adv_entries_clear(struct hci_dev *hdev); | ||
| 693 | struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
| 694 | int hci_add_adv_entry(struct hci_dev *hdev, | ||
| 695 | struct hci_ev_le_advertising_info *ev); | ||
| 696 | |||
| 697 | void hci_del_off_timer(struct hci_dev *hdev); | ||
| 698 | |||
| 699 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 692 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
| 700 | 693 | ||
| 701 | int hci_recv_frame(struct sk_buff *skb); | 694 | int hci_recv_frame(struct sk_buff *skb); |
| @@ -709,7 +702,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn); | |||
| 709 | void hci_conn_add_sysfs(struct hci_conn *conn); | 702 | void hci_conn_add_sysfs(struct hci_conn *conn); |
| 710 | void hci_conn_del_sysfs(struct hci_conn *conn); | 703 | void hci_conn_del_sysfs(struct hci_conn *conn); |
| 711 | 704 | ||
| 712 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) | 705 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) |
| 713 | 706 | ||
| 714 | /* ----- LMP capabilities ----- */ | 707 | /* ----- LMP capabilities ----- */ |
| 715 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) | 708 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) |
| @@ -933,6 +926,23 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | |||
| 933 | return false; | 926 | return false; |
| 934 | } | 927 | } |
| 935 | 928 | ||
| 929 | static inline size_t eir_get_length(u8 *eir, size_t eir_len) | ||
| 930 | { | ||
| 931 | size_t parsed = 0; | ||
| 932 | |||
| 933 | while (parsed < eir_len) { | ||
| 934 | u8 field_len = eir[0]; | ||
| 935 | |||
| 936 | if (field_len == 0) | ||
| 937 | return parsed; | ||
| 938 | |||
| 939 | parsed += field_len + 1; | ||
| 940 | eir += field_len + 1; | ||
| 941 | } | ||
| 942 | |||
| 943 | return eir_len; | ||
| 944 | } | ||
| 945 | |||
| 936 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, | 946 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, |
| 937 | u8 data_len) | 947 | u8 data_len) |
| 938 | { | 948 | { |
| @@ -961,17 +971,12 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); | |||
| 961 | void hci_sock_dev_event(struct hci_dev *hdev, int event); | 971 | void hci_sock_dev_event(struct hci_dev *hdev, int event); |
| 962 | 972 | ||
| 963 | /* Management interface */ | 973 | /* Management interface */ |
| 964 | #define MGMT_ADDR_BREDR 0x00 | 974 | #define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR)) |
| 965 | #define MGMT_ADDR_LE_PUBLIC 0x01 | 975 | #define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \ |
| 966 | #define MGMT_ADDR_LE_RANDOM 0x02 | 976 | BIT(BDADDR_LE_RANDOM)) |
| 967 | #define MGMT_ADDR_INVALID 0xff | 977 | #define DISCOV_TYPE_INTERLEAVED (BIT(BDADDR_BREDR) | \ |
| 968 | 978 | BIT(BDADDR_LE_PUBLIC) | \ | |
| 969 | #define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) | 979 | BIT(BDADDR_LE_RANDOM)) |
| 970 | #define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
| 971 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
| 972 | #define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \ | ||
| 973 | BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
| 974 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
| 975 | 980 | ||
| 976 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 981 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
| 977 | int mgmt_index_added(struct hci_dev *hdev); | 982 | int mgmt_index_added(struct hci_dev *hdev); |
| @@ -1067,12 +1072,12 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | |||
| 1067 | u16 latency, u16 to_multiplier); | 1072 | u16 latency, u16 to_multiplier); |
| 1068 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | 1073 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], |
| 1069 | __u8 ltk[16]); | 1074 | __u8 ltk[16]); |
| 1070 | void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]); | ||
| 1071 | void hci_le_ltk_neg_reply(struct hci_conn *conn); | ||
| 1072 | |||
| 1073 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1075 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
| 1074 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1076 | int hci_cancel_inquiry(struct hci_dev *hdev); |
| 1075 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | 1077 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, |
| 1076 | int timeout); | 1078 | int timeout); |
| 1079 | int hci_cancel_le_scan(struct hci_dev *hdev); | ||
| 1080 | |||
| 1081 | u8 bdaddr_to_le(u8 bdaddr_type); | ||
| 1077 | 1082 | ||
| 1078 | #endif /* __HCI_CORE_H */ | 1083 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 9b242c6bf55b..1c7d1cd5e679 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF | 44 | #define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF |
| 45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF | 45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF |
| 46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF | 46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF |
| 47 | #define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */ | ||
| 47 | 48 | ||
| 48 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) | 49 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) |
| 49 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) | 50 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) |
| @@ -57,6 +58,7 @@ struct sockaddr_l2 { | |||
| 57 | __le16 l2_psm; | 58 | __le16 l2_psm; |
| 58 | bdaddr_t l2_bdaddr; | 59 | bdaddr_t l2_bdaddr; |
| 59 | __le16 l2_cid; | 60 | __le16 l2_cid; |
| 61 | __u8 l2_bdaddr_type; | ||
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| 62 | /* L2CAP socket options */ | 64 | /* L2CAP socket options */ |
| @@ -139,6 +141,8 @@ struct l2cap_conninfo { | |||
| 139 | 141 | ||
| 140 | #define L2CAP_CTRL_TXSEQ_SHIFT 1 | 142 | #define L2CAP_CTRL_TXSEQ_SHIFT 1 |
| 141 | #define L2CAP_CTRL_SUPER_SHIFT 2 | 143 | #define L2CAP_CTRL_SUPER_SHIFT 2 |
| 144 | #define L2CAP_CTRL_POLL_SHIFT 4 | ||
| 145 | #define L2CAP_CTRL_FINAL_SHIFT 7 | ||
| 142 | #define L2CAP_CTRL_REQSEQ_SHIFT 8 | 146 | #define L2CAP_CTRL_REQSEQ_SHIFT 8 |
| 143 | #define L2CAP_CTRL_SAR_SHIFT 14 | 147 | #define L2CAP_CTRL_SAR_SHIFT 14 |
| 144 | 148 | ||
| @@ -152,9 +156,11 @@ struct l2cap_conninfo { | |||
| 152 | #define L2CAP_EXT_CTRL_FINAL 0x00000002 | 156 | #define L2CAP_EXT_CTRL_FINAL 0x00000002 |
| 153 | #define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ | 157 | #define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ |
| 154 | 158 | ||
| 159 | #define L2CAP_EXT_CTRL_FINAL_SHIFT 1 | ||
| 155 | #define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 | 160 | #define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 |
| 156 | #define L2CAP_EXT_CTRL_SAR_SHIFT 16 | 161 | #define L2CAP_EXT_CTRL_SAR_SHIFT 16 |
| 157 | #define L2CAP_EXT_CTRL_SUPER_SHIFT 16 | 162 | #define L2CAP_EXT_CTRL_SUPER_SHIFT 16 |
| 163 | #define L2CAP_EXT_CTRL_POLL_SHIFT 18 | ||
| 158 | #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 | 164 | #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 |
| 159 | 165 | ||
| 160 | /* L2CAP Supervisory Function */ | 166 | /* L2CAP Supervisory Function */ |
| @@ -186,6 +192,8 @@ struct l2cap_hdr { | |||
| 186 | #define L2CAP_FCS_SIZE 2 | 192 | #define L2CAP_FCS_SIZE 2 |
| 187 | #define L2CAP_SDULEN_SIZE 2 | 193 | #define L2CAP_SDULEN_SIZE 2 |
| 188 | #define L2CAP_PSMLEN_SIZE 2 | 194 | #define L2CAP_PSMLEN_SIZE 2 |
| 195 | #define L2CAP_ENH_CTRL_SIZE 2 | ||
| 196 | #define L2CAP_EXT_CTRL_SIZE 4 | ||
| 189 | 197 | ||
| 190 | struct l2cap_cmd_hdr { | 198 | struct l2cap_cmd_hdr { |
| 191 | __u8 code; | 199 | __u8 code; |
| @@ -401,6 +409,16 @@ struct l2cap_conn_param_update_rsp { | |||
| 401 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 | 409 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 |
| 402 | 410 | ||
| 403 | /* ----- L2CAP channels and connections ----- */ | 411 | /* ----- L2CAP channels and connections ----- */ |
| 412 | struct l2cap_seq_list { | ||
| 413 | __u16 head; | ||
| 414 | __u16 tail; | ||
| 415 | __u16 mask; | ||
| 416 | __u16 *list; | ||
| 417 | }; | ||
| 418 | |||
| 419 | #define L2CAP_SEQ_LIST_CLEAR 0xFFFF | ||
| 420 | #define L2CAP_SEQ_LIST_TAIL 0x8000 | ||
| 421 | |||
| 404 | struct srej_list { | 422 | struct srej_list { |
| 405 | __u16 tx_seq; | 423 | __u16 tx_seq; |
| 406 | struct list_head list; | 424 | struct list_head list; |
| @@ -446,6 +464,9 @@ struct l2cap_chan { | |||
| 446 | __u16 monitor_timeout; | 464 | __u16 monitor_timeout; |
| 447 | __u16 mps; | 465 | __u16 mps; |
| 448 | 466 | ||
| 467 | __u8 tx_state; | ||
| 468 | __u8 rx_state; | ||
| 469 | |||
| 449 | unsigned long conf_state; | 470 | unsigned long conf_state; |
| 450 | unsigned long conn_state; | 471 | unsigned long conn_state; |
| 451 | unsigned long flags; | 472 | unsigned long flags; |
| @@ -456,9 +477,11 @@ struct l2cap_chan { | |||
| 456 | __u16 buffer_seq; | 477 | __u16 buffer_seq; |
| 457 | __u16 buffer_seq_srej; | 478 | __u16 buffer_seq_srej; |
| 458 | __u16 srej_save_reqseq; | 479 | __u16 srej_save_reqseq; |
| 480 | __u16 last_acked_seq; | ||
| 459 | __u16 frames_sent; | 481 | __u16 frames_sent; |
| 460 | __u16 unacked_frames; | 482 | __u16 unacked_frames; |
| 461 | __u8 retry_count; | 483 | __u8 retry_count; |
| 484 | __u16 srej_queue_next; | ||
| 462 | __u8 num_acked; | 485 | __u8 num_acked; |
| 463 | __u16 sdu_len; | 486 | __u16 sdu_len; |
| 464 | struct sk_buff *sdu; | 487 | struct sk_buff *sdu; |
| @@ -490,6 +513,8 @@ struct l2cap_chan { | |||
| 490 | struct sk_buff *tx_send_head; | 513 | struct sk_buff *tx_send_head; |
| 491 | struct sk_buff_head tx_q; | 514 | struct sk_buff_head tx_q; |
| 492 | struct sk_buff_head srej_q; | 515 | struct sk_buff_head srej_q; |
| 516 | struct l2cap_seq_list srej_list; | ||
| 517 | struct l2cap_seq_list retrans_list; | ||
| 493 | struct list_head srej_l; | 518 | struct list_head srej_l; |
| 494 | 519 | ||
| 495 | struct list_head list; | 520 | struct list_head list; |
| @@ -508,8 +533,7 @@ struct l2cap_ops { | |||
| 508 | void (*close) (void *data); | 533 | void (*close) (void *data); |
| 509 | void (*state_change) (void *data, int state); | 534 | void (*state_change) (void *data, int state); |
| 510 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, | 535 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, |
| 511 | unsigned long len, int nb, int *err); | 536 | unsigned long len, int nb); |
| 512 | |||
| 513 | }; | 537 | }; |
| 514 | 538 | ||
| 515 | struct l2cap_conn { | 539 | struct l2cap_conn { |
| @@ -600,6 +624,44 @@ enum { | |||
| 600 | FLAG_EFS_ENABLE, | 624 | FLAG_EFS_ENABLE, |
| 601 | }; | 625 | }; |
| 602 | 626 | ||
| 627 | enum { | ||
| 628 | L2CAP_TX_STATE_XMIT, | ||
| 629 | L2CAP_TX_STATE_WAIT_F, | ||
| 630 | }; | ||
| 631 | |||
| 632 | enum { | ||
| 633 | L2CAP_RX_STATE_RECV, | ||
| 634 | L2CAP_RX_STATE_SREJ_SENT, | ||
| 635 | }; | ||
| 636 | |||
| 637 | enum { | ||
| 638 | L2CAP_TXSEQ_EXPECTED, | ||
| 639 | L2CAP_TXSEQ_EXPECTED_SREJ, | ||
| 640 | L2CAP_TXSEQ_UNEXPECTED, | ||
| 641 | L2CAP_TXSEQ_UNEXPECTED_SREJ, | ||
| 642 | L2CAP_TXSEQ_DUPLICATE, | ||
| 643 | L2CAP_TXSEQ_DUPLICATE_SREJ, | ||
| 644 | L2CAP_TXSEQ_INVALID, | ||
| 645 | L2CAP_TXSEQ_INVALID_IGNORE, | ||
| 646 | }; | ||
| 647 | |||
| 648 | enum { | ||
| 649 | L2CAP_EV_DATA_REQUEST, | ||
| 650 | L2CAP_EV_LOCAL_BUSY_DETECTED, | ||
| 651 | L2CAP_EV_LOCAL_BUSY_CLEAR, | ||
| 652 | L2CAP_EV_RECV_REQSEQ_AND_FBIT, | ||
| 653 | L2CAP_EV_RECV_FBIT, | ||
| 654 | L2CAP_EV_RETRANS_TO, | ||
| 655 | L2CAP_EV_MONITOR_TO, | ||
| 656 | L2CAP_EV_EXPLICIT_POLL, | ||
| 657 | L2CAP_EV_RECV_IFRAME, | ||
| 658 | L2CAP_EV_RECV_RR, | ||
| 659 | L2CAP_EV_RECV_REJ, | ||
| 660 | L2CAP_EV_RECV_RNR, | ||
| 661 | L2CAP_EV_RECV_SREJ, | ||
| 662 | L2CAP_EV_RECV_FRAME, | ||
| 663 | }; | ||
| 664 | |||
| 603 | static inline void l2cap_chan_hold(struct l2cap_chan *c) | 665 | static inline void l2cap_chan_hold(struct l2cap_chan *c) |
| 604 | { | 666 | { |
| 605 | atomic_inc(&c->refcnt); | 667 | atomic_inc(&c->refcnt); |
| @@ -622,21 +684,26 @@ static inline void l2cap_chan_unlock(struct l2cap_chan *chan) | |||
| 622 | } | 684 | } |
| 623 | 685 | ||
| 624 | static inline void l2cap_set_timer(struct l2cap_chan *chan, | 686 | static inline void l2cap_set_timer(struct l2cap_chan *chan, |
| 625 | struct delayed_work *work, long timeout) | 687 | struct delayed_work *work, long timeout) |
| 626 | { | 688 | { |
| 627 | BT_DBG("chan %p state %s timeout %ld", chan, | 689 | BT_DBG("chan %p state %s timeout %ld", chan, |
| 628 | state_to_string(chan->state), timeout); | 690 | state_to_string(chan->state), timeout); |
| 629 | 691 | ||
| 692 | /* If delayed work cancelled do not hold(chan) | ||
| 693 | since it is already done with previous set_timer */ | ||
| 630 | if (!cancel_delayed_work(work)) | 694 | if (!cancel_delayed_work(work)) |
| 631 | l2cap_chan_hold(chan); | 695 | l2cap_chan_hold(chan); |
| 696 | |||
| 632 | schedule_delayed_work(work, timeout); | 697 | schedule_delayed_work(work, timeout); |
| 633 | } | 698 | } |
| 634 | 699 | ||
| 635 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan, | 700 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan, |
| 636 | struct delayed_work *work) | 701 | struct delayed_work *work) |
| 637 | { | 702 | { |
| 638 | bool ret; | 703 | bool ret; |
| 639 | 704 | ||
| 705 | /* put(chan) if delayed work cancelled otherwise it | ||
| 706 | is done in delayed work function */ | ||
| 640 | ret = cancel_delayed_work(work); | 707 | ret = cancel_delayed_work(work); |
| 641 | if (ret) | 708 | if (ret) |
| 642 | l2cap_chan_put(chan); | 709 | l2cap_chan_put(chan); |
| @@ -658,13 +725,10 @@ static inline bool l2cap_clear_timer(struct l2cap_chan *chan, | |||
| 658 | 725 | ||
| 659 | static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) | 726 | static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) |
| 660 | { | 727 | { |
| 661 | int offset; | 728 | if (seq1 >= seq2) |
| 662 | 729 | return seq1 - seq2; | |
| 663 | offset = (seq1 - seq2) % (chan->tx_win_max + 1); | 730 | else |
| 664 | if (offset < 0) | 731 | return chan->tx_win_max + 1 - seq2 + seq1; |
| 665 | offset += (chan->tx_win_max + 1); | ||
| 666 | |||
| 667 | return offset; | ||
| 668 | } | 732 | } |
| 669 | 733 | ||
| 670 | static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq) | 734 | static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq) |
| @@ -852,14 +916,15 @@ int __l2cap_wait_ack(struct sock *sk); | |||
| 852 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); | 916 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); |
| 853 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | 917 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); |
| 854 | 918 | ||
| 855 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | 919 | struct l2cap_chan *l2cap_chan_create(void); |
| 856 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); | 920 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
| 857 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 921 | void l2cap_chan_destroy(struct l2cap_chan *chan); |
| 858 | int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, | 922 | int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, |
| 859 | bdaddr_t *dst); | 923 | bdaddr_t *dst, u8 dst_type); |
| 860 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, | 924 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, |
| 861 | u32 priority); | 925 | u32 priority); |
| 862 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | 926 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); |
| 863 | int l2cap_chan_check_security(struct l2cap_chan *chan); | 927 | int l2cap_chan_check_security(struct l2cap_chan *chan); |
| 928 | void l2cap_chan_set_defaults(struct l2cap_chan *chan); | ||
| 864 | 929 | ||
| 865 | #endif /* __L2CAP_H */ | 930 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index ebfd91fc20f8..23fd0546fccb 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
| @@ -341,6 +341,15 @@ struct mgmt_cp_unblock_device { | |||
| 341 | } __packed; | 341 | } __packed; |
| 342 | #define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | 342 | #define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE |
| 343 | 343 | ||
| 344 | #define MGMT_OP_SET_DEVICE_ID 0x0028 | ||
| 345 | struct mgmt_cp_set_device_id { | ||
| 346 | __le16 source; | ||
| 347 | __le16 vendor; | ||
| 348 | __le16 product; | ||
| 349 | __le16 version; | ||
| 350 | } __packed; | ||
| 351 | #define MGMT_SET_DEVICE_ID_SIZE 8 | ||
| 352 | |||
| 344 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 353 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
| 345 | struct mgmt_ev_cmd_complete { | 354 | struct mgmt_ev_cmd_complete { |
| 346 | __le16 opcode; | 355 | __le16 opcode; |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index 7b3acdd29134..ca356a734920 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
| @@ -77,7 +77,7 @@ struct smp_cmd_encrypt_info { | |||
| 77 | 77 | ||
| 78 | #define SMP_CMD_MASTER_IDENT 0x07 | 78 | #define SMP_CMD_MASTER_IDENT 0x07 |
| 79 | struct smp_cmd_master_ident { | 79 | struct smp_cmd_master_ident { |
| 80 | __u16 ediv; | 80 | __le16 ediv; |
| 81 | __u8 rand[8]; | 81 | __u8 rand[8]; |
| 82 | } __packed; | 82 | } __packed; |
| 83 | 83 | ||
