diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
commit | 3dd41424090a0ca3a660218d06afe6ff4441bad3 (patch) | |
tree | 511ef1bb1799027fc5aad574adce49120ecadd87 /include/net | |
parent | 5c5456402d467969b217d7fdd6670f8c8600f5a8 (diff) | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) |
Merge commit 'v2.6.36' into wip-merge-2.6.36
Conflicts:
Makefile
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/syscall_table_32.S
kernel/sched.c
kernel/time/tick-sched.c
Relevant API and functions changes (solved in this commit):
- (API) .enqueue_task() (enqueue_task_litmus),
dequeue_task() (dequeue_task_litmus),
[litmus/sched_litmus.c]
- (API) .select_task_rq() (select_task_rq_litmus)
[litmus/sched_litmus.c]
- (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks()
[litmus/sched_trace.c]
- struct kfifo internal buffer name changed (buffer -> buf)
[litmus/sched_trace.c]
- add_wait_queue_exclusive_locked -> __add_wait_queue_tail_exclusive
[litmus/fmlp.c]
- syscall numbers for both x86_32 and x86_64
Diffstat (limited to 'include/net')
89 files changed, 3178 insertions, 881 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index a7fb54808a23..a8de812ccbc8 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -86,6 +86,18 @@ do { \ | |||
86 | 86 | ||
87 | /** | 87 | /** |
88 | * enum p9_msg_t - 9P message types | 88 | * enum p9_msg_t - 9P message types |
89 | * @P9_TSTATFS: file system status request | ||
90 | * @P9_RSTATFS: file system status response | ||
91 | * @P9_TSYMLINK: make symlink request | ||
92 | * @P9_RSYMLINK: make symlink response | ||
93 | * @P9_TMKNOD: create a special file object request | ||
94 | * @P9_RMKNOD: create a special file object response | ||
95 | * @P9_TLCREATE: prepare a handle for I/O on an new file for 9P2000.L | ||
96 | * @P9_RLCREATE: response with file access information for 9P2000.L | ||
97 | * @P9_TRENAME: rename request | ||
98 | * @P9_RRENAME: rename response | ||
99 | * @P9_TMKDIR: create a directory request | ||
100 | * @P9_RMKDIR: create a directory response | ||
89 | * @P9_TVERSION: version handshake request | 101 | * @P9_TVERSION: version handshake request |
90 | * @P9_RVERSION: version handshake response | 102 | * @P9_RVERSION: version handshake response |
91 | * @P9_TAUTH: request to establish authentication channel | 103 | * @P9_TAUTH: request to establish authentication channel |
@@ -125,6 +137,32 @@ do { \ | |||
125 | */ | 137 | */ |
126 | 138 | ||
127 | enum p9_msg_t { | 139 | enum p9_msg_t { |
140 | P9_TSTATFS = 8, | ||
141 | P9_RSTATFS, | ||
142 | P9_TLOPEN = 12, | ||
143 | P9_RLOPEN, | ||
144 | P9_TLCREATE = 14, | ||
145 | P9_RLCREATE, | ||
146 | P9_TSYMLINK = 16, | ||
147 | P9_RSYMLINK, | ||
148 | P9_TMKNOD = 18, | ||
149 | P9_RMKNOD, | ||
150 | P9_TRENAME = 20, | ||
151 | P9_RRENAME, | ||
152 | P9_TGETATTR = 24, | ||
153 | P9_RGETATTR, | ||
154 | P9_TSETATTR = 26, | ||
155 | P9_RSETATTR, | ||
156 | P9_TXATTRWALK = 30, | ||
157 | P9_RXATTRWALK, | ||
158 | P9_TXATTRCREATE = 32, | ||
159 | P9_RXATTRCREATE, | ||
160 | P9_TREADDIR = 40, | ||
161 | P9_RREADDIR, | ||
162 | P9_TLINK = 70, | ||
163 | P9_RLINK, | ||
164 | P9_TMKDIR = 72, | ||
165 | P9_RMKDIR, | ||
128 | P9_TVERSION = 100, | 166 | P9_TVERSION = 100, |
129 | P9_RVERSION, | 167 | P9_RVERSION, |
130 | P9_TAUTH = 102, | 168 | P9_TAUTH = 102, |
@@ -267,6 +305,9 @@ enum p9_qid_t { | |||
267 | /* ample room for Twrite/Rread header */ | 305 | /* ample room for Twrite/Rread header */ |
268 | #define P9_IOHDRSZ 24 | 306 | #define P9_IOHDRSZ 24 |
269 | 307 | ||
308 | /* Room for readdir header */ | ||
309 | #define P9_READDIRHDRSZ 24 | ||
310 | |||
270 | /** | 311 | /** |
271 | * struct p9_str - length prefixed string type | 312 | * struct p9_str - length prefixed string type |
272 | * @len: length of the string | 313 | * @len: length of the string |
@@ -349,7 +390,100 @@ struct p9_wstat { | |||
349 | u32 n_muid; /* 9p2000.u extensions */ | 390 | u32 n_muid; /* 9p2000.u extensions */ |
350 | }; | 391 | }; |
351 | 392 | ||
393 | struct p9_stat_dotl { | ||
394 | u64 st_result_mask; | ||
395 | struct p9_qid qid; | ||
396 | u32 st_mode; | ||
397 | u32 st_uid; | ||
398 | u32 st_gid; | ||
399 | u64 st_nlink; | ||
400 | u64 st_rdev; | ||
401 | u64 st_size; | ||
402 | u64 st_blksize; | ||
403 | u64 st_blocks; | ||
404 | u64 st_atime_sec; | ||
405 | u64 st_atime_nsec; | ||
406 | u64 st_mtime_sec; | ||
407 | u64 st_mtime_nsec; | ||
408 | u64 st_ctime_sec; | ||
409 | u64 st_ctime_nsec; | ||
410 | u64 st_btime_sec; | ||
411 | u64 st_btime_nsec; | ||
412 | u64 st_gen; | ||
413 | u64 st_data_version; | ||
414 | }; | ||
415 | |||
416 | #define P9_STATS_MODE 0x00000001ULL | ||
417 | #define P9_STATS_NLINK 0x00000002ULL | ||
418 | #define P9_STATS_UID 0x00000004ULL | ||
419 | #define P9_STATS_GID 0x00000008ULL | ||
420 | #define P9_STATS_RDEV 0x00000010ULL | ||
421 | #define P9_STATS_ATIME 0x00000020ULL | ||
422 | #define P9_STATS_MTIME 0x00000040ULL | ||
423 | #define P9_STATS_CTIME 0x00000080ULL | ||
424 | #define P9_STATS_INO 0x00000100ULL | ||
425 | #define P9_STATS_SIZE 0x00000200ULL | ||
426 | #define P9_STATS_BLOCKS 0x00000400ULL | ||
427 | |||
428 | #define P9_STATS_BTIME 0x00000800ULL | ||
429 | #define P9_STATS_GEN 0x00001000ULL | ||
430 | #define P9_STATS_DATA_VERSION 0x00002000ULL | ||
431 | |||
432 | #define P9_STATS_BASIC 0x000007ffULL /* Mask for fields up to BLOCKS */ | ||
433 | #define P9_STATS_ALL 0x00003fffULL /* Mask for All fields above */ | ||
434 | |||
435 | /** | ||
436 | * struct p9_iattr_dotl - P9 inode attribute for setattr | ||
437 | * @valid: bitfield specifying which fields are valid | ||
438 | * same as in struct iattr | ||
439 | * @mode: File permission bits | ||
440 | * @uid: user id of owner | ||
441 | * @gid: group id | ||
442 | * @size: File size | ||
443 | * @atime_sec: Last access time, seconds | ||
444 | * @atime_nsec: Last access time, nanoseconds | ||
445 | * @mtime_sec: Last modification time, seconds | ||
446 | * @mtime_nsec: Last modification time, nanoseconds | ||
447 | */ | ||
448 | |||
449 | struct p9_iattr_dotl { | ||
450 | u32 valid; | ||
451 | u32 mode; | ||
452 | u32 uid; | ||
453 | u32 gid; | ||
454 | u64 size; | ||
455 | u64 atime_sec; | ||
456 | u64 atime_nsec; | ||
457 | u64 mtime_sec; | ||
458 | u64 mtime_nsec; | ||
459 | }; | ||
460 | |||
352 | /* Structures for Protocol Operations */ | 461 | /* Structures for Protocol Operations */ |
462 | struct p9_tstatfs { | ||
463 | u32 fid; | ||
464 | }; | ||
465 | |||
466 | struct p9_rstatfs { | ||
467 | u32 type; | ||
468 | u32 bsize; | ||
469 | u64 blocks; | ||
470 | u64 bfree; | ||
471 | u64 bavail; | ||
472 | u64 files; | ||
473 | u64 ffree; | ||
474 | u64 fsid; | ||
475 | u32 namelen; | ||
476 | }; | ||
477 | |||
478 | struct p9_trename { | ||
479 | u32 fid; | ||
480 | u32 newdirfid; | ||
481 | struct p9_str name; | ||
482 | }; | ||
483 | |||
484 | struct p9_rrename { | ||
485 | }; | ||
486 | |||
353 | struct p9_tversion { | 487 | struct p9_tversion { |
354 | u32 msize; | 488 | u32 msize; |
355 | struct p9_str version; | 489 | struct p9_str version; |
@@ -452,6 +586,18 @@ struct p9_rwrite { | |||
452 | u32 count; | 586 | u32 count; |
453 | }; | 587 | }; |
454 | 588 | ||
589 | struct p9_treaddir { | ||
590 | u32 fid; | ||
591 | u64 offset; | ||
592 | u32 count; | ||
593 | }; | ||
594 | |||
595 | struct p9_rreaddir { | ||
596 | u32 count; | ||
597 | u8 *data; | ||
598 | }; | ||
599 | |||
600 | |||
455 | struct p9_tclunk { | 601 | struct p9_tclunk { |
456 | u32 fid; | 602 | u32 fid; |
457 | }; | 603 | }; |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 4f3760afc20f..d1aa2cfb30f0 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
@@ -195,6 +195,23 @@ struct p9_fid { | |||
195 | struct list_head dlist; /* list of all fids attached to a dentry */ | 195 | struct list_head dlist; /* list of all fids attached to a dentry */ |
196 | }; | 196 | }; |
197 | 197 | ||
198 | /** | ||
199 | * struct p9_dirent - directory entry structure | ||
200 | * @qid: The p9 server qid for this dirent | ||
201 | * @d_off: offset to the next dirent | ||
202 | * @d_type: type of file | ||
203 | * @d_name: file name | ||
204 | */ | ||
205 | |||
206 | struct p9_dirent { | ||
207 | struct p9_qid qid; | ||
208 | u64 d_off; | ||
209 | unsigned char d_type; | ||
210 | char d_name[256]; | ||
211 | }; | ||
212 | |||
213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | ||
214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); | ||
198 | int p9_client_version(struct p9_client *); | 215 | int p9_client_version(struct p9_client *); |
199 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 216 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
200 | void p9_client_destroy(struct p9_client *clnt); | 217 | void p9_client_destroy(struct p9_client *clnt); |
@@ -209,15 +226,31 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
209 | int p9_client_open(struct p9_fid *fid, int mode); | 226 | int p9_client_open(struct p9_fid *fid, int mode); |
210 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | 227 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, |
211 | char *extension); | 228 | char *extension); |
229 | int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname); | ||
230 | int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid, | ||
231 | struct p9_qid *qid); | ||
232 | int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | ||
233 | gid_t gid, struct p9_qid *qid); | ||
212 | int p9_client_clunk(struct p9_fid *fid); | 234 | int p9_client_clunk(struct p9_fid *fid); |
213 | int p9_client_remove(struct p9_fid *fid); | 235 | int p9_client_remove(struct p9_fid *fid); |
214 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 236 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
215 | u64 offset, u32 count); | 237 | u64 offset, u32 count); |
216 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | 238 | int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, |
217 | u64 offset, u32 count); | 239 | u64 offset, u32 count); |
240 | int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset); | ||
241 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | ||
242 | int proto_version); | ||
218 | struct p9_wstat *p9_client_stat(struct p9_fid *fid); | 243 | struct p9_wstat *p9_client_stat(struct p9_fid *fid); |
219 | int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); | 244 | int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); |
245 | int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *attr); | ||
246 | |||
247 | struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, | ||
248 | u64 request_mask); | ||
220 | 249 | ||
250 | int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode, | ||
251 | dev_t rdev, gid_t gid, struct p9_qid *); | ||
252 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | ||
253 | gid_t gid, struct p9_qid *); | ||
221 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); | 254 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); |
222 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); | 255 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); |
223 | 256 | ||
@@ -227,5 +260,7 @@ void p9stat_free(struct p9_wstat *); | |||
227 | 260 | ||
228 | int p9_is_proto_dotu(struct p9_client *clnt); | 261 | int p9_is_proto_dotu(struct p9_client *clnt); |
229 | int p9_is_proto_dotl(struct p9_client *clnt); | 262 | int p9_is_proto_dotl(struct p9_client *clnt); |
263 | struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); | ||
264 | int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); | ||
230 | 265 | ||
231 | #endif /* NET_9P_CLIENT_H */ | 266 | #endif /* NET_9P_CLIENT_H */ |
diff --git a/include/net/act_api.h b/include/net/act_api.h index c05fd717c588..bab385f13ac3 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -20,6 +20,7 @@ struct tcf_common { | |||
20 | struct gnet_stats_queue tcfc_qstats; | 20 | struct gnet_stats_queue tcfc_qstats; |
21 | struct gnet_stats_rate_est tcfc_rate_est; | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
22 | spinlock_t tcfc_lock; | 22 | spinlock_t tcfc_lock; |
23 | struct rcu_head tcfc_rcu; | ||
23 | }; | 24 | }; |
24 | #define tcf_next common.tcfc_next | 25 | #define tcf_next common.tcfc_next |
25 | #define tcf_index common.tcfc_index | 26 | #define tcf_index common.tcfc_index |
@@ -32,6 +33,7 @@ struct tcf_common { | |||
32 | #define tcf_qstats common.tcfc_qstats | 33 | #define tcf_qstats common.tcfc_qstats |
33 | #define tcf_rate_est common.tcfc_rate_est | 34 | #define tcf_rate_est common.tcfc_rate_est |
34 | #define tcf_lock common.tcfc_lock | 35 | #define tcf_lock common.tcfc_lock |
36 | #define tcf_rcu common.tcfc_rcu | ||
35 | 37 | ||
36 | struct tcf_police { | 38 | struct tcf_police { |
37 | struct tcf_common common; | 39 | struct tcf_common common; |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 45375b41a2a0..4d40c4d0230b 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -121,6 +121,7 @@ static inline int addrconf_finite_timeout(unsigned long timeout) | |||
121 | * IPv6 Address Label subsystem (addrlabel.c) | 121 | * IPv6 Address Label subsystem (addrlabel.c) |
122 | */ | 122 | */ |
123 | extern int ipv6_addr_label_init(void); | 123 | extern int ipv6_addr_label_init(void); |
124 | extern void ipv6_addr_label_cleanup(void); | ||
124 | extern void ipv6_addr_label_rtnl_register(void); | 125 | extern void ipv6_addr_label_rtnl_register(void); |
125 | extern u32 ipv6_addr_label(struct net *net, | 126 | extern u32 ipv6_addr_label(struct net *net, |
126 | const struct in6_addr *addr, | 127 | const struct in6_addr *addr, |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 1614d78c60ed..90c9e2872f27 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -23,15 +23,15 @@ struct unix_address { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | struct unix_skb_parms { | 25 | struct unix_skb_parms { |
26 | struct ucred creds; /* Skb credentials */ | 26 | struct pid *pid; /* Skb credentials */ |
27 | const struct cred *cred; | ||
27 | struct scm_fp_list *fp; /* Passed files */ | 28 | struct scm_fp_list *fp; /* Passed files */ |
28 | #ifdef CONFIG_SECURITY_NETWORK | 29 | #ifdef CONFIG_SECURITY_NETWORK |
29 | u32 secid; /* Security ID */ | 30 | u32 secid; /* Security ID */ |
30 | #endif | 31 | #endif |
31 | }; | 32 | }; |
32 | 33 | ||
33 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) | 34 | #define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) |
34 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) | ||
35 | #define UNIXSID(skb) (&UNIXCB((skb)).secid) | 35 | #define UNIXSID(skb) (&UNIXCB((skb)).secid) |
36 | 36 | ||
37 | #define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) | 37 | #define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) |
@@ -45,21 +45,23 @@ struct unix_skb_parms { | |||
45 | struct unix_sock { | 45 | struct unix_sock { |
46 | /* WARNING: sk has to be the first member */ | 46 | /* WARNING: sk has to be the first member */ |
47 | struct sock sk; | 47 | struct sock sk; |
48 | struct unix_address *addr; | 48 | struct unix_address *addr; |
49 | struct dentry *dentry; | 49 | struct dentry *dentry; |
50 | struct vfsmount *mnt; | 50 | struct vfsmount *mnt; |
51 | struct mutex readlock; | 51 | struct mutex readlock; |
52 | struct sock *peer; | 52 | struct sock *peer; |
53 | struct sock *other; | 53 | struct sock *other; |
54 | struct list_head link; | 54 | struct list_head link; |
55 | atomic_long_t inflight; | 55 | atomic_long_t inflight; |
56 | spinlock_t lock; | 56 | spinlock_t lock; |
57 | unsigned int gc_candidate : 1; | 57 | unsigned int gc_candidate : 1; |
58 | unsigned int gc_maybe_cycle : 1; | 58 | unsigned int gc_maybe_cycle : 1; |
59 | wait_queue_head_t peer_wait; | 59 | struct socket_wq peer_wq; |
60 | }; | 60 | }; |
61 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 61 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
62 | 62 | ||
63 | #define peer_wait peer_wq.wait | ||
64 | |||
63 | #ifdef CONFIG_SYSCTL | 65 | #ifdef CONFIG_SYSCTL |
64 | extern int unix_sysctl_register(struct net *net); | 66 | extern int unix_sysctl_register(struct net *net); |
65 | extern void unix_sysctl_unregister(struct net *net); | 67 | extern void unix_sysctl_unregister(struct net *net); |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index ff77e8f882f1..30fce0128dd7 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -84,7 +84,7 @@ enum { | |||
84 | /* BD Address */ | 84 | /* BD Address */ |
85 | typedef struct { | 85 | typedef struct { |
86 | __u8 b[6]; | 86 | __u8 b[6]; |
87 | } __attribute__((packed)) bdaddr_t; | 87 | } __packed bdaddr_t; |
88 | 88 | ||
89 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) | 89 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) |
90 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) | 90 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) |
@@ -138,6 +138,7 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); | |||
138 | struct bt_skb_cb { | 138 | struct bt_skb_cb { |
139 | __u8 pkt_type; | 139 | __u8 pkt_type; |
140 | __u8 incoming; | 140 | __u8 incoming; |
141 | __u16 expect; | ||
141 | __u8 tx_seq; | 142 | __u8 tx_seq; |
142 | __u8 retries; | 143 | __u8 retries; |
143 | __u8 sar; | 144 | __u8 sar; |
@@ -160,12 +161,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l | |||
160 | { | 161 | { |
161 | struct sk_buff *skb; | 162 | struct sk_buff *skb; |
162 | 163 | ||
164 | release_sock(sk); | ||
163 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { | 165 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { |
164 | skb_reserve(skb, BT_SKB_RESERVE); | 166 | skb_reserve(skb, BT_SKB_RESERVE); |
165 | bt_cb(skb)->incoming = 0; | 167 | bt_cb(skb)->incoming = 0; |
166 | } | 168 | } |
169 | lock_sock(sk); | ||
170 | |||
171 | if (!skb && *err) | ||
172 | return NULL; | ||
173 | |||
174 | *err = sock_error(sk); | ||
175 | if (*err) | ||
176 | goto out; | ||
177 | |||
178 | if (sk->sk_shutdown) { | ||
179 | *err = -ECONNRESET; | ||
180 | goto out; | ||
181 | } | ||
167 | 182 | ||
168 | return skb; | 183 | return skb; |
184 | |||
185 | out: | ||
186 | kfree_skb(skb); | ||
187 | return NULL; | ||
169 | } | 188 | } |
170 | 189 | ||
171 | int bt_err(__u16 code); | 190 | int bt_err(__u16 code); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fc0c502d9fd1..bcbdd6d4e6dd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -100,6 +100,9 @@ enum { | |||
100 | #define HCISETACLMTU _IOW('H', 227, int) | 100 | #define HCISETACLMTU _IOW('H', 227, int) |
101 | #define HCISETSCOMTU _IOW('H', 228, int) | 101 | #define HCISETSCOMTU _IOW('H', 228, int) |
102 | 102 | ||
103 | #define HCIBLOCKADDR _IOW('H', 230, int) | ||
104 | #define HCIUNBLOCKADDR _IOW('H', 231, int) | ||
105 | |||
103 | #define HCIINQUIRY _IOR('H', 240, int) | 106 | #define HCIINQUIRY _IOR('H', 240, int) |
104 | 107 | ||
105 | /* HCI timeouts */ | 108 | /* HCI timeouts */ |
@@ -227,7 +230,7 @@ struct hci_cp_inquiry { | |||
227 | __u8 lap[3]; | 230 | __u8 lap[3]; |
228 | __u8 length; | 231 | __u8 length; |
229 | __u8 num_rsp; | 232 | __u8 num_rsp; |
230 | } __attribute__ ((packed)); | 233 | } __packed; |
231 | 234 | ||
232 | #define HCI_OP_INQUIRY_CANCEL 0x0402 | 235 | #define HCI_OP_INQUIRY_CANCEL 0x0402 |
233 | 236 | ||
@@ -241,81 +244,81 @@ struct hci_cp_create_conn { | |||
241 | __u8 pscan_mode; | 244 | __u8 pscan_mode; |
242 | __le16 clock_offset; | 245 | __le16 clock_offset; |
243 | __u8 role_switch; | 246 | __u8 role_switch; |
244 | } __attribute__ ((packed)); | 247 | } __packed; |
245 | 248 | ||
246 | #define HCI_OP_DISCONNECT 0x0406 | 249 | #define HCI_OP_DISCONNECT 0x0406 |
247 | struct hci_cp_disconnect { | 250 | struct hci_cp_disconnect { |
248 | __le16 handle; | 251 | __le16 handle; |
249 | __u8 reason; | 252 | __u8 reason; |
250 | } __attribute__ ((packed)); | 253 | } __packed; |
251 | 254 | ||
252 | #define HCI_OP_ADD_SCO 0x0407 | 255 | #define HCI_OP_ADD_SCO 0x0407 |
253 | struct hci_cp_add_sco { | 256 | struct hci_cp_add_sco { |
254 | __le16 handle; | 257 | __le16 handle; |
255 | __le16 pkt_type; | 258 | __le16 pkt_type; |
256 | } __attribute__ ((packed)); | 259 | } __packed; |
257 | 260 | ||
258 | #define HCI_OP_CREATE_CONN_CANCEL 0x0408 | 261 | #define HCI_OP_CREATE_CONN_CANCEL 0x0408 |
259 | struct hci_cp_create_conn_cancel { | 262 | struct hci_cp_create_conn_cancel { |
260 | bdaddr_t bdaddr; | 263 | bdaddr_t bdaddr; |
261 | } __attribute__ ((packed)); | 264 | } __packed; |
262 | 265 | ||
263 | #define HCI_OP_ACCEPT_CONN_REQ 0x0409 | 266 | #define HCI_OP_ACCEPT_CONN_REQ 0x0409 |
264 | struct hci_cp_accept_conn_req { | 267 | struct hci_cp_accept_conn_req { |
265 | bdaddr_t bdaddr; | 268 | bdaddr_t bdaddr; |
266 | __u8 role; | 269 | __u8 role; |
267 | } __attribute__ ((packed)); | 270 | } __packed; |
268 | 271 | ||
269 | #define HCI_OP_REJECT_CONN_REQ 0x040a | 272 | #define HCI_OP_REJECT_CONN_REQ 0x040a |
270 | struct hci_cp_reject_conn_req { | 273 | struct hci_cp_reject_conn_req { |
271 | bdaddr_t bdaddr; | 274 | bdaddr_t bdaddr; |
272 | __u8 reason; | 275 | __u8 reason; |
273 | } __attribute__ ((packed)); | 276 | } __packed; |
274 | 277 | ||
275 | #define HCI_OP_LINK_KEY_REPLY 0x040b | 278 | #define HCI_OP_LINK_KEY_REPLY 0x040b |
276 | struct hci_cp_link_key_reply { | 279 | struct hci_cp_link_key_reply { |
277 | bdaddr_t bdaddr; | 280 | bdaddr_t bdaddr; |
278 | __u8 link_key[16]; | 281 | __u8 link_key[16]; |
279 | } __attribute__ ((packed)); | 282 | } __packed; |
280 | 283 | ||
281 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c | 284 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c |
282 | struct hci_cp_link_key_neg_reply { | 285 | struct hci_cp_link_key_neg_reply { |
283 | bdaddr_t bdaddr; | 286 | bdaddr_t bdaddr; |
284 | } __attribute__ ((packed)); | 287 | } __packed; |
285 | 288 | ||
286 | #define HCI_OP_PIN_CODE_REPLY 0x040d | 289 | #define HCI_OP_PIN_CODE_REPLY 0x040d |
287 | struct hci_cp_pin_code_reply { | 290 | struct hci_cp_pin_code_reply { |
288 | bdaddr_t bdaddr; | 291 | bdaddr_t bdaddr; |
289 | __u8 pin_len; | 292 | __u8 pin_len; |
290 | __u8 pin_code[16]; | 293 | __u8 pin_code[16]; |
291 | } __attribute__ ((packed)); | 294 | } __packed; |
292 | 295 | ||
293 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e | 296 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e |
294 | struct hci_cp_pin_code_neg_reply { | 297 | struct hci_cp_pin_code_neg_reply { |
295 | bdaddr_t bdaddr; | 298 | bdaddr_t bdaddr; |
296 | } __attribute__ ((packed)); | 299 | } __packed; |
297 | 300 | ||
298 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f | 301 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f |
299 | struct hci_cp_change_conn_ptype { | 302 | struct hci_cp_change_conn_ptype { |
300 | __le16 handle; | 303 | __le16 handle; |
301 | __le16 pkt_type; | 304 | __le16 pkt_type; |
302 | } __attribute__ ((packed)); | 305 | } __packed; |
303 | 306 | ||
304 | #define HCI_OP_AUTH_REQUESTED 0x0411 | 307 | #define HCI_OP_AUTH_REQUESTED 0x0411 |
305 | struct hci_cp_auth_requested { | 308 | struct hci_cp_auth_requested { |
306 | __le16 handle; | 309 | __le16 handle; |
307 | } __attribute__ ((packed)); | 310 | } __packed; |
308 | 311 | ||
309 | #define HCI_OP_SET_CONN_ENCRYPT 0x0413 | 312 | #define HCI_OP_SET_CONN_ENCRYPT 0x0413 |
310 | struct hci_cp_set_conn_encrypt { | 313 | struct hci_cp_set_conn_encrypt { |
311 | __le16 handle; | 314 | __le16 handle; |
312 | __u8 encrypt; | 315 | __u8 encrypt; |
313 | } __attribute__ ((packed)); | 316 | } __packed; |
314 | 317 | ||
315 | #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 | 318 | #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 |
316 | struct hci_cp_change_conn_link_key { | 319 | struct hci_cp_change_conn_link_key { |
317 | __le16 handle; | 320 | __le16 handle; |
318 | } __attribute__ ((packed)); | 321 | } __packed; |
319 | 322 | ||
320 | #define HCI_OP_REMOTE_NAME_REQ 0x0419 | 323 | #define HCI_OP_REMOTE_NAME_REQ 0x0419 |
321 | struct hci_cp_remote_name_req { | 324 | struct hci_cp_remote_name_req { |
@@ -323,28 +326,28 @@ struct hci_cp_remote_name_req { | |||
323 | __u8 pscan_rep_mode; | 326 | __u8 pscan_rep_mode; |
324 | __u8 pscan_mode; | 327 | __u8 pscan_mode; |
325 | __le16 clock_offset; | 328 | __le16 clock_offset; |
326 | } __attribute__ ((packed)); | 329 | } __packed; |
327 | 330 | ||
328 | #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a | 331 | #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a |
329 | struct hci_cp_remote_name_req_cancel { | 332 | struct hci_cp_remote_name_req_cancel { |
330 | bdaddr_t bdaddr; | 333 | bdaddr_t bdaddr; |
331 | } __attribute__ ((packed)); | 334 | } __packed; |
332 | 335 | ||
333 | #define HCI_OP_READ_REMOTE_FEATURES 0x041b | 336 | #define HCI_OP_READ_REMOTE_FEATURES 0x041b |
334 | struct hci_cp_read_remote_features { | 337 | struct hci_cp_read_remote_features { |
335 | __le16 handle; | 338 | __le16 handle; |
336 | } __attribute__ ((packed)); | 339 | } __packed; |
337 | 340 | ||
338 | #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c | 341 | #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c |
339 | struct hci_cp_read_remote_ext_features { | 342 | struct hci_cp_read_remote_ext_features { |
340 | __le16 handle; | 343 | __le16 handle; |
341 | __u8 page; | 344 | __u8 page; |
342 | } __attribute__ ((packed)); | 345 | } __packed; |
343 | 346 | ||
344 | #define HCI_OP_READ_REMOTE_VERSION 0x041d | 347 | #define HCI_OP_READ_REMOTE_VERSION 0x041d |
345 | struct hci_cp_read_remote_version { | 348 | struct hci_cp_read_remote_version { |
346 | __le16 handle; | 349 | __le16 handle; |
347 | } __attribute__ ((packed)); | 350 | } __packed; |
348 | 351 | ||
349 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 | 352 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 |
350 | struct hci_cp_setup_sync_conn { | 353 | struct hci_cp_setup_sync_conn { |
@@ -355,7 +358,7 @@ struct hci_cp_setup_sync_conn { | |||
355 | __le16 voice_setting; | 358 | __le16 voice_setting; |
356 | __u8 retrans_effort; | 359 | __u8 retrans_effort; |
357 | __le16 pkt_type; | 360 | __le16 pkt_type; |
358 | } __attribute__ ((packed)); | 361 | } __packed; |
359 | 362 | ||
360 | #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 | 363 | #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 |
361 | struct hci_cp_accept_sync_conn_req { | 364 | struct hci_cp_accept_sync_conn_req { |
@@ -366,13 +369,13 @@ struct hci_cp_accept_sync_conn_req { | |||
366 | __le16 content_format; | 369 | __le16 content_format; |
367 | __u8 retrans_effort; | 370 | __u8 retrans_effort; |
368 | __le16 pkt_type; | 371 | __le16 pkt_type; |
369 | } __attribute__ ((packed)); | 372 | } __packed; |
370 | 373 | ||
371 | #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a | 374 | #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a |
372 | struct hci_cp_reject_sync_conn_req { | 375 | struct hci_cp_reject_sync_conn_req { |
373 | bdaddr_t bdaddr; | 376 | bdaddr_t bdaddr; |
374 | __u8 reason; | 377 | __u8 reason; |
375 | } __attribute__ ((packed)); | 378 | } __packed; |
376 | 379 | ||
377 | #define HCI_OP_SNIFF_MODE 0x0803 | 380 | #define HCI_OP_SNIFF_MODE 0x0803 |
378 | struct hci_cp_sniff_mode { | 381 | struct hci_cp_sniff_mode { |
@@ -381,59 +384,59 @@ struct hci_cp_sniff_mode { | |||
381 | __le16 min_interval; | 384 | __le16 min_interval; |
382 | __le16 attempt; | 385 | __le16 attempt; |
383 | __le16 timeout; | 386 | __le16 timeout; |
384 | } __attribute__ ((packed)); | 387 | } __packed; |
385 | 388 | ||
386 | #define HCI_OP_EXIT_SNIFF_MODE 0x0804 | 389 | #define HCI_OP_EXIT_SNIFF_MODE 0x0804 |
387 | struct hci_cp_exit_sniff_mode { | 390 | struct hci_cp_exit_sniff_mode { |
388 | __le16 handle; | 391 | __le16 handle; |
389 | } __attribute__ ((packed)); | 392 | } __packed; |
390 | 393 | ||
391 | #define HCI_OP_ROLE_DISCOVERY 0x0809 | 394 | #define HCI_OP_ROLE_DISCOVERY 0x0809 |
392 | struct hci_cp_role_discovery { | 395 | struct hci_cp_role_discovery { |
393 | __le16 handle; | 396 | __le16 handle; |
394 | } __attribute__ ((packed)); | 397 | } __packed; |
395 | struct hci_rp_role_discovery { | 398 | struct hci_rp_role_discovery { |
396 | __u8 status; | 399 | __u8 status; |
397 | __le16 handle; | 400 | __le16 handle; |
398 | __u8 role; | 401 | __u8 role; |
399 | } __attribute__ ((packed)); | 402 | } __packed; |
400 | 403 | ||
401 | #define HCI_OP_SWITCH_ROLE 0x080b | 404 | #define HCI_OP_SWITCH_ROLE 0x080b |
402 | struct hci_cp_switch_role { | 405 | struct hci_cp_switch_role { |
403 | bdaddr_t bdaddr; | 406 | bdaddr_t bdaddr; |
404 | __u8 role; | 407 | __u8 role; |
405 | } __attribute__ ((packed)); | 408 | } __packed; |
406 | 409 | ||
407 | #define HCI_OP_READ_LINK_POLICY 0x080c | 410 | #define HCI_OP_READ_LINK_POLICY 0x080c |
408 | struct hci_cp_read_link_policy { | 411 | struct hci_cp_read_link_policy { |
409 | __le16 handle; | 412 | __le16 handle; |
410 | } __attribute__ ((packed)); | 413 | } __packed; |
411 | struct hci_rp_read_link_policy { | 414 | struct hci_rp_read_link_policy { |
412 | __u8 status; | 415 | __u8 status; |
413 | __le16 handle; | 416 | __le16 handle; |
414 | __le16 policy; | 417 | __le16 policy; |
415 | } __attribute__ ((packed)); | 418 | } __packed; |
416 | 419 | ||
417 | #define HCI_OP_WRITE_LINK_POLICY 0x080d | 420 | #define HCI_OP_WRITE_LINK_POLICY 0x080d |
418 | struct hci_cp_write_link_policy { | 421 | struct hci_cp_write_link_policy { |
419 | __le16 handle; | 422 | __le16 handle; |
420 | __le16 policy; | 423 | __le16 policy; |
421 | } __attribute__ ((packed)); | 424 | } __packed; |
422 | struct hci_rp_write_link_policy { | 425 | struct hci_rp_write_link_policy { |
423 | __u8 status; | 426 | __u8 status; |
424 | __le16 handle; | 427 | __le16 handle; |
425 | } __attribute__ ((packed)); | 428 | } __packed; |
426 | 429 | ||
427 | #define HCI_OP_READ_DEF_LINK_POLICY 0x080e | 430 | #define HCI_OP_READ_DEF_LINK_POLICY 0x080e |
428 | struct hci_rp_read_def_link_policy { | 431 | struct hci_rp_read_def_link_policy { |
429 | __u8 status; | 432 | __u8 status; |
430 | __le16 policy; | 433 | __le16 policy; |
431 | } __attribute__ ((packed)); | 434 | } __packed; |
432 | 435 | ||
433 | #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f | 436 | #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f |
434 | struct hci_cp_write_def_link_policy { | 437 | struct hci_cp_write_def_link_policy { |
435 | __le16 policy; | 438 | __le16 policy; |
436 | } __attribute__ ((packed)); | 439 | } __packed; |
437 | 440 | ||
438 | #define HCI_OP_SNIFF_SUBRATE 0x0811 | 441 | #define HCI_OP_SNIFF_SUBRATE 0x0811 |
439 | struct hci_cp_sniff_subrate { | 442 | struct hci_cp_sniff_subrate { |
@@ -441,12 +444,12 @@ struct hci_cp_sniff_subrate { | |||
441 | __le16 max_latency; | 444 | __le16 max_latency; |
442 | __le16 min_remote_timeout; | 445 | __le16 min_remote_timeout; |
443 | __le16 min_local_timeout; | 446 | __le16 min_local_timeout; |
444 | } __attribute__ ((packed)); | 447 | } __packed; |
445 | 448 | ||
446 | #define HCI_OP_SET_EVENT_MASK 0x0c01 | 449 | #define HCI_OP_SET_EVENT_MASK 0x0c01 |
447 | struct hci_cp_set_event_mask { | 450 | struct hci_cp_set_event_mask { |
448 | __u8 mask[8]; | 451 | __u8 mask[8]; |
449 | } __attribute__ ((packed)); | 452 | } __packed; |
450 | 453 | ||
451 | #define HCI_OP_RESET 0x0c03 | 454 | #define HCI_OP_RESET 0x0c03 |
452 | 455 | ||
@@ -455,7 +458,7 @@ struct hci_cp_set_event_flt { | |||
455 | __u8 flt_type; | 458 | __u8 flt_type; |
456 | __u8 cond_type; | 459 | __u8 cond_type; |
457 | __u8 condition[0]; | 460 | __u8 condition[0]; |
458 | } __attribute__ ((packed)); | 461 | } __packed; |
459 | 462 | ||
460 | /* Filter types */ | 463 | /* Filter types */ |
461 | #define HCI_FLT_CLEAR_ALL 0x00 | 464 | #define HCI_FLT_CLEAR_ALL 0x00 |
@@ -474,13 +477,13 @@ struct hci_cp_set_event_flt { | |||
474 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 477 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
475 | struct hci_cp_write_local_name { | 478 | struct hci_cp_write_local_name { |
476 | __u8 name[248]; | 479 | __u8 name[248]; |
477 | } __attribute__ ((packed)); | 480 | } __packed; |
478 | 481 | ||
479 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 | 482 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 |
480 | struct hci_rp_read_local_name { | 483 | struct hci_rp_read_local_name { |
481 | __u8 status; | 484 | __u8 status; |
482 | __u8 name[248]; | 485 | __u8 name[248]; |
483 | } __attribute__ ((packed)); | 486 | } __packed; |
484 | 487 | ||
485 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 | 488 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 |
486 | 489 | ||
@@ -508,23 +511,23 @@ struct hci_rp_read_local_name { | |||
508 | struct hci_rp_read_class_of_dev { | 511 | struct hci_rp_read_class_of_dev { |
509 | __u8 status; | 512 | __u8 status; |
510 | __u8 dev_class[3]; | 513 | __u8 dev_class[3]; |
511 | } __attribute__ ((packed)); | 514 | } __packed; |
512 | 515 | ||
513 | #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 | 516 | #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 |
514 | struct hci_cp_write_class_of_dev { | 517 | struct hci_cp_write_class_of_dev { |
515 | __u8 dev_class[3]; | 518 | __u8 dev_class[3]; |
516 | } __attribute__ ((packed)); | 519 | } __packed; |
517 | 520 | ||
518 | #define HCI_OP_READ_VOICE_SETTING 0x0c25 | 521 | #define HCI_OP_READ_VOICE_SETTING 0x0c25 |
519 | struct hci_rp_read_voice_setting { | 522 | struct hci_rp_read_voice_setting { |
520 | __u8 status; | 523 | __u8 status; |
521 | __le16 voice_setting; | 524 | __le16 voice_setting; |
522 | } __attribute__ ((packed)); | 525 | } __packed; |
523 | 526 | ||
524 | #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 | 527 | #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 |
525 | struct hci_cp_write_voice_setting { | 528 | struct hci_cp_write_voice_setting { |
526 | __le16 voice_setting; | 529 | __le16 voice_setting; |
527 | } __attribute__ ((packed)); | 530 | } __packed; |
528 | 531 | ||
529 | #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 | 532 | #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 |
530 | struct hci_cp_host_buffer_size { | 533 | struct hci_cp_host_buffer_size { |
@@ -532,18 +535,18 @@ struct hci_cp_host_buffer_size { | |||
532 | __u8 sco_mtu; | 535 | __u8 sco_mtu; |
533 | __le16 acl_max_pkt; | 536 | __le16 acl_max_pkt; |
534 | __le16 sco_max_pkt; | 537 | __le16 sco_max_pkt; |
535 | } __attribute__ ((packed)); | 538 | } __packed; |
536 | 539 | ||
537 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 540 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
538 | struct hci_rp_read_ssp_mode { | 541 | struct hci_rp_read_ssp_mode { |
539 | __u8 status; | 542 | __u8 status; |
540 | __u8 mode; | 543 | __u8 mode; |
541 | } __attribute__ ((packed)); | 544 | } __packed; |
542 | 545 | ||
543 | #define HCI_OP_WRITE_SSP_MODE 0x0c56 | 546 | #define HCI_OP_WRITE_SSP_MODE 0x0c56 |
544 | struct hci_cp_write_ssp_mode { | 547 | struct hci_cp_write_ssp_mode { |
545 | __u8 mode; | 548 | __u8 mode; |
546 | } __attribute__ ((packed)); | 549 | } __packed; |
547 | 550 | ||
548 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 551 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
549 | struct hci_rp_read_local_version { | 552 | struct hci_rp_read_local_version { |
@@ -553,19 +556,19 @@ struct hci_rp_read_local_version { | |||
553 | __u8 lmp_ver; | 556 | __u8 lmp_ver; |
554 | __le16 manufacturer; | 557 | __le16 manufacturer; |
555 | __le16 lmp_subver; | 558 | __le16 lmp_subver; |
556 | } __attribute__ ((packed)); | 559 | } __packed; |
557 | 560 | ||
558 | #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 | 561 | #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 |
559 | struct hci_rp_read_local_commands { | 562 | struct hci_rp_read_local_commands { |
560 | __u8 status; | 563 | __u8 status; |
561 | __u8 commands[64]; | 564 | __u8 commands[64]; |
562 | } __attribute__ ((packed)); | 565 | } __packed; |
563 | 566 | ||
564 | #define HCI_OP_READ_LOCAL_FEATURES 0x1003 | 567 | #define HCI_OP_READ_LOCAL_FEATURES 0x1003 |
565 | struct hci_rp_read_local_features { | 568 | struct hci_rp_read_local_features { |
566 | __u8 status; | 569 | __u8 status; |
567 | __u8 features[8]; | 570 | __u8 features[8]; |
568 | } __attribute__ ((packed)); | 571 | } __packed; |
569 | 572 | ||
570 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 | 573 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 |
571 | struct hci_rp_read_local_ext_features { | 574 | struct hci_rp_read_local_ext_features { |
@@ -573,7 +576,7 @@ struct hci_rp_read_local_ext_features { | |||
573 | __u8 page; | 576 | __u8 page; |
574 | __u8 max_page; | 577 | __u8 max_page; |
575 | __u8 features[8]; | 578 | __u8 features[8]; |
576 | } __attribute__ ((packed)); | 579 | } __packed; |
577 | 580 | ||
578 | #define HCI_OP_READ_BUFFER_SIZE 0x1005 | 581 | #define HCI_OP_READ_BUFFER_SIZE 0x1005 |
579 | struct hci_rp_read_buffer_size { | 582 | struct hci_rp_read_buffer_size { |
@@ -582,13 +585,13 @@ struct hci_rp_read_buffer_size { | |||
582 | __u8 sco_mtu; | 585 | __u8 sco_mtu; |
583 | __le16 acl_max_pkt; | 586 | __le16 acl_max_pkt; |
584 | __le16 sco_max_pkt; | 587 | __le16 sco_max_pkt; |
585 | } __attribute__ ((packed)); | 588 | } __packed; |
586 | 589 | ||
587 | #define HCI_OP_READ_BD_ADDR 0x1009 | 590 | #define HCI_OP_READ_BD_ADDR 0x1009 |
588 | struct hci_rp_read_bd_addr { | 591 | struct hci_rp_read_bd_addr { |
589 | __u8 status; | 592 | __u8 status; |
590 | bdaddr_t bdaddr; | 593 | bdaddr_t bdaddr; |
591 | } __attribute__ ((packed)); | 594 | } __packed; |
592 | 595 | ||
593 | /* ---- HCI Events ---- */ | 596 | /* ---- HCI Events ---- */ |
594 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 597 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
@@ -601,7 +604,7 @@ struct inquiry_info { | |||
601 | __u8 pscan_mode; | 604 | __u8 pscan_mode; |
602 | __u8 dev_class[3]; | 605 | __u8 dev_class[3]; |
603 | __le16 clock_offset; | 606 | __le16 clock_offset; |
604 | } __attribute__ ((packed)); | 607 | } __packed; |
605 | 608 | ||
606 | #define HCI_EV_CONN_COMPLETE 0x03 | 609 | #define HCI_EV_CONN_COMPLETE 0x03 |
607 | struct hci_ev_conn_complete { | 610 | struct hci_ev_conn_complete { |
@@ -610,54 +613,54 @@ struct hci_ev_conn_complete { | |||
610 | bdaddr_t bdaddr; | 613 | bdaddr_t bdaddr; |
611 | __u8 link_type; | 614 | __u8 link_type; |
612 | __u8 encr_mode; | 615 | __u8 encr_mode; |
613 | } __attribute__ ((packed)); | 616 | } __packed; |
614 | 617 | ||
615 | #define HCI_EV_CONN_REQUEST 0x04 | 618 | #define HCI_EV_CONN_REQUEST 0x04 |
616 | struct hci_ev_conn_request { | 619 | struct hci_ev_conn_request { |
617 | bdaddr_t bdaddr; | 620 | bdaddr_t bdaddr; |
618 | __u8 dev_class[3]; | 621 | __u8 dev_class[3]; |
619 | __u8 link_type; | 622 | __u8 link_type; |
620 | } __attribute__ ((packed)); | 623 | } __packed; |
621 | 624 | ||
622 | #define HCI_EV_DISCONN_COMPLETE 0x05 | 625 | #define HCI_EV_DISCONN_COMPLETE 0x05 |
623 | struct hci_ev_disconn_complete { | 626 | struct hci_ev_disconn_complete { |
624 | __u8 status; | 627 | __u8 status; |
625 | __le16 handle; | 628 | __le16 handle; |
626 | __u8 reason; | 629 | __u8 reason; |
627 | } __attribute__ ((packed)); | 630 | } __packed; |
628 | 631 | ||
629 | #define HCI_EV_AUTH_COMPLETE 0x06 | 632 | #define HCI_EV_AUTH_COMPLETE 0x06 |
630 | struct hci_ev_auth_complete { | 633 | struct hci_ev_auth_complete { |
631 | __u8 status; | 634 | __u8 status; |
632 | __le16 handle; | 635 | __le16 handle; |
633 | } __attribute__ ((packed)); | 636 | } __packed; |
634 | 637 | ||
635 | #define HCI_EV_REMOTE_NAME 0x07 | 638 | #define HCI_EV_REMOTE_NAME 0x07 |
636 | struct hci_ev_remote_name { | 639 | struct hci_ev_remote_name { |
637 | __u8 status; | 640 | __u8 status; |
638 | bdaddr_t bdaddr; | 641 | bdaddr_t bdaddr; |
639 | __u8 name[248]; | 642 | __u8 name[248]; |
640 | } __attribute__ ((packed)); | 643 | } __packed; |
641 | 644 | ||
642 | #define HCI_EV_ENCRYPT_CHANGE 0x08 | 645 | #define HCI_EV_ENCRYPT_CHANGE 0x08 |
643 | struct hci_ev_encrypt_change { | 646 | struct hci_ev_encrypt_change { |
644 | __u8 status; | 647 | __u8 status; |
645 | __le16 handle; | 648 | __le16 handle; |
646 | __u8 encrypt; | 649 | __u8 encrypt; |
647 | } __attribute__ ((packed)); | 650 | } __packed; |
648 | 651 | ||
649 | #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 | 652 | #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 |
650 | struct hci_ev_change_link_key_complete { | 653 | struct hci_ev_change_link_key_complete { |
651 | __u8 status; | 654 | __u8 status; |
652 | __le16 handle; | 655 | __le16 handle; |
653 | } __attribute__ ((packed)); | 656 | } __packed; |
654 | 657 | ||
655 | #define HCI_EV_REMOTE_FEATURES 0x0b | 658 | #define HCI_EV_REMOTE_FEATURES 0x0b |
656 | struct hci_ev_remote_features { | 659 | struct hci_ev_remote_features { |
657 | __u8 status; | 660 | __u8 status; |
658 | __le16 handle; | 661 | __le16 handle; |
659 | __u8 features[8]; | 662 | __u8 features[8]; |
660 | } __attribute__ ((packed)); | 663 | } __packed; |
661 | 664 | ||
662 | #define HCI_EV_REMOTE_VERSION 0x0c | 665 | #define HCI_EV_REMOTE_VERSION 0x0c |
663 | struct hci_ev_remote_version { | 666 | struct hci_ev_remote_version { |
@@ -666,7 +669,7 @@ struct hci_ev_remote_version { | |||
666 | __u8 lmp_ver; | 669 | __u8 lmp_ver; |
667 | __le16 manufacturer; | 670 | __le16 manufacturer; |
668 | __le16 lmp_subver; | 671 | __le16 lmp_subver; |
669 | } __attribute__ ((packed)); | 672 | } __packed; |
670 | 673 | ||
671 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0d | 674 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0d |
672 | struct hci_qos { | 675 | struct hci_qos { |
@@ -675,38 +678,38 @@ struct hci_qos { | |||
675 | __u32 peak_bandwidth; | 678 | __u32 peak_bandwidth; |
676 | __u32 latency; | 679 | __u32 latency; |
677 | __u32 delay_variation; | 680 | __u32 delay_variation; |
678 | } __attribute__ ((packed)); | 681 | } __packed; |
679 | struct hci_ev_qos_setup_complete { | 682 | struct hci_ev_qos_setup_complete { |
680 | __u8 status; | 683 | __u8 status; |
681 | __le16 handle; | 684 | __le16 handle; |
682 | struct hci_qos qos; | 685 | struct hci_qos qos; |
683 | } __attribute__ ((packed)); | 686 | } __packed; |
684 | 687 | ||
685 | #define HCI_EV_CMD_COMPLETE 0x0e | 688 | #define HCI_EV_CMD_COMPLETE 0x0e |
686 | struct hci_ev_cmd_complete { | 689 | struct hci_ev_cmd_complete { |
687 | __u8 ncmd; | 690 | __u8 ncmd; |
688 | __le16 opcode; | 691 | __le16 opcode; |
689 | } __attribute__ ((packed)); | 692 | } __packed; |
690 | 693 | ||
691 | #define HCI_EV_CMD_STATUS 0x0f | 694 | #define HCI_EV_CMD_STATUS 0x0f |
692 | struct hci_ev_cmd_status { | 695 | struct hci_ev_cmd_status { |
693 | __u8 status; | 696 | __u8 status; |
694 | __u8 ncmd; | 697 | __u8 ncmd; |
695 | __le16 opcode; | 698 | __le16 opcode; |
696 | } __attribute__ ((packed)); | 699 | } __packed; |
697 | 700 | ||
698 | #define HCI_EV_ROLE_CHANGE 0x12 | 701 | #define HCI_EV_ROLE_CHANGE 0x12 |
699 | struct hci_ev_role_change { | 702 | struct hci_ev_role_change { |
700 | __u8 status; | 703 | __u8 status; |
701 | bdaddr_t bdaddr; | 704 | bdaddr_t bdaddr; |
702 | __u8 role; | 705 | __u8 role; |
703 | } __attribute__ ((packed)); | 706 | } __packed; |
704 | 707 | ||
705 | #define HCI_EV_NUM_COMP_PKTS 0x13 | 708 | #define HCI_EV_NUM_COMP_PKTS 0x13 |
706 | struct hci_ev_num_comp_pkts { | 709 | struct hci_ev_num_comp_pkts { |
707 | __u8 num_hndl; | 710 | __u8 num_hndl; |
708 | /* variable length part */ | 711 | /* variable length part */ |
709 | } __attribute__ ((packed)); | 712 | } __packed; |
710 | 713 | ||
711 | #define HCI_EV_MODE_CHANGE 0x14 | 714 | #define HCI_EV_MODE_CHANGE 0x14 |
712 | struct hci_ev_mode_change { | 715 | struct hci_ev_mode_change { |
@@ -714,44 +717,44 @@ struct hci_ev_mode_change { | |||
714 | __le16 handle; | 717 | __le16 handle; |
715 | __u8 mode; | 718 | __u8 mode; |
716 | __le16 interval; | 719 | __le16 interval; |
717 | } __attribute__ ((packed)); | 720 | } __packed; |
718 | 721 | ||
719 | #define HCI_EV_PIN_CODE_REQ 0x16 | 722 | #define HCI_EV_PIN_CODE_REQ 0x16 |
720 | struct hci_ev_pin_code_req { | 723 | struct hci_ev_pin_code_req { |
721 | bdaddr_t bdaddr; | 724 | bdaddr_t bdaddr; |
722 | } __attribute__ ((packed)); | 725 | } __packed; |
723 | 726 | ||
724 | #define HCI_EV_LINK_KEY_REQ 0x17 | 727 | #define HCI_EV_LINK_KEY_REQ 0x17 |
725 | struct hci_ev_link_key_req { | 728 | struct hci_ev_link_key_req { |
726 | bdaddr_t bdaddr; | 729 | bdaddr_t bdaddr; |
727 | } __attribute__ ((packed)); | 730 | } __packed; |
728 | 731 | ||
729 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 | 732 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 |
730 | struct hci_ev_link_key_notify { | 733 | struct hci_ev_link_key_notify { |
731 | bdaddr_t bdaddr; | 734 | bdaddr_t bdaddr; |
732 | __u8 link_key[16]; | 735 | __u8 link_key[16]; |
733 | __u8 key_type; | 736 | __u8 key_type; |
734 | } __attribute__ ((packed)); | 737 | } __packed; |
735 | 738 | ||
736 | #define HCI_EV_CLOCK_OFFSET 0x1c | 739 | #define HCI_EV_CLOCK_OFFSET 0x1c |
737 | struct hci_ev_clock_offset { | 740 | struct hci_ev_clock_offset { |
738 | __u8 status; | 741 | __u8 status; |
739 | __le16 handle; | 742 | __le16 handle; |
740 | __le16 clock_offset; | 743 | __le16 clock_offset; |
741 | } __attribute__ ((packed)); | 744 | } __packed; |
742 | 745 | ||
743 | #define HCI_EV_PKT_TYPE_CHANGE 0x1d | 746 | #define HCI_EV_PKT_TYPE_CHANGE 0x1d |
744 | struct hci_ev_pkt_type_change { | 747 | struct hci_ev_pkt_type_change { |
745 | __u8 status; | 748 | __u8 status; |
746 | __le16 handle; | 749 | __le16 handle; |
747 | __le16 pkt_type; | 750 | __le16 pkt_type; |
748 | } __attribute__ ((packed)); | 751 | } __packed; |
749 | 752 | ||
750 | #define HCI_EV_PSCAN_REP_MODE 0x20 | 753 | #define HCI_EV_PSCAN_REP_MODE 0x20 |
751 | struct hci_ev_pscan_rep_mode { | 754 | struct hci_ev_pscan_rep_mode { |
752 | bdaddr_t bdaddr; | 755 | bdaddr_t bdaddr; |
753 | __u8 pscan_rep_mode; | 756 | __u8 pscan_rep_mode; |
754 | } __attribute__ ((packed)); | 757 | } __packed; |
755 | 758 | ||
756 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 | 759 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 |
757 | struct inquiry_info_with_rssi { | 760 | struct inquiry_info_with_rssi { |
@@ -761,7 +764,7 @@ struct inquiry_info_with_rssi { | |||
761 | __u8 dev_class[3]; | 764 | __u8 dev_class[3]; |
762 | __le16 clock_offset; | 765 | __le16 clock_offset; |
763 | __s8 rssi; | 766 | __s8 rssi; |
764 | } __attribute__ ((packed)); | 767 | } __packed; |
765 | struct inquiry_info_with_rssi_and_pscan_mode { | 768 | struct inquiry_info_with_rssi_and_pscan_mode { |
766 | bdaddr_t bdaddr; | 769 | bdaddr_t bdaddr; |
767 | __u8 pscan_rep_mode; | 770 | __u8 pscan_rep_mode; |
@@ -770,7 +773,7 @@ struct inquiry_info_with_rssi_and_pscan_mode { | |||
770 | __u8 dev_class[3]; | 773 | __u8 dev_class[3]; |
771 | __le16 clock_offset; | 774 | __le16 clock_offset; |
772 | __s8 rssi; | 775 | __s8 rssi; |
773 | } __attribute__ ((packed)); | 776 | } __packed; |
774 | 777 | ||
775 | #define HCI_EV_REMOTE_EXT_FEATURES 0x23 | 778 | #define HCI_EV_REMOTE_EXT_FEATURES 0x23 |
776 | struct hci_ev_remote_ext_features { | 779 | struct hci_ev_remote_ext_features { |
@@ -779,7 +782,7 @@ struct hci_ev_remote_ext_features { | |||
779 | __u8 page; | 782 | __u8 page; |
780 | __u8 max_page; | 783 | __u8 max_page; |
781 | __u8 features[8]; | 784 | __u8 features[8]; |
782 | } __attribute__ ((packed)); | 785 | } __packed; |
783 | 786 | ||
784 | #define HCI_EV_SYNC_CONN_COMPLETE 0x2c | 787 | #define HCI_EV_SYNC_CONN_COMPLETE 0x2c |
785 | struct hci_ev_sync_conn_complete { | 788 | struct hci_ev_sync_conn_complete { |
@@ -792,7 +795,7 @@ struct hci_ev_sync_conn_complete { | |||
792 | __le16 rx_pkt_len; | 795 | __le16 rx_pkt_len; |
793 | __le16 tx_pkt_len; | 796 | __le16 tx_pkt_len; |
794 | __u8 air_mode; | 797 | __u8 air_mode; |
795 | } __attribute__ ((packed)); | 798 | } __packed; |
796 | 799 | ||
797 | #define HCI_EV_SYNC_CONN_CHANGED 0x2d | 800 | #define HCI_EV_SYNC_CONN_CHANGED 0x2d |
798 | struct hci_ev_sync_conn_changed { | 801 | struct hci_ev_sync_conn_changed { |
@@ -802,7 +805,7 @@ struct hci_ev_sync_conn_changed { | |||
802 | __u8 retrans_window; | 805 | __u8 retrans_window; |
803 | __le16 rx_pkt_len; | 806 | __le16 rx_pkt_len; |
804 | __le16 tx_pkt_len; | 807 | __le16 tx_pkt_len; |
805 | } __attribute__ ((packed)); | 808 | } __packed; |
806 | 809 | ||
807 | #define HCI_EV_SNIFF_SUBRATE 0x2e | 810 | #define HCI_EV_SNIFF_SUBRATE 0x2e |
808 | struct hci_ev_sniff_subrate { | 811 | struct hci_ev_sniff_subrate { |
@@ -812,7 +815,7 @@ struct hci_ev_sniff_subrate { | |||
812 | __le16 max_rx_latency; | 815 | __le16 max_rx_latency; |
813 | __le16 max_remote_timeout; | 816 | __le16 max_remote_timeout; |
814 | __le16 max_local_timeout; | 817 | __le16 max_local_timeout; |
815 | } __attribute__ ((packed)); | 818 | } __packed; |
816 | 819 | ||
817 | #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f | 820 | #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f |
818 | struct extended_inquiry_info { | 821 | struct extended_inquiry_info { |
@@ -823,37 +826,37 @@ struct extended_inquiry_info { | |||
823 | __le16 clock_offset; | 826 | __le16 clock_offset; |
824 | __s8 rssi; | 827 | __s8 rssi; |
825 | __u8 data[240]; | 828 | __u8 data[240]; |
826 | } __attribute__ ((packed)); | 829 | } __packed; |
827 | 830 | ||
828 | #define HCI_EV_IO_CAPA_REQUEST 0x31 | 831 | #define HCI_EV_IO_CAPA_REQUEST 0x31 |
829 | struct hci_ev_io_capa_request { | 832 | struct hci_ev_io_capa_request { |
830 | bdaddr_t bdaddr; | 833 | bdaddr_t bdaddr; |
831 | } __attribute__ ((packed)); | 834 | } __packed; |
832 | 835 | ||
833 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 836 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
834 | struct hci_ev_simple_pair_complete { | 837 | struct hci_ev_simple_pair_complete { |
835 | __u8 status; | 838 | __u8 status; |
836 | bdaddr_t bdaddr; | 839 | bdaddr_t bdaddr; |
837 | } __attribute__ ((packed)); | 840 | } __packed; |
838 | 841 | ||
839 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d | 842 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d |
840 | struct hci_ev_remote_host_features { | 843 | struct hci_ev_remote_host_features { |
841 | bdaddr_t bdaddr; | 844 | bdaddr_t bdaddr; |
842 | __u8 features[8]; | 845 | __u8 features[8]; |
843 | } __attribute__ ((packed)); | 846 | } __packed; |
844 | 847 | ||
845 | /* Internal events generated by Bluetooth stack */ | 848 | /* Internal events generated by Bluetooth stack */ |
846 | #define HCI_EV_STACK_INTERNAL 0xfd | 849 | #define HCI_EV_STACK_INTERNAL 0xfd |
847 | struct hci_ev_stack_internal { | 850 | struct hci_ev_stack_internal { |
848 | __u16 type; | 851 | __u16 type; |
849 | __u8 data[0]; | 852 | __u8 data[0]; |
850 | } __attribute__ ((packed)); | 853 | } __packed; |
851 | 854 | ||
852 | #define HCI_EV_SI_DEVICE 0x01 | 855 | #define HCI_EV_SI_DEVICE 0x01 |
853 | struct hci_ev_si_device { | 856 | struct hci_ev_si_device { |
854 | __u16 event; | 857 | __u16 event; |
855 | __u16 dev_id; | 858 | __u16 dev_id; |
856 | } __attribute__ ((packed)); | 859 | } __packed; |
857 | 860 | ||
858 | #define HCI_EV_SI_SECURITY 0x02 | 861 | #define HCI_EV_SI_SECURITY 0x02 |
859 | struct hci_ev_si_security { | 862 | struct hci_ev_si_security { |
@@ -861,7 +864,7 @@ struct hci_ev_si_security { | |||
861 | __u16 proto; | 864 | __u16 proto; |
862 | __u16 subproto; | 865 | __u16 subproto; |
863 | __u8 incoming; | 866 | __u8 incoming; |
864 | } __attribute__ ((packed)); | 867 | } __packed; |
865 | 868 | ||
866 | /* ---- HCI Packet structures ---- */ | 869 | /* ---- HCI Packet structures ---- */ |
867 | #define HCI_COMMAND_HDR_SIZE 3 | 870 | #define HCI_COMMAND_HDR_SIZE 3 |
@@ -872,22 +875,22 @@ struct hci_ev_si_security { | |||
872 | struct hci_command_hdr { | 875 | struct hci_command_hdr { |
873 | __le16 opcode; /* OCF & OGF */ | 876 | __le16 opcode; /* OCF & OGF */ |
874 | __u8 plen; | 877 | __u8 plen; |
875 | } __attribute__ ((packed)); | 878 | } __packed; |
876 | 879 | ||
877 | struct hci_event_hdr { | 880 | struct hci_event_hdr { |
878 | __u8 evt; | 881 | __u8 evt; |
879 | __u8 plen; | 882 | __u8 plen; |
880 | } __attribute__ ((packed)); | 883 | } __packed; |
881 | 884 | ||
882 | struct hci_acl_hdr { | 885 | struct hci_acl_hdr { |
883 | __le16 handle; /* Handle & Flags(PB, BC) */ | 886 | __le16 handle; /* Handle & Flags(PB, BC) */ |
884 | __le16 dlen; | 887 | __le16 dlen; |
885 | } __attribute__ ((packed)); | 888 | } __packed; |
886 | 889 | ||
887 | struct hci_sco_hdr { | 890 | struct hci_sco_hdr { |
888 | __le16 handle; | 891 | __le16 handle; |
889 | __u8 dlen; | 892 | __u8 dlen; |
890 | } __attribute__ ((packed)); | 893 | } __packed; |
891 | 894 | ||
892 | #ifdef __KERNEL__ | 895 | #ifdef __KERNEL__ |
893 | #include <linux/skbuff.h> | 896 | #include <linux/skbuff.h> |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ce3c99e5fa25..4568b938ca35 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. |
4 | 4 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 6 | ||
@@ -12,13 +12,13 @@ | |||
12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | 14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
16 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | 19 | ||
20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
22 | SOFTWARE IS DISCLAIMED. | 22 | SOFTWARE IS DISCLAIMED. |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -62,6 +62,11 @@ struct hci_conn_hash { | |||
62 | unsigned int sco_num; | 62 | unsigned int sco_num; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | struct bdaddr_list { | ||
66 | struct list_head list; | ||
67 | bdaddr_t bdaddr; | ||
68 | }; | ||
69 | #define NUM_REASSEMBLY 4 | ||
65 | struct hci_dev { | 70 | struct hci_dev { |
66 | struct list_head list; | 71 | struct list_head list; |
67 | spinlock_t lock; | 72 | spinlock_t lock; |
@@ -107,6 +112,8 @@ struct hci_dev { | |||
107 | unsigned long acl_last_tx; | 112 | unsigned long acl_last_tx; |
108 | unsigned long sco_last_tx; | 113 | unsigned long sco_last_tx; |
109 | 114 | ||
115 | struct workqueue_struct *workqueue; | ||
116 | |||
110 | struct tasklet_struct cmd_task; | 117 | struct tasklet_struct cmd_task; |
111 | struct tasklet_struct rx_task; | 118 | struct tasklet_struct rx_task; |
112 | struct tasklet_struct tx_task; | 119 | struct tasklet_struct tx_task; |
@@ -116,7 +123,7 @@ struct hci_dev { | |||
116 | struct sk_buff_head cmd_q; | 123 | struct sk_buff_head cmd_q; |
117 | 124 | ||
118 | struct sk_buff *sent_cmd; | 125 | struct sk_buff *sent_cmd; |
119 | struct sk_buff *reassembly[3]; | 126 | struct sk_buff *reassembly[NUM_REASSEMBLY]; |
120 | 127 | ||
121 | struct mutex req_lock; | 128 | struct mutex req_lock; |
122 | wait_queue_head_t req_wait_q; | 129 | wait_queue_head_t req_wait_q; |
@@ -125,6 +132,7 @@ struct hci_dev { | |||
125 | 132 | ||
126 | struct inquiry_cache inq_cache; | 133 | struct inquiry_cache inq_cache; |
127 | struct hci_conn_hash conn_hash; | 134 | struct hci_conn_hash conn_hash; |
135 | struct list_head blacklist; | ||
128 | 136 | ||
129 | struct hci_dev_stats stat; | 137 | struct hci_dev_stats stat; |
130 | 138 | ||
@@ -248,6 +256,7 @@ enum { | |||
248 | HCI_CONN_ENCRYPT_PEND, | 256 | HCI_CONN_ENCRYPT_PEND, |
249 | HCI_CONN_RSWITCH_PEND, | 257 | HCI_CONN_RSWITCH_PEND, |
250 | HCI_CONN_MODE_CHANGE_PEND, | 258 | HCI_CONN_MODE_CHANGE_PEND, |
259 | HCI_CONN_SCO_SETUP_PEND, | ||
251 | }; | 260 | }; |
252 | 261 | ||
253 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 262 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
@@ -328,6 +337,7 @@ void hci_acl_connect(struct hci_conn *conn); | |||
328 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); | 337 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); |
329 | void hci_add_sco(struct hci_conn *conn, __u16 handle); | 338 | void hci_add_sco(struct hci_conn *conn, __u16 handle); |
330 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); | 339 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); |
340 | void hci_sco_setup(struct hci_conn *conn, __u8 status); | ||
331 | 341 | ||
332 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); | 342 | struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); |
333 | int hci_conn_del(struct hci_conn *conn); | 343 | int hci_conn_del(struct hci_conn *conn); |
@@ -378,7 +388,7 @@ static inline void __hci_dev_put(struct hci_dev *d) | |||
378 | } | 388 | } |
379 | 389 | ||
380 | static inline void hci_dev_put(struct hci_dev *d) | 390 | static inline void hci_dev_put(struct hci_dev *d) |
381 | { | 391 | { |
382 | __hci_dev_put(d); | 392 | __hci_dev_put(d); |
383 | module_put(d->owner); | 393 | module_put(d->owner); |
384 | } | 394 | } |
@@ -422,10 +432,14 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); | |||
422 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); | 432 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); |
423 | int hci_inquiry(void __user *arg); | 433 | int hci_inquiry(void __user *arg); |
424 | 434 | ||
435 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
436 | int hci_blacklist_clear(struct hci_dev *hdev); | ||
437 | |||
425 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 438 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
426 | 439 | ||
427 | int hci_recv_frame(struct sk_buff *skb); | 440 | int hci_recv_frame(struct sk_buff *skb); |
428 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); | 441 | int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); |
442 | int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); | ||
429 | 443 | ||
430 | int hci_register_sysfs(struct hci_dev *hdev); | 444 | int hci_register_sysfs(struct hci_dev *hdev); |
431 | void hci_unregister_sysfs(struct hci_dev *hdev); | 445 | void hci_unregister_sysfs(struct hci_dev *hdev); |
@@ -636,8 +650,8 @@ int hci_register_notifier(struct notifier_block *nb); | |||
636 | int hci_unregister_notifier(struct notifier_block *nb); | 650 | int hci_unregister_notifier(struct notifier_block *nb); |
637 | 651 | ||
638 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 652 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); |
639 | int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); | 653 | void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); |
640 | int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 654 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
641 | 655 | ||
642 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | 656 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); |
643 | 657 | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 17a689f27a6a..6c241444f902 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> | ||
5 | Copyright (C) 2010 Google Inc. | ||
4 | 6 | ||
5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | 7 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
6 | 8 | ||
@@ -30,11 +32,12 @@ | |||
30 | #define L2CAP_DEFAULT_MIN_MTU 48 | 32 | #define L2CAP_DEFAULT_MIN_MTU 48 |
31 | #define L2CAP_DEFAULT_FLUSH_TO 0xffff | 33 | #define L2CAP_DEFAULT_FLUSH_TO 0xffff |
32 | #define L2CAP_DEFAULT_TX_WINDOW 63 | 34 | #define L2CAP_DEFAULT_TX_WINDOW 63 |
33 | #define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5) | ||
34 | #define L2CAP_DEFAULT_MAX_TX 3 | 35 | #define L2CAP_DEFAULT_MAX_TX 3 |
35 | #define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ | 36 | #define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ |
36 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ | 37 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ |
37 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 672 | 38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ |
39 | #define L2CAP_DEFAULT_ACK_TO 200 | ||
40 | #define L2CAP_LOCAL_BUSY_TRIES 12 | ||
38 | 41 | ||
39 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
40 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 43 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ |
@@ -55,6 +58,8 @@ struct l2cap_options { | |||
55 | __u16 flush_to; | 58 | __u16 flush_to; |
56 | __u8 mode; | 59 | __u8 mode; |
57 | __u8 fcs; | 60 | __u8 fcs; |
61 | __u8 max_tx; | ||
62 | __u16 txwin_size; | ||
58 | }; | 63 | }; |
59 | 64 | ||
60 | #define L2CAP_CONNINFO 0x02 | 65 | #define L2CAP_CONNINFO 0x02 |
@@ -126,31 +131,31 @@ struct l2cap_conninfo { | |||
126 | struct l2cap_hdr { | 131 | struct l2cap_hdr { |
127 | __le16 len; | 132 | __le16 len; |
128 | __le16 cid; | 133 | __le16 cid; |
129 | } __attribute__ ((packed)); | 134 | } __packed; |
130 | #define L2CAP_HDR_SIZE 4 | 135 | #define L2CAP_HDR_SIZE 4 |
131 | 136 | ||
132 | struct l2cap_cmd_hdr { | 137 | struct l2cap_cmd_hdr { |
133 | __u8 code; | 138 | __u8 code; |
134 | __u8 ident; | 139 | __u8 ident; |
135 | __le16 len; | 140 | __le16 len; |
136 | } __attribute__ ((packed)); | 141 | } __packed; |
137 | #define L2CAP_CMD_HDR_SIZE 4 | 142 | #define L2CAP_CMD_HDR_SIZE 4 |
138 | 143 | ||
139 | struct l2cap_cmd_rej { | 144 | struct l2cap_cmd_rej { |
140 | __le16 reason; | 145 | __le16 reason; |
141 | } __attribute__ ((packed)); | 146 | } __packed; |
142 | 147 | ||
143 | struct l2cap_conn_req { | 148 | struct l2cap_conn_req { |
144 | __le16 psm; | 149 | __le16 psm; |
145 | __le16 scid; | 150 | __le16 scid; |
146 | } __attribute__ ((packed)); | 151 | } __packed; |
147 | 152 | ||
148 | struct l2cap_conn_rsp { | 153 | struct l2cap_conn_rsp { |
149 | __le16 dcid; | 154 | __le16 dcid; |
150 | __le16 scid; | 155 | __le16 scid; |
151 | __le16 result; | 156 | __le16 result; |
152 | __le16 status; | 157 | __le16 status; |
153 | } __attribute__ ((packed)); | 158 | } __packed; |
154 | 159 | ||
155 | /* channel indentifier */ | 160 | /* channel indentifier */ |
156 | #define L2CAP_CID_SIGNALING 0x0001 | 161 | #define L2CAP_CID_SIGNALING 0x0001 |
@@ -174,14 +179,14 @@ struct l2cap_conf_req { | |||
174 | __le16 dcid; | 179 | __le16 dcid; |
175 | __le16 flags; | 180 | __le16 flags; |
176 | __u8 data[0]; | 181 | __u8 data[0]; |
177 | } __attribute__ ((packed)); | 182 | } __packed; |
178 | 183 | ||
179 | struct l2cap_conf_rsp { | 184 | struct l2cap_conf_rsp { |
180 | __le16 scid; | 185 | __le16 scid; |
181 | __le16 flags; | 186 | __le16 flags; |
182 | __le16 result; | 187 | __le16 result; |
183 | __u8 data[0]; | 188 | __u8 data[0]; |
184 | } __attribute__ ((packed)); | 189 | } __packed; |
185 | 190 | ||
186 | #define L2CAP_CONF_SUCCESS 0x0000 | 191 | #define L2CAP_CONF_SUCCESS 0x0000 |
187 | #define L2CAP_CONF_UNACCEPT 0x0001 | 192 | #define L2CAP_CONF_UNACCEPT 0x0001 |
@@ -192,7 +197,7 @@ struct l2cap_conf_opt { | |||
192 | __u8 type; | 197 | __u8 type; |
193 | __u8 len; | 198 | __u8 len; |
194 | __u8 val[0]; | 199 | __u8 val[0]; |
195 | } __attribute__ ((packed)); | 200 | } __packed; |
196 | #define L2CAP_CONF_OPT_SIZE 2 | 201 | #define L2CAP_CONF_OPT_SIZE 2 |
197 | 202 | ||
198 | #define L2CAP_CONF_HINT 0x80 | 203 | #define L2CAP_CONF_HINT 0x80 |
@@ -213,7 +218,7 @@ struct l2cap_conf_rfc { | |||
213 | __le16 retrans_timeout; | 218 | __le16 retrans_timeout; |
214 | __le16 monitor_timeout; | 219 | __le16 monitor_timeout; |
215 | __le16 max_pdu_size; | 220 | __le16 max_pdu_size; |
216 | } __attribute__ ((packed)); | 221 | } __packed; |
217 | 222 | ||
218 | #define L2CAP_MODE_BASIC 0x00 | 223 | #define L2CAP_MODE_BASIC 0x00 |
219 | #define L2CAP_MODE_RETRANS 0x01 | 224 | #define L2CAP_MODE_RETRANS 0x01 |
@@ -224,22 +229,22 @@ struct l2cap_conf_rfc { | |||
224 | struct l2cap_disconn_req { | 229 | struct l2cap_disconn_req { |
225 | __le16 dcid; | 230 | __le16 dcid; |
226 | __le16 scid; | 231 | __le16 scid; |
227 | } __attribute__ ((packed)); | 232 | } __packed; |
228 | 233 | ||
229 | struct l2cap_disconn_rsp { | 234 | struct l2cap_disconn_rsp { |
230 | __le16 dcid; | 235 | __le16 dcid; |
231 | __le16 scid; | 236 | __le16 scid; |
232 | } __attribute__ ((packed)); | 237 | } __packed; |
233 | 238 | ||
234 | struct l2cap_info_req { | 239 | struct l2cap_info_req { |
235 | __le16 type; | 240 | __le16 type; |
236 | } __attribute__ ((packed)); | 241 | } __packed; |
237 | 242 | ||
238 | struct l2cap_info_rsp { | 243 | struct l2cap_info_rsp { |
239 | __le16 type; | 244 | __le16 type; |
240 | __le16 result; | 245 | __le16 result; |
241 | __u8 data[0]; | 246 | __u8 data[0]; |
242 | } __attribute__ ((packed)); | 247 | } __packed; |
243 | 248 | ||
244 | /* info type */ | 249 | /* info type */ |
245 | #define L2CAP_IT_CL_MTU 0x0001 | 250 | #define L2CAP_IT_CL_MTU 0x0001 |
@@ -284,6 +289,11 @@ struct l2cap_conn { | |||
284 | struct l2cap_chan_list chan_list; | 289 | struct l2cap_chan_list chan_list; |
285 | }; | 290 | }; |
286 | 291 | ||
292 | struct sock_del_list { | ||
293 | struct sock *sk; | ||
294 | struct list_head list; | ||
295 | }; | ||
296 | |||
287 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 297 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
288 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | 298 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 |
289 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | 299 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 |
@@ -292,6 +302,7 @@ struct l2cap_conn { | |||
292 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 302 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
293 | #define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) | 303 | #define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) |
294 | #define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) | 304 | #define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) |
305 | #define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue) | ||
295 | #define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) | 306 | #define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) |
296 | 307 | ||
297 | struct srej_list { | 308 | struct srej_list { |
@@ -320,7 +331,7 @@ struct l2cap_pinfo { | |||
320 | __u8 conf_req[64]; | 331 | __u8 conf_req[64]; |
321 | __u8 conf_len; | 332 | __u8 conf_len; |
322 | __u8 conf_state; | 333 | __u8 conf_state; |
323 | __u8 conn_state; | 334 | __u16 conn_state; |
324 | 335 | ||
325 | __u8 next_tx_seq; | 336 | __u8 next_tx_seq; |
326 | __u8 expected_ack_seq; | 337 | __u8 expected_ack_seq; |
@@ -328,27 +339,34 @@ struct l2cap_pinfo { | |||
328 | __u8 buffer_seq; | 339 | __u8 buffer_seq; |
329 | __u8 buffer_seq_srej; | 340 | __u8 buffer_seq_srej; |
330 | __u8 srej_save_reqseq; | 341 | __u8 srej_save_reqseq; |
342 | __u8 frames_sent; | ||
331 | __u8 unacked_frames; | 343 | __u8 unacked_frames; |
332 | __u8 retry_count; | 344 | __u8 retry_count; |
333 | __u8 num_to_ack; | 345 | __u8 num_acked; |
334 | __u16 sdu_len; | 346 | __u16 sdu_len; |
335 | __u16 partial_sdu_len; | 347 | __u16 partial_sdu_len; |
336 | struct sk_buff *sdu; | 348 | struct sk_buff *sdu; |
337 | 349 | ||
338 | __u8 ident; | 350 | __u8 ident; |
339 | 351 | ||
352 | __u8 tx_win; | ||
353 | __u8 max_tx; | ||
340 | __u8 remote_tx_win; | 354 | __u8 remote_tx_win; |
341 | __u8 remote_max_tx; | 355 | __u8 remote_max_tx; |
342 | __u16 retrans_timeout; | 356 | __u16 retrans_timeout; |
343 | __u16 monitor_timeout; | 357 | __u16 monitor_timeout; |
344 | __u16 max_pdu_size; | 358 | __u16 remote_mps; |
359 | __u16 mps; | ||
345 | 360 | ||
346 | __le16 sport; | 361 | __le16 sport; |
347 | 362 | ||
348 | struct timer_list retrans_timer; | 363 | struct timer_list retrans_timer; |
349 | struct timer_list monitor_timer; | 364 | struct timer_list monitor_timer; |
365 | struct timer_list ack_timer; | ||
350 | struct sk_buff_head tx_queue; | 366 | struct sk_buff_head tx_queue; |
351 | struct sk_buff_head srej_queue; | 367 | struct sk_buff_head srej_queue; |
368 | struct sk_buff_head busy_queue; | ||
369 | struct work_struct busy_work; | ||
352 | struct srej_list srej_l; | 370 | struct srej_list srej_l; |
353 | struct l2cap_conn *conn; | 371 | struct l2cap_conn *conn; |
354 | struct sock *next_c; | 372 | struct sock *next_c; |
@@ -367,19 +385,24 @@ struct l2cap_pinfo { | |||
367 | #define L2CAP_CONF_MAX_CONF_REQ 2 | 385 | #define L2CAP_CONF_MAX_CONF_REQ 2 |
368 | #define L2CAP_CONF_MAX_CONF_RSP 2 | 386 | #define L2CAP_CONF_MAX_CONF_RSP 2 |
369 | 387 | ||
370 | #define L2CAP_CONN_SAR_SDU 0x01 | 388 | #define L2CAP_CONN_SAR_SDU 0x0001 |
371 | #define L2CAP_CONN_SREJ_SENT 0x02 | 389 | #define L2CAP_CONN_SREJ_SENT 0x0002 |
372 | #define L2CAP_CONN_WAIT_F 0x04 | 390 | #define L2CAP_CONN_WAIT_F 0x0004 |
373 | #define L2CAP_CONN_SREJ_ACT 0x08 | 391 | #define L2CAP_CONN_SREJ_ACT 0x0008 |
374 | #define L2CAP_CONN_SEND_PBIT 0x10 | 392 | #define L2CAP_CONN_SEND_PBIT 0x0010 |
375 | #define L2CAP_CONN_REMOTE_BUSY 0x20 | 393 | #define L2CAP_CONN_REMOTE_BUSY 0x0020 |
376 | #define L2CAP_CONN_LOCAL_BUSY 0x40 | 394 | #define L2CAP_CONN_LOCAL_BUSY 0x0040 |
377 | #define L2CAP_CONN_REJ_ACT 0x80 | 395 | #define L2CAP_CONN_REJ_ACT 0x0080 |
396 | #define L2CAP_CONN_SEND_FBIT 0x0100 | ||
397 | #define L2CAP_CONN_RNR_SENT 0x0200 | ||
398 | #define L2CAP_CONN_SAR_RETRY 0x0400 | ||
378 | 399 | ||
379 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | 400 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ |
380 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 401 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); |
381 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ | 402 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ |
382 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 403 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); |
404 | #define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \ | ||
405 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | ||
383 | 406 | ||
384 | static inline int l2cap_tx_window_full(struct sock *sk) | 407 | static inline int l2cap_tx_window_full(struct sock *sk) |
385 | { | 408 | { |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 921d7b3c7f8d..a140847d622c 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -106,19 +106,19 @@ struct rfcomm_hdr { | |||
106 | u8 addr; | 106 | u8 addr; |
107 | u8 ctrl; | 107 | u8 ctrl; |
108 | u8 len; // Actual size can be 2 bytes | 108 | u8 len; // Actual size can be 2 bytes |
109 | } __attribute__ ((packed)); | 109 | } __packed; |
110 | 110 | ||
111 | struct rfcomm_cmd { | 111 | struct rfcomm_cmd { |
112 | u8 addr; | 112 | u8 addr; |
113 | u8 ctrl; | 113 | u8 ctrl; |
114 | u8 len; | 114 | u8 len; |
115 | u8 fcs; | 115 | u8 fcs; |
116 | } __attribute__ ((packed)); | 116 | } __packed; |
117 | 117 | ||
118 | struct rfcomm_mcc { | 118 | struct rfcomm_mcc { |
119 | u8 type; | 119 | u8 type; |
120 | u8 len; | 120 | u8 len; |
121 | } __attribute__ ((packed)); | 121 | } __packed; |
122 | 122 | ||
123 | struct rfcomm_pn { | 123 | struct rfcomm_pn { |
124 | u8 dlci; | 124 | u8 dlci; |
@@ -128,7 +128,7 @@ struct rfcomm_pn { | |||
128 | __le16 mtu; | 128 | __le16 mtu; |
129 | u8 max_retrans; | 129 | u8 max_retrans; |
130 | u8 credits; | 130 | u8 credits; |
131 | } __attribute__ ((packed)); | 131 | } __packed; |
132 | 132 | ||
133 | struct rfcomm_rpn { | 133 | struct rfcomm_rpn { |
134 | u8 dlci; | 134 | u8 dlci; |
@@ -138,17 +138,17 @@ struct rfcomm_rpn { | |||
138 | u8 xon_char; | 138 | u8 xon_char; |
139 | u8 xoff_char; | 139 | u8 xoff_char; |
140 | __le16 param_mask; | 140 | __le16 param_mask; |
141 | } __attribute__ ((packed)); | 141 | } __packed; |
142 | 142 | ||
143 | struct rfcomm_rls { | 143 | struct rfcomm_rls { |
144 | u8 dlci; | 144 | u8 dlci; |
145 | u8 status; | 145 | u8 status; |
146 | } __attribute__ ((packed)); | 146 | } __packed; |
147 | 147 | ||
148 | struct rfcomm_msc { | 148 | struct rfcomm_msc { |
149 | u8 dlci; | 149 | u8 dlci; |
150 | u8 v24_sig; | 150 | u8 v24_sig; |
151 | } __attribute__ ((packed)); | 151 | } __packed; |
152 | 152 | ||
153 | /* ---- Core structures, flags etc ---- */ | 153 | /* ---- Core structures, flags etc ---- */ |
154 | 154 | ||
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h new file mode 100644 index 000000000000..6da573c75d54 --- /dev/null +++ b/include/net/caif/caif_dev.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CAIF_DEV_H_ | ||
8 | #define CAIF_DEV_H_ | ||
9 | |||
10 | #include <net/caif/caif_layer.h> | ||
11 | #include <net/caif/cfcnfg.h> | ||
12 | #include <linux/caif/caif_socket.h> | ||
13 | #include <linux/if.h> | ||
14 | |||
15 | /** | ||
16 | * struct caif_param - CAIF parameters. | ||
17 | * @size: Length of data | ||
18 | * @data: Binary Data Blob | ||
19 | */ | ||
20 | struct caif_param { | ||
21 | u16 size; | ||
22 | u8 data[256]; | ||
23 | }; | ||
24 | |||
25 | /** | ||
26 | * struct caif_connect_request - Request data for CAIF channel setup. | ||
27 | * @protocol: Type of CAIF protocol to use (at, datagram etc) | ||
28 | * @sockaddr: Socket address to connect. | ||
29 | * @priority: Priority of the connection. | ||
30 | * @link_selector: Link selector (high bandwidth or low latency) | ||
31 | * @link_name: Name of the CAIF Link Layer to use. | ||
32 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). | ||
33 | * | ||
34 | * This struct is used when connecting a CAIF channel. | ||
35 | * It contains all CAIF channel configuration options. | ||
36 | */ | ||
37 | struct caif_connect_request { | ||
38 | enum caif_protocol_type protocol; | ||
39 | struct sockaddr_caif sockaddr; | ||
40 | enum caif_channel_priority priority; | ||
41 | enum caif_link_selector link_selector; | ||
42 | char link_name[16]; | ||
43 | struct caif_param param; | ||
44 | }; | ||
45 | |||
46 | /** | ||
47 | * caif_connect_client - Connect a client to CAIF Core Stack. | ||
48 | * @config: Channel setup parameters, specifying what address | ||
49 | * to connect on the Modem. | ||
50 | * @client_layer: User implementation of client layer. This layer | ||
51 | * MUST have receive and control callback functions | ||
52 | * implemented. | ||
53 | * @ifindex: Link layer interface index used for this connection. | ||
54 | * @headroom: Head room needed by CAIF protocol. | ||
55 | * @tailroom: Tail room needed by CAIF protocol. | ||
56 | * | ||
57 | * This function connects a CAIF channel. The Client must implement | ||
58 | * the struct cflayer. This layer represents the Client layer and holds | ||
59 | * receive functions and control callback functions. Control callback | ||
60 | * function will receive information about connect/disconnect responses, | ||
61 | * flow control etc (see enum caif_control). | ||
62 | * E.g. CAIF Socket will call this function for each socket it connects | ||
63 | * and have one client_layer instance for each socket. | ||
64 | */ | ||
65 | int caif_connect_client(struct caif_connect_request *conn_req, | ||
66 | struct cflayer *client_layer, int *ifindex, | ||
67 | int *headroom, int *tailroom); | ||
68 | |||
69 | /** | ||
70 | * caif_disconnect_client - Disconnects a client from the CAIF stack. | ||
71 | * | ||
72 | * @client_layer: Client layer to be removed. | ||
73 | */ | ||
74 | int caif_disconnect_client(struct cflayer *client_layer); | ||
75 | |||
76 | /** | ||
77 | * caif_release_client - Release adaptation layer reference to client. | ||
78 | * | ||
79 | * @client_layer: Client layer. | ||
80 | * | ||
81 | * Releases a client/adaptation layer use of the caif stack. | ||
82 | * This function must be used after caif_disconnect_client to | ||
83 | * decrease the reference count of the service layer. | ||
84 | */ | ||
85 | void caif_release_client(struct cflayer *client_layer); | ||
86 | |||
87 | /** | ||
88 | * connect_req_to_link_param - Translate configuration parameters | ||
89 | * from socket format to internal format. | ||
90 | * @cnfg: Pointer to configuration handler | ||
91 | * @con_req: Configuration parameters supplied in function | ||
92 | * caif_connect_client | ||
93 | * @channel_setup_param: Parameters supplied to the CAIF Core stack for | ||
94 | * setting up channels. | ||
95 | * | ||
96 | */ | ||
97 | int connect_req_to_link_param(struct cfcnfg *cnfg, | ||
98 | struct caif_connect_request *con_req, | ||
99 | struct cfctrl_link_param *channel_setup_param); | ||
100 | |||
101 | /** | ||
102 | * get_caif_conf() - Get the configuration handler. | ||
103 | */ | ||
104 | struct cfcnfg *get_caif_conf(void); | ||
105 | |||
106 | |||
107 | #endif /* CAIF_DEV_H_ */ | ||
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h new file mode 100644 index 000000000000..d02f044adb8a --- /dev/null +++ b/include/net/caif/caif_device.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CAIF_DEVICE_H_ | ||
8 | #define CAIF_DEVICE_H_ | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/net.h> | ||
11 | #include <linux/netdevice.h> | ||
12 | #include <linux/caif/caif_socket.h> | ||
13 | #include <net/caif/caif_device.h> | ||
14 | |||
15 | /** | ||
16 | * struct caif_dev_common - data shared between CAIF drivers and stack. | ||
17 | * @flowctrl: Flow Control callback function. This function is | ||
18 | * supplied by CAIF Core Stack and is used by CAIF | ||
19 | * Link Layer to send flow-stop to CAIF Core. | ||
20 | * The flow information will be distributed to all | ||
21 | * clients of CAIF. | ||
22 | * | ||
23 | * @link_select: Profile of device, either high-bandwidth or | ||
24 | * low-latency. This member is set by CAIF Link | ||
25 | * Layer Device in order to indicate if this device | ||
26 | * is a high bandwidth or low latency device. | ||
27 | * | ||
28 | * @use_frag: CAIF Frames may be fragmented. | ||
29 | * Is set by CAIF Link Layer in order to indicate if the | ||
30 | * interface receives fragmented frames that must be | ||
31 | * assembled by CAIF Core Layer. | ||
32 | * | ||
33 | * @use_fcs: Indicate if Frame CheckSum (fcs) is used. | ||
34 | * Is set if the physical interface is | ||
35 | * using Frame Checksum on the CAIF Frames. | ||
36 | * | ||
37 | * @use_stx: Indicate STart of frame eXtension (stx) in use. | ||
38 | * Is set if the CAIF Link Layer expects | ||
39 | * CAIF Frames to start with the STX byte. | ||
40 | * | ||
41 | * This structure is shared between the CAIF drivers and the CAIF stack. | ||
42 | * It is used by the device to register its behavior. | ||
43 | * CAIF Core layer must set the member flowctrl in order to supply | ||
44 | * CAIF Link Layer with the flow control function. | ||
45 | * | ||
46 | */ | ||
47 | struct caif_dev_common { | ||
48 | void (*flowctrl)(struct net_device *net, int on); | ||
49 | enum caif_link_selector link_select; | ||
50 | int use_frag; | ||
51 | int use_fcs; | ||
52 | int use_stx; | ||
53 | }; | ||
54 | |||
55 | #endif /* CAIF_DEVICE_H_ */ | ||
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h new file mode 100644 index 000000000000..c8b07a904e78 --- /dev/null +++ b/include/net/caif/caif_layer.h | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland / sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CAIF_LAYER_H_ | ||
8 | #define CAIF_LAYER_H_ | ||
9 | |||
10 | #include <linux/list.h> | ||
11 | |||
12 | struct cflayer; | ||
13 | struct cfpkt; | ||
14 | struct cfpktq; | ||
15 | struct caif_payload_info; | ||
16 | struct caif_packet_funcs; | ||
17 | |||
18 | |||
19 | #define CAIF_LAYER_NAME_SZ 16 | ||
20 | |||
21 | /** | ||
22 | * caif_assert() - Assert function for CAIF. | ||
23 | * @assert: expression to evaluate. | ||
24 | * | ||
25 | * This function will print a error message and a do WARN_ON if the | ||
26 | * assertion failes. Normally this will do a stack up at the current location. | ||
27 | */ | ||
28 | #define caif_assert(assert) \ | ||
29 | do { \ | ||
30 | if (!(assert)) { \ | ||
31 | pr_err("caif:Assert detected:'%s'\n", #assert); \ | ||
32 | WARN_ON(!(assert)); \ | ||
33 | } \ | ||
34 | } while (0) | ||
35 | |||
36 | |||
37 | /** | ||
38 | * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd(). | ||
39 | * | ||
40 | * @CAIF_CTRLCMD_FLOW_OFF_IND: Flow Control is OFF, transmit function | ||
41 | * should stop sending data | ||
42 | * | ||
43 | * @CAIF_CTRLCMD_FLOW_ON_IND: Flow Control is ON, transmit function | ||
44 | * can start sending data | ||
45 | * | ||
46 | * @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: Remote end modem has decided to close | ||
47 | * down channel | ||
48 | * | ||
49 | * @CAIF_CTRLCMD_INIT_RSP: Called initially when the layer below | ||
50 | * has finished initialization | ||
51 | * | ||
52 | * @CAIF_CTRLCMD_DEINIT_RSP: Called when de-initialization is | ||
53 | * complete | ||
54 | * | ||
55 | * @CAIF_CTRLCMD_INIT_FAIL_RSP: Called if initialization fails | ||
56 | * | ||
57 | * @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: CAIF Link layer temporarily cannot | ||
58 | * send more packets. | ||
59 | * @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND: Called if CAIF Link layer is able | ||
60 | * to send packets again. | ||
61 | * @_CAIF_CTRLCMD_PHYIF_DOWN_IND: Called if CAIF Link layer is going | ||
62 | * down. | ||
63 | * | ||
64 | * These commands are sent upwards in the CAIF stack to the CAIF Client. | ||
65 | * They are used for signaling originating from the modem or CAIF Link Layer. | ||
66 | * These are either responses (*_RSP) or events (*_IND). | ||
67 | */ | ||
68 | enum caif_ctrlcmd { | ||
69 | CAIF_CTRLCMD_FLOW_OFF_IND, | ||
70 | CAIF_CTRLCMD_FLOW_ON_IND, | ||
71 | CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, | ||
72 | CAIF_CTRLCMD_INIT_RSP, | ||
73 | CAIF_CTRLCMD_DEINIT_RSP, | ||
74 | CAIF_CTRLCMD_INIT_FAIL_RSP, | ||
75 | _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND, | ||
76 | _CAIF_CTRLCMD_PHYIF_FLOW_ON_IND, | ||
77 | _CAIF_CTRLCMD_PHYIF_DOWN_IND, | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * enum caif_modemcmd - Modem Control Signaling, sent from CAIF Client | ||
82 | * to the CAIF Link Layer or modem. | ||
83 | * | ||
84 | * @CAIF_MODEMCMD_FLOW_ON_REQ: Flow Control is ON, transmit function | ||
85 | * can start sending data. | ||
86 | * | ||
87 | * @CAIF_MODEMCMD_FLOW_OFF_REQ: Flow Control is OFF, transmit function | ||
88 | * should stop sending data. | ||
89 | * | ||
90 | * @_CAIF_MODEMCMD_PHYIF_USEFULL: Notify physical layer that it is in use | ||
91 | * | ||
92 | * @_CAIF_MODEMCMD_PHYIF_USELESS: Notify physical layer that it is | ||
93 | * no longer in use. | ||
94 | * | ||
95 | * These are requests sent 'downwards' in the stack. | ||
96 | * Flow ON, OFF can be indicated to the modem. | ||
97 | */ | ||
98 | enum caif_modemcmd { | ||
99 | CAIF_MODEMCMD_FLOW_ON_REQ = 0, | ||
100 | CAIF_MODEMCMD_FLOW_OFF_REQ = 1, | ||
101 | _CAIF_MODEMCMD_PHYIF_USEFULL = 3, | ||
102 | _CAIF_MODEMCMD_PHYIF_USELESS = 4 | ||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * enum caif_direction - CAIF Packet Direction. | ||
107 | * Indicate if a packet is to be sent out or to be received in. | ||
108 | * @CAIF_DIR_IN: Incoming packet received. | ||
109 | * @CAIF_DIR_OUT: Outgoing packet to be transmitted. | ||
110 | */ | ||
111 | enum caif_direction { | ||
112 | CAIF_DIR_IN = 0, | ||
113 | CAIF_DIR_OUT = 1 | ||
114 | }; | ||
115 | |||
116 | /** | ||
117 | * struct cflayer - CAIF Stack layer. | ||
118 | * Defines the framework for the CAIF Core Stack. | ||
119 | * @up: Pointer up to the layer above. | ||
120 | * @dn: Pointer down to the layer below. | ||
121 | * @node: List node used when layer participate in a list. | ||
122 | * @receive: Packet receive function. | ||
123 | * @transmit: Packet transmit funciton. | ||
124 | * @ctrlcmd: Used for control signalling upwards in the stack. | ||
125 | * @modemcmd: Used for control signaling downwards in the stack. | ||
126 | * @prio: Priority of this layer. | ||
127 | * @id: The identity of this layer | ||
128 | * @type: The type of this layer | ||
129 | * @name: Name of the layer. | ||
130 | * | ||
131 | * This structure defines the layered structure in CAIF. | ||
132 | * | ||
133 | * It defines CAIF layering structure, used by all CAIF Layers and the | ||
134 | * layers interfacing CAIF. | ||
135 | * | ||
136 | * In order to integrate with CAIF an adaptation layer on top of the CAIF stack | ||
137 | * and PHY layer below the CAIF stack | ||
138 | * must be implemented. These layer must follow the design principles below. | ||
139 | * | ||
140 | * Principles for layering of protocol layers: | ||
141 | * - All layers must use this structure. If embedding it, then place this | ||
142 | * structure first in the layer specific structure. | ||
143 | * | ||
144 | * - Each layer should not depend on any others layer private data. | ||
145 | * | ||
146 | * - In order to send data upwards do | ||
147 | * layer->up->receive(layer->up, packet); | ||
148 | * | ||
149 | * - In order to send data downwards do | ||
150 | * layer->dn->transmit(layer->dn, info, packet); | ||
151 | */ | ||
152 | struct cflayer { | ||
153 | struct cflayer *up; | ||
154 | struct cflayer *dn; | ||
155 | struct list_head node; | ||
156 | |||
157 | /* | ||
158 | * receive() - Receive Function. | ||
159 | * Contract: Each layer must implement a receive function passing the | ||
160 | * CAIF packets upwards in the stack. | ||
161 | * Packet handling rules: | ||
162 | * - The CAIF packet (cfpkt) cannot be accessed after | ||
163 | * passing it to the next layer using up->receive(). | ||
164 | * - If parsing of the packet fails, the packet must be | ||
165 | * destroyed and -1 returned from the function. | ||
166 | * - If parsing succeeds (and above layers return OK) then | ||
167 | * the function must return a value > 0. | ||
168 | * | ||
169 | * Returns result < 0 indicates an error, 0 or positive value | ||
170 | * indicates success. | ||
171 | * | ||
172 | * @layr: Pointer to the current layer the receive function is | ||
173 | * implemented for (this pointer). | ||
174 | * @cfpkt: Pointer to CaifPacket to be handled. | ||
175 | */ | ||
176 | int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt); | ||
177 | |||
178 | /* | ||
179 | * transmit() - Transmit Function. | ||
180 | * Contract: Each layer must implement a transmit function passing the | ||
181 | * CAIF packet downwards in the stack. | ||
182 | * Packet handling rules: | ||
183 | * - The CAIF packet (cfpkt) ownership is passed to the | ||
184 | * transmit function. This means that the the packet | ||
185 | * cannot be accessed after passing it to the below | ||
186 | * layer using dn->transmit(). | ||
187 | * | ||
188 | * - If transmit fails, however, the ownership is returned | ||
189 | * to thecaller. The caller of "dn->transmit()" must | ||
190 | * destroy or resend packet. | ||
191 | * | ||
192 | * - Return value less than zero means error, zero or | ||
193 | * greater than zero means OK. | ||
194 | * | ||
195 | * result < 0 indicates an error, 0 or positive value | ||
196 | * indicate success. | ||
197 | * | ||
198 | * @layr: Pointer to the current layer the receive function | ||
199 | * isimplemented for (this pointer). | ||
200 | * @cfpkt: Pointer to CaifPacket to be handled. | ||
201 | */ | ||
202 | int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt); | ||
203 | |||
204 | /* | ||
205 | * cttrlcmd() - Control Function upwards in CAIF Stack. | ||
206 | * Used for signaling responses (CAIF_CTRLCMD_*_RSP) | ||
207 | * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND) | ||
208 | * | ||
209 | * @layr: Pointer to the current layer the receive function | ||
210 | * is implemented for (this pointer). | ||
211 | * @ctrl: Control Command. | ||
212 | */ | ||
213 | void (*ctrlcmd) (struct cflayer *layr, enum caif_ctrlcmd ctrl, | ||
214 | int phyid); | ||
215 | |||
216 | /* | ||
217 | * modemctrl() - Control Function used for controlling the modem. | ||
218 | * Used to signal down-wards in the CAIF stack. | ||
219 | * Returns 0 on success, < 0 upon failure. | ||
220 | * | ||
221 | * @layr: Pointer to the current layer the receive function | ||
222 | * is implemented for (this pointer). | ||
223 | * @ctrl: Control Command. | ||
224 | */ | ||
225 | int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl); | ||
226 | |||
227 | unsigned short prio; | ||
228 | unsigned int id; | ||
229 | unsigned int type; | ||
230 | char name[CAIF_LAYER_NAME_SZ]; | ||
231 | }; | ||
232 | |||
233 | /** | ||
234 | * layer_set_up() - Set the up pointer for a specified layer. | ||
235 | * @layr: Layer where up pointer shall be set. | ||
236 | * @above: Layer above. | ||
237 | */ | ||
238 | #define layer_set_up(layr, above) ((layr)->up = (struct cflayer *)(above)) | ||
239 | |||
240 | /** | ||
241 | * layer_set_dn() - Set the down pointer for a specified layer. | ||
242 | * @layr: Layer where down pointer shall be set. | ||
243 | * @below: Layer below. | ||
244 | */ | ||
245 | #define layer_set_dn(layr, below) ((layr)->dn = (struct cflayer *)(below)) | ||
246 | |||
247 | /** | ||
248 | * struct dev_info - Physical Device info information about physical layer. | ||
249 | * @dev: Pointer to native physical device. | ||
250 | * @id: Physical ID of the physical connection used by the | ||
251 | * logical CAIF connection. Used by service layers to | ||
252 | * identify their physical id to Caif MUX (CFMUXL)so | ||
253 | * that the MUX can add the correct physical ID to the | ||
254 | * packet. | ||
255 | */ | ||
256 | struct dev_info { | ||
257 | void *dev; | ||
258 | unsigned int id; | ||
259 | }; | ||
260 | |||
261 | /** | ||
262 | * struct caif_payload_info - Payload information embedded in packet (sk_buff). | ||
263 | * | ||
264 | * @dev_info: Information about the receiving device. | ||
265 | * | ||
266 | * @hdr_len: Header length, used to align pay load on 32bit boundary. | ||
267 | * | ||
268 | * @channel_id: Channel ID of the logical CAIF connection. | ||
269 | * Used by mux to insert channel id into the caif packet. | ||
270 | */ | ||
271 | struct caif_payload_info { | ||
272 | struct dev_info *dev_info; | ||
273 | unsigned short hdr_len; | ||
274 | unsigned short channel_id; | ||
275 | }; | ||
276 | |||
277 | #endif /* CAIF_LAYER_H_ */ | ||
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h new file mode 100644 index 000000000000..ce4570dff020 --- /dev/null +++ b/include/net/caif/caif_spi.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Daniel Martensson / Daniel.Martensson@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CAIF_SPI_H_ | ||
8 | #define CAIF_SPI_H_ | ||
9 | |||
10 | #include <net/caif/caif_device.h> | ||
11 | |||
12 | #define SPI_CMD_WR 0x00 | ||
13 | #define SPI_CMD_RD 0x01 | ||
14 | #define SPI_CMD_EOT 0x02 | ||
15 | #define SPI_CMD_IND 0x04 | ||
16 | |||
17 | #define SPI_DMA_BUF_LEN 8192 | ||
18 | |||
19 | #define WL_SZ 2 /* 16 bits. */ | ||
20 | #define SPI_CMD_SZ 4 /* 32 bits. */ | ||
21 | #define SPI_IND_SZ 4 /* 32 bits. */ | ||
22 | |||
23 | #define SPI_XFER 0 | ||
24 | #define SPI_SS_ON 1 | ||
25 | #define SPI_SS_OFF 2 | ||
26 | #define SPI_TERMINATE 3 | ||
27 | |||
28 | /* Minimum time between different levels is 50 microseconds. */ | ||
29 | #define MIN_TRANSITION_TIME_USEC 50 | ||
30 | |||
31 | /* Defines for calculating duration of SPI transfers for a particular | ||
32 | * number of bytes. | ||
33 | */ | ||
34 | #define SPI_MASTER_CLK_MHZ 13 | ||
35 | #define SPI_XFER_TIME_USEC(bytes, clk) (((bytes) * 8) / clk) | ||
36 | |||
37 | /* Normally this should be aligned on the modem in order to benefit from full | ||
38 | * duplex transfers. However a size of 8188 provokes errors when running with | ||
39 | * the modem. These errors occur when packet sizes approaches 4 kB of data. | ||
40 | */ | ||
41 | #define CAIF_MAX_SPI_FRAME 4092 | ||
42 | |||
43 | /* Maximum number of uplink CAIF frames that can reside in the same SPI frame. | ||
44 | * This number should correspond with the modem setting. The application side | ||
45 | * CAIF accepts any number of embedded downlink CAIF frames. | ||
46 | */ | ||
47 | #define CAIF_MAX_SPI_PKTS 9 | ||
48 | |||
49 | /* Decides if SPI buffers should be prefilled with 0xFF pattern for easier | ||
50 | * debugging. Both TX and RX buffers will be filled before the transfer. | ||
51 | */ | ||
52 | #define CFSPI_DBG_PREFILL 0 | ||
53 | |||
54 | /* Structure describing a SPI transfer. */ | ||
55 | struct cfspi_xfer { | ||
56 | u16 tx_dma_len; | ||
57 | u16 rx_dma_len; | ||
58 | void *va_tx; | ||
59 | dma_addr_t pa_tx; | ||
60 | void *va_rx; | ||
61 | dma_addr_t pa_rx; | ||
62 | }; | ||
63 | |||
64 | /* Structure implemented by the SPI interface. */ | ||
65 | struct cfspi_ifc { | ||
66 | void (*ss_cb) (bool assert, struct cfspi_ifc *ifc); | ||
67 | void (*xfer_done_cb) (struct cfspi_ifc *ifc); | ||
68 | void *priv; | ||
69 | }; | ||
70 | |||
71 | /* Structure implemented by SPI clients. */ | ||
72 | struct cfspi_dev { | ||
73 | int (*init_xfer) (struct cfspi_xfer *xfer, struct cfspi_dev *dev); | ||
74 | void (*sig_xfer) (bool xfer, struct cfspi_dev *dev); | ||
75 | struct cfspi_ifc *ifc; | ||
76 | char *name; | ||
77 | u32 clk_mhz; | ||
78 | void *priv; | ||
79 | }; | ||
80 | |||
81 | /* Enumeration describing the CAIF SPI state. */ | ||
82 | enum cfspi_state { | ||
83 | CFSPI_STATE_WAITING = 0, | ||
84 | CFSPI_STATE_AWAKE, | ||
85 | CFSPI_STATE_FETCH_PKT, | ||
86 | CFSPI_STATE_GET_NEXT, | ||
87 | CFSPI_STATE_INIT_XFER, | ||
88 | CFSPI_STATE_WAIT_ACTIVE, | ||
89 | CFSPI_STATE_SIG_ACTIVE, | ||
90 | CFSPI_STATE_WAIT_XFER_DONE, | ||
91 | CFSPI_STATE_XFER_DONE, | ||
92 | CFSPI_STATE_WAIT_INACTIVE, | ||
93 | CFSPI_STATE_SIG_INACTIVE, | ||
94 | CFSPI_STATE_DELIVER_PKT, | ||
95 | CFSPI_STATE_MAX, | ||
96 | }; | ||
97 | |||
98 | /* Structure implemented by SPI physical interfaces. */ | ||
99 | struct cfspi { | ||
100 | struct caif_dev_common cfdev; | ||
101 | struct net_device *ndev; | ||
102 | struct platform_device *pdev; | ||
103 | struct sk_buff_head qhead; | ||
104 | struct sk_buff_head chead; | ||
105 | u16 cmd; | ||
106 | u16 tx_cpck_len; | ||
107 | u16 tx_npck_len; | ||
108 | u16 rx_cpck_len; | ||
109 | u16 rx_npck_len; | ||
110 | struct cfspi_ifc ifc; | ||
111 | struct cfspi_xfer xfer; | ||
112 | struct cfspi_dev *dev; | ||
113 | unsigned long state; | ||
114 | struct work_struct work; | ||
115 | struct workqueue_struct *wq; | ||
116 | struct list_head list; | ||
117 | int flow_off_sent; | ||
118 | u32 qd_low_mark; | ||
119 | u32 qd_high_mark; | ||
120 | struct completion comp; | ||
121 | wait_queue_head_t wait; | ||
122 | spinlock_t lock; | ||
123 | bool flow_stop; | ||
124 | #ifdef CONFIG_DEBUG_FS | ||
125 | enum cfspi_state dbg_state; | ||
126 | u16 pcmd; | ||
127 | u16 tx_ppck_len; | ||
128 | u16 rx_ppck_len; | ||
129 | struct dentry *dbgfs_dir; | ||
130 | struct dentry *dbgfs_state; | ||
131 | struct dentry *dbgfs_frame; | ||
132 | #endif /* CONFIG_DEBUG_FS */ | ||
133 | }; | ||
134 | |||
135 | extern int spi_frm_align; | ||
136 | extern int spi_up_head_align; | ||
137 | extern int spi_up_tail_align; | ||
138 | extern int spi_down_head_align; | ||
139 | extern int spi_down_tail_align; | ||
140 | extern struct platform_driver cfspi_spi_driver; | ||
141 | |||
142 | void cfspi_dbg_state(struct cfspi *cfspi, int state); | ||
143 | int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len); | ||
144 | int cfspi_xmitlen(struct cfspi *cfspi); | ||
145 | int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len); | ||
146 | int cfspi_spi_remove(struct platform_device *pdev); | ||
147 | int cfspi_spi_probe(struct platform_device *pdev); | ||
148 | int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len); | ||
149 | int cfspi_xmitlen(struct cfspi *cfspi); | ||
150 | int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len); | ||
151 | void cfspi_xfer(struct work_struct *work); | ||
152 | |||
153 | #endif /* CAIF_SPI_H_ */ | ||
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h new file mode 100644 index 000000000000..bd646faffa47 --- /dev/null +++ b/include/net/caif/cfcnfg.h | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFCNFG_H_ | ||
8 | #define CFCNFG_H_ | ||
9 | #include <linux/spinlock.h> | ||
10 | #include <linux/netdevice.h> | ||
11 | #include <net/caif/caif_layer.h> | ||
12 | #include <net/caif/cfctrl.h> | ||
13 | |||
14 | struct cfcnfg; | ||
15 | |||
16 | /** | ||
17 | * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack | ||
18 | * | ||
19 | * @CFPHYTYPE_FRAG: Fragmented frames physical interface. | ||
20 | * @CFPHYTYPE_CAIF: Generic CAIF physical interface | ||
21 | */ | ||
22 | enum cfcnfg_phy_type { | ||
23 | CFPHYTYPE_FRAG = 1, | ||
24 | CFPHYTYPE_CAIF, | ||
25 | CFPHYTYPE_MAX | ||
26 | }; | ||
27 | |||
28 | /** | ||
29 | * enum cfcnfg_phy_preference - Physical preference HW Abstraction | ||
30 | * | ||
31 | * @CFPHYPREF_UNSPECIFIED: Default physical interface | ||
32 | * | ||
33 | * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency | ||
34 | * traffic | ||
35 | * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth | ||
36 | * traffic | ||
37 | * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem | ||
38 | * responses. | ||
39 | * | ||
40 | */ | ||
41 | enum cfcnfg_phy_preference { | ||
42 | CFPHYPREF_UNSPECIFIED, | ||
43 | CFPHYPREF_LOW_LAT, | ||
44 | CFPHYPREF_HIGH_BW, | ||
45 | CFPHYPREF_LOOP | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * cfcnfg_create() - Create the CAIF configuration object. | ||
50 | */ | ||
51 | struct cfcnfg *cfcnfg_create(void); | ||
52 | |||
53 | /** | ||
54 | * cfcnfg_remove() - Remove the CFCNFG object | ||
55 | * @cfg: config object | ||
56 | */ | ||
57 | void cfcnfg_remove(struct cfcnfg *cfg); | ||
58 | |||
59 | /** | ||
60 | * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. | ||
61 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
62 | * cfcnfg_create(). | ||
63 | * @phy_type: Specifies the type of physical interface, e.g. | ||
64 | * CFPHYTYPE_FRAG. | ||
65 | * @dev: Pointer to link layer device | ||
66 | * @phy_layer: Specify the physical layer. The transmit function | ||
67 | * MUST be set in the structure. | ||
68 | * @phyid: The assigned physical ID for this layer, used in | ||
69 | * cfcnfg_add_adapt_layer to specify PHY for the link. | ||
70 | * @pref: The phy (link layer) preference. | ||
71 | * @fcs: Specify if checksum is used in CAIF Framing Layer. | ||
72 | * @stx: Specify if Start Of Frame eXtention is used. | ||
73 | */ | ||
74 | |||
75 | void | ||
76 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | ||
77 | struct net_device *dev, struct cflayer *phy_layer, | ||
78 | u16 *phyid, enum cfcnfg_phy_preference pref, | ||
79 | bool fcs, bool stx); | ||
80 | |||
81 | /** | ||
82 | * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. | ||
83 | * | ||
84 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
85 | * cfcnfg_create(). | ||
86 | * @phy_layer: Adaptation layer to be removed. | ||
87 | */ | ||
88 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); | ||
89 | |||
90 | /** | ||
91 | * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer. | ||
92 | * | ||
93 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
94 | * cfcnfg_create(). | ||
95 | * @adap_layer: Adaptation layer to be removed. | ||
96 | */ | ||
97 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, | ||
98 | struct cflayer *adap_layer); | ||
99 | |||
100 | /** | ||
101 | * cfcnfg_release_adap_layer - Used by client to release the adaptation layer. | ||
102 | * | ||
103 | * @adap_layer: Adaptation layer. | ||
104 | */ | ||
105 | void cfcnfg_release_adap_layer(struct cflayer *adap_layer); | ||
106 | |||
107 | /** | ||
108 | * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. | ||
109 | * | ||
110 | * The adaptation Layer is where the interface to application or higher-level | ||
111 | * driver functionality is implemented. | ||
112 | * | ||
113 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
114 | * cfcnfg_create(). | ||
115 | * @param: Link setup parameters. | ||
116 | * @adap_layer: Specify the adaptation layer; the receive and | ||
117 | * flow-control functions MUST be set in the structure. | ||
118 | * @ifindex: Link layer interface index used for this connection. | ||
119 | * @proto_head: Protocol head-space needed by CAIF protocol, | ||
120 | * excluding link layer. | ||
121 | * @proto_tail: Protocol tail-space needed by CAIF protocol, | ||
122 | * excluding link layer. | ||
123 | */ | ||
124 | int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, | ||
125 | struct cfctrl_link_param *param, | ||
126 | struct cflayer *adap_layer, | ||
127 | int *ifindex, | ||
128 | int *proto_head, | ||
129 | int *proto_tail); | ||
130 | |||
131 | /** | ||
132 | * cfcnfg_get_phyid() - Get physical ID, given type. | ||
133 | * Returns one of the physical interfaces matching the given type. | ||
134 | * Zero if no match is found. | ||
135 | * @cnfg: Configuration object | ||
136 | * @phy_pref: Caif Link Layer preference | ||
137 | */ | ||
138 | struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, | ||
139 | enum cfcnfg_phy_preference phy_pref); | ||
140 | |||
141 | /** | ||
142 | * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer | ||
143 | * @cnfg: Configuration object | ||
144 | * @name: Name of the Physical Layer (Caif Link Layer) | ||
145 | */ | ||
146 | int cfcnfg_get_named(struct cfcnfg *cnfg, char *name); | ||
147 | |||
148 | #endif /* CFCNFG_H_ */ | ||
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h new file mode 100644 index 000000000000..9402543fc20d --- /dev/null +++ b/include/net/caif/cfctrl.h | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFCTRL_H_ | ||
8 | #define CFCTRL_H_ | ||
9 | #include <net/caif/caif_layer.h> | ||
10 | #include <net/caif/cfsrvl.h> | ||
11 | |||
12 | /* CAIF Control packet commands */ | ||
13 | enum cfctrl_cmd { | ||
14 | CFCTRL_CMD_LINK_SETUP = 0, | ||
15 | CFCTRL_CMD_LINK_DESTROY = 1, | ||
16 | CFCTRL_CMD_LINK_ERR = 2, | ||
17 | CFCTRL_CMD_ENUM = 3, | ||
18 | CFCTRL_CMD_SLEEP = 4, | ||
19 | CFCTRL_CMD_WAKE = 5, | ||
20 | CFCTRL_CMD_LINK_RECONF = 6, | ||
21 | CFCTRL_CMD_START_REASON = 7, | ||
22 | CFCTRL_CMD_RADIO_SET = 8, | ||
23 | CFCTRL_CMD_MODEM_SET = 9, | ||
24 | CFCTRL_CMD_MASK = 0xf | ||
25 | }; | ||
26 | |||
27 | /* Channel types */ | ||
28 | enum cfctrl_srv { | ||
29 | CFCTRL_SRV_DECM = 0, | ||
30 | CFCTRL_SRV_VEI = 1, | ||
31 | CFCTRL_SRV_VIDEO = 2, | ||
32 | CFCTRL_SRV_DBG = 3, | ||
33 | CFCTRL_SRV_DATAGRAM = 4, | ||
34 | CFCTRL_SRV_RFM = 5, | ||
35 | CFCTRL_SRV_UTIL = 6, | ||
36 | CFCTRL_SRV_MASK = 0xf | ||
37 | }; | ||
38 | |||
39 | #define CFCTRL_RSP_BIT 0x20 | ||
40 | #define CFCTRL_ERR_BIT 0x10 | ||
41 | |||
42 | struct cfctrl_rsp { | ||
43 | void (*linksetup_rsp)(struct cflayer *layer, u8 linkid, | ||
44 | enum cfctrl_srv serv, u8 phyid, | ||
45 | struct cflayer *adapt_layer); | ||
46 | void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid); | ||
47 | void (*linkerror_ind)(void); | ||
48 | void (*enum_rsp)(void); | ||
49 | void (*sleep_rsp)(void); | ||
50 | void (*wake_rsp)(void); | ||
51 | void (*restart_rsp)(void); | ||
52 | void (*radioset_rsp)(void); | ||
53 | void (*reject_rsp)(struct cflayer *layer, u8 linkid, | ||
54 | struct cflayer *client_layer);; | ||
55 | }; | ||
56 | |||
57 | /* Link Setup Parameters for CAIF-Links. */ | ||
58 | struct cfctrl_link_param { | ||
59 | enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */ | ||
60 | u8 priority; /* (P4,P0) Priority of the channel */ | ||
61 | u8 phyid; /* (U2-U0) Physical interface to connect */ | ||
62 | u8 endpoint; /* (E1,E0) Endpoint for data channels */ | ||
63 | u8 chtype; /* (H1,H0) Channel-Type, applies to | ||
64 | * VEI, DEBUG */ | ||
65 | union { | ||
66 | struct { | ||
67 | u8 connid; /* (D7,D0) Video LinkId */ | ||
68 | } video; | ||
69 | |||
70 | struct { | ||
71 | u32 connid; /* (N31,Ngit0) Connection ID used | ||
72 | * for Datagram */ | ||
73 | } datagram; | ||
74 | |||
75 | struct { | ||
76 | u32 connid; /* Connection ID used for RFM */ | ||
77 | char volume[20]; /* Volume to mount for RFM */ | ||
78 | } rfm; /* Configuration for RFM */ | ||
79 | |||
80 | struct { | ||
81 | u16 fifosize_kb; /* Psock FIFO size in KB */ | ||
82 | u16 fifosize_bufs; /* Psock # signal buffers */ | ||
83 | char name[16]; /* Name of the PSOCK service */ | ||
84 | u8 params[255]; /* Link setup Parameters> */ | ||
85 | u16 paramlen; /* Length of Link Setup | ||
86 | * Parameters */ | ||
87 | } utility; /* Configuration for Utility Links (Psock) */ | ||
88 | } u; | ||
89 | }; | ||
90 | |||
91 | /* This structure is used internally in CFCTRL */ | ||
92 | struct cfctrl_request_info { | ||
93 | int sequence_no; | ||
94 | enum cfctrl_cmd cmd; | ||
95 | u8 channel_id; | ||
96 | struct cfctrl_link_param param; | ||
97 | struct cflayer *client_layer; | ||
98 | struct list_head list; | ||
99 | }; | ||
100 | |||
101 | struct cfctrl { | ||
102 | struct cfsrvl serv; | ||
103 | struct cfctrl_rsp res; | ||
104 | atomic_t req_seq_no; | ||
105 | atomic_t rsp_seq_no; | ||
106 | struct list_head list; | ||
107 | /* Protects from simultaneous access to first_req list */ | ||
108 | spinlock_t info_list_lock; | ||
109 | #ifndef CAIF_NO_LOOP | ||
110 | u8 loop_linkid; | ||
111 | int loop_linkused[256]; | ||
112 | /* Protects simultaneous access to loop_linkid and loop_linkused */ | ||
113 | spinlock_t loop_linkid_lock; | ||
114 | #endif | ||
115 | |||
116 | }; | ||
117 | |||
118 | void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid); | ||
119 | int cfctrl_linkup_request(struct cflayer *cfctrl, | ||
120 | struct cfctrl_link_param *param, | ||
121 | struct cflayer *user_layer); | ||
122 | int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid, | ||
123 | struct cflayer *client); | ||
124 | void cfctrl_sleep_req(struct cflayer *cfctrl); | ||
125 | void cfctrl_wake_req(struct cflayer *cfctrl); | ||
126 | void cfctrl_getstartreason_req(struct cflayer *cfctrl); | ||
127 | struct cflayer *cfctrl_create(void); | ||
128 | void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn); | ||
129 | void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up); | ||
130 | struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer); | ||
131 | bool cfctrl_req_eq(struct cfctrl_request_info *r1, | ||
132 | struct cfctrl_request_info *r2); | ||
133 | void cfctrl_insert_req(struct cfctrl *ctrl, | ||
134 | struct cfctrl_request_info *req); | ||
135 | struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, | ||
136 | struct cfctrl_request_info *req); | ||
137 | void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer); | ||
138 | |||
139 | #endif /* CFCTRL_H_ */ | ||
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h new file mode 100644 index 000000000000..3f14d2e1ce61 --- /dev/null +++ b/include/net/caif/cffrml.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFFRML_H_ | ||
8 | #define CFFRML_H_ | ||
9 | #include <net/caif/caif_layer.h> | ||
10 | |||
11 | struct cffrml; | ||
12 | struct cflayer *cffrml_create(u16 phyid, bool DoFCS); | ||
13 | void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up); | ||
14 | void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn); | ||
15 | |||
16 | #endif /* CFFRML_H_ */ | ||
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h new file mode 100644 index 000000000000..4e1b4f33423e --- /dev/null +++ b/include/net/caif/cfmuxl.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFMUXL_H_ | ||
8 | #define CFMUXL_H_ | ||
9 | #include <net/caif/caif_layer.h> | ||
10 | |||
11 | struct cfsrvl; | ||
12 | struct cffrml; | ||
13 | |||
14 | struct cflayer *cfmuxl_create(void); | ||
15 | int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid); | ||
16 | struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid); | ||
17 | int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid); | ||
18 | struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid); | ||
19 | bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid); | ||
20 | u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id); | ||
21 | |||
22 | #endif /* CFMUXL_H_ */ | ||
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h new file mode 100644 index 000000000000..fbc681beff52 --- /dev/null +++ b/include/net/caif/cfpkt.h | |||
@@ -0,0 +1,274 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFPKT_H_ | ||
8 | #define CFPKT_H_ | ||
9 | #include <net/caif/caif_layer.h> | ||
10 | #include <linux/types.h> | ||
11 | struct cfpkt; | ||
12 | |||
13 | /* Create a CAIF packet. | ||
14 | * len: Length of packet to be created | ||
15 | * @return New packet. | ||
16 | */ | ||
17 | struct cfpkt *cfpkt_create(u16 len); | ||
18 | |||
19 | /* Create a CAIF packet. | ||
20 | * data Data to copy. | ||
21 | * len Length of packet to be created | ||
22 | * @return New packet. | ||
23 | */ | ||
24 | struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len); | ||
25 | /* | ||
26 | * Destroy a CAIF Packet. | ||
27 | * pkt Packet to be destoyed. | ||
28 | */ | ||
29 | void cfpkt_destroy(struct cfpkt *pkt); | ||
30 | |||
31 | /* | ||
32 | * Extract header from packet. | ||
33 | * | ||
34 | * pkt Packet to extract header data from. | ||
35 | * data Pointer to copy the header data into. | ||
36 | * len Length of head data to copy. | ||
37 | * @return zero on success and error code upon failure | ||
38 | */ | ||
39 | int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len); | ||
40 | |||
41 | /* | ||
42 | * Peek header from packet. | ||
43 | * Reads data from packet without changing packet. | ||
44 | * | ||
45 | * pkt Packet to extract header data from. | ||
46 | * data Pointer to copy the header data into. | ||
47 | * len Length of head data to copy. | ||
48 | * @return zero on success and error code upon failure | ||
49 | */ | ||
50 | int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len); | ||
51 | |||
52 | /* | ||
53 | * Extract header from trailer (end of packet). | ||
54 | * | ||
55 | * pkt Packet to extract header data from. | ||
56 | * data Pointer to copy the trailer data into. | ||
57 | * len Length of header data to copy. | ||
58 | * @return zero on success and error code upon failure | ||
59 | */ | ||
60 | int cfpkt_extr_trail(struct cfpkt *pkt, void *data, u16 len); | ||
61 | |||
62 | /* | ||
63 | * Add header to packet. | ||
64 | * | ||
65 | * | ||
66 | * pkt Packet to add header data to. | ||
67 | * data Pointer to data to copy into the header. | ||
68 | * len Length of header data to copy. | ||
69 | * @return zero on success and error code upon failure | ||
70 | */ | ||
71 | int cfpkt_add_head(struct cfpkt *pkt, const void *data, u16 len); | ||
72 | |||
73 | /* | ||
74 | * Add trailer to packet. | ||
75 | * | ||
76 | * | ||
77 | * pkt Packet to add trailer data to. | ||
78 | * data Pointer to data to copy into the trailer. | ||
79 | * len Length of trailer data to copy. | ||
80 | * @return zero on success and error code upon failure | ||
81 | */ | ||
82 | int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len); | ||
83 | |||
84 | /* | ||
85 | * Pad trailer on packet. | ||
86 | * Moves data pointer in packet, no content copied. | ||
87 | * | ||
88 | * pkt Packet in which to pad trailer. | ||
89 | * len Length of padding to add. | ||
90 | * @return zero on success and error code upon failure | ||
91 | */ | ||
92 | int cfpkt_pad_trail(struct cfpkt *pkt, u16 len); | ||
93 | |||
94 | /* | ||
95 | * Add a single byte to packet body (tail). | ||
96 | * | ||
97 | * pkt Packet in which to add byte. | ||
98 | * data Byte to add. | ||
99 | * @return zero on success and error code upon failure | ||
100 | */ | ||
101 | int cfpkt_addbdy(struct cfpkt *pkt, const u8 data); | ||
102 | |||
103 | /* | ||
104 | * Add a data to packet body (tail). | ||
105 | * | ||
106 | * pkt Packet in which to add data. | ||
107 | * data Pointer to data to copy into the packet body. | ||
108 | * len Length of data to add. | ||
109 | * @return zero on success and error code upon failure | ||
110 | */ | ||
111 | int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len); | ||
112 | |||
113 | /* | ||
114 | * Checks whether there are more data to process in packet. | ||
115 | * pkt Packet to check. | ||
116 | * @return true if more data are available in packet false otherwise | ||
117 | */ | ||
118 | bool cfpkt_more(struct cfpkt *pkt); | ||
119 | |||
120 | /* | ||
121 | * Checks whether the packet is erroneous, | ||
122 | * i.e. if it has been attempted to extract more data than available in packet | ||
123 | * or writing more data than has been allocated in cfpkt_create(). | ||
124 | * pkt Packet to check. | ||
125 | * @return true on error false otherwise | ||
126 | */ | ||
127 | bool cfpkt_erroneous(struct cfpkt *pkt); | ||
128 | |||
129 | /* | ||
130 | * Get the packet length. | ||
131 | * pkt Packet to get length from. | ||
132 | * @return Number of bytes in packet. | ||
133 | */ | ||
134 | u16 cfpkt_getlen(struct cfpkt *pkt); | ||
135 | |||
136 | /* | ||
137 | * Set the packet length, by adjusting the trailer pointer according to length. | ||
138 | * pkt Packet to set length. | ||
139 | * len Packet length. | ||
140 | * @return Number of bytes in packet. | ||
141 | */ | ||
142 | int cfpkt_setlen(struct cfpkt *pkt, u16 len); | ||
143 | |||
144 | /* | ||
145 | * cfpkt_append - Appends a packet's data to another packet. | ||
146 | * dstpkt: Packet to append data into, WILL BE FREED BY THIS FUNCTION | ||
147 | * addpkt: Packet to be appended and automatically released, | ||
148 | * WILL BE FREED BY THIS FUNCTION. | ||
149 | * expectlen: Packet's expected total length. This should be considered | ||
150 | * as a hint. | ||
151 | * NB: Input packets will be destroyed after appending and cannot be used | ||
152 | * after calling this function. | ||
153 | * @return The new appended packet. | ||
154 | */ | ||
155 | struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, struct cfpkt *addpkt, | ||
156 | u16 expectlen); | ||
157 | |||
158 | /* | ||
159 | * cfpkt_split - Split a packet into two packets at the specified split point. | ||
160 | * pkt: Packet to be split (will contain the first part of the data on exit) | ||
161 | * pos: Position to split packet in two parts. | ||
162 | * @return The new packet, containing the second part of the data. | ||
163 | */ | ||
164 | struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos); | ||
165 | |||
166 | /* | ||
167 | * Iteration function, iterates the packet buffers from start to end. | ||
168 | * | ||
169 | * Checksum iteration function used to iterate buffers | ||
170 | * (we may have packets consisting of a chain of buffers) | ||
171 | * pkt: Packet to calculate checksum for | ||
172 | * iter_func: Function pointer to iteration function | ||
173 | * chks: Checksum calculated so far. | ||
174 | * buf: Pointer to the buffer to checksum | ||
175 | * len: Length of buf. | ||
176 | * data: Initial checksum value. | ||
177 | * @return Checksum of buffer. | ||
178 | */ | ||
179 | |||
180 | u16 cfpkt_iterate(struct cfpkt *pkt, | ||
181 | u16 (*iter_func)(u16 chks, void *buf, u16 len), | ||
182 | u16 data); | ||
183 | |||
184 | /* Append by giving user access to packet buffer | ||
185 | * cfpkt Packet to append to | ||
186 | * buf Buffer inside pkt that user shall copy data into | ||
187 | * buflen Length of buffer and number of bytes added to packet | ||
188 | * @return 0 on error, 1 on success | ||
189 | */ | ||
190 | int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen); | ||
191 | |||
192 | /* Extract by giving user access to packet buffer | ||
193 | * cfpkt Packet to extract from | ||
194 | * buf Buffer inside pkt that user shall copy data from | ||
195 | * buflen Length of buffer and number of bytes removed from packet | ||
196 | * @return 0 on error, 1 on success | ||
197 | */ | ||
198 | int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen); | ||
199 | |||
200 | /* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet. | ||
201 | * dir - Direction indicating whether this packet is to be sent or received. | ||
202 | * nativepkt - The native packet to be transformed to a CAIF packet | ||
203 | * @return The mapped CAIF Packet CFPKT. | ||
204 | */ | ||
205 | struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt); | ||
206 | |||
207 | /* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer). | ||
208 | * pkt - The CAIF packet to be transformed into a "native" packet. | ||
209 | * @return The native packet transformed from a CAIF packet. | ||
210 | */ | ||
211 | void *cfpkt_tonative(struct cfpkt *pkt); | ||
212 | |||
213 | /* | ||
214 | * Insert a packet in the packet queue. | ||
215 | * pktq Packet queue to insert into | ||
216 | * pkt Packet to be inserted in queue | ||
217 | * prio Priority of packet | ||
218 | */ | ||
219 | void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt, | ||
220 | unsigned short prio); | ||
221 | |||
222 | /* | ||
223 | * Remove a packet from the packet queue. | ||
224 | * pktq Packet queue to fetch packets from. | ||
225 | * @return Dequeued packet. | ||
226 | */ | ||
227 | struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq); | ||
228 | |||
229 | /* | ||
230 | * Peek into a packet from the packet queue. | ||
231 | * pktq Packet queue to fetch packets from. | ||
232 | * @return Peeked packet. | ||
233 | */ | ||
234 | struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq); | ||
235 | |||
236 | /* | ||
237 | * Initiates the packet queue. | ||
238 | * @return Pointer to new packet queue. | ||
239 | */ | ||
240 | struct cfpktq *cfpktq_create(void); | ||
241 | |||
242 | /* | ||
243 | * Get the number of packets in the queue. | ||
244 | * pktq Packet queue to fetch count from. | ||
245 | * @return Number of packets in queue. | ||
246 | */ | ||
247 | int cfpkt_qcount(struct cfpktq *pktq); | ||
248 | |||
249 | /* | ||
250 | * Put content of packet into buffer for debuging purposes. | ||
251 | * pkt Packet to copy data from | ||
252 | * buf Buffer to copy data into | ||
253 | * buflen Length of data to copy | ||
254 | * @return Pointer to copied data | ||
255 | */ | ||
256 | char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen); | ||
257 | |||
258 | /* | ||
259 | * Clones a packet and releases the original packet. | ||
260 | * This is used for taking ownership of a packet e.g queueing. | ||
261 | * pkt Packet to clone and release. | ||
262 | * @return Cloned packet. | ||
263 | */ | ||
264 | struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt); | ||
265 | |||
266 | |||
267 | /* | ||
268 | * Returns packet information for a packet. | ||
269 | * pkt Packet to get info from; | ||
270 | * @return Packet information | ||
271 | */ | ||
272 | struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); | ||
273 | /*! @} */ | ||
274 | #endif /* CFPKT_H_ */ | ||
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h new file mode 100644 index 000000000000..b8374321b362 --- /dev/null +++ b/include/net/caif/cfserl.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFSERL_H_ | ||
8 | #define CFSERL_H_ | ||
9 | #include <net/caif/caif_layer.h> | ||
10 | |||
11 | struct cflayer *cfserl_create(int type, int instance, bool use_stx); | ||
12 | #endif /* CFSERL_H_ */ | ||
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h new file mode 100644 index 000000000000..b1fa87ee0992 --- /dev/null +++ b/include/net/caif/cfsrvl.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef CFSRVL_H_ | ||
8 | #define CFSRVL_H_ | ||
9 | #include <linux/list.h> | ||
10 | #include <linux/stddef.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/kref.h> | ||
13 | |||
14 | struct cfsrvl { | ||
15 | struct cflayer layer; | ||
16 | bool open; | ||
17 | bool phy_flow_on; | ||
18 | bool modem_flow_on; | ||
19 | bool supports_flowctrl; | ||
20 | void (*release)(struct kref *); | ||
21 | struct dev_info dev_info; | ||
22 | struct kref ref; | ||
23 | }; | ||
24 | |||
25 | void cfsrvl_release(struct kref *kref); | ||
26 | struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info); | ||
27 | struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); | ||
28 | struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); | ||
29 | struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); | ||
30 | struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info, | ||
31 | int mtu_size); | ||
32 | struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); | ||
33 | bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); | ||
34 | void cfservl_destroy(struct cflayer *layer); | ||
35 | void cfsrvl_init(struct cfsrvl *service, | ||
36 | u8 channel_id, | ||
37 | struct dev_info *dev_info, | ||
38 | bool supports_flowctrl); | ||
39 | bool cfsrvl_ready(struct cfsrvl *service, int *err); | ||
40 | u8 cfsrvl_getphyid(struct cflayer *layer); | ||
41 | |||
42 | static inline void cfsrvl_get(struct cflayer *layr) | ||
43 | { | ||
44 | struct cfsrvl *s; | ||
45 | if (layr == NULL) | ||
46 | return; | ||
47 | s = container_of(layr, struct cfsrvl, layer); | ||
48 | kref_get(&s->ref); | ||
49 | } | ||
50 | |||
51 | static inline void cfsrvl_put(struct cflayer *layr) | ||
52 | { | ||
53 | struct cfsrvl *s; | ||
54 | if (layr == NULL) | ||
55 | return; | ||
56 | s = container_of(layr, struct cfsrvl, layer); | ||
57 | |||
58 | WARN_ON(!s->release); | ||
59 | if (s->release) | ||
60 | kref_put(&s->ref, s->release); | ||
61 | } | ||
62 | |||
63 | #endif /* CFSRVL_H_ */ | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 3d134a1fb96b..2fd06c60ffbb 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -37,6 +37,7 @@ | |||
37 | * | 37 | * |
38 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band | 38 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band |
39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | 39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) |
40 | * @IEEE80211_NUM_BANDS: number of defined bands | ||
40 | */ | 41 | */ |
41 | enum ieee80211_band { | 42 | enum ieee80211_band { |
42 | IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, | 43 | IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, |
@@ -89,7 +90,7 @@ enum ieee80211_channel_flags { | |||
89 | * @max_power: maximum transmission power (in dBm) | 90 | * @max_power: maximum transmission power (in dBm) |
90 | * @beacon_found: helper to regulatory code to indicate when a beacon | 91 | * @beacon_found: helper to regulatory code to indicate when a beacon |
91 | * has been found on this channel. Use regulatory_hint_found_beacon() | 92 | * has been found on this channel. Use regulatory_hint_found_beacon() |
92 | * to enable this, this is is useful only on 5 GHz band. | 93 | * to enable this, this is useful only on 5 GHz band. |
93 | * @orig_mag: internal use | 94 | * @orig_mag: internal use |
94 | * @orig_mpwr: internal use | 95 | * @orig_mpwr: internal use |
95 | */ | 96 | */ |
@@ -188,6 +189,7 @@ struct ieee80211_sta_ht_cap { | |||
188 | * in this band. Must be sorted to give a valid "supported | 189 | * in this band. Must be sorted to give a valid "supported |
189 | * rates" IE, i.e. CCK rates first, then OFDM. | 190 | * rates" IE, i.e. CCK rates first, then OFDM. |
190 | * @n_bitrates: Number of bitrates in @bitrates | 191 | * @n_bitrates: Number of bitrates in @bitrates |
192 | * @ht_cap: HT capabilities in this band | ||
191 | */ | 193 | */ |
192 | struct ieee80211_supported_band { | 194 | struct ieee80211_supported_band { |
193 | struct ieee80211_channel *channels; | 195 | struct ieee80211_channel *channels; |
@@ -225,6 +227,7 @@ struct vif_params { | |||
225 | * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used | 227 | * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used |
226 | * with the get_key() callback, must be in little endian, | 228 | * with the get_key() callback, must be in little endian, |
227 | * length given by @seq_len. | 229 | * length given by @seq_len. |
230 | * @seq_len: length of @seq. | ||
228 | */ | 231 | */ |
229 | struct key_params { | 232 | struct key_params { |
230 | u8 *key; | 233 | u8 *key; |
@@ -237,6 +240,8 @@ struct key_params { | |||
237 | /** | 240 | /** |
238 | * enum survey_info_flags - survey information flags | 241 | * enum survey_info_flags - survey information flags |
239 | * | 242 | * |
243 | * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in | ||
244 | * | ||
240 | * Used by the driver to indicate which info in &struct survey_info | 245 | * Used by the driver to indicate which info in &struct survey_info |
241 | * it has filled in during the get_survey(). | 246 | * it has filled in during the get_survey(). |
242 | */ | 247 | */ |
@@ -247,13 +252,13 @@ enum survey_info_flags { | |||
247 | /** | 252 | /** |
248 | * struct survey_info - channel survey response | 253 | * struct survey_info - channel survey response |
249 | * | 254 | * |
250 | * Used by dump_survey() to report back per-channel survey information. | ||
251 | * | ||
252 | * @channel: the channel this survey record reports, mandatory | 255 | * @channel: the channel this survey record reports, mandatory |
253 | * @filled: bitflag of flags from &enum survey_info_flags | 256 | * @filled: bitflag of flags from &enum survey_info_flags |
254 | * @noise: channel noise in dBm. This and all following fields are | 257 | * @noise: channel noise in dBm. This and all following fields are |
255 | * optional | 258 | * optional |
256 | * | 259 | * |
260 | * Used by dump_survey() to report back per-channel survey information. | ||
261 | * | ||
257 | * This structure can later be expanded with things like | 262 | * This structure can later be expanded with things like |
258 | * channel duty cycle etc. | 263 | * channel duty cycle etc. |
259 | */ | 264 | */ |
@@ -288,7 +293,7 @@ struct beacon_parameters { | |||
288 | * | 293 | * |
289 | * @PLINK_ACTION_INVALID: action 0 is reserved | 294 | * @PLINK_ACTION_INVALID: action 0 is reserved |
290 | * @PLINK_ACTION_OPEN: start mesh peer link establishment | 295 | * @PLINK_ACTION_OPEN: start mesh peer link establishment |
291 | * @PLINK_ACTION_BLOCL: block traffic from this mesh peer | 296 | * @PLINK_ACTION_BLOCK: block traffic from this mesh peer |
292 | */ | 297 | */ |
293 | enum plink_actions { | 298 | enum plink_actions { |
294 | PLINK_ACTION_INVALID, | 299 | PLINK_ACTION_INVALID, |
@@ -311,6 +316,8 @@ enum plink_actions { | |||
311 | * (bitmask of BIT(NL80211_STA_FLAG_...)) | 316 | * (bitmask of BIT(NL80211_STA_FLAG_...)) |
312 | * @listen_interval: listen interval or -1 for no change | 317 | * @listen_interval: listen interval or -1 for no change |
313 | * @aid: AID or zero for no change | 318 | * @aid: AID or zero for no change |
319 | * @plink_action: plink action to take | ||
320 | * @ht_capa: HT capabilities of station | ||
314 | */ | 321 | */ |
315 | struct station_parameters { | 322 | struct station_parameters { |
316 | u8 *supported_rates; | 323 | u8 *supported_rates; |
@@ -448,13 +455,13 @@ enum monitor_flags { | |||
448 | * Used by the driver to indicate which info in &struct mpath_info it has filled | 455 | * Used by the driver to indicate which info in &struct mpath_info it has filled |
449 | * in during get_station() or dump_station(). | 456 | * in during get_station() or dump_station(). |
450 | * | 457 | * |
451 | * MPATH_INFO_FRAME_QLEN: @frame_qlen filled | 458 | * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled |
452 | * MPATH_INFO_SN: @sn filled | 459 | * @MPATH_INFO_SN: @sn filled |
453 | * MPATH_INFO_METRIC: @metric filled | 460 | * @MPATH_INFO_METRIC: @metric filled |
454 | * MPATH_INFO_EXPTIME: @exptime filled | 461 | * @MPATH_INFO_EXPTIME: @exptime filled |
455 | * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled | 462 | * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled |
456 | * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled | 463 | * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled |
457 | * MPATH_INFO_FLAGS: @flags filled | 464 | * @MPATH_INFO_FLAGS: @flags filled |
458 | */ | 465 | */ |
459 | enum mpath_info_flags { | 466 | enum mpath_info_flags { |
460 | MPATH_INFO_FRAME_QLEN = BIT(0), | 467 | MPATH_INFO_FRAME_QLEN = BIT(0), |
@@ -511,6 +518,7 @@ struct mpath_info { | |||
511 | * @basic_rates: basic rates in IEEE 802.11 format | 518 | * @basic_rates: basic rates in IEEE 802.11 format |
512 | * (or NULL for no change) | 519 | * (or NULL for no change) |
513 | * @basic_rates_len: number of basic rates | 520 | * @basic_rates_len: number of basic rates |
521 | * @ap_isolate: do not forward packets between connected stations | ||
514 | */ | 522 | */ |
515 | struct bss_parameters { | 523 | struct bss_parameters { |
516 | int use_cts_prot; | 524 | int use_cts_prot; |
@@ -518,6 +526,7 @@ struct bss_parameters { | |||
518 | int use_short_slot_time; | 526 | int use_short_slot_time; |
519 | u8 *basic_rates; | 527 | u8 *basic_rates; |
520 | u8 basic_rates_len; | 528 | u8 basic_rates_len; |
529 | int ap_isolate; | ||
521 | }; | 530 | }; |
522 | 531 | ||
523 | struct mesh_config { | 532 | struct mesh_config { |
@@ -585,6 +594,7 @@ struct cfg80211_ssid { | |||
585 | * @ie_len: length of ie in octets | 594 | * @ie_len: length of ie in octets |
586 | * @wiphy: the wiphy this was for | 595 | * @wiphy: the wiphy this was for |
587 | * @dev: the interface | 596 | * @dev: the interface |
597 | * @aborted: (internal) scan request was notified as aborted | ||
588 | */ | 598 | */ |
589 | struct cfg80211_scan_request { | 599 | struct cfg80211_scan_request { |
590 | struct cfg80211_ssid *ssids; | 600 | struct cfg80211_ssid *ssids; |
@@ -621,6 +631,7 @@ enum cfg80211_signal_type { | |||
621 | * This structure describes a BSS (which may also be a mesh network) | 631 | * This structure describes a BSS (which may also be a mesh network) |
622 | * for use in scan results and similar. | 632 | * for use in scan results and similar. |
623 | * | 633 | * |
634 | * @channel: channel this BSS is on | ||
624 | * @bssid: BSSID of the BSS | 635 | * @bssid: BSSID of the BSS |
625 | * @tsf: timestamp of last received update | 636 | * @tsf: timestamp of last received update |
626 | * @beacon_interval: the beacon interval as from the frame | 637 | * @beacon_interval: the beacon interval as from the frame |
@@ -704,6 +715,10 @@ struct cfg80211_crypto_settings { | |||
704 | * @key_len: length of WEP key for shared key authentication | 715 | * @key_len: length of WEP key for shared key authentication |
705 | * @key_idx: index of WEP key for shared key authentication | 716 | * @key_idx: index of WEP key for shared key authentication |
706 | * @key: WEP key for shared key authentication | 717 | * @key: WEP key for shared key authentication |
718 | * @local_state_change: This is a request for a local state only, i.e., no | ||
719 | * Authentication frame is to be transmitted and authentication state is | ||
720 | * to be changed without having to wait for a response from the peer STA | ||
721 | * (AP). | ||
707 | */ | 722 | */ |
708 | struct cfg80211_auth_request { | 723 | struct cfg80211_auth_request { |
709 | struct cfg80211_bss *bss; | 724 | struct cfg80211_bss *bss; |
@@ -712,6 +727,7 @@ struct cfg80211_auth_request { | |||
712 | enum nl80211_auth_type auth_type; | 727 | enum nl80211_auth_type auth_type; |
713 | const u8 *key; | 728 | const u8 *key; |
714 | u8 key_len, key_idx; | 729 | u8 key_len, key_idx; |
730 | bool local_state_change; | ||
715 | }; | 731 | }; |
716 | 732 | ||
717 | /** | 733 | /** |
@@ -744,12 +760,15 @@ struct cfg80211_assoc_request { | |||
744 | * @ie: Extra IEs to add to Deauthentication frame or %NULL | 760 | * @ie: Extra IEs to add to Deauthentication frame or %NULL |
745 | * @ie_len: Length of ie buffer in octets | 761 | * @ie_len: Length of ie buffer in octets |
746 | * @reason_code: The reason code for the deauthentication | 762 | * @reason_code: The reason code for the deauthentication |
763 | * @local_state_change: This is a request for a local state only, i.e., no | ||
764 | * Deauthentication frame is to be transmitted. | ||
747 | */ | 765 | */ |
748 | struct cfg80211_deauth_request { | 766 | struct cfg80211_deauth_request { |
749 | struct cfg80211_bss *bss; | 767 | struct cfg80211_bss *bss; |
750 | const u8 *ie; | 768 | const u8 *ie; |
751 | size_t ie_len; | 769 | size_t ie_len; |
752 | u16 reason_code; | 770 | u16 reason_code; |
771 | bool local_state_change; | ||
753 | }; | 772 | }; |
754 | 773 | ||
755 | /** | 774 | /** |
@@ -762,12 +781,15 @@ struct cfg80211_deauth_request { | |||
762 | * @ie: Extra IEs to add to Disassociation frame or %NULL | 781 | * @ie: Extra IEs to add to Disassociation frame or %NULL |
763 | * @ie_len: Length of ie buffer in octets | 782 | * @ie_len: Length of ie buffer in octets |
764 | * @reason_code: The reason code for the disassociation | 783 | * @reason_code: The reason code for the disassociation |
784 | * @local_state_change: This is a request for a local state only, i.e., no | ||
785 | * Disassociation frame is to be transmitted. | ||
765 | */ | 786 | */ |
766 | struct cfg80211_disassoc_request { | 787 | struct cfg80211_disassoc_request { |
767 | struct cfg80211_bss *bss; | 788 | struct cfg80211_bss *bss; |
768 | const u8 *ie; | 789 | const u8 *ie; |
769 | size_t ie_len; | 790 | size_t ie_len; |
770 | u16 reason_code; | 791 | u16 reason_code; |
792 | bool local_state_change; | ||
771 | }; | 793 | }; |
772 | 794 | ||
773 | /** | 795 | /** |
@@ -788,6 +810,7 @@ struct cfg80211_disassoc_request { | |||
788 | * @beacon_interval: beacon interval to use | 810 | * @beacon_interval: beacon interval to use |
789 | * @privacy: this is a protected network, keys will be configured | 811 | * @privacy: this is a protected network, keys will be configured |
790 | * after joining | 812 | * after joining |
813 | * @basic_rates: bitmap of basic rates to use when creating the IBSS | ||
791 | */ | 814 | */ |
792 | struct cfg80211_ibss_params { | 815 | struct cfg80211_ibss_params { |
793 | u8 *ssid; | 816 | u8 *ssid; |
@@ -796,6 +819,7 @@ struct cfg80211_ibss_params { | |||
796 | u8 *ie; | 819 | u8 *ie; |
797 | u8 ssid_len, ie_len; | 820 | u8 ssid_len, ie_len; |
798 | u16 beacon_interval; | 821 | u16 beacon_interval; |
822 | u32 basic_rates; | ||
799 | bool channel_fixed; | 823 | bool channel_fixed; |
800 | bool privacy; | 824 | bool privacy; |
801 | }; | 825 | }; |
@@ -813,8 +837,8 @@ struct cfg80211_ibss_params { | |||
813 | * @ssid: SSID | 837 | * @ssid: SSID |
814 | * @ssid_len: Length of ssid in octets | 838 | * @ssid_len: Length of ssid in octets |
815 | * @auth_type: Authentication type (algorithm) | 839 | * @auth_type: Authentication type (algorithm) |
816 | * @assoc_ie: IEs for association request | 840 | * @ie: IEs for association request |
817 | * @assoc_ie_len: Length of assoc_ie in octets | 841 | * @ie_len: Length of assoc_ie in octets |
818 | * @privacy: indicates whether privacy-enabled APs should be used | 842 | * @privacy: indicates whether privacy-enabled APs should be used |
819 | * @crypto: crypto settings | 843 | * @crypto: crypto settings |
820 | * @key_len: length of WEP key for shared key authentication | 844 | * @key_len: length of WEP key for shared key authentication |
@@ -837,10 +861,11 @@ struct cfg80211_connect_params { | |||
837 | 861 | ||
838 | /** | 862 | /** |
839 | * enum wiphy_params_flags - set_wiphy_params bitfield values | 863 | * enum wiphy_params_flags - set_wiphy_params bitfield values |
840 | * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed | 864 | * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed |
841 | * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed | 865 | * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed |
842 | * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed | 866 | * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed |
843 | * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed | 867 | * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed |
868 | * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed | ||
844 | */ | 869 | */ |
845 | enum wiphy_params_flags { | 870 | enum wiphy_params_flags { |
846 | WIPHY_PARAM_RETRY_SHORT = 1 << 0, | 871 | WIPHY_PARAM_RETRY_SHORT = 1 << 0, |
@@ -850,19 +875,6 @@ enum wiphy_params_flags { | |||
850 | WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, | 875 | WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, |
851 | }; | 876 | }; |
852 | 877 | ||
853 | /** | ||
854 | * enum tx_power_setting - TX power adjustment | ||
855 | * | ||
856 | * @TX_POWER_AUTOMATIC: the dbm parameter is ignored | ||
857 | * @TX_POWER_LIMITED: limit TX power by the dbm parameter | ||
858 | * @TX_POWER_FIXED: fix TX power to the dbm parameter | ||
859 | */ | ||
860 | enum tx_power_setting { | ||
861 | TX_POWER_AUTOMATIC, | ||
862 | TX_POWER_LIMITED, | ||
863 | TX_POWER_FIXED, | ||
864 | }; | ||
865 | |||
866 | /* | 878 | /* |
867 | * cfg80211_bitrate_mask - masks for bitrate control | 879 | * cfg80211_bitrate_mask - masks for bitrate control |
868 | */ | 880 | */ |
@@ -936,10 +948,16 @@ struct cfg80211_pmksa { | |||
936 | * @del_beacon: Remove beacon configuration and stop sending the beacon. | 948 | * @del_beacon: Remove beacon configuration and stop sending the beacon. |
937 | * | 949 | * |
938 | * @add_station: Add a new station. | 950 | * @add_station: Add a new station. |
939 | * | ||
940 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | 951 | * @del_station: Remove a station; @mac may be NULL to remove all stations. |
941 | * | ||
942 | * @change_station: Modify a given station. | 952 | * @change_station: Modify a given station. |
953 | * @get_station: get station information for the station identified by @mac | ||
954 | * @dump_station: dump station callback -- resume dump at index @idx | ||
955 | * | ||
956 | * @add_mpath: add a fixed mesh path | ||
957 | * @del_mpath: delete a given mesh path | ||
958 | * @change_mpath: change a given mesh path | ||
959 | * @get_mpath: get a mesh path for the given parameters | ||
960 | * @dump_mpath: dump mesh path callback -- resume dump at index @idx | ||
943 | * | 961 | * |
944 | * @get_mesh_params: Put the current mesh parameters into *params | 962 | * @get_mesh_params: Put the current mesh parameters into *params |
945 | * | 963 | * |
@@ -947,13 +965,15 @@ struct cfg80211_pmksa { | |||
947 | * The mask is a bitfield which tells us which parameters to | 965 | * The mask is a bitfield which tells us which parameters to |
948 | * set, and which to leave alone. | 966 | * set, and which to leave alone. |
949 | * | 967 | * |
950 | * @set_mesh_cfg: set mesh parameters (by now, just mesh id) | ||
951 | * | ||
952 | * @change_bss: Modify parameters for a given BSS. | 968 | * @change_bss: Modify parameters for a given BSS. |
953 | * | 969 | * |
954 | * @set_txq_params: Set TX queue parameters | 970 | * @set_txq_params: Set TX queue parameters |
955 | * | 971 | * |
956 | * @set_channel: Set channel | 972 | * @set_channel: Set channel for a given wireless interface. Some devices |
973 | * may support multi-channel operation (by channel hopping) so cfg80211 | ||
974 | * doesn't verify much. Note, however, that the passed netdev may be | ||
975 | * %NULL as well if the user requested changing the channel for the | ||
976 | * device itself, or for a monitor interface. | ||
957 | * | 977 | * |
958 | * @scan: Request to do a scan. If returning zero, the scan request is given | 978 | * @scan: Request to do a scan. If returning zero, the scan request is given |
959 | * the driver, and will be valid until passed to cfg80211_scan_done(). | 979 | * the driver, and will be valid until passed to cfg80211_scan_done(). |
@@ -985,6 +1005,8 @@ struct cfg80211_pmksa { | |||
985 | * @get_tx_power: store the current TX power into the dbm variable; | 1005 | * @get_tx_power: store the current TX power into the dbm variable; |
986 | * return 0 if successful | 1006 | * return 0 if successful |
987 | * | 1007 | * |
1008 | * @set_wds_peer: set the WDS peer for a WDS interface | ||
1009 | * | ||
988 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting | 1010 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting |
989 | * functions to adjust rfkill hw state | 1011 | * functions to adjust rfkill hw state |
990 | * | 1012 | * |
@@ -1002,11 +1024,16 @@ struct cfg80211_pmksa { | |||
1002 | * | 1024 | * |
1003 | * @testmode_cmd: run a test mode command | 1025 | * @testmode_cmd: run a test mode command |
1004 | * | 1026 | * |
1027 | * @set_bitrate_mask: set the bitrate mask configuration | ||
1028 | * | ||
1005 | * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac | 1029 | * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac |
1006 | * devices running firmwares capable of generating the (re) association | 1030 | * devices running firmwares capable of generating the (re) association |
1007 | * RSN IE. It allows for faster roaming between WPA2 BSSIDs. | 1031 | * RSN IE. It allows for faster roaming between WPA2 BSSIDs. |
1008 | * @del_pmksa: Delete a cached PMKID. | 1032 | * @del_pmksa: Delete a cached PMKID. |
1009 | * @flush_pmksa: Flush all cached PMKIDs. | 1033 | * @flush_pmksa: Flush all cached PMKIDs. |
1034 | * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 | ||
1035 | * allows the driver to adjust the dynamic ps timeout value. | ||
1036 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. | ||
1010 | * | 1037 | * |
1011 | */ | 1038 | */ |
1012 | struct cfg80211_ops { | 1039 | struct cfg80211_ops { |
@@ -1079,7 +1106,7 @@ struct cfg80211_ops { | |||
1079 | int (*set_txq_params)(struct wiphy *wiphy, | 1106 | int (*set_txq_params)(struct wiphy *wiphy, |
1080 | struct ieee80211_txq_params *params); | 1107 | struct ieee80211_txq_params *params); |
1081 | 1108 | ||
1082 | int (*set_channel)(struct wiphy *wiphy, | 1109 | int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, |
1083 | struct ieee80211_channel *chan, | 1110 | struct ieee80211_channel *chan, |
1084 | enum nl80211_channel_type channel_type); | 1111 | enum nl80211_channel_type channel_type); |
1085 | 1112 | ||
@@ -1109,7 +1136,7 @@ struct cfg80211_ops { | |||
1109 | int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); | 1136 | int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); |
1110 | 1137 | ||
1111 | int (*set_tx_power)(struct wiphy *wiphy, | 1138 | int (*set_tx_power)(struct wiphy *wiphy, |
1112 | enum tx_power_setting type, int dbm); | 1139 | enum nl80211_tx_power_setting type, int mbm); |
1113 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); | 1140 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); |
1114 | 1141 | ||
1115 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, | 1142 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, |
@@ -1148,10 +1175,15 @@ struct cfg80211_ops { | |||
1148 | int (*action)(struct wiphy *wiphy, struct net_device *dev, | 1175 | int (*action)(struct wiphy *wiphy, struct net_device *dev, |
1149 | struct ieee80211_channel *chan, | 1176 | struct ieee80211_channel *chan, |
1150 | enum nl80211_channel_type channel_type, | 1177 | enum nl80211_channel_type channel_type, |
1178 | bool channel_type_valid, | ||
1151 | const u8 *buf, size_t len, u64 *cookie); | 1179 | const u8 *buf, size_t len, u64 *cookie); |
1152 | 1180 | ||
1153 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, | 1181 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, |
1154 | bool enabled, int timeout); | 1182 | bool enabled, int timeout); |
1183 | |||
1184 | int (*set_cqm_rssi_config)(struct wiphy *wiphy, | ||
1185 | struct net_device *dev, | ||
1186 | s32 rssi_thold, u32 rssi_hyst); | ||
1155 | }; | 1187 | }; |
1156 | 1188 | ||
1157 | /* | 1189 | /* |
@@ -1206,8 +1238,6 @@ struct mac_address { | |||
1206 | 1238 | ||
1207 | /** | 1239 | /** |
1208 | * struct wiphy - wireless hardware description | 1240 | * struct wiphy - wireless hardware description |
1209 | * @idx: the wiphy index assigned to this item | ||
1210 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
1211 | * @reg_notifier: the driver's regulatory notification callback | 1241 | * @reg_notifier: the driver's regulatory notification callback |
1212 | * @regd: the driver's regulatory domain, if one was requested via | 1242 | * @regd: the driver's regulatory domain, if one was requested via |
1213 | * the regulatory_hint() API. This can be used by the driver | 1243 | * the regulatory_hint() API. This can be used by the driver |
@@ -1221,7 +1251,7 @@ struct mac_address { | |||
1221 | * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); | 1251 | * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); |
1222 | * -1 = fragmentation disabled, only odd values >= 256 used | 1252 | * -1 = fragmentation disabled, only odd values >= 256 used |
1223 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled | 1253 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled |
1224 | * @net: the network namespace this wiphy currently lives in | 1254 | * @_net: the network namespace this wiphy currently lives in |
1225 | * @perm_addr: permanent MAC address of this device | 1255 | * @perm_addr: permanent MAC address of this device |
1226 | * @addr_mask: If the device supports multiple MAC addresses by masking, | 1256 | * @addr_mask: If the device supports multiple MAC addresses by masking, |
1227 | * set this to a mask with variable bits set to 1, e.g. if the last | 1257 | * set this to a mask with variable bits set to 1, e.g. if the last |
@@ -1234,6 +1264,28 @@ struct mac_address { | |||
1234 | * by default for perm_addr. In this case, the mask should be set to | 1264 | * by default for perm_addr. In this case, the mask should be set to |
1235 | * all-zeroes. In this case it is assumed that the device can handle | 1265 | * all-zeroes. In this case it is assumed that the device can handle |
1236 | * the same number of arbitrary MAC addresses. | 1266 | * the same number of arbitrary MAC addresses. |
1267 | * @debugfsdir: debugfs directory used for this wiphy, will be renamed | ||
1268 | * automatically on wiphy renames | ||
1269 | * @dev: (virtual) struct device for this wiphy | ||
1270 | * @wext: wireless extension handlers | ||
1271 | * @priv: driver private data (sized according to wiphy_new() parameter) | ||
1272 | * @interface_modes: bitmask of interfaces types valid for this wiphy, | ||
1273 | * must be set by driver | ||
1274 | * @flags: wiphy flags, see &enum wiphy_flags | ||
1275 | * @bss_priv_size: each BSS struct has private data allocated with it, | ||
1276 | * this variable determines its size | ||
1277 | * @max_scan_ssids: maximum number of SSIDs the device can scan for in | ||
1278 | * any given scan | ||
1279 | * @max_scan_ie_len: maximum length of user-controlled IEs device can | ||
1280 | * add to probe request frames transmitted during a scan, must not | ||
1281 | * include fixed IEs like supported rates | ||
1282 | * @coverage_class: current coverage class | ||
1283 | * @fw_version: firmware version for ethtool reporting | ||
1284 | * @hw_version: hardware version for ethtool reporting | ||
1285 | * @max_num_pmkids: maximum number of PMKIDs supported by device | ||
1286 | * @privid: a pointer that drivers can use to identify if an arbitrary | ||
1287 | * wiphy is theirs, e.g. in global notifiers | ||
1288 | * @bands: information about bands/channels supported by this device | ||
1237 | */ | 1289 | */ |
1238 | struct wiphy { | 1290 | struct wiphy { |
1239 | /* assign these fields before you register the wiphy */ | 1291 | /* assign these fields before you register the wiphy */ |
@@ -1306,27 +1358,16 @@ struct wiphy { | |||
1306 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 1358 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
1307 | }; | 1359 | }; |
1308 | 1360 | ||
1309 | #ifdef CONFIG_NET_NS | ||
1310 | static inline struct net *wiphy_net(struct wiphy *wiphy) | 1361 | static inline struct net *wiphy_net(struct wiphy *wiphy) |
1311 | { | 1362 | { |
1312 | return wiphy->_net; | 1363 | return read_pnet(&wiphy->_net); |
1313 | } | 1364 | } |
1314 | 1365 | ||
1315 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) | 1366 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) |
1316 | { | 1367 | { |
1317 | wiphy->_net = net; | 1368 | write_pnet(&wiphy->_net, net); |
1318 | } | ||
1319 | #else | ||
1320 | static inline struct net *wiphy_net(struct wiphy *wiphy) | ||
1321 | { | ||
1322 | return &init_net; | ||
1323 | } | 1369 | } |
1324 | 1370 | ||
1325 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) | ||
1326 | { | ||
1327 | } | ||
1328 | #endif | ||
1329 | |||
1330 | /** | 1371 | /** |
1331 | * wiphy_priv - return priv from wiphy | 1372 | * wiphy_priv - return priv from wiphy |
1332 | * | 1373 | * |
@@ -1375,7 +1416,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy) | |||
1375 | * | 1416 | * |
1376 | * @wiphy: The wiphy whose name to return | 1417 | * @wiphy: The wiphy whose name to return |
1377 | */ | 1418 | */ |
1378 | static inline const char *wiphy_name(struct wiphy *wiphy) | 1419 | static inline const char *wiphy_name(const struct wiphy *wiphy) |
1379 | { | 1420 | { |
1380 | return dev_name(&wiphy->dev); | 1421 | return dev_name(&wiphy->dev); |
1381 | } | 1422 | } |
@@ -1441,17 +1482,20 @@ struct cfg80211_cached_keys; | |||
1441 | * @list: (private) Used to collect the interfaces | 1482 | * @list: (private) Used to collect the interfaces |
1442 | * @netdev: (private) Used to reference back to the netdev | 1483 | * @netdev: (private) Used to reference back to the netdev |
1443 | * @current_bss: (private) Used by the internal configuration code | 1484 | * @current_bss: (private) Used by the internal configuration code |
1485 | * @channel: (private) Used by the internal configuration code to track | ||
1486 | * user-set AP, monitor and WDS channels for wireless extensions | ||
1444 | * @bssid: (private) Used by the internal configuration code | 1487 | * @bssid: (private) Used by the internal configuration code |
1445 | * @ssid: (private) Used by the internal configuration code | 1488 | * @ssid: (private) Used by the internal configuration code |
1446 | * @ssid_len: (private) Used by the internal configuration code | 1489 | * @ssid_len: (private) Used by the internal configuration code |
1447 | * @wext: (private) Used by the internal wireless extensions compat code | 1490 | * @wext: (private) Used by the internal wireless extensions compat code |
1448 | * @wext_bssid: (private) Used by the internal wireless extensions compat code | ||
1449 | * @use_4addr: indicates 4addr mode is used on this interface, must be | 1491 | * @use_4addr: indicates 4addr mode is used on this interface, must be |
1450 | * set by driver (if supported) on add_interface BEFORE registering the | 1492 | * set by driver (if supported) on add_interface BEFORE registering the |
1451 | * netdev and may otherwise be used by driver read-only, will be update | 1493 | * netdev and may otherwise be used by driver read-only, will be update |
1452 | * by cfg80211 on change_interface | 1494 | * by cfg80211 on change_interface |
1453 | * @action_registrations: list of registrations for action frames | 1495 | * @action_registrations: list of registrations for action frames |
1454 | * @action_registrations_lock: lock for the list | 1496 | * @action_registrations_lock: lock for the list |
1497 | * @mtx: mutex used to lock data in this struct | ||
1498 | * @cleanup_work: work struct used for cleanup that can't be done directly | ||
1455 | */ | 1499 | */ |
1456 | struct wireless_dev { | 1500 | struct wireless_dev { |
1457 | struct wiphy *wiphy; | 1501 | struct wiphy *wiphy; |
@@ -1487,6 +1531,7 @@ struct wireless_dev { | |||
1487 | struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; | 1531 | struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; |
1488 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; | 1532 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; |
1489 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ | 1533 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ |
1534 | struct ieee80211_channel *channel; | ||
1490 | 1535 | ||
1491 | bool ps; | 1536 | bool ps; |
1492 | int ps_timeout; | 1537 | int ps_timeout; |
@@ -1524,11 +1569,13 @@ static inline void *wdev_priv(struct wireless_dev *wdev) | |||
1524 | 1569 | ||
1525 | /** | 1570 | /** |
1526 | * ieee80211_channel_to_frequency - convert channel number to frequency | 1571 | * ieee80211_channel_to_frequency - convert channel number to frequency |
1572 | * @chan: channel number | ||
1527 | */ | 1573 | */ |
1528 | extern int ieee80211_channel_to_frequency(int chan); | 1574 | extern int ieee80211_channel_to_frequency(int chan); |
1529 | 1575 | ||
1530 | /** | 1576 | /** |
1531 | * ieee80211_frequency_to_channel - convert frequency to channel number | 1577 | * ieee80211_frequency_to_channel - convert frequency to channel number |
1578 | * @freq: center frequency | ||
1532 | */ | 1579 | */ |
1533 | extern int ieee80211_frequency_to_channel(int freq); | 1580 | extern int ieee80211_frequency_to_channel(int freq); |
1534 | 1581 | ||
@@ -1543,6 +1590,8 @@ extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | |||
1543 | int freq); | 1590 | int freq); |
1544 | /** | 1591 | /** |
1545 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | 1592 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency |
1593 | * @wiphy: the struct wiphy to get the channel for | ||
1594 | * @freq: the center frequency of the channel | ||
1546 | */ | 1595 | */ |
1547 | static inline struct ieee80211_channel * | 1596 | static inline struct ieee80211_channel * |
1548 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | 1597 | ieee80211_get_channel(struct wiphy *wiphy, int freq) |
@@ -1603,9 +1652,6 @@ struct ieee80211_radiotap_vendor_namespaces { | |||
1603 | * @is_radiotap_ns: indicates whether the current namespace is the default | 1652 | * @is_radiotap_ns: indicates whether the current namespace is the default |
1604 | * radiotap namespace or not | 1653 | * radiotap namespace or not |
1605 | * | 1654 | * |
1606 | * @overrides: override standard radiotap fields | ||
1607 | * @n_overrides: number of overrides | ||
1608 | * | ||
1609 | * @_rtheader: pointer to the radiotap header we are walking through | 1655 | * @_rtheader: pointer to the radiotap header we are walking through |
1610 | * @_max_length: length of radiotap header in cpu byte ordering | 1656 | * @_max_length: length of radiotap header in cpu byte ordering |
1611 | * @_arg_index: next argument index | 1657 | * @_arg_index: next argument index |
@@ -1627,7 +1673,7 @@ struct ieee80211_radiotap_iterator { | |||
1627 | const struct ieee80211_radiotap_namespace *current_namespace; | 1673 | const struct ieee80211_radiotap_namespace *current_namespace; |
1628 | 1674 | ||
1629 | unsigned char *_arg, *_next_ns_data; | 1675 | unsigned char *_arg, *_next_ns_data; |
1630 | uint32_t *_next_bitmap; | 1676 | __le32 *_next_bitmap; |
1631 | 1677 | ||
1632 | unsigned char *this_arg; | 1678 | unsigned char *this_arg; |
1633 | int this_arg_index; | 1679 | int this_arg_index; |
@@ -1906,6 +1952,10 @@ int cfg80211_wext_giwap(struct net_device *dev, | |||
1906 | struct iw_request_info *info, | 1952 | struct iw_request_info *info, |
1907 | struct sockaddr *ap_addr, char *extra); | 1953 | struct sockaddr *ap_addr, char *extra); |
1908 | 1954 | ||
1955 | int cfg80211_wext_siwpmksa(struct net_device *dev, | ||
1956 | struct iw_request_info *info, | ||
1957 | struct iw_point *data, char *extra); | ||
1958 | |||
1909 | /* | 1959 | /* |
1910 | * callbacks for asynchronous cfg80211 methods, notification | 1960 | * callbacks for asynchronous cfg80211 methods, notification |
1911 | * functions and BSS handling helpers | 1961 | * functions and BSS handling helpers |
@@ -1921,10 +1971,12 @@ int cfg80211_wext_giwap(struct net_device *dev, | |||
1921 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | 1971 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); |
1922 | 1972 | ||
1923 | /** | 1973 | /** |
1924 | * cfg80211_inform_bss - inform cfg80211 of a new BSS | 1974 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame |
1925 | * | 1975 | * |
1926 | * @wiphy: the wiphy reporting the BSS | 1976 | * @wiphy: the wiphy reporting the BSS |
1927 | * @bss: the found BSS | 1977 | * @channel: The channel the frame was received on |
1978 | * @mgmt: the management frame (probe response or beacon) | ||
1979 | * @len: length of the management frame | ||
1928 | * @signal: the signal strength, type depends on the wiphy's signal_type | 1980 | * @signal: the signal strength, type depends on the wiphy's signal_type |
1929 | * @gfp: context flags | 1981 | * @gfp: context flags |
1930 | * | 1982 | * |
@@ -1937,6 +1989,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
1937 | struct ieee80211_mgmt *mgmt, size_t len, | 1989 | struct ieee80211_mgmt *mgmt, size_t len, |
1938 | s32 signal, gfp_t gfp); | 1990 | s32 signal, gfp_t gfp); |
1939 | 1991 | ||
1992 | /** | ||
1993 | * cfg80211_inform_bss - inform cfg80211 of a new BSS | ||
1994 | * | ||
1995 | * @wiphy: the wiphy reporting the BSS | ||
1996 | * @channel: The channel the frame was received on | ||
1997 | * @bssid: the BSSID of the BSS | ||
1998 | * @timestamp: the TSF timestamp sent by the peer | ||
1999 | * @capability: the capability field sent by the peer | ||
2000 | * @beacon_interval: the beacon interval announced by the peer | ||
2001 | * @ie: additional IEs sent by the peer | ||
2002 | * @ielen: length of the additional IEs | ||
2003 | * @signal: the signal strength, type depends on the wiphy's signal_type | ||
2004 | * @gfp: context flags | ||
2005 | * | ||
2006 | * This informs cfg80211 that BSS information was found and | ||
2007 | * the BSS should be updated/added. | ||
2008 | */ | ||
1940 | struct cfg80211_bss* | 2009 | struct cfg80211_bss* |
1941 | cfg80211_inform_bss(struct wiphy *wiphy, | 2010 | cfg80211_inform_bss(struct wiphy *wiphy, |
1942 | struct ieee80211_channel *channel, | 2011 | struct ieee80211_channel *channel, |
@@ -2337,4 +2406,81 @@ bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, | |||
2337 | void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, | 2406 | void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, |
2338 | const u8 *buf, size_t len, bool ack, gfp_t gfp); | 2407 | const u8 *buf, size_t len, bool ack, gfp_t gfp); |
2339 | 2408 | ||
2409 | |||
2410 | /** | ||
2411 | * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event | ||
2412 | * @dev: network device | ||
2413 | * @rssi_event: the triggered RSSI event | ||
2414 | * @gfp: context flags | ||
2415 | * | ||
2416 | * This function is called when a configured connection quality monitoring | ||
2417 | * rssi threshold reached event occurs. | ||
2418 | */ | ||
2419 | void cfg80211_cqm_rssi_notify(struct net_device *dev, | ||
2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
2421 | gfp_t gfp); | ||
2422 | |||
2423 | #ifdef __KERNEL__ | ||
2424 | |||
2425 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
2426 | |||
2427 | /* wiphy_printk helpers, similar to dev_printk */ | ||
2428 | |||
2429 | #define wiphy_printk(level, wiphy, format, args...) \ | ||
2430 | printk(level "%s: " format, wiphy_name(wiphy), ##args) | ||
2431 | #define wiphy_emerg(wiphy, format, args...) \ | ||
2432 | wiphy_printk(KERN_EMERG, wiphy, format, ##args) | ||
2433 | #define wiphy_alert(wiphy, format, args...) \ | ||
2434 | wiphy_printk(KERN_ALERT, wiphy, format, ##args) | ||
2435 | #define wiphy_crit(wiphy, format, args...) \ | ||
2436 | wiphy_printk(KERN_CRIT, wiphy, format, ##args) | ||
2437 | #define wiphy_err(wiphy, format, args...) \ | ||
2438 | wiphy_printk(KERN_ERR, wiphy, format, ##args) | ||
2439 | #define wiphy_warn(wiphy, format, args...) \ | ||
2440 | wiphy_printk(KERN_WARNING, wiphy, format, ##args) | ||
2441 | #define wiphy_notice(wiphy, format, args...) \ | ||
2442 | wiphy_printk(KERN_NOTICE, wiphy, format, ##args) | ||
2443 | #define wiphy_info(wiphy, format, args...) \ | ||
2444 | wiphy_printk(KERN_INFO, wiphy, format, ##args) | ||
2445 | |||
2446 | int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | ||
2447 | __attribute__ ((format (printf, 2, 3))); | ||
2448 | |||
2449 | #if defined(DEBUG) | ||
2450 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2451 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | ||
2452 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2453 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2454 | dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args) | ||
2455 | #else | ||
2456 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2457 | ({ \ | ||
2458 | if (0) \ | ||
2459 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2460 | 0; \ | ||
2461 | }) | ||
2462 | #endif | ||
2463 | |||
2464 | #if defined(VERBOSE_DEBUG) | ||
2465 | #define wiphy_vdbg wiphy_dbg | ||
2466 | #else | ||
2467 | |||
2468 | #define wiphy_vdbg(wiphy, format, args...) \ | ||
2469 | ({ \ | ||
2470 | if (0) \ | ||
2471 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2472 | 0; \ | ||
2473 | }) | ||
2474 | #endif | ||
2475 | |||
2476 | /* | ||
2477 | * wiphy_WARN() acts like wiphy_printk(), but with the key difference | ||
2478 | * of using a WARN/WARN_ON to get the message out, including the | ||
2479 | * file/line information and a backtrace. | ||
2480 | */ | ||
2481 | #define wiphy_WARN(wiphy, format, args...) \ | ||
2482 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); | ||
2483 | |||
2484 | #endif | ||
2485 | |||
2340 | #endif /* __NET_CFG80211_H */ | 2486 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h new file mode 100644 index 000000000000..ef6c24a529e1 --- /dev/null +++ b/include/net/cls_cgroup.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * cls_cgroup.h Control Group Classifier | ||
3 | * | ||
4 | * Authors: Thomas Graf <tgraf@suug.ch> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation; either version 2 of the License, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _NET_CLS_CGROUP_H | ||
14 | #define _NET_CLS_CGROUP_H | ||
15 | |||
16 | #include <linux/cgroup.h> | ||
17 | #include <linux/hardirq.h> | ||
18 | #include <linux/rcupdate.h> | ||
19 | |||
20 | #ifdef CONFIG_CGROUPS | ||
21 | struct cgroup_cls_state | ||
22 | { | ||
23 | struct cgroup_subsys_state css; | ||
24 | u32 classid; | ||
25 | }; | ||
26 | |||
27 | #ifdef CONFIG_NET_CLS_CGROUP | ||
28 | static inline u32 task_cls_classid(struct task_struct *p) | ||
29 | { | ||
30 | int classid; | ||
31 | |||
32 | if (in_interrupt()) | ||
33 | return 0; | ||
34 | |||
35 | rcu_read_lock(); | ||
36 | classid = container_of(task_subsys_state(p, net_cls_subsys_id), | ||
37 | struct cgroup_cls_state, css)->classid; | ||
38 | rcu_read_unlock(); | ||
39 | |||
40 | return classid; | ||
41 | } | ||
42 | #else | ||
43 | extern int net_cls_subsys_id; | ||
44 | |||
45 | static inline u32 task_cls_classid(struct task_struct *p) | ||
46 | { | ||
47 | int id; | ||
48 | u32 classid = 0; | ||
49 | |||
50 | if (in_interrupt()) | ||
51 | return 0; | ||
52 | |||
53 | rcu_read_lock(); | ||
54 | id = rcu_dereference(net_cls_subsys_id); | ||
55 | if (id >= 0) | ||
56 | classid = container_of(task_subsys_state(p, id), | ||
57 | struct cgroup_cls_state, css)->classid; | ||
58 | rcu_read_unlock(); | ||
59 | |||
60 | return classid; | ||
61 | } | ||
62 | #endif | ||
63 | #else | ||
64 | static inline u32 task_cls_classid(struct task_struct *p) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | #endif | ||
69 | #endif /* _NET_CLS_CGROUP_H */ | ||
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index 511a459ec10f..0916bbf3bdff 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h | |||
@@ -101,7 +101,7 @@ struct dn_short_packet { | |||
101 | __le16 dstnode; | 101 | __le16 dstnode; |
102 | __le16 srcnode; | 102 | __le16 srcnode; |
103 | __u8 forward; | 103 | __u8 forward; |
104 | } __attribute__((packed)); | 104 | } __packed; |
105 | 105 | ||
106 | struct dn_long_packet { | 106 | struct dn_long_packet { |
107 | __u8 msgflg; | 107 | __u8 msgflg; |
@@ -115,7 +115,7 @@ struct dn_long_packet { | |||
115 | __u8 visit_ct; | 115 | __u8 visit_ct; |
116 | __u8 s_class; | 116 | __u8 s_class; |
117 | __u8 pt; | 117 | __u8 pt; |
118 | } __attribute__((packed)); | 118 | } __packed; |
119 | 119 | ||
120 | /*------------------------- DRP - Routing messages ---------------------*/ | 120 | /*------------------------- DRP - Routing messages ---------------------*/ |
121 | 121 | ||
@@ -132,7 +132,7 @@ struct endnode_hello_message { | |||
132 | __u8 mpd; | 132 | __u8 mpd; |
133 | __u8 datalen; | 133 | __u8 datalen; |
134 | __u8 data[2]; | 134 | __u8 data[2]; |
135 | } __attribute__((packed)); | 135 | } __packed; |
136 | 136 | ||
137 | struct rtnode_hello_message { | 137 | struct rtnode_hello_message { |
138 | __u8 msgflg; | 138 | __u8 msgflg; |
@@ -144,7 +144,7 @@ struct rtnode_hello_message { | |||
144 | __u8 area; | 144 | __u8 area; |
145 | __le16 timer; | 145 | __le16 timer; |
146 | __u8 mpd; | 146 | __u8 mpd; |
147 | } __attribute__((packed)); | 147 | } __packed; |
148 | 148 | ||
149 | 149 | ||
150 | extern void dn_dev_init(void); | 150 | extern void dn_dev_init(void); |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 52da6c3dd50d..bbcde3238e58 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -50,10 +50,6 @@ struct dn_fib_info { | |||
50 | __le16 fib_prefsrc; | 50 | __le16 fib_prefsrc; |
51 | __u32 fib_priority; | 51 | __u32 fib_priority; |
52 | __u32 fib_metrics[RTAX_MAX]; | 52 | __u32 fib_metrics[RTAX_MAX]; |
53 | #define dn_fib_mtu fib_metrics[RTAX_MTU-1] | ||
54 | #define dn_fib_window fib_metrics[RTAX_WINDOW-1] | ||
55 | #define dn_fib_rtt fib_metrics[RTAX_RTT-1] | ||
56 | #define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1] | ||
57 | int fib_nhs; | 53 | int fib_nhs; |
58 | int fib_power; | 54 | int fib_power; |
59 | struct dn_fib_nh fib_nh[0]; | 55 | struct dn_fib_nh fib_nh[0]; |
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index 17d43d2db5ec..e43a2893f132 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h | |||
@@ -74,18 +74,18 @@ struct nsp_data_seg_msg { | |||
74 | __u8 msgflg; | 74 | __u8 msgflg; |
75 | __le16 dstaddr; | 75 | __le16 dstaddr; |
76 | __le16 srcaddr; | 76 | __le16 srcaddr; |
77 | } __attribute__((packed)); | 77 | } __packed; |
78 | 78 | ||
79 | struct nsp_data_opt_msg { | 79 | struct nsp_data_opt_msg { |
80 | __le16 acknum; | 80 | __le16 acknum; |
81 | __le16 segnum; | 81 | __le16 segnum; |
82 | __le16 lsflgs; | 82 | __le16 lsflgs; |
83 | } __attribute__((packed)); | 83 | } __packed; |
84 | 84 | ||
85 | struct nsp_data_opt_msg1 { | 85 | struct nsp_data_opt_msg1 { |
86 | __le16 acknum; | 86 | __le16 acknum; |
87 | __le16 segnum; | 87 | __le16 segnum; |
88 | } __attribute__((packed)); | 88 | } __packed; |
89 | 89 | ||
90 | 90 | ||
91 | /* Acknowledgment Message (data/other data) */ | 91 | /* Acknowledgment Message (data/other data) */ |
@@ -94,13 +94,13 @@ struct nsp_data_ack_msg { | |||
94 | __le16 dstaddr; | 94 | __le16 dstaddr; |
95 | __le16 srcaddr; | 95 | __le16 srcaddr; |
96 | __le16 acknum; | 96 | __le16 acknum; |
97 | } __attribute__((packed)); | 97 | } __packed; |
98 | 98 | ||
99 | /* Connect Acknowledgment Message */ | 99 | /* Connect Acknowledgment Message */ |
100 | struct nsp_conn_ack_msg { | 100 | struct nsp_conn_ack_msg { |
101 | __u8 msgflg; | 101 | __u8 msgflg; |
102 | __le16 dstaddr; | 102 | __le16 dstaddr; |
103 | } __attribute__((packed)); | 103 | } __packed; |
104 | 104 | ||
105 | 105 | ||
106 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ | 106 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ |
@@ -117,7 +117,7 @@ struct nsp_conn_init_msg { | |||
117 | #define NSP_FC_MASK 0x0c /* FC type mask */ | 117 | #define NSP_FC_MASK 0x0c /* FC type mask */ |
118 | __u8 info; | 118 | __u8 info; |
119 | __le16 segsize; | 119 | __le16 segsize; |
120 | } __attribute__((packed)); | 120 | } __packed; |
121 | 121 | ||
122 | /* Disconnect Initiate/Disconnect Confirm */ | 122 | /* Disconnect Initiate/Disconnect Confirm */ |
123 | struct nsp_disconn_init_msg { | 123 | struct nsp_disconn_init_msg { |
@@ -125,7 +125,7 @@ struct nsp_disconn_init_msg { | |||
125 | __le16 dstaddr; | 125 | __le16 dstaddr; |
126 | __le16 srcaddr; | 126 | __le16 srcaddr; |
127 | __le16 reason; | 127 | __le16 reason; |
128 | } __attribute__((packed)); | 128 | } __packed; |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
@@ -135,7 +135,7 @@ struct srcobj_fmt { | |||
135 | __le16 grpcode; | 135 | __le16 grpcode; |
136 | __le16 usrcode; | 136 | __le16 usrcode; |
137 | __u8 dlen; | 137 | __u8 dlen; |
138 | } __attribute__((packed)); | 138 | } __packed; |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * A collection of functions for manipulating the sequence | 141 | * A collection of functions for manipulating the sequence |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 60c9f22d8694..ccadab3aa3f6 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -65,9 +65,7 @@ extern void dn_rt_cache_flush(int delay); | |||
65 | * packets to the originating host. | 65 | * packets to the originating host. |
66 | */ | 66 | */ |
67 | struct dn_route { | 67 | struct dn_route { |
68 | union { | 68 | struct dst_entry dst; |
69 | struct dst_entry dst; | ||
70 | } u; | ||
71 | 69 | ||
72 | struct flowi fl; | 70 | struct flowi fl; |
73 | 71 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index ce078cda6b74..02386505033d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -168,6 +168,12 @@ static inline void dst_use(struct dst_entry *dst, unsigned long time) | |||
168 | dst->lastuse = time; | 168 | dst->lastuse = time; |
169 | } | 169 | } |
170 | 170 | ||
171 | static inline void dst_use_noref(struct dst_entry *dst, unsigned long time) | ||
172 | { | ||
173 | dst->__use++; | ||
174 | dst->lastuse = time; | ||
175 | } | ||
176 | |||
171 | static inline | 177 | static inline |
172 | struct dst_entry * dst_clone(struct dst_entry * dst) | 178 | struct dst_entry * dst_clone(struct dst_entry * dst) |
173 | { | 179 | { |
@@ -177,22 +183,79 @@ struct dst_entry * dst_clone(struct dst_entry * dst) | |||
177 | } | 183 | } |
178 | 184 | ||
179 | extern void dst_release(struct dst_entry *dst); | 185 | extern void dst_release(struct dst_entry *dst); |
186 | |||
187 | static inline void refdst_drop(unsigned long refdst) | ||
188 | { | ||
189 | if (!(refdst & SKB_DST_NOREF)) | ||
190 | dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK)); | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * skb_dst_drop - drops skb dst | ||
195 | * @skb: buffer | ||
196 | * | ||
197 | * Drops dst reference count if a reference was taken. | ||
198 | */ | ||
180 | static inline void skb_dst_drop(struct sk_buff *skb) | 199 | static inline void skb_dst_drop(struct sk_buff *skb) |
181 | { | 200 | { |
182 | if (skb->_skb_dst) | 201 | if (skb->_skb_refdst) { |
183 | dst_release(skb_dst(skb)); | 202 | refdst_drop(skb->_skb_refdst); |
184 | skb->_skb_dst = 0UL; | 203 | skb->_skb_refdst = 0UL; |
204 | } | ||
205 | } | ||
206 | |||
207 | static inline void skb_dst_copy(struct sk_buff *nskb, const struct sk_buff *oskb) | ||
208 | { | ||
209 | nskb->_skb_refdst = oskb->_skb_refdst; | ||
210 | if (!(nskb->_skb_refdst & SKB_DST_NOREF)) | ||
211 | dst_clone(skb_dst(nskb)); | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * skb_dst_force - makes sure skb dst is refcounted | ||
216 | * @skb: buffer | ||
217 | * | ||
218 | * If dst is not yet refcounted, let's do it | ||
219 | */ | ||
220 | static inline void skb_dst_force(struct sk_buff *skb) | ||
221 | { | ||
222 | if (skb_dst_is_noref(skb)) { | ||
223 | WARN_ON(!rcu_read_lock_held()); | ||
224 | skb->_skb_refdst &= ~SKB_DST_NOREF; | ||
225 | dst_clone(skb_dst(skb)); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | |||
230 | /** | ||
231 | * skb_tunnel_rx - prepare skb for rx reinsert | ||
232 | * @skb: buffer | ||
233 | * @dev: tunnel device | ||
234 | * | ||
235 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, | ||
236 | * so make some cleanups, and perform accounting. | ||
237 | */ | ||
238 | static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | ||
239 | { | ||
240 | skb->dev = dev; | ||
241 | /* TODO : stats should be SMP safe */ | ||
242 | dev->stats.rx_packets++; | ||
243 | dev->stats.rx_bytes += skb->len; | ||
244 | skb->rxhash = 0; | ||
245 | skb_set_queue_mapping(skb, 0); | ||
246 | skb_dst_drop(skb); | ||
247 | nf_reset(skb); | ||
185 | } | 248 | } |
186 | 249 | ||
187 | /* Children define the path of the packet through the | 250 | /* Children define the path of the packet through the |
188 | * Linux networking. Thus, destinations are stackable. | 251 | * Linux networking. Thus, destinations are stackable. |
189 | */ | 252 | */ |
190 | 253 | ||
191 | static inline struct dst_entry *dst_pop(struct dst_entry *dst) | 254 | static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) |
192 | { | 255 | { |
193 | struct dst_entry *child = dst_clone(dst->child); | 256 | struct dst_entry *child = skb_dst(skb)->child; |
194 | 257 | ||
195 | dst_release(dst); | 258 | skb_dst_drop(skb); |
196 | return child; | 259 | return child; |
197 | } | 260 | } |
198 | 261 | ||
@@ -225,21 +288,6 @@ static inline void dst_confirm(struct dst_entry *dst) | |||
225 | neigh_confirm(dst->neighbour); | 288 | neigh_confirm(dst->neighbour); |
226 | } | 289 | } |
227 | 290 | ||
228 | static inline void dst_negative_advice(struct dst_entry **dst_p, | ||
229 | struct sock *sk) | ||
230 | { | ||
231 | struct dst_entry * dst = *dst_p; | ||
232 | if (dst && dst->ops->negative_advice) { | ||
233 | *dst_p = dst->ops->negative_advice(dst); | ||
234 | |||
235 | if (dst != *dst_p) { | ||
236 | extern void sk_reset_txq(struct sock *sk); | ||
237 | |||
238 | sk_reset_txq(sk); | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | |||
243 | static inline void dst_link_failure(struct sk_buff *skb) | 291 | static inline void dst_link_failure(struct sk_buff *skb) |
244 | { | 292 | { |
245 | struct dst_entry *dst = skb_dst(skb); | 293 | struct dst_entry *dst = skb_dst(skb); |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index c49086d2bc7d..e8923bc20f9f 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -104,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
104 | return frh->table; | 104 | return frh->table; |
105 | } | 105 | } |
106 | 106 | ||
107 | extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); | 107 | extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); |
108 | extern void fib_rules_unregister(struct fib_rules_ops *); | 108 | extern void fib_rules_unregister(struct fib_rules_ops *); |
109 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | 109 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); |
110 | 110 | ||
@@ -114,4 +114,5 @@ extern int fib_rules_lookup(struct fib_rules_ops *, | |||
114 | extern int fib_default_rule_add(struct fib_rules_ops *, | 114 | extern int fib_default_rule_add(struct fib_rules_ops *, |
115 | u32 pref, u32 table, | 115 | u32 pref, u32 table, |
116 | u32 flags); | 116 | u32 flags); |
117 | extern u32 fib_default_rule_pref(struct fib_rules_ops *ops); | ||
117 | #endif | 118 | #endif |
diff --git a/include/net/flow.h b/include/net/flow.h index 809970b7dfee..bb08692a20b0 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -86,11 +86,26 @@ struct flowi { | |||
86 | 86 | ||
87 | struct net; | 87 | struct net; |
88 | struct sock; | 88 | struct sock; |
89 | typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, | 89 | struct flow_cache_ops; |
90 | u8 dir, void **objp, atomic_t **obj_refp); | 90 | |
91 | struct flow_cache_object { | ||
92 | const struct flow_cache_ops *ops; | ||
93 | }; | ||
94 | |||
95 | struct flow_cache_ops { | ||
96 | struct flow_cache_object *(*get)(struct flow_cache_object *); | ||
97 | int (*check)(struct flow_cache_object *); | ||
98 | void (*delete)(struct flow_cache_object *); | ||
99 | }; | ||
100 | |||
101 | typedef struct flow_cache_object *(*flow_resolve_t)( | ||
102 | struct net *net, struct flowi *key, u16 family, | ||
103 | u8 dir, struct flow_cache_object *oldobj, void *ctx); | ||
104 | |||
105 | extern struct flow_cache_object *flow_cache_lookup( | ||
106 | struct net *net, struct flowi *key, u16 family, | ||
107 | u8 dir, flow_resolve_t resolver, void *ctx); | ||
91 | 108 | ||
92 | extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, | ||
93 | u8 dir, flow_resolve_t resolver); | ||
94 | extern void flow_cache_flush(void); | 109 | extern void flow_cache_flush(void); |
95 | extern atomic_t flow_cache_genid; | 110 | extern atomic_t flow_cache_genid; |
96 | 111 | ||
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index eb551baafc04..f7dcd2c70412 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -68,26 +68,15 @@ struct genl_info { | |||
68 | #endif | 68 | #endif |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #ifdef CONFIG_NET_NS | ||
72 | static inline struct net *genl_info_net(struct genl_info *info) | 71 | static inline struct net *genl_info_net(struct genl_info *info) |
73 | { | 72 | { |
74 | return info->_net; | 73 | return read_pnet(&info->_net); |
75 | } | 74 | } |
76 | 75 | ||
77 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) | 76 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) |
78 | { | 77 | { |
79 | info->_net = net; | 78 | write_pnet(&info->_net, net); |
80 | } | 79 | } |
81 | #else | ||
82 | static inline struct net *genl_info_net(struct genl_info *info) | ||
83 | { | ||
84 | return &init_net; | ||
85 | } | ||
86 | |||
87 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) | ||
88 | { | ||
89 | } | ||
90 | #endif | ||
91 | 80 | ||
92 | /** | 81 | /** |
93 | * struct genl_ops - generic netlink operations | 82 | * struct genl_ops - generic netlink operations |
diff --git a/include/net/icmp.h b/include/net/icmp.h index 15b3dfe9fce8..6e991e0d0d6f 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -48,15 +48,4 @@ extern void icmp_out_count(struct net *net, unsigned char type); | |||
48 | /* Move into dst.h ? */ | 48 | /* Move into dst.h ? */ |
49 | extern int xrlim_allow(struct dst_entry *dst, int timeout); | 49 | extern int xrlim_allow(struct dst_entry *dst, int timeout); |
50 | 50 | ||
51 | struct raw_sock { | ||
52 | /* inet_sock has to be the first member */ | ||
53 | struct inet_sock inet; | ||
54 | struct icmp_filter filter; | ||
55 | }; | ||
56 | |||
57 | static inline struct raw_sock *raw_sk(const struct sock *sk) | ||
58 | { | ||
59 | return (struct raw_sock *)sk; | ||
60 | } | ||
61 | |||
62 | #endif /* _ICMP_H */ | 51 | #endif /* _ICMP_H */ |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 545d8b059bef..f95ff8d9aa47 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -32,6 +32,13 @@ | |||
32 | 32 | ||
33 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
34 | 34 | ||
35 | enum { | ||
36 | INET6_IFADDR_STATE_DAD, | ||
37 | INET6_IFADDR_STATE_POSTDAD, | ||
38 | INET6_IFADDR_STATE_UP, | ||
39 | INET6_IFADDR_STATE_DEAD, | ||
40 | }; | ||
41 | |||
35 | struct inet6_ifaddr { | 42 | struct inet6_ifaddr { |
36 | struct in6_addr addr; | 43 | struct in6_addr addr; |
37 | __u32 prefix_len; | 44 | __u32 prefix_len; |
@@ -40,6 +47,9 @@ struct inet6_ifaddr { | |||
40 | __u32 prefered_lft; | 47 | __u32 prefered_lft; |
41 | atomic_t refcnt; | 48 | atomic_t refcnt; |
42 | spinlock_t lock; | 49 | spinlock_t lock; |
50 | spinlock_t state_lock; | ||
51 | |||
52 | int state; | ||
43 | 53 | ||
44 | __u8 probes; | 54 | __u8 probes; |
45 | __u8 flags; | 55 | __u8 flags; |
@@ -54,16 +64,15 @@ struct inet6_ifaddr { | |||
54 | struct inet6_dev *idev; | 64 | struct inet6_dev *idev; |
55 | struct rt6_info *rt; | 65 | struct rt6_info *rt; |
56 | 66 | ||
57 | struct inet6_ifaddr *lst_next; /* next addr in addr_lst */ | 67 | struct hlist_node addr_lst; |
58 | struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ | 68 | struct list_head if_list; |
59 | 69 | ||
60 | #ifdef CONFIG_IPV6_PRIVACY | 70 | #ifdef CONFIG_IPV6_PRIVACY |
61 | struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ | 71 | struct list_head tmp_list; |
62 | struct inet6_ifaddr *ifpub; | 72 | struct inet6_ifaddr *ifpub; |
63 | int regen_count; | 73 | int regen_count; |
64 | #endif | 74 | #endif |
65 | 75 | struct rcu_head rcu; | |
66 | int dead; | ||
67 | }; | 76 | }; |
68 | 77 | ||
69 | struct ip6_sf_socklist { | 78 | struct ip6_sf_socklist { |
@@ -151,9 +160,9 @@ struct ipv6_devstat { | |||
151 | }; | 160 | }; |
152 | 161 | ||
153 | struct inet6_dev { | 162 | struct inet6_dev { |
154 | struct net_device *dev; | 163 | struct net_device *dev; |
155 | 164 | ||
156 | struct inet6_ifaddr *addr_list; | 165 | struct list_head addr_list; |
157 | 166 | ||
158 | struct ifmcaddr6 *mc_list; | 167 | struct ifmcaddr6 *mc_list; |
159 | struct ifmcaddr6 *mc_tomb; | 168 | struct ifmcaddr6 *mc_tomb; |
@@ -175,7 +184,7 @@ struct inet6_dev { | |||
175 | #ifdef CONFIG_IPV6_PRIVACY | 184 | #ifdef CONFIG_IPV6_PRIVACY |
176 | u8 rndid[8]; | 185 | u8 rndid[8]; |
177 | struct timer_list regen_timer; | 186 | struct timer_list regen_timer; |
178 | struct inet6_ifaddr *tempaddr_list; | 187 | struct list_head tempaddr_list; |
179 | #endif | 188 | #endif |
180 | 189 | ||
181 | struct neigh_parms *nd_parms; | 190 | struct neigh_parms *nd_parms; |
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h index f13ddc2543b1..aae08f686633 100644 --- a/include/net/inet6_connection_sock.h +++ b/include/net/inet6_connection_sock.h | |||
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, | |||
38 | 38 | ||
39 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | 39 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); |
40 | 40 | ||
41 | extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); | 41 | extern int inet6_csk_xmit(struct sk_buff *skb); |
42 | #endif /* _INET6_CONNECTION_SOCK_H */ | 42 | #endif /* _INET6_CONNECTION_SOCK_H */ |
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 18c773286b91..22fac9892b16 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _INET_COMMON_H | 1 | #ifndef _INET_COMMON_H |
2 | #define _INET_COMMON_H | 2 | #define _INET_COMMON_H |
3 | 3 | ||
4 | extern const struct proto_ops inet_stream_ops; | 4 | extern const struct proto_ops inet_stream_ops; |
5 | extern const struct proto_ops inet_dgram_ops; | 5 | extern const struct proto_ops inet_dgram_ops; |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * INET4 prototypes used by INET6 | 8 | * INET4 prototypes used by INET6 |
@@ -13,37 +13,28 @@ struct sock; | |||
13 | struct sockaddr; | 13 | struct sockaddr; |
14 | struct socket; | 14 | struct socket; |
15 | 15 | ||
16 | extern int inet_release(struct socket *sock); | 16 | extern int inet_release(struct socket *sock); |
17 | extern int inet_stream_connect(struct socket *sock, | 17 | extern int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr, |
18 | struct sockaddr * uaddr, | 18 | int addr_len, int flags); |
19 | int addr_len, int flags); | 19 | extern int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, |
20 | extern int inet_dgram_connect(struct socket *sock, | 20 | int addr_len, int flags); |
21 | struct sockaddr * uaddr, | 21 | extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); |
22 | int addr_len, int flags); | 22 | extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock, |
23 | extern int inet_accept(struct socket *sock, | 23 | struct msghdr *msg, size_t size); |
24 | struct socket *newsock, int flags); | 24 | extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, |
25 | extern int inet_sendmsg(struct kiocb *iocb, | 25 | size_t size, int flags); |
26 | struct socket *sock, | 26 | extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock, |
27 | struct msghdr *msg, | 27 | struct msghdr *msg, size_t size, int flags); |
28 | size_t size); | 28 | extern int inet_shutdown(struct socket *sock, int how); |
29 | extern int inet_shutdown(struct socket *sock, int how); | 29 | extern int inet_listen(struct socket *sock, int backlog); |
30 | extern int inet_listen(struct socket *sock, int backlog); | 30 | extern void inet_sock_destruct(struct sock *sk); |
31 | 31 | extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); | |
32 | extern void inet_sock_destruct(struct sock *sk); | 32 | extern int inet_getname(struct socket *sock, struct sockaddr *uaddr, |
33 | 33 | int *uaddr_len, int peer); | |
34 | extern int inet_bind(struct socket *sock, | 34 | extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
35 | struct sockaddr *uaddr, int addr_len); | 35 | extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, |
36 | extern int inet_getname(struct socket *sock, | 36 | unsigned short type, unsigned char protocol, |
37 | struct sockaddr *uaddr, | 37 | struct net *net); |
38 | int *uaddr_len, int peer); | ||
39 | extern int inet_ioctl(struct socket *sock, | ||
40 | unsigned int cmd, unsigned long arg); | ||
41 | |||
42 | extern int inet_ctl_sock_create(struct sock **sk, | ||
43 | unsigned short family, | ||
44 | unsigned short type, | ||
45 | unsigned char protocol, | ||
46 | struct net *net); | ||
47 | 38 | ||
48 | static inline void inet_ctl_sock_destroy(struct sock *sk) | 39 | static inline void inet_ctl_sock_destroy(struct sock *sk) |
49 | { | 40 | { |
@@ -51,5 +42,3 @@ static inline void inet_ctl_sock_destroy(struct sock *sk) | |||
51 | } | 42 | } |
52 | 43 | ||
53 | #endif | 44 | #endif |
54 | |||
55 | |||
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 696d6e4ce68a..b6d3b55da19b 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -36,9 +36,8 @@ struct tcp_congestion_ops; | |||
36 | * (i.e. things that depend on the address family) | 36 | * (i.e. things that depend on the address family) |
37 | */ | 37 | */ |
38 | struct inet_connection_sock_af_ops { | 38 | struct inet_connection_sock_af_ops { |
39 | int (*queue_xmit)(struct sk_buff *skb, int ipfragok); | 39 | int (*queue_xmit)(struct sk_buff *skb); |
40 | void (*send_check)(struct sock *sk, int len, | 40 | void (*send_check)(struct sock *sk, struct sk_buff *skb); |
41 | struct sk_buff *skb); | ||
42 | int (*rebuild_header)(struct sock *sk); | 41 | int (*rebuild_header)(struct sock *sk); |
43 | int (*conn_request)(struct sock *sk, struct sk_buff *skb); | 42 | int (*conn_request)(struct sock *sk, struct sk_buff *skb); |
44 | struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, | 43 | struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 39f2dc943908..16ff29a7bb30 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -20,6 +20,7 @@ struct inet_frag_queue { | |||
20 | atomic_t refcnt; | 20 | atomic_t refcnt; |
21 | struct timer_list timer; /* when will this queue expire? */ | 21 | struct timer_list timer; /* when will this queue expire? */ |
22 | struct sk_buff *fragments; /* list of received fragments */ | 22 | struct sk_buff *fragments; /* list of received fragments */ |
23 | struct sk_buff *fragments_tail; | ||
23 | ktime_t stamp; | 24 | ktime_t stamp; |
24 | int len; /* total length of orig datagram */ | 25 | int len; /* total length of orig datagram */ |
25 | int meat; | 26 | int meat; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 83fd34437cf1..1989cfd7405f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
24 | #include <linux/netdevice.h> | ||
24 | 25 | ||
25 | #include <net/flow.h> | 26 | #include <net/flow.h> |
26 | #include <net/sock.h> | 27 | #include <net/sock.h> |
@@ -136,7 +137,8 @@ struct inet_sock { | |||
136 | hdrincl:1, | 137 | hdrincl:1, |
137 | mc_loop:1, | 138 | mc_loop:1, |
138 | transparent:1, | 139 | transparent:1, |
139 | mc_all:1; | 140 | mc_all:1, |
141 | nodefrag:1; | ||
140 | int mc_index; | 142 | int mc_index; |
141 | __be32 mc_addr; | 143 | __be32 mc_addr; |
142 | struct ip_mc_socklist *mc_list; | 144 | struct ip_mc_socklist *mc_list; |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 79f67eae8a7e..a066fdd50da6 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -224,7 +224,9 @@ static inline | |||
224 | struct net *twsk_net(const struct inet_timewait_sock *twsk) | 224 | struct net *twsk_net(const struct inet_timewait_sock *twsk) |
225 | { | 225 | { |
226 | #ifdef CONFIG_NET_NS | 226 | #ifdef CONFIG_NET_NS |
227 | return rcu_dereference(twsk->tw_net); | 227 | return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */ |
228 | /* reference counting, */ | ||
229 | /* initialization, or RCU. */ | ||
228 | #else | 230 | #else |
229 | return &init_net; | 231 | return &init_net; |
230 | #endif | 232 | #endif |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 87b1df0d4d8c..417d0c894f29 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -22,10 +22,21 @@ struct inet_peer { | |||
22 | __u32 dtime; /* the time of last use of not | 22 | __u32 dtime; /* the time of last use of not |
23 | * referenced entries */ | 23 | * referenced entries */ |
24 | atomic_t refcnt; | 24 | atomic_t refcnt; |
25 | atomic_t rid; /* Frag reception counter */ | 25 | /* |
26 | atomic_t ip_id_count; /* IP ID for the next packet */ | 26 | * Once inet_peer is queued for deletion (refcnt == -1), following fields |
27 | __u32 tcp_ts; | 27 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp |
28 | __u32 tcp_ts_stamp; | 28 | * We can share memory with rcu_head to keep inet_peer small |
29 | * (less then 64 bytes) | ||
30 | */ | ||
31 | union { | ||
32 | struct { | ||
33 | atomic_t rid; /* Frag reception counter */ | ||
34 | atomic_t ip_id_count; /* IP ID for the next packet */ | ||
35 | __u32 tcp_ts; | ||
36 | __u32 tcp_ts_stamp; | ||
37 | }; | ||
38 | struct rcu_head rcu; | ||
39 | }; | ||
29 | }; | 40 | }; |
30 | 41 | ||
31 | void inet_initpeers(void) __init; | 42 | void inet_initpeers(void) __init; |
@@ -36,10 +47,21 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create); | |||
36 | /* can be called from BH context or outside */ | 47 | /* can be called from BH context or outside */ |
37 | extern void inet_putpeer(struct inet_peer *p); | 48 | extern void inet_putpeer(struct inet_peer *p); |
38 | 49 | ||
50 | /* | ||
51 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, | ||
52 | * tcp_ts_stamp if no refcount is taken on inet_peer | ||
53 | */ | ||
54 | static inline void inet_peer_refcheck(const struct inet_peer *p) | ||
55 | { | ||
56 | WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); | ||
57 | } | ||
58 | |||
59 | |||
39 | /* can be called with or without local BH being disabled */ | 60 | /* can be called with or without local BH being disabled */ |
40 | static inline __u16 inet_getid(struct inet_peer *p, int more) | 61 | static inline __u16 inet_getid(struct inet_peer *p, int more) |
41 | { | 62 | { |
42 | more++; | 63 | more++; |
64 | inet_peer_refcheck(p); | ||
43 | return atomic_add_return(more, &p->ip_id_count) - more; | 65 | return atomic_add_return(more, &p->ip_id_count) - more; |
44 | } | 66 | } |
45 | 67 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 503994a38ed1..890f9725d681 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -61,11 +61,14 @@ struct ipcm_cookie { | |||
61 | struct ip_ra_chain { | 61 | struct ip_ra_chain { |
62 | struct ip_ra_chain *next; | 62 | struct ip_ra_chain *next; |
63 | struct sock *sk; | 63 | struct sock *sk; |
64 | void (*destructor)(struct sock *); | 64 | union { |
65 | void (*destructor)(struct sock *); | ||
66 | struct sock *saved_sk; | ||
67 | }; | ||
68 | struct rcu_head rcu; | ||
65 | }; | 69 | }; |
66 | 70 | ||
67 | extern struct ip_ra_chain *ip_ra_chain; | 71 | extern struct ip_ra_chain *ip_ra_chain; |
68 | extern rwlock_t ip_ra_lock; | ||
69 | 72 | ||
70 | /* IP flags. */ | 73 | /* IP flags. */ |
71 | #define IP_CE 0x8000 /* Flag: "Congestion" */ | 74 | #define IP_CE 0x8000 /* Flag: "Congestion" */ |
@@ -101,7 +104,7 @@ extern int ip_do_nat(struct sk_buff *skb); | |||
101 | extern void ip_send_check(struct iphdr *ip); | 104 | extern void ip_send_check(struct iphdr *ip); |
102 | extern int __ip_local_out(struct sk_buff *skb); | 105 | extern int __ip_local_out(struct sk_buff *skb); |
103 | extern int ip_local_out(struct sk_buff *skb); | 106 | extern int ip_local_out(struct sk_buff *skb); |
104 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); | 107 | extern int ip_queue_xmit(struct sk_buff *skb); |
105 | extern void ip_init(void); | 108 | extern void ip_init(void); |
106 | extern int ip_append_data(struct sock *sk, | 109 | extern int ip_append_data(struct sock *sk, |
107 | int getfrag(void *from, char *to, int offset, int len, | 110 | int getfrag(void *from, char *to, int offset, int len, |
@@ -162,12 +165,12 @@ struct ipv4_config { | |||
162 | }; | 165 | }; |
163 | 166 | ||
164 | extern struct ipv4_config ipv4_config; | 167 | extern struct ipv4_config ipv4_config; |
165 | #define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) | 168 | #define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) |
166 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) | 169 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field) |
167 | #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val) | 170 | #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val) |
168 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) | 171 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val) |
169 | #define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val) | 172 | #define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val) |
170 | #define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val) | 173 | #define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val) |
171 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) | 174 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) |
172 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) | 175 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) |
173 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) | 176 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) |
@@ -175,7 +178,15 @@ extern struct ipv4_config ipv4_config; | |||
175 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 178 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
176 | 179 | ||
177 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); | 180 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); |
178 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); | 181 | #if BITS_PER_LONG==32 |
182 | extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); | ||
183 | #else | ||
184 | static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) | ||
185 | { | ||
186 | return snmp_fold_field(mib, offt); | ||
187 | } | ||
188 | #endif | ||
189 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); | ||
179 | extern void snmp_mib_free(void __percpu *ptr[2]); | 190 | extern void snmp_mib_free(void __percpu *ptr[2]); |
180 | 191 | ||
181 | extern struct local_ports { | 192 | extern struct local_ports { |
@@ -184,6 +195,12 @@ extern struct local_ports { | |||
184 | } sysctl_local_ports; | 195 | } sysctl_local_ports; |
185 | extern void inet_get_local_port_range(int *low, int *high); | 196 | extern void inet_get_local_port_range(int *low, int *high); |
186 | 197 | ||
198 | extern unsigned long *sysctl_local_reserved_ports; | ||
199 | static inline int inet_is_reserved_local_port(int port) | ||
200 | { | ||
201 | return test_bit(port, sysctl_local_reserved_ports); | ||
202 | } | ||
203 | |||
187 | extern int sysctl_ip_default_ttl; | 204 | extern int sysctl_ip_default_ttl; |
188 | extern int sysctl_ip_nonlocal_bind; | 205 | extern int sysctl_ip_nonlocal_bind; |
189 | 206 | ||
@@ -352,11 +369,11 @@ enum ip_defrag_users { | |||
352 | IP_DEFRAG_LOCAL_DELIVER, | 369 | IP_DEFRAG_LOCAL_DELIVER, |
353 | IP_DEFRAG_CALL_RA_CHAIN, | 370 | IP_DEFRAG_CALL_RA_CHAIN, |
354 | IP_DEFRAG_CONNTRACK_IN, | 371 | IP_DEFRAG_CONNTRACK_IN, |
355 | __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX, | 372 | __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX, |
356 | IP_DEFRAG_CONNTRACK_OUT, | 373 | IP_DEFRAG_CONNTRACK_OUT, |
357 | __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | 374 | __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX, |
358 | IP_DEFRAG_CONNTRACK_BRIDGE_IN, | 375 | IP_DEFRAG_CONNTRACK_BRIDGE_IN, |
359 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | 376 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX, |
360 | IP_DEFRAG_VS_IN, | 377 | IP_DEFRAG_VS_IN, |
361 | IP_DEFRAG_VS_OUT, | 378 | IP_DEFRAG_VS_OUT, |
362 | IP_DEFRAG_VS_FWD | 379 | IP_DEFRAG_VS_FWD |
@@ -393,6 +410,7 @@ extern int ip_options_rcv_srr(struct sk_buff *skb); | |||
393 | * Functions provided by ip_sockglue.c | 410 | * Functions provided by ip_sockglue.c |
394 | */ | 411 | */ |
395 | 412 | ||
413 | extern int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | ||
396 | extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); | 414 | extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); |
397 | extern int ip_cmsg_send(struct net *net, | 415 | extern int ip_cmsg_send(struct net *net, |
398 | struct msghdr *msg, struct ipcm_cookie *ipc); | 416 | struct msghdr *msg, struct ipcm_cookie *ipc); |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 86f46c49e318..062a823d311c 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -84,38 +84,39 @@ struct rt6key { | |||
84 | struct fib6_table; | 84 | struct fib6_table; |
85 | 85 | ||
86 | struct rt6_info { | 86 | struct rt6_info { |
87 | union { | 87 | struct dst_entry dst; |
88 | struct dst_entry dst; | ||
89 | } u; | ||
90 | 88 | ||
91 | struct inet6_dev *rt6i_idev; | 89 | #define rt6i_dev dst.dev |
92 | 90 | #define rt6i_nexthop dst.neighbour | |
93 | #define rt6i_dev u.dst.dev | 91 | #define rt6i_expires dst.expires |
94 | #define rt6i_nexthop u.dst.neighbour | ||
95 | #define rt6i_expires u.dst.expires | ||
96 | 92 | ||
93 | /* | ||
94 | * Tail elements of dst_entry (__refcnt etc.) | ||
95 | * and these elements (rarely used in hot path) are in | ||
96 | * the same cache line. | ||
97 | */ | ||
98 | struct fib6_table *rt6i_table; | ||
97 | struct fib6_node *rt6i_node; | 99 | struct fib6_node *rt6i_node; |
98 | 100 | ||
99 | struct in6_addr rt6i_gateway; | 101 | struct in6_addr rt6i_gateway; |
100 | |||
101 | u32 rt6i_flags; | ||
102 | u32 rt6i_metric; | ||
103 | atomic_t rt6i_ref; | ||
104 | 102 | ||
105 | /* more non-fragment space at head required */ | 103 | atomic_t rt6i_ref; |
106 | unsigned short rt6i_nfheader_len; | ||
107 | |||
108 | u8 rt6i_protocol; | ||
109 | 104 | ||
110 | struct fib6_table *rt6i_table; | 105 | /* These are in a separate cache line. */ |
106 | struct rt6key rt6i_dst ____cacheline_aligned_in_smp; | ||
107 | u32 rt6i_flags; | ||
108 | struct rt6key rt6i_src; | ||
109 | u32 rt6i_metric; | ||
111 | 110 | ||
112 | struct rt6key rt6i_dst; | 111 | struct inet6_dev *rt6i_idev; |
113 | 112 | ||
114 | #ifdef CONFIG_XFRM | 113 | #ifdef CONFIG_XFRM |
115 | u32 rt6i_flow_cache_genid; | 114 | u32 rt6i_flow_cache_genid; |
116 | #endif | 115 | #endif |
116 | /* more non-fragment space at head required */ | ||
117 | unsigned short rt6i_nfheader_len; | ||
117 | 118 | ||
118 | struct rt6key rt6i_src; | 119 | u8 rt6i_protocol; |
119 | }; | 120 | }; |
120 | 121 | ||
121 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | 122 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 68f67836e146..278312c95f96 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -152,9 +152,9 @@ static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, | |||
152 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | 152 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, |
153 | struct in6_addr *daddr, struct in6_addr *saddr) | 153 | struct in6_addr *daddr, struct in6_addr *saddr) |
154 | { | 154 | { |
155 | write_lock(&sk->sk_dst_lock); | 155 | spin_lock(&sk->sk_dst_lock); |
156 | __ip6_dst_store(sk, dst, daddr, saddr); | 156 | __ip6_dst_store(sk, dst, daddr, saddr); |
157 | write_unlock(&sk->sk_dst_lock); | 157 | spin_unlock(&sk->sk_dst_lock); |
158 | } | 158 | } |
159 | 159 | ||
160 | static inline int ipv6_unicast_destination(struct sk_buff *skb) | 160 | static inline int ipv6_unicast_destination(struct sk_buff *skb) |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index fbf9d1cda27b..fc94ec568a50 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
@@ -27,6 +27,6 @@ struct ipv6_tlv_tnl_enc_lim { | |||
27 | __u8 type; /* type-code for option */ | 27 | __u8 type; /* type-code for option */ |
28 | __u8 length; /* option length */ | 28 | __u8 length; /* option length */ |
29 | __u8 encap_limit; /* tunnel encapsulation limit */ | 29 | __u8 encap_limit; /* tunnel encapsulation limit */ |
30 | } __attribute__ ((packed)); | 30 | } __packed; |
31 | 31 | ||
32 | #endif | 32 | #endif |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index fe82b1e10a29..f976885f686f 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -632,10 +632,22 @@ extern struct ip_vs_conn *ip_vs_ct_in_get | |||
632 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, | 632 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, |
633 | const union nf_inet_addr *d_addr, __be16 d_port); | 633 | const union nf_inet_addr *d_addr, __be16 d_port); |
634 | 634 | ||
635 | struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, | ||
636 | struct ip_vs_protocol *pp, | ||
637 | const struct ip_vs_iphdr *iph, | ||
638 | unsigned int proto_off, | ||
639 | int inverse); | ||
640 | |||
635 | extern struct ip_vs_conn *ip_vs_conn_out_get | 641 | extern struct ip_vs_conn *ip_vs_conn_out_get |
636 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, | 642 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, |
637 | const union nf_inet_addr *d_addr, __be16 d_port); | 643 | const union nf_inet_addr *d_addr, __be16 d_port); |
638 | 644 | ||
645 | struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, | ||
646 | struct ip_vs_protocol *pp, | ||
647 | const struct ip_vs_iphdr *iph, | ||
648 | unsigned int proto_off, | ||
649 | int inverse); | ||
650 | |||
639 | /* put back the conn without restarting its timer */ | 651 | /* put back the conn without restarting its timer */ |
640 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 652 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
641 | { | 653 | { |
@@ -736,8 +748,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | |||
736 | 748 | ||
737 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | 749 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); |
738 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | 750 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
739 | extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, | ||
740 | char *o_buf, int o_len, char *n_buf, int n_len); | ||
741 | extern int ip_vs_app_init(void); | 751 | extern int ip_vs_app_init(void); |
742 | extern void ip_vs_app_cleanup(void); | 752 | extern void ip_vs_app_cleanup(void); |
743 | 753 | ||
@@ -945,6 +955,9 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) | |||
945 | return csum_partial(diff, sizeof(diff), oldsum); | 955 | return csum_partial(diff, sizeof(diff), oldsum); |
946 | } | 956 | } |
947 | 957 | ||
958 | extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, | ||
959 | int outin); | ||
960 | |||
948 | #endif /* __KERNEL__ */ | 961 | #endif /* __KERNEL__ */ |
949 | 962 | ||
950 | #endif /* _NET_IP_VS_H */ | 963 | #endif /* _NET_IP_VS_H */ |
diff --git a/include/net/ipip.h b/include/net/ipip.h index 11e8513d2d07..65caea8b414f 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
@@ -50,7 +50,7 @@ struct ip_tunnel_prl_entry { | |||
50 | int pkt_len = skb->len - skb_transport_offset(skb); \ | 50 | int pkt_len = skb->len - skb_transport_offset(skb); \ |
51 | \ | 51 | \ |
52 | skb->ip_summed = CHECKSUM_NONE; \ | 52 | skb->ip_summed = CHECKSUM_NONE; \ |
53 | ip_select_ident(iph, &rt->u.dst, NULL); \ | 53 | ip_select_ident(iph, &rt->dst, NULL); \ |
54 | \ | 54 | \ |
55 | err = ip_local_out(skb); \ | 55 | err = ip_local_out(skb); \ |
56 | if (likely(net_xmit_eval(err) == 0)) { \ | 56 | if (likely(net_xmit_eval(err) == 0)) { \ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index e72fb10ce573..1f8412410998 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -136,17 +136,17 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
136 | /* MIBs */ | 136 | /* MIBs */ |
137 | 137 | ||
138 | #define IP6_INC_STATS(net, idev,field) \ | 138 | #define IP6_INC_STATS(net, idev,field) \ |
139 | _DEVINC(net, ipv6, , idev, field) | 139 | _DEVINC(net, ipv6, 64, idev, field) |
140 | #define IP6_INC_STATS_BH(net, idev,field) \ | 140 | #define IP6_INC_STATS_BH(net, idev,field) \ |
141 | _DEVINC(net, ipv6, _BH, idev, field) | 141 | _DEVINC(net, ipv6, 64_BH, idev, field) |
142 | #define IP6_ADD_STATS(net, idev,field,val) \ | 142 | #define IP6_ADD_STATS(net, idev,field,val) \ |
143 | _DEVADD(net, ipv6, , idev, field, val) | 143 | _DEVADD(net, ipv6, 64, idev, field, val) |
144 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ | 144 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ |
145 | _DEVADD(net, ipv6, _BH, idev, field, val) | 145 | _DEVADD(net, ipv6, 64_BH, idev, field, val) |
146 | #define IP6_UPD_PO_STATS(net, idev,field,val) \ | 146 | #define IP6_UPD_PO_STATS(net, idev,field,val) \ |
147 | _DEVUPD(net, ipv6, , idev, field, val) | 147 | _DEVUPD(net, ipv6, 64, idev, field, val) |
148 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | 148 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ |
149 | _DEVUPD(net, ipv6, _BH, idev, field, val) | 149 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) |
150 | #define ICMP6_INC_STATS(net, idev, field) \ | 150 | #define ICMP6_INC_STATS(net, idev, field) \ |
151 | _DEVINC(net, icmpv6, , idev, field) | 151 | _DEVINC(net, icmpv6, , idev, field) |
152 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 152 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
@@ -354,11 +354,11 @@ struct inet_frag_queue; | |||
354 | enum ip6_defrag_users { | 354 | enum ip6_defrag_users { |
355 | IP6_DEFRAG_LOCAL_DELIVER, | 355 | IP6_DEFRAG_LOCAL_DELIVER, |
356 | IP6_DEFRAG_CONNTRACK_IN, | 356 | IP6_DEFRAG_CONNTRACK_IN, |
357 | __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX, | 357 | __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHRT_MAX, |
358 | IP6_DEFRAG_CONNTRACK_OUT, | 358 | IP6_DEFRAG_CONNTRACK_OUT, |
359 | __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | 359 | __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHRT_MAX, |
360 | IP6_DEFRAG_CONNTRACK_BRIDGE_IN, | 360 | IP6_DEFRAG_CONNTRACK_BRIDGE_IN, |
361 | __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | 361 | __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX, |
362 | }; | 362 | }; |
363 | 363 | ||
364 | struct ip6_create_arg { | 364 | struct ip6_create_arg { |
@@ -422,7 +422,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a | |||
422 | for (i = 0; i < addrlen; i++) { | 422 | for (i = 0; i < addrlen; i++) { |
423 | __be32 xb = a1[i] ^ a2[i]; | 423 | __be32 xb = a1[i] ^ a2[i]; |
424 | if (xb) | 424 | if (xb) |
425 | return i * 32 + 32 - fls(ntohl(xb)); | 425 | return i * 32 + 31 - __fls(ntohl(xb)); |
426 | } | 426 | } |
427 | 427 | ||
428 | /* | 428 | /* |
@@ -482,8 +482,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb); | |||
482 | extern int ip6_xmit(struct sock *sk, | 482 | extern int ip6_xmit(struct sock *sk, |
483 | struct sk_buff *skb, | 483 | struct sk_buff *skb, |
484 | struct flowi *fl, | 484 | struct flowi *fl, |
485 | struct ipv6_txoptions *opt, | 485 | struct ipv6_txoptions *opt); |
486 | int ipfragok); | ||
487 | 486 | ||
488 | extern int ip6_nd_hdr(struct sock *sk, | 487 | extern int ip6_nd_hdr(struct sock *sk, |
489 | struct sk_buff *skb, | 488 | struct sk_buff *skb, |
@@ -504,7 +503,8 @@ extern int ip6_append_data(struct sock *sk, | |||
504 | struct ipv6_txoptions *opt, | 503 | struct ipv6_txoptions *opt, |
505 | struct flowi *fl, | 504 | struct flowi *fl, |
506 | struct rt6_info *rt, | 505 | struct rt6_info *rt, |
507 | unsigned int flags); | 506 | unsigned int flags, |
507 | int dontfrag); | ||
508 | 508 | ||
509 | extern int ip6_push_pending_frames(struct sock *sk); | 509 | extern int ip6_push_pending_frames(struct sock *sk); |
510 | 510 | ||
@@ -551,6 +551,10 @@ extern int ipv6_ext_hdr(u8 nexthdr); | |||
551 | 551 | ||
552 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | 552 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); |
553 | 553 | ||
554 | extern struct in6_addr *fl6_update_dst(struct flowi *fl, | ||
555 | const struct ipv6_txoptions *opt, | ||
556 | struct in6_addr *orig); | ||
557 | |||
554 | /* | 558 | /* |
555 | * socket options (ipv6_sockglue.c) | 559 | * socket options (ipv6_sockglue.c) |
556 | */ | 560 | */ |
@@ -578,9 +582,11 @@ extern int ip6_datagram_connect(struct sock *sk, | |||
578 | struct sockaddr *addr, int addr_len); | 582 | struct sockaddr *addr, int addr_len); |
579 | 583 | ||
580 | extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); | 584 | extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); |
585 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); | ||
581 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 586 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
582 | u32 info, u8 *payload); | 587 | u32 info, u8 *payload); |
583 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); | 588 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); |
589 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu); | ||
584 | 590 | ||
585 | extern int inet6_release(struct socket *sock); | 591 | extern int inet6_release(struct socket *sock); |
586 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, | 592 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, |
diff --git a/include/net/ipx.h b/include/net/ipx.h index ef51a668ba19..05d7e4a88b49 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
@@ -27,9 +27,9 @@ struct ipx_address { | |||
27 | #define IPX_MAX_PPROP_HOPS 8 | 27 | #define IPX_MAX_PPROP_HOPS 8 |
28 | 28 | ||
29 | struct ipxhdr { | 29 | struct ipxhdr { |
30 | __be16 ipx_checksum __attribute__ ((packed)); | 30 | __be16 ipx_checksum __packed; |
31 | #define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF) | 31 | #define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF) |
32 | __be16 ipx_pktsize __attribute__ ((packed)); | 32 | __be16 ipx_pktsize __packed; |
33 | __u8 ipx_tctrl; | 33 | __u8 ipx_tctrl; |
34 | __u8 ipx_type; | 34 | __u8 ipx_type; |
35 | #define IPX_TYPE_UNKNOWN 0x00 | 35 | #define IPX_TYPE_UNKNOWN 0x00 |
@@ -38,8 +38,8 @@ struct ipxhdr { | |||
38 | #define IPX_TYPE_SPX 0x05 /* SPX protocol */ | 38 | #define IPX_TYPE_SPX 0x05 /* SPX protocol */ |
39 | #define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ | 39 | #define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ |
40 | #define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */ | 40 | #define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */ |
41 | struct ipx_address ipx_dest __attribute__ ((packed)); | 41 | struct ipx_address ipx_dest __packed; |
42 | struct ipx_address ipx_source __attribute__ ((packed)); | 42 | struct ipx_address ipx_source __packed; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) | 45 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) |
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index 7e582061b230..3bed61d379a8 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h | |||
@@ -53,10 +53,6 @@ typedef __u32 magic_t; | |||
53 | #ifndef IRDA_ALIGN | 53 | #ifndef IRDA_ALIGN |
54 | # define IRDA_ALIGN __attribute__((aligned)) | 54 | # define IRDA_ALIGN __attribute__((aligned)) |
55 | #endif | 55 | #endif |
56 | #ifndef IRDA_PACK | ||
57 | # define IRDA_PACK __attribute__((packed)) | ||
58 | #endif | ||
59 | |||
60 | 56 | ||
61 | #ifdef CONFIG_IRDA_DEBUG | 57 | #ifdef CONFIG_IRDA_DEBUG |
62 | 58 | ||
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h index 641f88e848bd..6b1dc4f8eca5 100644 --- a/include/net/irda/irlap_frame.h +++ b/include/net/irda/irlap_frame.h | |||
@@ -85,7 +85,7 @@ struct discovery_t; | |||
85 | struct disc_frame { | 85 | struct disc_frame { |
86 | __u8 caddr; /* Connection address */ | 86 | __u8 caddr; /* Connection address */ |
87 | __u8 control; | 87 | __u8 control; |
88 | } IRDA_PACK; | 88 | } __packed; |
89 | 89 | ||
90 | struct xid_frame { | 90 | struct xid_frame { |
91 | __u8 caddr; /* Connection address */ | 91 | __u8 caddr; /* Connection address */ |
@@ -96,41 +96,41 @@ struct xid_frame { | |||
96 | __u8 flags; /* Discovery flags */ | 96 | __u8 flags; /* Discovery flags */ |
97 | __u8 slotnr; | 97 | __u8 slotnr; |
98 | __u8 version; | 98 | __u8 version; |
99 | } IRDA_PACK; | 99 | } __packed; |
100 | 100 | ||
101 | struct test_frame { | 101 | struct test_frame { |
102 | __u8 caddr; /* Connection address */ | 102 | __u8 caddr; /* Connection address */ |
103 | __u8 control; | 103 | __u8 control; |
104 | __le32 saddr; /* Source device address */ | 104 | __le32 saddr; /* Source device address */ |
105 | __le32 daddr; /* Destination device address */ | 105 | __le32 daddr; /* Destination device address */ |
106 | } IRDA_PACK; | 106 | } __packed; |
107 | 107 | ||
108 | struct ua_frame { | 108 | struct ua_frame { |
109 | __u8 caddr; | 109 | __u8 caddr; |
110 | __u8 control; | 110 | __u8 control; |
111 | __le32 saddr; /* Source device address */ | 111 | __le32 saddr; /* Source device address */ |
112 | __le32 daddr; /* Dest device address */ | 112 | __le32 daddr; /* Dest device address */ |
113 | } IRDA_PACK; | 113 | } __packed; |
114 | 114 | ||
115 | struct dm_frame { | 115 | struct dm_frame { |
116 | __u8 caddr; /* Connection address */ | 116 | __u8 caddr; /* Connection address */ |
117 | __u8 control; | 117 | __u8 control; |
118 | } IRDA_PACK; | 118 | } __packed; |
119 | 119 | ||
120 | struct rd_frame { | 120 | struct rd_frame { |
121 | __u8 caddr; /* Connection address */ | 121 | __u8 caddr; /* Connection address */ |
122 | __u8 control; | 122 | __u8 control; |
123 | } IRDA_PACK; | 123 | } __packed; |
124 | 124 | ||
125 | struct rr_frame { | 125 | struct rr_frame { |
126 | __u8 caddr; /* Connection address */ | 126 | __u8 caddr; /* Connection address */ |
127 | __u8 control; | 127 | __u8 control; |
128 | } IRDA_PACK; | 128 | } __packed; |
129 | 129 | ||
130 | struct i_frame { | 130 | struct i_frame { |
131 | __u8 caddr; | 131 | __u8 caddr; |
132 | __u8 control; | 132 | __u8 control; |
133 | } IRDA_PACK; | 133 | } __packed; |
134 | 134 | ||
135 | struct snrm_frame { | 135 | struct snrm_frame { |
136 | __u8 caddr; | 136 | __u8 caddr; |
@@ -138,7 +138,7 @@ struct snrm_frame { | |||
138 | __le32 saddr; | 138 | __le32 saddr; |
139 | __le32 daddr; | 139 | __le32 daddr; |
140 | __u8 ncaddr; | 140 | __u8 ncaddr; |
141 | } IRDA_PACK; | 141 | } __packed; |
142 | 142 | ||
143 | void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); | 143 | void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); |
144 | void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, | 144 | void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index b2b98f3fa265..3afdb21cc31d 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
@@ -323,7 +323,7 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info, | |||
323 | struct iw_handler_def { | 323 | struct iw_handler_def { |
324 | 324 | ||
325 | /* Array of handlers for standard ioctls | 325 | /* Array of handlers for standard ioctls |
326 | * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] | 326 | * We will call dev->wireless_handlers->standard[ioctl - SIOCIWFIRST] |
327 | */ | 327 | */ |
328 | const iw_handler * standard; | 328 | const iw_handler * standard; |
329 | /* Number of handlers defined (more precisely, index of the | 329 | /* Number of handlers defined (more precisely, index of the |
diff --git a/include/net/lib80211.h b/include/net/lib80211.h index fb4e2784857d..848cce1bb7a5 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h | |||
@@ -54,9 +54,6 @@ struct lib80211_crypto_ops { | |||
54 | /* deinitialize crypto context and free allocated private data */ | 54 | /* deinitialize crypto context and free allocated private data */ |
55 | void (*deinit) (void *priv); | 55 | void (*deinit) (void *priv); |
56 | 56 | ||
57 | int (*build_iv) (struct sk_buff * skb, int hdr_len, | ||
58 | u8 *key, int keylen, void *priv); | ||
59 | |||
60 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | 57 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
61 | * value from decrypt_mpdu is passed as the keyidx value for | 58 | * value from decrypt_mpdu is passed as the keyidx value for |
62 | * decrypt_msdu. skb must have enough head and tail room for the | 59 | * decrypt_msdu. skb must have enough head and tail room for the |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 45d7d44d7cbe..b0787a1dea90 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -144,6 +144,11 @@ struct ieee80211_low_level_stats { | |||
144 | * new beacon (beaconing modes) | 144 | * new beacon (beaconing modes) |
145 | * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be | 145 | * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be |
146 | * enabled/disabled (beaconing modes) | 146 | * enabled/disabled (beaconing modes) |
147 | * @BSS_CHANGED_CQM: Connection quality monitor config changed | ||
148 | * @BSS_CHANGED_IBSS: IBSS join status changed | ||
149 | * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. | ||
150 | * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note | ||
151 | * that it is only ever disabled for station mode. | ||
147 | */ | 152 | */ |
148 | enum ieee80211_bss_change { | 153 | enum ieee80211_bss_change { |
149 | BSS_CHANGED_ASSOC = 1<<0, | 154 | BSS_CHANGED_ASSOC = 1<<0, |
@@ -156,8 +161,21 @@ enum ieee80211_bss_change { | |||
156 | BSS_CHANGED_BSSID = 1<<7, | 161 | BSS_CHANGED_BSSID = 1<<7, |
157 | BSS_CHANGED_BEACON = 1<<8, | 162 | BSS_CHANGED_BEACON = 1<<8, |
158 | BSS_CHANGED_BEACON_ENABLED = 1<<9, | 163 | BSS_CHANGED_BEACON_ENABLED = 1<<9, |
164 | BSS_CHANGED_CQM = 1<<10, | ||
165 | BSS_CHANGED_IBSS = 1<<11, | ||
166 | BSS_CHANGED_ARP_FILTER = 1<<12, | ||
167 | BSS_CHANGED_QOS = 1<<13, | ||
168 | |||
169 | /* when adding here, make sure to change ieee80211_reconfig */ | ||
159 | }; | 170 | }; |
160 | 171 | ||
172 | /* | ||
173 | * The maximum number of IPv4 addresses listed for ARP filtering. If the number | ||
174 | * of addresses for an interface increase beyond this value, hardware ARP | ||
175 | * filtering will be disabled. | ||
176 | */ | ||
177 | #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 | ||
178 | |||
161 | /** | 179 | /** |
162 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | 180 | * struct ieee80211_bss_conf - holds the BSS's changing parameters |
163 | * | 181 | * |
@@ -165,6 +183,8 @@ enum ieee80211_bss_change { | |||
165 | * to that BSS) that can change during the lifetime of the BSS. | 183 | * to that BSS) that can change during the lifetime of the BSS. |
166 | * | 184 | * |
167 | * @assoc: association status | 185 | * @assoc: association status |
186 | * @ibss_joined: indicates whether this station is part of an IBSS | ||
187 | * or not | ||
168 | * @aid: association ID number, valid only when @assoc is true | 188 | * @aid: association ID number, valid only when @assoc is true |
169 | * @use_cts_prot: use CTS protection | 189 | * @use_cts_prot: use CTS protection |
170 | * @use_short_preamble: use 802.11b short preamble; | 190 | * @use_short_preamble: use 802.11b short preamble; |
@@ -174,7 +194,9 @@ enum ieee80211_bss_change { | |||
174 | * if the hardware cannot handle this it must set the | 194 | * if the hardware cannot handle this it must set the |
175 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag | 195 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag |
176 | * @dtim_period: num of beacons before the next DTIM, for beaconing, | 196 | * @dtim_period: num of beacons before the next DTIM, for beaconing, |
177 | * not valid in station mode (cf. hw conf ps_dtim_period) | 197 | * valid in station mode only while @assoc is true and if also |
198 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf | ||
199 | * @ps_dtim_period) | ||
178 | * @timestamp: beacon timestamp | 200 | * @timestamp: beacon timestamp |
179 | * @beacon_int: beacon interval | 201 | * @beacon_int: beacon interval |
180 | * @assoc_capability: capabilities taken from assoc resp | 202 | * @assoc_capability: capabilities taken from assoc resp |
@@ -183,13 +205,29 @@ enum ieee80211_bss_change { | |||
183 | * the current band. | 205 | * the current band. |
184 | * @bssid: The BSSID for this BSS | 206 | * @bssid: The BSSID for this BSS |
185 | * @enable_beacon: whether beaconing should be enabled or not | 207 | * @enable_beacon: whether beaconing should be enabled or not |
208 | * @channel_type: Channel type for this BSS -- the hardware might be | ||
209 | * configured for HT40+ while this BSS only uses no-HT, for | ||
210 | * example. | ||
186 | * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). | 211 | * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). |
187 | * This field is only valid when the channel type is one of the HT types. | 212 | * This field is only valid when the channel type is one of the HT types. |
213 | * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value | ||
214 | * implies disabled | ||
215 | * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis | ||
216 | * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The | ||
217 | * may filter ARP queries targeted for other addresses than listed here. | ||
218 | * The driver must allow ARP queries targeted for all address listed here | ||
219 | * to pass through. An empty list implies no ARP queries need to pass. | ||
220 | * @arp_addr_cnt: Number of addresses currently on the list. | ||
221 | * @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may | ||
222 | * filter ARP queries based on the @arp_addr_list, if disabled, the | ||
223 | * hardware must not perform any ARP filtering. Note, that the filter will | ||
224 | * be enabled also in promiscuous mode. | ||
225 | * @qos: This is a QoS-enabled BSS. | ||
188 | */ | 226 | */ |
189 | struct ieee80211_bss_conf { | 227 | struct ieee80211_bss_conf { |
190 | const u8 *bssid; | 228 | const u8 *bssid; |
191 | /* association related data */ | 229 | /* association related data */ |
192 | bool assoc; | 230 | bool assoc, ibss_joined; |
193 | u16 aid; | 231 | u16 aid; |
194 | /* erp related data */ | 232 | /* erp related data */ |
195 | bool use_cts_prot; | 233 | bool use_cts_prot; |
@@ -202,6 +240,13 @@ struct ieee80211_bss_conf { | |||
202 | u64 timestamp; | 240 | u64 timestamp; |
203 | u32 basic_rates; | 241 | u32 basic_rates; |
204 | u16 ht_operation_mode; | 242 | u16 ht_operation_mode; |
243 | s32 cqm_rssi_thold; | ||
244 | u32 cqm_rssi_hyst; | ||
245 | enum nl80211_channel_type channel_type; | ||
246 | __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; | ||
247 | u8 arp_addr_cnt; | ||
248 | bool arp_filter_enabled; | ||
249 | bool qos; | ||
205 | }; | 250 | }; |
206 | 251 | ||
207 | /** | 252 | /** |
@@ -267,6 +312,9 @@ struct ieee80211_bss_conf { | |||
267 | * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 | 312 | * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 |
268 | * MLME command (internal to mac80211 to figure out whether to send TX | 313 | * MLME command (internal to mac80211 to figure out whether to send TX |
269 | * status to user space) | 314 | * status to user space) |
315 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame | ||
316 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this | ||
317 | * frame and selects the maximum number of streams that it can use. | ||
270 | */ | 318 | */ |
271 | enum mac80211_tx_control_flags { | 319 | enum mac80211_tx_control_flags { |
272 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 320 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
@@ -290,8 +338,12 @@ enum mac80211_tx_control_flags { | |||
290 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), | 338 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), |
291 | IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), | 339 | IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), |
292 | IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), | 340 | IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), |
341 | IEEE80211_TX_CTL_LDPC = BIT(22), | ||
342 | IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), | ||
293 | }; | 343 | }; |
294 | 344 | ||
345 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 | ||
346 | |||
295 | /** | 347 | /** |
296 | * enum mac80211_rate_control_flags - per-rate flags set by the | 348 | * enum mac80211_rate_control_flags - per-rate flags set by the |
297 | * Rate Control algorithm. | 349 | * Rate Control algorithm. |
@@ -367,7 +419,7 @@ struct ieee80211_tx_rate { | |||
367 | s8 idx; | 419 | s8 idx; |
368 | u8 count; | 420 | u8 count; |
369 | u8 flags; | 421 | u8 flags; |
370 | } __attribute__((packed)); | 422 | } __packed; |
371 | 423 | ||
372 | /** | 424 | /** |
373 | * struct ieee80211_tx_info - skb transmit information | 425 | * struct ieee80211_tx_info - skb transmit information |
@@ -388,11 +440,9 @@ struct ieee80211_tx_rate { | |||
388 | * @status: union for status data | 440 | * @status: union for status data |
389 | * @driver_data: array of driver_data pointers | 441 | * @driver_data: array of driver_data pointers |
390 | * @ampdu_ack_len: number of acked aggregated frames. | 442 | * @ampdu_ack_len: number of acked aggregated frames. |
391 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 443 | * relevant only if IEEE80211_TX_STAT_AMPDU was set. |
392 | * @ampdu_ack_map: block ack bit map for the aggregation. | ||
393 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | ||
394 | * @ampdu_len: number of aggregated frames. | 444 | * @ampdu_len: number of aggregated frames. |
395 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 445 | * relevant only if IEEE80211_TX_STAT_AMPDU was set. |
396 | * @ack_signal: signal strength of the ACK frame | 446 | * @ack_signal: signal strength of the ACK frame |
397 | */ | 447 | */ |
398 | struct ieee80211_tx_info { | 448 | struct ieee80211_tx_info { |
@@ -425,10 +475,9 @@ struct ieee80211_tx_info { | |||
425 | struct { | 475 | struct { |
426 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; | 476 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; |
427 | u8 ampdu_ack_len; | 477 | u8 ampdu_ack_len; |
428 | u64 ampdu_ack_map; | ||
429 | int ack_signal; | 478 | int ack_signal; |
430 | u8 ampdu_len; | 479 | u8 ampdu_len; |
431 | /* 7 bytes free */ | 480 | /* 15 bytes free */ |
432 | } status; | 481 | } status; |
433 | struct { | 482 | struct { |
434 | struct ieee80211_tx_rate driver_rates[ | 483 | struct ieee80211_tx_rate driver_rates[ |
@@ -543,7 +592,6 @@ enum mac80211_rx_flags { | |||
543 | * @signal: signal strength when receiving this frame, either in dBm, in dB or | 592 | * @signal: signal strength when receiving this frame, either in dBm, in dB or |
544 | * unspecified depending on the hardware capabilities flags | 593 | * unspecified depending on the hardware capabilities flags |
545 | * @IEEE80211_HW_SIGNAL_* | 594 | * @IEEE80211_HW_SIGNAL_* |
546 | * @noise: noise when receiving this frame, in dBm. | ||
547 | * @antenna: antenna used | 595 | * @antenna: antenna used |
548 | * @rate_idx: index of data rate into band's supported rates or MCS index if | 596 | * @rate_idx: index of data rate into band's supported rates or MCS index if |
549 | * HT rates are use (RX_FLAG_HT) | 597 | * HT rates are use (RX_FLAG_HT) |
@@ -554,7 +602,6 @@ struct ieee80211_rx_status { | |||
554 | enum ieee80211_band band; | 602 | enum ieee80211_band band; |
555 | int freq; | 603 | int freq; |
556 | int signal; | 604 | int signal; |
557 | int noise; | ||
558 | int antenna; | 605 | int antenna; |
559 | int rate_idx; | 606 | int rate_idx; |
560 | int flag; | 607 | int flag; |
@@ -580,11 +627,14 @@ struct ieee80211_rx_status { | |||
580 | * may turn the device off as much as possible. Typically, this flag will | 627 | * may turn the device off as much as possible. Typically, this flag will |
581 | * be set when an interface is set UP but not associated or scanning, but | 628 | * be set when an interface is set UP but not associated or scanning, but |
582 | * it can also be unset in that case when monitor interfaces are active. | 629 | * it can also be unset in that case when monitor interfaces are active. |
630 | * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main | ||
631 | * operating channel. | ||
583 | */ | 632 | */ |
584 | enum ieee80211_conf_flags { | 633 | enum ieee80211_conf_flags { |
585 | IEEE80211_CONF_MONITOR = (1<<0), | 634 | IEEE80211_CONF_MONITOR = (1<<0), |
586 | IEEE80211_CONF_PS = (1<<1), | 635 | IEEE80211_CONF_PS = (1<<1), |
587 | IEEE80211_CONF_IDLE = (1<<2), | 636 | IEEE80211_CONF_IDLE = (1<<2), |
637 | IEEE80211_CONF_OFFCHANNEL = (1<<3), | ||
588 | }; | 638 | }; |
589 | 639 | ||
590 | 640 | ||
@@ -682,6 +732,28 @@ struct ieee80211_conf { | |||
682 | }; | 732 | }; |
683 | 733 | ||
684 | /** | 734 | /** |
735 | * struct ieee80211_channel_switch - holds the channel switch data | ||
736 | * | ||
737 | * The information provided in this structure is required for channel switch | ||
738 | * operation. | ||
739 | * | ||
740 | * @timestamp: value in microseconds of the 64-bit Time Synchronization | ||
741 | * Function (TSF) timer when the frame containing the channel switch | ||
742 | * announcement was received. This is simply the rx.mactime parameter | ||
743 | * the driver passed into mac80211. | ||
744 | * @block_tx: Indicates whether transmission must be blocked before the | ||
745 | * scheduled channel switch, as indicated by the AP. | ||
746 | * @channel: the new channel to switch to | ||
747 | * @count: the number of TBTT's until the channel switch event | ||
748 | */ | ||
749 | struct ieee80211_channel_switch { | ||
750 | u64 timestamp; | ||
751 | bool block_tx; | ||
752 | struct ieee80211_channel *channel; | ||
753 | u8 count; | ||
754 | }; | ||
755 | |||
756 | /** | ||
685 | * struct ieee80211_vif - per-interface data | 757 | * struct ieee80211_vif - per-interface data |
686 | * | 758 | * |
687 | * Data in this structure is continually present for driver | 759 | * Data in this structure is continually present for driver |
@@ -828,16 +900,12 @@ struct ieee80211_sta { | |||
828 | * enum sta_notify_cmd - sta notify command | 900 | * enum sta_notify_cmd - sta notify command |
829 | * | 901 | * |
830 | * Used with the sta_notify() callback in &struct ieee80211_ops, this | 902 | * Used with the sta_notify() callback in &struct ieee80211_ops, this |
831 | * indicates addition and removal of a station to station table, | 903 | * indicates if an associated station made a power state transition. |
832 | * or if a associated station made a power state transition. | ||
833 | * | 904 | * |
834 | * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table | ||
835 | * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table | ||
836 | * @STA_NOTIFY_SLEEP: a station is now sleeping | 905 | * @STA_NOTIFY_SLEEP: a station is now sleeping |
837 | * @STA_NOTIFY_AWAKE: a sleeping station woke up | 906 | * @STA_NOTIFY_AWAKE: a sleeping station woke up |
838 | */ | 907 | */ |
839 | enum sta_notify_cmd { | 908 | enum sta_notify_cmd { |
840 | STA_NOTIFY_ADD, STA_NOTIFY_REMOVE, | ||
841 | STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, | 909 | STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, |
842 | }; | 910 | }; |
843 | 911 | ||
@@ -907,10 +975,6 @@ enum ieee80211_tkip_key_type { | |||
907 | * one milliwatt. This is the preferred method since it is standardized | 975 | * one milliwatt. This is the preferred method since it is standardized |
908 | * between different devices. @max_signal does not need to be set. | 976 | * between different devices. @max_signal does not need to be set. |
909 | * | 977 | * |
910 | * @IEEE80211_HW_NOISE_DBM: | ||
911 | * Hardware can provide noise (radio interference) values in units dBm, | ||
912 | * decibel difference from one milliwatt. | ||
913 | * | ||
914 | * @IEEE80211_HW_SPECTRUM_MGMT: | 978 | * @IEEE80211_HW_SPECTRUM_MGMT: |
915 | * Hardware supports spectrum management defined in 802.11h | 979 | * Hardware supports spectrum management defined in 802.11h |
916 | * Measurement, Channel Switch, Quieting, TPC | 980 | * Measurement, Channel Switch, Quieting, TPC |
@@ -954,6 +1018,20 @@ enum ieee80211_tkip_key_type { | |||
954 | * Hardware can provide ack status reports of Tx frames to | 1018 | * Hardware can provide ack status reports of Tx frames to |
955 | * the stack. | 1019 | * the stack. |
956 | * | 1020 | * |
1021 | * @IEEE80211_HW_CONNECTION_MONITOR: | ||
1022 | * The hardware performs its own connection monitoring, including | ||
1023 | * periodic keep-alives to the AP and probing the AP on beacon loss. | ||
1024 | * When this flag is set, signaling beacon-loss will cause an immediate | ||
1025 | * change to disassociated state. | ||
1026 | * | ||
1027 | * @IEEE80211_HW_SUPPORTS_CQM_RSSI: | ||
1028 | * Hardware can do connection quality monitoring - i.e. it can monitor | ||
1029 | * connection quality related parameters, such as the RSSI level and | ||
1030 | * provide notifications if configured trigger levels are reached. | ||
1031 | * | ||
1032 | * @IEEE80211_HW_NEED_DTIM_PERIOD: | ||
1033 | * This device needs to know the DTIM period for the BSS before | ||
1034 | * associating. | ||
957 | */ | 1035 | */ |
958 | enum ieee80211_hw_flags { | 1036 | enum ieee80211_hw_flags { |
959 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1037 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -963,7 +1041,7 @@ enum ieee80211_hw_flags { | |||
963 | IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, | 1041 | IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, |
964 | IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, | 1042 | IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, |
965 | IEEE80211_HW_SIGNAL_DBM = 1<<6, | 1043 | IEEE80211_HW_SIGNAL_DBM = 1<<6, |
966 | IEEE80211_HW_NOISE_DBM = 1<<7, | 1044 | IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7, |
967 | IEEE80211_HW_SPECTRUM_MGMT = 1<<8, | 1045 | IEEE80211_HW_SPECTRUM_MGMT = 1<<8, |
968 | IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, | 1046 | IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, |
969 | IEEE80211_HW_SUPPORTS_PS = 1<<10, | 1047 | IEEE80211_HW_SUPPORTS_PS = 1<<10, |
@@ -975,6 +1053,8 @@ enum ieee80211_hw_flags { | |||
975 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, | 1053 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, |
976 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | 1054 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, |
977 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | 1055 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, |
1056 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | ||
1057 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, | ||
978 | }; | 1058 | }; |
979 | 1059 | ||
980 | /** | 1060 | /** |
@@ -1198,6 +1278,15 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1198 | * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS | 1278 | * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS |
1199 | * enabled whenever user has enabled powersave. | 1279 | * enabled whenever user has enabled powersave. |
1200 | * | 1280 | * |
1281 | * Some hardware need to toggle a single shared antenna between WLAN and | ||
1282 | * Bluetooth to facilitate co-existence. These types of hardware set | ||
1283 | * limitations on the use of host controlled dynamic powersave whenever there | ||
1284 | * is simultaneous WLAN and Bluetooth traffic. For these types of hardware, the | ||
1285 | * driver may request temporarily going into full power save, in order to | ||
1286 | * enable toggling the antenna between BT and WLAN. If the driver requests | ||
1287 | * disabling dynamic powersave, the @dynamic_ps_timeout value will be | ||
1288 | * temporarily set to zero until the driver re-enables dynamic powersave. | ||
1289 | * | ||
1201 | * Driver informs U-APSD client support by enabling | 1290 | * Driver informs U-APSD client support by enabling |
1202 | * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the | 1291 | * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the |
1203 | * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS | 1292 | * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS |
@@ -1389,7 +1478,7 @@ enum ieee80211_filter_flags { | |||
1389 | * | 1478 | * |
1390 | * Note that drivers MUST be able to deal with a TX aggregation | 1479 | * Note that drivers MUST be able to deal with a TX aggregation |
1391 | * session being stopped even before they OK'ed starting it by | 1480 | * session being stopped even before they OK'ed starting it by |
1392 | * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer | 1481 | * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer |
1393 | * might receive the addBA frame and send a delBA right away! | 1482 | * might receive the addBA frame and send a delBA right away! |
1394 | * | 1483 | * |
1395 | * @IEEE80211_AMPDU_RX_START: start Rx aggregation | 1484 | * @IEEE80211_AMPDU_RX_START: start Rx aggregation |
@@ -1574,7 +1663,9 @@ enum ieee80211_ampdu_mlme_action { | |||
1574 | * is the first frame we expect to perform the action on. Notice | 1663 | * is the first frame we expect to perform the action on. Notice |
1575 | * that TX/RX_STOP can pass NULL for this parameter. | 1664 | * that TX/RX_STOP can pass NULL for this parameter. |
1576 | * Returns a negative error code on failure. | 1665 | * Returns a negative error code on failure. |
1577 | * The callback must be atomic. | 1666 | * The callback can sleep. |
1667 | * | ||
1668 | * @get_survey: Return per-channel survey information | ||
1578 | * | 1669 | * |
1579 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | 1670 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also |
1580 | * need to set wiphy->rfkill_poll to %true before registration, | 1671 | * need to set wiphy->rfkill_poll to %true before registration, |
@@ -1591,6 +1682,11 @@ enum ieee80211_ampdu_mlme_action { | |||
1591 | * @flush: Flush all pending frames from the hardware queue, making sure | 1682 | * @flush: Flush all pending frames from the hardware queue, making sure |
1592 | * that the hardware queues are empty. If the parameter @drop is set | 1683 | * that the hardware queues are empty. If the parameter @drop is set |
1593 | * to %true, pending frames may be dropped. The callback can sleep. | 1684 | * to %true, pending frames may be dropped. The callback can sleep. |
1685 | * | ||
1686 | * @channel_switch: Drivers that need (or want) to offload the channel | ||
1687 | * switch operation for CSAs received from the AP may implement this | ||
1688 | * callback. They must then call ieee80211_chswitch_done() to indicate | ||
1689 | * completion of the channel switch. | ||
1594 | */ | 1690 | */ |
1595 | struct ieee80211_ops { | 1691 | struct ieee80211_ops { |
1596 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1692 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
@@ -1606,7 +1702,7 @@ struct ieee80211_ops { | |||
1606 | struct ieee80211_bss_conf *info, | 1702 | struct ieee80211_bss_conf *info, |
1607 | u32 changed); | 1703 | u32 changed); |
1608 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, | 1704 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, |
1609 | int mc_count, struct dev_addr_list *mc_list); | 1705 | struct netdev_hw_addr_list *mc_list); |
1610 | void (*configure_filter)(struct ieee80211_hw *hw, | 1706 | void (*configure_filter)(struct ieee80211_hw *hw, |
1611 | unsigned int changed_flags, | 1707 | unsigned int changed_flags, |
1612 | unsigned int *total_flags, | 1708 | unsigned int *total_flags, |
@@ -1621,7 +1717,7 @@ struct ieee80211_ops { | |||
1621 | struct ieee80211_key_conf *conf, | 1717 | struct ieee80211_key_conf *conf, |
1622 | struct ieee80211_sta *sta, | 1718 | struct ieee80211_sta *sta, |
1623 | u32 iv32, u16 *phase1key); | 1719 | u32 iv32, u16 *phase1key); |
1624 | int (*hw_scan)(struct ieee80211_hw *hw, | 1720 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1625 | struct cfg80211_scan_request *req); | 1721 | struct cfg80211_scan_request *req); |
1626 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 1722 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
1627 | void (*sw_scan_complete)(struct ieee80211_hw *hw); | 1723 | void (*sw_scan_complete)(struct ieee80211_hw *hw); |
@@ -1646,13 +1742,16 @@ struct ieee80211_ops { | |||
1646 | struct ieee80211_vif *vif, | 1742 | struct ieee80211_vif *vif, |
1647 | enum ieee80211_ampdu_mlme_action action, | 1743 | enum ieee80211_ampdu_mlme_action action, |
1648 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1744 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
1649 | 1745 | int (*get_survey)(struct ieee80211_hw *hw, int idx, | |
1746 | struct survey_info *survey); | ||
1650 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 1747 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
1651 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); | 1748 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); |
1652 | #ifdef CONFIG_NL80211_TESTMODE | 1749 | #ifdef CONFIG_NL80211_TESTMODE |
1653 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); | 1750 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); |
1654 | #endif | 1751 | #endif |
1655 | void (*flush)(struct ieee80211_hw *hw, bool drop); | 1752 | void (*flush)(struct ieee80211_hw *hw, bool drop); |
1753 | void (*channel_switch)(struct ieee80211_hw *hw, | ||
1754 | struct ieee80211_channel_switch *ch_switch); | ||
1656 | }; | 1755 | }; |
1657 | 1756 | ||
1658 | /** | 1757 | /** |
@@ -1802,7 +1901,10 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw); | |||
1802 | * ieee80211_rx - receive frame | 1901 | * ieee80211_rx - receive frame |
1803 | * | 1902 | * |
1804 | * Use this function to hand received frames to mac80211. The receive | 1903 | * Use this function to hand received frames to mac80211. The receive |
1805 | * buffer in @skb must start with an IEEE 802.11 header. | 1904 | * buffer in @skb must start with an IEEE 802.11 header. In case of a |
1905 | * paged @skb is used, the driver is recommended to put the ieee80211 | ||
1906 | * header of the frame on the linear part of the @skb to avoid memory | ||
1907 | * allocation and/or memcpy by the stack. | ||
1806 | * | 1908 | * |
1807 | * This function may not be called in IRQ context. Calls to this function | 1909 | * This function may not be called in IRQ context. Calls to this function |
1808 | * for a single hardware must be synchronized against each other. Calls to | 1910 | * for a single hardware must be synchronized against each other. Calls to |
@@ -2232,25 +2334,14 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, | |||
2232 | int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); | 2334 | int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); |
2233 | 2335 | ||
2234 | /** | 2336 | /** |
2235 | * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. | ||
2236 | * @vif: &struct ieee80211_vif pointer from the add_interface callback | ||
2237 | * @ra: receiver address of the BA session recipient. | ||
2238 | * @tid: the TID to BA on. | ||
2239 | * | ||
2240 | * This function must be called by low level driver once it has | ||
2241 | * finished with preparations for the BA session. | ||
2242 | */ | ||
2243 | void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); | ||
2244 | |||
2245 | /** | ||
2246 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. | 2337 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. |
2247 | * @vif: &struct ieee80211_vif pointer from the add_interface callback | 2338 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
2248 | * @ra: receiver address of the BA session recipient. | 2339 | * @ra: receiver address of the BA session recipient. |
2249 | * @tid: the TID to BA on. | 2340 | * @tid: the TID to BA on. |
2250 | * | 2341 | * |
2251 | * This function must be called by low level driver once it has | 2342 | * This function must be called by low level driver once it has |
2252 | * finished with preparations for the BA session. | 2343 | * finished with preparations for the BA session. It can be called |
2253 | * This version of the function is IRQ-safe. | 2344 | * from any context. |
2254 | */ | 2345 | */ |
2255 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, | 2346 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
2256 | u16 tid); | 2347 | u16 tid); |
@@ -2259,27 +2350,14 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, | |||
2259 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. | 2350 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. |
2260 | * @sta: the station whose BA session to stop | 2351 | * @sta: the station whose BA session to stop |
2261 | * @tid: the TID to stop BA. | 2352 | * @tid: the TID to stop BA. |
2262 | * @initiator: if indicates initiator DELBA frame will be sent. | ||
2263 | * | 2353 | * |
2264 | * Return: error if no sta with matching da found, success otherwise | 2354 | * Return: negative error if the TID is invalid, or no aggregation active |
2265 | * | 2355 | * |
2266 | * Although mac80211/low level driver/user space application can estimate | 2356 | * Although mac80211/low level driver/user space application can estimate |
2267 | * the need to stop aggregation on a certain RA/TID, the session level | 2357 | * the need to stop aggregation on a certain RA/TID, the session level |
2268 | * will be managed by the mac80211. | 2358 | * will be managed by the mac80211. |
2269 | */ | 2359 | */ |
2270 | int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid, | 2360 | int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid); |
2271 | enum ieee80211_back_parties initiator); | ||
2272 | |||
2273 | /** | ||
2274 | * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. | ||
2275 | * @vif: &struct ieee80211_vif pointer from the add_interface callback | ||
2276 | * @ra: receiver address of the BA session recipient. | ||
2277 | * @tid: the desired TID to BA on. | ||
2278 | * | ||
2279 | * This function must be called by low level driver once it has | ||
2280 | * finished with preparations for the BA session tear down. | ||
2281 | */ | ||
2282 | void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); | ||
2283 | 2361 | ||
2284 | /** | 2362 | /** |
2285 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. | 2363 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. |
@@ -2288,8 +2366,8 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); | |||
2288 | * @tid: the desired TID to BA on. | 2366 | * @tid: the desired TID to BA on. |
2289 | * | 2367 | * |
2290 | * This function must be called by low level driver once it has | 2368 | * This function must be called by low level driver once it has |
2291 | * finished with preparations for the BA session tear down. | 2369 | * finished with preparations for the BA session tear down. It |
2292 | * This version of the function is IRQ-safe. | 2370 | * can be called from any context. |
2293 | */ | 2371 | */ |
2294 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, | 2372 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
2295 | u16 tid); | 2373 | u16 tid); |
@@ -2364,12 +2442,82 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
2364 | * | 2442 | * |
2365 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2443 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2366 | * | 2444 | * |
2367 | * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and | 2445 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and |
2368 | * IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 2446 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
2369 | * hardware is not receiving beacons with this function. | 2447 | * hardware is not receiving beacons with this function. |
2370 | */ | 2448 | */ |
2371 | void ieee80211_beacon_loss(struct ieee80211_vif *vif); | 2449 | void ieee80211_beacon_loss(struct ieee80211_vif *vif); |
2372 | 2450 | ||
2451 | /** | ||
2452 | * ieee80211_connection_loss - inform hardware has lost connection to the AP | ||
2453 | * | ||
2454 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2455 | * | ||
2456 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and | ||
2457 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver | ||
2458 | * needs to inform if the connection to the AP has been lost. | ||
2459 | * | ||
2460 | * This function will cause immediate change to disassociated state, | ||
2461 | * without connection recovery attempts. | ||
2462 | */ | ||
2463 | void ieee80211_connection_loss(struct ieee80211_vif *vif); | ||
2464 | |||
2465 | /** | ||
2466 | * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm | ||
2467 | * | ||
2468 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2469 | * | ||
2470 | * Some hardware require full power save to manage simultaneous BT traffic | ||
2471 | * on the WLAN frequency. Full PSM is required periodically, whenever there are | ||
2472 | * burst of BT traffic. The hardware gets information of BT traffic via | ||
2473 | * hardware co-existence lines, and consequentially requests mac80211 to | ||
2474 | * (temporarily) enter full psm. | ||
2475 | * This function will only temporarily disable dynamic PS, not enable PSM if | ||
2476 | * it was not already enabled. | ||
2477 | * The driver must make sure to re-enable dynamic PS using | ||
2478 | * ieee80211_enable_dyn_ps() if the driver has disabled it. | ||
2479 | * | ||
2480 | */ | ||
2481 | void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif); | ||
2482 | |||
2483 | /** | ||
2484 | * ieee80211_enable_dyn_ps - restore dynamic psm after being disabled | ||
2485 | * | ||
2486 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2487 | * | ||
2488 | * This function restores dynamic PS after being temporarily disabled via | ||
2489 | * ieee80211_disable_dyn_ps(). Each ieee80211_disable_dyn_ps() call must | ||
2490 | * be coupled with an eventual call to this function. | ||
2491 | * | ||
2492 | */ | ||
2493 | void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif); | ||
2494 | |||
2495 | /** | ||
2496 | * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring | ||
2497 | * rssi threshold triggered | ||
2498 | * | ||
2499 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2500 | * @rssi_event: the RSSI trigger event type | ||
2501 | * @gfp: context flags | ||
2502 | * | ||
2503 | * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality | ||
2504 | * monitoring is configured with an rssi threshold, the driver will inform | ||
2505 | * whenever the rssi level reaches the threshold. | ||
2506 | */ | ||
2507 | void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | ||
2508 | enum nl80211_cqm_rssi_threshold_event rssi_event, | ||
2509 | gfp_t gfp); | ||
2510 | |||
2511 | /** | ||
2512 | * ieee80211_chswitch_done - Complete channel switch process | ||
2513 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2514 | * @success: make the channel switch successful or not | ||
2515 | * | ||
2516 | * Complete the channel switch post-process: set the new operational channel | ||
2517 | * and wake up the suspended queues. | ||
2518 | */ | ||
2519 | void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); | ||
2520 | |||
2373 | /* Rate control API */ | 2521 | /* Rate control API */ |
2374 | 2522 | ||
2375 | /** | 2523 | /** |
diff --git a/include/net/mip6.h b/include/net/mip6.h index a83ad1982a90..26ba99b5a4b1 100644 --- a/include/net/mip6.h +++ b/include/net/mip6.h | |||
@@ -39,7 +39,7 @@ struct ip6_mh { | |||
39 | __u16 ip6mh_cksum; | 39 | __u16 ip6mh_cksum; |
40 | /* Followed by type specific messages */ | 40 | /* Followed by type specific messages */ |
41 | __u8 data[0]; | 41 | __u8 data[0]; |
42 | } __attribute__ ((__packed__)); | 42 | } __packed; |
43 | 43 | ||
44 | #define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ | 44 | #define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ |
45 | #define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ | 45 | #define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ |
diff --git a/include/net/mld.h b/include/net/mld.h new file mode 100644 index 000000000000..467143cd4e2f --- /dev/null +++ b/include/net/mld.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef LINUX_MLD_H | ||
2 | #define LINUX_MLD_H | ||
3 | |||
4 | #include <linux/in6.h> | ||
5 | #include <linux/icmpv6.h> | ||
6 | |||
7 | /* MLDv1 Query/Report/Done */ | ||
8 | struct mld_msg { | ||
9 | struct icmp6hdr mld_hdr; | ||
10 | struct in6_addr mld_mca; | ||
11 | }; | ||
12 | |||
13 | #define mld_type mld_hdr.icmp6_type | ||
14 | #define mld_code mld_hdr.icmp6_code | ||
15 | #define mld_cksum mld_hdr.icmp6_cksum | ||
16 | #define mld_maxdelay mld_hdr.icmp6_maxdelay | ||
17 | #define mld_reserved mld_hdr.icmp6_dataun.un_data16[1] | ||
18 | |||
19 | /* Multicast Listener Discovery version 2 headers */ | ||
20 | /* MLDv2 Report */ | ||
21 | struct mld2_grec { | ||
22 | __u8 grec_type; | ||
23 | __u8 grec_auxwords; | ||
24 | __be16 grec_nsrcs; | ||
25 | struct in6_addr grec_mca; | ||
26 | struct in6_addr grec_src[0]; | ||
27 | }; | ||
28 | |||
29 | struct mld2_report { | ||
30 | struct icmp6hdr mld2r_hdr; | ||
31 | struct mld2_grec mld2r_grec[0]; | ||
32 | }; | ||
33 | |||
34 | #define mld2r_type mld2r_hdr.icmp6_type | ||
35 | #define mld2r_resv1 mld2r_hdr.icmp6_code | ||
36 | #define mld2r_cksum mld2r_hdr.icmp6_cksum | ||
37 | #define mld2r_resv2 mld2r_hdr.icmp6_dataun.un_data16[0] | ||
38 | #define mld2r_ngrec mld2r_hdr.icmp6_dataun.un_data16[1] | ||
39 | |||
40 | /* MLDv2 Query */ | ||
41 | struct mld2_query { | ||
42 | struct icmp6hdr mld2q_hdr; | ||
43 | struct in6_addr mld2q_mca; | ||
44 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
45 | __u8 mld2q_qrv:3, | ||
46 | mld2q_suppress:1, | ||
47 | mld2q_resv2:4; | ||
48 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
49 | __u8 mld2q_resv2:4, | ||
50 | mld2q_suppress:1, | ||
51 | mld2q_qrv:3; | ||
52 | #else | ||
53 | #error "Please fix <asm/byteorder.h>" | ||
54 | #endif | ||
55 | __u8 mld2q_qqic; | ||
56 | __be16 mld2q_nsrcs; | ||
57 | struct in6_addr mld2q_srcs[0]; | ||
58 | }; | ||
59 | |||
60 | #define mld2q_type mld2q_hdr.icmp6_type | ||
61 | #define mld2q_code mld2q_hdr.icmp6_code | ||
62 | #define mld2q_cksum mld2q_hdr.icmp6_cksum | ||
63 | #define mld2q_mrc mld2q_hdr.icmp6_maxdelay | ||
64 | #define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1] | ||
65 | |||
66 | /* Max Response Code */ | ||
67 | #define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) | ||
68 | #define MLDV2_EXP(thresh, nbmant, nbexp, value) \ | ||
69 | ((value) < (thresh) ? (value) : \ | ||
70 | ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \ | ||
71 | (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp)))) | ||
72 | |||
73 | #define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value) | ||
74 | |||
75 | #endif | ||
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index f76f22d05721..895997bc2ead 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -82,7 +82,7 @@ struct ra_msg { | |||
82 | struct nd_opt_hdr { | 82 | struct nd_opt_hdr { |
83 | __u8 nd_opt_type; | 83 | __u8 nd_opt_type; |
84 | __u8 nd_opt_len; | 84 | __u8 nd_opt_len; |
85 | } __attribute__((__packed__)); | 85 | } __packed; |
86 | 86 | ||
87 | 87 | ||
88 | extern int ndisc_init(void); | 88 | extern int ndisc_init(void); |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index da1d58be31b7..242879b6c4df 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -151,7 +151,7 @@ struct neigh_table { | |||
151 | void (*proxy_redo)(struct sk_buff *skb); | 151 | void (*proxy_redo)(struct sk_buff *skb); |
152 | char *id; | 152 | char *id; |
153 | struct neigh_parms parms; | 153 | struct neigh_parms parms; |
154 | /* HACK. gc_* shoul follow parms without a gap! */ | 154 | /* HACK. gc_* should follow parms without a gap! */ |
155 | int gc_interval; | 155 | int gc_interval; |
156 | int gc_thresh1; | 156 | int gc_thresh1; |
157 | int gc_thresh2; | 157 | int gc_thresh2; |
@@ -299,6 +299,20 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | |||
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
302 | #ifdef CONFIG_BRIDGE_NETFILTER | ||
303 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) | ||
304 | { | ||
305 | unsigned seq, hh_alen; | ||
306 | |||
307 | do { | ||
308 | seq = read_seqbegin(&hh->hh_lock); | ||
309 | hh_alen = HH_DATA_ALIGN(ETH_HLEN); | ||
310 | memcpy(skb->data - hh_alen, hh->hh_data, ETH_ALEN + hh_alen - ETH_HLEN); | ||
311 | } while (read_seqretry(&hh->hh_lock, seq)); | ||
312 | return 0; | ||
313 | } | ||
314 | #endif | ||
315 | |||
302 | static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) | 316 | static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) |
303 | { | 317 | { |
304 | unsigned seq; | 318 | unsigned seq; |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index bde095f7e845..e624dae54fa4 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -152,11 +152,7 @@ extern struct net init_net; | |||
152 | 152 | ||
153 | static inline struct net *nf_ct_net(const struct nf_conn *ct) | 153 | static inline struct net *nf_ct_net(const struct nf_conn *ct) |
154 | { | 154 | { |
155 | #ifdef CONFIG_NET_NS | 155 | return read_pnet(&ct->ct_net); |
156 | return ct->ct_net; | ||
157 | #else | ||
158 | return &init_net; | ||
159 | #endif | ||
160 | } | 156 | } |
161 | 157 | ||
162 | /* Alter reply tuple (maybe alter helper). */ | 158 | /* Alter reply tuple (maybe alter helper). */ |
@@ -261,7 +257,12 @@ extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct, | |||
261 | u32 seq); | 257 | u32 seq); |
262 | 258 | ||
263 | /* Fake conntrack entry for untracked connections */ | 259 | /* Fake conntrack entry for untracked connections */ |
264 | extern struct nf_conn nf_conntrack_untracked; | 260 | DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked); |
261 | static inline struct nf_conn *nf_ct_untracked_get(void) | ||
262 | { | ||
263 | return &__raw_get_cpu_var(nf_conntrack_untracked); | ||
264 | } | ||
265 | extern void nf_ct_untracked_status_or(unsigned long bits); | ||
265 | 266 | ||
266 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | 267 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ |
267 | extern void | 268 | extern void |
@@ -289,9 +290,9 @@ static inline int nf_ct_is_dying(struct nf_conn *ct) | |||
289 | return test_bit(IPS_DYING_BIT, &ct->status); | 290 | return test_bit(IPS_DYING_BIT, &ct->status); |
290 | } | 291 | } |
291 | 292 | ||
292 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | 293 | static inline int nf_ct_is_untracked(const struct nf_conn *ct) |
293 | { | 294 | { |
294 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | 295 | return test_bit(IPS_UNTRACKED_BIT, &ct->status); |
295 | } | 296 | } |
296 | 297 | ||
297 | extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); | 298 | extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); |
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h index 03e218f0be43..4e9c63a20db2 100644 --- a/include/net/netfilter/nf_conntrack_acct.h +++ b/include/net/netfilter/nf_conntrack_acct.h | |||
@@ -45,6 +45,18 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) | |||
45 | extern unsigned int | 45 | extern unsigned int |
46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); | 46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); |
47 | 47 | ||
48 | /* Check if connection tracking accounting is enabled */ | ||
49 | static inline bool nf_ct_acct_enabled(struct net *net) | ||
50 | { | ||
51 | return net->ct.sysctl_acct != 0; | ||
52 | } | ||
53 | |||
54 | /* Enable/disable connection tracking accounting */ | ||
55 | static inline void nf_ct_set_acct(struct net *net, bool enable) | ||
56 | { | ||
57 | net->ct.sysctl_acct = enable; | ||
58 | } | ||
59 | |||
48 | extern int nf_conntrack_acct_init(struct net *net); | 60 | extern int nf_conntrack_acct_init(struct net *net); |
49 | extern void nf_conntrack_acct_fini(struct net *net); | 61 | extern void nf_conntrack_acct_fini(struct net *net); |
50 | 62 | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index dffde8e6920e..aced085132e7 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -60,8 +60,8 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
60 | struct nf_conn *ct = (struct nf_conn *)skb->nfct; | 60 | struct nf_conn *ct = (struct nf_conn *)skb->nfct; |
61 | int ret = NF_ACCEPT; | 61 | int ret = NF_ACCEPT; |
62 | 62 | ||
63 | if (ct && ct != &nf_conntrack_untracked) { | 63 | if (ct && !nf_ct_is_untracked(ct)) { |
64 | if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) | 64 | if (!nf_ct_is_confirmed(ct)) |
65 | ret = __nf_conntrack_confirm(skb); | 65 | ret = __nf_conntrack_confirm(skb); |
66 | if (likely(ret == NF_ACCEPT)) | 66 | if (likely(ret == NF_ACCEPT)) |
67 | nf_ct_deliver_cached_events(ct); | 67 | nf_ct_deliver_cached_events(ct); |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 32d15bd6efa3..0772d296dfdb 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -28,9 +28,14 @@ struct nf_ct_ext { | |||
28 | char data[0]; | 28 | char data[0]; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static inline int nf_ct_ext_exist(const struct nf_conn *ct, u8 id) | 31 | static inline bool __nf_ct_ext_exist(const struct nf_ct_ext *ext, u8 id) |
32 | { | 32 | { |
33 | return (ct->ext && ct->ext->offset[id]); | 33 | return !!ext->offset[id]; |
34 | } | ||
35 | |||
36 | static inline bool nf_ct_ext_exist(const struct nf_conn *ct, u8 id) | ||
37 | { | ||
38 | return (ct->ext && __nf_ct_ext_exist(ct->ext, id)); | ||
34 | } | 39 | } |
35 | 40 | ||
36 | static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id) | 41 | static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id) |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index c398017ccfa3..df17bac46bf5 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
@@ -27,9 +27,9 @@ struct nf_nat_protocol { | |||
27 | 27 | ||
28 | /* Alter the per-proto part of the tuple (depending on | 28 | /* Alter the per-proto part of the tuple (depending on |
29 | maniptype), to give a unique tuple in the given range if | 29 | maniptype), to give a unique tuple in the given range if |
30 | possible; return false if not. Per-protocol part of tuple | 30 | possible. Per-protocol part of tuple is initialized to the |
31 | is initialized to the incoming packet. */ | 31 | incoming packet. */ |
32 | bool (*unique_tuple)(struct nf_conntrack_tuple *tuple, | 32 | void (*unique_tuple)(struct nf_conntrack_tuple *tuple, |
33 | const struct nf_nat_range *range, | 33 | const struct nf_nat_range *range, |
34 | enum nf_nat_manip_type maniptype, | 34 | enum nf_nat_manip_type maniptype, |
35 | const struct nf_conn *ct); | 35 | const struct nf_conn *ct); |
@@ -63,7 +63,7 @@ extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, | |||
63 | const union nf_conntrack_man_proto *min, | 63 | const union nf_conntrack_man_proto *min, |
64 | const union nf_conntrack_man_proto *max); | 64 | const union nf_conntrack_man_proto *max); |
65 | 65 | ||
66 | extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, | 66 | extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, |
67 | const struct nf_nat_range *range, | 67 | const struct nf_nat_range *range, |
68 | enum nf_nat_manip_type maniptype, | 68 | enum nf_nat_manip_type maniptype, |
69 | const struct nf_conn *ct, | 69 | const struct nf_conn *ct, |
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h index e4a18ae361c6..2890bdc4cd92 100644 --- a/include/net/netfilter/nf_nat_rule.h +++ b/include/net/netfilter/nf_nat_rule.h | |||
@@ -12,6 +12,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb, | |||
12 | const struct net_device *out, | 12 | const struct net_device *out, |
13 | struct nf_conn *ct); | 13 | struct nf_conn *ct); |
14 | 14 | ||
15 | extern unsigned int | ||
16 | alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); | ||
17 | #endif /* _NF_NAT_RULE_H */ | 15 | #endif /* _NF_NAT_RULE_H */ |
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h index b0569ff0775e..e2dec42c2db2 100644 --- a/include/net/netfilter/nfnetlink_log.h +++ b/include/net/netfilter/nfnetlink_log.h | |||
@@ -10,5 +10,7 @@ nfulnl_log_packet(u_int8_t pf, | |||
10 | const struct nf_loginfo *li_user, | 10 | const struct nf_loginfo *li_user, |
11 | const char *prefix); | 11 | const char *prefix); |
12 | 12 | ||
13 | #define NFULNL_COPY_DISABLED 0xff | ||
14 | |||
13 | #endif /* _KER_NFNETLINK_LOG_H */ | 15 | #endif /* _KER_NFNETLINK_LOG_H */ |
14 | 16 | ||
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h index ddbf37e19616..5a2978d1cb22 100644 --- a/include/net/netfilter/xt_rateest.h +++ b/include/net/netfilter/xt_rateest.h | |||
@@ -2,13 +2,18 @@ | |||
2 | #define _XT_RATEEST_H | 2 | #define _XT_RATEEST_H |
3 | 3 | ||
4 | struct xt_rateest { | 4 | struct xt_rateest { |
5 | /* keep lock and bstats on same cache line to speedup xt_rateest_tg() */ | ||
6 | struct gnet_stats_basic_packed bstats; | ||
7 | spinlock_t lock; | ||
8 | /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */ | ||
9 | struct gnet_stats_rate_est rstats; | ||
10 | |||
11 | /* following fields not accessed in hot path */ | ||
5 | struct hlist_node list; | 12 | struct hlist_node list; |
6 | char name[IFNAMSIZ]; | 13 | char name[IFNAMSIZ]; |
7 | unsigned int refcnt; | 14 | unsigned int refcnt; |
8 | spinlock_t lock; | ||
9 | struct gnet_estimator params; | 15 | struct gnet_estimator params; |
10 | struct gnet_stats_rate_est rstats; | 16 | struct rcu_head rcu; |
11 | struct gnet_stats_basic_packed bstats; | ||
12 | }; | 17 | }; |
13 | 18 | ||
14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); | 19 | extern struct xt_rateest *xt_rateest_lookup(const char *name); |
diff --git a/include/net/netlink.h b/include/net/netlink.h index 4fc05b58503e..f3b201d335b3 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -35,7 +35,7 @@ | |||
35 | * nlmsg_new() create a new netlink message | 35 | * nlmsg_new() create a new netlink message |
36 | * nlmsg_put() add a netlink message to an skb | 36 | * nlmsg_put() add a netlink message to an skb |
37 | * nlmsg_put_answer() callback based nlmsg_put() | 37 | * nlmsg_put_answer() callback based nlmsg_put() |
38 | * nlmsg_end() finanlize netlink message | 38 | * nlmsg_end() finalize netlink message |
39 | * nlmsg_get_pos() return current position in message | 39 | * nlmsg_get_pos() return current position in message |
40 | * nlmsg_trim() trim part of message | 40 | * nlmsg_trim() trim part of message |
41 | * nlmsg_cancel() cancel message construction | 41 | * nlmsg_cancel() cancel message construction |
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index ff4982ab84b6..81a31c0db3e7 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h | |||
@@ -14,11 +14,8 @@ | |||
14 | * The rules are simple: | 14 | * The rules are simple: |
15 | * 1. set pernet_operations->id. After register_pernet_device you | 15 | * 1. set pernet_operations->id. After register_pernet_device you |
16 | * will have the id of your private pointer. | 16 | * will have the id of your private pointer. |
17 | * 2. Either set pernet_operations->size (to have the code allocate and | 17 | * 2. set pernet_operations->size to have the code allocate and free |
18 | * free a private structure pointed to from struct net ) or | 18 | * a private structure pointed to from struct net. |
19 | * call net_assign_generic() to put the private data on the struct | ||
20 | * net (most preferably this should be done in the ->init callback | ||
21 | * of the ops registered); | ||
22 | * 3. do not change this pointer while the net is alive; | 19 | * 3. do not change this pointer while the net is alive; |
23 | * 4. do not try to have any private reference on the net_generic object. | 20 | * 4. do not try to have any private reference on the net_generic object. |
24 | * | 21 | * |
@@ -46,6 +43,4 @@ static inline void *net_generic(struct net *net, int id) | |||
46 | 43 | ||
47 | return ptr; | 44 | return ptr; |
48 | } | 45 | } |
49 | |||
50 | extern int net_assign_generic(struct net *net, int id, void *data); | ||
51 | #endif | 46 | #endif |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2764994c9136..d68c3f121774 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -55,19 +55,14 @@ struct netns_ipv4 { | |||
55 | int sysctl_rt_cache_rebuild_count; | 55 | int sysctl_rt_cache_rebuild_count; |
56 | int current_rt_cache_rebuild_count; | 56 | int current_rt_cache_rebuild_count; |
57 | 57 | ||
58 | struct timer_list rt_secret_timer; | ||
59 | atomic_t rt_genid; | 58 | atomic_t rt_genid; |
60 | 59 | ||
61 | #ifdef CONFIG_IP_MROUTE | 60 | #ifdef CONFIG_IP_MROUTE |
62 | struct sock *mroute_sk; | 61 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES |
63 | struct mfc_cache **mfc_cache_array; | 62 | struct mr_table *mrt; |
64 | struct vif_device *vif_table; | 63 | #else |
65 | int maxvif; | 64 | struct list_head mr_tables; |
66 | atomic_t cache_resolve_queue_len; | 65 | struct fib_rules_ops *mr_rules_ops; |
67 | int mroute_do_assert; | ||
68 | int mroute_do_pim; | ||
69 | #if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2) | ||
70 | int mroute_reg_vif_num; | ||
71 | #endif | 66 | #endif |
72 | #endif | 67 | #endif |
73 | }; | 68 | }; |
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 1f11ebc22151..81abfcb2eb4e 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
@@ -59,15 +59,11 @@ struct netns_ipv6 { | |||
59 | struct sock *tcp_sk; | 59 | struct sock *tcp_sk; |
60 | struct sock *igmp_sk; | 60 | struct sock *igmp_sk; |
61 | #ifdef CONFIG_IPV6_MROUTE | 61 | #ifdef CONFIG_IPV6_MROUTE |
62 | struct sock *mroute6_sk; | 62 | #ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES |
63 | struct mfc6_cache **mfc6_cache_array; | 63 | struct mr6_table *mrt6; |
64 | struct mif_device *vif6_table; | 64 | #else |
65 | int maxvif; | 65 | struct list_head mr6_tables; |
66 | atomic_t cache_resolve_queue_len; | 66 | struct fib_rules_ops *mr6_rules_ops; |
67 | int mroute_do_assert; | ||
68 | int mroute_do_pim; | ||
69 | #ifdef CONFIG_IPV6_PIMSM_V2 | ||
70 | int mroute_reg_vif_num; | ||
71 | #endif | 67 | #endif |
72 | #endif | 68 | #endif |
73 | }; | 69 | }; |
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index d7b989ca3d63..2d16783d5e20 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
@@ -34,6 +34,7 @@ struct phonet_device { | |||
34 | struct list_head list; | 34 | struct list_head list; |
35 | struct net_device *netdev; | 35 | struct net_device *netdev; |
36 | DECLARE_BITMAP(addrs, 64); | 36 | DECLARE_BITMAP(addrs, 64); |
37 | struct rcu_head rcu; | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | int phonet_device_init(void); | 40 | int phonet_device_init(void); |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index b6cdc33b39c1..d9549af6929a 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -12,7 +12,7 @@ struct qdisc_walker { | |||
12 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); | 12 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #define QDISC_ALIGNTO 32 | 15 | #define QDISC_ALIGNTO 64 |
16 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) | 16 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) |
17 | 17 | ||
18 | static inline void *qdisc_priv(struct Qdisc *q) | 18 | static inline void *qdisc_priv(struct Qdisc *q) |
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q); | |||
95 | 95 | ||
96 | static inline void qdisc_run(struct Qdisc *q) | 96 | static inline void qdisc_run(struct Qdisc *q) |
97 | { | 97 | { |
98 | if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) | 98 | if (qdisc_run_begin(q)) |
99 | __qdisc_run(q); | 99 | __qdisc_run(q); |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/include/net/raw.h b/include/net/raw.h index 6c14a656357a..43c57502659b 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | 20 | ||
21 | #include <net/protocol.h> | 21 | #include <net/protocol.h> |
22 | #include <linux/icmp.h> | ||
22 | 23 | ||
23 | extern struct proto raw_prot; | 24 | extern struct proto raw_prot; |
24 | 25 | ||
@@ -56,4 +57,16 @@ int raw_seq_open(struct inode *ino, struct file *file, | |||
56 | void raw_hash_sk(struct sock *sk); | 57 | void raw_hash_sk(struct sock *sk); |
57 | void raw_unhash_sk(struct sock *sk); | 58 | void raw_unhash_sk(struct sock *sk); |
58 | 59 | ||
60 | struct raw_sock { | ||
61 | /* inet_sock has to be the first member */ | ||
62 | struct inet_sock inet; | ||
63 | struct icmp_filter filter; | ||
64 | u32 ipmr_table; | ||
65 | }; | ||
66 | |||
67 | static inline struct raw_sock *raw_sk(const struct sock *sk) | ||
68 | { | ||
69 | return (struct raw_sock *)sk; | ||
70 | } | ||
71 | |||
59 | #endif /* _RAW_H */ | 72 | #endif /* _RAW_H */ |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index f873ee37f7e4..9e103a4e91ee 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -54,7 +54,6 @@ struct regulatory_request { | |||
54 | enum nl80211_reg_initiator initiator; | 54 | enum nl80211_reg_initiator initiator; |
55 | char alpha2[2]; | 55 | char alpha2[2]; |
56 | bool intersect; | 56 | bool intersect; |
57 | u32 country_ie_checksum; | ||
58 | enum environment_cap country_ie_env; | 57 | enum environment_cap country_ie_env; |
59 | struct list_head list; | 58 | struct list_head list; |
60 | }; | 59 | }; |
diff --git a/include/net/route.h b/include/net/route.h index 2c9fba7f7731..7e5e73bfa4de 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -50,9 +50,7 @@ | |||
50 | struct fib_nh; | 50 | struct fib_nh; |
51 | struct inet_peer; | 51 | struct inet_peer; |
52 | struct rtable { | 52 | struct rtable { |
53 | union { | 53 | struct dst_entry dst; |
54 | struct dst_entry dst; | ||
55 | } u; | ||
56 | 54 | ||
57 | /* Cache lookup keys */ | 55 | /* Cache lookup keys */ |
58 | struct flowi fl; | 56 | struct flowi fl; |
@@ -112,7 +110,22 @@ extern void rt_cache_flush_batch(void); | |||
112 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); | 110 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); |
113 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); | 111 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); |
114 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 112 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
115 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); | 113 | |
114 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | ||
115 | u8 tos, struct net_device *devin, bool noref); | ||
116 | |||
117 | static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, | ||
118 | u8 tos, struct net_device *devin) | ||
119 | { | ||
120 | return ip_route_input_common(skb, dst, src, tos, devin, false); | ||
121 | } | ||
122 | |||
123 | static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, | ||
124 | u8 tos, struct net_device *devin) | ||
125 | { | ||
126 | return ip_route_input_common(skb, dst, src, tos, devin, true); | ||
127 | } | ||
128 | |||
116 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); | 129 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); |
117 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 130 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
118 | 131 | ||
@@ -129,7 +142,7 @@ extern void fib_add_ifaddr(struct in_ifaddr *); | |||
129 | static inline void ip_rt_put(struct rtable * rt) | 142 | static inline void ip_rt_put(struct rtable * rt) |
130 | { | 143 | { |
131 | if (rt) | 144 | if (rt) |
132 | dst_release(&rt->u.dst); | 145 | dst_release(&rt->dst); |
133 | } | 146 | } |
134 | 147 | ||
135 | #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) | 148 | #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) |
@@ -186,6 +199,8 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
186 | fl.fl_ip_sport = sport; | 199 | fl.fl_ip_sport = sport; |
187 | fl.fl_ip_dport = dport; | 200 | fl.fl_ip_dport = dport; |
188 | fl.proto = protocol; | 201 | fl.proto = protocol; |
202 | if (inet_sk(sk)->transparent) | ||
203 | fl.flags |= FLOWI_FLAG_ANYSRC; | ||
189 | ip_rt_put(*rp); | 204 | ip_rt_put(*rp); |
190 | *rp = NULL; | 205 | *rp = NULL; |
191 | security_sk_classify_flow(sk, &fl); | 206 | security_sk_classify_flow(sk, &fl); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 67dc08eaaa45..3c8728aaab4e 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -23,11 +23,17 @@ struct qdisc_rate_table { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | enum qdisc_state_t { | 25 | enum qdisc_state_t { |
26 | __QDISC_STATE_RUNNING, | ||
27 | __QDISC_STATE_SCHED, | 26 | __QDISC_STATE_SCHED, |
28 | __QDISC_STATE_DEACTIVATED, | 27 | __QDISC_STATE_DEACTIVATED, |
29 | }; | 28 | }; |
30 | 29 | ||
30 | /* | ||
31 | * following bits are only changed while qdisc lock is held | ||
32 | */ | ||
33 | enum qdisc___state_t { | ||
34 | __QDISC___STATE_RUNNING, | ||
35 | }; | ||
36 | |||
31 | struct qdisc_size_table { | 37 | struct qdisc_size_table { |
32 | struct list_head list; | 38 | struct list_head list; |
33 | struct tc_sizespec szopts; | 39 | struct tc_sizespec szopts; |
@@ -72,9 +78,27 @@ struct Qdisc { | |||
72 | unsigned long state; | 78 | unsigned long state; |
73 | struct sk_buff_head q; | 79 | struct sk_buff_head q; |
74 | struct gnet_stats_basic_packed bstats; | 80 | struct gnet_stats_basic_packed bstats; |
81 | unsigned long __state; | ||
75 | struct gnet_stats_queue qstats; | 82 | struct gnet_stats_queue qstats; |
83 | struct rcu_head rcu_head; | ||
84 | spinlock_t busylock; | ||
76 | }; | 85 | }; |
77 | 86 | ||
87 | static inline bool qdisc_is_running(struct Qdisc *qdisc) | ||
88 | { | ||
89 | return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | ||
90 | } | ||
91 | |||
92 | static inline bool qdisc_run_begin(struct Qdisc *qdisc) | ||
93 | { | ||
94 | return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | ||
95 | } | ||
96 | |||
97 | static inline void qdisc_run_end(struct Qdisc *qdisc) | ||
98 | { | ||
99 | __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state); | ||
100 | } | ||
101 | |||
78 | struct Qdisc_class_ops { | 102 | struct Qdisc_class_ops { |
79 | /* Child qdisc manipulation */ | 103 | /* Child qdisc manipulation */ |
80 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); | 104 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); |
@@ -312,12 +336,24 @@ extern void qdisc_calculate_pkt_len(struct sk_buff *skb, | |||
312 | extern void tcf_destroy(struct tcf_proto *tp); | 336 | extern void tcf_destroy(struct tcf_proto *tp); |
313 | extern void tcf_destroy_chain(struct tcf_proto **fl); | 337 | extern void tcf_destroy_chain(struct tcf_proto **fl); |
314 | 338 | ||
315 | /* Reset all TX qdiscs of a device. */ | 339 | /* Reset all TX qdiscs greater then index of a device. */ |
340 | static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i) | ||
341 | { | ||
342 | struct Qdisc *qdisc; | ||
343 | |||
344 | for (; i < dev->num_tx_queues; i++) { | ||
345 | qdisc = netdev_get_tx_queue(dev, i)->qdisc; | ||
346 | if (qdisc) { | ||
347 | spin_lock_bh(qdisc_lock(qdisc)); | ||
348 | qdisc_reset(qdisc); | ||
349 | spin_unlock_bh(qdisc_lock(qdisc)); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | |||
316 | static inline void qdisc_reset_all_tx(struct net_device *dev) | 354 | static inline void qdisc_reset_all_tx(struct net_device *dev) |
317 | { | 355 | { |
318 | unsigned int i; | 356 | qdisc_reset_all_tx_gt(dev, 0); |
319 | for (i = 0; i < dev->num_tx_queues; i++) | ||
320 | qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc); | ||
321 | } | 357 | } |
322 | 358 | ||
323 | /* Are all TX queues of the device empty? */ | 359 | /* Are all TX queues of the device empty? */ |
@@ -570,9 +606,16 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) | |||
570 | } | 606 | } |
571 | 607 | ||
572 | #ifdef CONFIG_NET_CLS_ACT | 608 | #ifdef CONFIG_NET_CLS_ACT |
573 | static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) | 609 | static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask, |
610 | int action) | ||
574 | { | 611 | { |
575 | struct sk_buff *n = skb_clone(skb, gfp_mask); | 612 | struct sk_buff *n; |
613 | |||
614 | if ((action == TC_ACT_STOLEN || action == TC_ACT_QUEUED) && | ||
615 | !skb_shared(skb)) | ||
616 | n = skb_get(skb); | ||
617 | else | ||
618 | n = skb_clone(skb, gfp_mask); | ||
576 | 619 | ||
577 | if (n) { | 620 | if (n) { |
578 | n->tc_verd = SET_TC_VERD(n->tc_verd, 0); | 621 | n->tc_verd = SET_TC_VERD(n->tc_verd, 0); |
diff --git a/include/net/scm.h b/include/net/scm.h index 8360e47aa7e3..31656506d967 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
@@ -19,8 +19,10 @@ struct scm_fp_list { | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct scm_cookie { | 21 | struct scm_cookie { |
22 | struct ucred creds; /* Skb credentials */ | 22 | struct pid *pid; /* Skb credentials */ |
23 | const struct cred *cred; | ||
23 | struct scm_fp_list *fp; /* Passed files */ | 24 | struct scm_fp_list *fp; /* Passed files */ |
25 | struct ucred creds; /* Skb credentials */ | ||
24 | #ifdef CONFIG_SECURITY_NETWORK | 26 | #ifdef CONFIG_SECURITY_NETWORK |
25 | u32 secid; /* Passed security ID */ | 27 | u32 secid; /* Passed security ID */ |
26 | #endif | 28 | #endif |
@@ -42,8 +44,27 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co | |||
42 | { } | 44 | { } |
43 | #endif /* CONFIG_SECURITY_NETWORK */ | 45 | #endif /* CONFIG_SECURITY_NETWORK */ |
44 | 46 | ||
47 | static __inline__ void scm_set_cred(struct scm_cookie *scm, | ||
48 | struct pid *pid, const struct cred *cred) | ||
49 | { | ||
50 | scm->pid = get_pid(pid); | ||
51 | scm->cred = get_cred(cred); | ||
52 | cred_to_ucred(pid, cred, &scm->creds); | ||
53 | } | ||
54 | |||
55 | static __inline__ void scm_destroy_cred(struct scm_cookie *scm) | ||
56 | { | ||
57 | put_pid(scm->pid); | ||
58 | scm->pid = NULL; | ||
59 | |||
60 | if (scm->cred) | ||
61 | put_cred(scm->cred); | ||
62 | scm->cred = NULL; | ||
63 | } | ||
64 | |||
45 | static __inline__ void scm_destroy(struct scm_cookie *scm) | 65 | static __inline__ void scm_destroy(struct scm_cookie *scm) |
46 | { | 66 | { |
67 | scm_destroy_cred(scm); | ||
47 | if (scm && scm->fp) | 68 | if (scm && scm->fp) |
48 | __scm_destroy(scm); | 69 | __scm_destroy(scm); |
49 | } | 70 | } |
@@ -51,10 +72,7 @@ static __inline__ void scm_destroy(struct scm_cookie *scm) | |||
51 | static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, | 72 | static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, |
52 | struct scm_cookie *scm) | 73 | struct scm_cookie *scm) |
53 | { | 74 | { |
54 | struct task_struct *p = current; | 75 | scm_set_cred(scm, task_tgid(current), current_cred()); |
55 | scm->creds.uid = current_uid(); | ||
56 | scm->creds.gid = current_gid(); | ||
57 | scm->creds.pid = task_tgid_vnr(p); | ||
58 | scm->fp = NULL; | 76 | scm->fp = NULL; |
59 | unix_get_peersec_dgram(sock, scm); | 77 | unix_get_peersec_dgram(sock, scm); |
60 | if (msg->msg_controllen <= 0) | 78 | if (msg->msg_controllen <= 0) |
@@ -96,6 +114,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | |||
96 | if (test_bit(SOCK_PASSCRED, &sock->flags)) | 114 | if (test_bit(SOCK_PASSCRED, &sock->flags)) |
97 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); | 115 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); |
98 | 116 | ||
117 | scm_destroy_cred(scm); | ||
118 | |||
99 | scm_passec(sock, msg, scm); | 119 | scm_passec(sock, msg, scm); |
100 | 120 | ||
101 | if (!scm->fp) | 121 | if (!scm->fp) |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index fa6cde578a1d..65946bc43d00 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -269,7 +269,7 @@ enum { | |||
269 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | 269 | #define SCTP_MIB_MAX __SCTP_MIB_MAX |
270 | struct sctp_mib { | 270 | struct sctp_mib { |
271 | unsigned long mibs[SCTP_MIB_MAX]; | 271 | unsigned long mibs[SCTP_MIB_MAX]; |
272 | } __SNMP_MIB_ALIGN__; | 272 | }; |
273 | 273 | ||
274 | 274 | ||
275 | /* Print debugging messages. */ | 275 | /* Print debugging messages. */ |
@@ -547,7 +547,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\ | |||
547 | #define WORD_ROUND(s) (((s)+3)&~3) | 547 | #define WORD_ROUND(s) (((s)+3)&~3) |
548 | 548 | ||
549 | /* Make a new instance of type. */ | 549 | /* Make a new instance of type. */ |
550 | #define t_new(type, flags) (type *)kmalloc(sizeof(type), flags) | 550 | #define t_new(type, flags) (type *)kzalloc(sizeof(type), flags) |
551 | 551 | ||
552 | /* Compare two timevals. */ | 552 | /* Compare two timevals. */ |
553 | #define tv_lt(s, t) \ | 553 | #define tv_lt(s, t) \ |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 61d73e37d543..4088c89a9055 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -438,7 +438,7 @@ sctp_vtag_verify_either(const struct sctp_chunk *chunk, | |||
438 | */ | 438 | */ |
439 | if ((!sctp_test_T_bit(chunk) && | 439 | if ((!sctp_test_T_bit(chunk) && |
440 | (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || | 440 | (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || |
441 | (sctp_test_T_bit(chunk) && | 441 | (sctp_test_T_bit(chunk) && asoc->c.peer_vtag && |
442 | (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { | 442 | (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { |
443 | return 1; | 443 | return 1; |
444 | } | 444 | } |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 219043a67bf7..f9e7473613bd 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -443,7 +443,7 @@ struct sctp_signed_cookie { | |||
443 | __u8 signature[SCTP_SECRET_SIZE]; | 443 | __u8 signature[SCTP_SECRET_SIZE]; |
444 | __u32 __pad; /* force sctp_cookie alignment to 64 bits */ | 444 | __u32 __pad; /* force sctp_cookie alignment to 64 bits */ |
445 | struct sctp_cookie c; | 445 | struct sctp_cookie c; |
446 | } __attribute__((packed)); | 446 | } __packed; |
447 | 447 | ||
448 | /* This is another convenience type to allocate memory for address | 448 | /* This is another convenience type to allocate memory for address |
449 | * params for the maximum size and pass such structures around | 449 | * params for the maximum size and pass such structures around |
@@ -488,7 +488,7 @@ typedef struct sctp_sender_hb_info { | |||
488 | union sctp_addr daddr; | 488 | union sctp_addr daddr; |
489 | unsigned long sent_at; | 489 | unsigned long sent_at; |
490 | __u64 hb_nonce; | 490 | __u64 hb_nonce; |
491 | } __attribute__((packed)) sctp_sender_hb_info_t; | 491 | } __packed sctp_sender_hb_info_t; |
492 | 492 | ||
493 | /* | 493 | /* |
494 | * RFC 2960 1.3.2 Sequenced Delivery within Streams | 494 | * RFC 2960 1.3.2 Sequenced Delivery within Streams |
@@ -643,17 +643,15 @@ struct sctp_pf { | |||
643 | struct sctp_datamsg { | 643 | struct sctp_datamsg { |
644 | /* Chunks waiting to be submitted to lower layer. */ | 644 | /* Chunks waiting to be submitted to lower layer. */ |
645 | struct list_head chunks; | 645 | struct list_head chunks; |
646 | /* Chunks that have been transmitted. */ | ||
647 | size_t msg_size; | ||
648 | /* Reference counting. */ | 646 | /* Reference counting. */ |
649 | atomic_t refcnt; | 647 | atomic_t refcnt; |
650 | /* When is this message no longer interesting to the peer? */ | 648 | /* When is this message no longer interesting to the peer? */ |
651 | unsigned long expires_at; | 649 | unsigned long expires_at; |
652 | /* Did the messenge fail to send? */ | 650 | /* Did the messenge fail to send? */ |
653 | int send_error; | 651 | int send_error; |
654 | char send_failed; | 652 | u8 send_failed:1, |
655 | /* Control whether chunks from this message can be abandoned. */ | 653 | can_abandon:1, /* can chunks from this message can be abandoned. */ |
656 | char can_abandon; | 654 | can_delay; /* should this message be Nagle delayed */ |
657 | }; | 655 | }; |
658 | 656 | ||
659 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, | 657 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, |
@@ -757,7 +755,6 @@ struct sctp_chunk { | |||
757 | #define SCTP_NEED_FRTX 0x1 | 755 | #define SCTP_NEED_FRTX 0x1 |
758 | #define SCTP_DONT_FRTX 0x2 | 756 | #define SCTP_DONT_FRTX 0x2 |
759 | __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ | 757 | __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ |
760 | resent:1, /* Has this chunk ever been resent. */ | ||
761 | has_tsn:1, /* Does this chunk have a TSN yet? */ | 758 | has_tsn:1, /* Does this chunk have a TSN yet? */ |
762 | has_ssn:1, /* Does this chunk have a SSN yet? */ | 759 | has_ssn:1, /* Does this chunk have a SSN yet? */ |
763 | singleton:1, /* Only chunk in the packet? */ | 760 | singleton:1, /* Only chunk in the packet? */ |
@@ -879,7 +876,30 @@ struct sctp_transport { | |||
879 | 876 | ||
880 | /* Reference counting. */ | 877 | /* Reference counting. */ |
881 | atomic_t refcnt; | 878 | atomic_t refcnt; |
882 | int dead; | 879 | __u32 dead:1, |
880 | /* RTO-Pending : A flag used to track if one of the DATA | ||
881 | * chunks sent to this address is currently being | ||
882 | * used to compute a RTT. If this flag is 0, | ||
883 | * the next DATA chunk sent to this destination | ||
884 | * should be used to compute a RTT and this flag | ||
885 | * should be set. Every time the RTT | ||
886 | * calculation completes (i.e. the DATA chunk | ||
887 | * is SACK'd) clear this flag. | ||
888 | */ | ||
889 | rto_pending:1, | ||
890 | |||
891 | /* | ||
892 | * hb_sent : a flag that signals that we have a pending | ||
893 | * heartbeat. | ||
894 | */ | ||
895 | hb_sent:1, | ||
896 | |||
897 | /* Is the Path MTU update pending on this tranport */ | ||
898 | pmtu_pending:1, | ||
899 | |||
900 | /* Is this structure kfree()able? */ | ||
901 | malloced:1; | ||
902 | |||
883 | 903 | ||
884 | /* This is the peer's IP address and port. */ | 904 | /* This is the peer's IP address and port. */ |
885 | union sctp_addr ipaddr; | 905 | union sctp_addr ipaddr; |
@@ -909,22 +929,6 @@ struct sctp_transport { | |||
909 | /* SRTT : The current smoothed round trip time. */ | 929 | /* SRTT : The current smoothed round trip time. */ |
910 | __u32 srtt; | 930 | __u32 srtt; |
911 | 931 | ||
912 | /* RTO-Pending : A flag used to track if one of the DATA | ||
913 | * chunks sent to this address is currently being | ||
914 | * used to compute a RTT. If this flag is 0, | ||
915 | * the next DATA chunk sent to this destination | ||
916 | * should be used to compute a RTT and this flag | ||
917 | * should be set. Every time the RTT | ||
918 | * calculation completes (i.e. the DATA chunk | ||
919 | * is SACK'd) clear this flag. | ||
920 | * hb_sent : a flag that signals that we have a pending heartbeat. | ||
921 | */ | ||
922 | __u8 rto_pending; | ||
923 | __u8 hb_sent; | ||
924 | |||
925 | /* Flag to track the current fast recovery state */ | ||
926 | __u8 fast_recovery; | ||
927 | |||
928 | /* | 932 | /* |
929 | * These are the congestion stats. | 933 | * These are the congestion stats. |
930 | */ | 934 | */ |
@@ -944,9 +948,6 @@ struct sctp_transport { | |||
944 | 948 | ||
945 | __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ | 949 | __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ |
946 | 950 | ||
947 | /* TSN marking the fast recovery exit point */ | ||
948 | __u32 fast_recovery_exit; | ||
949 | |||
950 | /* Destination */ | 951 | /* Destination */ |
951 | struct dst_entry *dst; | 952 | struct dst_entry *dst; |
952 | /* Source address. */ | 953 | /* Source address. */ |
@@ -977,9 +978,6 @@ struct sctp_transport { | |||
977 | */ | 978 | */ |
978 | __u16 pathmaxrxt; | 979 | __u16 pathmaxrxt; |
979 | 980 | ||
980 | /* is the Path MTU update pending on this tranport */ | ||
981 | __u8 pmtu_pending; | ||
982 | |||
983 | /* PMTU : The current known path MTU. */ | 981 | /* PMTU : The current known path MTU. */ |
984 | __u32 pathmtu; | 982 | __u32 pathmtu; |
985 | 983 | ||
@@ -1026,8 +1024,6 @@ struct sctp_transport { | |||
1026 | /* This is the list of transports that have chunks to send. */ | 1024 | /* This is the list of transports that have chunks to send. */ |
1027 | struct list_head send_ready; | 1025 | struct list_head send_ready; |
1028 | 1026 | ||
1029 | int malloced; /* Is this structure kfree()able? */ | ||
1030 | |||
1031 | /* State information saved for SFR_CACC algorithm. The key | 1027 | /* State information saved for SFR_CACC algorithm. The key |
1032 | * idea in SFR_CACC is to maintain state at the sender on a | 1028 | * idea in SFR_CACC is to maintain state at the sender on a |
1033 | * per-destination basis when a changeover happens. | 1029 | * per-destination basis when a changeover happens. |
@@ -1069,7 +1065,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *, | |||
1069 | struct sctp_sock *); | 1065 | struct sctp_sock *); |
1070 | void sctp_transport_pmtu(struct sctp_transport *); | 1066 | void sctp_transport_pmtu(struct sctp_transport *); |
1071 | void sctp_transport_free(struct sctp_transport *); | 1067 | void sctp_transport_free(struct sctp_transport *); |
1072 | void sctp_transport_reset_timers(struct sctp_transport *, int); | 1068 | void sctp_transport_reset_timers(struct sctp_transport *); |
1073 | void sctp_transport_hold(struct sctp_transport *); | 1069 | void sctp_transport_hold(struct sctp_transport *); |
1074 | void sctp_transport_put(struct sctp_transport *); | 1070 | void sctp_transport_put(struct sctp_transport *); |
1075 | void sctp_transport_update_rto(struct sctp_transport *, __u32); | 1071 | void sctp_transport_update_rto(struct sctp_transport *, __u32); |
@@ -1723,6 +1719,12 @@ struct sctp_association { | |||
1723 | /* Highest TSN that is acknowledged by incoming SACKs. */ | 1719 | /* Highest TSN that is acknowledged by incoming SACKs. */ |
1724 | __u32 highest_sacked; | 1720 | __u32 highest_sacked; |
1725 | 1721 | ||
1722 | /* TSN marking the fast recovery exit point */ | ||
1723 | __u32 fast_recovery_exit; | ||
1724 | |||
1725 | /* Flag to track the current fast recovery state */ | ||
1726 | __u8 fast_recovery; | ||
1727 | |||
1726 | /* The number of unacknowledged data chunks. Reported through | 1728 | /* The number of unacknowledged data chunks. Reported through |
1727 | * the SCTP_STATUS sockopt. | 1729 | * the SCTP_STATUS sockopt. |
1728 | */ | 1730 | */ |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 692ee0061dc4..a0e61806d480 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -47,31 +47,17 @@ struct snmp_mib { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * We use all unsigned longs. Linux will soon be so reliable that even | 50 | * We use unsigned longs for most mibs but u64 for ipstats. |
51 | * these will rapidly get too small 8-). Seriously consider the IpInReceives | ||
52 | * count on the 20Gb/s + networks people expect in a few years time! | ||
53 | */ | 51 | */ |
54 | 52 | #include <linux/u64_stats_sync.h> | |
55 | /* | ||
56 | * The rule for padding: | ||
57 | * Best is power of two because then the right structure can be found by a | ||
58 | * simple shift. The structure should be always cache line aligned. | ||
59 | * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add | ||
60 | * instructions to emulate multiply in case it is not power-of-two. | ||
61 | * Currently n is always <=3 for all sizes so simple cache line alignment | ||
62 | * is enough. | ||
63 | * | ||
64 | * The best solution would be a global CPU local area , especially on 64 | ||
65 | * and 128byte cacheline machine it makes a *lot* of sense -AK | ||
66 | */ | ||
67 | |||
68 | #define __SNMP_MIB_ALIGN__ ____cacheline_aligned | ||
69 | 53 | ||
70 | /* IPstats */ | 54 | /* IPstats */ |
71 | #define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX | 55 | #define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX |
72 | struct ipstats_mib { | 56 | struct ipstats_mib { |
73 | unsigned long mibs[IPSTATS_MIB_MAX]; | 57 | /* mibs[] must be first field of struct ipstats_mib */ |
74 | } __SNMP_MIB_ALIGN__; | 58 | u64 mibs[IPSTATS_MIB_MAX]; |
59 | struct u64_stats_sync syncp; | ||
60 | }; | ||
75 | 61 | ||
76 | /* ICMP */ | 62 | /* ICMP */ |
77 | #define ICMP_MIB_DUMMY __ICMP_MIB_MAX | 63 | #define ICMP_MIB_DUMMY __ICMP_MIB_MAX |
@@ -79,36 +65,36 @@ struct ipstats_mib { | |||
79 | 65 | ||
80 | struct icmp_mib { | 66 | struct icmp_mib { |
81 | unsigned long mibs[ICMP_MIB_MAX]; | 67 | unsigned long mibs[ICMP_MIB_MAX]; |
82 | } __SNMP_MIB_ALIGN__; | 68 | }; |
83 | 69 | ||
84 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX | 70 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX |
85 | struct icmpmsg_mib { | 71 | struct icmpmsg_mib { |
86 | unsigned long mibs[ICMPMSG_MIB_MAX]; | 72 | unsigned long mibs[ICMPMSG_MIB_MAX]; |
87 | } __SNMP_MIB_ALIGN__; | 73 | }; |
88 | 74 | ||
89 | /* ICMP6 (IPv6-ICMP) */ | 75 | /* ICMP6 (IPv6-ICMP) */ |
90 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX | 76 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX |
91 | struct icmpv6_mib { | 77 | struct icmpv6_mib { |
92 | unsigned long mibs[ICMP6_MIB_MAX]; | 78 | unsigned long mibs[ICMP6_MIB_MAX]; |
93 | } __SNMP_MIB_ALIGN__; | 79 | }; |
94 | 80 | ||
95 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX | 81 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX |
96 | struct icmpv6msg_mib { | 82 | struct icmpv6msg_mib { |
97 | unsigned long mibs[ICMP6MSG_MIB_MAX]; | 83 | unsigned long mibs[ICMP6MSG_MIB_MAX]; |
98 | } __SNMP_MIB_ALIGN__; | 84 | }; |
99 | 85 | ||
100 | 86 | ||
101 | /* TCP */ | 87 | /* TCP */ |
102 | #define TCP_MIB_MAX __TCP_MIB_MAX | 88 | #define TCP_MIB_MAX __TCP_MIB_MAX |
103 | struct tcp_mib { | 89 | struct tcp_mib { |
104 | unsigned long mibs[TCP_MIB_MAX]; | 90 | unsigned long mibs[TCP_MIB_MAX]; |
105 | } __SNMP_MIB_ALIGN__; | 91 | }; |
106 | 92 | ||
107 | /* UDP */ | 93 | /* UDP */ |
108 | #define UDP_MIB_MAX __UDP_MIB_MAX | 94 | #define UDP_MIB_MAX __UDP_MIB_MAX |
109 | struct udp_mib { | 95 | struct udp_mib { |
110 | unsigned long mibs[UDP_MIB_MAX]; | 96 | unsigned long mibs[UDP_MIB_MAX]; |
111 | } __SNMP_MIB_ALIGN__; | 97 | }; |
112 | 98 | ||
113 | /* Linux */ | 99 | /* Linux */ |
114 | #define LINUX_MIB_MAX __LINUX_MIB_MAX | 100 | #define LINUX_MIB_MAX __LINUX_MIB_MAX |
@@ -148,6 +134,8 @@ struct linux_xfrm_mib { | |||
148 | __this_cpu_add(mib[0]->mibs[field], addend) | 134 | __this_cpu_add(mib[0]->mibs[field], addend) |
149 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 135 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
150 | this_cpu_add(mib[1]->mibs[field], addend) | 136 | this_cpu_add(mib[1]->mibs[field], addend) |
137 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
138 | this_cpu_add(mib[!in_softirq()]->mibs[field], addend) | ||
151 | /* | 139 | /* |
152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" | 140 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" |
153 | * to make @ptr a non-percpu pointer. | 141 | * to make @ptr a non-percpu pointer. |
@@ -168,4 +156,70 @@ struct linux_xfrm_mib { | |||
168 | ptr->mibs[basefield##PKTS]++; \ | 156 | ptr->mibs[basefield##PKTS]++; \ |
169 | ptr->mibs[basefield##OCTETS] += addend;\ | 157 | ptr->mibs[basefield##OCTETS] += addend;\ |
170 | } while (0) | 158 | } while (0) |
159 | |||
160 | |||
161 | #if BITS_PER_LONG==32 | ||
162 | |||
163 | #define SNMP_ADD_STATS64_BH(mib, field, addend) \ | ||
164 | do { \ | ||
165 | __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \ | ||
166 | u64_stats_update_begin(&ptr->syncp); \ | ||
167 | ptr->mibs[field] += addend; \ | ||
168 | u64_stats_update_end(&ptr->syncp); \ | ||
169 | } while (0) | ||
170 | #define SNMP_ADD_STATS64_USER(mib, field, addend) \ | ||
171 | do { \ | ||
172 | __typeof__(*mib[0]) *ptr; \ | ||
173 | preempt_disable(); \ | ||
174 | ptr = __this_cpu_ptr((mib)[1]); \ | ||
175 | u64_stats_update_begin(&ptr->syncp); \ | ||
176 | ptr->mibs[field] += addend; \ | ||
177 | u64_stats_update_end(&ptr->syncp); \ | ||
178 | preempt_enable(); \ | ||
179 | } while (0) | ||
180 | #define SNMP_ADD_STATS64(mib, field, addend) \ | ||
181 | do { \ | ||
182 | __typeof__(*mib[0]) *ptr; \ | ||
183 | preempt_disable(); \ | ||
184 | ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
185 | u64_stats_update_begin(&ptr->syncp); \ | ||
186 | ptr->mibs[field] += addend; \ | ||
187 | u64_stats_update_end(&ptr->syncp); \ | ||
188 | preempt_enable(); \ | ||
189 | } while (0) | ||
190 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_ADD_STATS64_BH(mib, field, 1) | ||
191 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_ADD_STATS64_USER(mib, field, 1) | ||
192 | #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) | ||
193 | #define SNMP_UPD_PO_STATS64(mib, basefield, addend) \ | ||
194 | do { \ | ||
195 | __typeof__(*mib[0]) *ptr; \ | ||
196 | preempt_disable(); \ | ||
197 | ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
198 | u64_stats_update_begin(&ptr->syncp); \ | ||
199 | ptr->mibs[basefield##PKTS]++; \ | ||
200 | ptr->mibs[basefield##OCTETS] += addend; \ | ||
201 | u64_stats_update_end(&ptr->syncp); \ | ||
202 | preempt_enable(); \ | ||
203 | } while (0) | ||
204 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ | ||
205 | do { \ | ||
206 | __typeof__(*mib[0]) *ptr; \ | ||
207 | ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
208 | u64_stats_update_begin(&ptr->syncp); \ | ||
209 | ptr->mibs[basefield##PKTS]++; \ | ||
210 | ptr->mibs[basefield##OCTETS] += addend; \ | ||
211 | u64_stats_update_end(&ptr->syncp); \ | ||
212 | } while (0) | ||
213 | #else | ||
214 | #define SNMP_INC_STATS64_BH(mib, field) SNMP_INC_STATS_BH(mib, field) | ||
215 | #define SNMP_INC_STATS64_USER(mib, field) SNMP_INC_STATS_USER(mib, field) | ||
216 | #define SNMP_INC_STATS64(mib, field) SNMP_INC_STATS(mib, field) | ||
217 | #define SNMP_DEC_STATS64(mib, field) SNMP_DEC_STATS(mib, field) | ||
218 | #define SNMP_ADD_STATS64_BH(mib, field, addend) SNMP_ADD_STATS_BH(mib, field, addend) | ||
219 | #define SNMP_ADD_STATS64_USER(mib, field, addend) SNMP_ADD_STATS_USER(mib, field, addend) | ||
220 | #define SNMP_ADD_STATS64(mib, field, addend) SNMP_ADD_STATS(mib, field, addend) | ||
221 | #define SNMP_UPD_PO_STATS64(mib, basefield, addend) SNMP_UPD_PO_STATS(mib, basefield, addend) | ||
222 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) SNMP_UPD_PO_STATS_BH(mib, basefield, addend) | ||
223 | #endif | ||
224 | |||
171 | #endif | 225 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 1ad6435f252e..adab9dc58183 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -159,7 +159,7 @@ struct sock_common { | |||
159 | * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings | 159 | * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings |
160 | * @sk_lock: synchronizer | 160 | * @sk_lock: synchronizer |
161 | * @sk_rcvbuf: size of receive buffer in bytes | 161 | * @sk_rcvbuf: size of receive buffer in bytes |
162 | * @sk_sleep: sock wait queue | 162 | * @sk_wq: sock wait queue and async head |
163 | * @sk_dst_cache: destination cache | 163 | * @sk_dst_cache: destination cache |
164 | * @sk_dst_lock: destination cache lock | 164 | * @sk_dst_lock: destination cache lock |
165 | * @sk_policy: flow policy | 165 | * @sk_policy: flow policy |
@@ -177,6 +177,7 @@ struct sock_common { | |||
177 | * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings | 177 | * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings |
178 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 178 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
179 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 179 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
180 | * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) | ||
180 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | 181 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
181 | * @sk_gso_max_size: Maximum GSO segment size to build | 182 | * @sk_gso_max_size: Maximum GSO segment size to build |
182 | * @sk_lingertime: %SO_LINGER l_linger setting | 183 | * @sk_lingertime: %SO_LINGER l_linger setting |
@@ -194,10 +195,12 @@ struct sock_common { | |||
194 | * @sk_priority: %SO_PRIORITY setting | 195 | * @sk_priority: %SO_PRIORITY setting |
195 | * @sk_type: socket type (%SOCK_STREAM, etc) | 196 | * @sk_type: socket type (%SOCK_STREAM, etc) |
196 | * @sk_protocol: which protocol this socket belongs in this network family | 197 | * @sk_protocol: which protocol this socket belongs in this network family |
197 | * @sk_peercred: %SO_PEERCRED setting | 198 | * @sk_peer_pid: &struct pid for this socket's peer |
199 | * @sk_peer_cred: %SO_PEERCRED setting | ||
198 | * @sk_rcvlowat: %SO_RCVLOWAT setting | 200 | * @sk_rcvlowat: %SO_RCVLOWAT setting |
199 | * @sk_rcvtimeo: %SO_RCVTIMEO setting | 201 | * @sk_rcvtimeo: %SO_RCVTIMEO setting |
200 | * @sk_sndtimeo: %SO_SNDTIMEO setting | 202 | * @sk_sndtimeo: %SO_SNDTIMEO setting |
203 | * @sk_rxhash: flow hash received from netif layer | ||
201 | * @sk_filter: socket filtering instructions | 204 | * @sk_filter: socket filtering instructions |
202 | * @sk_protinfo: private area, net family specific, when not using slab | 205 | * @sk_protinfo: private area, net family specific, when not using slab |
203 | * @sk_timer: sock cleanup timer | 206 | * @sk_timer: sock cleanup timer |
@@ -209,6 +212,7 @@ struct sock_common { | |||
209 | * @sk_send_head: front of stuff to transmit | 212 | * @sk_send_head: front of stuff to transmit |
210 | * @sk_security: used by security modules | 213 | * @sk_security: used by security modules |
211 | * @sk_mark: generic packet mark | 214 | * @sk_mark: generic packet mark |
215 | * @sk_classid: this socket's cgroup classid | ||
212 | * @sk_write_pending: a write to stream socket waits to start | 216 | * @sk_write_pending: a write to stream socket waits to start |
213 | * @sk_state_change: callback to indicate change in the state of the sock | 217 | * @sk_state_change: callback to indicate change in the state of the sock |
214 | * @sk_data_ready: callback to indicate there is data to be processed | 218 | * @sk_data_ready: callback to indicate there is data to be processed |
@@ -255,14 +259,13 @@ struct sock { | |||
255 | struct sk_buff *head; | 259 | struct sk_buff *head; |
256 | struct sk_buff *tail; | 260 | struct sk_buff *tail; |
257 | int len; | 261 | int len; |
258 | int limit; | ||
259 | } sk_backlog; | 262 | } sk_backlog; |
260 | wait_queue_head_t *sk_sleep; | 263 | struct socket_wq *sk_wq; |
261 | struct dst_entry *sk_dst_cache; | 264 | struct dst_entry *sk_dst_cache; |
262 | #ifdef CONFIG_XFRM | 265 | #ifdef CONFIG_XFRM |
263 | struct xfrm_policy *sk_policy[2]; | 266 | struct xfrm_policy *sk_policy[2]; |
264 | #endif | 267 | #endif |
265 | rwlock_t sk_dst_lock; | 268 | spinlock_t sk_dst_lock; |
266 | atomic_t sk_rmem_alloc; | 269 | atomic_t sk_rmem_alloc; |
267 | atomic_t sk_wmem_alloc; | 270 | atomic_t sk_wmem_alloc; |
268 | atomic_t sk_omem_alloc; | 271 | atomic_t sk_omem_alloc; |
@@ -276,9 +279,13 @@ struct sock { | |||
276 | int sk_forward_alloc; | 279 | int sk_forward_alloc; |
277 | gfp_t sk_allocation; | 280 | gfp_t sk_allocation; |
278 | int sk_route_caps; | 281 | int sk_route_caps; |
282 | int sk_route_nocaps; | ||
279 | int sk_gso_type; | 283 | int sk_gso_type; |
280 | unsigned int sk_gso_max_size; | 284 | unsigned int sk_gso_max_size; |
281 | int sk_rcvlowat; | 285 | int sk_rcvlowat; |
286 | #ifdef CONFIG_RPS | ||
287 | __u32 sk_rxhash; | ||
288 | #endif | ||
282 | unsigned long sk_flags; | 289 | unsigned long sk_flags; |
283 | unsigned long sk_lingertime; | 290 | unsigned long sk_lingertime; |
284 | struct sk_buff_head sk_error_queue; | 291 | struct sk_buff_head sk_error_queue; |
@@ -290,7 +297,8 @@ struct sock { | |||
290 | unsigned short sk_ack_backlog; | 297 | unsigned short sk_ack_backlog; |
291 | unsigned short sk_max_ack_backlog; | 298 | unsigned short sk_max_ack_backlog; |
292 | __u32 sk_priority; | 299 | __u32 sk_priority; |
293 | struct ucred sk_peercred; | 300 | struct pid *sk_peer_pid; |
301 | const struct cred *sk_peer_cred; | ||
294 | long sk_rcvtimeo; | 302 | long sk_rcvtimeo; |
295 | long sk_sndtimeo; | 303 | long sk_sndtimeo; |
296 | struct sk_filter *sk_filter; | 304 | struct sk_filter *sk_filter; |
@@ -307,7 +315,7 @@ struct sock { | |||
307 | void *sk_security; | 315 | void *sk_security; |
308 | #endif | 316 | #endif |
309 | __u32 sk_mark; | 317 | __u32 sk_mark; |
310 | /* XXX 4 bytes hole on 64 bit */ | 318 | u32 sk_classid; |
311 | void (*sk_state_change)(struct sock *sk); | 319 | void (*sk_state_change)(struct sock *sk); |
312 | void (*sk_data_ready)(struct sock *sk, int bytes); | 320 | void (*sk_data_ready)(struct sock *sk, int bytes); |
313 | void (*sk_write_space)(struct sock *sk); | 321 | void (*sk_write_space)(struct sock *sk); |
@@ -595,19 +603,32 @@ static inline int sk_stream_memory_free(struct sock *sk) | |||
595 | /* OOB backlog add */ | 603 | /* OOB backlog add */ |
596 | static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 604 | static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
597 | { | 605 | { |
598 | if (!sk->sk_backlog.tail) { | 606 | /* dont let skb dst not refcounted, we are going to leave rcu lock */ |
599 | sk->sk_backlog.head = sk->sk_backlog.tail = skb; | 607 | skb_dst_force(skb); |
600 | } else { | 608 | |
609 | if (!sk->sk_backlog.tail) | ||
610 | sk->sk_backlog.head = skb; | ||
611 | else | ||
601 | sk->sk_backlog.tail->next = skb; | 612 | sk->sk_backlog.tail->next = skb; |
602 | sk->sk_backlog.tail = skb; | 613 | |
603 | } | 614 | sk->sk_backlog.tail = skb; |
604 | skb->next = NULL; | 615 | skb->next = NULL; |
605 | } | 616 | } |
606 | 617 | ||
618 | /* | ||
619 | * Take into account size of receive queue and backlog queue | ||
620 | */ | ||
621 | static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) | ||
622 | { | ||
623 | unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); | ||
624 | |||
625 | return qsize + skb->truesize > sk->sk_rcvbuf; | ||
626 | } | ||
627 | |||
607 | /* The per-socket spinlock must be held here. */ | 628 | /* The per-socket spinlock must be held here. */ |
608 | static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 629 | static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
609 | { | 630 | { |
610 | if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) | 631 | if (sk_rcvqueues_full(sk, skb)) |
611 | return -ENOBUFS; | 632 | return -ENOBUFS; |
612 | 633 | ||
613 | __sk_add_backlog(sk, skb); | 634 | __sk_add_backlog(sk, skb); |
@@ -620,6 +641,40 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
620 | return sk->sk_backlog_rcv(sk, skb); | 641 | return sk->sk_backlog_rcv(sk, skb); |
621 | } | 642 | } |
622 | 643 | ||
644 | static inline void sock_rps_record_flow(const struct sock *sk) | ||
645 | { | ||
646 | #ifdef CONFIG_RPS | ||
647 | struct rps_sock_flow_table *sock_flow_table; | ||
648 | |||
649 | rcu_read_lock(); | ||
650 | sock_flow_table = rcu_dereference(rps_sock_flow_table); | ||
651 | rps_record_sock_flow(sock_flow_table, sk->sk_rxhash); | ||
652 | rcu_read_unlock(); | ||
653 | #endif | ||
654 | } | ||
655 | |||
656 | static inline void sock_rps_reset_flow(const struct sock *sk) | ||
657 | { | ||
658 | #ifdef CONFIG_RPS | ||
659 | struct rps_sock_flow_table *sock_flow_table; | ||
660 | |||
661 | rcu_read_lock(); | ||
662 | sock_flow_table = rcu_dereference(rps_sock_flow_table); | ||
663 | rps_reset_sock_flow(sock_flow_table, sk->sk_rxhash); | ||
664 | rcu_read_unlock(); | ||
665 | #endif | ||
666 | } | ||
667 | |||
668 | static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash) | ||
669 | { | ||
670 | #ifdef CONFIG_RPS | ||
671 | if (unlikely(sk->sk_rxhash != rxhash)) { | ||
672 | sock_rps_reset_flow(sk); | ||
673 | sk->sk_rxhash = rxhash; | ||
674 | } | ||
675 | #endif | ||
676 | } | ||
677 | |||
623 | #define sk_wait_event(__sk, __timeo, __condition) \ | 678 | #define sk_wait_event(__sk, __timeo, __condition) \ |
624 | ({ int __rc; \ | 679 | ({ int __rc; \ |
625 | release_sock(__sk); \ | 680 | release_sock(__sk); \ |
@@ -697,6 +752,7 @@ struct proto { | |||
697 | /* Keeping track of sk's, looking them up, and port selection methods. */ | 752 | /* Keeping track of sk's, looking them up, and port selection methods. */ |
698 | void (*hash)(struct sock *sk); | 753 | void (*hash)(struct sock *sk); |
699 | void (*unhash)(struct sock *sk); | 754 | void (*unhash)(struct sock *sk); |
755 | void (*rehash)(struct sock *sk); | ||
700 | int (*get_port)(struct sock *sk, unsigned short snum); | 756 | int (*get_port)(struct sock *sk, unsigned short snum); |
701 | 757 | ||
702 | /* Keeping track of sockets in use */ | 758 | /* Keeping track of sockets in use */ |
@@ -719,6 +775,7 @@ struct proto { | |||
719 | int *sysctl_wmem; | 775 | int *sysctl_wmem; |
720 | int *sysctl_rmem; | 776 | int *sysctl_rmem; |
721 | int max_header; | 777 | int max_header; |
778 | bool no_autobind; | ||
722 | 779 | ||
723 | struct kmem_cache *slab; | 780 | struct kmem_cache *slab; |
724 | unsigned int obj_size; | 781 | unsigned int obj_size; |
@@ -974,6 +1031,24 @@ extern void release_sock(struct sock *sk); | |||
974 | SINGLE_DEPTH_NESTING) | 1031 | SINGLE_DEPTH_NESTING) |
975 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 1032 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
976 | 1033 | ||
1034 | extern bool lock_sock_fast(struct sock *sk); | ||
1035 | /** | ||
1036 | * unlock_sock_fast - complement of lock_sock_fast | ||
1037 | * @sk: socket | ||
1038 | * @slow: slow mode | ||
1039 | * | ||
1040 | * fast unlock socket for user context. | ||
1041 | * If slow mode is on, we call regular release_sock() | ||
1042 | */ | ||
1043 | static inline void unlock_sock_fast(struct sock *sk, bool slow) | ||
1044 | { | ||
1045 | if (slow) | ||
1046 | release_sock(sk); | ||
1047 | else | ||
1048 | spin_unlock_bh(&sk->sk_lock.slock); | ||
1049 | } | ||
1050 | |||
1051 | |||
977 | extern struct sock *sk_alloc(struct net *net, int family, | 1052 | extern struct sock *sk_alloc(struct net *net, int family, |
978 | gfp_t priority, | 1053 | gfp_t priority, |
979 | struct proto *prot); | 1054 | struct proto *prot); |
@@ -1012,6 +1087,14 @@ extern void *sock_kmalloc(struct sock *sk, int size, | |||
1012 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); | 1087 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); |
1013 | extern void sk_send_sigurg(struct sock *sk); | 1088 | extern void sk_send_sigurg(struct sock *sk); |
1014 | 1089 | ||
1090 | #ifdef CONFIG_CGROUPS | ||
1091 | extern void sock_update_classid(struct sock *sk); | ||
1092 | #else | ||
1093 | static inline void sock_update_classid(struct sock *sk) | ||
1094 | { | ||
1095 | } | ||
1096 | #endif | ||
1097 | |||
1015 | /* | 1098 | /* |
1016 | * Functions to fill in entries in struct proto_ops when a protocol | 1099 | * Functions to fill in entries in struct proto_ops when a protocol |
1017 | * does not implement a particular function. | 1100 | * does not implement a particular function. |
@@ -1146,12 +1229,7 @@ static inline void sk_tx_queue_clear(struct sock *sk) | |||
1146 | 1229 | ||
1147 | static inline int sk_tx_queue_get(const struct sock *sk) | 1230 | static inline int sk_tx_queue_get(const struct sock *sk) |
1148 | { | 1231 | { |
1149 | return sk->sk_tx_queue_mapping; | 1232 | return sk ? sk->sk_tx_queue_mapping : -1; |
1150 | } | ||
1151 | |||
1152 | static inline bool sk_tx_queue_recorded(const struct sock *sk) | ||
1153 | { | ||
1154 | return (sk && sk->sk_tx_queue_mapping >= 0); | ||
1155 | } | 1233 | } |
1156 | 1234 | ||
1157 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) | 1235 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) |
@@ -1160,6 +1238,10 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock) | |||
1160 | sk->sk_socket = sock; | 1238 | sk->sk_socket = sock; |
1161 | } | 1239 | } |
1162 | 1240 | ||
1241 | static inline wait_queue_head_t *sk_sleep(struct sock *sk) | ||
1242 | { | ||
1243 | return &sk->sk_wq->wait; | ||
1244 | } | ||
1163 | /* Detach socket from process context. | 1245 | /* Detach socket from process context. |
1164 | * Announce socket dead, detach it from wait queue and inode. | 1246 | * Announce socket dead, detach it from wait queue and inode. |
1165 | * Note that parent inode held reference count on this struct sock, | 1247 | * Note that parent inode held reference count on this struct sock, |
@@ -1172,14 +1254,14 @@ static inline void sock_orphan(struct sock *sk) | |||
1172 | write_lock_bh(&sk->sk_callback_lock); | 1254 | write_lock_bh(&sk->sk_callback_lock); |
1173 | sock_set_flag(sk, SOCK_DEAD); | 1255 | sock_set_flag(sk, SOCK_DEAD); |
1174 | sk_set_socket(sk, NULL); | 1256 | sk_set_socket(sk, NULL); |
1175 | sk->sk_sleep = NULL; | 1257 | sk->sk_wq = NULL; |
1176 | write_unlock_bh(&sk->sk_callback_lock); | 1258 | write_unlock_bh(&sk->sk_callback_lock); |
1177 | } | 1259 | } |
1178 | 1260 | ||
1179 | static inline void sock_graft(struct sock *sk, struct socket *parent) | 1261 | static inline void sock_graft(struct sock *sk, struct socket *parent) |
1180 | { | 1262 | { |
1181 | write_lock_bh(&sk->sk_callback_lock); | 1263 | write_lock_bh(&sk->sk_callback_lock); |
1182 | sk->sk_sleep = &parent->wait; | 1264 | rcu_assign_pointer(sk->sk_wq, parent->wq); |
1183 | parent->sk = sk; | 1265 | parent->sk = sk; |
1184 | sk_set_socket(sk, parent); | 1266 | sk_set_socket(sk, parent); |
1185 | security_sock_graft(sk, parent); | 1267 | security_sock_graft(sk, parent); |
@@ -1192,7 +1274,9 @@ extern unsigned long sock_i_ino(struct sock *sk); | |||
1192 | static inline struct dst_entry * | 1274 | static inline struct dst_entry * |
1193 | __sk_dst_get(struct sock *sk) | 1275 | __sk_dst_get(struct sock *sk) |
1194 | { | 1276 | { |
1195 | return sk->sk_dst_cache; | 1277 | return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() || |
1278 | sock_owned_by_user(sk) || | ||
1279 | lockdep_is_held(&sk->sk_lock.slock)); | ||
1196 | } | 1280 | } |
1197 | 1281 | ||
1198 | static inline struct dst_entry * | 1282 | static inline struct dst_entry * |
@@ -1200,50 +1284,65 @@ sk_dst_get(struct sock *sk) | |||
1200 | { | 1284 | { |
1201 | struct dst_entry *dst; | 1285 | struct dst_entry *dst; |
1202 | 1286 | ||
1203 | read_lock(&sk->sk_dst_lock); | 1287 | rcu_read_lock(); |
1204 | dst = sk->sk_dst_cache; | 1288 | dst = rcu_dereference(sk->sk_dst_cache); |
1205 | if (dst) | 1289 | if (dst) |
1206 | dst_hold(dst); | 1290 | dst_hold(dst); |
1207 | read_unlock(&sk->sk_dst_lock); | 1291 | rcu_read_unlock(); |
1208 | return dst; | 1292 | return dst; |
1209 | } | 1293 | } |
1210 | 1294 | ||
1295 | extern void sk_reset_txq(struct sock *sk); | ||
1296 | |||
1297 | static inline void dst_negative_advice(struct sock *sk) | ||
1298 | { | ||
1299 | struct dst_entry *ndst, *dst = __sk_dst_get(sk); | ||
1300 | |||
1301 | if (dst && dst->ops->negative_advice) { | ||
1302 | ndst = dst->ops->negative_advice(dst); | ||
1303 | |||
1304 | if (ndst != dst) { | ||
1305 | rcu_assign_pointer(sk->sk_dst_cache, ndst); | ||
1306 | sk_reset_txq(sk); | ||
1307 | } | ||
1308 | } | ||
1309 | } | ||
1310 | |||
1211 | static inline void | 1311 | static inline void |
1212 | __sk_dst_set(struct sock *sk, struct dst_entry *dst) | 1312 | __sk_dst_set(struct sock *sk, struct dst_entry *dst) |
1213 | { | 1313 | { |
1214 | struct dst_entry *old_dst; | 1314 | struct dst_entry *old_dst; |
1215 | 1315 | ||
1216 | sk_tx_queue_clear(sk); | 1316 | sk_tx_queue_clear(sk); |
1217 | old_dst = sk->sk_dst_cache; | 1317 | /* |
1218 | sk->sk_dst_cache = dst; | 1318 | * This can be called while sk is owned by the caller only, |
1319 | * with no state that can be checked in a rcu_dereference_check() cond | ||
1320 | */ | ||
1321 | old_dst = rcu_dereference_raw(sk->sk_dst_cache); | ||
1322 | rcu_assign_pointer(sk->sk_dst_cache, dst); | ||
1219 | dst_release(old_dst); | 1323 | dst_release(old_dst); |
1220 | } | 1324 | } |
1221 | 1325 | ||
1222 | static inline void | 1326 | static inline void |
1223 | sk_dst_set(struct sock *sk, struct dst_entry *dst) | 1327 | sk_dst_set(struct sock *sk, struct dst_entry *dst) |
1224 | { | 1328 | { |
1225 | write_lock(&sk->sk_dst_lock); | 1329 | spin_lock(&sk->sk_dst_lock); |
1226 | __sk_dst_set(sk, dst); | 1330 | __sk_dst_set(sk, dst); |
1227 | write_unlock(&sk->sk_dst_lock); | 1331 | spin_unlock(&sk->sk_dst_lock); |
1228 | } | 1332 | } |
1229 | 1333 | ||
1230 | static inline void | 1334 | static inline void |
1231 | __sk_dst_reset(struct sock *sk) | 1335 | __sk_dst_reset(struct sock *sk) |
1232 | { | 1336 | { |
1233 | struct dst_entry *old_dst; | 1337 | __sk_dst_set(sk, NULL); |
1234 | |||
1235 | sk_tx_queue_clear(sk); | ||
1236 | old_dst = sk->sk_dst_cache; | ||
1237 | sk->sk_dst_cache = NULL; | ||
1238 | dst_release(old_dst); | ||
1239 | } | 1338 | } |
1240 | 1339 | ||
1241 | static inline void | 1340 | static inline void |
1242 | sk_dst_reset(struct sock *sk) | 1341 | sk_dst_reset(struct sock *sk) |
1243 | { | 1342 | { |
1244 | write_lock(&sk->sk_dst_lock); | 1343 | spin_lock(&sk->sk_dst_lock); |
1245 | __sk_dst_reset(sk); | 1344 | __sk_dst_reset(sk); |
1246 | write_unlock(&sk->sk_dst_lock); | 1345 | spin_unlock(&sk->sk_dst_lock); |
1247 | } | 1346 | } |
1248 | 1347 | ||
1249 | extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | 1348 | extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); |
@@ -1257,6 +1356,12 @@ static inline int sk_can_gso(const struct sock *sk) | |||
1257 | 1356 | ||
1258 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); | 1357 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); |
1259 | 1358 | ||
1359 | static inline void sk_nocaps_add(struct sock *sk, int flags) | ||
1360 | { | ||
1361 | sk->sk_route_nocaps |= flags; | ||
1362 | sk->sk_route_caps &= ~flags; | ||
1363 | } | ||
1364 | |||
1260 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, | 1365 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, |
1261 | struct sk_buff *skb, struct page *page, | 1366 | struct sk_buff *skb, struct page *page, |
1262 | int off, int copy) | 1367 | int off, int copy) |
@@ -1314,12 +1419,12 @@ static inline int sk_has_allocations(const struct sock *sk) | |||
1314 | } | 1419 | } |
1315 | 1420 | ||
1316 | /** | 1421 | /** |
1317 | * sk_has_sleeper - check if there are any waiting processes | 1422 | * wq_has_sleeper - check if there are any waiting processes |
1318 | * @sk: socket | 1423 | * @wq: struct socket_wq |
1319 | * | 1424 | * |
1320 | * Returns true if socket has waiting processes | 1425 | * Returns true if socket_wq has waiting processes |
1321 | * | 1426 | * |
1322 | * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory | 1427 | * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory |
1323 | * barrier call. They were added due to the race found within the tcp code. | 1428 | * barrier call. They were added due to the race found within the tcp code. |
1324 | * | 1429 | * |
1325 | * Consider following tcp code paths: | 1430 | * Consider following tcp code paths: |
@@ -1332,9 +1437,10 @@ static inline int sk_has_allocations(const struct sock *sk) | |||
1332 | * ... ... | 1437 | * ... ... |
1333 | * tp->rcv_nxt check sock_def_readable | 1438 | * tp->rcv_nxt check sock_def_readable |
1334 | * ... { | 1439 | * ... { |
1335 | * schedule ... | 1440 | * schedule rcu_read_lock(); |
1336 | * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1441 | * wq = rcu_dereference(sk->sk_wq); |
1337 | * wake_up_interruptible(sk->sk_sleep) | 1442 | * if (wq && waitqueue_active(&wq->wait)) |
1443 | * wake_up_interruptible(&wq->wait) | ||
1338 | * ... | 1444 | * ... |
1339 | * } | 1445 | * } |
1340 | * | 1446 | * |
@@ -1343,19 +1449,18 @@ static inline int sk_has_allocations(const struct sock *sk) | |||
1343 | * could then endup calling schedule and sleep forever if there are no more | 1449 | * could then endup calling schedule and sleep forever if there are no more |
1344 | * data on the socket. | 1450 | * data on the socket. |
1345 | * | 1451 | * |
1346 | * The sk_has_sleeper is always called right after a call to read_lock, so we | ||
1347 | * can use smp_mb__after_lock barrier. | ||
1348 | */ | 1452 | */ |
1349 | static inline int sk_has_sleeper(struct sock *sk) | 1453 | static inline bool wq_has_sleeper(struct socket_wq *wq) |
1350 | { | 1454 | { |
1455 | |||
1351 | /* | 1456 | /* |
1352 | * We need to be sure we are in sync with the | 1457 | * We need to be sure we are in sync with the |
1353 | * add_wait_queue modifications to the wait queue. | 1458 | * add_wait_queue modifications to the wait queue. |
1354 | * | 1459 | * |
1355 | * This memory barrier is paired in the sock_poll_wait. | 1460 | * This memory barrier is paired in the sock_poll_wait. |
1356 | */ | 1461 | */ |
1357 | smp_mb__after_lock(); | 1462 | smp_mb(); |
1358 | return sk->sk_sleep && waitqueue_active(sk->sk_sleep); | 1463 | return wq && waitqueue_active(&wq->wait); |
1359 | } | 1464 | } |
1360 | 1465 | ||
1361 | /** | 1466 | /** |
@@ -1364,7 +1469,7 @@ static inline int sk_has_sleeper(struct sock *sk) | |||
1364 | * @wait_address: socket wait queue | 1469 | * @wait_address: socket wait queue |
1365 | * @p: poll_table | 1470 | * @p: poll_table |
1366 | * | 1471 | * |
1367 | * See the comments in the sk_has_sleeper function. | 1472 | * See the comments in the wq_has_sleeper function. |
1368 | */ | 1473 | */ |
1369 | static inline void sock_poll_wait(struct file *filp, | 1474 | static inline void sock_poll_wait(struct file *filp, |
1370 | wait_queue_head_t *wait_address, poll_table *p) | 1475 | wait_queue_head_t *wait_address, poll_table *p) |
@@ -1375,7 +1480,7 @@ static inline void sock_poll_wait(struct file *filp, | |||
1375 | * We need to be sure we are in sync with the | 1480 | * We need to be sure we are in sync with the |
1376 | * socket flags modification. | 1481 | * socket flags modification. |
1377 | * | 1482 | * |
1378 | * This memory barrier is paired in the sk_has_sleeper. | 1483 | * This memory barrier is paired in the wq_has_sleeper. |
1379 | */ | 1484 | */ |
1380 | smp_mb(); | 1485 | smp_mb(); |
1381 | } | 1486 | } |
@@ -1419,20 +1524,7 @@ extern void sk_stop_timer(struct sock *sk, struct timer_list* timer); | |||
1419 | 1524 | ||
1420 | extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | 1525 | extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); |
1421 | 1526 | ||
1422 | static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | 1527 | extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); |
1423 | { | ||
1424 | /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces | ||
1425 | number of warnings when compiling with -W --ANK | ||
1426 | */ | ||
1427 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | ||
1428 | (unsigned)sk->sk_rcvbuf) | ||
1429 | return -ENOMEM; | ||
1430 | skb_set_owner_r(skb, sk); | ||
1431 | skb_queue_tail(&sk->sk_error_queue, skb); | ||
1432 | if (!sock_flag(sk, SOCK_DEAD)) | ||
1433 | sk->sk_data_ready(sk, skb->len); | ||
1434 | return 0; | ||
1435 | } | ||
1436 | 1528 | ||
1437 | /* | 1529 | /* |
1438 | * Recover an error report and clear atomically | 1530 | * Recover an error report and clear atomically |
@@ -1557,7 +1649,24 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
1557 | sk->sk_stamp = kt; | 1649 | sk->sk_stamp = kt; |
1558 | } | 1650 | } |
1559 | 1651 | ||
1560 | extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); | 1652 | extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, |
1653 | struct sk_buff *skb); | ||
1654 | |||
1655 | static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | ||
1656 | struct sk_buff *skb) | ||
1657 | { | ||
1658 | #define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \ | ||
1659 | (1UL << SOCK_RCVTSTAMP) | \ | ||
1660 | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \ | ||
1661 | (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ | ||
1662 | (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ | ||
1663 | (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE)) | ||
1664 | |||
1665 | if (sk->sk_flags & FLAGS_TS_OR_DROPS) | ||
1666 | __sock_recv_ts_and_drops(msg, sk, skb); | ||
1667 | else | ||
1668 | sk->sk_stamp = skb->tstamp; | ||
1669 | } | ||
1561 | 1670 | ||
1562 | /** | 1671 | /** |
1563 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | 1672 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped |
@@ -1602,19 +1711,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1602 | static inline | 1711 | static inline |
1603 | struct net *sock_net(const struct sock *sk) | 1712 | struct net *sock_net(const struct sock *sk) |
1604 | { | 1713 | { |
1605 | #ifdef CONFIG_NET_NS | 1714 | return read_pnet(&sk->sk_net); |
1606 | return sk->sk_net; | ||
1607 | #else | ||
1608 | return &init_net; | ||
1609 | #endif | ||
1610 | } | 1715 | } |
1611 | 1716 | ||
1612 | static inline | 1717 | static inline |
1613 | void sock_net_set(struct sock *sk, struct net *net) | 1718 | void sock_net_set(struct sock *sk, struct net *net) |
1614 | { | 1719 | { |
1615 | #ifdef CONFIG_NET_NS | 1720 | write_pnet(&sk->sk_net, net); |
1616 | sk->sk_net = net; | ||
1617 | #endif | ||
1618 | } | 1721 | } |
1619 | 1722 | ||
1620 | /* | 1723 | /* |
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h index ceac661cdfd5..cfe2943690ff 100644 --- a/include/net/tc_act/tc_mirred.h +++ b/include/net/tc_act/tc_mirred.h | |||
@@ -9,6 +9,7 @@ struct tcf_mirred { | |||
9 | int tcfm_ifindex; | 9 | int tcfm_ifindex; |
10 | int tcfm_ok_push; | 10 | int tcfm_ok_push; |
11 | struct net_device *tcfm_dev; | 11 | struct net_device *tcfm_dev; |
12 | struct list_head tcfm_list; | ||
12 | }; | 13 | }; |
13 | #define to_mirred(pc) \ | 14 | #define to_mirred(pc) \ |
14 | container_of(pc, struct tcf_mirred, common) | 15 | container_of(pc, struct tcf_mirred, common) |
diff --git a/include/net/tcp.h b/include/net/tcp.h index aa04b9a5093b..3e4b33e36602 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) | |||
268 | return seq3 - seq2 >= seq1 - seq2; | 268 | return seq3 - seq2 >= seq1 - seq2; |
269 | } | 269 | } |
270 | 270 | ||
271 | static inline int tcp_too_many_orphans(struct sock *sk, int num) | 271 | static inline bool tcp_too_many_orphans(struct sock *sk, int shift) |
272 | { | 272 | { |
273 | return (num > sysctl_tcp_max_orphans) || | 273 | struct percpu_counter *ocp = sk->sk_prot->orphan_count; |
274 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | 274 | int orphans = percpu_counter_read_positive(ocp); |
275 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | 275 | |
276 | if (orphans << shift > sysctl_tcp_max_orphans) { | ||
277 | orphans = percpu_counter_sum_positive(ocp); | ||
278 | if (orphans << shift > sysctl_tcp_max_orphans) | ||
279 | return true; | ||
280 | } | ||
281 | |||
282 | if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | ||
283 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) | ||
284 | return true; | ||
285 | return false; | ||
276 | } | 286 | } |
277 | 287 | ||
278 | /* syncookies: remember time of last synqueue overflow */ | 288 | /* syncookies: remember time of last synqueue overflow */ |
@@ -294,46 +304,32 @@ extern struct proto tcp_prot; | |||
294 | #define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) | 304 | #define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) |
295 | #define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) | 305 | #define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) |
296 | #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) | 306 | #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) |
297 | 307 | #define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) | |
298 | extern void tcp_v4_err(struct sk_buff *skb, u32); | 308 | |
299 | 309 | extern void tcp_v4_err(struct sk_buff *skb, u32); | |
300 | extern void tcp_shutdown (struct sock *sk, int how); | 310 | |
301 | 311 | extern void tcp_shutdown (struct sock *sk, int how); | |
302 | extern int tcp_v4_rcv(struct sk_buff *skb); | 312 | |
303 | 313 | extern int tcp_v4_rcv(struct sk_buff *skb); | |
304 | extern int tcp_v4_remember_stamp(struct sock *sk); | 314 | |
305 | 315 | extern int tcp_v4_remember_stamp(struct sock *sk); | |
306 | extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); | 316 | extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); |
307 | 317 | extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |
308 | extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, | 318 | size_t size); |
309 | struct msghdr *msg, size_t size); | 319 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, |
310 | extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); | 320 | size_t size, int flags); |
311 | 321 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | |
312 | extern int tcp_ioctl(struct sock *sk, | 322 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
313 | int cmd, | 323 | struct tcphdr *th, unsigned len); |
314 | unsigned long arg); | 324 | extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
315 | 325 | struct tcphdr *th, unsigned len); | |
316 | extern int tcp_rcv_state_process(struct sock *sk, | 326 | extern void tcp_rcv_space_adjust(struct sock *sk); |
317 | struct sk_buff *skb, | 327 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); |
318 | struct tcphdr *th, | 328 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); |
319 | unsigned len); | 329 | extern void tcp_twsk_destructor(struct sock *sk); |
320 | 330 | extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, | |
321 | extern int tcp_rcv_established(struct sock *sk, | 331 | struct pipe_inode_info *pipe, size_t len, |
322 | struct sk_buff *skb, | 332 | unsigned int flags); |
323 | struct tcphdr *th, | ||
324 | unsigned len); | ||
325 | |||
326 | extern void tcp_rcv_space_adjust(struct sock *sk); | ||
327 | |||
328 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | ||
329 | |||
330 | extern int tcp_twsk_unique(struct sock *sk, | ||
331 | struct sock *sktw, void *twp); | ||
332 | |||
333 | extern void tcp_twsk_destructor(struct sock *sk); | ||
334 | |||
335 | extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, | ||
336 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | ||
337 | 333 | ||
338 | static inline void tcp_dec_quickack_mode(struct sock *sk, | 334 | static inline void tcp_dec_quickack_mode(struct sock *sk, |
339 | const unsigned int pkts) | 335 | const unsigned int pkts) |
@@ -371,88 +367,59 @@ enum tcp_tw_status { | |||
371 | }; | 367 | }; |
372 | 368 | ||
373 | 369 | ||
374 | extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, | 370 | extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, |
375 | struct sk_buff *skb, | 371 | struct sk_buff *skb, |
376 | const struct tcphdr *th); | 372 | const struct tcphdr *th); |
377 | 373 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | |
378 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | 374 | struct request_sock *req, |
379 | struct request_sock *req, | 375 | struct request_sock **prev); |
380 | struct request_sock **prev); | 376 | extern int tcp_child_process(struct sock *parent, struct sock *child, |
381 | extern int tcp_child_process(struct sock *parent, | 377 | struct sk_buff *skb); |
382 | struct sock *child, | 378 | extern int tcp_use_frto(struct sock *sk); |
383 | struct sk_buff *skb); | 379 | extern void tcp_enter_frto(struct sock *sk); |
384 | extern int tcp_use_frto(struct sock *sk); | 380 | extern void tcp_enter_loss(struct sock *sk, int how); |
385 | extern void tcp_enter_frto(struct sock *sk); | 381 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
386 | extern void tcp_enter_loss(struct sock *sk, int how); | 382 | extern void tcp_update_metrics(struct sock *sk); |
387 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 383 | extern void tcp_close(struct sock *sk, long timeout); |
388 | extern void tcp_update_metrics(struct sock *sk); | 384 | extern unsigned int tcp_poll(struct file * file, struct socket *sock, |
389 | 385 | struct poll_table_struct *wait); | |
390 | extern void tcp_close(struct sock *sk, | 386 | extern int tcp_getsockopt(struct sock *sk, int level, int optname, |
391 | long timeout); | 387 | char __user *optval, int __user *optlen); |
392 | extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); | 388 | extern int tcp_setsockopt(struct sock *sk, int level, int optname, |
393 | 389 | char __user *optval, unsigned int optlen); | |
394 | extern int tcp_getsockopt(struct sock *sk, int level, | 390 | extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname, |
395 | int optname, | 391 | char __user *optval, int __user *optlen); |
396 | char __user *optval, | 392 | extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname, |
397 | int __user *optlen); | 393 | char __user *optval, unsigned int optlen); |
398 | extern int tcp_setsockopt(struct sock *sk, int level, | 394 | extern void tcp_set_keepalive(struct sock *sk, int val); |
399 | int optname, char __user *optval, | 395 | extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); |
400 | unsigned int optlen); | 396 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
401 | extern int compat_tcp_getsockopt(struct sock *sk, | 397 | size_t len, int nonblock, int flags, int *addr_len); |
402 | int level, int optname, | 398 | extern void tcp_parse_options(struct sk_buff *skb, |
403 | char __user *optval, int __user *optlen); | 399 | struct tcp_options_received *opt_rx, u8 **hvpp, |
404 | extern int compat_tcp_setsockopt(struct sock *sk, | 400 | int estab); |
405 | int level, int optname, | 401 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); |
406 | char __user *optval, unsigned int optlen); | ||
407 | extern void tcp_set_keepalive(struct sock *sk, int val); | ||
408 | extern void tcp_syn_ack_timeout(struct sock *sk, | ||
409 | struct request_sock *req); | ||
410 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | ||
411 | struct msghdr *msg, | ||
412 | size_t len, int nonblock, | ||
413 | int flags, int *addr_len); | ||
414 | |||
415 | extern void tcp_parse_options(struct sk_buff *skb, | ||
416 | struct tcp_options_received *opt_rx, | ||
417 | u8 **hvpp, | ||
418 | int estab); | ||
419 | |||
420 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); | ||
421 | 402 | ||
422 | /* | 403 | /* |
423 | * TCP v4 functions exported for the inet6 API | 404 | * TCP v4 functions exported for the inet6 API |
424 | */ | 405 | */ |
425 | 406 | ||
426 | extern void tcp_v4_send_check(struct sock *sk, int len, | 407 | extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); |
427 | struct sk_buff *skb); | 408 | extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); |
428 | 409 | extern struct sock * tcp_create_openreq_child(struct sock *sk, | |
429 | extern int tcp_v4_conn_request(struct sock *sk, | 410 | struct request_sock *req, |
430 | struct sk_buff *skb); | ||
431 | |||
432 | extern struct sock * tcp_create_openreq_child(struct sock *sk, | ||
433 | struct request_sock *req, | ||
434 | struct sk_buff *skb); | ||
435 | |||
436 | extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, | ||
437 | struct sk_buff *skb, | ||
438 | struct request_sock *req, | ||
439 | struct dst_entry *dst); | ||
440 | |||
441 | extern int tcp_v4_do_rcv(struct sock *sk, | ||
442 | struct sk_buff *skb); | 411 | struct sk_buff *skb); |
443 | 412 | extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |
444 | extern int tcp_v4_connect(struct sock *sk, | 413 | struct request_sock *req, |
445 | struct sockaddr *uaddr, | 414 | struct dst_entry *dst); |
446 | int addr_len); | 415 | extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); |
447 | 416 | extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |
448 | extern int tcp_connect(struct sock *sk); | 417 | int addr_len); |
449 | 418 | extern int tcp_connect(struct sock *sk); | |
450 | extern struct sk_buff * tcp_make_synack(struct sock *sk, | 419 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, |
451 | struct dst_entry *dst, | 420 | struct request_sock *req, |
452 | struct request_sock *req, | 421 | struct request_values *rvp); |
453 | struct request_values *rvp); | 422 | extern int tcp_disconnect(struct sock *sk, int flags); |
454 | |||
455 | extern int tcp_disconnect(struct sock *sk, int flags); | ||
456 | 423 | ||
457 | 424 | ||
458 | /* From syncookies.c */ | 425 | /* From syncookies.c */ |
@@ -463,7 +430,7 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | |||
463 | __u16 *mss); | 430 | __u16 *mss); |
464 | 431 | ||
465 | extern __u32 cookie_init_timestamp(struct request_sock *req); | 432 | extern __u32 cookie_init_timestamp(struct request_sock *req); |
466 | extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt); | 433 | extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *); |
467 | 434 | ||
468 | /* From net/ipv6/syncookies.c */ | 435 | /* From net/ipv6/syncookies.c */ |
469 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 436 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
@@ -484,10 +451,10 @@ extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); | |||
484 | 451 | ||
485 | extern void tcp_send_probe0(struct sock *); | 452 | extern void tcp_send_probe0(struct sock *); |
486 | extern void tcp_send_partial(struct sock *); | 453 | extern void tcp_send_partial(struct sock *); |
487 | extern int tcp_write_wakeup(struct sock *); | 454 | extern int tcp_write_wakeup(struct sock *); |
488 | extern void tcp_send_fin(struct sock *sk); | 455 | extern void tcp_send_fin(struct sock *sk); |
489 | extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); | 456 | extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); |
490 | extern int tcp_send_synack(struct sock *); | 457 | extern int tcp_send_synack(struct sock *); |
491 | extern void tcp_push_one(struct sock *, unsigned int mss_now); | 458 | extern void tcp_push_one(struct sock *, unsigned int mss_now); |
492 | extern void tcp_send_ack(struct sock *sk); | 459 | extern void tcp_send_ack(struct sock *sk); |
493 | extern void tcp_send_delayed_ack(struct sock *sk); | 460 | extern void tcp_send_delayed_ack(struct sock *sk); |
@@ -508,8 +475,22 @@ extern unsigned int tcp_current_mss(struct sock *sk); | |||
508 | /* Bound MSS / TSO packet size with the half of the window */ | 475 | /* Bound MSS / TSO packet size with the half of the window */ |
509 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | 476 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) |
510 | { | 477 | { |
511 | if (tp->max_window && pktsize > (tp->max_window >> 1)) | 478 | int cutoff; |
512 | return max(tp->max_window >> 1, 68U - tp->tcp_header_len); | 479 | |
480 | /* When peer uses tiny windows, there is no use in packetizing | ||
481 | * to sub-MSS pieces for the sake of SWS or making sure there | ||
482 | * are enough packets in the pipe for fast recovery. | ||
483 | * | ||
484 | * On the other hand, for extremely large MSS devices, handling | ||
485 | * smaller than MSS windows in this way does make sense. | ||
486 | */ | ||
487 | if (tp->max_window >= 512) | ||
488 | cutoff = (tp->max_window >> 1); | ||
489 | else | ||
490 | cutoff = tp->max_window; | ||
491 | |||
492 | if (cutoff && pktsize > cutoff) | ||
493 | return max_t(int, cutoff, 68U - tp->tcp_header_len); | ||
513 | else | 494 | else |
514 | return pktsize; | 495 | return pktsize; |
515 | } | 496 | } |
@@ -591,7 +572,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp) | |||
591 | * scaling applied to the result. The caller does these things | 572 | * scaling applied to the result. The caller does these things |
592 | * if necessary. This is a "raw" window selection. | 573 | * if necessary. This is a "raw" window selection. |
593 | */ | 574 | */ |
594 | extern u32 __tcp_select_window(struct sock *sk); | 575 | extern u32 __tcp_select_window(struct sock *sk); |
595 | 576 | ||
596 | /* TCP timestamps are only 32-bits, this causes a slight | 577 | /* TCP timestamps are only 32-bits, this causes a slight |
597 | * complication on 64-bit systems since we store a snapshot | 578 | * complication on 64-bit systems since we store a snapshot |
@@ -601,12 +582,22 @@ extern u32 __tcp_select_window(struct sock *sk); | |||
601 | */ | 582 | */ |
602 | #define tcp_time_stamp ((__u32)(jiffies)) | 583 | #define tcp_time_stamp ((__u32)(jiffies)) |
603 | 584 | ||
585 | #define tcp_flag_byte(th) (((u_int8_t *)th)[13]) | ||
586 | |||
587 | #define TCPHDR_FIN 0x01 | ||
588 | #define TCPHDR_SYN 0x02 | ||
589 | #define TCPHDR_RST 0x04 | ||
590 | #define TCPHDR_PSH 0x08 | ||
591 | #define TCPHDR_ACK 0x10 | ||
592 | #define TCPHDR_URG 0x20 | ||
593 | #define TCPHDR_ECE 0x40 | ||
594 | #define TCPHDR_CWR 0x80 | ||
595 | |||
604 | /* This is what the send packet queuing engine uses to pass | 596 | /* This is what the send packet queuing engine uses to pass |
605 | * TCP per-packet control information to the transmission | 597 | * TCP per-packet control information to the transmission code. |
606 | * code. We also store the host-order sequence numbers in | 598 | * We also store the host-order sequence numbers in here too. |
607 | * here too. This is 36 bytes on 32-bit architectures, | 599 | * This is 44 bytes if IPV6 is enabled. |
608 | * 40 bytes on 64-bit machines, if this grows please adjust | 600 | * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately. |
609 | * skbuff.h:skbuff->cb[xxx] size appropriately. | ||
610 | */ | 601 | */ |
611 | struct tcp_skb_cb { | 602 | struct tcp_skb_cb { |
612 | union { | 603 | union { |
@@ -619,19 +610,6 @@ struct tcp_skb_cb { | |||
619 | __u32 end_seq; /* SEQ + FIN + SYN + datalen */ | 610 | __u32 end_seq; /* SEQ + FIN + SYN + datalen */ |
620 | __u32 when; /* used to compute rtt's */ | 611 | __u32 when; /* used to compute rtt's */ |
621 | __u8 flags; /* TCP header flags. */ | 612 | __u8 flags; /* TCP header flags. */ |
622 | |||
623 | /* NOTE: These must match up to the flags byte in a | ||
624 | * real TCP header. | ||
625 | */ | ||
626 | #define TCPCB_FLAG_FIN 0x01 | ||
627 | #define TCPCB_FLAG_SYN 0x02 | ||
628 | #define TCPCB_FLAG_RST 0x04 | ||
629 | #define TCPCB_FLAG_PSH 0x08 | ||
630 | #define TCPCB_FLAG_ACK 0x10 | ||
631 | #define TCPCB_FLAG_URG 0x20 | ||
632 | #define TCPCB_FLAG_ECE 0x40 | ||
633 | #define TCPCB_FLAG_CWR 0x80 | ||
634 | |||
635 | __u8 sacked; /* State flags for SACK/FACK. */ | 613 | __u8 sacked; /* State flags for SACK/FACK. */ |
636 | #define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ | 614 | #define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ |
637 | #define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ | 615 | #define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ |
@@ -939,7 +917,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) | |||
939 | 917 | ||
940 | tp->ucopy.memory = 0; | 918 | tp->ucopy.memory = 0; |
941 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | 919 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { |
942 | wake_up_interruptible_sync_poll(sk->sk_sleep, | 920 | wake_up_interruptible_sync_poll(sk_sleep(sk), |
943 | POLLIN | POLLRDNORM | POLLRDBAND); | 921 | POLLIN | POLLRDNORM | POLLRDBAND); |
944 | if (!inet_csk_ack_scheduled(sk)) | 922 | if (!inet_csk_ack_scheduled(sk)) |
945 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | 923 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, |
@@ -1032,6 +1010,14 @@ static inline int keepalive_probes(const struct tcp_sock *tp) | |||
1032 | return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; | 1010 | return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; |
1033 | } | 1011 | } |
1034 | 1012 | ||
1013 | static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) | ||
1014 | { | ||
1015 | const struct inet_connection_sock *icsk = &tp->inet_conn; | ||
1016 | |||
1017 | return min_t(u32, tcp_time_stamp - icsk->icsk_ack.lrcvtime, | ||
1018 | tcp_time_stamp - tp->rcv_tstamp); | ||
1019 | } | ||
1020 | |||
1035 | static inline int tcp_fin_time(const struct sock *sk) | 1021 | static inline int tcp_fin_time(const struct sock *sk) |
1036 | { | 1022 | { |
1037 | int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; | 1023 | int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; |
@@ -1167,22 +1153,14 @@ struct tcp_md5sig_pool { | |||
1167 | #define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ | 1153 | #define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ |
1168 | 1154 | ||
1169 | /* - functions */ | 1155 | /* - functions */ |
1170 | extern int tcp_v4_md5_hash_skb(char *md5_hash, | 1156 | extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
1171 | struct tcp_md5sig_key *key, | 1157 | struct sock *sk, struct request_sock *req, |
1172 | struct sock *sk, | 1158 | struct sk_buff *skb); |
1173 | struct request_sock *req, | 1159 | extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, |
1174 | struct sk_buff *skb); | 1160 | struct sock *addr_sk); |
1175 | 1161 | extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, | |
1176 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 1162 | u8 newkeylen); |
1177 | struct sock *addr_sk); | 1163 | extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); |
1178 | |||
1179 | extern int tcp_v4_md5_do_add(struct sock *sk, | ||
1180 | __be32 addr, | ||
1181 | u8 *newkey, | ||
1182 | u8 newkeylen); | ||
1183 | |||
1184 | extern int tcp_v4_md5_do_del(struct sock *sk, | ||
1185 | __be32 addr); | ||
1186 | 1164 | ||
1187 | #ifdef CONFIG_TCP_MD5SIG | 1165 | #ifdef CONFIG_TCP_MD5SIG |
1188 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ | 1166 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ |
@@ -1195,10 +1173,10 @@ extern int tcp_v4_md5_do_del(struct sock *sk, | |||
1195 | #endif | 1173 | #endif |
1196 | 1174 | ||
1197 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); | 1175 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); |
1198 | extern void tcp_free_md5sig_pool(void); | 1176 | extern void tcp_free_md5sig_pool(void); |
1199 | 1177 | ||
1200 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); | 1178 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); |
1201 | extern void tcp_put_md5sig_pool(void); | 1179 | extern void tcp_put_md5sig_pool(void); |
1202 | 1180 | ||
1203 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | 1181 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); |
1204 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, | 1182 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, |
@@ -1404,7 +1382,8 @@ struct tcp_iter_state { | |||
1404 | sa_family_t family; | 1382 | sa_family_t family; |
1405 | enum tcp_seq_states state; | 1383 | enum tcp_seq_states state; |
1406 | struct sock *syn_wait_sk; | 1384 | struct sock *syn_wait_sk; |
1407 | int bucket, sbucket, num, uid; | 1385 | int bucket, offset, sbucket, num, uid; |
1386 | loff_t last_pos; | ||
1408 | }; | 1387 | }; |
1409 | 1388 | ||
1410 | extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); | 1389 | extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); |
@@ -1425,7 +1404,7 @@ extern int tcp_gro_complete(struct sk_buff *skb); | |||
1425 | extern int tcp4_gro_complete(struct sk_buff *skb); | 1404 | extern int tcp4_gro_complete(struct sk_buff *skb); |
1426 | 1405 | ||
1427 | #ifdef CONFIG_PROC_FS | 1406 | #ifdef CONFIG_PROC_FS |
1428 | extern int tcp4_proc_init(void); | 1407 | extern int tcp4_proc_init(void); |
1429 | extern void tcp4_proc_exit(void); | 1408 | extern void tcp4_proc_exit(void); |
1430 | #endif | 1409 | #endif |
1431 | 1410 | ||
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h index 9566608c88cf..15af6dca0b49 100644 --- a/include/net/tipc/tipc.h +++ b/include/net/tipc/tipc.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * include/net/tipc/tipc.h: Main include file for TIPC users | 2 | * include/net/tipc/tipc.h: Main include file for TIPC users |
3 | * | 3 | * |
4 | * Copyright (c) 2003-2006, Ericsson AB | 4 | * Copyright (c) 2003-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005,2010 Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -126,7 +126,7 @@ int tipc_createport(unsigned int tipc_user, | |||
126 | tipc_msg_event message_cb, | 126 | tipc_msg_event message_cb, |
127 | tipc_named_msg_event named_message_cb, | 127 | tipc_named_msg_event named_message_cb, |
128 | tipc_conn_msg_event conn_message_cb, | 128 | tipc_conn_msg_event conn_message_cb, |
129 | tipc_continue_event continue_event_cb,/* May be zero */ | 129 | tipc_continue_event continue_event_cb, |
130 | u32 *portref); | 130 | u32 *portref); |
131 | 131 | ||
132 | int tipc_deleteport(u32 portref); | 132 | int tipc_deleteport(u32 portref); |
@@ -145,13 +145,13 @@ int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable); | |||
145 | int tipc_publish(u32 portref, unsigned int scope, | 145 | int tipc_publish(u32 portref, unsigned int scope, |
146 | struct tipc_name_seq const *name_seq); | 146 | struct tipc_name_seq const *name_seq); |
147 | int tipc_withdraw(u32 portref, unsigned int scope, | 147 | int tipc_withdraw(u32 portref, unsigned int scope, |
148 | struct tipc_name_seq const *name_seq); /* 0: all */ | 148 | struct tipc_name_seq const *name_seq); |
149 | 149 | ||
150 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); | 150 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); |
151 | 151 | ||
152 | int tipc_disconnect(u32 portref); | 152 | int tipc_disconnect(u32 portref); |
153 | 153 | ||
154 | int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */ | 154 | int tipc_shutdown(u32 ref); |
155 | 155 | ||
156 | int tipc_isconnected(u32 portref, int *isconnected); | 156 | int tipc_isconnected(u32 portref, int *isconnected); |
157 | 157 | ||
@@ -176,7 +176,7 @@ int tipc_send_buf(u32 portref, | |||
176 | 176 | ||
177 | int tipc_send2name(u32 portref, | 177 | int tipc_send2name(u32 portref, |
178 | struct tipc_name const *name, | 178 | struct tipc_name const *name, |
179 | u32 domain, /* 0:own zone */ | 179 | u32 domain, |
180 | unsigned int num_sect, | 180 | unsigned int num_sect, |
181 | struct iovec const *msg_sect); | 181 | struct iovec const *msg_sect); |
182 | 182 | ||
@@ -188,7 +188,7 @@ int tipc_send_buf2name(u32 portref, | |||
188 | 188 | ||
189 | int tipc_forward2name(u32 portref, | 189 | int tipc_forward2name(u32 portref, |
190 | struct tipc_name const *name, | 190 | struct tipc_name const *name, |
191 | u32 domain, /*0: own zone */ | 191 | u32 domain, |
192 | unsigned int section_count, | 192 | unsigned int section_count, |
193 | struct iovec const *msg_sect, | 193 | struct iovec const *msg_sect, |
194 | struct tipc_portid const *origin, | 194 | struct tipc_portid const *origin, |
@@ -228,14 +228,14 @@ int tipc_forward_buf2port(u32 portref, | |||
228 | 228 | ||
229 | int tipc_multicast(u32 portref, | 229 | int tipc_multicast(u32 portref, |
230 | struct tipc_name_seq const *seq, | 230 | struct tipc_name_seq const *seq, |
231 | u32 domain, /* 0:own zone */ | 231 | u32 domain, /* currently unused */ |
232 | unsigned int section_count, | 232 | unsigned int section_count, |
233 | struct iovec const *msg); | 233 | struct iovec const *msg); |
234 | 234 | ||
235 | #if 0 | 235 | #if 0 |
236 | int tipc_multicast_buf(u32 portref, | 236 | int tipc_multicast_buf(u32 portref, |
237 | struct tipc_name_seq const *seq, | 237 | struct tipc_name_seq const *seq, |
238 | u32 domain, /* 0:own zone */ | 238 | u32 domain, |
239 | void *buf, | 239 | void *buf, |
240 | unsigned int size); | 240 | unsigned int size); |
241 | #endif | 241 | #endif |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index d65381cad0fc..42a0eb68b7b6 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -44,7 +44,8 @@ extern int datagram_send_ctl(struct net *net, | |||
44 | struct msghdr *msg, | 44 | struct msghdr *msg, |
45 | struct flowi *fl, | 45 | struct flowi *fl, |
46 | struct ipv6_txoptions *opt, | 46 | struct ipv6_txoptions *opt, |
47 | int *hlimit, int *tclass); | 47 | int *hlimit, int *tclass, |
48 | int *dontfrag); | ||
48 | 49 | ||
49 | #define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) | 50 | #define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) |
50 | 51 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 5348d80b25bb..a184d3496b13 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -151,36 +151,35 @@ static inline void udp_lib_hash(struct sock *sk) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | extern void udp_lib_unhash(struct sock *sk); | 153 | extern void udp_lib_unhash(struct sock *sk); |
154 | extern void udp_lib_rehash(struct sock *sk, u16 new_hash); | ||
154 | 155 | ||
155 | static inline void udp_lib_close(struct sock *sk, long timeout) | 156 | static inline void udp_lib_close(struct sock *sk, long timeout) |
156 | { | 157 | { |
157 | sk_common_release(sk); | 158 | sk_common_release(sk); |
158 | } | 159 | } |
159 | 160 | ||
160 | extern int udp_lib_get_port(struct sock *sk, unsigned short snum, | 161 | extern int udp_lib_get_port(struct sock *sk, unsigned short snum, |
161 | int (*)(const struct sock *,const struct sock *), | 162 | int (*)(const struct sock *,const struct sock *), |
162 | unsigned int hash2_nulladdr); | 163 | unsigned int hash2_nulladdr); |
163 | 164 | ||
164 | /* net/ipv4/udp.c */ | 165 | /* net/ipv4/udp.c */ |
165 | extern int udp_get_port(struct sock *sk, unsigned short snum, | 166 | extern int udp_get_port(struct sock *sk, unsigned short snum, |
166 | int (*saddr_cmp)(const struct sock *, const struct sock *)); | 167 | int (*saddr_cmp)(const struct sock *, |
167 | extern void udp_err(struct sk_buff *, u32); | 168 | const struct sock *)); |
168 | 169 | extern void udp_err(struct sk_buff *, u32); | |
169 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, | 170 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, |
170 | struct msghdr *msg, size_t len); | 171 | struct msghdr *msg, size_t len); |
171 | extern void udp_flush_pending_frames(struct sock *sk); | 172 | extern void udp_flush_pending_frames(struct sock *sk); |
172 | 173 | extern int udp_rcv(struct sk_buff *skb); | |
173 | extern int udp_rcv(struct sk_buff *skb); | 174 | extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
174 | extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 175 | extern int udp_disconnect(struct sock *sk, int flags); |
175 | extern int udp_disconnect(struct sock *sk, int flags); | ||
176 | extern unsigned int udp_poll(struct file *file, struct socket *sock, | 176 | extern unsigned int udp_poll(struct file *file, struct socket *sock, |
177 | poll_table *wait); | 177 | poll_table *wait); |
178 | extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, | 178 | extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, |
179 | char __user *optval, int __user *optlen); | 179 | char __user *optval, int __user *optlen); |
180 | extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | 180 | extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, |
181 | char __user *optval, unsigned int optlen, | 181 | char __user *optval, unsigned int optlen, |
182 | int (*push_pending_frames)(struct sock *)); | 182 | int (*push_pending_frames)(struct sock *)); |
183 | |||
184 | extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | 183 | extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, |
185 | __be32 daddr, __be16 dport, | 184 | __be32 daddr, __be16 dport, |
186 | int dif); | 185 | int dif); |
@@ -236,7 +235,7 @@ struct udp_iter_state { | |||
236 | extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); | 235 | extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); |
237 | extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); | 236 | extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); |
238 | 237 | ||
239 | extern int udp4_proc_init(void); | 238 | extern int udp4_proc_init(void); |
240 | extern void udp4_proc_exit(void); | 239 | extern void udp4_proc_exit(void); |
241 | #endif | 240 | #endif |
242 | 241 | ||
diff --git a/include/net/x25.h b/include/net/x25.h index 468551ea4f1d..1479cb4a41fc 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
@@ -80,8 +80,6 @@ enum { | |||
80 | #define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ | 80 | #define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ |
81 | #define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ | 81 | #define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ |
82 | #define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ | 82 | #define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ |
83 | #define X25_DENY_ACCPT_APPRV 0x01 /* Default value */ | ||
84 | #define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */ | ||
85 | 83 | ||
86 | #define X25_SMODULUS 8 | 84 | #define X25_SMODULUS 8 |
87 | #define X25_EMODULUS 128 | 85 | #define X25_EMODULUS 128 |
@@ -113,6 +111,11 @@ enum { | |||
113 | #define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ | 111 | #define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ |
114 | #define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ | 112 | #define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ |
115 | 113 | ||
114 | /* Bitset in x25_sock->flags for misc flags */ | ||
115 | #define X25_Q_BIT_FLAG 0 | ||
116 | #define X25_INTERRUPT_FLAG 1 | ||
117 | #define X25_ACCPT_APPRV_FLAG 2 | ||
118 | |||
116 | /** | 119 | /** |
117 | * struct x25_route - x25 routing entry | 120 | * struct x25_route - x25 routing entry |
118 | * @node - entry in x25_list_lock | 121 | * @node - entry in x25_list_lock |
@@ -146,10 +149,11 @@ struct x25_sock { | |||
146 | struct x25_address source_addr, dest_addr; | 149 | struct x25_address source_addr, dest_addr; |
147 | struct x25_neigh *neighbour; | 150 | struct x25_neigh *neighbour; |
148 | unsigned int lci, cudmatchlength; | 151 | unsigned int lci, cudmatchlength; |
149 | unsigned char state, condition, qbitincl, intflag, accptapprv; | 152 | unsigned char state, condition; |
150 | unsigned short vs, vr, va, vl; | 153 | unsigned short vs, vr, va, vl; |
151 | unsigned long t2, t21, t22, t23; | 154 | unsigned long t2, t21, t22, t23; |
152 | unsigned short fraglen; | 155 | unsigned short fraglen; |
156 | unsigned long flags; | ||
153 | struct sk_buff_head ack_queue; | 157 | struct sk_buff_head ack_queue; |
154 | struct sk_buff_head fragment_queue; | 158 | struct sk_buff_head fragment_queue; |
155 | struct sk_buff_head interrupt_in_queue; | 159 | struct sk_buff_head interrupt_in_queue; |
diff --git a/include/net/x25device.h b/include/net/x25device.h index 1415bcf93980..1fa08b49f1c2 100644 --- a/include/net/x25device.h +++ b/include/net/x25device.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/if_ether.h> | 4 | #include <linux/if_ether.h> |
5 | #include <linux/if_packet.h> | 5 | #include <linux/if_packet.h> |
6 | #include <linux/if_x25.h> | ||
6 | #include <linux/skbuff.h> | 7 | #include <linux/skbuff.h> |
7 | 8 | ||
8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) | 9 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index ac52f33f3e4a..4f53532d4c2f 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <net/route.h> | 20 | #include <net/route.h> |
21 | #include <net/ipv6.h> | 21 | #include <net/ipv6.h> |
22 | #include <net/ip6_fib.h> | 22 | #include <net/ip6_fib.h> |
23 | #include <net/flow.h> | ||
23 | 24 | ||
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | 26 | ||
@@ -267,7 +268,6 @@ struct xfrm_policy_afinfo { | |||
267 | xfrm_address_t *saddr, | 268 | xfrm_address_t *saddr, |
268 | xfrm_address_t *daddr); | 269 | xfrm_address_t *daddr); |
269 | int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); | 270 | int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); |
270 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | ||
271 | void (*decode_session)(struct sk_buff *skb, | 271 | void (*decode_session)(struct sk_buff *skb, |
272 | struct flowi *fl, | 272 | struct flowi *fl, |
273 | int reverse); | 273 | int reverse); |
@@ -298,8 +298,8 @@ struct xfrm_state_afinfo { | |||
298 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 298 | const struct xfrm_type *type_map[IPPROTO_MAX]; |
299 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 299 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
300 | int (*init_flags)(struct xfrm_state *x); | 300 | int (*init_flags)(struct xfrm_state *x); |
301 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 301 | void (*init_tempsel)(struct xfrm_selector *sel, struct flowi *fl); |
302 | struct xfrm_tmpl *tmpl, | 302 | void (*init_temprop)(struct xfrm_state *x, struct xfrm_tmpl *tmpl, |
303 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 303 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
304 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 304 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
305 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 305 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
@@ -482,13 +482,14 @@ struct xfrm_policy { | |||
482 | atomic_t refcnt; | 482 | atomic_t refcnt; |
483 | struct timer_list timer; | 483 | struct timer_list timer; |
484 | 484 | ||
485 | struct flow_cache_object flo; | ||
486 | atomic_t genid; | ||
485 | u32 priority; | 487 | u32 priority; |
486 | u32 index; | 488 | u32 index; |
487 | struct xfrm_mark mark; | 489 | struct xfrm_mark mark; |
488 | struct xfrm_selector selector; | 490 | struct xfrm_selector selector; |
489 | struct xfrm_lifetime_cfg lft; | 491 | struct xfrm_lifetime_cfg lft; |
490 | struct xfrm_lifetime_cur curlft; | 492 | struct xfrm_lifetime_cur curlft; |
491 | struct dst_entry *bundles; | ||
492 | struct xfrm_policy_walk_entry walk; | 493 | struct xfrm_policy_walk_entry walk; |
493 | u8 type; | 494 | u8 type; |
494 | u8 action; | 495 | u8 action; |
@@ -735,19 +736,12 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy) | |||
735 | xfrm_policy_destroy(policy); | 736 | xfrm_policy_destroy(policy); |
736 | } | 737 | } |
737 | 738 | ||
738 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
739 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) | 739 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) |
740 | { | 740 | { |
741 | int i; | 741 | int i; |
742 | for (i = npols - 1; i >= 0; --i) | 742 | for (i = npols - 1; i >= 0; --i) |
743 | xfrm_pol_put(pols[i]); | 743 | xfrm_pol_put(pols[i]); |
744 | } | 744 | } |
745 | #else | ||
746 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) | ||
747 | { | ||
748 | xfrm_pol_put(pols[0]); | ||
749 | } | ||
750 | #endif | ||
751 | 745 | ||
752 | extern void __xfrm_state_destroy(struct xfrm_state *); | 746 | extern void __xfrm_state_destroy(struct xfrm_state *); |
753 | 747 | ||
@@ -878,11 +872,15 @@ struct xfrm_dst { | |||
878 | struct rt6_info rt6; | 872 | struct rt6_info rt6; |
879 | } u; | 873 | } u; |
880 | struct dst_entry *route; | 874 | struct dst_entry *route; |
875 | struct flow_cache_object flo; | ||
876 | struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; | ||
877 | int num_pols, num_xfrms; | ||
881 | #ifdef CONFIG_XFRM_SUB_POLICY | 878 | #ifdef CONFIG_XFRM_SUB_POLICY |
882 | struct flowi *origin; | 879 | struct flowi *origin; |
883 | struct xfrm_selector *partner; | 880 | struct xfrm_selector *partner; |
884 | #endif | 881 | #endif |
885 | u32 genid; | 882 | u32 xfrm_genid; |
883 | u32 policy_genid; | ||
886 | u32 route_mtu_cached; | 884 | u32 route_mtu_cached; |
887 | u32 child_mtu_cached; | 885 | u32 child_mtu_cached; |
888 | u32 route_cookie; | 886 | u32 route_cookie; |
@@ -892,6 +890,7 @@ struct xfrm_dst { | |||
892 | #ifdef CONFIG_XFRM | 890 | #ifdef CONFIG_XFRM |
893 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) | 891 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) |
894 | { | 892 | { |
893 | xfrm_pols_put(xdst->pols, xdst->num_pols); | ||
895 | dst_release(xdst->route); | 894 | dst_release(xdst->route); |
896 | if (likely(xdst->u.dst.xfrm)) | 895 | if (likely(xdst->u.dst.xfrm)) |
897 | xfrm_state_put(xdst->u.dst.xfrm); | 896 | xfrm_state_put(xdst->u.dst.xfrm); |
@@ -1587,7 +1586,7 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | |||
1587 | static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) | 1586 | static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) |
1588 | { | 1587 | { |
1589 | if (attrs[XFRMA_MARK]) | 1588 | if (attrs[XFRMA_MARK]) |
1590 | memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m)); | 1589 | memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark)); |
1591 | else | 1590 | else |
1592 | m->v = m->m = 0; | 1591 | m->v = m->m = 0; |
1593 | 1592 | ||