aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/9p.h222
-rw-r--r--include/net/9p/client.h12
-rw-r--r--include/net/9p/transport.h2
-rw-r--r--include/net/act_api.h6
-rw-r--r--include/net/activity_stats.h25
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/arp.h31
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/bluetooth/bluetooth.h27
-rw-r--r--include/net/bluetooth/hci.h87
-rw-r--r--include/net/bluetooth/hci_core.h102
-rw-r--r--include/net/bluetooth/l2cap.h140
-rw-r--r--include/net/bluetooth/mgmt.h12
-rw-r--r--include/net/bluetooth/rfcomm.h9
-rw-r--r--include/net/bluetooth/sco.h4
-rw-r--r--include/net/bluetooth/smp.h47
-rw-r--r--include/net/caif/caif_hsi.h145
-rw-r--r--include/net/cfg80211.h89
-rw-r--r--include/net/cipso_ipv4.h4
-rw-r--r--include/net/dcbnl.h11
-rw-r--r--include/net/dst.h51
-rw-r--r--include/net/dst_ops.h1
-rw-r--r--include/net/flow.h28
-rw-r--r--include/net/genetlink.h32
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet_hashtables.h2
-rw-r--r--include/net/inet_sock.h2
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/inetpeer.h42
-rw-r--r--include/net/ip.h10
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/net/ip_vs.h37
-rw-r--r--include/net/ipv6.h12
-rw-r--r--include/net/lib80211.h2
-rw-r--r--include/net/llc.h2
-rw-r--r--include/net/mac80211.h321
-rw-r--r--include/net/neighbour.h36
-rw-r--r--include/net/net_namespace.h3
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netlabel.h4
-rw-r--r--include/net/netlink.h24
-rw-r--r--include/net/netns/conntrack.h2
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/nfc.h156
-rw-r--r--include/net/pkt_sched.h4
-rw-r--r--include/net/red.h15
-rw-r--r--include/net/request_sock.h3
-rw-r--r--include/net/rtnetlink.h7
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/sctp.h15
-rw-r--r--include/net/sctp/structs.h23
-rw-r--r--include/net/sctp/user.h1
-rw-r--r--include/net/secure_seq.h20
-rw-r--r--include/net/snmp.h86
-rw-r--r--include/net/sock.h5
-rw-r--r--include/net/tcp.h35
-rw-r--r--include/net/transp_v6.h1
-rw-r--r--include/net/udplite.h63
-rw-r--r--include/net/wimax.h1
60 files changed, 1533 insertions, 512 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 008711e8e78..a6326ef8ade 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...) \
82do { \ 88do { \
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,
@@ -278,6 +288,35 @@ enum p9_perm_t {
278 P9_DMSETVTX = 0x00010000, 288 P9_DMSETVTX = 0x00010000,
279}; 289};
280 290
291/* 9p2000.L open flags */
292#define P9_DOTL_RDONLY 00000000
293#define P9_DOTL_WRONLY 00000001
294#define P9_DOTL_RDWR 00000002
295#define P9_DOTL_NOACCESS 00000003
296#define P9_DOTL_CREATE 00000100
297#define P9_DOTL_EXCL 00000200
298#define P9_DOTL_NOCTTY 00000400
299#define P9_DOTL_TRUNC 00001000
300#define P9_DOTL_APPEND 00002000
301#define P9_DOTL_NONBLOCK 00004000
302#define P9_DOTL_DSYNC 00010000
303#define P9_DOTL_FASYNC 00020000
304#define P9_DOTL_DIRECT 00040000
305#define P9_DOTL_LARGEFILE 00100000
306#define P9_DOTL_DIRECTORY 00200000
307#define P9_DOTL_NOFOLLOW 00400000
308#define P9_DOTL_NOATIME 01000000
309#define P9_DOTL_CLOEXEC 02000000
310#define P9_DOTL_SYNC 04000000
311
312/* 9p2000.L at flags */
313#define P9_DOTL_AT_REMOVEDIR 0x200
314
315/* 9p2000.L lock type */
316#define P9_LOCK_TYPE_RDLCK 0
317#define P9_LOCK_TYPE_WRLCK 1
318#define P9_LOCK_TYPE_UNLCK 2
319
281/** 320/**
282 * enum p9_qid_t - QID types 321 * enum p9_qid_t - QID types
283 * @P9_QTDIR: directory 322 * @P9_QTDIR: directory
@@ -321,21 +360,6 @@ enum p9_qid_t {
321#define P9_READDIRHDRSZ 24 360#define P9_READDIRHDRSZ 24
322 361
323/** 362/**
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
333struct p9_str {
334 u16 len;
335 char *str;
336};
337
338/**
339 * struct p9_qid - file system entity information 363 * struct p9_qid - file system entity information
340 * @type: 8-bit type &p9_qid_t 364 * @type: 8-bit type &p9_qid_t
341 * @version: 16-bit monotonically incrementing version number 365 * @version: 16-bit monotonically incrementing version number
@@ -371,11 +395,11 @@ struct p9_qid {
371 * @atime: Last access/read time 395 * @atime: Last access/read time
372 * @mtime: Last modify/write time 396 * @mtime: Last modify/write time
373 * @length: file length 397 * @length: file length
374 * @name: last element of path (aka filename) in type &p9_str 398 * @name: last element of path (aka filename)
375 * @uid: owner name in type &p9_str 399 * @uid: owner name
376 * @gid: group owner in type &p9_str 400 * @gid: group owner
377 * @muid: last modifier in type &p9_str 401 * @muid: last modifier
378 * @extension: area used to encode extended UNIX support in type &p9_str 402 * @extension: area used to encode extended UNIX support
379 * @n_uid: numeric user id of owner (part of 9p2000.u extension) 403 * @n_uid: numeric user id of owner (part of 9p2000.u extension)
380 * @n_gid: numeric group id (part of 9p2000.u extension) 404 * @n_gid: numeric group id (part of 9p2000.u extension)
381 * @n_muid: numeric user id of laster modifier (part of 9p2000.u extension) 405 * @n_muid: numeric user id of laster modifier (part of 9p2000.u extension)
@@ -512,11 +536,6 @@ struct p9_getlock {
512 char *client_id; 536 char *client_id;
513}; 537};
514 538
515/* Structures for Protocol Operations */
516struct p9_tstatfs {
517 u32 fid;
518};
519
520struct p9_rstatfs { 539struct p9_rstatfs {
521 u32 type; 540 u32 type;
522 u32 bsize; 541 u32 bsize;
@@ -529,159 +548,6 @@ struct p9_rstatfs {
529 u32 namelen; 548 u32 namelen;
530}; 549};
531 550
532struct p9_trename {
533 u32 fid;
534 u32 newdirfid;
535 struct p9_str name;
536};
537
538struct p9_rrename {
539};
540
541struct p9_tversion {
542 u32 msize;
543 struct p9_str version;
544};
545
546struct p9_rversion {
547 u32 msize;
548 struct p9_str version;
549};
550
551struct p9_tauth {
552 u32 afid;
553 struct p9_str uname;
554 struct p9_str aname;
555 u32 n_uname; /* 9P2000.u extensions */
556};
557
558struct p9_rauth {
559 struct p9_qid qid;
560};
561
562struct p9_rerror {
563 struct p9_str error;
564 u32 errno; /* 9p2000.u extension */
565};
566
567struct p9_tflush {
568 u16 oldtag;
569};
570
571struct p9_rflush {
572};
573
574struct 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
582struct p9_rattach {
583 struct p9_qid qid;
584};
585
586struct p9_twalk {
587 u32 fid;
588 u32 newfid;
589 u16 nwname;
590 struct p9_str wnames[16];
591};
592
593struct p9_rwalk {
594 u16 nwqid;
595 struct p9_qid wqids[16];
596};
597
598struct p9_topen {
599 u32 fid;
600 u8 mode;
601};
602
603struct p9_ropen {
604 struct p9_qid qid;
605 u32 iounit;
606};
607
608struct p9_tcreate {
609 u32 fid;
610 struct p9_str name;
611 u32 perm;
612 u8 mode;
613 struct p9_str extension;
614};
615
616struct p9_rcreate {
617 struct p9_qid qid;
618 u32 iounit;
619};
620
621struct p9_tread {
622 u32 fid;
623 u64 offset;
624 u32 count;
625};
626
627struct p9_rread {
628 u32 count;
629 u8 *data;
630};
631
632struct p9_twrite {
633 u32 fid;
634 u64 offset;
635 u32 count;
636 u8 *data;
637};
638
639struct p9_rwrite {
640 u32 count;
641};
642
643struct p9_treaddir {
644 u32 fid;
645 u64 offset;
646 u32 count;
647};
648
649struct p9_rreaddir {
650 u32 count;
651 u8 *data;
652};
653
654
655struct p9_tclunk {
656 u32 fid;
657};
658
659struct p9_rclunk {
660};
661
662struct p9_tremove {
663 u32 fid;
664};
665
666struct p9_rremove {
667};
668
669struct p9_tstat {
670 u32 fid;
671};
672
673struct p9_rstat {
674 struct p9_wstat stat;
675};
676
677struct p9_twstat {
678 u32 fid;
679 struct p9_wstat stat;
680};
681
682struct p9_rwstat {
683};
684
685/** 551/**
686 * struct p9_fcall - primary packet structure 552 * struct p9_fcall - primary packet structure
687 * @size: prefixed length of the structure 553 * @size: prefixed length of the structure
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index d26d5e98a17..55ce72ce986 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -36,9 +36,9 @@
36 */ 36 */
37 37
38enum p9_proto_versions{ 38enum 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
213int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 213int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
214int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); 214int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid,
215 const char *name);
216int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name,
217 struct p9_fid *newdirfid, const char *new_name);
215struct p9_client *p9_client_create(const char *dev_name, char *options); 218struct p9_client *p9_client_create(const char *dev_name, char *options);
216void p9_client_destroy(struct p9_client *clnt); 219void p9_client_destroy(struct p9_client *clnt);
217void p9_client_disconnect(struct p9_client *clnt); 220void 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,
231int p9_client_clunk(struct p9_fid *fid); 234int p9_client_clunk(struct p9_fid *fid);
232int p9_client_fsync(struct p9_fid *fid, int datasync); 235int p9_client_fsync(struct p9_fid *fid, int datasync);
233int p9_client_remove(struct p9_fid *fid); 236int p9_client_remove(struct p9_fid *fid);
237int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags);
234int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 238int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
235 u64 offset, u32 count); 239 u64 offset, u32 count);
236int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, 240int 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 d8549fb9c74..83531ebeee9 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -67,7 +67,7 @@ struct p9_trans_module {
67 67
68void v9fs_register_trans(struct p9_trans_module *m); 68void v9fs_register_trans(struct p9_trans_module *m);
69void v9fs_unregister_trans(struct p9_trans_module *m); 69void v9fs_unregister_trans(struct p9_trans_module *m);
70struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name); 70struct p9_trans_module *v9fs_get_trans_by_name(char *s);
71struct p9_trans_module *v9fs_get_default_trans(void); 71struct p9_trans_module *v9fs_get_default_trans(void);
72void v9fs_put_trans(struct p9_trans_module *m); 72void 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 bab385f13ac..c739531e156 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -72,7 +72,7 @@ struct tcf_act_hdr {
72 72
73struct tc_action { 73struct 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);
115extern int tcf_register_action(struct tc_action_ops *a); 115extern int tcf_register_action(struct tc_action_ops *a);
116extern int tcf_unregister_action(struct tc_action_ops *a); 116extern int tcf_unregister_action(struct tc_action_ops *a);
117extern void tcf_action_destroy(struct tc_action *a, int bind); 117extern void tcf_action_destroy(struct tc_action *a, int bind);
118extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); 118extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res);
119extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 119extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
120extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 120extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
121extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); 121extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
diff --git a/include/net/activity_stats.h b/include/net/activity_stats.h
new file mode 100644
index 00000000000..10e4c1506ee
--- /dev/null
+++ b/include/net/activity_stats.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * Author: Mike Chan (mike@android.com)
14 */
15
16#ifndef __activity_stats_h
17#define __activity_stats_h
18
19#ifdef CONFIG_NET_ACTIVITY_STATS
20void activity_stats_update(void);
21#else
22#define activity_stats_update(void) {}
23#endif
24
25#endif /* _NET_ACTIVITY_STATS_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 582e4ae7075..cbc6bb0a683 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -8,7 +8,7 @@
8 8
9#define TEMP_VALID_LIFETIME (7*86400) 9#define TEMP_VALID_LIFETIME (7*86400)
10#define TEMP_PREFERRED_LIFETIME (86400) 10#define TEMP_PREFERRED_LIFETIME (86400)
11#define REGEN_MAX_RETRY (5) 11#define REGEN_MAX_RETRY (3)
12#define MAX_DESYNC_FACTOR (600) 12#define MAX_DESYNC_FACTOR (600)
13 13
14#define ADDR_CHECK_FREQUENCY (120*HZ) 14#define ADDR_CHECK_FREQUENCY (120*HZ)
diff --git a/include/net/arp.h b/include/net/arp.h
index 91f0568a04e..4979af8b155 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -8,6 +8,36 @@
8 8
9extern struct neigh_table arp_tbl; 9extern struct neigh_table arp_tbl;
10 10
11static 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
18static 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
11extern void arp_init(void); 41extern void arp_init(void);
12extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 42extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
13extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); 43extern 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);
18extern int arp_bind_neighbour(struct dst_entry *dst);
19extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); 48extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
20extern void arp_ifdown(struct net_device *dev); 49extern void arp_ifdown(struct net_device *dev);
21 50
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 206d22297ac..94e09d361bb 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -11,7 +11,7 @@
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <asm/atomic.h> 14#include <linux/atomic.h>
15 15
16#define AX25_T1CLAMPLO 1 16#define AX25_T1CLAMPLO 1
17#define AX25_T1CLAMPHI (30 * HZ) 17#define AX25_T1CLAMPHI (30 * HZ)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 43750439c52..e727555d4ee 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
57struct bt_security { 57struct 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) 74struct 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)))
81int 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 */
77enum { 88enum {
@@ -130,7 +141,8 @@ int bt_sock_register(int proto, const struct net_proto_family *ops);
130int bt_sock_unregister(int proto); 141int bt_sock_unregister(int proto);
131void bt_sock_link(struct bt_sock_list *l, struct sock *s); 142void bt_sock_link(struct bt_sock_list *l, struct sock *s);
132void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 143void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
133int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); 144int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
145 struct msghdr *msg, size_t len, int flags);
134int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, 146int 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);
136uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); 148uint 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
167static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, 180static 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
198int bt_err(__u16 code); 211int bt_to_errno(__u16 code);
199 212
200extern int hci_sock_init(void); 213extern int hci_sock_init(void);
201extern void hci_sock_cleanup(void); 214extern void hci_sock_cleanup(void);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 0c20227e57f..915d7ae527b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -37,6 +37,7 @@
37#define HCI_DEV_DOWN 4 37#define HCI_DEV_DOWN 4
38#define HCI_DEV_SUSPEND 5 38#define HCI_DEV_SUSPEND 5
39#define HCI_DEV_RESUME 6 39#define HCI_DEV_RESUME 6
40#define HCI_DEV_WRITE 7
40 41
41/* HCI notify events */ 42/* HCI notify events */
42#define HCI_NOTIFY_CONN_ADD 1 43#define HCI_NOTIFY_CONN_ADD 1
@@ -157,8 +158,10 @@ enum {
157#define ESCO_2EV5 0x0100 158#define ESCO_2EV5 0x0100
158#define ESCO_3EV5 0x0200 159#define ESCO_3EV5 0x0200
159 160
160#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 161#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
161#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 162#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
163#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \
164 EDR_ESCO_MASK)
162 165
163/* ACL flags */ 166/* ACL flags */
164#define ACL_START_NO_FLUSH 0x00 167#define ACL_START_NO_FLUSH 0x00
@@ -211,11 +214,16 @@ enum {
211#define LMP_EDR_3S_ESCO 0x80 214#define LMP_EDR_3S_ESCO 0x80
212 215
213#define LMP_EXT_INQ 0x01 216#define LMP_EXT_INQ 0x01
217#define LMP_SIMUL_LE_BR 0x02
214#define LMP_SIMPLE_PAIR 0x08 218#define LMP_SIMPLE_PAIR 0x08
215#define LMP_NO_FLUSH 0x40 219#define LMP_NO_FLUSH 0x40
216 220
217#define LMP_LSTO 0x01 221#define LMP_LSTO 0x01
218#define LMP_INQ_TX_PWR 0x02 222#define LMP_INQ_TX_PWR 0x02
223#define LMP_EXTFEATURES 0x80
224
225/* Extended LMP features */
226#define LMP_HOST_LE 0x02
219 227
220/* Connection modes */ 228/* Connection modes */
221#define HCI_CM_ACTIVE 0x0000 229#define HCI_CM_ACTIVE 0x0000
@@ -254,6 +262,10 @@ enum {
254#define HCI_LK_UNAUTH_COMBINATION 0x04 262#define HCI_LK_UNAUTH_COMBINATION 0x04
255#define HCI_LK_AUTH_COMBINATION 0x05 263#define HCI_LK_AUTH_COMBINATION 0x05
256#define HCI_LK_CHANGED_COMBINATION 0x06 264#define HCI_LK_CHANGED_COMBINATION 0x06
265/* The spec doesn't define types for SMP keys */
266#define HCI_LK_SMP_LTK 0x81
267#define HCI_LK_SMP_IRK 0x82
268#define HCI_LK_SMP_CSRK 0x83
257 269
258/* ----- HCI Commands ---- */ 270/* ----- HCI Commands ---- */
259#define HCI_OP_NOP 0x0000 271#define HCI_OP_NOP 0x0000
@@ -653,6 +665,12 @@ struct hci_rp_read_local_oob_data {
653 665
654#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 666#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
655 667
668#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
669struct hci_cp_write_le_host_supported {
670 __u8 le;
671 __u8 simul;
672} __packed;
673
656#define HCI_OP_READ_LOCAL_VERSION 0x1001 674#define HCI_OP_READ_LOCAL_VERSION 0x1001
657struct hci_rp_read_local_version { 675struct hci_rp_read_local_version {
658 __u8 status; 676 __u8 status;
@@ -676,6 +694,9 @@ struct hci_rp_read_local_features {
676} __packed; 694} __packed;
677 695
678#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 696#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
697struct hci_cp_read_local_ext_features {
698 __u8 page;
699} __packed;
679struct hci_rp_read_local_ext_features { 700struct hci_rp_read_local_ext_features {
680 __u8 status; 701 __u8 status;
681 __u8 page; 702 __u8 page;
@@ -710,6 +731,12 @@ struct hci_rp_le_read_buffer_size {
710 __u8 le_max_pkt; 731 __u8 le_max_pkt;
711} __packed; 732} __packed;
712 733
734#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
735struct hci_cp_le_set_scan_enable {
736 __u8 enable;
737 __u8 filter_dup;
738} __packed;
739
713#define HCI_OP_LE_CREATE_CONN 0x200d 740#define HCI_OP_LE_CREATE_CONN 0x200d
714struct hci_cp_le_create_conn { 741struct hci_cp_le_create_conn {
715 __le16 scan_interval; 742 __le16 scan_interval;
@@ -739,6 +766,33 @@ struct hci_cp_le_conn_update {
739 __le16 max_ce_len; 766 __le16 max_ce_len;
740} __packed; 767} __packed;
741 768
769#define HCI_OP_LE_START_ENC 0x2019
770struct hci_cp_le_start_enc {
771 __le16 handle;
772 __u8 rand[8];
773 __le16 ediv;
774 __u8 ltk[16];
775} __packed;
776
777#define HCI_OP_LE_LTK_REPLY 0x201a
778struct hci_cp_le_ltk_reply {
779 __le16 handle;
780 __u8 ltk[16];
781} __packed;
782struct hci_rp_le_ltk_reply {
783 __u8 status;
784 __le16 handle;
785} __packed;
786
787#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
788struct hci_cp_le_ltk_neg_reply {
789 __le16 handle;
790} __packed;
791struct hci_rp_le_ltk_neg_reply {
792 __u8 status;
793 __le16 handle;
794} __packed;
795
742/* ---- HCI Events ---- */ 796/* ---- HCI Events ---- */
743#define HCI_EV_INQUIRY_COMPLETE 0x01 797#define HCI_EV_INQUIRY_COMPLETE 0x01
744 798
@@ -1029,6 +1083,32 @@ struct hci_ev_le_conn_complete {
1029 __u8 clk_accurancy; 1083 __u8 clk_accurancy;
1030} __packed; 1084} __packed;
1031 1085
1086#define HCI_EV_LE_LTK_REQ 0x05
1087struct hci_ev_le_ltk_req {
1088 __le16 handle;
1089 __u8 random[8];
1090 __le16 ediv;
1091} __packed;
1092
1093/* Advertising report event types */
1094#define ADV_IND 0x00
1095#define ADV_DIRECT_IND 0x01
1096#define ADV_SCAN_IND 0x02
1097#define ADV_NONCONN_IND 0x03
1098#define ADV_SCAN_RSP 0x04
1099
1100#define ADDR_LE_DEV_PUBLIC 0x00
1101#define ADDR_LE_DEV_RANDOM 0x01
1102
1103#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1104struct hci_ev_le_advertising_info {
1105 __u8 evt_type;
1106 __u8 bdaddr_type;
1107 bdaddr_t bdaddr;
1108 __u8 length;
1109 __u8 data[0];
1110} __packed;
1111
1032/* Internal events generated by Bluetooth stack */ 1112/* Internal events generated by Bluetooth stack */
1033#define HCI_EV_STACK_INTERNAL 0xfd 1113#define HCI_EV_STACK_INTERNAL 0xfd
1034struct hci_ev_stack_internal { 1114struct hci_ev_stack_internal {
@@ -1184,6 +1264,9 @@ struct hci_conn_info {
1184 __u8 out; 1264 __u8 out;
1185 __u16 state; 1265 __u16 state;
1186 __u32 link_mode; 1266 __u32 link_mode;
1267 __u32 mtu;
1268 __u32 cnt;
1269 __u32 pkts;
1187}; 1270};
1188 1271
1189struct hci_dev_req { 1272struct hci_dev_req {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6c994c004d1..626f8b0a679 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
78struct key_master_id {
79 __le16 ediv;
80 u8 rand[8];
81} __packed;
82
83struct 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
77struct link_key { 92struct 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
85struct oob_data { 102struct oob_data {
@@ -89,6 +106,12 @@ struct oob_data {
89 u8 randomizer[16]; 106 u8 randomizer[16];
90}; 107};
91 108
109struct 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
93struct hci_dev { 116struct 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
310struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 339struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
340 bdaddr_t *bdaddr);
311void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); 341void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data);
312 342
313/* ----- HCI Connections ----- */ 343/* ----- HCI Connections ----- */
314enum { 344enum {
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,
@@ -415,19 +446,22 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle);
415void hci_setup_sync(struct hci_conn *conn, __u16 handle); 446void hci_setup_sync(struct hci_conn *conn, __u16 handle);
416void hci_sco_setup(struct hci_conn *conn, __u8 status); 447void hci_sco_setup(struct hci_conn *conn, __u8 status);
417 448
418struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); 449struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
450 __u16 pkt_type, bdaddr_t *dst);
419int hci_conn_del(struct hci_conn *conn); 451int hci_conn_del(struct hci_conn *conn);
420void hci_conn_hash_flush(struct hci_dev *hdev); 452void hci_conn_hash_flush(struct hci_dev *hdev);
421void hci_conn_check_pending(struct hci_dev *hdev); 453void hci_conn_check_pending(struct hci_dev *hdev);
422 454
423struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); 455struct hci_conn *hci_connect(struct hci_dev *hdev, int type,
456 __u16 pkt_type, bdaddr_t *dst,
457 __u8 sec_level, __u8 auth_type);
424int hci_conn_check_link_mode(struct hci_conn *conn); 458int hci_conn_check_link_mode(struct hci_conn *conn);
425int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); 459int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
426int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); 460int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
427int hci_conn_change_link_key(struct hci_conn *conn); 461int hci_conn_change_link_key(struct hci_conn *conn);
428int hci_conn_switch_role(struct hci_conn *conn, __u8 role); 462int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
429 463
430void hci_conn_enter_active_mode(struct hci_conn *conn); 464void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
431void hci_conn_enter_sniff_mode(struct hci_conn *conn); 465void hci_conn_enter_sniff_mode(struct hci_conn *conn);
432 466
433void hci_conn_hold_device(struct hci_conn *conn); 467void hci_conn_hold_device(struct hci_conn *conn);
@@ -448,11 +482,13 @@ static inline void hci_conn_put(struct hci_conn *conn)
448 if (conn->state == BT_CONNECTED) { 482 if (conn->state == BT_CONNECTED) {
449 timeo = msecs_to_jiffies(conn->disc_timeout); 483 timeo = msecs_to_jiffies(conn->disc_timeout);
450 if (!conn->out) 484 if (!conn->out)
451 timeo *= 2; 485 timeo *= 20;
452 } else 486 } else {
453 timeo = msecs_to_jiffies(10); 487 timeo = msecs_to_jiffies(10);
454 } else 488 }
489 } else {
455 timeo = msecs_to_jiffies(10); 490 timeo = msecs_to_jiffies(10);
491 }
456 mod_timer(&conn->disc_timer, jiffies + timeo); 492 mod_timer(&conn->disc_timer, jiffies + timeo);
457 } 493 }
458} 494}
@@ -511,6 +547,8 @@ int hci_inquiry(void __user *arg);
511 547
512struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 548struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
513int hci_blacklist_clear(struct hci_dev *hdev); 549int hci_blacklist_clear(struct hci_dev *hdev);
550int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr);
551int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr);
514 552
515int hci_uuids_clear(struct hci_dev *hdev); 553int hci_uuids_clear(struct hci_dev *hdev);
516 554
@@ -518,6 +556,11 @@ int hci_link_keys_clear(struct hci_dev *hdev);
518struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 556struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
519int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 557int 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); 558 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
559struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
560struct link_key *hci_find_link_key_type(struct hci_dev *hdev,
561 bdaddr_t *bdaddr, u8 type);
562int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr,
563 u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]);
521int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 564int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
522 565
523int hci_remote_oob_data_clear(struct hci_dev *hdev); 566int hci_remote_oob_data_clear(struct hci_dev *hdev);
@@ -527,6 +570,12 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
527 u8 *randomizer); 570 u8 *randomizer);
528int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 571int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
529 572
573#define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */
574int hci_adv_entries_clear(struct hci_dev *hdev);
575struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr);
576int hci_add_adv_entry(struct hci_dev *hdev,
577 struct hci_ev_le_advertising_info *ev);
578
530void hci_del_off_timer(struct hci_dev *hdev); 579void hci_del_off_timer(struct hci_dev *hdev);
531 580
532void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 581void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
@@ -553,6 +602,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
553#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 602#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
554#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 603#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
555 604
605/* ----- Extended LMP capabilities ----- */
606#define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE)
607
556/* ----- HCI protocols ----- */ 608/* ----- HCI protocols ----- */
557struct hci_proto { 609struct hci_proto {
558 char *name; 610 char *name;
@@ -561,16 +613,20 @@ struct hci_proto {
561 613
562 void *priv; 614 void *priv;
563 615
564 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); 616 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr,
617 __u8 type);
565 int (*connect_cfm) (struct hci_conn *conn, __u8 status); 618 int (*connect_cfm) (struct hci_conn *conn, __u8 status);
566 int (*disconn_ind) (struct hci_conn *conn); 619 int (*disconn_ind) (struct hci_conn *conn);
567 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason); 620 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
568 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 621 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb,
622 __u16 flags);
569 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); 623 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
570 int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); 624 int (*security_cfm) (struct hci_conn *conn, __u8 status,
625 __u8 encrypt);
571}; 626};
572 627
573static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) 628static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
629 __u8 type)
574{ 630{
575 register struct hci_proto *hp; 631 register struct hci_proto *hp;
576 int mask = 0; 632 int mask = 0;
@@ -656,7 +712,8 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
656 conn->security_cfm_cb(conn, status); 712 conn->security_cfm_cb(conn, status);
657} 713}
658 714
659static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 715static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status,
716 __u8 encrypt)
660{ 717{
661 register struct hci_proto *hp; 718 register struct hci_proto *hp;
662 719
@@ -681,7 +738,8 @@ struct hci_cb {
681 738
682 char *name; 739 char *name;
683 740
684 void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt); 741 void (*security_cfm) (struct hci_conn *conn, __u8 status,
742 __u8 encrypt);
685 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 743 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
686 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); 744 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
687}; 745};
@@ -707,13 +765,17 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
707 read_unlock_bh(&hci_cb_list_lock); 765 read_unlock_bh(&hci_cb_list_lock);
708} 766}
709 767
710static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 768static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
769 __u8 encrypt)
711{ 770{
712 struct list_head *p; 771 struct list_head *p;
713 772
714 if (conn->sec_level == BT_SECURITY_SDP) 773 if (conn->sec_level == BT_SECURITY_SDP)
715 conn->sec_level = BT_SECURITY_LOW; 774 conn->sec_level = BT_SECURITY_LOW;
716 775
776 if (conn->pending_sec_level > conn->sec_level)
777 conn->sec_level = conn->pending_sec_level;
778
717 hci_proto_encrypt_cfm(conn, status, encrypt); 779 hci_proto_encrypt_cfm(conn, status, encrypt);
718 780
719 read_lock_bh(&hci_cb_list_lock); 781 read_lock_bh(&hci_cb_list_lock);
@@ -738,7 +800,8 @@ static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
738 read_unlock_bh(&hci_cb_list_lock); 800 read_unlock_bh(&hci_cb_list_lock);
739} 801}
740 802
741static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, __u8 role) 803static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
804 __u8 role)
742{ 805{
743 struct list_head *p; 806 struct list_head *p;
744 807
@@ -830,4 +893,9 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
830 893
831void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 894void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
832 u16 latency, u16 to_multiplier); 895 u16 latency, u16 to_multiplier);
896void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
897 __u8 ltk[16]);
898void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
899void hci_le_ltk_neg_reply(struct hci_conn *conn);
900
833#endif /* __HCI_CORE_H */ 901#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d09c9b1118e..4f34ad25e75 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 */
134struct l2cap_hdr { 139struct 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
147struct l2cap_cmd_rej { 152struct l2cap_cmd_rej_unk {
153 __le16 reason;
154} __packed;
155
156struct l2cap_cmd_rej_mtu {
157 __le16 reason;
158 __le16 max_mtu;
159} __packed;
160
161struct l2cap_cmd_rej_cid {
148 __le16 reason; 162 __le16 reason;
163 __le16 scid;
164 __le16 dcid;
149} __packed; 165} __packed;
150 166
151struct l2cap_conn_req { 167struct 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
380struct 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
356struct l2cap_conn { 389struct 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
390struct l2cap_pinfo { 436struct 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 442enum {
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 456enum {
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
426static inline int l2cap_tx_window_full(struct l2cap_chan *ch) 481static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
427{ 482{
@@ -446,32 +501,17 @@ extern int disable_ertm;
446int l2cap_init_sockets(void); 501int l2cap_init_sockets(void);
447void l2cap_cleanup_sockets(void); 502void l2cap_cleanup_sockets(void);
448 503
449void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data);
450void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 504void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
451int __l2cap_wait_ack(struct sock *sk); 505int __l2cap_wait_ack(struct sock *sk);
452 506
453struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
454struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
455struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen);
456int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
457void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb);
458void l2cap_streaming_send(struct l2cap_chan *chan);
459int l2cap_ertm_send(struct l2cap_chan *chan);
460
461int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 507int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
462int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 508int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
463 509
464void l2cap_sock_set_timer(struct sock *sk, long timeout);
465void l2cap_sock_clear_timer(struct sock *sk);
466void __l2cap_sock_close(struct sock *sk, int reason);
467void l2cap_sock_kill(struct sock *sk);
468void l2cap_sock_init(struct sock *sk, struct sock *parent);
469struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
470 int proto, gfp_t prio);
471void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err);
472struct l2cap_chan *l2cap_chan_create(struct sock *sk); 510struct l2cap_chan *l2cap_chan_create(struct sock *sk);
473void l2cap_chan_del(struct l2cap_chan *chan, int err); 511void l2cap_chan_close(struct l2cap_chan *chan, int reason);
474void l2cap_chan_destroy(struct l2cap_chan *chan); 512void l2cap_chan_destroy(struct l2cap_chan *chan);
475int l2cap_chan_connect(struct l2cap_chan *chan); 513int l2cap_chan_connect(struct l2cap_chan *chan);
514int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
515void 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 4899286ed4e..5428fd32cce 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
205struct mgmt_cp_block_device {
206 bdaddr_t bdaddr;
207} __packed;
208
209#define MGMT_OP_UNBLOCK_DEVICE 0x001E
210struct 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
203struct mgmt_ev_cmd_complete { 215struct 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 6eac4a760c3..d5eee2093b1 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) ---- */
235struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); 235struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio);
236void rfcomm_dlc_free(struct rfcomm_dlc *d); 236void rfcomm_dlc_free(struct rfcomm_dlc *d);
237int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel); 237int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
238 u8 channel);
238int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
239int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
240int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 241int 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 ---- */
274void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst); 275void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src,
276 bdaddr_t *dst);
275 277
276static inline void rfcomm_session_hold(struct rfcomm_session *s) 278static inline void rfcomm_session_hold(struct rfcomm_session *s)
277{ 279{
@@ -312,7 +314,8 @@ struct rfcomm_pinfo {
312int rfcomm_init_sockets(void); 314int rfcomm_init_sockets(void);
313void rfcomm_cleanup_sockets(void); 315void rfcomm_cleanup_sockets(void);
314 316
315int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc **d); 317int 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/sco.h b/include/net/bluetooth/sco.h
index 1e35c43657c..6d1857ab8e5 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -37,6 +37,7 @@
37struct sockaddr_sco { 37struct sockaddr_sco {
38 sa_family_t sco_family; 38 sa_family_t sco_family;
39 bdaddr_t sco_bdaddr; 39 bdaddr_t sco_bdaddr;
40 __u16 sco_pkt_type;
40}; 41};
41 42
42/* SCO socket options */ 43/* SCO socket options */
@@ -72,7 +73,8 @@ struct sco_conn {
72 73
73struct sco_pinfo { 74struct sco_pinfo {
74 struct bt_sock bt; 75 struct bt_sock bt;
75 __u32 flags; 76 __u16 pkt_type;
77
76 struct sco_conn *conn; 78 struct sco_conn *conn;
77}; 79};
78 80
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 8f2edbf979d..46c45761230 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
20struct smp_cmd_pairing_confirm { 59struct 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 */
119int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
120int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
121int 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 00000000000..c5dedd87b4c
--- /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. */
35struct 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. */
92struct 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. */
100struct 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. */
113struct 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
143extern struct platform_driver cfhsi_driver;
144
145#endif /* CAIF_HSI_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 396e8fc8910..ffa8aedd70f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -536,6 +536,11 @@ struct sta_bss_parameters {
536 * This number should increase every time the list of stations 536 * This number should increase every time the list of stations
537 * changes, i.e. when a station is added or removed, so that 537 * changes, i.e. when a station is added or removed, so that
538 * userspace can tell whether it got a consistent snapshot. 538 * userspace can tell whether it got a consistent snapshot.
539 * @assoc_req_ies: IEs from (Re)Association Request.
540 * This is used only when in AP mode with drivers that do not use
541 * user space MLME/SME implementation. The information is provided for
542 * the cfg80211_new_sta() calls to notify user space of the IEs.
543 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
539 */ 544 */
540struct station_info { 545struct station_info {
541 u32 filled; 546 u32 filled;
@@ -558,6 +563,14 @@ struct station_info {
558 struct sta_bss_parameters bss_param; 563 struct sta_bss_parameters bss_param;
559 564
560 int generation; 565 int generation;
566
567 const u8 *assoc_req_ies;
568 size_t assoc_req_ies_len;
569
570 /*
571 * Note: Add a new enum station_info_flags value for each new field and
572 * use it to check which fields are initialized.
573 */
561}; 574};
562 575
563/** 576/**
@@ -777,6 +790,7 @@ struct cfg80211_ssid {
777 * @n_channels: total number of channels to scan 790 * @n_channels: total number of channels to scan
778 * @ie: optional information element(s) to add into Probe Request or %NULL 791 * @ie: optional information element(s) to add into Probe Request or %NULL
779 * @ie_len: length of ie in octets 792 * @ie_len: length of ie in octets
793 * @rates: bitmap of rates to advertise for each band
780 * @wiphy: the wiphy this was for 794 * @wiphy: the wiphy this was for
781 * @dev: the interface 795 * @dev: the interface
782 * @aborted: (internal) scan request was notified as aborted 796 * @aborted: (internal) scan request was notified as aborted
@@ -788,6 +802,8 @@ struct cfg80211_scan_request {
788 const u8 *ie; 802 const u8 *ie;
789 size_t ie_len; 803 size_t ie_len;
790 804
805 u32 rates[IEEE80211_NUM_BANDS];
806
791 /* internal */ 807 /* internal */
792 struct wiphy *wiphy; 808 struct wiphy *wiphy;
793 struct net_device *dev; 809 struct net_device *dev;
@@ -1146,14 +1162,32 @@ struct cfg80211_wowlan_trig_pkt_pattern {
1146 * @magic_pkt: wake up on receiving magic packet 1162 * @magic_pkt: wake up on receiving magic packet
1147 * @patterns: wake up on receiving packet matching a pattern 1163 * @patterns: wake up on receiving packet matching a pattern
1148 * @n_patterns: number of patterns 1164 * @n_patterns: number of patterns
1165 * @gtk_rekey_failure: wake up on GTK rekey failure
1166 * @eap_identity_req: wake up on EAP identity request packet
1167 * @four_way_handshake: wake up on 4-way handshake
1168 * @rfkill_release: wake up when rfkill is released
1149 */ 1169 */
1150struct cfg80211_wowlan { 1170struct cfg80211_wowlan {
1151 bool any, disconnect, magic_pkt; 1171 bool any, disconnect, magic_pkt, gtk_rekey_failure,
1172 eap_identity_req, four_way_handshake,
1173 rfkill_release;
1152 struct cfg80211_wowlan_trig_pkt_pattern *patterns; 1174 struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1153 int n_patterns; 1175 int n_patterns;
1154}; 1176};
1155 1177
1156/** 1178/**
1179 * struct cfg80211_gtk_rekey_data - rekey data
1180 * @kek: key encryption key
1181 * @kck: key confirmation key
1182 * @replay_ctr: replay counter
1183 */
1184struct cfg80211_gtk_rekey_data {
1185 u8 kek[NL80211_KEK_LEN];
1186 u8 kck[NL80211_KCK_LEN];
1187 u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1188};
1189
1190/**
1157 * struct cfg80211_ops - backend description for wireless configuration 1191 * struct cfg80211_ops - backend description for wireless configuration
1158 * 1192 *
1159 * This struct is registered by fullmac card drivers and/or wireless stacks 1193 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -1197,6 +1231,8 @@ struct cfg80211_wowlan {
1197 * 1231 *
1198 * @set_default_mgmt_key: set the default management frame key on an interface 1232 * @set_default_mgmt_key: set the default management frame key on an interface
1199 * 1233 *
1234 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1235 *
1200 * @add_beacon: Add a beacon with given parameters, @head, @interval 1236 * @add_beacon: Add a beacon with given parameters, @head, @interval
1201 * and @dtim_period will be valid, @tail is optional. 1237 * and @dtim_period will be valid, @tail is optional.
1202 * @set_beacon: Change the beacon parameters for an access point mode 1238 * @set_beacon: Change the beacon parameters for an access point mode
@@ -1284,6 +1320,12 @@ struct cfg80211_wowlan {
1284 * frame on another channel 1320 * frame on another channel
1285 * 1321 *
1286 * @testmode_cmd: run a test mode command 1322 * @testmode_cmd: run a test mode command
1323 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
1324 * used by the function, but 0 and 1 must not be touched. Additionally,
1325 * return error codes other than -ENOBUFS and -ENOENT will terminate the
1326 * dump and return to userspace with an error, so be careful. If any data
1327 * was passed in from userspace then the data/len arguments will be present
1328 * and point to the data contained in %NL80211_ATTR_TESTDATA.
1287 * 1329 *
1288 * @set_bitrate_mask: set the bitrate mask configuration 1330 * @set_bitrate_mask: set the bitrate mask configuration
1289 * 1331 *
@@ -1433,6 +1475,9 @@ struct cfg80211_ops {
1433 1475
1434#ifdef CONFIG_NL80211_TESTMODE 1476#ifdef CONFIG_NL80211_TESTMODE
1435 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1477 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
1478 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
1479 struct netlink_callback *cb,
1480 void *data, int len);
1436#endif 1481#endif
1437 1482
1438 int (*set_bitrate_mask)(struct wiphy *wiphy, 1483 int (*set_bitrate_mask)(struct wiphy *wiphy,
@@ -1490,6 +1535,9 @@ struct cfg80211_ops {
1490 struct net_device *dev, 1535 struct net_device *dev,
1491 struct cfg80211_sched_scan_request *request); 1536 struct cfg80211_sched_scan_request *request);
1492 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 1537 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1538
1539 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1540 struct cfg80211_gtk_rekey_data *data);
1493}; 1541};
1494 1542
1495/* 1543/*
@@ -1647,11 +1695,21 @@ struct ieee80211_txrx_stypes {
1647 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 1695 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
1648 * (see nl80211.h) 1696 * (see nl80211.h)
1649 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 1697 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
1698 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
1699 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
1700 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
1701 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
1702 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
1650 */ 1703 */
1651enum wiphy_wowlan_support_flags { 1704enum wiphy_wowlan_support_flags {
1652 WIPHY_WOWLAN_ANY = BIT(0), 1705 WIPHY_WOWLAN_ANY = BIT(0),
1653 WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 1706 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
1654 WIPHY_WOWLAN_DISCONNECT = BIT(2), 1707 WIPHY_WOWLAN_DISCONNECT = BIT(2),
1708 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
1709 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
1710 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
1711 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
1712 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
1655}; 1713};
1656 1714
1657/** 1715/**
@@ -1699,6 +1757,8 @@ struct wiphy_wowlan_support {
1699 * by default for perm_addr. In this case, the mask should be set to 1757 * by default for perm_addr. In this case, the mask should be set to
1700 * all-zeroes. In this case it is assumed that the device can handle 1758 * all-zeroes. In this case it is assumed that the device can handle
1701 * the same number of arbitrary MAC addresses. 1759 * the same number of arbitrary MAC addresses.
1760 * @registered: protects ->resume and ->suspend sysfs callbacks against
1761 * unregister hardware
1702 * @debugfsdir: debugfs directory used for this wiphy, will be renamed 1762 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
1703 * automatically on wiphy renames 1763 * automatically on wiphy renames
1704 * @dev: (virtual) struct device for this wiphy 1764 * @dev: (virtual) struct device for this wiphy
@@ -1716,9 +1776,13 @@ struct wiphy_wowlan_support {
1716 * this variable determines its size 1776 * this variable determines its size
1717 * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1777 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
1718 * any given scan 1778 * any given scan
1779 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
1780 * for in any given scheduled scan
1719 * @max_scan_ie_len: maximum length of user-controlled IEs device can 1781 * @max_scan_ie_len: maximum length of user-controlled IEs device can
1720 * add to probe request frames transmitted during a scan, must not 1782 * add to probe request frames transmitted during a scan, must not
1721 * include fixed IEs like supported rates 1783 * include fixed IEs like supported rates
1784 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
1785 * scans
1722 * @coverage_class: current coverage class 1786 * @coverage_class: current coverage class
1723 * @fw_version: firmware version for ethtool reporting 1787 * @fw_version: firmware version for ethtool reporting
1724 * @hw_version: hardware version for ethtool reporting 1788 * @hw_version: hardware version for ethtool reporting
@@ -1770,7 +1834,9 @@ struct wiphy {
1770 1834
1771 int bss_priv_size; 1835 int bss_priv_size;
1772 u8 max_scan_ssids; 1836 u8 max_scan_ssids;
1837 u8 max_sched_scan_ssids;
1773 u16 max_scan_ie_len; 1838 u16 max_scan_ie_len;
1839 u16 max_sched_scan_ie_len;
1774 1840
1775 int n_cipher_suites; 1841 int n_cipher_suites;
1776 const u32 *cipher_suites; 1842 const u32 *cipher_suites;
@@ -1814,6 +1880,9 @@ struct wiphy {
1814 * you need use set_wiphy_dev() (see below) */ 1880 * you need use set_wiphy_dev() (see below) */
1815 struct device dev; 1881 struct device dev;
1816 1882
1883 /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
1884 bool registered;
1885
1817 /* dir in debugfs: ieee80211/<wiphyname> */ 1886 /* dir in debugfs: ieee80211/<wiphyname> */
1818 struct dentry *debugfsdir; 1887 struct dentry *debugfsdir;
1819 1888
@@ -2849,8 +2918,10 @@ struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
2849void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 2918void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
2850 2919
2851#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 2920#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
2921#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
2852#else 2922#else
2853#define CFG80211_TESTMODE_CMD(cmd) 2923#define CFG80211_TESTMODE_CMD(cmd)
2924#define CFG80211_TESTMODE_DUMP(cmd)
2854#endif 2925#endif
2855 2926
2856/** 2927/**
@@ -3022,6 +3093,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
3022void cfg80211_cqm_pktloss_notify(struct net_device *dev, 3093void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3023 const u8 *peer, u32 num_packets, gfp_t gfp); 3094 const u8 *peer, u32 num_packets, gfp_t gfp);
3024 3095
3096/**
3097 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3098 * @dev: network device
3099 * @bssid: BSSID of AP (to avoid races)
3100 * @replay_ctr: new replay counter
3101 * @gfp: allocation flags
3102 */
3103void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3104 const u8 *replay_ctr, gfp_t gfp);
3105
3025/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3106/* Logging, debugging and troubleshooting/diagnostic helpers. */
3026 3107
3027/* wiphy_printk helpers, similar to dev_printk */ 3108/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index abd443604c9..9808877c2ab 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -8,7 +8,7 @@
8 * have chosen to adopt the protocol and over the years it has become a 8 * have chosen to adopt the protocol and over the years it has become a
9 * de-facto standard for labeled networking. 9 * de-facto standard for labeled networking.
10 * 10 *
11 * Author: Paul Moore <paul.moore@hp.com> 11 * Author: Paul Moore <paul@paul-moore.com>
12 * 12 *
13 */ 13 */
14 14
@@ -41,7 +41,7 @@
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <net/request_sock.h> 43#include <net/request_sock.h>
44#include <asm/atomic.h> 44#include <linux/atomic.h>
45 45
46/* known doi values */ 46/* known doi values */
47#define CIPSO_V4_DOI_UNKNOWN 0x00000000 47#define CIPSO_V4_DOI_UNKNOWN 0x00000000
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index e5983c9053d..f5aa39997f0 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
31u8 dcb_setapp(struct net_device *, struct dcb_app *); 31int dcb_setapp(struct net_device *, struct dcb_app *);
32u8 dcb_getapp(struct net_device *, struct dcb_app *); 32u8 dcb_getapp(struct net_device *, struct dcb_app *);
33int dcb_ieee_setapp(struct net_device *, struct dcb_app *);
34int dcb_ieee_delapp(struct net_device *, struct dcb_app *);
35u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *);
36
37int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd,
38 u32 seq, u32 pid);
39int 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 e12ddfb9eb1..82952498b63 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 __rcu *_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,15 @@ 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#define DST_NOPEER 0x0040
57
50 short error; 58 short error;
51 short obsolete; 59 short obsolete;
52 unsigned short header_len; /* more space at head required */ 60 unsigned short header_len; /* more space at head required */
@@ -62,7 +70,7 @@ struct dst_entry {
62 * (L1_CACHE_SIZE would be too much) 70 * (L1_CACHE_SIZE would be too much)
63 */ 71 */
64#ifdef CONFIG_64BIT 72#ifdef CONFIG_64BIT
65 long __pad_to_align_refcnt[1]; 73 long __pad_to_align_refcnt[2];
66#endif 74#endif
67 /* 75 /*
68 * __refcnt wants to be on a different cache line from 76 * __refcnt wants to be on a different cache line from
@@ -71,13 +79,6 @@ struct dst_entry {
71 atomic_t __refcnt; /* client references */ 79 atomic_t __refcnt; /* client references */
72 int __use; 80 int __use;
73 unsigned long lastuse; 81 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 { 82 union {
82 struct dst_entry *next; 83 struct dst_entry *next;
83 struct rtable __rcu *rt_next; 84 struct rtable __rcu *rt_next;
@@ -86,6 +87,21 @@ struct dst_entry {
86 }; 87 };
87}; 88};
88 89
90static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst)
91{
92 return rcu_dereference(dst->_neighbour);
93}
94
95static inline struct neighbour *dst_get_neighbour_raw(struct dst_entry *dst)
96{
97 return rcu_dereference_raw(dst->_neighbour);
98}
99
100static inline void dst_set_neighbour(struct dst_entry *dst, struct neighbour *neigh)
101{
102 rcu_assign_pointer(dst->_neighbour, neigh);
103}
104
89extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 105extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
90extern const u32 dst_default_metrics[RTAX_MAX]; 106extern const u32 dst_default_metrics[RTAX_MAX];
91 107
@@ -371,8 +387,19 @@ static inline void dst_rcu_free(struct rcu_head *head)
371 387
372static inline void dst_confirm(struct dst_entry *dst) 388static inline void dst_confirm(struct dst_entry *dst)
373{ 389{
374 if (dst) 390 if (dst) {
375 neigh_confirm(dst->neighbour); 391 struct neighbour *n;
392
393 rcu_read_lock();
394 n = dst_get_neighbour(dst);
395 neigh_confirm(n);
396 rcu_read_unlock();
397 }
398}
399
400static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
401{
402 return dst->ops->neigh_lookup(dst, daddr);
376} 403}
377 404
378static inline void dst_link_failure(struct sk_buff *skb) 405static inline void dst_link_failure(struct sk_buff *skb)
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index dc074632894..9adb99845a5 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/flow.h b/include/net/flow.h
index c6d5fe5ec1b..57f15a7f1cd 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -7,8 +7,9 @@
7#ifndef _NET_FLOW_H 7#ifndef _NET_FLOW_H
8#define _NET_FLOW_H 8#define _NET_FLOW_H
9 9
10#include <linux/socket.h>
10#include <linux/in6.h> 11#include <linux/in6.h>
11#include <asm/atomic.h> 12#include <linux/atomic.h>
12 13
13struct flowi_common { 14struct flowi_common {
14 int flowic_oif; 15 int flowic_oif;
@@ -68,7 +69,7 @@ struct flowi4 {
68#define fl4_ipsec_spi uli.spi 69#define fl4_ipsec_spi uli.spi
69#define fl4_mh_type uli.mht.type 70#define fl4_mh_type uli.mht.type
70#define fl4_gre_key uli.gre_key 71#define fl4_gre_key uli.gre_key
71}; 72} __attribute__((__aligned__(BITS_PER_LONG/8)));
72 73
73static inline void flowi4_init_output(struct flowi4 *fl4, int oif, 74static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
74 __u32 mark, __u8 tos, __u8 scope, 75 __u32 mark, __u8 tos, __u8 scope,
@@ -112,7 +113,7 @@ struct flowi6 {
112#define fl6_ipsec_spi uli.spi 113#define fl6_ipsec_spi uli.spi
113#define fl6_mh_type uli.mht.type 114#define fl6_mh_type uli.mht.type
114#define fl6_gre_key uli.gre_key 115#define fl6_gre_key uli.gre_key
115}; 116} __attribute__((__aligned__(BITS_PER_LONG/8)));
116 117
117struct flowidn { 118struct flowidn {
118 struct flowi_common __fl_common; 119 struct flowi_common __fl_common;
@@ -127,7 +128,7 @@ struct flowidn {
127 union flowi_uli uli; 128 union flowi_uli uli;
128#define fld_sport uli.ports.sport 129#define fld_sport uli.ports.sport
129#define fld_dport uli.ports.dport 130#define fld_dport uli.ports.dport
130}; 131} __attribute__((__aligned__(BITS_PER_LONG/8)));
131 132
132struct flowi { 133struct flowi {
133 union { 134 union {
@@ -161,6 +162,24 @@ static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn)
161 return container_of(fldn, struct flowi, u.dn); 162 return container_of(fldn, struct flowi, u.dn);
162} 163}
163 164
165typedef unsigned long flow_compare_t;
166
167static inline size_t flow_key_size(u16 family)
168{
169 switch (family) {
170 case AF_INET:
171 BUILD_BUG_ON(sizeof(struct flowi4) % sizeof(flow_compare_t));
172 return sizeof(struct flowi4) / sizeof(flow_compare_t);
173 case AF_INET6:
174 BUILD_BUG_ON(sizeof(struct flowi6) % sizeof(flow_compare_t));
175 return sizeof(struct flowi6) / sizeof(flow_compare_t);
176 case AF_DECnet:
177 BUILD_BUG_ON(sizeof(struct flowidn) % sizeof(flow_compare_t));
178 return sizeof(struct flowidn) / sizeof(flow_compare_t);
179 }
180 return 0;
181}
182
164#define FLOW_DIR_IN 0 183#define FLOW_DIR_IN 0
165#define FLOW_DIR_OUT 1 184#define FLOW_DIR_OUT 1
166#define FLOW_DIR_FWD 2 185#define FLOW_DIR_FWD 2
@@ -188,6 +207,7 @@ extern struct flow_cache_object *flow_cache_lookup(
188 u8 dir, flow_resolve_t resolver, void *ctx); 207 u8 dir, flow_resolve_t resolver, void *ctx);
189 208
190extern void flow_cache_flush(void); 209extern void flow_cache_flush(void);
210extern void flow_cache_flush_deferred(void);
191extern atomic_t flow_cache_genid; 211extern atomic_t flow_cache_genid;
192 212
193#endif 213#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index d420f28b6d6..82d8d09faa4 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 */
169static 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 */
187static 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/if_inet6.h b/include/net/if_inet6.h
index 11cf373970a..51a7031b4aa 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -41,6 +41,7 @@ struct inet6_ifaddr {
41 struct in6_addr addr; 41 struct in6_addr addr;
42 __u32 prefix_len; 42 __u32 prefix_len;
43 43
44 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
44 __u32 valid_lft; 45 __u32 valid_lft;
45 __u32 prefered_lft; 46 __u32 prefered_lft;
46 atomic_t refcnt; 47 atomic_t refcnt;
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index e9c2ed8af86..808fc5f76b0 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -33,7 +33,7 @@
33#include <net/tcp_states.h> 33#include <net/tcp_states.h>
34#include <net/netns/hash.h> 34#include <net/netns/hash.h>
35 35
36#include <asm/atomic.h> 36#include <linux/atomic.h>
37#include <asm/byteorder.h> 37#include <asm/byteorder.h>
38 38
39/* This is for all connections with a full identity, no wildcards. 39/* This is for all connections with a full identity, no wildcards.
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index caaff5f5f39..b897d6e6d0a 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -238,7 +238,7 @@ static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
238{ 238{
239 __u8 flags = 0; 239 __u8 flags = 0;
240 240
241 if (inet_sk(sk)->transparent) 241 if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl)
242 flags |= FLOWI_FLAG_ANYSRC; 242 flags |= FLOWI_FLAG_ANYSRC;
243 if (sk->sk_protocol == IPPROTO_TCP) 243 if (sk->sk_protocol == IPPROTO_TCP)
244 flags |= FLOWI_FLAG_PRECOW_METRICS; 244 flags |= FLOWI_FLAG_PRECOW_METRICS;
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 17404b5388a..f1a770977c4 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -28,7 +28,7 @@
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <net/timewait_sock.h> 29#include <net/timewait_sock.h>
30 30
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32 32
33struct inet_hashinfo; 33struct inet_hashinfo;
34 34
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 8a159cc3d68..e9ff3fc5e68 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -13,7 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/rtnetlink.h> 14#include <linux/rtnetlink.h>
15#include <net/ipv6.h> 15#include <net/ipv6.h>
16#include <asm/atomic.h> 16#include <linux/atomic.h>
17 17
18struct inetpeer_addr_base { 18struct inetpeer_addr_base {
19 union { 19 union {
@@ -32,13 +32,18 @@ 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 int redirect_genid;
39 unsigned long rate_last;
40 unsigned long pmtu_expires;
41 u32 pmtu_orig;
42 u32 pmtu_learned;
43 struct inetpeer_addr_base redirect_learned;
39 /* 44 /*
40 * Once inet_peer is queued for deletion (refcnt == -1), following fields 45 * 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 46 * 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. 47 * We can share memory with rcu_head to help keep inet_peer small.
43 */ 48 */
44 union { 49 union {
@@ -47,16 +52,14 @@ struct inet_peer {
47 atomic_t ip_id_count; /* IP ID for the next packet */ 52 atomic_t ip_id_count; /* IP ID for the next packet */
48 __u32 tcp_ts; 53 __u32 tcp_ts;
49 __u32 tcp_ts_stamp; 54 __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 }; 55 };
58 struct rcu_head rcu; 56 struct rcu_head rcu;
57 struct inet_peer *gc_next;
59 }; 58 };
59
60 /* following fields might be frequently dirtied */
61 __u32 dtime; /* the time of last use of not referenced entries */
62 atomic_t refcnt;
60}; 63};
61 64
62void inet_initpeers(void) __init; 65void inet_initpeers(void) __init;
@@ -69,7 +72,7 @@ static inline bool inet_metrics_new(const struct inet_peer *p)
69} 72}
70 73
71/* can be called with or without local BH being disabled */ 74/* can be called with or without local BH being disabled */
72struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); 75struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create);
73 76
74static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) 77static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
75{ 78{
@@ -104,11 +107,18 @@ static inline void inet_peer_refcheck(const struct inet_peer *p)
104 107
105 108
106/* can be called with or without local BH being disabled */ 109/* can be called with or without local BH being disabled */
107static inline __u16 inet_getid(struct inet_peer *p, int more) 110static inline int inet_getid(struct inet_peer *p, int more)
108{ 111{
112 int old, new;
109 more++; 113 more++;
110 inet_peer_refcheck(p); 114 inet_peer_refcheck(p);
111 return atomic_add_return(more, &p->ip_id_count) - more; 115 do {
116 old = atomic_read(&p->ip_id_count);
117 new = old + more;
118 if (!new)
119 new = 1;
120 } while (atomic_cmpxchg(&p->ip_id_count, old, new) != old);
121 return new;
112} 122}
113 123
114#endif /* _NET_INETPEER_H */ 124#endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 66dd4914920..aa76c7a4d9c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -228,8 +228,6 @@ extern struct ctl_path net_ipv4_ctl_path[];
228extern int inet_peer_threshold; 228extern int inet_peer_threshold;
229extern int inet_peer_minttl; 229extern int inet_peer_minttl;
230extern int inet_peer_maxttl; 230extern int inet_peer_maxttl;
231extern int inet_peer_gc_mintime;
232extern int inet_peer_gc_maxtime;
233 231
234/* From ip_output.c */ 232/* From ip_output.c */
235extern int sysctl_ip_dynaddr; 233extern int sysctl_ip_dynaddr;
@@ -238,6 +236,11 @@ extern void ipfrag_init(void);
238 236
239extern void ip_static_sysctl_init(void); 237extern void ip_static_sysctl_init(void);
240 238
239static 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
407int ip_defrag(struct sk_buff *skb, u32 user); 411int ip_defrag(struct sk_buff *skb, u32 user);
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 477ef75f387..5735a0f979c 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 481f856c650..8fa4430f99c 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -13,7 +13,7 @@
13#include <linux/sysctl.h> /* for ctl_path */ 13#include <linux/sysctl.h> /* for ctl_path */
14#include <linux/list.h> /* for struct list_head */ 14#include <linux/list.h> /* for struct list_head */
15#include <linux/spinlock.h> /* for struct rwlock_t */ 15#include <linux/spinlock.h> /* for struct rwlock_t */
16#include <asm/atomic.h> /* for struct atomic_t */ 16#include <linux/atomic.h> /* for struct atomic_t */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19 19
@@ -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 */
@@ -902,6 +900,7 @@ struct netns_ipvs {
902 volatile int sync_state; 900 volatile int sync_state;
903 volatile int master_syncid; 901 volatile int master_syncid;
904 volatile int backup_syncid; 902 volatile int backup_syncid;
903 struct mutex sync_mutex;
905 /* multicast interface name */ 904 /* multicast interface name */
906 char master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 905 char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
907 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 906 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
@@ -1089,19 +1088,19 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1089/* 1088/*
1090 * IPVS netns init & cleanup functions 1089 * IPVS netns init & cleanup functions
1091 */ 1090 */
1092extern int __ip_vs_estimator_init(struct net *net); 1091extern int ip_vs_estimator_net_init(struct net *net);
1093extern int __ip_vs_control_init(struct net *net); 1092extern int ip_vs_control_net_init(struct net *net);
1094extern int __ip_vs_protocol_init(struct net *net); 1093extern int ip_vs_protocol_net_init(struct net *net);
1095extern int __ip_vs_app_init(struct net *net); 1094extern int ip_vs_app_net_init(struct net *net);
1096extern int __ip_vs_conn_init(struct net *net); 1095extern int ip_vs_conn_net_init(struct net *net);
1097extern int __ip_vs_sync_init(struct net *net); 1096extern int ip_vs_sync_net_init(struct net *net);
1098extern void __ip_vs_conn_cleanup(struct net *net); 1097extern void ip_vs_conn_net_cleanup(struct net *net);
1099extern void __ip_vs_app_cleanup(struct net *net); 1098extern void ip_vs_app_net_cleanup(struct net *net);
1100extern void __ip_vs_protocol_cleanup(struct net *net); 1099extern void ip_vs_protocol_net_cleanup(struct net *net);
1101extern void __ip_vs_control_cleanup(struct net *net); 1100extern void ip_vs_control_net_cleanup(struct net *net);
1102extern void __ip_vs_estimator_cleanup(struct net *net); 1101extern void ip_vs_estimator_net_cleanup(struct net *net);
1103extern void __ip_vs_sync_cleanup(struct net *net); 1102extern void ip_vs_sync_net_cleanup(struct net *net);
1104extern void __ip_vs_service_cleanup(struct net *net); 1103extern void ip_vs_service_net_cleanup(struct net *net);
1105 1104
1106/* 1105/*
1107 * IPVS application functions 1106 * IPVS application functions
@@ -1119,8 +1118,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
1119 1118
1120extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1119extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1121extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); 1120extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1122extern int ip_vs_app_init(void);
1123extern void ip_vs_app_cleanup(void);
1124 1121
1125void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); 1122void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
1126void ip_vs_unbind_pe(struct ip_vs_service *svc); 1123void ip_vs_unbind_pe(struct ip_vs_service *svc);
@@ -1223,15 +1220,11 @@ extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
1223 __u8 syncid); 1220 __u8 syncid);
1224extern int stop_sync_thread(struct net *net, int state); 1221extern int stop_sync_thread(struct net *net, int state);
1225extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); 1222extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp);
1226extern int ip_vs_sync_init(void);
1227extern void ip_vs_sync_cleanup(void);
1228 1223
1229 1224
1230/* 1225/*
1231 * IPVS rate estimator prototypes (from ip_vs_est.c) 1226 * IPVS rate estimator prototypes (from ip_vs_est.c)
1232 */ 1227 */
1233extern int ip_vs_estimator_init(void);
1234extern void ip_vs_estimator_cleanup(void);
1235extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1228extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1236extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1229extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1237extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1230extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c033ed00df7..3b5ac1fbff3 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
466static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr) 466extern 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/lib80211.h b/include/net/lib80211.h
index 848cce1bb7a..b95bbb083ee 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -26,7 +26,7 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <linux/if.h> 30#include <linux/if.h>
31#include <linux/skbuff.h> 31#include <linux/skbuff.h>
32#include <linux/ieee80211.h> 32#include <linux/ieee80211.h>
diff --git a/include/net/llc.h b/include/net/llc.h
index 5503b74ab17..226c846cab0 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -20,7 +20,7 @@
20#include <linux/hash.h> 20#include <linux/hash.h>
21#include <linux/jhash.h> 21#include <linux/jhash.h>
22 22
23#include <asm/atomic.h> 23#include <linux/atomic.h>
24 24
25struct net_device; 25struct net_device;
26struct packet_type; 26struct packet_type;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e6d6a66a8f7..9259e97864d 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 */
202enum 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 */
972enum 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 */
1596enum 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 */
1864struct ieee80211_ops { 1918struct 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 *
2550ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2622ieee80211_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 */
2633void 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 */
2647static 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 */
2668void 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 */
2682void 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 */
2694struct 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 */
2723void 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 */
2565void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, 2742void 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 */
2752void 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 */
3037void 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);
2870void ieee80211_connection_loss(struct ieee80211_vif *vif); 3084void 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 */
3107void 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 */
3163unsigned 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 */
2966void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); 3213void 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 */
3229void 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
3417void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
3418 int rssi_min_thold,
3419 int rssi_max_thold);
3420
3421void 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 4014b623880..2720884287c 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -16,7 +16,7 @@
16 * - Add neighbour cache statistics like rtstat 16 * - Add neighbour cache statistics like rtstat
17 */ 17 */
18 18
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/rcupdate.h> 22#include <linux/rcupdate.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
119struct neigh_ops { 119struct 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
129struct pneigh_entry { 127struct pneigh_entry {
@@ -142,7 +140,7 @@ struct pneigh_entry {
142 140
143struct neigh_hash_table { 141struct 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);
206extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); 204extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev);
207extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); 205extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
208extern int neigh_resolve_output(struct sk_buff *skb); 206extern int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb);
209extern int neigh_connected_output(struct sk_buff *skb); 207extern int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb);
210extern int neigh_compat_output(struct sk_buff *skb); 208extern int neigh_compat_output(struct neighbour *neigh, struct sk_buff *skb);
209extern int neigh_direct_output(struct neighbour *neigh, struct sk_buff *skb);
211extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, 210extern 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
346static 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
347static inline struct neighbour * 355static inline struct neighbour *
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index aef430d779b..3bb6fa0eace 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -4,7 +4,7 @@
4#ifndef __NET_NET_NAMESPACE_H 4#ifndef __NET_NET_NAMESPACE_H
5#define __NET_NET_NAMESPACE_H 5#define __NET_NET_NAMESPACE_H
6 6
7#include <asm/atomic.h> 7#include <linux/atomic.h>
8#include <linux/workqueue.h> 8#include <linux/workqueue.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/sysctl.h> 10#include <linux/sysctl.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/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 5d4f8e586e3..0b7f05e4a92 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -16,7 +16,7 @@
16 16
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21#include <linux/netfilter/nf_conntrack_tcp.h> 21#include <linux/netfilter/nf_conntrack_tcp.h>
22#include <linux/netfilter/nf_conntrack_dccp.h> 22#include <linux/netfilter/nf_conntrack_dccp.h>
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 9db401a8b4d..f67440970d7 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -4,7 +4,7 @@
4 * The NetLabel system manages static and dynamic label mappings for network 4 * The NetLabel system manages static and dynamic label mappings for network
5 * protocols such as CIPSO and RIPSO. 5 * protocols such as CIPSO and RIPSO.
6 * 6 *
7 * Author: Paul Moore <paul.moore@hp.com> 7 * Author: Paul Moore <paul@paul-moore.com>
8 * 8 *
9 */ 9 */
10 10
@@ -38,7 +38,7 @@
38#include <linux/in6.h> 38#include <linux/in6.h>
39#include <net/netlink.h> 39#include <net/netlink.h>
40#include <net/request_sock.h> 40#include <net/request_sock.h>
41#include <asm/atomic.h> 41#include <linux/atomic.h>
42 42
43struct cipso_v4_doi; 43struct cipso_v4_doi;
44 44
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 02740a94f10..98c185441be 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 */
656static inline void
657nl_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/netns/conntrack.h b/include/net/netns/conntrack.h
index 341eb089349..0249399e51a 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h> 5#include <linux/list_nulls.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7 7
8struct ctl_table_header; 8struct ctl_table_header;
9struct nf_conntrack_ecache; 9struct nf_conntrack_ecache;
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 3419bf5cd15..d55f4344333 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -41,6 +41,7 @@ static inline void *net_generic(const struct net *net, int id)
41 ptr = ng->ptr[id - 1]; 41 ptr = ng->ptr[id - 1];
42 rcu_read_unlock(); 42 rcu_read_unlock();
43 43
44 BUG_ON(!ptr);
44 return ptr; 45 return ptr;
45} 46}
46#endif 47#endif
diff --git a/include/net/nfc.h b/include/net/nfc.h
new file mode 100644
index 00000000000..cc0130312f7
--- /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
34struct 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 */
47typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
48 int err);
49
50struct 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
61struct nfc_target {
62 u32 idx;
63 u32 supported_protocols;
64 u16 sens_res;
65 u8 sel_res;
66};
67
68struct nfc_genl_data {
69 u32 poll_req_pid;
70 struct mutex genl_data_mutex;
71};
72
73struct 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
89extern struct class nfc_class;
90
91struct 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 */
99static inline void nfc_free_device(struct nfc_dev *dev)
100{
101 put_device(&dev->dev);
102}
103
104int nfc_register_device(struct nfc_dev *dev);
105
106void 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 */
114static 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 */
126static 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 */
136static 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 */
146static inline const char *nfc_device_name(struct nfc_dev *dev)
147{
148 return dev_name(&dev->dev);
149}
150
151struct sk_buff *nfc_alloc_skb(unsigned int size, gfp_t gfp);
152
153int 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 65afc496620..fffdc603f4c 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
102extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, 102extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
103 struct tcf_result *res); 103 struct tcf_result *res);
104extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 104extern 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/red.h b/include/net/red.h
index 3319f16b3be..b72a3b83393 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -116,7 +116,7 @@ struct red_parms {
116 u32 qR; /* Cached random number */ 116 u32 qR; /* Cached random number */
117 117
118 unsigned long qavg; /* Average queue length: A scaled */ 118 unsigned long qavg; /* Average queue length: A scaled */
119 psched_time_t qidlestart; /* Start of current idle period */ 119 ktime_t qidlestart; /* Start of current idle period */
120}; 120};
121 121
122static inline u32 red_rmask(u8 Plog) 122static inline u32 red_rmask(u8 Plog)
@@ -148,17 +148,17 @@ static inline void red_set_parms(struct red_parms *p,
148 148
149static inline int red_is_idling(struct red_parms *p) 149static inline int red_is_idling(struct red_parms *p)
150{ 150{
151 return p->qidlestart != PSCHED_PASTPERFECT; 151 return p->qidlestart.tv64 != 0;
152} 152}
153 153
154static inline void red_start_of_idle_period(struct red_parms *p) 154static inline void red_start_of_idle_period(struct red_parms *p)
155{ 155{
156 p->qidlestart = psched_get_time(); 156 p->qidlestart = ktime_get();
157} 157}
158 158
159static inline void red_end_of_idle_period(struct red_parms *p) 159static inline void red_end_of_idle_period(struct red_parms *p)
160{ 160{
161 p->qidlestart = PSCHED_PASTPERFECT; 161 p->qidlestart.tv64 = 0;
162} 162}
163 163
164static inline void red_restart(struct red_parms *p) 164static inline void red_restart(struct red_parms *p)
@@ -170,13 +170,10 @@ static inline void red_restart(struct red_parms *p)
170 170
171static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) 171static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
172{ 172{
173 psched_time_t now; 173 s64 delta = ktime_us_delta(ktime_get(), p->qidlestart);
174 long us_idle; 174 long us_idle = min_t(s64, delta, p->Scell_max);
175 int shift; 175 int shift;
176 176
177 now = psched_get_time();
178 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
179
180 /* 177 /*
181 * The problem: ideally, average length queue recalcultion should 178 * The problem: ideally, average length queue recalcultion should
182 * be done over constant clock intervals. This is too expensive, so 179 * be done over constant clock intervals. This is too expensive, so
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 99e6e19b57c..4c0766e201e 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -96,7 +96,8 @@ extern int sysctl_max_syn_backlog;
96 */ 96 */
97struct listen_sock { 97struct listen_sock {
98 u8 max_qlen_log; 98 u8 max_qlen_log;
99 /* 3 bytes hole, try to use */ 99 u8 synflood_warned;
100 /* 2 bytes hole, try to use */
100 int qlen; 101 int qlen;
101 int qlen_young; 102 int qlen_young;
102 int clock_hand; 103 int clock_hand;
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 4093ca78cf6..678f1ffaf84 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,11 +6,14 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *);
9 10
10extern int __rtnl_register(int protocol, int msgtype, 11extern 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);
12extern void rtnl_register(int protocol, int msgtype, 14extern 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);
14extern int rtnl_unregister(int protocol, int msgtype); 17extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol); 18extern void rtnl_unregister_all(int protocol);
16 19
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b931f021d7a..4fc88f3ccd5 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
220struct qdisc_skb_cb { 222struct qdisc_skb_cb {
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 6506458ccd3..712b3bebeda 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -109,6 +109,7 @@ typedef enum {
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */ 109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ 110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
111 SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/ 111 SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
112 SCTP_CMD_SET_ASOC, /* Restore association context */
112 SCTP_CMD_LAST 113 SCTP_CMD_LAST
113} sctp_verb_t; 114} sctp_verb_t;
114 115
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index b2c2366676a..6a72a58cde5 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);
121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
122extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 122extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
123extern 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);
134void sctp_copy_sock(struct sock *newsk, struct sock *sk, 135void sctp_copy_sock(struct sock *newsk, struct sock *sk,
135 struct sctp_association *asoc); 136 struct sctp_association *asoc);
136extern struct percpu_counter sctp_sockets_allocated; 137extern struct percpu_counter sctp_sockets_allocated;
138extern 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...) \
289do { \ 291do { \
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 7df327a6d56..ec86952fb57 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -60,7 +60,7 @@
60#include <linux/in6.h> /* We get struct in6_addr */ 60#include <linux/in6.h> /* We get struct in6_addr */
61#include <linux/ipv6.h> 61#include <linux/ipv6.h>
62#include <asm/param.h> /* We get MAXHOSTNAMELEN. */ 62#include <asm/param.h> /* We get MAXHOSTNAMELEN. */
63#include <asm/atomic.h> /* This gets us atomic counters. */ 63#include <linux/atomic.h> /* This gets us atomic counters. */
64#include <linux/skbuff.h> /* We need sk_buff_head. */ 64#include <linux/skbuff.h> /* We need sk_buff_head. */
65#include <linux/workqueue.h> /* We need tq_struct. */ 65#include <linux/workqueue.h> /* We need tq_struct. */
66#include <linux/sctp.h> /* We need sctp* header structs. */ 66#include <linux/sctp.h> /* We need sctp* header structs. */
@@ -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;
@@ -236,6 +241,9 @@ extern struct sctp_globals {
236 * bits is an indicator of when to send and window update SACK. 241 * bits is an indicator of when to send and window update SACK.
237 */ 242 */
238 int rwnd_update_shift; 243 int rwnd_update_shift;
244
245 /* Threshold for autoclose timeout, in seconds. */
246 unsigned long max_autoclose;
239} sctp_globals; 247} sctp_globals;
240 248
241#define sctp_rto_initial (sctp_globals.rto_initial) 249#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -264,6 +272,11 @@ extern struct sctp_globals {
264#define sctp_port_hashtable (sctp_globals.port_hashtable) 272#define sctp_port_hashtable (sctp_globals.port_hashtable)
265#define sctp_local_addr_list (sctp_globals.local_addr_list) 273#define sctp_local_addr_list (sctp_globals.local_addr_list)
266#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 274#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
275#define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist)
276#define sctp_addr_waitq (sctp_globals.addr_waitq)
277#define sctp_addr_wq_timer (sctp_globals.addr_wq_timer)
278#define sctp_addr_wq_lock (sctp_globals.addr_wq_lock)
279#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf)
267#define sctp_scope_policy (sctp_globals.ipv4_scope_policy) 280#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
268#define sctp_addip_enable (sctp_globals.addip_enable) 281#define sctp_addip_enable (sctp_globals.addip_enable)
269#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 282#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
@@ -271,6 +284,7 @@ extern struct sctp_globals {
271#define sctp_auth_enable (sctp_globals.auth_enable) 284#define sctp_auth_enable (sctp_globals.auth_enable)
272#define sctp_checksum_disable (sctp_globals.checksum_disable) 285#define sctp_checksum_disable (sctp_globals.checksum_disable)
273#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift) 286#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
287#define sctp_max_autoclose (sctp_globals.max_autoclose)
274 288
275/* SCTP Socket type: UDP or TCP style. */ 289/* SCTP Socket type: UDP or TCP style. */
276typedef enum { 290typedef enum {
@@ -341,6 +355,8 @@ struct sctp_sock {
341 atomic_t pd_mode; 355 atomic_t pd_mode;
342 /* Receive to here while partial delivery is in effect. */ 356 /* Receive to here while partial delivery is in effect. */
343 struct sk_buff_head pd_lobby; 357 struct sk_buff_head pd_lobby;
358 struct list_head auto_asconf_list;
359 int do_auto_asconf;
344}; 360};
345 361
346static inline struct sctp_sock *sctp_sk(const struct sock *sk) 362static inline struct sctp_sock *sctp_sk(const struct sock *sk)
@@ -792,6 +808,8 @@ struct sctp_sockaddr_entry {
792 __u8 valid; 808 __u8 valid;
793}; 809};
794 810
811#define SCTP_ADDRESS_TICK_DELAY 500
812
795typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); 813typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *);
796 814
797/* This structure holds lists of chunks as we are assembling for 815/* This structure holds lists of chunks as we are assembling for
@@ -1236,6 +1254,7 @@ sctp_scope_t sctp_scope(const union sctp_addr *);
1236int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1254int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
1237int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1255int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1238int sctp_addr_is_valid(const union sctp_addr *addr); 1256int sctp_addr_is_valid(const union sctp_addr *addr);
1257int sctp_is_ep_boundall(struct sock *sk);
1239 1258
1240 1259
1241/* What type of endpoint? */ 1260/* What type of endpoint? */
@@ -1898,6 +1917,8 @@ struct sctp_association {
1898 * after reaching 4294967295. 1917 * after reaching 4294967295.
1899 */ 1918 */
1900 __u32 addip_serial; 1919 __u32 addip_serial;
1920 union sctp_addr *asconf_addr_del_pending;
1921 int src_out_of_asoc_ok;
1901 1922
1902 /* SCTP AUTH: list of the endpoint shared keys. These 1923 /* SCTP AUTH: list of the endpoint shared keys. These
1903 * keys are provided out of band by the user applicaton 1924 * 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 32fd5127403..0842ef00b2f 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/secure_seq.h b/include/net/secure_seq.h
new file mode 100644
index 00000000000..d97f6892c01
--- /dev/null
+++ b/include/net/secure_seq.h
@@ -0,0 +1,20 @@
1#ifndef _NET_SECURE_SEQ
2#define _NET_SECURE_SEQ
3
4#include <linux/types.h>
5
6extern __u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ipv6_id(const __be32 daddr[4]);
8extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10 __be16 dport);
11extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
12 __be16 sport, __be16 dport);
13extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
14 __be16 sport, __be16 dport);
15extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
16 __be16 sport, __be16 dport);
17extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
18 __be16 sport, __be16 dport);
19
20#endif /* _NET_SECURE_SEQ */
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 479083a78b0..8f0f9ac0307 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 c0b938cb4b1..8e4062f165b 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
567static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 569static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -1301,8 +1303,7 @@ extern unsigned long sock_i_ino(struct sock *sk);
1301static inline struct dst_entry * 1303static 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 cda30ea354a..4fcd77af405 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)
295static inline int tcp_synq_no_recent_overflow(const struct sock *sk) 301static 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
301extern struct proto tcp_prot; 307extern struct proto tcp_prot;
@@ -425,17 +431,34 @@ extern int tcp_disconnect(struct sock *sk, int flags);
425extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 431extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
426extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 432extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
427 struct ip_options *opt); 433 struct ip_options *opt);
434#ifdef CONFIG_SYN_COOKIES
428extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 435extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
429 __u16 *mss); 436 __u16 *mss);
437#else
438static inline __u32 cookie_v4_init_sequence(struct sock *sk,
439 struct sk_buff *skb,
440 __u16 *mss)
441{
442 return 0;
443}
444#endif
430 445
431extern __u32 cookie_init_timestamp(struct request_sock *req); 446extern __u32 cookie_init_timestamp(struct request_sock *req);
432extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); 447extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *);
433 448
434/* From net/ipv6/syncookies.c */ 449/* From net/ipv6/syncookies.c */
435extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 450extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
451#ifdef CONFIG_SYN_COOKIES
436extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, 452extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb,
437 __u16 *mss); 453 __u16 *mss);
438 454#else
455static inline __u32 cookie_v6_init_sequence(struct sock *sk,
456 struct sk_buff *skb,
457 __u16 *mss)
458{
459 return 0;
460}
461#endif
439/* tcp_output.c */ 462/* tcp_output.c */
440 463
441extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 464extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
@@ -454,6 +477,9 @@ extern int tcp_write_wakeup(struct sock *);
454extern void tcp_send_fin(struct sock *sk); 477extern void tcp_send_fin(struct sock *sk);
455extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 478extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
456extern int tcp_send_synack(struct sock *); 479extern int tcp_send_synack(struct sock *);
480extern int tcp_syn_flood_action(struct sock *sk,
481 const struct sk_buff *skb,
482 const char *proto);
457extern void tcp_push_one(struct sock *, unsigned int mss_now); 483extern void tcp_push_one(struct sock *, unsigned int mss_now);
458extern void tcp_send_ack(struct sock *sk); 484extern void tcp_send_ack(struct sock *sk);
459extern void tcp_send_delayed_ack(struct sock *sk); 485extern void tcp_send_delayed_ack(struct sock *sk);
@@ -508,6 +534,7 @@ extern void tcp_initialize_rcv_mss(struct sock *sk);
508extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); 534extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
509extern int tcp_mss_to_mtu(struct sock *sk, int mss); 535extern int tcp_mss_to_mtu(struct sock *sk, int mss);
510extern void tcp_mtup_init(struct sock *sk); 536extern void tcp_mtup_init(struct sock *sk);
537extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
511 538
512static inline void tcp_bound_rto(const struct sock *sk) 539static inline void tcp_bound_rto(const struct sock *sk)
513{ 540{
@@ -1404,6 +1431,8 @@ extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1404extern int tcp_gro_complete(struct sk_buff *skb); 1431extern int tcp_gro_complete(struct sk_buff *skb);
1405extern int tcp4_gro_complete(struct sk_buff *skb); 1432extern int tcp4_gro_complete(struct sk_buff *skb);
1406 1433
1434extern int tcp_nuke_addr(struct net *net, struct sockaddr *addr);
1435
1407#ifdef CONFIG_PROC_FS 1436#ifdef CONFIG_PROC_FS
1408extern int tcp4_proc_init(void); 1437extern int tcp4_proc_init(void);
1409extern void tcp4_proc_exit(void); 1438extern void tcp4_proc_exit(void);
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 5271a741c3a..498433dd067 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -39,6 +39,7 @@ extern int datagram_recv_ctl(struct sock *sk,
39 struct sk_buff *skb); 39 struct sk_buff *skb);
40 40
41extern int datagram_send_ctl(struct net *net, 41extern int datagram_send_ctl(struct net *net,
42 struct sock *sk,
42 struct msghdr *msg, 43 struct msghdr *msg,
43 struct flowi6 *fl6, 44 struct flowi6 *fl6,
44 struct ipv6_txoptions *opt, 45 struct ipv6_txoptions *opt,
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 673a024c6b2..5f097ca7d5c 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -66,40 +66,34 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
66 return 0; 66 return 0;
67} 67}
68 68
69static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) 69/* Slow-path computation of checksum. Socket is locked. */
70static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
70{ 71{
72 const struct udp_sock *up = udp_sk(skb->sk);
71 int cscov = up->len; 73 int cscov = up->len;
74 __wsum csum = 0;
72 75
73 /* 76 if (up->pcflag & UDPLITE_SEND_CC) {
74 * Sender has set `partial coverage' option on UDP-Lite socket 77 /*
75 */ 78 * Sender has set `partial coverage' option on UDP-Lite socket.
76 if (up->pcflag & UDPLITE_SEND_CC) { 79 * The special case "up->pcslen == 0" signifies full coverage.
80 */
77 if (up->pcslen < up->len) { 81 if (up->pcslen < up->len) {
78 /* up->pcslen == 0 means that full coverage is required, 82 if (0 < up->pcslen)
79 * partial coverage only if 0 < up->pcslen < up->len */ 83 cscov = up->pcslen;
80 if (0 < up->pcslen) { 84 udp_hdr(skb)->len = htons(up->pcslen);
81 cscov = up->pcslen;
82 }
83 uh->len = htons(up->pcslen);
84 } 85 }
85 /* 86 /*
86 * NOTE: Causes for the error case `up->pcslen > up->len': 87 * NOTE: Causes for the error case `up->pcslen > up->len':
87 * (i) Application error (will not be penalized). 88 * (i) Application error (will not be penalized).
88 * (ii) Payload too big for send buffer: data is split 89 * (ii) Payload too big for send buffer: data is split
89 * into several packets, each with its own header. 90 * into several packets, each with its own header.
90 * In this case (e.g. last segment), coverage may 91 * In this case (e.g. last segment), coverage may
91 * exceed packet length. 92 * exceed packet length.
92 * Since packets with coverage length > packet length are 93 * Since packets with coverage length > packet length are
93 * illegal, we fall back to the defaults here. 94 * illegal, we fall back to the defaults here.
94 */ 95 */
95 } 96 }
96 return cscov;
97}
98
99static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
100{
101 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
102 __wsum csum = 0;
103 97
104 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 98 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
105 99
@@ -115,16 +109,21 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
115 return csum; 109 return csum;
116} 110}
117 111
112/* Fast-path computation of checksum. Socket may not be locked. */
118static inline __wsum udplite_csum(struct sk_buff *skb) 113static inline __wsum udplite_csum(struct sk_buff *skb)
119{ 114{
120 struct sock *sk = skb->sk; 115 const struct udp_sock *up = udp_sk(skb->sk);
121 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
122 const int off = skb_transport_offset(skb); 116 const int off = skb_transport_offset(skb);
123 const int len = skb->len - off; 117 int len = skb->len - off;
124 118
119 if ((up->pcflag & UDPLITE_SEND_CC) && up->pcslen < len) {
120 if (0 < up->pcslen)
121 len = up->pcslen;
122 udp_hdr(skb)->len = htons(up->pcslen);
123 }
125 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 124 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
126 125
127 return skb_checksum(skb, off, min(cscov, len), 0); 126 return skb_checksum(skb, off, len, 0);
128} 127}
129 128
130extern void udplite4_register(void); 129extern void udplite4_register(void);
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 7328d5019d8..322ff4fbdb4 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];