diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dmaengine.h | 43 | ||||
-rw-r--r-- | include/linux/poison.h | 5 | ||||
-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 |
6 files changed, 137 insertions, 69 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 272010a6078a..c94d8f1d62e5 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -44,7 +44,7 @@ enum dma_event { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * typedef dma_cookie_t | 47 | * typedef dma_cookie_t - an opaque DMA cookie |
48 | * | 48 | * |
49 | * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code | 49 | * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code |
50 | */ | 50 | */ |
@@ -80,14 +80,14 @@ struct dma_chan_percpu { | |||
80 | 80 | ||
81 | /** | 81 | /** |
82 | * struct dma_chan - devices supply DMA channels, clients use them | 82 | * struct dma_chan - devices supply DMA channels, clients use them |
83 | * @client: ptr to the client user of this chan, will be NULL when unused | 83 | * @client: ptr to the client user of this chan, will be %NULL when unused |
84 | * @device: ptr to the dma device who supplies this channel, always !NULL | 84 | * @device: ptr to the dma device who supplies this channel, always !%NULL |
85 | * @cookie: last cookie value returned to client | 85 | * @cookie: last cookie value returned to client |
86 | * @chan_id: | 86 | * @chan_id: channel ID for sysfs |
87 | * @class_dev: | 87 | * @class_dev: class device for sysfs |
88 | * @refcount: kref, used in "bigref" slow-mode | 88 | * @refcount: kref, used in "bigref" slow-mode |
89 | * @slow_ref: | 89 | * @slow_ref: indicates that the DMA channel is free |
90 | * @rcu: | 90 | * @rcu: the DMA channel's RCU head |
91 | * @client_node: used to add this to the client chan list | 91 | * @client_node: used to add this to the client chan list |
92 | * @device_node: used to add this to the device chan list | 92 | * @device_node: used to add this to the device chan list |
93 | * @local: per-cpu pointer to a struct dma_chan_percpu | 93 | * @local: per-cpu pointer to a struct dma_chan_percpu |
@@ -162,10 +162,17 @@ struct dma_client { | |||
162 | * @chancnt: how many DMA channels are supported | 162 | * @chancnt: how many DMA channels are supported |
163 | * @channels: the list of struct dma_chan | 163 | * @channels: the list of struct dma_chan |
164 | * @global_node: list_head for global dma_device_list | 164 | * @global_node: list_head for global dma_device_list |
165 | * @refcount: | 165 | * @refcount: reference count |
166 | * @done: | 166 | * @done: IO completion struct |
167 | * @dev_id: | 167 | * @dev_id: unique device ID |
168 | * Other func ptrs: used to make use of this device's capabilities | 168 | * @device_alloc_chan_resources: allocate resources and return the |
169 | * number of allocated descriptors | ||
170 | * @device_free_chan_resources: release DMA channel's resources | ||
171 | * @device_memcpy_buf_to_buf: memcpy buf pointer to buf pointer | ||
172 | * @device_memcpy_buf_to_pg: memcpy buf pointer to struct page | ||
173 | * @device_memcpy_pg_to_pg: memcpy struct page/offset to struct page/offset | ||
174 | * @device_memcpy_complete: poll the status of an IOAT DMA transaction | ||
175 | * @device_memcpy_issue_pending: push appended descriptors to hardware | ||
169 | */ | 176 | */ |
170 | struct dma_device { | 177 | struct dma_device { |
171 | 178 | ||
@@ -211,7 +218,7 @@ void dma_async_client_chan_request(struct dma_client *client, | |||
211 | * Both @dest and @src must be mappable to a bus address according to the | 218 | * Both @dest and @src must be mappable to a bus address according to the |
212 | * DMA mapping API rules for streaming mappings. | 219 | * DMA mapping API rules for streaming mappings. |
213 | * Both @dest and @src must stay memory resident (kernel memory or locked | 220 | * Both @dest and @src must stay memory resident (kernel memory or locked |
214 | * user space pages) | 221 | * user space pages). |
215 | */ | 222 | */ |
216 | static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, | 223 | static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, |
217 | void *dest, void *src, size_t len) | 224 | void *dest, void *src, size_t len) |
@@ -225,7 +232,7 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, | |||
225 | } | 232 | } |
226 | 233 | ||
227 | /** | 234 | /** |
228 | * dma_async_memcpy_buf_to_pg - offloaded copy | 235 | * dma_async_memcpy_buf_to_pg - offloaded copy from address to page |
229 | * @chan: DMA channel to offload copy to | 236 | * @chan: DMA channel to offload copy to |
230 | * @page: destination page | 237 | * @page: destination page |
231 | * @offset: offset in page to copy to | 238 | * @offset: offset in page to copy to |
@@ -250,18 +257,18 @@ static inline dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, | |||
250 | } | 257 | } |
251 | 258 | ||
252 | /** | 259 | /** |
253 | * dma_async_memcpy_buf_to_pg - offloaded copy | 260 | * dma_async_memcpy_pg_to_pg - offloaded copy from page to page |
254 | * @chan: DMA channel to offload copy to | 261 | * @chan: DMA channel to offload copy to |
255 | * @dest_page: destination page | 262 | * @dest_pg: destination page |
256 | * @dest_off: offset in page to copy to | 263 | * @dest_off: offset in page to copy to |
257 | * @src_page: source page | 264 | * @src_pg: source page |
258 | * @src_off: offset in page to copy from | 265 | * @src_off: offset in page to copy from |
259 | * @len: length | 266 | * @len: length |
260 | * | 267 | * |
261 | * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus | 268 | * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus |
262 | * address according to the DMA mapping API rules for streaming mappings. | 269 | * address according to the DMA mapping API rules for streaming mappings. |
263 | * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident | 270 | * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident |
264 | * (kernel memory or locked user space pages) | 271 | * (kernel memory or locked user space pages). |
265 | */ | 272 | */ |
266 | static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, | 273 | static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, |
267 | struct page *dest_pg, unsigned int dest_off, struct page *src_pg, | 274 | struct page *dest_pg, unsigned int dest_off, struct page *src_pg, |
@@ -278,7 +285,7 @@ static inline dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan, | |||
278 | 285 | ||
279 | /** | 286 | /** |
280 | * dma_async_memcpy_issue_pending - flush pending copies to HW | 287 | * dma_async_memcpy_issue_pending - flush pending copies to HW |
281 | * @chan: | 288 | * @chan: target DMA channel |
282 | * | 289 | * |
283 | * This allows drivers to push copies to HW in batches, | 290 | * This allows drivers to push copies to HW in batches, |
284 | * reducing MMIO writes where possible. | 291 | * reducing MMIO writes where possible. |
diff --git a/include/linux/poison.h b/include/linux/poison.h index a5347c02432e..3e628f990fdf 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
@@ -44,6 +44,11 @@ | |||
44 | 44 | ||
45 | /********** drivers/atm/ **********/ | 45 | /********** drivers/atm/ **********/ |
46 | #define ATM_POISON_FREE 0x12 | 46 | #define ATM_POISON_FREE 0x12 |
47 | #define ATM_POISON 0xdeadbeef | ||
48 | |||
49 | /********** net/ **********/ | ||
50 | #define NEIGHBOR_DEAD 0xdeadbeef | ||
51 | #define NETFILTER_LINK_POISON 0xdead57ac | ||
47 | 52 | ||
48 | /********** kernel/mutexes **********/ | 53 | /********** kernel/mutexes **********/ |
49 | #define MUTEX_DEBUG_INIT 0x11 | 54 | #define MUTEX_DEBUG_INIT 0x11 |
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 { |