diff options
Diffstat (limited to 'include/net')
38 files changed, 1302 insertions, 442 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 008711e8e78f..342dcf13d039 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -40,6 +40,7 @@ | |||
40 | * @P9_DEBUG_FID: fid allocation/deallocation tracking | 40 | * @P9_DEBUG_FID: fid allocation/deallocation tracking |
41 | * @P9_DEBUG_PKT: packet marshalling/unmarshalling | 41 | * @P9_DEBUG_PKT: packet marshalling/unmarshalling |
42 | * @P9_DEBUG_FSC: FS-cache tracing | 42 | * @P9_DEBUG_FSC: FS-cache tracing |
43 | * @P9_DEBUG_VPKT: Verbose packet debugging (full packet dump) | ||
43 | * | 44 | * |
44 | * These flags are passed at mount time to turn on various levels of | 45 | * These flags are passed at mount time to turn on various levels of |
45 | * verbosity and tracing which will be output to the system logs. | 46 | * verbosity and tracing which will be output to the system logs. |
@@ -57,6 +58,7 @@ enum p9_debug_flags { | |||
57 | P9_DEBUG_FID = (1<<9), | 58 | P9_DEBUG_FID = (1<<9), |
58 | P9_DEBUG_PKT = (1<<10), | 59 | P9_DEBUG_PKT = (1<<10), |
59 | P9_DEBUG_FSC = (1<<11), | 60 | P9_DEBUG_FSC = (1<<11), |
61 | P9_DEBUG_VPKT = (1<<12), | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | #ifdef CONFIG_NET_9P_DEBUG | 64 | #ifdef CONFIG_NET_9P_DEBUG |
@@ -74,10 +76,14 @@ do { \ | |||
74 | } \ | 76 | } \ |
75 | } while (0) | 77 | } while (0) |
76 | 78 | ||
79 | #define P9_DUMP_PKT(way, pdu) p9pdu_dump(way, pdu) | ||
80 | |||
77 | #else | 81 | #else |
78 | #define P9_DPRINTK(level, format, arg...) do { } while (0) | 82 | #define P9_DPRINTK(level, format, arg...) do { } while (0) |
83 | #define P9_DUMP_PKT(way, pdu) do { } while (0) | ||
79 | #endif | 84 | #endif |
80 | 85 | ||
86 | |||
81 | #define P9_EPRINTK(level, format, arg...) \ | 87 | #define P9_EPRINTK(level, format, arg...) \ |
82 | do { \ | 88 | do { \ |
83 | printk(level "9p: %s (%d): " \ | 89 | printk(level "9p: %s (%d): " \ |
@@ -175,6 +181,10 @@ enum p9_msg_t { | |||
175 | P9_RLINK, | 181 | P9_RLINK, |
176 | P9_TMKDIR = 72, | 182 | P9_TMKDIR = 72, |
177 | P9_RMKDIR, | 183 | P9_RMKDIR, |
184 | P9_TRENAMEAT = 74, | ||
185 | P9_RRENAMEAT, | ||
186 | P9_TUNLINKAT = 76, | ||
187 | P9_RUNLINKAT, | ||
178 | P9_TVERSION = 100, | 188 | P9_TVERSION = 100, |
179 | P9_RVERSION, | 189 | P9_RVERSION, |
180 | P9_TAUTH = 102, | 190 | P9_TAUTH = 102, |
@@ -321,21 +331,6 @@ enum p9_qid_t { | |||
321 | #define P9_READDIRHDRSZ 24 | 331 | #define P9_READDIRHDRSZ 24 |
322 | 332 | ||
323 | /** | 333 | /** |
324 | * struct p9_str - length prefixed string type | ||
325 | * @len: length of the string | ||
326 | * @str: the string | ||
327 | * | ||
328 | * The protocol uses length prefixed strings for all | ||
329 | * string data, so we replicate that for our internal | ||
330 | * string members. | ||
331 | */ | ||
332 | |||
333 | struct p9_str { | ||
334 | u16 len; | ||
335 | char *str; | ||
336 | }; | ||
337 | |||
338 | /** | ||
339 | * struct p9_qid - file system entity information | 334 | * struct p9_qid - file system entity information |
340 | * @type: 8-bit type &p9_qid_t | 335 | * @type: 8-bit type &p9_qid_t |
341 | * @version: 16-bit monotonically incrementing version number | 336 | * @version: 16-bit monotonically incrementing version number |
@@ -371,11 +366,11 @@ struct p9_qid { | |||
371 | * @atime: Last access/read time | 366 | * @atime: Last access/read time |
372 | * @mtime: Last modify/write time | 367 | * @mtime: Last modify/write time |
373 | * @length: file length | 368 | * @length: file length |
374 | * @name: last element of path (aka filename) in type &p9_str | 369 | * @name: last element of path (aka filename) |
375 | * @uid: owner name in type &p9_str | 370 | * @uid: owner name |
376 | * @gid: group owner in type &p9_str | 371 | * @gid: group owner |
377 | * @muid: last modifier in type &p9_str | 372 | * @muid: last modifier |
378 | * @extension: area used to encode extended UNIX support in type &p9_str | 373 | * @extension: area used to encode extended UNIX support |
379 | * @n_uid: numeric user id of owner (part of 9p2000.u extension) | 374 | * @n_uid: numeric user id of owner (part of 9p2000.u extension) |
380 | * @n_gid: numeric group id (part of 9p2000.u extension) | 375 | * @n_gid: numeric group id (part of 9p2000.u extension) |
381 | * @n_muid: numeric user id of laster modifier (part of 9p2000.u extension) | 376 | * @n_muid: numeric user id of laster modifier (part of 9p2000.u extension) |
@@ -512,11 +507,6 @@ struct p9_getlock { | |||
512 | char *client_id; | 507 | char *client_id; |
513 | }; | 508 | }; |
514 | 509 | ||
515 | /* Structures for Protocol Operations */ | ||
516 | struct p9_tstatfs { | ||
517 | u32 fid; | ||
518 | }; | ||
519 | |||
520 | struct p9_rstatfs { | 510 | struct p9_rstatfs { |
521 | u32 type; | 511 | u32 type; |
522 | u32 bsize; | 512 | u32 bsize; |
@@ -529,159 +519,6 @@ struct p9_rstatfs { | |||
529 | u32 namelen; | 519 | u32 namelen; |
530 | }; | 520 | }; |
531 | 521 | ||
532 | struct p9_trename { | ||
533 | u32 fid; | ||
534 | u32 newdirfid; | ||
535 | struct p9_str name; | ||
536 | }; | ||
537 | |||
538 | struct p9_rrename { | ||
539 | }; | ||
540 | |||
541 | struct p9_tversion { | ||
542 | u32 msize; | ||
543 | struct p9_str version; | ||
544 | }; | ||
545 | |||
546 | struct p9_rversion { | ||
547 | u32 msize; | ||
548 | struct p9_str version; | ||
549 | }; | ||
550 | |||
551 | struct p9_tauth { | ||
552 | u32 afid; | ||
553 | struct p9_str uname; | ||
554 | struct p9_str aname; | ||
555 | u32 n_uname; /* 9P2000.u extensions */ | ||
556 | }; | ||
557 | |||
558 | struct p9_rauth { | ||
559 | struct p9_qid qid; | ||
560 | }; | ||
561 | |||
562 | struct p9_rerror { | ||
563 | struct p9_str error; | ||
564 | u32 errno; /* 9p2000.u extension */ | ||
565 | }; | ||
566 | |||
567 | struct p9_tflush { | ||
568 | u16 oldtag; | ||
569 | }; | ||
570 | |||
571 | struct p9_rflush { | ||
572 | }; | ||
573 | |||
574 | struct p9_tattach { | ||
575 | u32 fid; | ||
576 | u32 afid; | ||
577 | struct p9_str uname; | ||
578 | struct p9_str aname; | ||
579 | u32 n_uname; /* 9P2000.u extensions */ | ||
580 | }; | ||
581 | |||
582 | struct p9_rattach { | ||
583 | struct p9_qid qid; | ||
584 | }; | ||
585 | |||
586 | struct p9_twalk { | ||
587 | u32 fid; | ||
588 | u32 newfid; | ||
589 | u16 nwname; | ||
590 | struct p9_str wnames[16]; | ||
591 | }; | ||
592 | |||
593 | struct p9_rwalk { | ||
594 | u16 nwqid; | ||
595 | struct p9_qid wqids[16]; | ||
596 | }; | ||
597 | |||
598 | struct p9_topen { | ||
599 | u32 fid; | ||
600 | u8 mode; | ||
601 | }; | ||
602 | |||
603 | struct p9_ropen { | ||
604 | struct p9_qid qid; | ||
605 | u32 iounit; | ||
606 | }; | ||
607 | |||
608 | struct p9_tcreate { | ||
609 | u32 fid; | ||
610 | struct p9_str name; | ||
611 | u32 perm; | ||
612 | u8 mode; | ||
613 | struct p9_str extension; | ||
614 | }; | ||
615 | |||
616 | struct p9_rcreate { | ||
617 | struct p9_qid qid; | ||
618 | u32 iounit; | ||
619 | }; | ||
620 | |||
621 | struct p9_tread { | ||
622 | u32 fid; | ||
623 | u64 offset; | ||
624 | u32 count; | ||
625 | }; | ||
626 | |||
627 | struct p9_rread { | ||
628 | u32 count; | ||
629 | u8 *data; | ||
630 | }; | ||
631 | |||
632 | struct p9_twrite { | ||
633 | u32 fid; | ||
634 | u64 offset; | ||
635 | u32 count; | ||
636 | u8 *data; | ||
637 | }; | ||
638 | |||
639 | struct p9_rwrite { | ||
640 | u32 count; | ||
641 | }; | ||
642 | |||
643 | struct p9_treaddir { | ||
644 | u32 fid; | ||
645 | u64 offset; | ||
646 | u32 count; | ||
647 | }; | ||
648 | |||
649 | struct p9_rreaddir { | ||
650 | u32 count; | ||
651 | u8 *data; | ||
652 | }; | ||
653 | |||
654 | |||
655 | struct p9_tclunk { | ||
656 | u32 fid; | ||
657 | }; | ||
658 | |||
659 | struct p9_rclunk { | ||
660 | }; | ||
661 | |||
662 | struct p9_tremove { | ||
663 | u32 fid; | ||
664 | }; | ||
665 | |||
666 | struct p9_rremove { | ||
667 | }; | ||
668 | |||
669 | struct p9_tstat { | ||
670 | u32 fid; | ||
671 | }; | ||
672 | |||
673 | struct p9_rstat { | ||
674 | struct p9_wstat stat; | ||
675 | }; | ||
676 | |||
677 | struct p9_twstat { | ||
678 | u32 fid; | ||
679 | struct p9_wstat stat; | ||
680 | }; | ||
681 | |||
682 | struct p9_rwstat { | ||
683 | }; | ||
684 | |||
685 | /** | 522 | /** |
686 | * struct p9_fcall - primary packet structure | 523 | * struct p9_fcall - primary packet structure |
687 | * @size: prefixed length of the structure | 524 | * @size: prefixed length of the structure |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index d26d5e98a173..55ce72ce9861 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
@@ -36,9 +36,9 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | enum p9_proto_versions{ | 38 | enum p9_proto_versions{ |
39 | p9_proto_legacy = 0, | 39 | p9_proto_legacy, |
40 | p9_proto_2000u = 1, | 40 | p9_proto_2000u, |
41 | p9_proto_2000L = 2, | 41 | p9_proto_2000L, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | 44 | ||
@@ -211,7 +211,10 @@ struct p9_dirent { | |||
211 | }; | 211 | }; |
212 | 212 | ||
213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); |
214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); | 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, |
215 | const char *name); | ||
216 | int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name, | ||
217 | struct p9_fid *newdirfid, const char *new_name); | ||
215 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 218 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
216 | void p9_client_destroy(struct p9_client *clnt); | 219 | void p9_client_destroy(struct p9_client *clnt); |
217 | void p9_client_disconnect(struct p9_client *clnt); | 220 | void p9_client_disconnect(struct p9_client *clnt); |
@@ -231,6 +234,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | |||
231 | int p9_client_clunk(struct p9_fid *fid); | 234 | int p9_client_clunk(struct p9_fid *fid); |
232 | int p9_client_fsync(struct p9_fid *fid, int datasync); | 235 | int p9_client_fsync(struct p9_fid *fid, int datasync); |
233 | int p9_client_remove(struct p9_fid *fid); | 236 | int p9_client_remove(struct p9_fid *fid); |
237 | int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags); | ||
234 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 238 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
235 | u64 offset, u32 count); | 239 | u64 offset, u32 count); |
236 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | 240 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index d8549fb9c742..83531ebeee99 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -67,7 +67,7 @@ struct p9_trans_module { | |||
67 | 67 | ||
68 | void v9fs_register_trans(struct p9_trans_module *m); | 68 | void v9fs_register_trans(struct p9_trans_module *m); |
69 | void v9fs_unregister_trans(struct p9_trans_module *m); | 69 | void v9fs_unregister_trans(struct p9_trans_module *m); |
70 | struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name); | 70 | struct p9_trans_module *v9fs_get_trans_by_name(char *s); |
71 | struct p9_trans_module *v9fs_get_default_trans(void); | 71 | struct p9_trans_module *v9fs_get_default_trans(void); |
72 | void v9fs_put_trans(struct p9_trans_module *m); | 72 | void v9fs_put_trans(struct p9_trans_module *m); |
73 | #endif /* NET_9P_TRANSPORT_H */ | 73 | #endif /* NET_9P_TRANSPORT_H */ |
diff --git a/include/net/act_api.h b/include/net/act_api.h index bab385f13ac3..c739531e1564 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -72,7 +72,7 @@ struct tcf_act_hdr { | |||
72 | 72 | ||
73 | struct tc_action { | 73 | struct tc_action { |
74 | void *priv; | 74 | void *priv; |
75 | struct tc_action_ops *ops; | 75 | const struct tc_action_ops *ops; |
76 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | 76 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
77 | __u32 order; | 77 | __u32 order; |
78 | struct tc_action *next; | 78 | struct tc_action *next; |
@@ -86,7 +86,7 @@ struct tc_action_ops { | |||
86 | __u32 type; /* TBD to match kind */ | 86 | __u32 type; /* TBD to match kind */ |
87 | __u32 capab; /* capabilities includes 4 bit version */ | 87 | __u32 capab; /* capabilities includes 4 bit version */ |
88 | struct module *owner; | 88 | struct module *owner; |
89 | int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); | 89 | int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); |
90 | int (*get_stats)(struct sk_buff *, struct tc_action *); | 90 | int (*get_stats)(struct sk_buff *, struct tc_action *); |
91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
92 | int (*cleanup)(struct tc_action *, int bind); | 92 | int (*cleanup)(struct tc_action *, int bind); |
@@ -115,7 +115,7 @@ extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo); | |||
115 | extern int tcf_register_action(struct tc_action_ops *a); | 115 | extern int tcf_register_action(struct tc_action_ops *a); |
116 | extern int tcf_unregister_action(struct tc_action_ops *a); | 116 | extern int tcf_unregister_action(struct tc_action_ops *a); |
117 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 117 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
118 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); | 118 | extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res); |
119 | extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); | 119 | extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
120 | extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); | 120 | extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
121 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); | 121 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); |
diff --git a/include/net/arp.h b/include/net/arp.h index 91f0568a04ef..4979af8b1559 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -8,6 +8,36 @@ | |||
8 | 8 | ||
9 | extern struct neigh_table arp_tbl; | 9 | extern struct neigh_table arp_tbl; |
10 | 10 | ||
11 | static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) | ||
12 | { | ||
13 | u32 val = key ^ dev->ifindex; | ||
14 | |||
15 | return val * hash_rnd; | ||
16 | } | ||
17 | |||
18 | static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) | ||
19 | { | ||
20 | struct neigh_hash_table *nht; | ||
21 | struct neighbour *n; | ||
22 | u32 hash_val; | ||
23 | |||
24 | rcu_read_lock_bh(); | ||
25 | nht = rcu_dereference_bh(tbl->nht); | ||
26 | hash_val = arp_hashfn(key, dev, nht->hash_rnd) >> (32 - nht->hash_shift); | ||
27 | for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); | ||
28 | n != NULL; | ||
29 | n = rcu_dereference_bh(n->next)) { | ||
30 | if (n->dev == dev && *(u32 *)n->primary_key == key) { | ||
31 | if (!atomic_inc_not_zero(&n->refcnt)) | ||
32 | n = NULL; | ||
33 | break; | ||
34 | } | ||
35 | } | ||
36 | rcu_read_unlock_bh(); | ||
37 | |||
38 | return n; | ||
39 | } | ||
40 | |||
11 | extern void arp_init(void); | 41 | extern void arp_init(void); |
12 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 42 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
13 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); | 43 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); |
@@ -15,7 +45,6 @@ extern void arp_send(int type, int ptype, __be32 dest_ip, | |||
15 | struct net_device *dev, __be32 src_ip, | 45 | struct net_device *dev, __be32 src_ip, |
16 | const unsigned char *dest_hw, | 46 | const unsigned char *dest_hw, |
17 | const unsigned char *src_hw, const unsigned char *th); | 47 | const unsigned char *src_hw, const unsigned char *th); |
18 | extern int arp_bind_neighbour(struct dst_entry *dst); | ||
19 | extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); | 48 | extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); |
20 | extern void arp_ifdown(struct net_device *dev); | 49 | extern void arp_ifdown(struct net_device *dev); |
21 | 50 | ||
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 43750439c521..e727555d4ee9 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #define BT_SECURITY 4 | 56 | #define BT_SECURITY 4 |
57 | struct bt_security { | 57 | struct bt_security { |
58 | __u8 level; | 58 | __u8 level; |
59 | __u8 key_size; | ||
59 | }; | 60 | }; |
60 | #define BT_SECURITY_SDP 0 | 61 | #define BT_SECURITY_SDP 0 |
61 | #define BT_SECURITY_LOW 1 | 62 | #define BT_SECURITY_LOW 1 |
@@ -69,9 +70,19 @@ struct bt_security { | |||
69 | #define BT_FLUSHABLE_OFF 0 | 70 | #define BT_FLUSHABLE_OFF 0 |
70 | #define BT_FLUSHABLE_ON 1 | 71 | #define BT_FLUSHABLE_ON 1 |
71 | 72 | ||
72 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 73 | #define BT_POWER 9 |
73 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 74 | struct bt_power { |
74 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) | 75 | __u8 force_active; |
76 | }; | ||
77 | #define BT_POWER_FORCE_ACTIVE_OFF 0 | ||
78 | #define BT_POWER_FORCE_ACTIVE_ON 1 | ||
79 | |||
80 | __attribute__((format (printf, 2, 3))) | ||
81 | int bt_printk(const char *level, const char *fmt, ...); | ||
82 | |||
83 | #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) | ||
84 | #define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) | ||
85 | #define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) | ||
75 | 86 | ||
76 | /* Connection and socket states */ | 87 | /* Connection and socket states */ |
77 | enum { | 88 | enum { |
@@ -130,7 +141,8 @@ int bt_sock_register(int proto, const struct net_proto_family *ops); | |||
130 | int bt_sock_unregister(int proto); | 141 | int bt_sock_unregister(int proto); |
131 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 142 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
132 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 143 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
133 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); | 144 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
145 | struct msghdr *msg, size_t len, int flags); | ||
134 | int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | 146 | int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, |
135 | struct msghdr *msg, size_t len, int flags); | 147 | struct msghdr *msg, size_t len, int flags); |
136 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); | 148 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); |
@@ -150,6 +162,7 @@ struct bt_skb_cb { | |||
150 | __u8 retries; | 162 | __u8 retries; |
151 | __u8 sar; | 163 | __u8 sar; |
152 | unsigned short channel; | 164 | unsigned short channel; |
165 | __u8 force_active; | ||
153 | }; | 166 | }; |
154 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 167 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
155 | 168 | ||
@@ -164,8 +177,8 @@ static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) | |||
164 | return skb; | 177 | return skb; |
165 | } | 178 | } |
166 | 179 | ||
167 | static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, | 180 | static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, |
168 | int nb, int *err) | 181 | unsigned long len, int nb, int *err) |
169 | { | 182 | { |
170 | struct sk_buff *skb; | 183 | struct sk_buff *skb; |
171 | 184 | ||
@@ -195,7 +208,7 @@ out: | |||
195 | return NULL; | 208 | return NULL; |
196 | } | 209 | } |
197 | 210 | ||
198 | int bt_err(__u16 code); | 211 | int bt_to_errno(__u16 code); |
199 | 212 | ||
200 | extern int hci_sock_init(void); | 213 | extern int hci_sock_init(void); |
201 | extern void hci_sock_cleanup(void); | 214 | extern void hci_sock_cleanup(void); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 0c20227e57f6..be30aabe7b88 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -211,11 +211,16 @@ enum { | |||
211 | #define LMP_EDR_3S_ESCO 0x80 | 211 | #define LMP_EDR_3S_ESCO 0x80 |
212 | 212 | ||
213 | #define LMP_EXT_INQ 0x01 | 213 | #define LMP_EXT_INQ 0x01 |
214 | #define LMP_SIMUL_LE_BR 0x02 | ||
214 | #define LMP_SIMPLE_PAIR 0x08 | 215 | #define LMP_SIMPLE_PAIR 0x08 |
215 | #define LMP_NO_FLUSH 0x40 | 216 | #define LMP_NO_FLUSH 0x40 |
216 | 217 | ||
217 | #define LMP_LSTO 0x01 | 218 | #define LMP_LSTO 0x01 |
218 | #define LMP_INQ_TX_PWR 0x02 | 219 | #define LMP_INQ_TX_PWR 0x02 |
220 | #define LMP_EXTFEATURES 0x80 | ||
221 | |||
222 | /* Extended LMP features */ | ||
223 | #define LMP_HOST_LE 0x02 | ||
219 | 224 | ||
220 | /* Connection modes */ | 225 | /* Connection modes */ |
221 | #define HCI_CM_ACTIVE 0x0000 | 226 | #define HCI_CM_ACTIVE 0x0000 |
@@ -254,6 +259,10 @@ enum { | |||
254 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | 259 | #define HCI_LK_UNAUTH_COMBINATION 0x04 |
255 | #define HCI_LK_AUTH_COMBINATION 0x05 | 260 | #define HCI_LK_AUTH_COMBINATION 0x05 |
256 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 261 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
262 | /* The spec doesn't define types for SMP keys */ | ||
263 | #define HCI_LK_SMP_LTK 0x81 | ||
264 | #define HCI_LK_SMP_IRK 0x82 | ||
265 | #define HCI_LK_SMP_CSRK 0x83 | ||
257 | 266 | ||
258 | /* ----- HCI Commands ---- */ | 267 | /* ----- HCI Commands ---- */ |
259 | #define HCI_OP_NOP 0x0000 | 268 | #define HCI_OP_NOP 0x0000 |
@@ -653,6 +662,12 @@ struct hci_rp_read_local_oob_data { | |||
653 | 662 | ||
654 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | 663 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 |
655 | 664 | ||
665 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d | ||
666 | struct hci_cp_write_le_host_supported { | ||
667 | __u8 le; | ||
668 | __u8 simul; | ||
669 | } __packed; | ||
670 | |||
656 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 671 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
657 | struct hci_rp_read_local_version { | 672 | struct hci_rp_read_local_version { |
658 | __u8 status; | 673 | __u8 status; |
@@ -676,6 +691,9 @@ struct hci_rp_read_local_features { | |||
676 | } __packed; | 691 | } __packed; |
677 | 692 | ||
678 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 | 693 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 |
694 | struct hci_cp_read_local_ext_features { | ||
695 | __u8 page; | ||
696 | } __packed; | ||
679 | struct hci_rp_read_local_ext_features { | 697 | struct hci_rp_read_local_ext_features { |
680 | __u8 status; | 698 | __u8 status; |
681 | __u8 page; | 699 | __u8 page; |
@@ -710,6 +728,12 @@ struct hci_rp_le_read_buffer_size { | |||
710 | __u8 le_max_pkt; | 728 | __u8 le_max_pkt; |
711 | } __packed; | 729 | } __packed; |
712 | 730 | ||
731 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c | ||
732 | struct hci_cp_le_set_scan_enable { | ||
733 | __u8 enable; | ||
734 | __u8 filter_dup; | ||
735 | } __packed; | ||
736 | |||
713 | #define HCI_OP_LE_CREATE_CONN 0x200d | 737 | #define HCI_OP_LE_CREATE_CONN 0x200d |
714 | struct hci_cp_le_create_conn { | 738 | struct hci_cp_le_create_conn { |
715 | __le16 scan_interval; | 739 | __le16 scan_interval; |
@@ -739,6 +763,33 @@ struct hci_cp_le_conn_update { | |||
739 | __le16 max_ce_len; | 763 | __le16 max_ce_len; |
740 | } __packed; | 764 | } __packed; |
741 | 765 | ||
766 | #define HCI_OP_LE_START_ENC 0x2019 | ||
767 | struct hci_cp_le_start_enc { | ||
768 | __le16 handle; | ||
769 | __u8 rand[8]; | ||
770 | __le16 ediv; | ||
771 | __u8 ltk[16]; | ||
772 | } __packed; | ||
773 | |||
774 | #define HCI_OP_LE_LTK_REPLY 0x201a | ||
775 | struct hci_cp_le_ltk_reply { | ||
776 | __le16 handle; | ||
777 | __u8 ltk[16]; | ||
778 | } __packed; | ||
779 | struct hci_rp_le_ltk_reply { | ||
780 | __u8 status; | ||
781 | __le16 handle; | ||
782 | } __packed; | ||
783 | |||
784 | #define HCI_OP_LE_LTK_NEG_REPLY 0x201b | ||
785 | struct hci_cp_le_ltk_neg_reply { | ||
786 | __le16 handle; | ||
787 | } __packed; | ||
788 | struct hci_rp_le_ltk_neg_reply { | ||
789 | __u8 status; | ||
790 | __le16 handle; | ||
791 | } __packed; | ||
792 | |||
742 | /* ---- HCI Events ---- */ | 793 | /* ---- HCI Events ---- */ |
743 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 794 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
744 | 795 | ||
@@ -1029,6 +1080,32 @@ struct hci_ev_le_conn_complete { | |||
1029 | __u8 clk_accurancy; | 1080 | __u8 clk_accurancy; |
1030 | } __packed; | 1081 | } __packed; |
1031 | 1082 | ||
1083 | #define HCI_EV_LE_LTK_REQ 0x05 | ||
1084 | struct hci_ev_le_ltk_req { | ||
1085 | __le16 handle; | ||
1086 | __u8 random[8]; | ||
1087 | __le16 ediv; | ||
1088 | } __packed; | ||
1089 | |||
1090 | /* Advertising report event types */ | ||
1091 | #define ADV_IND 0x00 | ||
1092 | #define ADV_DIRECT_IND 0x01 | ||
1093 | #define ADV_SCAN_IND 0x02 | ||
1094 | #define ADV_NONCONN_IND 0x03 | ||
1095 | #define ADV_SCAN_RSP 0x04 | ||
1096 | |||
1097 | #define ADDR_LE_DEV_PUBLIC 0x00 | ||
1098 | #define ADDR_LE_DEV_RANDOM 0x01 | ||
1099 | |||
1100 | #define HCI_EV_LE_ADVERTISING_REPORT 0x02 | ||
1101 | struct hci_ev_le_advertising_info { | ||
1102 | __u8 evt_type; | ||
1103 | __u8 bdaddr_type; | ||
1104 | bdaddr_t bdaddr; | ||
1105 | __u8 length; | ||
1106 | __u8 data[0]; | ||
1107 | } __packed; | ||
1108 | |||
1032 | /* Internal events generated by Bluetooth stack */ | 1109 | /* Internal events generated by Bluetooth stack */ |
1033 | #define HCI_EV_STACK_INTERNAL 0xfd | 1110 | #define HCI_EV_STACK_INTERNAL 0xfd |
1034 | struct hci_ev_stack_internal { | 1111 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 6c994c004d15..8f441b8b2963 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef __HCI_CORE_H | 25 | #ifndef __HCI_CORE_H |
26 | #define __HCI_CORE_H | 26 | #define __HCI_CORE_H |
27 | 27 | ||
28 | #include <linux/interrupt.h> | ||
28 | #include <net/bluetooth/hci.h> | 29 | #include <net/bluetooth/hci.h> |
29 | 30 | ||
30 | /* HCI upper protocols */ | 31 | /* HCI upper protocols */ |
@@ -74,12 +75,28 @@ struct bt_uuid { | |||
74 | u8 svc_hint; | 75 | u8 svc_hint; |
75 | }; | 76 | }; |
76 | 77 | ||
78 | struct key_master_id { | ||
79 | __le16 ediv; | ||
80 | u8 rand[8]; | ||
81 | } __packed; | ||
82 | |||
83 | struct link_key_data { | ||
84 | bdaddr_t bdaddr; | ||
85 | u8 type; | ||
86 | u8 val[16]; | ||
87 | u8 pin_len; | ||
88 | u8 dlen; | ||
89 | u8 data[0]; | ||
90 | } __packed; | ||
91 | |||
77 | struct link_key { | 92 | struct link_key { |
78 | struct list_head list; | 93 | struct list_head list; |
79 | bdaddr_t bdaddr; | 94 | bdaddr_t bdaddr; |
80 | u8 type; | 95 | u8 type; |
81 | u8 val[16]; | 96 | u8 val[16]; |
82 | u8 pin_len; | 97 | u8 pin_len; |
98 | u8 dlen; | ||
99 | u8 data[0]; | ||
83 | }; | 100 | }; |
84 | 101 | ||
85 | struct oob_data { | 102 | struct oob_data { |
@@ -89,6 +106,12 @@ struct oob_data { | |||
89 | u8 randomizer[16]; | 106 | u8 randomizer[16]; |
90 | }; | 107 | }; |
91 | 108 | ||
109 | struct adv_entry { | ||
110 | struct list_head list; | ||
111 | bdaddr_t bdaddr; | ||
112 | u8 bdaddr_type; | ||
113 | }; | ||
114 | |||
92 | #define NUM_REASSEMBLY 4 | 115 | #define NUM_REASSEMBLY 4 |
93 | struct hci_dev { | 116 | struct hci_dev { |
94 | struct list_head list; | 117 | struct list_head list; |
@@ -107,6 +130,7 @@ struct hci_dev { | |||
107 | __u8 major_class; | 130 | __u8 major_class; |
108 | __u8 minor_class; | 131 | __u8 minor_class; |
109 | __u8 features[8]; | 132 | __u8 features[8]; |
133 | __u8 extfeatures[8]; | ||
110 | __u8 commands[64]; | 134 | __u8 commands[64]; |
111 | __u8 ssp_mode; | 135 | __u8 ssp_mode; |
112 | __u8 hci_ver; | 136 | __u8 hci_ver; |
@@ -171,6 +195,8 @@ struct hci_dev { | |||
171 | 195 | ||
172 | __u16 init_last_cmd; | 196 | __u16 init_last_cmd; |
173 | 197 | ||
198 | struct crypto_blkcipher *tfm; | ||
199 | |||
174 | struct inquiry_cache inq_cache; | 200 | struct inquiry_cache inq_cache; |
175 | struct hci_conn_hash conn_hash; | 201 | struct hci_conn_hash conn_hash; |
176 | struct list_head blacklist; | 202 | struct list_head blacklist; |
@@ -181,6 +207,9 @@ struct hci_dev { | |||
181 | 207 | ||
182 | struct list_head remote_oob_data; | 208 | struct list_head remote_oob_data; |
183 | 209 | ||
210 | struct list_head adv_entries; | ||
211 | struct timer_list adv_timer; | ||
212 | |||
184 | struct hci_dev_stats stat; | 213 | struct hci_dev_stats stat; |
185 | 214 | ||
186 | struct sk_buff_head driver_init; | 215 | struct sk_buff_head driver_init; |
@@ -212,9 +241,9 @@ struct hci_conn { | |||
212 | struct list_head list; | 241 | struct list_head list; |
213 | 242 | ||
214 | atomic_t refcnt; | 243 | atomic_t refcnt; |
215 | spinlock_t lock; | ||
216 | 244 | ||
217 | bdaddr_t dst; | 245 | bdaddr_t dst; |
246 | __u8 dst_type; | ||
218 | __u16 handle; | 247 | __u16 handle; |
219 | __u16 state; | 248 | __u16 state; |
220 | __u8 mode; | 249 | __u8 mode; |
@@ -233,6 +262,7 @@ struct hci_conn { | |||
233 | __u8 sec_level; | 262 | __u8 sec_level; |
234 | __u8 pending_sec_level; | 263 | __u8 pending_sec_level; |
235 | __u8 pin_length; | 264 | __u8 pin_length; |
265 | __u8 enc_key_size; | ||
236 | __u8 io_capability; | 266 | __u8 io_capability; |
237 | __u8 power_save; | 267 | __u8 power_save; |
238 | __u16 disc_timeout; | 268 | __u16 disc_timeout; |
@@ -259,7 +289,6 @@ struct hci_conn { | |||
259 | struct hci_dev *hdev; | 289 | struct hci_dev *hdev; |
260 | void *l2cap_data; | 290 | void *l2cap_data; |
261 | void *sco_data; | 291 | void *sco_data; |
262 | void *priv; | ||
263 | 292 | ||
264 | struct hci_conn *link; | 293 | struct hci_conn *link; |
265 | 294 | ||
@@ -307,12 +336,14 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) | |||
307 | return jiffies - e->timestamp; | 336 | return jiffies - e->timestamp; |
308 | } | 337 | } |
309 | 338 | ||
310 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 339 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, |
340 | bdaddr_t *bdaddr); | ||
311 | void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | 341 | void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); |
312 | 342 | ||
313 | /* ----- HCI Connections ----- */ | 343 | /* ----- HCI Connections ----- */ |
314 | enum { | 344 | enum { |
315 | HCI_CONN_AUTH_PEND, | 345 | HCI_CONN_AUTH_PEND, |
346 | HCI_CONN_REAUTH_PEND, | ||
316 | HCI_CONN_ENCRYPT_PEND, | 347 | HCI_CONN_ENCRYPT_PEND, |
317 | HCI_CONN_RSWITCH_PEND, | 348 | HCI_CONN_RSWITCH_PEND, |
318 | HCI_CONN_MODE_CHANGE_PEND, | 349 | HCI_CONN_MODE_CHANGE_PEND, |
@@ -420,14 +451,15 @@ int hci_conn_del(struct hci_conn *conn); | |||
420 | void hci_conn_hash_flush(struct hci_dev *hdev); | 451 | void hci_conn_hash_flush(struct hci_dev *hdev); |
421 | void hci_conn_check_pending(struct hci_dev *hdev); | 452 | void hci_conn_check_pending(struct hci_dev *hdev); |
422 | 453 | ||
423 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); | 454 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
455 | __u8 sec_level, __u8 auth_type); | ||
424 | int hci_conn_check_link_mode(struct hci_conn *conn); | 456 | int hci_conn_check_link_mode(struct hci_conn *conn); |
425 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); | 457 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); |
426 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); | 458 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
427 | int hci_conn_change_link_key(struct hci_conn *conn); | 459 | int hci_conn_change_link_key(struct hci_conn *conn); |
428 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | 460 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
429 | 461 | ||
430 | void hci_conn_enter_active_mode(struct hci_conn *conn); | 462 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); |
431 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); | 463 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); |
432 | 464 | ||
433 | void hci_conn_hold_device(struct hci_conn *conn); | 465 | void hci_conn_hold_device(struct hci_conn *conn); |
@@ -449,10 +481,12 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
449 | timeo = msecs_to_jiffies(conn->disc_timeout); | 481 | timeo = msecs_to_jiffies(conn->disc_timeout); |
450 | if (!conn->out) | 482 | if (!conn->out) |
451 | timeo *= 2; | 483 | timeo *= 2; |
452 | } else | 484 | } else { |
453 | timeo = msecs_to_jiffies(10); | 485 | timeo = msecs_to_jiffies(10); |
454 | } else | 486 | } |
487 | } else { | ||
455 | timeo = msecs_to_jiffies(10); | 488 | timeo = msecs_to_jiffies(10); |
489 | } | ||
456 | mod_timer(&conn->disc_timer, jiffies + timeo); | 490 | mod_timer(&conn->disc_timer, jiffies + timeo); |
457 | } | 491 | } |
458 | } | 492 | } |
@@ -511,6 +545,8 @@ int hci_inquiry(void __user *arg); | |||
511 | 545 | ||
512 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 546 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
513 | int hci_blacklist_clear(struct hci_dev *hdev); | 547 | int hci_blacklist_clear(struct hci_dev *hdev); |
548 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
549 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
514 | 550 | ||
515 | int hci_uuids_clear(struct hci_dev *hdev); | 551 | int hci_uuids_clear(struct hci_dev *hdev); |
516 | 552 | ||
@@ -518,6 +554,11 @@ int hci_link_keys_clear(struct hci_dev *hdev); | |||
518 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 554 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
519 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 555 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
520 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 556 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
557 | struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | ||
558 | struct link_key *hci_find_link_key_type(struct hci_dev *hdev, | ||
559 | bdaddr_t *bdaddr, u8 type); | ||
560 | int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | ||
561 | u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); | ||
521 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 562 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
522 | 563 | ||
523 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 564 | int hci_remote_oob_data_clear(struct hci_dev *hdev); |
@@ -527,6 +568,12 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | |||
527 | u8 *randomizer); | 568 | u8 *randomizer); |
528 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | 569 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); |
529 | 570 | ||
571 | #define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */ | ||
572 | int hci_adv_entries_clear(struct hci_dev *hdev); | ||
573 | struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
574 | int hci_add_adv_entry(struct hci_dev *hdev, | ||
575 | struct hci_ev_le_advertising_info *ev); | ||
576 | |||
530 | void hci_del_off_timer(struct hci_dev *hdev); | 577 | void hci_del_off_timer(struct hci_dev *hdev); |
531 | 578 | ||
532 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 579 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
@@ -553,6 +600,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
553 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | 600 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) |
554 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | 601 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) |
555 | 602 | ||
603 | /* ----- Extended LMP capabilities ----- */ | ||
604 | #define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) | ||
605 | |||
556 | /* ----- HCI protocols ----- */ | 606 | /* ----- HCI protocols ----- */ |
557 | struct hci_proto { | 607 | struct hci_proto { |
558 | char *name; | 608 | char *name; |
@@ -561,16 +611,20 @@ struct hci_proto { | |||
561 | 611 | ||
562 | void *priv; | 612 | void *priv; |
563 | 613 | ||
564 | int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); | 614 | int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, |
615 | __u8 type); | ||
565 | int (*connect_cfm) (struct hci_conn *conn, __u8 status); | 616 | int (*connect_cfm) (struct hci_conn *conn, __u8 status); |
566 | int (*disconn_ind) (struct hci_conn *conn); | 617 | int (*disconn_ind) (struct hci_conn *conn); |
567 | int (*disconn_cfm) (struct hci_conn *conn, __u8 reason); | 618 | int (*disconn_cfm) (struct hci_conn *conn, __u8 reason); |
568 | int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); | 619 | int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, |
620 | __u16 flags); | ||
569 | int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); | 621 | int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); |
570 | int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); | 622 | int (*security_cfm) (struct hci_conn *conn, __u8 status, |
623 | __u8 encrypt); | ||
571 | }; | 624 | }; |
572 | 625 | ||
573 | static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) | 626 | static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, |
627 | __u8 type) | ||
574 | { | 628 | { |
575 | register struct hci_proto *hp; | 629 | register struct hci_proto *hp; |
576 | int mask = 0; | 630 | int mask = 0; |
@@ -656,7 +710,8 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
656 | conn->security_cfm_cb(conn, status); | 710 | conn->security_cfm_cb(conn, status); |
657 | } | 711 | } |
658 | 712 | ||
659 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) | 713 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, |
714 | __u8 encrypt) | ||
660 | { | 715 | { |
661 | register struct hci_proto *hp; | 716 | register struct hci_proto *hp; |
662 | 717 | ||
@@ -681,7 +736,8 @@ struct hci_cb { | |||
681 | 736 | ||
682 | char *name; | 737 | char *name; |
683 | 738 | ||
684 | void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); | 739 | void (*security_cfm) (struct hci_conn *conn, __u8 status, |
740 | __u8 encrypt); | ||
685 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); | 741 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); |
686 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); | 742 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); |
687 | }; | 743 | }; |
@@ -707,13 +763,17 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | |||
707 | read_unlock_bh(&hci_cb_list_lock); | 763 | read_unlock_bh(&hci_cb_list_lock); |
708 | } | 764 | } |
709 | 765 | ||
710 | static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) | 766 | static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, |
767 | __u8 encrypt) | ||
711 | { | 768 | { |
712 | struct list_head *p; | 769 | struct list_head *p; |
713 | 770 | ||
714 | if (conn->sec_level == BT_SECURITY_SDP) | 771 | if (conn->sec_level == BT_SECURITY_SDP) |
715 | conn->sec_level = BT_SECURITY_LOW; | 772 | conn->sec_level = BT_SECURITY_LOW; |
716 | 773 | ||
774 | if (conn->pending_sec_level > conn->sec_level) | ||
775 | conn->sec_level = conn->pending_sec_level; | ||
776 | |||
717 | hci_proto_encrypt_cfm(conn, status, encrypt); | 777 | hci_proto_encrypt_cfm(conn, status, encrypt); |
718 | 778 | ||
719 | read_lock_bh(&hci_cb_list_lock); | 779 | read_lock_bh(&hci_cb_list_lock); |
@@ -738,7 +798,8 @@ static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) | |||
738 | read_unlock_bh(&hci_cb_list_lock); | 798 | read_unlock_bh(&hci_cb_list_lock); |
739 | } | 799 | } |
740 | 800 | ||
741 | static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, __u8 role) | 801 | static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, |
802 | __u8 role) | ||
742 | { | 803 | { |
743 | struct list_head *p; | 804 | struct list_head *p; |
744 | 805 | ||
@@ -830,4 +891,9 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); | |||
830 | 891 | ||
831 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | 892 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, |
832 | u16 latency, u16 to_multiplier); | 893 | u16 latency, u16 to_multiplier); |
894 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | ||
895 | __u8 ltk[16]); | ||
896 | void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]); | ||
897 | void hci_le_ltk_neg_reply(struct hci_conn *conn); | ||
898 | |||
833 | #endif /* __HCI_CORE_H */ | 899 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index d09c9b1118e3..4f34ad25e75c 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -37,7 +37,6 @@ | |||
37 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ | 37 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ |
38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ | 38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ |
39 | #define L2CAP_DEFAULT_ACK_TO 200 | 39 | #define L2CAP_DEFAULT_ACK_TO 200 |
40 | #define L2CAP_LOCAL_BUSY_TRIES 12 | ||
41 | #define L2CAP_LE_DEFAULT_MTU 23 | 40 | #define L2CAP_LE_DEFAULT_MTU 23 |
42 | 41 | ||
43 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
@@ -130,6 +129,12 @@ struct l2cap_conninfo { | |||
130 | #define L2CAP_SDU_END 0x8000 | 129 | #define L2CAP_SDU_END 0x8000 |
131 | #define L2CAP_SDU_CONTINUE 0xC000 | 130 | #define L2CAP_SDU_CONTINUE 0xC000 |
132 | 131 | ||
132 | /* L2CAP Command rej. reasons */ | ||
133 | #define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 | ||
134 | #define L2CAP_REJ_MTU_EXCEEDED 0x0001 | ||
135 | #define L2CAP_REJ_INVALID_CID 0x0002 | ||
136 | |||
137 | |||
133 | /* L2CAP structures */ | 138 | /* L2CAP structures */ |
134 | struct l2cap_hdr { | 139 | struct l2cap_hdr { |
135 | __le16 len; | 140 | __le16 len; |
@@ -144,8 +149,19 @@ struct l2cap_cmd_hdr { | |||
144 | } __packed; | 149 | } __packed; |
145 | #define L2CAP_CMD_HDR_SIZE 4 | 150 | #define L2CAP_CMD_HDR_SIZE 4 |
146 | 151 | ||
147 | struct l2cap_cmd_rej { | 152 | struct l2cap_cmd_rej_unk { |
153 | __le16 reason; | ||
154 | } __packed; | ||
155 | |||
156 | struct l2cap_cmd_rej_mtu { | ||
157 | __le16 reason; | ||
158 | __le16 max_mtu; | ||
159 | } __packed; | ||
160 | |||
161 | struct l2cap_cmd_rej_cid { | ||
148 | __le16 reason; | 162 | __le16 reason; |
163 | __le16 scid; | ||
164 | __le16 dcid; | ||
149 | } __packed; | 165 | } __packed; |
150 | 166 | ||
151 | struct l2cap_conn_req { | 167 | struct l2cap_conn_req { |
@@ -287,6 +303,10 @@ struct l2cap_chan { | |||
287 | 303 | ||
288 | struct l2cap_conn *conn; | 304 | struct l2cap_conn *conn; |
289 | 305 | ||
306 | __u8 state; | ||
307 | |||
308 | atomic_t refcnt; | ||
309 | |||
290 | __le16 psm; | 310 | __le16 psm; |
291 | __u16 dcid; | 311 | __u16 dcid; |
292 | __u16 scid; | 312 | __u16 scid; |
@@ -295,6 +315,7 @@ struct l2cap_chan { | |||
295 | __u16 omtu; | 315 | __u16 omtu; |
296 | __u16 flush_to; | 316 | __u16 flush_to; |
297 | __u8 mode; | 317 | __u8 mode; |
318 | __u8 chan_type; | ||
298 | 319 | ||
299 | __le16 sport; | 320 | __le16 sport; |
300 | 321 | ||
@@ -302,6 +323,7 @@ struct l2cap_chan { | |||
302 | __u8 role_switch; | 323 | __u8 role_switch; |
303 | __u8 force_reliable; | 324 | __u8 force_reliable; |
304 | __u8 flushable; | 325 | __u8 flushable; |
326 | __u8 force_active; | ||
305 | 327 | ||
306 | __u8 ident; | 328 | __u8 ident; |
307 | 329 | ||
@@ -318,8 +340,8 @@ struct l2cap_chan { | |||
318 | __u16 monitor_timeout; | 340 | __u16 monitor_timeout; |
319 | __u16 mps; | 341 | __u16 mps; |
320 | 342 | ||
321 | __u8 conf_state; | 343 | unsigned long conf_state; |
322 | __u16 conn_state; | 344 | unsigned long conn_state; |
323 | 345 | ||
324 | __u8 next_tx_seq; | 346 | __u8 next_tx_seq; |
325 | __u8 expected_ack_seq; | 347 | __u8 expected_ack_seq; |
@@ -339,18 +361,29 @@ struct l2cap_chan { | |||
339 | __u8 remote_max_tx; | 361 | __u8 remote_max_tx; |
340 | __u16 remote_mps; | 362 | __u16 remote_mps; |
341 | 363 | ||
364 | struct timer_list chan_timer; | ||
342 | struct timer_list retrans_timer; | 365 | struct timer_list retrans_timer; |
343 | struct timer_list monitor_timer; | 366 | struct timer_list monitor_timer; |
344 | struct timer_list ack_timer; | 367 | struct timer_list ack_timer; |
345 | struct sk_buff *tx_send_head; | 368 | struct sk_buff *tx_send_head; |
346 | struct sk_buff_head tx_q; | 369 | struct sk_buff_head tx_q; |
347 | struct sk_buff_head srej_q; | 370 | struct sk_buff_head srej_q; |
348 | struct sk_buff_head busy_q; | ||
349 | struct work_struct busy_work; | ||
350 | struct list_head srej_l; | 371 | struct list_head srej_l; |
351 | 372 | ||
352 | struct list_head list; | 373 | struct list_head list; |
353 | struct list_head global_l; | 374 | struct list_head global_l; |
375 | |||
376 | void *data; | ||
377 | struct l2cap_ops *ops; | ||
378 | }; | ||
379 | |||
380 | struct l2cap_ops { | ||
381 | char *name; | ||
382 | |||
383 | struct l2cap_chan *(*new_connection) (void *data); | ||
384 | int (*recv) (void *data, struct sk_buff *skb); | ||
385 | void (*close) (void *data); | ||
386 | void (*state_change) (void *data, int state); | ||
354 | }; | 387 | }; |
355 | 388 | ||
356 | struct l2cap_conn { | 389 | struct l2cap_conn { |
@@ -376,6 +409,15 @@ struct l2cap_conn { | |||
376 | 409 | ||
377 | __u8 disc_reason; | 410 | __u8 disc_reason; |
378 | 411 | ||
412 | __u8 preq[7]; /* SMP Pairing Request */ | ||
413 | __u8 prsp[7]; /* SMP Pairing Response */ | ||
414 | __u8 prnd[16]; /* SMP Pairing Random */ | ||
415 | __u8 pcnf[16]; /* SMP Pairing Confirm */ | ||
416 | __u8 tk[16]; /* SMP Temporary Key */ | ||
417 | __u8 smp_key_size; | ||
418 | |||
419 | struct timer_list security_timer; | ||
420 | |||
379 | struct list_head chan_l; | 421 | struct list_head chan_l; |
380 | rwlock_t chan_lock; | 422 | rwlock_t chan_lock; |
381 | }; | 423 | }; |
@@ -384,44 +426,57 @@ struct l2cap_conn { | |||
384 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | 426 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 |
385 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | 427 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 |
386 | 428 | ||
429 | #define L2CAP_CHAN_RAW 1 | ||
430 | #define L2CAP_CHAN_CONN_LESS 2 | ||
431 | #define L2CAP_CHAN_CONN_ORIENTED 3 | ||
432 | |||
387 | /* ----- L2CAP socket info ----- */ | 433 | /* ----- L2CAP socket info ----- */ |
388 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 434 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
389 | 435 | ||
390 | struct l2cap_pinfo { | 436 | struct l2cap_pinfo { |
391 | struct bt_sock bt; | 437 | struct bt_sock bt; |
392 | struct l2cap_chan *chan; | 438 | struct l2cap_chan *chan; |
439 | struct sk_buff *rx_busy_skb; | ||
393 | }; | 440 | }; |
394 | 441 | ||
395 | #define L2CAP_CONF_REQ_SENT 0x01 | 442 | enum { |
396 | #define L2CAP_CONF_INPUT_DONE 0x02 | 443 | CONF_REQ_SENT, |
397 | #define L2CAP_CONF_OUTPUT_DONE 0x04 | 444 | CONF_INPUT_DONE, |
398 | #define L2CAP_CONF_MTU_DONE 0x08 | 445 | CONF_OUTPUT_DONE, |
399 | #define L2CAP_CONF_MODE_DONE 0x10 | 446 | CONF_MTU_DONE, |
400 | #define L2CAP_CONF_CONNECT_PEND 0x20 | 447 | CONF_MODE_DONE, |
401 | #define L2CAP_CONF_NO_FCS_RECV 0x40 | 448 | CONF_CONNECT_PEND, |
402 | #define L2CAP_CONF_STATE2_DEVICE 0x80 | 449 | CONF_NO_FCS_RECV, |
450 | CONF_STATE2_DEVICE, | ||
451 | }; | ||
403 | 452 | ||
404 | #define L2CAP_CONF_MAX_CONF_REQ 2 | 453 | #define L2CAP_CONF_MAX_CONF_REQ 2 |
405 | #define L2CAP_CONF_MAX_CONF_RSP 2 | 454 | #define L2CAP_CONF_MAX_CONF_RSP 2 |
406 | 455 | ||
407 | #define L2CAP_CONN_SAR_SDU 0x0001 | 456 | enum { |
408 | #define L2CAP_CONN_SREJ_SENT 0x0002 | 457 | CONN_SAR_SDU, |
409 | #define L2CAP_CONN_WAIT_F 0x0004 | 458 | CONN_SREJ_SENT, |
410 | #define L2CAP_CONN_SREJ_ACT 0x0008 | 459 | CONN_WAIT_F, |
411 | #define L2CAP_CONN_SEND_PBIT 0x0010 | 460 | CONN_SREJ_ACT, |
412 | #define L2CAP_CONN_REMOTE_BUSY 0x0020 | 461 | CONN_SEND_PBIT, |
413 | #define L2CAP_CONN_LOCAL_BUSY 0x0040 | 462 | CONN_REMOTE_BUSY, |
414 | #define L2CAP_CONN_REJ_ACT 0x0080 | 463 | CONN_LOCAL_BUSY, |
415 | #define L2CAP_CONN_SEND_FBIT 0x0100 | 464 | CONN_REJ_ACT, |
416 | #define L2CAP_CONN_RNR_SENT 0x0200 | 465 | CONN_SEND_FBIT, |
417 | #define L2CAP_CONN_SAR_RETRY 0x0400 | 466 | CONN_RNR_SENT, |
418 | 467 | }; | |
419 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ | 468 | |
420 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 469 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
421 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ | 470 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) |
422 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 471 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ |
423 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ | 472 | L2CAP_DEFAULT_RETRANS_TO); |
424 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 473 | #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) |
474 | #define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ | ||
475 | L2CAP_DEFAULT_MONITOR_TO); | ||
476 | #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) | ||
477 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ | ||
478 | L2CAP_DEFAULT_ACK_TO); | ||
479 | #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) | ||
425 | 480 | ||
426 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) | 481 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
427 | { | 482 | { |
@@ -446,32 +501,17 @@ extern int disable_ertm; | |||
446 | int l2cap_init_sockets(void); | 501 | int l2cap_init_sockets(void); |
447 | void l2cap_cleanup_sockets(void); | 502 | void l2cap_cleanup_sockets(void); |
448 | 503 | ||
449 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | ||
450 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); | 504 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); |
451 | int __l2cap_wait_ack(struct sock *sk); | 505 | int __l2cap_wait_ack(struct sock *sk); |
452 | 506 | ||
453 | struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
454 | struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
455 | struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | ||
456 | int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
457 | void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb); | ||
458 | void l2cap_streaming_send(struct l2cap_chan *chan); | ||
459 | int l2cap_ertm_send(struct l2cap_chan *chan); | ||
460 | |||
461 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); | 507 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); |
462 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | 508 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); |
463 | 509 | ||
464 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | ||
465 | void l2cap_sock_clear_timer(struct sock *sk); | ||
466 | void __l2cap_sock_close(struct sock *sk, int reason); | ||
467 | void l2cap_sock_kill(struct sock *sk); | ||
468 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | ||
469 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | ||
470 | int proto, gfp_t prio); | ||
471 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err); | ||
472 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | 510 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); |
473 | void l2cap_chan_del(struct l2cap_chan *chan, int err); | 511 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
474 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 512 | void l2cap_chan_destroy(struct l2cap_chan *chan); |
475 | int l2cap_chan_connect(struct l2cap_chan *chan); | 513 | int l2cap_chan_connect(struct l2cap_chan *chan); |
514 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
515 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | ||
476 | 516 | ||
477 | #endif /* __L2CAP_H */ | 517 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 4899286ed4e4..5428fd32ccec 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -101,6 +101,8 @@ struct mgmt_key_info { | |||
101 | u8 type; | 101 | u8 type; |
102 | u8 val[16]; | 102 | u8 val[16]; |
103 | u8 pin_len; | 103 | u8 pin_len; |
104 | u8 dlen; | ||
105 | u8 data[0]; | ||
104 | } __packed; | 106 | } __packed; |
105 | 107 | ||
106 | #define MGMT_OP_LOAD_KEYS 0x000D | 108 | #define MGMT_OP_LOAD_KEYS 0x000D |
@@ -199,6 +201,16 @@ struct mgmt_cp_remove_remote_oob_data { | |||
199 | 201 | ||
200 | #define MGMT_OP_STOP_DISCOVERY 0x001C | 202 | #define MGMT_OP_STOP_DISCOVERY 0x001C |
201 | 203 | ||
204 | #define MGMT_OP_BLOCK_DEVICE 0x001D | ||
205 | struct mgmt_cp_block_device { | ||
206 | bdaddr_t bdaddr; | ||
207 | } __packed; | ||
208 | |||
209 | #define MGMT_OP_UNBLOCK_DEVICE 0x001E | ||
210 | struct mgmt_cp_unblock_device { | ||
211 | bdaddr_t bdaddr; | ||
212 | } __packed; | ||
213 | |||
202 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 214 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
203 | struct mgmt_ev_cmd_complete { | 215 | struct mgmt_ev_cmd_complete { |
204 | __le16 opcode; | 216 | __le16 opcode; |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 6eac4a760c3b..d5eee2093b1e 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -234,7 +234,8 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, | |||
234 | /* ---- RFCOMM DLCs (channels) ---- */ | 234 | /* ---- RFCOMM DLCs (channels) ---- */ |
235 | struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); | 235 | struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); |
236 | void rfcomm_dlc_free(struct rfcomm_dlc *d); | 236 | void rfcomm_dlc_free(struct rfcomm_dlc *d); |
237 | int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); | 237 | int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, |
238 | u8 channel); | ||
238 | int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); | 239 | int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); |
239 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); | 240 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); |
240 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); | 241 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); |
@@ -271,7 +272,8 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) | |||
271 | } | 272 | } |
272 | 273 | ||
273 | /* ---- RFCOMM sessions ---- */ | 274 | /* ---- RFCOMM sessions ---- */ |
274 | void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst); | 275 | void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, |
276 | bdaddr_t *dst); | ||
275 | 277 | ||
276 | static inline void rfcomm_session_hold(struct rfcomm_session *s) | 278 | static inline void rfcomm_session_hold(struct rfcomm_session *s) |
277 | { | 279 | { |
@@ -312,7 +314,8 @@ struct rfcomm_pinfo { | |||
312 | int rfcomm_init_sockets(void); | 314 | int rfcomm_init_sockets(void); |
313 | void rfcomm_cleanup_sockets(void); | 315 | void rfcomm_cleanup_sockets(void); |
314 | 316 | ||
315 | int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc **d); | 317 | int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, |
318 | struct rfcomm_dlc **d); | ||
316 | 319 | ||
317 | /* ---- RFCOMM TTY ---- */ | 320 | /* ---- RFCOMM TTY ---- */ |
318 | #define RFCOMM_MAX_DEV 256 | 321 | #define RFCOMM_MAX_DEV 256 |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index 8f2edbf979dc..46c457612300 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -1,3 +1,25 @@ | |||
1 | /* | ||
2 | BlueZ - Bluetooth protocol stack for Linux | ||
3 | Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License version 2 as | ||
7 | published by the Free Software Foundation; | ||
8 | |||
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
10 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
11 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
12 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
13 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | |||
18 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
19 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
20 | SOFTWARE IS DISCLAIMED. | ||
21 | */ | ||
22 | |||
1 | #ifndef __SMP_H | 23 | #ifndef __SMP_H |
2 | #define __SMP_H | 24 | #define __SMP_H |
3 | 25 | ||
@@ -16,6 +38,23 @@ struct smp_cmd_pairing { | |||
16 | __u8 resp_key_dist; | 38 | __u8 resp_key_dist; |
17 | } __packed; | 39 | } __packed; |
18 | 40 | ||
41 | #define SMP_IO_DISPLAY_ONLY 0x00 | ||
42 | #define SMP_IO_DISPLAY_YESNO 0x01 | ||
43 | #define SMP_IO_KEYBOARD_ONLY 0x02 | ||
44 | #define SMP_IO_NO_INPUT_OUTPUT 0x03 | ||
45 | #define SMP_IO_KEYBOARD_DISPLAY 0x04 | ||
46 | |||
47 | #define SMP_OOB_NOT_PRESENT 0x00 | ||
48 | #define SMP_OOB_PRESENT 0x01 | ||
49 | |||
50 | #define SMP_DIST_ENC_KEY 0x01 | ||
51 | #define SMP_DIST_ID_KEY 0x02 | ||
52 | #define SMP_DIST_SIGN 0x04 | ||
53 | |||
54 | #define SMP_AUTH_NONE 0x00 | ||
55 | #define SMP_AUTH_BONDING 0x01 | ||
56 | #define SMP_AUTH_MITM 0x04 | ||
57 | |||
19 | #define SMP_CMD_PAIRING_CONFIRM 0x03 | 58 | #define SMP_CMD_PAIRING_CONFIRM 0x03 |
20 | struct smp_cmd_pairing_confirm { | 59 | struct smp_cmd_pairing_confirm { |
21 | __u8 confirm_val[16]; | 60 | __u8 confirm_val[16]; |
@@ -73,4 +112,12 @@ struct smp_cmd_security_req { | |||
73 | #define SMP_UNSPECIFIED 0x08 | 112 | #define SMP_UNSPECIFIED 0x08 |
74 | #define SMP_REPEATED_ATTEMPTS 0x09 | 113 | #define SMP_REPEATED_ATTEMPTS 0x09 |
75 | 114 | ||
115 | #define SMP_MIN_ENC_KEY_SIZE 7 | ||
116 | #define SMP_MAX_ENC_KEY_SIZE 16 | ||
117 | |||
118 | /* SMP Commands */ | ||
119 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); | ||
120 | int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); | ||
121 | int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); | ||
122 | |||
76 | #endif /* __SMP_H */ | 123 | #endif /* __SMP_H */ |
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h new file mode 100644 index 000000000000..c5dedd87b4cb --- /dev/null +++ b/include/net/caif/caif_hsi.h | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com | ||
4 | * Author: Daniel Martensson / daniel.martensson@stericsson.com | ||
5 | * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com | ||
6 | * License terms: GNU General Public License (GPL) version 2 | ||
7 | */ | ||
8 | |||
9 | #ifndef CAIF_HSI_H_ | ||
10 | #define CAIF_HSI_H_ | ||
11 | |||
12 | #include <net/caif/caif_layer.h> | ||
13 | #include <net/caif/caif_device.h> | ||
14 | #include <linux/atomic.h> | ||
15 | |||
16 | /* | ||
17 | * Maximum number of CAIF frames that can reside in the same HSI frame. | ||
18 | */ | ||
19 | #define CFHSI_MAX_PKTS 15 | ||
20 | |||
21 | /* | ||
22 | * Maximum number of bytes used for the frame that can be embedded in the | ||
23 | * HSI descriptor. | ||
24 | */ | ||
25 | #define CFHSI_MAX_EMB_FRM_SZ 96 | ||
26 | |||
27 | /* | ||
28 | * Decides if HSI buffers should be prefilled with 0xFF pattern for easier | ||
29 | * debugging. Both TX and RX buffers will be filled before the transfer. | ||
30 | */ | ||
31 | #define CFHSI_DBG_PREFILL 0 | ||
32 | |||
33 | /* Structure describing a HSI packet descriptor. */ | ||
34 | #pragma pack(1) /* Byte alignment. */ | ||
35 | struct cfhsi_desc { | ||
36 | u8 header; | ||
37 | u8 offset; | ||
38 | u16 cffrm_len[CFHSI_MAX_PKTS]; | ||
39 | u8 emb_frm[CFHSI_MAX_EMB_FRM_SZ]; | ||
40 | }; | ||
41 | #pragma pack() /* Default alignment. */ | ||
42 | |||
43 | /* Size of the complete HSI packet descriptor. */ | ||
44 | #define CFHSI_DESC_SZ (sizeof(struct cfhsi_desc)) | ||
45 | |||
46 | /* | ||
47 | * Size of the complete HSI packet descriptor excluding the optional embedded | ||
48 | * CAIF frame. | ||
49 | */ | ||
50 | #define CFHSI_DESC_SHORT_SZ (CFHSI_DESC_SZ - CFHSI_MAX_EMB_FRM_SZ) | ||
51 | |||
52 | /* | ||
53 | * Maximum bytes transferred in one transfer. | ||
54 | */ | ||
55 | /* TODO: 4096 is temporary... */ | ||
56 | #define CFHSI_MAX_PAYLOAD_SZ (CFHSI_MAX_PKTS * 4096) | ||
57 | |||
58 | /* Size of the complete HSI TX buffer. */ | ||
59 | #define CFHSI_BUF_SZ_TX (CFHSI_DESC_SZ + CFHSI_MAX_PAYLOAD_SZ) | ||
60 | |||
61 | /* Size of the complete HSI RX buffer. */ | ||
62 | #define CFHSI_BUF_SZ_RX ((2 * CFHSI_DESC_SZ) + CFHSI_MAX_PAYLOAD_SZ) | ||
63 | |||
64 | /* Bitmasks for the HSI descriptor. */ | ||
65 | #define CFHSI_PIGGY_DESC (0x01 << 7) | ||
66 | |||
67 | #define CFHSI_TX_STATE_IDLE 0 | ||
68 | #define CFHSI_TX_STATE_XFER 1 | ||
69 | |||
70 | #define CFHSI_RX_STATE_DESC 0 | ||
71 | #define CFHSI_RX_STATE_PAYLOAD 1 | ||
72 | |||
73 | /* Bitmasks for power management. */ | ||
74 | #define CFHSI_WAKE_UP 0 | ||
75 | #define CFHSI_WAKE_UP_ACK 1 | ||
76 | #define CFHSI_WAKE_DOWN_ACK 2 | ||
77 | #define CFHSI_AWAKE 3 | ||
78 | #define CFHSI_PENDING_RX 4 | ||
79 | #define CFHSI_SHUTDOWN 6 | ||
80 | #define CFHSI_FLUSH_FIFO 7 | ||
81 | |||
82 | #ifndef CFHSI_INACTIVITY_TOUT | ||
83 | #define CFHSI_INACTIVITY_TOUT (1 * HZ) | ||
84 | #endif /* CFHSI_INACTIVITY_TOUT */ | ||
85 | |||
86 | #ifndef CFHSI_WAKEUP_TOUT | ||
87 | #define CFHSI_WAKEUP_TOUT (3 * HZ) | ||
88 | #endif /* CFHSI_WAKEUP_TOUT */ | ||
89 | |||
90 | |||
91 | /* Structure implemented by the CAIF HSI driver. */ | ||
92 | struct cfhsi_drv { | ||
93 | void (*tx_done_cb) (struct cfhsi_drv *drv); | ||
94 | void (*rx_done_cb) (struct cfhsi_drv *drv); | ||
95 | void (*wake_up_cb) (struct cfhsi_drv *drv); | ||
96 | void (*wake_down_cb) (struct cfhsi_drv *drv); | ||
97 | }; | ||
98 | |||
99 | /* Structure implemented by HSI device. */ | ||
100 | struct cfhsi_dev { | ||
101 | int (*cfhsi_up) (struct cfhsi_dev *dev); | ||
102 | int (*cfhsi_down) (struct cfhsi_dev *dev); | ||
103 | int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_dev *dev); | ||
104 | int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_dev *dev); | ||
105 | int (*cfhsi_wake_up) (struct cfhsi_dev *dev); | ||
106 | int (*cfhsi_wake_down) (struct cfhsi_dev *dev); | ||
107 | int (*cfhsi_fifo_occupancy)(struct cfhsi_dev *dev, size_t *occupancy); | ||
108 | int (*cfhsi_rx_cancel)(struct cfhsi_dev *dev); | ||
109 | struct cfhsi_drv *drv; | ||
110 | }; | ||
111 | |||
112 | /* Structure implemented by CAIF HSI drivers. */ | ||
113 | struct cfhsi { | ||
114 | struct caif_dev_common cfdev; | ||
115 | struct net_device *ndev; | ||
116 | struct platform_device *pdev; | ||
117 | struct sk_buff_head qhead; | ||
118 | struct cfhsi_drv drv; | ||
119 | struct cfhsi_dev *dev; | ||
120 | int tx_state; | ||
121 | int rx_state; | ||
122 | int rx_len; | ||
123 | u8 *rx_ptr; | ||
124 | u8 *tx_buf; | ||
125 | u8 *rx_buf; | ||
126 | spinlock_t lock; | ||
127 | int flow_off_sent; | ||
128 | u32 q_low_mark; | ||
129 | u32 q_high_mark; | ||
130 | struct list_head list; | ||
131 | struct work_struct wake_up_work; | ||
132 | struct work_struct wake_down_work; | ||
133 | struct work_struct rx_done_work; | ||
134 | struct work_struct tx_done_work; | ||
135 | struct workqueue_struct *wq; | ||
136 | wait_queue_head_t wake_up_wait; | ||
137 | wait_queue_head_t wake_down_wait; | ||
138 | wait_queue_head_t flush_fifo_wait; | ||
139 | struct timer_list timer; | ||
140 | unsigned long bits; | ||
141 | }; | ||
142 | |||
143 | extern struct platform_driver cfhsi_driver; | ||
144 | |||
145 | #endif /* CAIF_HSI_H_ */ | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 396e8fc8910e..d17f47fc9e31 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -777,6 +777,7 @@ struct cfg80211_ssid { | |||
777 | * @n_channels: total number of channels to scan | 777 | * @n_channels: total number of channels to scan |
778 | * @ie: optional information element(s) to add into Probe Request or %NULL | 778 | * @ie: optional information element(s) to add into Probe Request or %NULL |
779 | * @ie_len: length of ie in octets | 779 | * @ie_len: length of ie in octets |
780 | * @rates: bitmap of rates to advertise for each band | ||
780 | * @wiphy: the wiphy this was for | 781 | * @wiphy: the wiphy this was for |
781 | * @dev: the interface | 782 | * @dev: the interface |
782 | * @aborted: (internal) scan request was notified as aborted | 783 | * @aborted: (internal) scan request was notified as aborted |
@@ -788,6 +789,8 @@ struct cfg80211_scan_request { | |||
788 | const u8 *ie; | 789 | const u8 *ie; |
789 | size_t ie_len; | 790 | size_t ie_len; |
790 | 791 | ||
792 | u32 rates[IEEE80211_NUM_BANDS]; | ||
793 | |||
791 | /* internal */ | 794 | /* internal */ |
792 | struct wiphy *wiphy; | 795 | struct wiphy *wiphy; |
793 | struct net_device *dev; | 796 | struct net_device *dev; |
@@ -1146,14 +1149,32 @@ struct cfg80211_wowlan_trig_pkt_pattern { | |||
1146 | * @magic_pkt: wake up on receiving magic packet | 1149 | * @magic_pkt: wake up on receiving magic packet |
1147 | * @patterns: wake up on receiving packet matching a pattern | 1150 | * @patterns: wake up on receiving packet matching a pattern |
1148 | * @n_patterns: number of patterns | 1151 | * @n_patterns: number of patterns |
1152 | * @gtk_rekey_failure: wake up on GTK rekey failure | ||
1153 | * @eap_identity_req: wake up on EAP identity request packet | ||
1154 | * @four_way_handshake: wake up on 4-way handshake | ||
1155 | * @rfkill_release: wake up when rfkill is released | ||
1149 | */ | 1156 | */ |
1150 | struct cfg80211_wowlan { | 1157 | struct cfg80211_wowlan { |
1151 | bool any, disconnect, magic_pkt; | 1158 | bool any, disconnect, magic_pkt, gtk_rekey_failure, |
1159 | eap_identity_req, four_way_handshake, | ||
1160 | rfkill_release; | ||
1152 | struct cfg80211_wowlan_trig_pkt_pattern *patterns; | 1161 | struct cfg80211_wowlan_trig_pkt_pattern *patterns; |
1153 | int n_patterns; | 1162 | int n_patterns; |
1154 | }; | 1163 | }; |
1155 | 1164 | ||
1156 | /** | 1165 | /** |
1166 | * struct cfg80211_gtk_rekey_data - rekey data | ||
1167 | * @kek: key encryption key | ||
1168 | * @kck: key confirmation key | ||
1169 | * @replay_ctr: replay counter | ||
1170 | */ | ||
1171 | struct cfg80211_gtk_rekey_data { | ||
1172 | u8 kek[NL80211_KEK_LEN]; | ||
1173 | u8 kck[NL80211_KCK_LEN]; | ||
1174 | u8 replay_ctr[NL80211_REPLAY_CTR_LEN]; | ||
1175 | }; | ||
1176 | |||
1177 | /** | ||
1157 | * struct cfg80211_ops - backend description for wireless configuration | 1178 | * struct cfg80211_ops - backend description for wireless configuration |
1158 | * | 1179 | * |
1159 | * This struct is registered by fullmac card drivers and/or wireless stacks | 1180 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -1197,6 +1218,8 @@ struct cfg80211_wowlan { | |||
1197 | * | 1218 | * |
1198 | * @set_default_mgmt_key: set the default management frame key on an interface | 1219 | * @set_default_mgmt_key: set the default management frame key on an interface |
1199 | * | 1220 | * |
1221 | * @set_rekey_data: give the data necessary for GTK rekeying to the driver | ||
1222 | * | ||
1200 | * @add_beacon: Add a beacon with given parameters, @head, @interval | 1223 | * @add_beacon: Add a beacon with given parameters, @head, @interval |
1201 | * and @dtim_period will be valid, @tail is optional. | 1224 | * and @dtim_period will be valid, @tail is optional. |
1202 | * @set_beacon: Change the beacon parameters for an access point mode | 1225 | * @set_beacon: Change the beacon parameters for an access point mode |
@@ -1284,6 +1307,12 @@ struct cfg80211_wowlan { | |||
1284 | * frame on another channel | 1307 | * frame on another channel |
1285 | * | 1308 | * |
1286 | * @testmode_cmd: run a test mode command | 1309 | * @testmode_cmd: run a test mode command |
1310 | * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be | ||
1311 | * used by the function, but 0 and 1 must not be touched. Additionally, | ||
1312 | * return error codes other than -ENOBUFS and -ENOENT will terminate the | ||
1313 | * dump and return to userspace with an error, so be careful. If any data | ||
1314 | * was passed in from userspace then the data/len arguments will be present | ||
1315 | * and point to the data contained in %NL80211_ATTR_TESTDATA. | ||
1287 | * | 1316 | * |
1288 | * @set_bitrate_mask: set the bitrate mask configuration | 1317 | * @set_bitrate_mask: set the bitrate mask configuration |
1289 | * | 1318 | * |
@@ -1433,6 +1462,9 @@ struct cfg80211_ops { | |||
1433 | 1462 | ||
1434 | #ifdef CONFIG_NL80211_TESTMODE | 1463 | #ifdef CONFIG_NL80211_TESTMODE |
1435 | int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); | 1464 | int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); |
1465 | int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, | ||
1466 | struct netlink_callback *cb, | ||
1467 | void *data, int len); | ||
1436 | #endif | 1468 | #endif |
1437 | 1469 | ||
1438 | int (*set_bitrate_mask)(struct wiphy *wiphy, | 1470 | int (*set_bitrate_mask)(struct wiphy *wiphy, |
@@ -1490,6 +1522,9 @@ struct cfg80211_ops { | |||
1490 | struct net_device *dev, | 1522 | struct net_device *dev, |
1491 | struct cfg80211_sched_scan_request *request); | 1523 | struct cfg80211_sched_scan_request *request); |
1492 | int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); | 1524 | int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); |
1525 | |||
1526 | int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, | ||
1527 | struct cfg80211_gtk_rekey_data *data); | ||
1493 | }; | 1528 | }; |
1494 | 1529 | ||
1495 | /* | 1530 | /* |
@@ -1647,11 +1682,21 @@ struct ieee80211_txrx_stypes { | |||
1647 | * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet | 1682 | * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet |
1648 | * (see nl80211.h) | 1683 | * (see nl80211.h) |
1649 | * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect | 1684 | * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect |
1685 | * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep | ||
1686 | * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure | ||
1687 | * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request | ||
1688 | * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure | ||
1689 | * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release | ||
1650 | */ | 1690 | */ |
1651 | enum wiphy_wowlan_support_flags { | 1691 | enum wiphy_wowlan_support_flags { |
1652 | WIPHY_WOWLAN_ANY = BIT(0), | 1692 | WIPHY_WOWLAN_ANY = BIT(0), |
1653 | WIPHY_WOWLAN_MAGIC_PKT = BIT(1), | 1693 | WIPHY_WOWLAN_MAGIC_PKT = BIT(1), |
1654 | WIPHY_WOWLAN_DISCONNECT = BIT(2), | 1694 | WIPHY_WOWLAN_DISCONNECT = BIT(2), |
1695 | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), | ||
1696 | WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), | ||
1697 | WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), | ||
1698 | WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), | ||
1699 | WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), | ||
1655 | }; | 1700 | }; |
1656 | 1701 | ||
1657 | /** | 1702 | /** |
@@ -1716,9 +1761,13 @@ struct wiphy_wowlan_support { | |||
1716 | * this variable determines its size | 1761 | * this variable determines its size |
1717 | * @max_scan_ssids: maximum number of SSIDs the device can scan for in | 1762 | * @max_scan_ssids: maximum number of SSIDs the device can scan for in |
1718 | * any given scan | 1763 | * any given scan |
1764 | * @max_sched_scan_ssids: maximum number of SSIDs the device can scan | ||
1765 | * for in any given scheduled scan | ||
1719 | * @max_scan_ie_len: maximum length of user-controlled IEs device can | 1766 | * @max_scan_ie_len: maximum length of user-controlled IEs device can |
1720 | * add to probe request frames transmitted during a scan, must not | 1767 | * add to probe request frames transmitted during a scan, must not |
1721 | * include fixed IEs like supported rates | 1768 | * include fixed IEs like supported rates |
1769 | * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled | ||
1770 | * scans | ||
1722 | * @coverage_class: current coverage class | 1771 | * @coverage_class: current coverage class |
1723 | * @fw_version: firmware version for ethtool reporting | 1772 | * @fw_version: firmware version for ethtool reporting |
1724 | * @hw_version: hardware version for ethtool reporting | 1773 | * @hw_version: hardware version for ethtool reporting |
@@ -1770,7 +1819,9 @@ struct wiphy { | |||
1770 | 1819 | ||
1771 | int bss_priv_size; | 1820 | int bss_priv_size; |
1772 | u8 max_scan_ssids; | 1821 | u8 max_scan_ssids; |
1822 | u8 max_sched_scan_ssids; | ||
1773 | u16 max_scan_ie_len; | 1823 | u16 max_scan_ie_len; |
1824 | u16 max_sched_scan_ie_len; | ||
1774 | 1825 | ||
1775 | int n_cipher_suites; | 1826 | int n_cipher_suites; |
1776 | const u32 *cipher_suites; | 1827 | const u32 *cipher_suites; |
@@ -2849,8 +2900,10 @@ struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, | |||
2849 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); | 2900 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); |
2850 | 2901 | ||
2851 | #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), | 2902 | #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), |
2903 | #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), | ||
2852 | #else | 2904 | #else |
2853 | #define CFG80211_TESTMODE_CMD(cmd) | 2905 | #define CFG80211_TESTMODE_CMD(cmd) |
2906 | #define CFG80211_TESTMODE_DUMP(cmd) | ||
2854 | #endif | 2907 | #endif |
2855 | 2908 | ||
2856 | /** | 2909 | /** |
@@ -3022,6 +3075,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
3022 | void cfg80211_cqm_pktloss_notify(struct net_device *dev, | 3075 | void cfg80211_cqm_pktloss_notify(struct net_device *dev, |
3023 | const u8 *peer, u32 num_packets, gfp_t gfp); | 3076 | const u8 *peer, u32 num_packets, gfp_t gfp); |
3024 | 3077 | ||
3078 | /** | ||
3079 | * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying | ||
3080 | * @dev: network device | ||
3081 | * @bssid: BSSID of AP (to avoid races) | ||
3082 | * @replay_ctr: new replay counter | ||
3083 | * @gfp: allocation flags | ||
3084 | */ | ||
3085 | void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, | ||
3086 | const u8 *replay_ctr, gfp_t gfp); | ||
3087 | |||
3025 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3088 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3026 | 3089 | ||
3027 | /* wiphy_printk helpers, similar to dev_printk */ | 3090 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index e5983c9053dc..f5aa39997f0b 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h | |||
@@ -28,8 +28,16 @@ struct dcb_app_type { | |||
28 | struct list_head list; | 28 | struct list_head list; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | u8 dcb_setapp(struct net_device *, struct dcb_app *); | 31 | int dcb_setapp(struct net_device *, struct dcb_app *); |
32 | u8 dcb_getapp(struct net_device *, struct dcb_app *); | 32 | u8 dcb_getapp(struct net_device *, struct dcb_app *); |
33 | int dcb_ieee_setapp(struct net_device *, struct dcb_app *); | ||
34 | int dcb_ieee_delapp(struct net_device *, struct dcb_app *); | ||
35 | u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *); | ||
36 | |||
37 | int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd, | ||
38 | u32 seq, u32 pid); | ||
39 | int dcbnl_cee_notify(struct net_device *dev, int event, int cmd, | ||
40 | u32 seq, u32 pid); | ||
33 | 41 | ||
34 | /* | 42 | /* |
35 | * Ops struct for the netlink callbacks. Used by DCB-enabled drivers through | 43 | * Ops struct for the netlink callbacks. Used by DCB-enabled drivers through |
@@ -43,6 +51,7 @@ struct dcbnl_rtnl_ops { | |||
43 | int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); | 51 | int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); |
44 | int (*ieee_getapp) (struct net_device *, struct dcb_app *); | 52 | int (*ieee_getapp) (struct net_device *, struct dcb_app *); |
45 | int (*ieee_setapp) (struct net_device *, struct dcb_app *); | 53 | int (*ieee_setapp) (struct net_device *, struct dcb_app *); |
54 | int (*ieee_delapp) (struct net_device *, struct dcb_app *); | ||
46 | int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *); | 55 | int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *); |
47 | int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *); | 56 | int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *); |
48 | 57 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index e12ddfb9eb16..29e255796ce1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -37,8 +37,7 @@ struct dst_entry { | |||
37 | unsigned long _metrics; | 37 | unsigned long _metrics; |
38 | unsigned long expires; | 38 | unsigned long expires; |
39 | struct dst_entry *path; | 39 | struct dst_entry *path; |
40 | struct neighbour *neighbour; | 40 | struct neighbour *_neighbour; |
41 | struct hh_cache *hh; | ||
42 | #ifdef CONFIG_XFRM | 41 | #ifdef CONFIG_XFRM |
43 | struct xfrm_state *xfrm; | 42 | struct xfrm_state *xfrm; |
44 | #else | 43 | #else |
@@ -47,6 +46,14 @@ struct dst_entry { | |||
47 | int (*input)(struct sk_buff*); | 46 | int (*input)(struct sk_buff*); |
48 | int (*output)(struct sk_buff*); | 47 | int (*output)(struct sk_buff*); |
49 | 48 | ||
49 | int flags; | ||
50 | #define DST_HOST 0x0001 | ||
51 | #define DST_NOXFRM 0x0002 | ||
52 | #define DST_NOPOLICY 0x0004 | ||
53 | #define DST_NOHASH 0x0008 | ||
54 | #define DST_NOCACHE 0x0010 | ||
55 | #define DST_NOCOUNT 0x0020 | ||
56 | |||
50 | short error; | 57 | short error; |
51 | short obsolete; | 58 | short obsolete; |
52 | unsigned short header_len; /* more space at head required */ | 59 | unsigned short header_len; /* more space at head required */ |
@@ -62,7 +69,7 @@ struct dst_entry { | |||
62 | * (L1_CACHE_SIZE would be too much) | 69 | * (L1_CACHE_SIZE would be too much) |
63 | */ | 70 | */ |
64 | #ifdef CONFIG_64BIT | 71 | #ifdef CONFIG_64BIT |
65 | long __pad_to_align_refcnt[1]; | 72 | long __pad_to_align_refcnt[2]; |
66 | #endif | 73 | #endif |
67 | /* | 74 | /* |
68 | * __refcnt wants to be on a different cache line from | 75 | * __refcnt wants to be on a different cache line from |
@@ -71,13 +78,6 @@ struct dst_entry { | |||
71 | atomic_t __refcnt; /* client references */ | 78 | atomic_t __refcnt; /* client references */ |
72 | int __use; | 79 | int __use; |
73 | unsigned long lastuse; | 80 | unsigned long lastuse; |
74 | int flags; | ||
75 | #define DST_HOST 0x0001 | ||
76 | #define DST_NOXFRM 0x0002 | ||
77 | #define DST_NOPOLICY 0x0004 | ||
78 | #define DST_NOHASH 0x0008 | ||
79 | #define DST_NOCACHE 0x0010 | ||
80 | #define DST_NOCOUNT 0x0020 | ||
81 | union { | 81 | union { |
82 | struct dst_entry *next; | 82 | struct dst_entry *next; |
83 | struct rtable __rcu *rt_next; | 83 | struct rtable __rcu *rt_next; |
@@ -86,6 +86,16 @@ struct dst_entry { | |||
86 | }; | 86 | }; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst) | ||
90 | { | ||
91 | return dst->_neighbour; | ||
92 | } | ||
93 | |||
94 | static inline void dst_set_neighbour(struct dst_entry *dst, struct neighbour *neigh) | ||
95 | { | ||
96 | dst->_neighbour = neigh; | ||
97 | } | ||
98 | |||
89 | extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); | 99 | extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); |
90 | extern const u32 dst_default_metrics[RTAX_MAX]; | 100 | extern const u32 dst_default_metrics[RTAX_MAX]; |
91 | 101 | ||
@@ -371,8 +381,15 @@ static inline void dst_rcu_free(struct rcu_head *head) | |||
371 | 381 | ||
372 | static inline void dst_confirm(struct dst_entry *dst) | 382 | static inline void dst_confirm(struct dst_entry *dst) |
373 | { | 383 | { |
374 | if (dst) | 384 | if (dst) { |
375 | neigh_confirm(dst->neighbour); | 385 | struct neighbour *n = dst_get_neighbour(dst); |
386 | neigh_confirm(n); | ||
387 | } | ||
388 | } | ||
389 | |||
390 | static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | ||
391 | { | ||
392 | return dst->ops->neigh_lookup(dst, daddr); | ||
376 | } | 393 | } |
377 | 394 | ||
378 | static inline void dst_link_failure(struct sk_buff *skb) | 395 | static inline void dst_link_failure(struct sk_buff *skb) |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index dc0746328947..9adb99845a56 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
@@ -26,6 +26,7 @@ struct dst_ops { | |||
26 | void (*link_failure)(struct sk_buff *); | 26 | void (*link_failure)(struct sk_buff *); |
27 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | 27 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); |
28 | int (*local_out)(struct sk_buff *skb); | 28 | int (*local_out)(struct sk_buff *skb); |
29 | struct neighbour * (*neigh_lookup)(const struct dst_entry *dst, const void *daddr); | ||
29 | 30 | ||
30 | struct kmem_cache *kmem_cachep; | 31 | struct kmem_cache *kmem_cachep; |
31 | 32 | ||
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index d420f28b6d60..82d8d09faa44 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -160,6 +160,38 @@ static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, | |||
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * genlmsg_nlhdr - Obtain netlink header from user specified header | ||
164 | * @user_hdr: user header as returned from genlmsg_put() | ||
165 | * @family: generic netlink family | ||
166 | * | ||
167 | * Returns pointer to netlink header. | ||
168 | */ | ||
169 | static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr, | ||
170 | struct genl_family *family) | ||
171 | { | ||
172 | return (struct nlmsghdr *)((char *)user_hdr - | ||
173 | family->hdrsize - | ||
174 | GENL_HDRLEN - | ||
175 | NLMSG_HDRLEN); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * genl_dump_check_consistent - check if sequence is consistent and advertise if not | ||
180 | * @cb: netlink callback structure that stores the sequence number | ||
181 | * @user_hdr: user header as returned from genlmsg_put() | ||
182 | * @family: generic netlink family | ||
183 | * | ||
184 | * Cf. nl_dump_check_consistent(), this just provides a wrapper to make it | ||
185 | * simpler to use with generic netlink. | ||
186 | */ | ||
187 | static inline void genl_dump_check_consistent(struct netlink_callback *cb, | ||
188 | void *user_hdr, | ||
189 | struct genl_family *family) | ||
190 | { | ||
191 | nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr, family)); | ||
192 | } | ||
193 | |||
194 | /** | ||
163 | * genlmsg_put_reply - Add generic netlink header to a reply message | 195 | * genlmsg_put_reply - Add generic netlink header to a reply message |
164 | * @skb: socket buffer holding the message | 196 | * @skb: socket buffer holding the message |
165 | * @info: receiver info | 197 | * @info: receiver info |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 8a159cc3d68b..4233e6f9841d 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -32,13 +32,17 @@ struct inet_peer { | |||
32 | struct inet_peer __rcu *avl_left, *avl_right; | 32 | struct inet_peer __rcu *avl_left, *avl_right; |
33 | struct inetpeer_addr daddr; | 33 | struct inetpeer_addr daddr; |
34 | __u32 avl_height; | 34 | __u32 avl_height; |
35 | struct list_head unused; | 35 | |
36 | __u32 dtime; /* the time of last use of not | 36 | u32 metrics[RTAX_MAX]; |
37 | * referenced entries */ | 37 | u32 rate_tokens; /* rate limiting for ICMP */ |
38 | atomic_t refcnt; | 38 | unsigned long rate_last; |
39 | unsigned long pmtu_expires; | ||
40 | u32 pmtu_orig; | ||
41 | u32 pmtu_learned; | ||
42 | struct inetpeer_addr_base redirect_learned; | ||
39 | /* | 43 | /* |
40 | * Once inet_peer is queued for deletion (refcnt == -1), following fields | 44 | * Once inet_peer is queued for deletion (refcnt == -1), following fields |
41 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp, metrics | 45 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp |
42 | * We can share memory with rcu_head to help keep inet_peer small. | 46 | * We can share memory with rcu_head to help keep inet_peer small. |
43 | */ | 47 | */ |
44 | union { | 48 | union { |
@@ -47,16 +51,14 @@ struct inet_peer { | |||
47 | atomic_t ip_id_count; /* IP ID for the next packet */ | 51 | atomic_t ip_id_count; /* IP ID for the next packet */ |
48 | __u32 tcp_ts; | 52 | __u32 tcp_ts; |
49 | __u32 tcp_ts_stamp; | 53 | __u32 tcp_ts_stamp; |
50 | u32 metrics[RTAX_MAX]; | ||
51 | u32 rate_tokens; /* rate limiting for ICMP */ | ||
52 | unsigned long rate_last; | ||
53 | unsigned long pmtu_expires; | ||
54 | u32 pmtu_orig; | ||
55 | u32 pmtu_learned; | ||
56 | struct inetpeer_addr_base redirect_learned; | ||
57 | }; | 54 | }; |
58 | struct rcu_head rcu; | 55 | struct rcu_head rcu; |
56 | struct inet_peer *gc_next; | ||
59 | }; | 57 | }; |
58 | |||
59 | /* following fields might be frequently dirtied */ | ||
60 | __u32 dtime; /* the time of last use of not referenced entries */ | ||
61 | atomic_t refcnt; | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | void inet_initpeers(void) __init; | 64 | void inet_initpeers(void) __init; |
@@ -69,7 +71,7 @@ static inline bool inet_metrics_new(const struct inet_peer *p) | |||
69 | } | 71 | } |
70 | 72 | ||
71 | /* can be called with or without local BH being disabled */ | 73 | /* can be called with or without local BH being disabled */ |
72 | struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); | 74 | struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create); |
73 | 75 | ||
74 | static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) | 76 | static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) |
75 | { | 77 | { |
@@ -104,11 +106,18 @@ static inline void inet_peer_refcheck(const struct inet_peer *p) | |||
104 | 106 | ||
105 | 107 | ||
106 | /* can be called with or without local BH being disabled */ | 108 | /* can be called with or without local BH being disabled */ |
107 | static inline __u16 inet_getid(struct inet_peer *p, int more) | 109 | static inline int inet_getid(struct inet_peer *p, int more) |
108 | { | 110 | { |
111 | int old, new; | ||
109 | more++; | 112 | more++; |
110 | inet_peer_refcheck(p); | 113 | inet_peer_refcheck(p); |
111 | return atomic_add_return(more, &p->ip_id_count) - more; | 114 | do { |
115 | old = atomic_read(&p->ip_id_count); | ||
116 | new = old + more; | ||
117 | if (!new) | ||
118 | new = 1; | ||
119 | } while (atomic_cmpxchg(&p->ip_id_count, old, new) != old); | ||
120 | return new; | ||
112 | } | 121 | } |
113 | 122 | ||
114 | #endif /* _NET_INETPEER_H */ | 123 | #endif /* _NET_INETPEER_H */ |
diff --git a/include/net/ip.h b/include/net/ip.h index 66dd49149208..aa76c7a4d9c3 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -228,8 +228,6 @@ extern struct ctl_path net_ipv4_ctl_path[]; | |||
228 | extern int inet_peer_threshold; | 228 | extern int inet_peer_threshold; |
229 | extern int inet_peer_minttl; | 229 | extern int inet_peer_minttl; |
230 | extern int inet_peer_maxttl; | 230 | extern int inet_peer_maxttl; |
231 | extern int inet_peer_gc_mintime; | ||
232 | extern int inet_peer_gc_maxtime; | ||
233 | 231 | ||
234 | /* From ip_output.c */ | 232 | /* From ip_output.c */ |
235 | extern int sysctl_ip_dynaddr; | 233 | extern int sysctl_ip_dynaddr; |
@@ -238,6 +236,11 @@ extern void ipfrag_init(void); | |||
238 | 236 | ||
239 | extern void ip_static_sysctl_init(void); | 237 | extern void ip_static_sysctl_init(void); |
240 | 238 | ||
239 | static inline bool ip_is_fragment(const struct iphdr *iph) | ||
240 | { | ||
241 | return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; | ||
242 | } | ||
243 | |||
241 | #ifdef CONFIG_INET | 244 | #ifdef CONFIG_INET |
242 | #include <net/dst.h> | 245 | #include <net/dst.h> |
243 | 246 | ||
@@ -401,7 +404,8 @@ enum ip_defrag_users { | |||
401 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX, | 404 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX, |
402 | IP_DEFRAG_VS_IN, | 405 | IP_DEFRAG_VS_IN, |
403 | IP_DEFRAG_VS_OUT, | 406 | IP_DEFRAG_VS_OUT, |
404 | IP_DEFRAG_VS_FWD | 407 | IP_DEFRAG_VS_FWD, |
408 | IP_DEFRAG_AF_PACKET, | ||
405 | }; | 409 | }; |
406 | 410 | ||
407 | int ip_defrag(struct sk_buff *skb, u32 user); | 411 | int ip_defrag(struct sk_buff *skb, u32 user); |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 477ef75f3873..5735a0f979c3 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -87,7 +87,6 @@ struct rt6_info { | |||
87 | struct dst_entry dst; | 87 | struct dst_entry dst; |
88 | 88 | ||
89 | #define rt6i_dev dst.dev | 89 | #define rt6i_dev dst.dev |
90 | #define rt6i_nexthop dst.neighbour | ||
91 | #define rt6i_expires dst.expires | 90 | #define rt6i_expires dst.expires |
92 | 91 | ||
93 | /* | 92 | /* |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 481f856c650f..b1370c4015b6 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -836,8 +836,6 @@ struct netns_ipvs { | |||
836 | int num_services; /* no of virtual services */ | 836 | int num_services; /* no of virtual services */ |
837 | 837 | ||
838 | rwlock_t rs_lock; /* real services table */ | 838 | rwlock_t rs_lock; /* real services table */ |
839 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | ||
840 | struct lock_class_key ctl_key; /* ctl_mutex debuging */ | ||
841 | /* Trash for destinations */ | 839 | /* Trash for destinations */ |
842 | struct list_head dest_trash; | 840 | struct list_head dest_trash; |
843 | /* Service counters */ | 841 | /* Service counters */ |
@@ -1089,19 +1087,19 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) | |||
1089 | /* | 1087 | /* |
1090 | * IPVS netns init & cleanup functions | 1088 | * IPVS netns init & cleanup functions |
1091 | */ | 1089 | */ |
1092 | extern int __ip_vs_estimator_init(struct net *net); | 1090 | extern int ip_vs_estimator_net_init(struct net *net); |
1093 | extern int __ip_vs_control_init(struct net *net); | 1091 | extern int ip_vs_control_net_init(struct net *net); |
1094 | extern int __ip_vs_protocol_init(struct net *net); | 1092 | extern int ip_vs_protocol_net_init(struct net *net); |
1095 | extern int __ip_vs_app_init(struct net *net); | 1093 | extern int ip_vs_app_net_init(struct net *net); |
1096 | extern int __ip_vs_conn_init(struct net *net); | 1094 | extern int ip_vs_conn_net_init(struct net *net); |
1097 | extern int __ip_vs_sync_init(struct net *net); | 1095 | extern int ip_vs_sync_net_init(struct net *net); |
1098 | extern void __ip_vs_conn_cleanup(struct net *net); | 1096 | extern void ip_vs_conn_net_cleanup(struct net *net); |
1099 | extern void __ip_vs_app_cleanup(struct net *net); | 1097 | extern void ip_vs_app_net_cleanup(struct net *net); |
1100 | extern void __ip_vs_protocol_cleanup(struct net *net); | 1098 | extern void ip_vs_protocol_net_cleanup(struct net *net); |
1101 | extern void __ip_vs_control_cleanup(struct net *net); | 1099 | extern void ip_vs_control_net_cleanup(struct net *net); |
1102 | extern void __ip_vs_estimator_cleanup(struct net *net); | 1100 | extern void ip_vs_estimator_net_cleanup(struct net *net); |
1103 | extern void __ip_vs_sync_cleanup(struct net *net); | 1101 | extern void ip_vs_sync_net_cleanup(struct net *net); |
1104 | extern void __ip_vs_service_cleanup(struct net *net); | 1102 | extern void ip_vs_service_net_cleanup(struct net *net); |
1105 | 1103 | ||
1106 | /* | 1104 | /* |
1107 | * IPVS application functions | 1105 | * IPVS application functions |
@@ -1119,8 +1117,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | |||
1119 | 1117 | ||
1120 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | 1118 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); |
1121 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | 1119 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
1122 | extern int ip_vs_app_init(void); | ||
1123 | extern void ip_vs_app_cleanup(void); | ||
1124 | 1120 | ||
1125 | void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); | 1121 | void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); |
1126 | void ip_vs_unbind_pe(struct ip_vs_service *svc); | 1122 | void ip_vs_unbind_pe(struct ip_vs_service *svc); |
@@ -1223,15 +1219,11 @@ extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, | |||
1223 | __u8 syncid); | 1219 | __u8 syncid); |
1224 | extern int stop_sync_thread(struct net *net, int state); | 1220 | extern int stop_sync_thread(struct net *net, int state); |
1225 | extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); | 1221 | extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); |
1226 | extern int ip_vs_sync_init(void); | ||
1227 | extern void ip_vs_sync_cleanup(void); | ||
1228 | 1222 | ||
1229 | 1223 | ||
1230 | /* | 1224 | /* |
1231 | * IPVS rate estimator prototypes (from ip_vs_est.c) | 1225 | * IPVS rate estimator prototypes (from ip_vs_est.c) |
1232 | */ | 1226 | */ |
1233 | extern int ip_vs_estimator_init(void); | ||
1234 | extern void ip_vs_estimator_cleanup(void); | ||
1235 | extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); | 1227 | extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); |
1236 | extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); | 1228 | extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); |
1237 | extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); | 1229 | extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index c033ed00df7d..3b5ac1fbff39 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -463,17 +463,7 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
463 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | 463 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); |
464 | } | 464 | } |
465 | 465 | ||
466 | static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr) | 466 | extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); |
467 | { | ||
468 | static u32 ipv6_fragmentation_id = 1; | ||
469 | static DEFINE_SPINLOCK(ip6_id_lock); | ||
470 | |||
471 | spin_lock_bh(&ip6_id_lock); | ||
472 | fhdr->identification = htonl(ipv6_fragmentation_id); | ||
473 | if (++ipv6_fragmentation_id == 0) | ||
474 | ipv6_fragmentation_id = 1; | ||
475 | spin_unlock_bh(&ip6_id_lock); | ||
476 | } | ||
477 | 467 | ||
478 | /* | 468 | /* |
479 | * Prototypes exported by ipv6 | 469 | * Prototypes exported by ipv6 |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index e6d6a66a8f71..9259e97864d7 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/ieee80211.h> | 21 | #include <linux/ieee80211.h> |
22 | #include <net/cfg80211.h> | 22 | #include <net/cfg80211.h> |
23 | #include <asm/unaligned.h> | ||
23 | 24 | ||
24 | /** | 25 | /** |
25 | * DOC: Introduction | 26 | * DOC: Introduction |
@@ -193,6 +194,17 @@ enum ieee80211_bss_change { | |||
193 | #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 | 194 | #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 |
194 | 195 | ||
195 | /** | 196 | /** |
197 | * enum ieee80211_rssi_event - RSSI threshold event | ||
198 | * An indicator for when RSSI goes below/above a certain threshold. | ||
199 | * @RSSI_EVENT_HIGH: AP's rssi crossed the high threshold set by the driver. | ||
200 | * @RSSI_EVENT_LOW: AP's rssi crossed the low threshold set by the driver. | ||
201 | */ | ||
202 | enum ieee80211_rssi_event { | ||
203 | RSSI_EVENT_HIGH, | ||
204 | RSSI_EVENT_LOW, | ||
205 | }; | ||
206 | |||
207 | /** | ||
196 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | 208 | * struct ieee80211_bss_conf - holds the BSS's changing parameters |
197 | * | 209 | * |
198 | * This structure keeps information about a BSS (and an association | 210 | * This structure keeps information about a BSS (and an association |
@@ -933,6 +945,7 @@ enum set_key_cmd { | |||
933 | * @aid: AID we assigned to the station if we're an AP | 945 | * @aid: AID we assigned to the station if we're an AP |
934 | * @supp_rates: Bitmap of supported rates (per band) | 946 | * @supp_rates: Bitmap of supported rates (per band) |
935 | * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities | 947 | * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities |
948 | * @wme: indicates whether the STA supports WME. Only valid during AP-mode. | ||
936 | * @drv_priv: data area for driver use, will always be aligned to | 949 | * @drv_priv: data area for driver use, will always be aligned to |
937 | * sizeof(void *), size is determined in hw information. | 950 | * sizeof(void *), size is determined in hw information. |
938 | */ | 951 | */ |
@@ -941,6 +954,7 @@ struct ieee80211_sta { | |||
941 | u8 addr[ETH_ALEN]; | 954 | u8 addr[ETH_ALEN]; |
942 | u16 aid; | 955 | u16 aid; |
943 | struct ieee80211_sta_ht_cap ht_cap; | 956 | struct ieee80211_sta_ht_cap ht_cap; |
957 | bool wme; | ||
944 | 958 | ||
945 | /* must be last */ | 959 | /* must be last */ |
946 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 960 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
@@ -960,21 +974,6 @@ enum sta_notify_cmd { | |||
960 | }; | 974 | }; |
961 | 975 | ||
962 | /** | 976 | /** |
963 | * enum ieee80211_tkip_key_type - get tkip key | ||
964 | * | ||
965 | * Used by drivers which need to get a tkip key for skb. Some drivers need a | ||
966 | * phase 1 key, others need a phase 2 key. A single function allows the driver | ||
967 | * to get the key, this enum indicates what type of key is required. | ||
968 | * | ||
969 | * @IEEE80211_TKIP_P1_KEY: the driver needs a phase 1 key | ||
970 | * @IEEE80211_TKIP_P2_KEY: the driver needs a phase 2 key | ||
971 | */ | ||
972 | enum ieee80211_tkip_key_type { | ||
973 | IEEE80211_TKIP_P1_KEY, | ||
974 | IEEE80211_TKIP_P2_KEY, | ||
975 | }; | ||
976 | |||
977 | /** | ||
978 | * enum ieee80211_hw_flags - hardware flags | 977 | * enum ieee80211_hw_flags - hardware flags |
979 | * | 978 | * |
980 | * These flags are used to indicate hardware capabilities to | 979 | * These flags are used to indicate hardware capabilities to |
@@ -1587,6 +1586,20 @@ enum ieee80211_ampdu_mlme_action { | |||
1587 | }; | 1586 | }; |
1588 | 1587 | ||
1589 | /** | 1588 | /** |
1589 | * enum ieee80211_tx_sync_type - TX sync type | ||
1590 | * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication | ||
1591 | * (and possibly also before direct probe) | ||
1592 | * @IEEE80211_TX_SYNC_ASSOC: sync TX for association | ||
1593 | * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame | ||
1594 | * (not implemented yet) | ||
1595 | */ | ||
1596 | enum ieee80211_tx_sync_type { | ||
1597 | IEEE80211_TX_SYNC_AUTH, | ||
1598 | IEEE80211_TX_SYNC_ASSOC, | ||
1599 | IEEE80211_TX_SYNC_ACTION, | ||
1600 | }; | ||
1601 | |||
1602 | /** | ||
1590 | * struct ieee80211_ops - callbacks from mac80211 to the driver | 1603 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
1591 | * | 1604 | * |
1592 | * This structure contains various callbacks that the driver may | 1605 | * This structure contains various callbacks that the driver may |
@@ -1626,6 +1639,10 @@ enum ieee80211_ampdu_mlme_action { | |||
1626 | * ask the device to suspend. This is only invoked when WoWLAN is | 1639 | * ask the device to suspend. This is only invoked when WoWLAN is |
1627 | * configured, otherwise the device is deconfigured completely and | 1640 | * configured, otherwise the device is deconfigured completely and |
1628 | * reconfigured at resume time. | 1641 | * reconfigured at resume time. |
1642 | * The driver may also impose special conditions under which it | ||
1643 | * wants to use the "normal" suspend (deconfigure), say if it only | ||
1644 | * supports WoWLAN when the device is associated. In this case, it | ||
1645 | * must return 1 from this function. | ||
1629 | * | 1646 | * |
1630 | * @resume: If WoWLAN was configured, this indicates that mac80211 is | 1647 | * @resume: If WoWLAN was configured, this indicates that mac80211 is |
1631 | * now resuming its operation, after this the device must be fully | 1648 | * now resuming its operation, after this the device must be fully |
@@ -1671,6 +1688,26 @@ enum ieee80211_ampdu_mlme_action { | |||
1671 | * of the bss parameters has changed when a call is made. The callback | 1688 | * of the bss parameters has changed when a call is made. The callback |
1672 | * can sleep. | 1689 | * can sleep. |
1673 | * | 1690 | * |
1691 | * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the | ||
1692 | * driver should sync with the GO's powersaving so the device doesn't | ||
1693 | * transmit the frame while the GO is asleep. In the regular AP case | ||
1694 | * it may be used by drivers for devices implementing other restrictions | ||
1695 | * on talking to APs, e.g. due to regulatory enforcement or just HW | ||
1696 | * restrictions. | ||
1697 | * This function is called for every authentication, association and | ||
1698 | * action frame separately since applications might attempt to auth | ||
1699 | * with multiple APs before chosing one to associate to. If it returns | ||
1700 | * an error, the corresponding authentication, association or frame | ||
1701 | * transmission is aborted and reported as having failed. It is always | ||
1702 | * called after tuning to the correct channel. | ||
1703 | * The callback might be called multiple times before @finish_tx_sync | ||
1704 | * (but @finish_tx_sync will be called once for each) but in practice | ||
1705 | * this is unlikely to happen. It can also refuse in that case if the | ||
1706 | * driver cannot handle that situation. | ||
1707 | * This callback can sleep. | ||
1708 | * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned | ||
1709 | * an error. This callback can sleep. | ||
1710 | * | ||
1674 | * @prepare_multicast: Prepare for multicast filter configuration. | 1711 | * @prepare_multicast: Prepare for multicast filter configuration. |
1675 | * This callback is optional, and its return value is passed | 1712 | * This callback is optional, and its return value is passed |
1676 | * to configure_filter(). This callback must be atomic. | 1713 | * to configure_filter(). This callback must be atomic. |
@@ -1694,6 +1731,12 @@ enum ieee80211_ampdu_mlme_action { | |||
1694 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. | 1731 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. |
1695 | * The callback must be atomic. | 1732 | * The callback must be atomic. |
1696 | * | 1733 | * |
1734 | * @set_rekey_data: If the device supports GTK rekeying, for example while the | ||
1735 | * host is suspended, it can assign this callback to retrieve the data | ||
1736 | * necessary to do GTK rekeying, this is the KEK, KCK and replay counter. | ||
1737 | * After rekeying was done it should (for example during resume) notify | ||
1738 | * userspace of the new replay counter using ieee80211_gtk_rekey_notify(). | ||
1739 | * | ||
1697 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 1740 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
1698 | * the scan state machine in stack. The scan must honour the channel | 1741 | * the scan state machine in stack. The scan must honour the channel |
1699 | * configuration done by the regulatory agent in the wiphy's | 1742 | * configuration done by the regulatory agent in the wiphy's |
@@ -1708,6 +1751,14 @@ enum ieee80211_ampdu_mlme_action { | |||
1708 | * any error unless this callback returned a negative error code. | 1751 | * any error unless this callback returned a negative error code. |
1709 | * The callback can sleep. | 1752 | * The callback can sleep. |
1710 | * | 1753 | * |
1754 | * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan. | ||
1755 | * The driver should ask the hardware to cancel the scan (if possible), | ||
1756 | * but the scan will be completed only after the driver will call | ||
1757 | * ieee80211_scan_completed(). | ||
1758 | * This callback is needed for wowlan, to prevent enqueueing a new | ||
1759 | * scan_work after the low-level driver was already suspended. | ||
1760 | * The callback can sleep. | ||
1761 | * | ||
1711 | * @sched_scan_start: Ask the hardware to start scanning repeatedly at | 1762 | * @sched_scan_start: Ask the hardware to start scanning repeatedly at |
1712 | * specific intervals. The driver must call the | 1763 | * specific intervals. The driver must call the |
1713 | * ieee80211_sched_scan_results() function whenever it finds results. | 1764 | * ieee80211_sched_scan_results() function whenever it finds results. |
@@ -1816,6 +1867,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1816 | * | 1867 | * |
1817 | * @testmode_cmd: Implement a cfg80211 test mode command. | 1868 | * @testmode_cmd: Implement a cfg80211 test mode command. |
1818 | * The callback can sleep. | 1869 | * The callback can sleep. |
1870 | * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. | ||
1819 | * | 1871 | * |
1820 | * @flush: Flush all pending frames from the hardware queue, making sure | 1872 | * @flush: Flush all pending frames from the hardware queue, making sure |
1821 | * that the hardware queues are empty. If the parameter @drop is set | 1873 | * that the hardware queues are empty. If the parameter @drop is set |
@@ -1860,6 +1912,8 @@ enum ieee80211_ampdu_mlme_action { | |||
1860 | * @set_bitrate_mask: Set a mask of rates to be used for rate control selection | 1912 | * @set_bitrate_mask: Set a mask of rates to be used for rate control selection |
1861 | * when transmitting a frame. Currently only legacy rates are handled. | 1913 | * when transmitting a frame. Currently only legacy rates are handled. |
1862 | * The callback can sleep. | 1914 | * The callback can sleep. |
1915 | * @rssi_callback: Notify driver when the average RSSI goes above/below | ||
1916 | * thresholds that were registered previously. The callback can sleep. | ||
1863 | */ | 1917 | */ |
1864 | struct ieee80211_ops { | 1918 | struct ieee80211_ops { |
1865 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1919 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
@@ -1881,6 +1935,14 @@ struct ieee80211_ops { | |||
1881 | struct ieee80211_vif *vif, | 1935 | struct ieee80211_vif *vif, |
1882 | struct ieee80211_bss_conf *info, | 1936 | struct ieee80211_bss_conf *info, |
1883 | u32 changed); | 1937 | u32 changed); |
1938 | |||
1939 | int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1940 | const u8 *bssid, enum ieee80211_tx_sync_type type); | ||
1941 | void (*finish_tx_sync)(struct ieee80211_hw *hw, | ||
1942 | struct ieee80211_vif *vif, | ||
1943 | const u8 *bssid, | ||
1944 | enum ieee80211_tx_sync_type type); | ||
1945 | |||
1884 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, | 1946 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, |
1885 | struct netdev_hw_addr_list *mc_list); | 1947 | struct netdev_hw_addr_list *mc_list); |
1886 | void (*configure_filter)(struct ieee80211_hw *hw, | 1948 | void (*configure_filter)(struct ieee80211_hw *hw, |
@@ -1897,8 +1959,13 @@ struct ieee80211_ops { | |||
1897 | struct ieee80211_key_conf *conf, | 1959 | struct ieee80211_key_conf *conf, |
1898 | struct ieee80211_sta *sta, | 1960 | struct ieee80211_sta *sta, |
1899 | u32 iv32, u16 *phase1key); | 1961 | u32 iv32, u16 *phase1key); |
1962 | void (*set_rekey_data)(struct ieee80211_hw *hw, | ||
1963 | struct ieee80211_vif *vif, | ||
1964 | struct cfg80211_gtk_rekey_data *data); | ||
1900 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1965 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1901 | struct cfg80211_scan_request *req); | 1966 | struct cfg80211_scan_request *req); |
1967 | void (*cancel_hw_scan)(struct ieee80211_hw *hw, | ||
1968 | struct ieee80211_vif *vif); | ||
1902 | int (*sched_scan_start)(struct ieee80211_hw *hw, | 1969 | int (*sched_scan_start)(struct ieee80211_hw *hw, |
1903 | struct ieee80211_vif *vif, | 1970 | struct ieee80211_vif *vif, |
1904 | struct cfg80211_sched_scan_request *req, | 1971 | struct cfg80211_sched_scan_request *req, |
@@ -1936,6 +2003,9 @@ struct ieee80211_ops { | |||
1936 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); | 2003 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); |
1937 | #ifdef CONFIG_NL80211_TESTMODE | 2004 | #ifdef CONFIG_NL80211_TESTMODE |
1938 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); | 2005 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); |
2006 | int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
2007 | struct netlink_callback *cb, | ||
2008 | void *data, int len); | ||
1939 | #endif | 2009 | #endif |
1940 | void (*flush)(struct ieee80211_hw *hw, bool drop); | 2010 | void (*flush)(struct ieee80211_hw *hw, bool drop); |
1941 | void (*channel_switch)(struct ieee80211_hw *hw, | 2011 | void (*channel_switch)(struct ieee80211_hw *hw, |
@@ -1960,6 +2030,8 @@ struct ieee80211_ops { | |||
1960 | bool (*tx_frames_pending)(struct ieee80211_hw *hw); | 2030 | bool (*tx_frames_pending)(struct ieee80211_hw *hw); |
1961 | int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2031 | int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1962 | const struct cfg80211_bitrate_mask *mask); | 2032 | const struct cfg80211_bitrate_mask *mask); |
2033 | void (*rssi_callback)(struct ieee80211_hw *hw, | ||
2034 | enum ieee80211_rssi_event rssi_event); | ||
1963 | }; | 2035 | }; |
1964 | 2036 | ||
1965 | /** | 2037 | /** |
@@ -2550,21 +2622,136 @@ struct sk_buff * | |||
2550 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 2622 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
2551 | 2623 | ||
2552 | /** | 2624 | /** |
2553 | * ieee80211_get_tkip_key - get a TKIP rc4 for skb | 2625 | * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32 |
2626 | * | ||
2627 | * This function returns the TKIP phase 1 key for the given IV32. | ||
2628 | * | ||
2629 | * @keyconf: the parameter passed with the set key | ||
2630 | * @iv32: IV32 to get the P1K for | ||
2631 | * @p1k: a buffer to which the key will be written, as 5 u16 values | ||
2632 | */ | ||
2633 | void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, | ||
2634 | u32 iv32, u16 *p1k); | ||
2635 | |||
2636 | /** | ||
2637 | * ieee80211_get_tkip_p1k - get a TKIP phase 1 key | ||
2638 | * | ||
2639 | * This function returns the TKIP phase 1 key for the IV32 taken | ||
2640 | * from the given packet. | ||
2641 | * | ||
2642 | * @keyconf: the parameter passed with the set key | ||
2643 | * @skb: the packet to take the IV32 value from that will be encrypted | ||
2644 | * with this P1K | ||
2645 | * @p1k: a buffer to which the key will be written, as 5 u16 values | ||
2646 | */ | ||
2647 | static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, | ||
2648 | struct sk_buff *skb, u16 *p1k) | ||
2649 | { | ||
2650 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
2651 | const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); | ||
2652 | u32 iv32 = get_unaligned_le32(&data[4]); | ||
2653 | |||
2654 | ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k); | ||
2655 | } | ||
2656 | |||
2657 | /** | ||
2658 | * ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX | ||
2659 | * | ||
2660 | * This function returns the TKIP phase 1 key for the given IV32 | ||
2661 | * and transmitter address. | ||
2662 | * | ||
2663 | * @keyconf: the parameter passed with the set key | ||
2664 | * @ta: TA that will be used with the key | ||
2665 | * @iv32: IV32 to get the P1K for | ||
2666 | * @p1k: a buffer to which the key will be written, as 5 u16 values | ||
2667 | */ | ||
2668 | void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, | ||
2669 | const u8 *ta, u32 iv32, u16 *p1k); | ||
2670 | |||
2671 | /** | ||
2672 | * ieee80211_get_tkip_p2k - get a TKIP phase 2 key | ||
2673 | * | ||
2674 | * This function computes the TKIP RC4 key for the IV values | ||
2675 | * in the packet. | ||
2676 | * | ||
2677 | * @keyconf: the parameter passed with the set key | ||
2678 | * @skb: the packet to take the IV32/IV16 values from that will be | ||
2679 | * encrypted with this key | ||
2680 | * @p2k: a buffer to which the key will be written, 16 bytes | ||
2681 | */ | ||
2682 | void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, | ||
2683 | struct sk_buff *skb, u8 *p2k); | ||
2684 | |||
2685 | /** | ||
2686 | * struct ieee80211_key_seq - key sequence counter | ||
2554 | * | 2687 | * |
2555 | * This function computes a TKIP rc4 key for an skb. It computes | 2688 | * @tkip: TKIP data, containing IV32 and IV16 in host byte order |
2556 | * a phase 1 key if needed (iv16 wraps around). This function is to | 2689 | * @ccmp: PN data, most significant byte first (big endian, |
2557 | * be used by drivers which can do HW encryption but need to compute | 2690 | * reverse order than in packet) |
2558 | * to phase 1/2 key in SW. | 2691 | * @aes_cmac: PN data, most significant byte first (big endian, |
2692 | * reverse order than in packet) | ||
2693 | */ | ||
2694 | struct ieee80211_key_seq { | ||
2695 | union { | ||
2696 | struct { | ||
2697 | u32 iv32; | ||
2698 | u16 iv16; | ||
2699 | } tkip; | ||
2700 | struct { | ||
2701 | u8 pn[6]; | ||
2702 | } ccmp; | ||
2703 | struct { | ||
2704 | u8 pn[6]; | ||
2705 | } aes_cmac; | ||
2706 | }; | ||
2707 | }; | ||
2708 | |||
2709 | /** | ||
2710 | * ieee80211_get_key_tx_seq - get key TX sequence counter | ||
2711 | * | ||
2712 | * @keyconf: the parameter passed with the set key | ||
2713 | * @seq: buffer to receive the sequence data | ||
2714 | * | ||
2715 | * This function allows a driver to retrieve the current TX IV/PN | ||
2716 | * for the given key. It must not be called if IV generation is | ||
2717 | * offloaded to the device. | ||
2718 | * | ||
2719 | * Note that this function may only be called when no TX processing | ||
2720 | * can be done concurrently, for example when queues are stopped | ||
2721 | * and the stop has been synchronized. | ||
2722 | */ | ||
2723 | void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, | ||
2724 | struct ieee80211_key_seq *seq); | ||
2725 | |||
2726 | /** | ||
2727 | * ieee80211_get_key_rx_seq - get key RX sequence counter | ||
2559 | * | 2728 | * |
2560 | * @keyconf: the parameter passed with the set key | 2729 | * @keyconf: the parameter passed with the set key |
2561 | * @skb: the skb for which the key is needed | 2730 | * @tid: The TID, or -1 for the management frame value (CCMP only); |
2562 | * @type: TBD | 2731 | * the value on TID 0 is also used for non-QoS frames. For |
2563 | * @key: a buffer to which the key will be written | 2732 | * CMAC, only TID 0 is valid. |
2733 | * @seq: buffer to receive the sequence data | ||
2734 | * | ||
2735 | * This function allows a driver to retrieve the current RX IV/PNs | ||
2736 | * for the given key. It must not be called if IV checking is done | ||
2737 | * by the device and not by mac80211. | ||
2738 | * | ||
2739 | * Note that this function may only be called when no RX processing | ||
2740 | * can be done concurrently. | ||
2564 | */ | 2741 | */ |
2565 | void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | 2742 | void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, |
2566 | struct sk_buff *skb, | 2743 | int tid, struct ieee80211_key_seq *seq); |
2567 | enum ieee80211_tkip_key_type type, u8 *key); | 2744 | |
2745 | /** | ||
2746 | * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying | ||
2747 | * @vif: virtual interface the rekeying was done on | ||
2748 | * @bssid: The BSSID of the AP, for checking association | ||
2749 | * @replay_ctr: the new replay counter after GTK rekeying | ||
2750 | * @gfp: allocation flags | ||
2751 | */ | ||
2752 | void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid, | ||
2753 | const u8 *replay_ctr, gfp_t gfp); | ||
2754 | |||
2568 | /** | 2755 | /** |
2569 | * ieee80211_wake_queue - wake specific queue | 2756 | * ieee80211_wake_queue - wake specific queue |
2570 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2757 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
@@ -2830,6 +3017,33 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
2830 | struct ieee80211_sta *pubsta, bool block); | 3017 | struct ieee80211_sta *pubsta, bool block); |
2831 | 3018 | ||
2832 | /** | 3019 | /** |
3020 | * ieee80211_iter_keys - iterate keys programmed into the device | ||
3021 | * @hw: pointer obtained from ieee80211_alloc_hw() | ||
3022 | * @vif: virtual interface to iterate, may be %NULL for all | ||
3023 | * @iter: iterator function that will be called for each key | ||
3024 | * @iter_data: custom data to pass to the iterator function | ||
3025 | * | ||
3026 | * This function can be used to iterate all the keys known to | ||
3027 | * mac80211, even those that weren't previously programmed into | ||
3028 | * the device. This is intended for use in WoWLAN if the device | ||
3029 | * needs reprogramming of the keys during suspend. Note that due | ||
3030 | * to locking reasons, it is also only safe to call this at few | ||
3031 | * spots since it must hold the RTNL and be able to sleep. | ||
3032 | * | ||
3033 | * The order in which the keys are iterated matches the order | ||
3034 | * in which they were originally installed and handed to the | ||
3035 | * set_key callback. | ||
3036 | */ | ||
3037 | void ieee80211_iter_keys(struct ieee80211_hw *hw, | ||
3038 | struct ieee80211_vif *vif, | ||
3039 | void (*iter)(struct ieee80211_hw *hw, | ||
3040 | struct ieee80211_vif *vif, | ||
3041 | struct ieee80211_sta *sta, | ||
3042 | struct ieee80211_key_conf *key, | ||
3043 | void *data), | ||
3044 | void *iter_data); | ||
3045 | |||
3046 | /** | ||
2833 | * ieee80211_ap_probereq_get - retrieve a Probe Request template | 3047 | * ieee80211_ap_probereq_get - retrieve a Probe Request template |
2834 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 3048 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
2835 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3049 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
@@ -2870,6 +3084,29 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif); | |||
2870 | void ieee80211_connection_loss(struct ieee80211_vif *vif); | 3084 | void ieee80211_connection_loss(struct ieee80211_vif *vif); |
2871 | 3085 | ||
2872 | /** | 3086 | /** |
3087 | * ieee80211_resume_disconnect - disconnect from AP after resume | ||
3088 | * | ||
3089 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
3090 | * | ||
3091 | * Instructs mac80211 to disconnect from the AP after resume. | ||
3092 | * Drivers can use this after WoWLAN if they know that the | ||
3093 | * connection cannot be kept up, for example because keys were | ||
3094 | * used while the device was asleep but the replay counters or | ||
3095 | * similar cannot be retrieved from the device during resume. | ||
3096 | * | ||
3097 | * Note that due to implementation issues, if the driver uses | ||
3098 | * the reconfiguration functionality during resume the interface | ||
3099 | * will still be added as associated first during resume and then | ||
3100 | * disconnect normally later. | ||
3101 | * | ||
3102 | * This function can only be called from the resume callback and | ||
3103 | * the driver must not be holding any of its own locks while it | ||
3104 | * calls this function, or at least not any locks it needs in the | ||
3105 | * key configuration paths (if it supports HW crypto). | ||
3106 | */ | ||
3107 | void ieee80211_resume_disconnect(struct ieee80211_vif *vif); | ||
3108 | |||
3109 | /** | ||
2873 | * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm | 3110 | * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm |
2874 | * | 3111 | * |
2875 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3112 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
@@ -2916,6 +3153,16 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | |||
2916 | gfp_t gfp); | 3153 | gfp_t gfp); |
2917 | 3154 | ||
2918 | /** | 3155 | /** |
3156 | * ieee80211_get_operstate - get the operstate of the vif | ||
3157 | * | ||
3158 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
3159 | * | ||
3160 | * The driver might need to know the operstate of the net_device | ||
3161 | * (specifically, whether the link is IF_OPER_UP after resume) | ||
3162 | */ | ||
3163 | unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif); | ||
3164 | |||
3165 | /** | ||
2919 | * ieee80211_chswitch_done - Complete channel switch process | 3166 | * ieee80211_chswitch_done - Complete channel switch process |
2920 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3167 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2921 | * @success: make the channel switch successful or not | 3168 | * @success: make the channel switch successful or not |
@@ -2965,6 +3212,23 @@ void ieee80211_ready_on_channel(struct ieee80211_hw *hw); | |||
2965 | */ | 3212 | */ |
2966 | void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); | 3213 | void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); |
2967 | 3214 | ||
3215 | /** | ||
3216 | * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions | ||
3217 | * | ||
3218 | * in order not to harm the system performance and user experience, the device | ||
3219 | * may request not to allow any rx ba session and tear down existing rx ba | ||
3220 | * sessions based on system constraints such as periodic BT activity that needs | ||
3221 | * to limit wlan activity (eg.sco or a2dp)." | ||
3222 | * in such cases, the intention is to limit the duration of the rx ppdu and | ||
3223 | * therefore prevent the peer device to use a-mpdu aggregation. | ||
3224 | * | ||
3225 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
3226 | * @ba_rx_bitmap: Bit map of open rx ba per tid | ||
3227 | * @addr: & to bssid mac address | ||
3228 | */ | ||
3229 | void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap, | ||
3230 | const u8 *addr); | ||
3231 | |||
2968 | /* Rate control API */ | 3232 | /* Rate control API */ |
2969 | 3233 | ||
2970 | /** | 3234 | /** |
@@ -3150,4 +3414,9 @@ ieee80211_vif_type_p2p(struct ieee80211_vif *vif) | |||
3150 | return ieee80211_iftype_p2p(vif->type, vif->p2p); | 3414 | return ieee80211_iftype_p2p(vif->type, vif->p2p); |
3151 | } | 3415 | } |
3152 | 3416 | ||
3417 | void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, | ||
3418 | int rssi_min_thold, | ||
3419 | int rssi_max_thold); | ||
3420 | |||
3421 | void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); | ||
3153 | #endif /* MAC80211_H */ | 3422 | #endif /* MAC80211_H */ |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 4014b623880c..4ba8521490ba 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -108,8 +108,8 @@ struct neighbour { | |||
108 | __u8 dead; | 108 | __u8 dead; |
109 | seqlock_t ha_lock; | 109 | seqlock_t ha_lock; |
110 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; | 110 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; |
111 | struct hh_cache *hh; | 111 | struct hh_cache hh; |
112 | int (*output)(struct sk_buff *skb); | 112 | int (*output)(struct neighbour *, struct sk_buff *); |
113 | const struct neigh_ops *ops; | 113 | const struct neigh_ops *ops; |
114 | struct rcu_head rcu; | 114 | struct rcu_head rcu; |
115 | struct net_device *dev; | 115 | struct net_device *dev; |
@@ -118,12 +118,10 @@ struct neighbour { | |||
118 | 118 | ||
119 | struct neigh_ops { | 119 | struct neigh_ops { |
120 | int family; | 120 | int family; |
121 | void (*solicit)(struct neighbour *, struct sk_buff*); | 121 | void (*solicit)(struct neighbour *, struct sk_buff *); |
122 | void (*error_report)(struct neighbour *, struct sk_buff*); | 122 | void (*error_report)(struct neighbour *, struct sk_buff *); |
123 | int (*output)(struct sk_buff*); | 123 | int (*output)(struct neighbour *, struct sk_buff *); |
124 | int (*connected_output)(struct sk_buff*); | 124 | int (*connected_output)(struct neighbour *, struct sk_buff *); |
125 | int (*hh_output)(struct sk_buff*); | ||
126 | int (*queue_xmit)(struct sk_buff*); | ||
127 | }; | 125 | }; |
128 | 126 | ||
129 | struct pneigh_entry { | 127 | struct pneigh_entry { |
@@ -142,7 +140,7 @@ struct pneigh_entry { | |||
142 | 140 | ||
143 | struct neigh_hash_table { | 141 | struct neigh_hash_table { |
144 | struct neighbour __rcu **hash_buckets; | 142 | struct neighbour __rcu **hash_buckets; |
145 | unsigned int hash_mask; | 143 | unsigned int hash_shift; |
146 | __u32 hash_rnd; | 144 | __u32 hash_rnd; |
147 | struct rcu_head rcu; | 145 | struct rcu_head rcu; |
148 | }; | 146 | }; |
@@ -205,9 +203,10 @@ extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, | |||
205 | u32 flags); | 203 | u32 flags); |
206 | extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); | 204 | extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); |
207 | extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); | 205 | extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); |
208 | extern int neigh_resolve_output(struct sk_buff *skb); | 206 | extern int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb); |
209 | extern int neigh_connected_output(struct sk_buff *skb); | 207 | extern int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb); |
210 | extern int neigh_compat_output(struct sk_buff *skb); | 208 | extern int neigh_compat_output(struct neighbour *neigh, struct sk_buff *skb); |
209 | extern int neigh_direct_output(struct neighbour *neigh, struct sk_buff *skb); | ||
211 | extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, | 210 | extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, |
212 | u8 *lladdr, void *saddr, | 211 | u8 *lladdr, void *saddr, |
213 | struct net_device *dev); | 212 | struct net_device *dev); |
@@ -341,7 +340,16 @@ static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) | |||
341 | } while (read_seqretry(&hh->hh_lock, seq)); | 340 | } while (read_seqretry(&hh->hh_lock, seq)); |
342 | 341 | ||
343 | skb_push(skb, hh_len); | 342 | skb_push(skb, hh_len); |
344 | return hh->hh_output(skb); | 343 | return dev_queue_xmit(skb); |
344 | } | ||
345 | |||
346 | static inline int neigh_output(struct neighbour *n, struct sk_buff *skb) | ||
347 | { | ||
348 | struct hh_cache *hh = &n->hh; | ||
349 | if ((n->nud_state & NUD_CONNECTED) && hh->hh_len) | ||
350 | return neigh_hh_output(hh, skb); | ||
351 | else | ||
352 | return n->output(n, skb); | ||
345 | } | 353 | } |
346 | 354 | ||
347 | static inline struct neighbour * | 355 | static inline struct neighbour * |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index aef430d779bd..1ab1aec209ac 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -65,6 +65,7 @@ struct net { | |||
65 | struct list_head dev_base_head; | 65 | struct list_head dev_base_head; |
66 | struct hlist_head *dev_name_head; | 66 | struct hlist_head *dev_name_head; |
67 | struct hlist_head *dev_index_head; | 67 | struct hlist_head *dev_index_head; |
68 | unsigned int dev_base_seq; /* protected by rtnl_mutex */ | ||
68 | 69 | ||
69 | /* core fib_rules */ | 70 | /* core fib_rules */ |
70 | struct list_head rules_ops; | 71 | struct list_head rules_ops; |
diff --git a/include/net/netlink.h b/include/net/netlink.h index 02740a94f108..98c185441bee 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -638,6 +638,30 @@ static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid) | |||
638 | nlmsg_ok(pos, rem); \ | 638 | nlmsg_ok(pos, rem); \ |
639 | pos = nlmsg_next(pos, &(rem))) | 639 | pos = nlmsg_next(pos, &(rem))) |
640 | 640 | ||
641 | /** | ||
642 | * nl_dump_check_consistent - check if sequence is consistent and advertise if not | ||
643 | * @cb: netlink callback structure that stores the sequence number | ||
644 | * @nlh: netlink message header to write the flag to | ||
645 | * | ||
646 | * This function checks if the sequence (generation) number changed during dump | ||
647 | * and if it did, advertises it in the netlink message header. | ||
648 | * | ||
649 | * The correct way to use it is to set cb->seq to the generation counter when | ||
650 | * all locks for dumping have been acquired, and then call this function for | ||
651 | * each message that is generated. | ||
652 | * | ||
653 | * Note that due to initialisation concerns, 0 is an invalid sequence number | ||
654 | * and must not be used by code that uses this functionality. | ||
655 | */ | ||
656 | static inline void | ||
657 | nl_dump_check_consistent(struct netlink_callback *cb, | ||
658 | struct nlmsghdr *nlh) | ||
659 | { | ||
660 | if (cb->prev_seq && cb->seq != cb->prev_seq) | ||
661 | nlh->nlmsg_flags |= NLM_F_DUMP_INTR; | ||
662 | cb->prev_seq = cb->seq; | ||
663 | } | ||
664 | |||
641 | /************************************************************************** | 665 | /************************************************************************** |
642 | * Netlink Attributes | 666 | * Netlink Attributes |
643 | **************************************************************************/ | 667 | **************************************************************************/ |
diff --git a/include/net/nfc.h b/include/net/nfc.h new file mode 100644 index 000000000000..cc0130312f70 --- /dev/null +++ b/include/net/nfc.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia | ||
3 | * | ||
4 | * Authors: | ||
5 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> | ||
6 | * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the | ||
20 | * Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __NET_NFC_H | ||
25 | #define __NET_NFC_H | ||
26 | |||
27 | #include <linux/device.h> | ||
28 | #include <linux/skbuff.h> | ||
29 | |||
30 | #define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg) | ||
31 | #define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg) | ||
32 | #define nfc_dev_dbg(dev, fmt, arg...) dev_dbg((dev), fmt "\n", ## arg) | ||
33 | |||
34 | struct nfc_dev; | ||
35 | |||
36 | /** | ||
37 | * data_exchange_cb_t - Definition of nfc_data_exchange callback | ||
38 | * | ||
39 | * @context: nfc_data_exchange cb_context parameter | ||
40 | * @skb: response data | ||
41 | * @err: If an error has occurred during data exchange, it is the | ||
42 | * error number. Zero means no error. | ||
43 | * | ||
44 | * When a rx or tx package is lost or corrupted or the target gets out | ||
45 | * of the operating field, err is -EIO. | ||
46 | */ | ||
47 | typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, | ||
48 | int err); | ||
49 | |||
50 | struct nfc_ops { | ||
51 | int (*start_poll)(struct nfc_dev *dev, u32 protocols); | ||
52 | void (*stop_poll)(struct nfc_dev *dev); | ||
53 | int (*activate_target)(struct nfc_dev *dev, u32 target_idx, | ||
54 | u32 protocol); | ||
55 | void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); | ||
56 | int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, | ||
57 | struct sk_buff *skb, data_exchange_cb_t cb, | ||
58 | void *cb_context); | ||
59 | }; | ||
60 | |||
61 | struct nfc_target { | ||
62 | u32 idx; | ||
63 | u32 supported_protocols; | ||
64 | u16 sens_res; | ||
65 | u8 sel_res; | ||
66 | }; | ||
67 | |||
68 | struct nfc_genl_data { | ||
69 | u32 poll_req_pid; | ||
70 | struct mutex genl_data_mutex; | ||
71 | }; | ||
72 | |||
73 | struct nfc_dev { | ||
74 | unsigned idx; | ||
75 | unsigned target_idx; | ||
76 | struct nfc_target *targets; | ||
77 | int n_targets; | ||
78 | int targets_generation; | ||
79 | spinlock_t targets_lock; | ||
80 | struct device dev; | ||
81 | bool polling; | ||
82 | struct nfc_genl_data genl_data; | ||
83 | u32 supported_protocols; | ||
84 | |||
85 | struct nfc_ops *ops; | ||
86 | }; | ||
87 | #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) | ||
88 | |||
89 | extern struct class nfc_class; | ||
90 | |||
91 | struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, | ||
92 | u32 supported_protocols); | ||
93 | |||
94 | /** | ||
95 | * nfc_free_device - free nfc device | ||
96 | * | ||
97 | * @dev: The nfc device to free | ||
98 | */ | ||
99 | static inline void nfc_free_device(struct nfc_dev *dev) | ||
100 | { | ||
101 | put_device(&dev->dev); | ||
102 | } | ||
103 | |||
104 | int nfc_register_device(struct nfc_dev *dev); | ||
105 | |||
106 | void nfc_unregister_device(struct nfc_dev *dev); | ||
107 | |||
108 | /** | ||
109 | * nfc_set_parent_dev - set the parent device | ||
110 | * | ||
111 | * @nfc_dev: The nfc device whose parent is being set | ||
112 | * @dev: The parent device | ||
113 | */ | ||
114 | static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, | ||
115 | struct device *dev) | ||
116 | { | ||
117 | nfc_dev->dev.parent = dev; | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * nfc_set_drvdata - set driver specifc data | ||
122 | * | ||
123 | * @dev: The nfc device | ||
124 | * @data: Pointer to driver specifc data | ||
125 | */ | ||
126 | static inline void nfc_set_drvdata(struct nfc_dev *dev, void *data) | ||
127 | { | ||
128 | dev_set_drvdata(&dev->dev, data); | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * nfc_get_drvdata - get driver specifc data | ||
133 | * | ||
134 | * @dev: The nfc device | ||
135 | */ | ||
136 | static inline void *nfc_get_drvdata(struct nfc_dev *dev) | ||
137 | { | ||
138 | return dev_get_drvdata(&dev->dev); | ||
139 | } | ||
140 | |||
141 | /** | ||
142 | * nfc_device_name - get the nfc device name | ||
143 | * | ||
144 | * @dev: The nfc device whose name to return | ||
145 | */ | ||
146 | static inline const char *nfc_device_name(struct nfc_dev *dev) | ||
147 | { | ||
148 | return dev_name(&dev->dev); | ||
149 | } | ||
150 | |||
151 | struct sk_buff *nfc_alloc_skb(unsigned int size, gfp_t gfp); | ||
152 | |||
153 | int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, | ||
154 | int ntargets); | ||
155 | |||
156 | #endif /* __NET_NFC_H */ | ||
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 65afc4966204..fffdc603f4c8 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -99,9 +99,9 @@ static inline void qdisc_run(struct Qdisc *q) | |||
99 | __qdisc_run(q); | 99 | __qdisc_run(q); |
100 | } | 100 | } |
101 | 101 | ||
102 | extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, | 102 | extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, |
103 | struct tcf_result *res); | 103 | struct tcf_result *res); |
104 | extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, | 104 | extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
105 | struct tcf_result *res); | 105 | struct tcf_result *res); |
106 | 106 | ||
107 | /* Calculate maximal size of packet seen by hard_start_xmit | 107 | /* Calculate maximal size of packet seen by hard_start_xmit |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 4093ca78cf60..678f1ffaf843 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
@@ -6,11 +6,14 @@ | |||
6 | 6 | ||
7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); | 7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); |
8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); | 8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); |
9 | typedef u16 (*rtnl_calcit_func)(struct sk_buff *); | ||
9 | 10 | ||
10 | extern int __rtnl_register(int protocol, int msgtype, | 11 | extern int __rtnl_register(int protocol, int msgtype, |
11 | rtnl_doit_func, rtnl_dumpit_func); | 12 | rtnl_doit_func, rtnl_dumpit_func, |
13 | rtnl_calcit_func); | ||
12 | extern void rtnl_register(int protocol, int msgtype, | 14 | extern void rtnl_register(int protocol, int msgtype, |
13 | rtnl_doit_func, rtnl_dumpit_func); | 15 | rtnl_doit_func, rtnl_dumpit_func, |
16 | rtnl_calcit_func); | ||
14 | extern int rtnl_unregister(int protocol, int msgtype); | 17 | extern int rtnl_unregister(int protocol, int msgtype); |
15 | extern void rtnl_unregister_all(int protocol); | 18 | extern void rtnl_unregister_all(int protocol); |
16 | 19 | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index b931f021d7ab..4fc88f3ccd5f 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -181,8 +181,9 @@ struct tcf_proto_ops { | |||
181 | struct tcf_proto_ops *next; | 181 | struct tcf_proto_ops *next; |
182 | char kind[IFNAMSIZ]; | 182 | char kind[IFNAMSIZ]; |
183 | 183 | ||
184 | int (*classify)(struct sk_buff*, struct tcf_proto*, | 184 | int (*classify)(struct sk_buff *, |
185 | struct tcf_result *); | 185 | const struct tcf_proto *, |
186 | struct tcf_result *); | ||
186 | int (*init)(struct tcf_proto*); | 187 | int (*init)(struct tcf_proto*); |
187 | void (*destroy)(struct tcf_proto*); | 188 | void (*destroy)(struct tcf_proto*); |
188 | 189 | ||
@@ -205,8 +206,9 @@ struct tcf_proto { | |||
205 | /* Fast access part */ | 206 | /* Fast access part */ |
206 | struct tcf_proto *next; | 207 | struct tcf_proto *next; |
207 | void *root; | 208 | void *root; |
208 | int (*classify)(struct sk_buff*, struct tcf_proto*, | 209 | int (*classify)(struct sk_buff *, |
209 | struct tcf_result *); | 210 | const struct tcf_proto *, |
211 | struct tcf_result *); | ||
210 | __be16 protocol; | 212 | __be16 protocol; |
211 | 213 | ||
212 | /* All the rest */ | 214 | /* All the rest */ |
@@ -214,7 +216,7 @@ struct tcf_proto { | |||
214 | u32 classid; | 216 | u32 classid; |
215 | struct Qdisc *q; | 217 | struct Qdisc *q; |
216 | void *data; | 218 | void *data; |
217 | struct tcf_proto_ops *ops; | 219 | const struct tcf_proto_ops *ops; |
218 | }; | 220 | }; |
219 | 221 | ||
220 | struct qdisc_skb_cb { | 222 | struct qdisc_skb_cb { |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index b2c2366676a7..6a72a58cde59 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -120,6 +120,7 @@ extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, | |||
120 | int flags); | 120 | int flags); |
121 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); | 121 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); |
122 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); | 122 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); |
123 | extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int); | ||
123 | 124 | ||
124 | /* | 125 | /* |
125 | * sctp/socket.c | 126 | * sctp/socket.c |
@@ -134,6 +135,7 @@ void sctp_sock_rfree(struct sk_buff *skb); | |||
134 | void sctp_copy_sock(struct sock *newsk, struct sock *sk, | 135 | void sctp_copy_sock(struct sock *newsk, struct sock *sk, |
135 | struct sctp_association *asoc); | 136 | struct sctp_association *asoc); |
136 | extern struct percpu_counter sctp_sockets_allocated; | 137 | extern struct percpu_counter sctp_sockets_allocated; |
138 | extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); | ||
137 | 139 | ||
138 | /* | 140 | /* |
139 | * sctp/primitive.c | 141 | * sctp/primitive.c |
@@ -285,20 +287,21 @@ do { \ | |||
285 | pr_cont(fmt, ##args); \ | 287 | pr_cont(fmt, ##args); \ |
286 | } while (0) | 288 | } while (0) |
287 | #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \ | 289 | #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \ |
288 | args_lead, saddr, args_trail...) \ | 290 | args_lead, addr, args_trail...) \ |
289 | do { \ | 291 | do { \ |
292 | const union sctp_addr *_addr = (addr); \ | ||
290 | if (sctp_debug_flag) { \ | 293 | if (sctp_debug_flag) { \ |
291 | if (saddr->sa.sa_family == AF_INET6) { \ | 294 | if (_addr->sa.sa_family == AF_INET6) { \ |
292 | printk(KERN_DEBUG \ | 295 | printk(KERN_DEBUG \ |
293 | pr_fmt(fmt_lead "%pI6" fmt_trail), \ | 296 | pr_fmt(fmt_lead "%pI6" fmt_trail), \ |
294 | args_lead, \ | 297 | args_lead, \ |
295 | &saddr->v6.sin6_addr, \ | 298 | &_addr->v6.sin6_addr, \ |
296 | args_trail); \ | 299 | args_trail); \ |
297 | } else { \ | 300 | } else { \ |
298 | printk(KERN_DEBUG \ | 301 | printk(KERN_DEBUG \ |
299 | pr_fmt(fmt_lead "%pI4" fmt_trail), \ | 302 | pr_fmt(fmt_lead "%pI4" fmt_trail), \ |
300 | args_lead, \ | 303 | args_lead, \ |
301 | &saddr->v4.sin_addr.s_addr, \ | 304 | &_addr->v4.sin_addr.s_addr, \ |
302 | args_trail); \ | 305 | args_trail); \ |
303 | } \ | 306 | } \ |
304 | } \ | 307 | } \ |
@@ -598,7 +601,7 @@ static inline int ipver2af(__u8 ipver) | |||
598 | return AF_INET6; | 601 | return AF_INET6; |
599 | default: | 602 | default: |
600 | return 0; | 603 | return 0; |
601 | }; | 604 | } |
602 | } | 605 | } |
603 | 606 | ||
604 | /* Convert from an address parameter type to an address family. */ | 607 | /* Convert from an address parameter type to an address family. */ |
@@ -611,7 +614,7 @@ static inline int param_type2af(__be16 type) | |||
611 | return AF_INET6; | 614 | return AF_INET6; |
612 | default: | 615 | default: |
613 | return 0; | 616 | return 0; |
614 | }; | 617 | } |
615 | } | 618 | } |
616 | 619 | ||
617 | /* Perform some sanity checks. */ | 620 | /* Perform some sanity checks. */ |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 7df327a6d564..31d7ea2e1d2a 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -205,6 +205,11 @@ extern struct sctp_globals { | |||
205 | * It is a list of sctp_sockaddr_entry. | 205 | * It is a list of sctp_sockaddr_entry. |
206 | */ | 206 | */ |
207 | struct list_head local_addr_list; | 207 | struct list_head local_addr_list; |
208 | int default_auto_asconf; | ||
209 | struct list_head addr_waitq; | ||
210 | struct timer_list addr_wq_timer; | ||
211 | struct list_head auto_asconf_splist; | ||
212 | spinlock_t addr_wq_lock; | ||
208 | 213 | ||
209 | /* Lock that protects the local_addr_list writers */ | 214 | /* Lock that protects the local_addr_list writers */ |
210 | spinlock_t addr_list_lock; | 215 | spinlock_t addr_list_lock; |
@@ -264,6 +269,11 @@ extern struct sctp_globals { | |||
264 | #define sctp_port_hashtable (sctp_globals.port_hashtable) | 269 | #define sctp_port_hashtable (sctp_globals.port_hashtable) |
265 | #define sctp_local_addr_list (sctp_globals.local_addr_list) | 270 | #define sctp_local_addr_list (sctp_globals.local_addr_list) |
266 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | 271 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) |
272 | #define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist) | ||
273 | #define sctp_addr_waitq (sctp_globals.addr_waitq) | ||
274 | #define sctp_addr_wq_timer (sctp_globals.addr_wq_timer) | ||
275 | #define sctp_addr_wq_lock (sctp_globals.addr_wq_lock) | ||
276 | #define sctp_default_auto_asconf (sctp_globals.default_auto_asconf) | ||
267 | #define sctp_scope_policy (sctp_globals.ipv4_scope_policy) | 277 | #define sctp_scope_policy (sctp_globals.ipv4_scope_policy) |
268 | #define sctp_addip_enable (sctp_globals.addip_enable) | 278 | #define sctp_addip_enable (sctp_globals.addip_enable) |
269 | #define sctp_addip_noauth (sctp_globals.addip_noauth_enable) | 279 | #define sctp_addip_noauth (sctp_globals.addip_noauth_enable) |
@@ -341,6 +351,8 @@ struct sctp_sock { | |||
341 | atomic_t pd_mode; | 351 | atomic_t pd_mode; |
342 | /* Receive to here while partial delivery is in effect. */ | 352 | /* Receive to here while partial delivery is in effect. */ |
343 | struct sk_buff_head pd_lobby; | 353 | struct sk_buff_head pd_lobby; |
354 | struct list_head auto_asconf_list; | ||
355 | int do_auto_asconf; | ||
344 | }; | 356 | }; |
345 | 357 | ||
346 | static inline struct sctp_sock *sctp_sk(const struct sock *sk) | 358 | static inline struct sctp_sock *sctp_sk(const struct sock *sk) |
@@ -792,6 +804,8 @@ struct sctp_sockaddr_entry { | |||
792 | __u8 valid; | 804 | __u8 valid; |
793 | }; | 805 | }; |
794 | 806 | ||
807 | #define SCTP_ADDRESS_TICK_DELAY 500 | ||
808 | |||
795 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); | 809 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); |
796 | 810 | ||
797 | /* This structure holds lists of chunks as we are assembling for | 811 | /* This structure holds lists of chunks as we are assembling for |
@@ -1236,6 +1250,7 @@ sctp_scope_t sctp_scope(const union sctp_addr *); | |||
1236 | int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); | 1250 | int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); |
1237 | int sctp_is_any(struct sock *sk, const union sctp_addr *addr); | 1251 | int sctp_is_any(struct sock *sk, const union sctp_addr *addr); |
1238 | int sctp_addr_is_valid(const union sctp_addr *addr); | 1252 | int sctp_addr_is_valid(const union sctp_addr *addr); |
1253 | int sctp_is_ep_boundall(struct sock *sk); | ||
1239 | 1254 | ||
1240 | 1255 | ||
1241 | /* What type of endpoint? */ | 1256 | /* What type of endpoint? */ |
@@ -1898,6 +1913,8 @@ struct sctp_association { | |||
1898 | * after reaching 4294967295. | 1913 | * after reaching 4294967295. |
1899 | */ | 1914 | */ |
1900 | __u32 addip_serial; | 1915 | __u32 addip_serial; |
1916 | union sctp_addr *asconf_addr_del_pending; | ||
1917 | int src_out_of_asoc_ok; | ||
1901 | 1918 | ||
1902 | /* SCTP AUTH: list of the endpoint shared keys. These | 1919 | /* SCTP AUTH: list of the endpoint shared keys. These |
1903 | * keys are provided out of band by the user applicaton | 1920 | * keys are provided out of band by the user applicaton |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 32fd51274037..0842ef00b2fe 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -92,6 +92,7 @@ typedef __s32 sctp_assoc_t; | |||
92 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ | 92 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ |
93 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ | 93 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ |
94 | #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ | 94 | #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ |
95 | #define SCTP_AUTO_ASCONF 30 | ||
95 | 96 | ||
96 | /* Internal Socket Options. Some of the sctp library functions are | 97 | /* Internal Socket Options. Some of the sctp library functions are |
97 | * implemented using these socket options. | 98 | * implemented using these socket options. |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 479083a78b0c..8f0f9ac0307f 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -116,57 +116,51 @@ struct linux_xfrm_mib { | |||
116 | unsigned long mibs[LINUX_MIB_XFRMMAX]; | 116 | unsigned long mibs[LINUX_MIB_XFRMMAX]; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | /* | 119 | #define SNMP_ARRAY_SZ 1 |
120 | * FIXME: On x86 and some other CPUs the split into user and softirq parts | 120 | |
121 | * is not needed because addl $1,memory is atomic against interrupts (but | ||
122 | * atomic_inc would be overkill because of the lock cycles). Wants new | ||
123 | * nonlocked_atomic_inc() primitives -AK | ||
124 | */ | ||
125 | #define DEFINE_SNMP_STAT(type, name) \ | 121 | #define DEFINE_SNMP_STAT(type, name) \ |
126 | __typeof__(type) __percpu *name[2] | 122 | __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] |
127 | #define DEFINE_SNMP_STAT_ATOMIC(type, name) \ | 123 | #define DEFINE_SNMP_STAT_ATOMIC(type, name) \ |
128 | __typeof__(type) *name | 124 | __typeof__(type) *name |
129 | #define DECLARE_SNMP_STAT(type, name) \ | 125 | #define DECLARE_SNMP_STAT(type, name) \ |
130 | extern __typeof__(type) __percpu *name[2] | 126 | extern __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] |
131 | |||
132 | #define SNMP_STAT_BHPTR(name) (name[0]) | ||
133 | #define SNMP_STAT_USRPTR(name) (name[1]) | ||
134 | 127 | ||
135 | #define SNMP_INC_STATS_BH(mib, field) \ | 128 | #define SNMP_INC_STATS_BH(mib, field) \ |
136 | __this_cpu_inc(mib[0]->mibs[field]) | 129 | __this_cpu_inc(mib[0]->mibs[field]) |
130 | |||
137 | #define SNMP_INC_STATS_USER(mib, field) \ | 131 | #define SNMP_INC_STATS_USER(mib, field) \ |
138 | this_cpu_inc(mib[1]->mibs[field]) | 132 | irqsafe_cpu_inc(mib[0]->mibs[field]) |
133 | |||
139 | #define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ | 134 | #define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ |
140 | atomic_long_inc(&mib->mibs[field]) | 135 | atomic_long_inc(&mib->mibs[field]) |
136 | |||
141 | #define SNMP_INC_STATS(mib, field) \ | 137 | #define SNMP_INC_STATS(mib, field) \ |
142 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) | 138 | irqsafe_cpu_inc(mib[0]->mibs[field]) |
139 | |||
143 | #define SNMP_DEC_STATS(mib, field) \ | 140 | #define SNMP_DEC_STATS(mib, field) \ |
144 | this_cpu_dec(mib[!in_softirq()]->mibs[field]) | 141 | irqsafe_cpu_dec(mib[0]->mibs[field]) |
142 | |||
145 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 143 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
146 | __this_cpu_add(mib[0]->mibs[field], addend) | 144 | __this_cpu_add(mib[0]->mibs[field], addend) |
145 | |||
147 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 146 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
148 | this_cpu_add(mib[1]->mibs[field], addend) | 147 | irqsafe_cpu_add(mib[0]->mibs[field], addend) |
148 | |||
149 | #define SNMP_ADD_STATS(mib, field, addend) \ | 149 | #define SNMP_ADD_STATS(mib, field, addend) \ |
150 | this_cpu_add(mib[!in_softirq()]->mibs[field], addend) | 150 | irqsafe_cpu_add(mib[0]->mibs[field], addend) |
151 | /* | 151 | /* |
152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" | 152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" |
153 | * to make @ptr a non-percpu pointer. | 153 | * to make @ptr a non-percpu pointer. |
154 | */ | 154 | */ |
155 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | 155 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ |
156 | do { \ | 156 | do { \ |
157 | __typeof__(*mib[0]) *ptr; \ | 157 | irqsafe_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ |
158 | preempt_disable(); \ | 158 | irqsafe_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ |
159 | ptr = this_cpu_ptr((mib)[!in_softirq()]); \ | ||
160 | ptr->mibs[basefield##PKTS]++; \ | ||
161 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
162 | preempt_enable(); \ | ||
163 | } while (0) | 159 | } while (0) |
164 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | 160 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ |
165 | do { \ | 161 | do { \ |
166 | __typeof__(*mib[0]) *ptr = \ | 162 | __this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ |
167 | __this_cpu_ptr((mib)[0]); \ | 163 | __this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ |
168 | ptr->mibs[basefield##PKTS]++; \ | ||
169 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
170 | } while (0) | 164 | } while (0) |
171 | 165 | ||
172 | 166 | ||
@@ -179,40 +173,20 @@ struct linux_xfrm_mib { | |||
179 | ptr->mibs[field] += addend; \ | 173 | ptr->mibs[field] += addend; \ |
180 | u64_stats_update_end(&ptr->syncp); \ | 174 | u64_stats_update_end(&ptr->syncp); \ |
181 | } while (0) | 175 | } while (0) |
176 | |||
182 | #define SNMP_ADD_STATS64_USER(mib, field, addend) \ | 177 | #define SNMP_ADD_STATS64_USER(mib, field, addend) \ |
183 | do { \ | 178 | do { \ |
184 | __typeof__(*mib[0]) *ptr; \ | 179 | local_bh_disable(); \ |
185 | preempt_disable(); \ | 180 | SNMP_ADD_STATS64_BH(mib, field, addend); \ |
186 | ptr = __this_cpu_ptr((mib)[1]); \ | 181 | local_bh_enable(); \ |
187 | u64_stats_update_begin(&ptr->syncp); \ | ||
188 | ptr->mibs[field] += addend; \ | ||
189 | u64_stats_update_end(&ptr->syncp); \ | ||
190 | preempt_enable(); \ | ||
191 | } while (0) | 182 | } while (0) |
183 | |||
192 | #define SNMP_ADD_STATS64(mib, field, addend) \ | 184 | #define SNMP_ADD_STATS64(mib, field, addend) \ |
193 | do { \ | 185 | SNMP_ADD_STATS64_USER(mib, field, addend) |
194 | __typeof__(*mib[0]) *ptr; \ | 186 | |
195 | preempt_disable(); \ | ||
196 | ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
197 | u64_stats_update_begin(&ptr->syncp); \ | ||
198 | ptr->mibs[field] += addend; \ | ||
199 | u64_stats_update_end(&ptr->syncp); \ | ||
200 | preempt_enable(); \ | ||
201 | } while (0) | ||
202 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_ADD_STATS64_BH(mib, field, 1) | 187 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_ADD_STATS64_BH(mib, field, 1) |
203 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_ADD_STATS64_USER(mib, field, 1) | 188 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_ADD_STATS64_USER(mib, field, 1) |
204 | #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) | 189 | #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) |
205 | #define SNMP_UPD_PO_STATS64(mib, basefield, addend) \ | ||
206 | do { \ | ||
207 | __typeof__(*mib[0]) *ptr; \ | ||
208 | preempt_disable(); \ | ||
209 | ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
210 | u64_stats_update_begin(&ptr->syncp); \ | ||
211 | ptr->mibs[basefield##PKTS]++; \ | ||
212 | ptr->mibs[basefield##OCTETS] += addend; \ | ||
213 | u64_stats_update_end(&ptr->syncp); \ | ||
214 | preempt_enable(); \ | ||
215 | } while (0) | ||
216 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ | 190 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ |
217 | do { \ | 191 | do { \ |
218 | __typeof__(*mib[0]) *ptr; \ | 192 | __typeof__(*mib[0]) *ptr; \ |
@@ -222,6 +196,12 @@ struct linux_xfrm_mib { | |||
222 | ptr->mibs[basefield##OCTETS] += addend; \ | 196 | ptr->mibs[basefield##OCTETS] += addend; \ |
223 | u64_stats_update_end(&ptr->syncp); \ | 197 | u64_stats_update_end(&ptr->syncp); \ |
224 | } while (0) | 198 | } while (0) |
199 | #define SNMP_UPD_PO_STATS64(mib, basefield, addend) \ | ||
200 | do { \ | ||
201 | local_bh_disable(); \ | ||
202 | SNMP_UPD_PO_STATS64_BH(mib, basefield, addend); \ | ||
203 | local_bh_enable(); \ | ||
204 | } while (0) | ||
225 | #else | 205 | #else |
226 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_INC_STATS_BH(mib, field) | 206 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_INC_STATS_BH(mib, field) |
227 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_INC_STATS_USER(mib, field) | 207 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_INC_STATS_USER(mib, field) |
diff --git a/include/net/sock.h b/include/net/sock.h index c0b938cb4b1a..8e4062f165b8 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef _SOCK_H | 40 | #ifndef _SOCK_H |
41 | #define _SOCK_H | 41 | #define _SOCK_H |
42 | 42 | ||
43 | #include <linux/hardirq.h> | ||
43 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
44 | #include <linux/list.h> | 45 | #include <linux/list.h> |
45 | #include <linux/list_nulls.h> | 46 | #include <linux/list_nulls.h> |
@@ -562,6 +563,7 @@ enum sock_flags { | |||
562 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ | 563 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ |
563 | SOCK_FASYNC, /* fasync() active */ | 564 | SOCK_FASYNC, /* fasync() active */ |
564 | SOCK_RXQ_OVFL, | 565 | SOCK_RXQ_OVFL, |
566 | SOCK_ZEROCOPY, /* buffers from userspace */ | ||
565 | }; | 567 | }; |
566 | 568 | ||
567 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 569 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
@@ -1301,8 +1303,7 @@ extern unsigned long sock_i_ino(struct sock *sk); | |||
1301 | static inline struct dst_entry * | 1303 | static inline struct dst_entry * |
1302 | __sk_dst_get(struct sock *sk) | 1304 | __sk_dst_get(struct sock *sk) |
1303 | { | 1305 | { |
1304 | return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() || | 1306 | return rcu_dereference_check(sk->sk_dst_cache, sock_owned_by_user(sk) || |
1305 | sock_owned_by_user(sk) || | ||
1306 | lockdep_is_held(&sk->sk_lock.slock)); | 1307 | lockdep_is_held(&sk->sk_lock.slock)); |
1307 | } | 1308 | } |
1308 | 1309 | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index cda30ea354a2..149a415d1e0a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -122,7 +122,13 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
122 | #endif | 122 | #endif |
123 | #define TCP_RTO_MAX ((unsigned)(120*HZ)) | 123 | #define TCP_RTO_MAX ((unsigned)(120*HZ)) |
124 | #define TCP_RTO_MIN ((unsigned)(HZ/5)) | 124 | #define TCP_RTO_MIN ((unsigned)(HZ/5)) |
125 | #define TCP_TIMEOUT_INIT ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value */ | 125 | #define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC2988bis initial RTO value */ |
126 | #define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now | ||
127 | * used as a fallback RTO for the | ||
128 | * initial data transmission if no | ||
129 | * valid RTT sample has been acquired, | ||
130 | * most likely due to retrans in 3WHS. | ||
131 | */ | ||
126 | 132 | ||
127 | #define TCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ/2U)) /* Maximal interval between probes | 133 | #define TCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ/2U)) /* Maximal interval between probes |
128 | * for local resources. | 134 | * for local resources. |
@@ -295,7 +301,7 @@ static inline void tcp_synq_overflow(struct sock *sk) | |||
295 | static inline int tcp_synq_no_recent_overflow(const struct sock *sk) | 301 | static inline int tcp_synq_no_recent_overflow(const struct sock *sk) |
296 | { | 302 | { |
297 | unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; | 303 | unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; |
298 | return time_after(jiffies, last_overflow + TCP_TIMEOUT_INIT); | 304 | return time_after(jiffies, last_overflow + TCP_TIMEOUT_FALLBACK); |
299 | } | 305 | } |
300 | 306 | ||
301 | extern struct proto tcp_prot; | 307 | extern struct proto tcp_prot; |
@@ -508,6 +514,7 @@ extern void tcp_initialize_rcv_mss(struct sock *sk); | |||
508 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); | 514 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); |
509 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); | 515 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); |
510 | extern void tcp_mtup_init(struct sock *sk); | 516 | extern void tcp_mtup_init(struct sock *sk); |
517 | extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); | ||
511 | 518 | ||
512 | static inline void tcp_bound_rto(const struct sock *sk) | 519 | static inline void tcp_bound_rto(const struct sock *sk) |
513 | { | 520 | { |
diff --git a/include/net/wimax.h b/include/net/wimax.h index 7328d5019d88..322ff4fbdb4a 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
@@ -423,7 +423,6 @@ struct wimax_dev { | |||
423 | int (*op_reset)(struct wimax_dev *wimax_dev); | 423 | int (*op_reset)(struct wimax_dev *wimax_dev); |
424 | 424 | ||
425 | struct rfkill *rfkill; | 425 | struct rfkill *rfkill; |
426 | struct input_dev *rfkill_input; | ||
427 | unsigned rf_hw; | 426 | unsigned rf_hw; |
428 | unsigned rf_sw; | 427 | unsigned rf_sw; |
429 | char name[32]; | 428 | char name[32]; |