[Bluetooth] Disable disconnect timer during Simple Pairing
[pandora-kernel.git] / include / net / bluetooth / hci_core.h
1 /* 
2    BlueZ - Bluetooth protocol stack for Linux
3    Copyright (C) 2000-2001 Qualcomm Incorporated
4
5    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License version 2 as
9    published by the Free Software Foundation;
10
11    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
16    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
17    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
18    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
21    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
22    SOFTWARE IS DISCLAIMED.
23 */
24
25 #ifndef __HCI_CORE_H
26 #define __HCI_CORE_H
27
28 #include <net/bluetooth/hci.h>
29
30 /* HCI upper protocols */
31 #define HCI_PROTO_L2CAP 0
32 #define HCI_PROTO_SCO   1
33
34 /* HCI Core structures */
35 struct inquiry_data {
36         bdaddr_t        bdaddr;
37         __u8            pscan_rep_mode;
38         __u8            pscan_period_mode;
39         __u8            pscan_mode;
40         __u8            dev_class[3];
41         __le16          clock_offset;
42         __s8            rssi;
43 };
44
45 struct inquiry_entry {
46         struct inquiry_entry    *next;
47         __u32                   timestamp;
48         struct inquiry_data     data;
49 };
50
51 struct inquiry_cache {
52         spinlock_t              lock;
53         __u32                   timestamp;
54         struct inquiry_entry    *list;
55 };
56
57 struct hci_conn_hash {
58         struct list_head list;
59         spinlock_t       lock;
60         unsigned int     acl_num;
61         unsigned int     sco_num;
62 };
63
64 struct hci_dev {
65         struct list_head list;
66         spinlock_t      lock;
67         atomic_t        refcnt;
68
69         char            name[8];
70         unsigned long   flags;
71         __u16           id;
72         __u8            type;
73         bdaddr_t        bdaddr;
74         __u8            dev_name[248];
75         __u8            dev_class[3];
76         __u8            features[8];
77         __u8            commands[64];
78         __u8            hci_ver;
79         __u16           hci_rev;
80         __u16           manufacturer;
81         __u16           voice_setting;
82
83         __u16           pkt_type;
84         __u16           esco_type;
85         __u16           link_policy;
86         __u16           link_mode;
87
88         __u32           idle_timeout;
89         __u16           sniff_min_interval;
90         __u16           sniff_max_interval;
91
92         unsigned long   quirks;
93
94         atomic_t        cmd_cnt;
95         unsigned int    acl_cnt;
96         unsigned int    sco_cnt;
97
98         unsigned int    acl_mtu;
99         unsigned int    sco_mtu;
100         unsigned int    acl_pkts;
101         unsigned int    sco_pkts;
102
103         unsigned long   cmd_last_tx;
104         unsigned long   acl_last_tx;
105         unsigned long   sco_last_tx;
106
107         struct tasklet_struct   cmd_task;
108         struct tasklet_struct   rx_task;
109         struct tasklet_struct   tx_task;
110
111         struct sk_buff_head     rx_q;
112         struct sk_buff_head     raw_q;
113         struct sk_buff_head     cmd_q;
114
115         struct sk_buff          *sent_cmd;
116         struct sk_buff          *reassembly[3];
117
118         struct semaphore        req_lock;
119         wait_queue_head_t       req_wait_q;
120         __u32                   req_status;
121         __u32                   req_result;
122
123         struct inquiry_cache    inq_cache;
124         struct hci_conn_hash    conn_hash;
125
126         struct hci_dev_stats    stat;
127
128         struct sk_buff_head     driver_init;
129
130         void                    *driver_data;
131         void                    *core_data;
132
133         atomic_t                promisc;
134
135         struct device           *parent;
136         struct device           dev;
137
138         struct module           *owner;
139
140         int (*open)(struct hci_dev *hdev);
141         int (*close)(struct hci_dev *hdev);
142         int (*flush)(struct hci_dev *hdev);
143         int (*send)(struct sk_buff *skb);
144         void (*destruct)(struct hci_dev *hdev);
145         void (*notify)(struct hci_dev *hdev, unsigned int evt);
146         int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
147 };
148
149 struct hci_conn {
150         struct list_head list;
151
152         atomic_t         refcnt;
153         spinlock_t       lock;
154
155         bdaddr_t         dst;
156         __u16            handle;
157         __u16            state;
158         __u8             mode;
159         __u8             type;
160         __u8             out;
161         __u8             attempt;
162         __u8             dev_class[3];
163         __u8             features[8];
164         __u16            interval;
165         __u16            pkt_type;
166         __u16            link_policy;
167         __u32            link_mode;
168         __u8             power_save;
169         unsigned long    pend;
170
171         unsigned int     sent;
172
173         struct sk_buff_head data_q;
174
175         struct timer_list disc_timer;
176         struct timer_list idle_timer;
177
178         struct work_struct work;
179
180         struct device   dev;
181
182         struct hci_dev  *hdev;
183         void            *l2cap_data;
184         void            *sco_data;
185         void            *priv;
186
187         struct hci_conn *link;
188 };
189
190 extern struct hci_proto *hci_proto[];
191 extern struct list_head hci_dev_list;
192 extern struct list_head hci_cb_list;
193 extern rwlock_t hci_dev_list_lock;
194 extern rwlock_t hci_cb_list_lock;
195
196 /* ----- Inquiry cache ----- */
197 #define INQUIRY_CACHE_AGE_MAX   (HZ*30)   // 30 seconds
198 #define INQUIRY_ENTRY_AGE_MAX   (HZ*60)   // 60 seconds
199
200 #define inquiry_cache_lock(c)           spin_lock(&c->lock)
201 #define inquiry_cache_unlock(c)         spin_unlock(&c->lock)
202 #define inquiry_cache_lock_bh(c)        spin_lock_bh(&c->lock)
203 #define inquiry_cache_unlock_bh(c)      spin_unlock_bh(&c->lock)
204
205 static inline void inquiry_cache_init(struct hci_dev *hdev)
206 {
207         struct inquiry_cache *c = &hdev->inq_cache;
208         spin_lock_init(&c->lock);
209         c->list = NULL;
210 }
211
212 static inline int inquiry_cache_empty(struct hci_dev *hdev)
213 {
214         struct inquiry_cache *c = &hdev->inq_cache;
215         return (c->list == NULL);
216 }
217
218 static inline long inquiry_cache_age(struct hci_dev *hdev)
219 {
220         struct inquiry_cache *c = &hdev->inq_cache;
221         return jiffies - c->timestamp;
222 }
223
224 static inline long inquiry_entry_age(struct inquiry_entry *e)
225 {
226         return jiffies - e->timestamp;
227 }
228
229 struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
230 void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data);
231
232 /* ----- HCI Connections ----- */
233 enum {
234         HCI_CONN_AUTH_PEND,
235         HCI_CONN_ENCRYPT_PEND,
236         HCI_CONN_RSWITCH_PEND,
237         HCI_CONN_MODE_CHANGE_PEND,
238 };
239
240 static inline void hci_conn_hash_init(struct hci_dev *hdev)
241 {
242         struct hci_conn_hash *h = &hdev->conn_hash;
243         INIT_LIST_HEAD(&h->list);
244         spin_lock_init(&h->lock);
245         h->acl_num = 0;
246         h->sco_num = 0;
247 }
248
249 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
250 {
251         struct hci_conn_hash *h = &hdev->conn_hash;
252         list_add(&c->list, &h->list);
253         if (c->type == ACL_LINK)
254                 h->acl_num++;
255         else
256                 h->sco_num++;
257 }
258
259 static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
260 {
261         struct hci_conn_hash *h = &hdev->conn_hash;
262         list_del(&c->list);
263         if (c->type == ACL_LINK)
264                 h->acl_num--;
265         else
266                 h->sco_num--;
267 }
268
269 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
270                                         __u16 handle)
271 {
272         struct hci_conn_hash *h = &hdev->conn_hash;
273         struct list_head *p;
274         struct hci_conn  *c;
275
276         list_for_each(p, &h->list) {
277                 c = list_entry(p, struct hci_conn, list);
278                 if (c->handle == handle)
279                         return c;
280         }
281         return NULL;
282 }
283
284 static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
285                                         __u8 type, bdaddr_t *ba)
286 {
287         struct hci_conn_hash *h = &hdev->conn_hash;
288         struct list_head *p;
289         struct hci_conn  *c;
290
291         list_for_each(p, &h->list) {
292                 c = list_entry(p, struct hci_conn, list);
293                 if (c->type == type && !bacmp(&c->dst, ba))
294                         return c;
295         }
296         return NULL;
297 }
298
299 static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
300                                         __u8 type, __u16 state)
301 {
302         struct hci_conn_hash *h = &hdev->conn_hash;
303         struct list_head *p;
304         struct hci_conn  *c;
305
306         list_for_each(p, &h->list) {
307                 c = list_entry(p, struct hci_conn, list);
308                 if (c->type == type && c->state == state)
309                         return c;
310         }
311         return NULL;
312 }
313
314 void hci_acl_connect(struct hci_conn *conn);
315 void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
316 void hci_add_sco(struct hci_conn *conn, __u16 handle);
317 void hci_setup_sync(struct hci_conn *conn, __u16 handle);
318
319 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
320 int hci_conn_del(struct hci_conn *conn);
321 void hci_conn_hash_flush(struct hci_dev *hdev);
322 void hci_conn_check_pending(struct hci_dev *hdev);
323
324 struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *src);
325 int hci_conn_auth(struct hci_conn *conn);
326 int hci_conn_encrypt(struct hci_conn *conn);
327 int hci_conn_change_link_key(struct hci_conn *conn);
328 int hci_conn_switch_role(struct hci_conn *conn, uint8_t role);
329
330 void hci_conn_enter_active_mode(struct hci_conn *conn);
331 void hci_conn_enter_sniff_mode(struct hci_conn *conn);
332
333 static inline void hci_conn_hold(struct hci_conn *conn)
334 {
335         atomic_inc(&conn->refcnt);
336         del_timer(&conn->disc_timer);
337 }
338
339 static inline void hci_conn_put(struct hci_conn *conn)
340 {
341         if (atomic_dec_and_test(&conn->refcnt)) {
342                 unsigned long timeo;
343                 if (conn->type == ACL_LINK) {
344                         del_timer(&conn->idle_timer);
345                         if (conn->state == BT_CONNECTED) {
346                                 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
347                                 if (!conn->out)
348                                         timeo *= 2;
349                         } else
350                                 timeo = msecs_to_jiffies(10);
351                 } else
352                         timeo = msecs_to_jiffies(10);
353                 mod_timer(&conn->disc_timer, jiffies + timeo);
354         }
355 }
356
357 /* ----- HCI tasks ----- */
358 static inline void hci_sched_cmd(struct hci_dev *hdev)
359 {
360         tasklet_schedule(&hdev->cmd_task);
361 }
362
363 static inline void hci_sched_rx(struct hci_dev *hdev)
364 {
365         tasklet_schedule(&hdev->rx_task);
366 }
367
368 static inline void hci_sched_tx(struct hci_dev *hdev)
369 {
370         tasklet_schedule(&hdev->tx_task);
371 }
372
373 /* ----- HCI Devices ----- */
374 static inline void __hci_dev_put(struct hci_dev *d)
375 {
376         if (atomic_dec_and_test(&d->refcnt))
377                 d->destruct(d);
378 }
379
380 static inline void hci_dev_put(struct hci_dev *d)
381
382         __hci_dev_put(d);
383         module_put(d->owner);
384 }
385
386 static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
387 {
388         atomic_inc(&d->refcnt);
389         return d;
390 }
391
392 static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
393 {
394         if (try_module_get(d->owner))
395                 return __hci_dev_hold(d);
396         return NULL;
397 }
398
399 #define hci_dev_lock(d)         spin_lock(&d->lock)
400 #define hci_dev_unlock(d)       spin_unlock(&d->lock)
401 #define hci_dev_lock_bh(d)      spin_lock_bh(&d->lock)
402 #define hci_dev_unlock_bh(d)    spin_unlock_bh(&d->lock)
403
404 struct hci_dev *hci_dev_get(int index);
405 struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
406
407 struct hci_dev *hci_alloc_dev(void);
408 void hci_free_dev(struct hci_dev *hdev);
409 int hci_register_dev(struct hci_dev *hdev);
410 int hci_unregister_dev(struct hci_dev *hdev);
411 int hci_suspend_dev(struct hci_dev *hdev);
412 int hci_resume_dev(struct hci_dev *hdev);
413 int hci_dev_open(__u16 dev);
414 int hci_dev_close(__u16 dev);
415 int hci_dev_reset(__u16 dev);
416 int hci_dev_reset_stat(__u16 dev);
417 int hci_dev_cmd(unsigned int cmd, void __user *arg);
418 int hci_get_dev_list(void __user *arg);
419 int hci_get_dev_info(void __user *arg);
420 int hci_get_conn_list(void __user *arg);
421 int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
422 int hci_inquiry(void __user *arg);
423
424 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
425
426 /* Receive frame from HCI drivers */
427 static inline int hci_recv_frame(struct sk_buff *skb)
428 {
429         struct hci_dev *hdev = (struct hci_dev *) skb->dev;
430         if (!hdev || (!test_bit(HCI_UP, &hdev->flags) 
431                         && !test_bit(HCI_INIT, &hdev->flags))) {
432                 kfree_skb(skb);
433                 return -ENXIO;
434         }
435
436         /* Incomming skb */
437         bt_cb(skb)->incoming = 1;
438
439         /* Time stamp */
440         __net_timestamp(skb);
441
442         /* Queue frame for rx task */
443         skb_queue_tail(&hdev->rx_q, skb);
444         hci_sched_rx(hdev);
445         return 0;
446 }
447
448 int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
449
450 int hci_register_sysfs(struct hci_dev *hdev);
451 void hci_unregister_sysfs(struct hci_dev *hdev);
452 void hci_conn_add_sysfs(struct hci_conn *conn);
453 void hci_conn_del_sysfs(struct hci_conn *conn);
454
455 #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
456
457 /* ----- LMP capabilities ----- */
458 #define lmp_rswitch_capable(dev)   ((dev)->features[0] & LMP_RSWITCH)
459 #define lmp_encrypt_capable(dev)   ((dev)->features[0] & LMP_ENCRYPT)
460 #define lmp_sniff_capable(dev)     ((dev)->features[0] & LMP_SNIFF)
461 #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
462 #define lmp_esco_capable(dev)      ((dev)->features[3] & LMP_ESCO)
463
464 /* ----- HCI protocols ----- */
465 struct hci_proto {
466         char            *name;
467         unsigned int    id;
468         unsigned long   flags;
469
470         void            *priv;
471
472         int (*connect_ind)      (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);
473         int (*connect_cfm)      (struct hci_conn *conn, __u8 status);
474         int (*disconn_ind)      (struct hci_conn *conn, __u8 reason);
475         int (*recv_acldata)     (struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
476         int (*recv_scodata)     (struct hci_conn *conn, struct sk_buff *skb);
477         int (*auth_cfm)         (struct hci_conn *conn, __u8 status);
478         int (*encrypt_cfm)      (struct hci_conn *conn, __u8 status, __u8 encrypt);
479 };
480
481 static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
482 {
483         register struct hci_proto *hp;
484         int mask = 0;
485         
486         hp = hci_proto[HCI_PROTO_L2CAP];
487         if (hp && hp->connect_ind)
488                 mask |= hp->connect_ind(hdev, bdaddr, type);
489
490         hp = hci_proto[HCI_PROTO_SCO];
491         if (hp && hp->connect_ind)
492                 mask |= hp->connect_ind(hdev, bdaddr, type);
493
494         return mask;
495 }
496
497 static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
498 {
499         register struct hci_proto *hp;
500
501         hp = hci_proto[HCI_PROTO_L2CAP];
502         if (hp && hp->connect_cfm)
503                 hp->connect_cfm(conn, status);
504
505         hp = hci_proto[HCI_PROTO_SCO];
506         if (hp && hp->connect_cfm)
507                 hp->connect_cfm(conn, status);
508 }
509
510 static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason)
511 {
512         register struct hci_proto *hp;
513
514         hp = hci_proto[HCI_PROTO_L2CAP];
515         if (hp && hp->disconn_ind)
516                 hp->disconn_ind(conn, reason);
517
518         hp = hci_proto[HCI_PROTO_SCO];
519         if (hp && hp->disconn_ind)
520                 hp->disconn_ind(conn, reason);
521 }
522
523 static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
524 {
525         register struct hci_proto *hp;
526
527         hp = hci_proto[HCI_PROTO_L2CAP];
528         if (hp && hp->auth_cfm)
529                 hp->auth_cfm(conn, status);
530
531         hp = hci_proto[HCI_PROTO_SCO];
532         if (hp && hp->auth_cfm)
533                 hp->auth_cfm(conn, status);
534 }
535
536 static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
537 {
538         register struct hci_proto *hp;
539
540         hp = hci_proto[HCI_PROTO_L2CAP];
541         if (hp && hp->encrypt_cfm)
542                 hp->encrypt_cfm(conn, status, encrypt);
543
544         hp = hci_proto[HCI_PROTO_SCO];
545         if (hp && hp->encrypt_cfm)
546                 hp->encrypt_cfm(conn, status, encrypt);
547 }
548
549 int hci_register_proto(struct hci_proto *hproto);
550 int hci_unregister_proto(struct hci_proto *hproto);
551
552 /* ----- HCI callbacks ----- */
553 struct hci_cb {
554         struct list_head list;
555
556         char *name;
557
558         void (*auth_cfm)        (struct hci_conn *conn, __u8 status);
559         void (*encrypt_cfm)     (struct hci_conn *conn, __u8 status, __u8 encrypt);
560         void (*key_change_cfm)  (struct hci_conn *conn, __u8 status);
561         void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
562 };
563
564 static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
565 {
566         struct list_head *p;
567
568         hci_proto_auth_cfm(conn, status);
569
570         read_lock_bh(&hci_cb_list_lock);
571         list_for_each(p, &hci_cb_list) {
572                 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
573                 if (cb->auth_cfm)
574                         cb->auth_cfm(conn, status);
575         }
576         read_unlock_bh(&hci_cb_list_lock);
577 }
578
579 static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
580 {
581         struct list_head *p;
582
583         hci_proto_encrypt_cfm(conn, status, encrypt);
584
585         read_lock_bh(&hci_cb_list_lock);
586         list_for_each(p, &hci_cb_list) {
587                 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
588                 if (cb->encrypt_cfm)
589                         cb->encrypt_cfm(conn, status, encrypt);
590         }
591         read_unlock_bh(&hci_cb_list_lock);
592 }
593
594 static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
595 {
596         struct list_head *p;
597
598         read_lock_bh(&hci_cb_list_lock);
599         list_for_each(p, &hci_cb_list) {
600                 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
601                 if (cb->key_change_cfm)
602                         cb->key_change_cfm(conn, status);
603         }
604         read_unlock_bh(&hci_cb_list_lock);
605 }
606
607 static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, __u8 role)
608 {
609         struct list_head *p;
610
611         read_lock_bh(&hci_cb_list_lock);
612         list_for_each(p, &hci_cb_list) {
613                 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
614                 if (cb->role_switch_cfm)
615                         cb->role_switch_cfm(conn, status, role);
616         }
617         read_unlock_bh(&hci_cb_list_lock);
618 }
619
620 int hci_register_cb(struct hci_cb *hcb);
621 int hci_unregister_cb(struct hci_cb *hcb);
622
623 int hci_register_notifier(struct notifier_block *nb);
624 int hci_unregister_notifier(struct notifier_block *nb);
625
626 int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
627 int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
628 int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
629
630 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
631
632 void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
633
634 /* ----- HCI Sockets ----- */
635 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
636
637 /* HCI info for socket */
638 #define hci_pi(sk) ((struct hci_pinfo *) sk)
639
640 struct hci_pinfo {
641         struct bt_sock    bt;
642         struct hci_dev    *hdev;
643         struct hci_filter filter;
644         __u32             cmsg_mask;
645 };
646
647 /* HCI security filter */
648 #define HCI_SFLT_MAX_OGF  5
649
650 struct hci_sec_filter {
651         __u32 type_mask;
652         __u32 event_mask[2];
653         __u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4];
654 };
655
656 /* ----- HCI requests ----- */
657 #define HCI_REQ_DONE      0
658 #define HCI_REQ_PEND      1
659 #define HCI_REQ_CANCELED  2
660
661 #define hci_req_lock(d)         down(&d->req_lock)
662 #define hci_req_unlock(d)       up(&d->req_lock)
663
664 void hci_req_complete(struct hci_dev *hdev, int result);
665
666 #endif /* __HCI_CORE_H */