diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/af_unix.h | 3 | ||||
-rw-r--r-- | include/net/ax25.h | 24 | ||||
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 2 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 73 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 59 | ||||
-rw-r--r-- | include/net/sock.h | 19 |
6 files changed, 123 insertions, 57 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 5ba72d95280c..2fec827c8801 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -67,6 +67,9 @@ struct unix_skb_parms { | |||
67 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) | 67 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) |
68 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) | 68 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) |
69 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) | 69 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) |
70 | #define unix_state_wlock_nested(s) \ | ||
71 | spin_lock_nested(&unix_sk(s)->lock, \ | ||
72 | SINGLE_DEPTH_NESTING) | ||
70 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) | 73 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) |
71 | 74 | ||
72 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 7cd528e9d668..69374cd1a857 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -182,14 +182,26 @@ typedef struct { | |||
182 | 182 | ||
183 | typedef struct ax25_route { | 183 | typedef struct ax25_route { |
184 | struct ax25_route *next; | 184 | struct ax25_route *next; |
185 | atomic_t ref; | 185 | atomic_t refcount; |
186 | ax25_address callsign; | 186 | ax25_address callsign; |
187 | struct net_device *dev; | 187 | struct net_device *dev; |
188 | ax25_digi *digipeat; | 188 | ax25_digi *digipeat; |
189 | char ip_mode; | 189 | char ip_mode; |
190 | struct timer_list timer; | ||
191 | } ax25_route; | 190 | } ax25_route; |
192 | 191 | ||
192 | static inline void ax25_hold_route(ax25_route *ax25_rt) | ||
193 | { | ||
194 | atomic_inc(&ax25_rt->refcount); | ||
195 | } | ||
196 | |||
197 | extern void __ax25_put_route(ax25_route *ax25_rt); | ||
198 | |||
199 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
200 | { | ||
201 | if (atomic_dec_and_test(&ax25_rt->refcount)) | ||
202 | __ax25_put_route(ax25_rt); | ||
203 | } | ||
204 | |||
193 | typedef struct { | 205 | typedef struct { |
194 | char slave; /* slave_mode? */ | 206 | char slave; /* slave_mode? */ |
195 | struct timer_list slave_timer; /* timeout timer */ | 207 | struct timer_list slave_timer; /* timeout timer */ |
@@ -348,17 +360,11 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); | |||
348 | extern void ax25_rt_device_down(struct net_device *); | 360 | extern void ax25_rt_device_down(struct net_device *); |
349 | extern int ax25_rt_ioctl(unsigned int, void __user *); | 361 | extern int ax25_rt_ioctl(unsigned int, void __user *); |
350 | extern struct file_operations ax25_route_fops; | 362 | extern struct file_operations ax25_route_fops; |
363 | extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); | ||
351 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); | 364 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); |
352 | extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *, | ||
353 | struct net_device *); | ||
354 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); | 365 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); |
355 | extern void ax25_rt_free(void); | 366 | extern void ax25_rt_free(void); |
356 | 367 | ||
357 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
358 | { | ||
359 | atomic_dec(&ax25_rt->ref); | ||
360 | } | ||
361 | |||
362 | /* ax25_std_in.c */ | 368 | /* ax25_std_in.c */ |
363 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); | 369 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); |
364 | 370 | ||
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 911ceb5cd263..771d17783c18 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -175,6 +175,6 @@ extern int hci_sock_cleanup(void); | |||
175 | extern int bt_sysfs_init(void); | 175 | extern int bt_sysfs_init(void); |
176 | extern void bt_sysfs_cleanup(void); | 176 | extern void bt_sysfs_cleanup(void); |
177 | 177 | ||
178 | extern struct class bt_class; | 178 | extern struct class *bt_class; |
179 | 179 | ||
180 | #endif /* __BLUETOOTH_H */ | 180 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b06a2d2f63d2..b2bdb1aa0429 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -54,7 +54,8 @@ | |||
54 | /* HCI device quirks */ | 54 | /* HCI device quirks */ |
55 | enum { | 55 | enum { |
56 | HCI_QUIRK_RESET_ON_INIT, | 56 | HCI_QUIRK_RESET_ON_INIT, |
57 | HCI_QUIRK_RAW_DEVICE | 57 | HCI_QUIRK_RAW_DEVICE, |
58 | HCI_QUIRK_FIXUP_BUFFER_SIZE | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | /* HCI device flags */ | 61 | /* HCI device flags */ |
@@ -100,9 +101,10 @@ enum { | |||
100 | #define HCIINQUIRY _IOR('H', 240, int) | 101 | #define HCIINQUIRY _IOR('H', 240, int) |
101 | 102 | ||
102 | /* HCI timeouts */ | 103 | /* HCI timeouts */ |
103 | #define HCI_CONN_TIMEOUT (HZ * 40) | 104 | #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ |
104 | #define HCI_DISCONN_TIMEOUT (HZ * 2) | 105 | #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ |
105 | #define HCI_CONN_IDLE_TIMEOUT (HZ * 60) | 106 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
107 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | ||
106 | 108 | ||
107 | /* HCI Packet types */ | 109 | /* HCI Packet types */ |
108 | #define HCI_COMMAND_PKT 0x01 | 110 | #define HCI_COMMAND_PKT 0x01 |
@@ -144,7 +146,7 @@ enum { | |||
144 | #define LMP_TACCURACY 0x10 | 146 | #define LMP_TACCURACY 0x10 |
145 | #define LMP_RSWITCH 0x20 | 147 | #define LMP_RSWITCH 0x20 |
146 | #define LMP_HOLD 0x40 | 148 | #define LMP_HOLD 0x40 |
147 | #define LMP_SNIF 0x80 | 149 | #define LMP_SNIFF 0x80 |
148 | 150 | ||
149 | #define LMP_PARK 0x01 | 151 | #define LMP_PARK 0x01 |
150 | #define LMP_RSSI 0x02 | 152 | #define LMP_RSSI 0x02 |
@@ -159,13 +161,21 @@ enum { | |||
159 | #define LMP_PSCHEME 0x02 | 161 | #define LMP_PSCHEME 0x02 |
160 | #define LMP_PCONTROL 0x04 | 162 | #define LMP_PCONTROL 0x04 |
161 | 163 | ||
164 | #define LMP_SNIFF_SUBR 0x02 | ||
165 | |||
166 | /* Connection modes */ | ||
167 | #define HCI_CM_ACTIVE 0x0000 | ||
168 | #define HCI_CM_HOLD 0x0001 | ||
169 | #define HCI_CM_SNIFF 0x0002 | ||
170 | #define HCI_CM_PARK 0x0003 | ||
171 | |||
162 | /* Link policies */ | 172 | /* Link policies */ |
163 | #define HCI_LP_RSWITCH 0x0001 | 173 | #define HCI_LP_RSWITCH 0x0001 |
164 | #define HCI_LP_HOLD 0x0002 | 174 | #define HCI_LP_HOLD 0x0002 |
165 | #define HCI_LP_SNIFF 0x0004 | 175 | #define HCI_LP_SNIFF 0x0004 |
166 | #define HCI_LP_PARK 0x0008 | 176 | #define HCI_LP_PARK 0x0008 |
167 | 177 | ||
168 | /* Link mode */ | 178 | /* Link modes */ |
169 | #define HCI_LM_ACCEPT 0x8000 | 179 | #define HCI_LM_ACCEPT 0x8000 |
170 | #define HCI_LM_MASTER 0x0001 | 180 | #define HCI_LM_MASTER 0x0001 |
171 | #define HCI_LM_AUTH 0x0002 | 181 | #define HCI_LM_AUTH 0x0002 |
@@ -191,7 +201,7 @@ struct hci_rp_read_loc_version { | |||
191 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
192 | 202 | ||
193 | #define OCF_READ_LOCAL_FEATURES 0x0003 | 203 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
194 | struct hci_rp_read_loc_features { | 204 | struct hci_rp_read_local_features { |
195 | __u8 status; | 205 | __u8 status; |
196 | __u8 features[8]; | 206 | __u8 features[8]; |
197 | } __attribute__ ((packed)); | 207 | } __attribute__ ((packed)); |
@@ -375,17 +385,32 @@ struct hci_cp_change_conn_link_key { | |||
375 | } __attribute__ ((packed)); | 385 | } __attribute__ ((packed)); |
376 | 386 | ||
377 | #define OCF_READ_REMOTE_FEATURES 0x001B | 387 | #define OCF_READ_REMOTE_FEATURES 0x001B |
378 | struct hci_cp_read_rmt_features { | 388 | struct hci_cp_read_remote_features { |
379 | __le16 handle; | 389 | __le16 handle; |
380 | } __attribute__ ((packed)); | 390 | } __attribute__ ((packed)); |
381 | 391 | ||
382 | #define OCF_READ_REMOTE_VERSION 0x001D | 392 | #define OCF_READ_REMOTE_VERSION 0x001D |
383 | struct hci_cp_read_rmt_version { | 393 | struct hci_cp_read_remote_version { |
384 | __le16 handle; | 394 | __le16 handle; |
385 | } __attribute__ ((packed)); | 395 | } __attribute__ ((packed)); |
386 | 396 | ||
387 | /* Link Policy */ | 397 | /* Link Policy */ |
388 | #define OGF_LINK_POLICY 0x02 | 398 | #define OGF_LINK_POLICY 0x02 |
399 | |||
400 | #define OCF_SNIFF_MODE 0x0003 | ||
401 | struct hci_cp_sniff_mode { | ||
402 | __le16 handle; | ||
403 | __le16 max_interval; | ||
404 | __le16 min_interval; | ||
405 | __le16 attempt; | ||
406 | __le16 timeout; | ||
407 | } __attribute__ ((packed)); | ||
408 | |||
409 | #define OCF_EXIT_SNIFF_MODE 0x0004 | ||
410 | struct hci_cp_exit_sniff_mode { | ||
411 | __le16 handle; | ||
412 | } __attribute__ ((packed)); | ||
413 | |||
389 | #define OCF_ROLE_DISCOVERY 0x0009 | 414 | #define OCF_ROLE_DISCOVERY 0x0009 |
390 | struct hci_cp_role_discovery { | 415 | struct hci_cp_role_discovery { |
391 | __le16 handle; | 416 | __le16 handle; |
@@ -406,7 +431,7 @@ struct hci_rp_read_link_policy { | |||
406 | __le16 policy; | 431 | __le16 policy; |
407 | } __attribute__ ((packed)); | 432 | } __attribute__ ((packed)); |
408 | 433 | ||
409 | #define OCF_SWITCH_ROLE 0x000B | 434 | #define OCF_SWITCH_ROLE 0x000B |
410 | struct hci_cp_switch_role { | 435 | struct hci_cp_switch_role { |
411 | bdaddr_t bdaddr; | 436 | bdaddr_t bdaddr; |
412 | __u8 role; | 437 | __u8 role; |
@@ -422,6 +447,14 @@ struct hci_rp_write_link_policy { | |||
422 | __le16 handle; | 447 | __le16 handle; |
423 | } __attribute__ ((packed)); | 448 | } __attribute__ ((packed)); |
424 | 449 | ||
450 | #define OCF_SNIFF_SUBRATE 0x0011 | ||
451 | struct hci_cp_sniff_subrate { | ||
452 | __le16 handle; | ||
453 | __le16 max_latency; | ||
454 | __le16 min_remote_timeout; | ||
455 | __le16 min_local_timeout; | ||
456 | } __attribute__ ((packed)); | ||
457 | |||
425 | /* Status params */ | 458 | /* Status params */ |
426 | #define OGF_STATUS_PARAM 0x05 | 459 | #define OGF_STATUS_PARAM 0x05 |
427 | 460 | ||
@@ -581,15 +614,15 @@ struct hci_ev_link_key_notify { | |||
581 | __u8 key_type; | 614 | __u8 key_type; |
582 | } __attribute__ ((packed)); | 615 | } __attribute__ ((packed)); |
583 | 616 | ||
584 | #define HCI_EV_RMT_FEATURES 0x0B | 617 | #define HCI_EV_REMOTE_FEATURES 0x0B |
585 | struct hci_ev_rmt_features { | 618 | struct hci_ev_remote_features { |
586 | __u8 status; | 619 | __u8 status; |
587 | __le16 handle; | 620 | __le16 handle; |
588 | __u8 features[8]; | 621 | __u8 features[8]; |
589 | } __attribute__ ((packed)); | 622 | } __attribute__ ((packed)); |
590 | 623 | ||
591 | #define HCI_EV_RMT_VERSION 0x0C | 624 | #define HCI_EV_REMOTE_VERSION 0x0C |
592 | struct hci_ev_rmt_version { | 625 | struct hci_ev_remote_version { |
593 | __u8 status; | 626 | __u8 status; |
594 | __le16 handle; | 627 | __le16 handle; |
595 | __u8 lmp_ver; | 628 | __u8 lmp_ver; |
@@ -610,6 +643,16 @@ struct hci_ev_pscan_rep_mode { | |||
610 | __u8 pscan_rep_mode; | 643 | __u8 pscan_rep_mode; |
611 | } __attribute__ ((packed)); | 644 | } __attribute__ ((packed)); |
612 | 645 | ||
646 | #define HCI_EV_SNIFF_SUBRATE 0x2E | ||
647 | struct hci_ev_sniff_subrate { | ||
648 | __u8 status; | ||
649 | __le16 handle; | ||
650 | __le16 max_tx_latency; | ||
651 | __le16 max_rx_latency; | ||
652 | __le16 max_remote_timeout; | ||
653 | __le16 max_local_timeout; | ||
654 | } __attribute__ ((packed)); | ||
655 | |||
613 | /* Internal events generated by Bluetooth stack */ | 656 | /* Internal events generated by Bluetooth stack */ |
614 | #define HCI_EV_STACK_INTERNAL 0xFD | 657 | #define HCI_EV_STACK_INTERNAL 0xFD |
615 | struct hci_ev_stack_internal { | 658 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index bb9f81dc8723..d84855fe7336 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -31,10 +31,7 @@ | |||
31 | #define HCI_PROTO_L2CAP 0 | 31 | #define HCI_PROTO_L2CAP 0 |
32 | #define HCI_PROTO_SCO 1 | 32 | #define HCI_PROTO_SCO 1 |
33 | 33 | ||
34 | #define HCI_INIT_TIMEOUT (HZ * 10) | ||
35 | |||
36 | /* HCI Core structures */ | 34 | /* HCI Core structures */ |
37 | |||
38 | struct inquiry_data { | 35 | struct inquiry_data { |
39 | bdaddr_t bdaddr; | 36 | bdaddr_t bdaddr; |
40 | __u8 pscan_rep_mode; | 37 | __u8 pscan_rep_mode; |
@@ -81,6 +78,10 @@ struct hci_dev { | |||
81 | __u16 link_policy; | 78 | __u16 link_policy; |
82 | __u16 link_mode; | 79 | __u16 link_mode; |
83 | 80 | ||
81 | __u32 idle_timeout; | ||
82 | __u16 sniff_min_interval; | ||
83 | __u16 sniff_max_interval; | ||
84 | |||
84 | unsigned long quirks; | 85 | unsigned long quirks; |
85 | 86 | ||
86 | atomic_t cmd_cnt; | 87 | atomic_t cmd_cnt; |
@@ -123,7 +124,8 @@ struct hci_dev { | |||
123 | 124 | ||
124 | atomic_t promisc; | 125 | atomic_t promisc; |
125 | 126 | ||
126 | struct class_device class_dev; | 127 | struct device *parent; |
128 | struct device dev; | ||
127 | 129 | ||
128 | struct module *owner; | 130 | struct module *owner; |
129 | 131 | ||
@@ -145,18 +147,24 @@ struct hci_conn { | |||
145 | bdaddr_t dst; | 147 | bdaddr_t dst; |
146 | __u16 handle; | 148 | __u16 handle; |
147 | __u16 state; | 149 | __u16 state; |
150 | __u8 mode; | ||
148 | __u8 type; | 151 | __u8 type; |
149 | __u8 out; | 152 | __u8 out; |
150 | __u8 dev_class[3]; | 153 | __u8 dev_class[3]; |
154 | __u8 features[8]; | ||
155 | __u16 interval; | ||
156 | __u16 link_policy; | ||
151 | __u32 link_mode; | 157 | __u32 link_mode; |
158 | __u8 power_save; | ||
152 | unsigned long pend; | 159 | unsigned long pend; |
153 | 160 | ||
154 | unsigned int sent; | 161 | unsigned int sent; |
155 | 162 | ||
156 | struct sk_buff_head data_q; | 163 | struct sk_buff_head data_q; |
157 | 164 | ||
158 | struct timer_list timer; | 165 | struct timer_list disc_timer; |
159 | 166 | struct timer_list idle_timer; | |
167 | |||
160 | struct hci_dev *hdev; | 168 | struct hci_dev *hdev; |
161 | void *l2cap_data; | 169 | void *l2cap_data; |
162 | void *sco_data; | 170 | void *sco_data; |
@@ -211,7 +219,8 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | |||
211 | enum { | 219 | enum { |
212 | HCI_CONN_AUTH_PEND, | 220 | HCI_CONN_AUTH_PEND, |
213 | HCI_CONN_ENCRYPT_PEND, | 221 | HCI_CONN_ENCRYPT_PEND, |
214 | HCI_CONN_RSWITCH_PEND | 222 | HCI_CONN_RSWITCH_PEND, |
223 | HCI_CONN_MODE_CHANGE_PEND, | ||
215 | }; | 224 | }; |
216 | 225 | ||
217 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 226 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
@@ -286,31 +295,27 @@ int hci_conn_encrypt(struct hci_conn *conn); | |||
286 | int hci_conn_change_link_key(struct hci_conn *conn); | 295 | int hci_conn_change_link_key(struct hci_conn *conn); |
287 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); | 296 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); |
288 | 297 | ||
289 | static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout) | 298 | void hci_conn_enter_active_mode(struct hci_conn *conn); |
290 | { | 299 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); |
291 | mod_timer(&conn->timer, jiffies + timeout); | ||
292 | } | ||
293 | |||
294 | static inline void hci_conn_del_timer(struct hci_conn *conn) | ||
295 | { | ||
296 | del_timer(&conn->timer); | ||
297 | } | ||
298 | 300 | ||
299 | static inline void hci_conn_hold(struct hci_conn *conn) | 301 | static inline void hci_conn_hold(struct hci_conn *conn) |
300 | { | 302 | { |
301 | atomic_inc(&conn->refcnt); | 303 | atomic_inc(&conn->refcnt); |
302 | hci_conn_del_timer(conn); | 304 | del_timer(&conn->disc_timer); |
303 | } | 305 | } |
304 | 306 | ||
305 | static inline void hci_conn_put(struct hci_conn *conn) | 307 | static inline void hci_conn_put(struct hci_conn *conn) |
306 | { | 308 | { |
307 | if (atomic_dec_and_test(&conn->refcnt)) { | 309 | if (atomic_dec_and_test(&conn->refcnt)) { |
310 | unsigned long timeo; | ||
308 | if (conn->type == ACL_LINK) { | 311 | if (conn->type == ACL_LINK) { |
309 | unsigned long timeo = (conn->out) ? | 312 | timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); |
310 | HCI_DISCONN_TIMEOUT : HCI_DISCONN_TIMEOUT * 2; | 313 | if (!conn->out) |
311 | hci_conn_set_timer(conn, timeo); | 314 | timeo *= 2; |
315 | del_timer(&conn->idle_timer); | ||
312 | } else | 316 | } else |
313 | hci_conn_set_timer(conn, HZ / 100); | 317 | timeo = msecs_to_jiffies(10); |
318 | mod_timer(&conn->disc_timer, jiffies + timeo); | ||
314 | } | 319 | } |
315 | } | 320 | } |
316 | 321 | ||
@@ -408,11 +413,13 @@ static inline int hci_recv_frame(struct sk_buff *skb) | |||
408 | int hci_register_sysfs(struct hci_dev *hdev); | 413 | int hci_register_sysfs(struct hci_dev *hdev); |
409 | void hci_unregister_sysfs(struct hci_dev *hdev); | 414 | void hci_unregister_sysfs(struct hci_dev *hdev); |
410 | 415 | ||
411 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->class_dev.dev = (pdev)) | 416 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) |
412 | 417 | ||
413 | /* ----- LMP capabilities ----- */ | 418 | /* ----- LMP capabilities ----- */ |
414 | #define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH) | 419 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) |
415 | #define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT) | 420 | #define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) |
421 | #define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) | ||
422 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | ||
416 | 423 | ||
417 | /* ----- HCI protocols ----- */ | 424 | /* ----- HCI protocols ----- */ |
418 | struct hci_proto { | 425 | struct hci_proto { |
diff --git a/include/net/sock.h b/include/net/sock.h index 7b3d6b856946..324b3ea233d6 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
45 | #include <linux/cache.h> | 45 | #include <linux/cache.h> |
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/lockdep.h> | ||
47 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
48 | #include <linux/skbuff.h> /* struct sk_buff */ | 49 | #include <linux/skbuff.h> /* struct sk_buff */ |
49 | #include <linux/security.h> | 50 | #include <linux/security.h> |
@@ -78,14 +79,17 @@ typedef struct { | |||
78 | spinlock_t slock; | 79 | spinlock_t slock; |
79 | struct sock_iocb *owner; | 80 | struct sock_iocb *owner; |
80 | wait_queue_head_t wq; | 81 | wait_queue_head_t wq; |
82 | /* | ||
83 | * We express the mutex-alike socket_lock semantics | ||
84 | * to the lock validator by explicitly managing | ||
85 | * the slock as a lock variant (in addition to | ||
86 | * the slock itself): | ||
87 | */ | ||
88 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
89 | struct lockdep_map dep_map; | ||
90 | #endif | ||
81 | } socket_lock_t; | 91 | } socket_lock_t; |
82 | 92 | ||
83 | #define sock_lock_init(__sk) \ | ||
84 | do { spin_lock_init(&((__sk)->sk_lock.slock)); \ | ||
85 | (__sk)->sk_lock.owner = NULL; \ | ||
86 | init_waitqueue_head(&((__sk)->sk_lock.wq)); \ | ||
87 | } while(0) | ||
88 | |||
89 | struct sock; | 93 | struct sock; |
90 | struct proto; | 94 | struct proto; |
91 | 95 | ||
@@ -747,6 +751,9 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
747 | 751 | ||
748 | /* BH context may only use the following locking interface. */ | 752 | /* BH context may only use the following locking interface. */ |
749 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) | 753 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) |
754 | #define bh_lock_sock_nested(__sk) \ | ||
755 | spin_lock_nested(&((__sk)->sk_lock.slock), \ | ||
756 | SINGLE_DEPTH_NESTING) | ||
750 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 757 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
751 | 758 | ||
752 | extern struct sock *sk_alloc(int family, | 759 | extern struct sock *sk_alloc(int family, |