aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/9p.h33
-rw-r--r--include/net/9p/client.h2
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/af_unix.h4
-rw-r--r--include/net/bluetooth/bluetooth.h3
-rw-r--r--include/net/bluetooth/hci.h187
-rw-r--r--include/net/bluetooth/hci_core.h28
-rw-r--r--include/net/bluetooth/l2cap.h34
-rw-r--r--include/net/bluetooth/rfcomm.h14
-rw-r--r--include/net/caif/caif_dev.h8
-rw-r--r--include/net/caif/caif_layer.h6
-rw-r--r--include/net/caif/caif_spi.h153
-rw-r--r--include/net/caif/cfcnfg.h16
-rw-r--r--include/net/caif/cfctrl.h4
-rw-r--r--include/net/caif/cfsrvl.h15
-rw-r--r--include/net/cfg80211.h15
-rw-r--r--include/net/cls_cgroup.h63
-rw-r--r--include/net/dn_dev.h8
-rw-r--r--include/net/dn_nsp.h16
-rw-r--r--include/net/dn_route.h4
-rw-r--r--include/net/dst.h6
-rw-r--r--include/net/genetlink.h15
-rw-r--r--include/net/inet_common.h59
-rw-r--r--include/net/inet_frag.h1
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h30
-rw-r--r--include/net/ip.h35
-rw-r--r--include/net/ip6_fib.h10
-rw-r--r--include/net/ip6_tunnel.h2
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h22
-rw-r--r--include/net/ipx.h8
-rw-r--r--include/net/mip6.h2
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h17
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h12
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netfilter/nf_nat_rule.h2
-rw-r--r--include/net/netfilter/xt_rateest.h11
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/phonet/pn_dev.h1
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/sch_generic.h58
-rw-r--r--include/net/scm.h30
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/snmp.h77
-rw-r--r--include/net/sock.h68
-rw-r--r--include/net/tcp.h260
-rw-r--r--include/net/udp.h38
-rw-r--r--include/net/xfrm.h2
52 files changed, 889 insertions, 519 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index a7fb54808a23..156c26bb8bd7 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -86,6 +86,10 @@ 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_TRENAME: rename request
92 * @P9_RRENAME: rename response
89 * @P9_TVERSION: version handshake request 93 * @P9_TVERSION: version handshake request
90 * @P9_RVERSION: version handshake response 94 * @P9_RVERSION: version handshake response
91 * @P9_TAUTH: request to establish authentication channel 95 * @P9_TAUTH: request to establish authentication channel
@@ -125,6 +129,10 @@ do { \
125 */ 129 */
126 130
127enum p9_msg_t { 131enum p9_msg_t {
132 P9_TSTATFS = 8,
133 P9_RSTATFS,
134 P9_TRENAME = 20,
135 P9_RRENAME,
128 P9_TVERSION = 100, 136 P9_TVERSION = 100,
129 P9_RVERSION, 137 P9_RVERSION,
130 P9_TAUTH = 102, 138 P9_TAUTH = 102,
@@ -350,6 +358,31 @@ struct p9_wstat {
350}; 358};
351 359
352/* Structures for Protocol Operations */ 360/* Structures for Protocol Operations */
361struct p9_tstatfs {
362 u32 fid;
363};
364
365struct p9_rstatfs {
366 u32 type;
367 u32 bsize;
368 u64 blocks;
369 u64 bfree;
370 u64 bavail;
371 u64 files;
372 u64 ffree;
373 u64 fsid;
374 u32 namelen;
375};
376
377struct p9_trename {
378 u32 fid;
379 u32 newdirfid;
380 struct p9_str name;
381};
382
383struct p9_rrename {
384};
385
353struct p9_tversion { 386struct p9_tversion {
354 u32 msize; 387 u32 msize;
355 struct p9_str version; 388 struct p9_str version;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4f3760afc20f..7dd3ed85c782 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -195,6 +195,8 @@ 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
198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
199int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
198int p9_client_version(struct p9_client *); 200int p9_client_version(struct p9_client *);
199struct p9_client *p9_client_create(const char *dev_name, char *options); 201struct p9_client *p9_client_create(const char *dev_name, char *options);
200void p9_client_destroy(struct p9_client *clnt); 202void p9_client_destroy(struct p9_client *clnt);
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
36struct tcf_police { 38struct tcf_police {
37 struct tcf_common common; 39 struct tcf_common common;
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 20725e213aee..90c9e2872f27 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -23,7 +23,8 @@ struct unix_address {
23}; 23};
24 24
25struct unix_skb_parms { 25struct 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 */
@@ -31,7 +32,6 @@ struct unix_skb_parms {
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)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ff77e8f882f1..27a902d9b3a9 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -84,7 +84,7 @@ enum {
84/* BD Address */ 84/* BD Address */
85typedef struct { 85typedef 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);
138struct bt_skb_cb { 138struct 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;
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
247struct hci_cp_disconnect { 250struct 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
253struct hci_cp_add_sco { 256struct 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
259struct hci_cp_create_conn_cancel { 262struct 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
264struct hci_cp_accept_conn_req { 267struct 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
270struct hci_cp_reject_conn_req { 273struct 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
276struct hci_cp_link_key_reply { 279struct 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
282struct hci_cp_link_key_neg_reply { 285struct 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
287struct hci_cp_pin_code_reply { 290struct 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
294struct hci_cp_pin_code_neg_reply { 297struct 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
299struct hci_cp_change_conn_ptype { 302struct 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
305struct hci_cp_auth_requested { 308struct 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
310struct hci_cp_set_conn_encrypt { 313struct 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
316struct hci_cp_change_conn_link_key { 319struct 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
321struct hci_cp_remote_name_req { 324struct 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
329struct hci_cp_remote_name_req_cancel { 332struct 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
334struct hci_cp_read_remote_features { 337struct 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
339struct hci_cp_read_remote_ext_features { 342struct 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
345struct hci_cp_read_remote_version { 348struct 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
350struct hci_cp_setup_sync_conn { 353struct 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
361struct hci_cp_accept_sync_conn_req { 364struct 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
372struct hci_cp_reject_sync_conn_req { 375struct 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
378struct hci_cp_sniff_mode { 381struct 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
387struct hci_cp_exit_sniff_mode { 390struct 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
392struct hci_cp_role_discovery { 395struct hci_cp_role_discovery {
393 __le16 handle; 396 __le16 handle;
394} __attribute__ ((packed)); 397} __packed;
395struct hci_rp_role_discovery { 398struct 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
402struct hci_cp_switch_role { 405struct 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
408struct hci_cp_read_link_policy { 411struct hci_cp_read_link_policy {
409 __le16 handle; 412 __le16 handle;
410} __attribute__ ((packed)); 413} __packed;
411struct hci_rp_read_link_policy { 414struct 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
418struct hci_cp_write_link_policy { 421struct hci_cp_write_link_policy {
419 __le16 handle; 422 __le16 handle;
420 __le16 policy; 423 __le16 policy;
421} __attribute__ ((packed)); 424} __packed;
422struct hci_rp_write_link_policy { 425struct 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
428struct hci_rp_read_def_link_policy { 431struct 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
434struct hci_cp_write_def_link_policy { 437struct 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
439struct hci_cp_sniff_subrate { 442struct 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
447struct hci_cp_set_event_mask { 450struct 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
475struct hci_cp_write_local_name { 478struct 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
480struct hci_rp_read_local_name { 483struct 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 {
508struct hci_rp_read_class_of_dev { 511struct 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
514struct hci_cp_write_class_of_dev { 517struct 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
519struct hci_rp_read_voice_setting { 522struct 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
525struct hci_cp_write_voice_setting { 528struct 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
530struct hci_cp_host_buffer_size { 533struct 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
538struct hci_rp_read_ssp_mode { 541struct 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
544struct hci_cp_write_ssp_mode { 547struct 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
549struct hci_rp_read_local_version { 552struct 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
559struct hci_rp_read_local_commands { 562struct 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
565struct hci_rp_read_local_features { 568struct 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
571struct hci_rp_read_local_ext_features { 574struct 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
579struct hci_rp_read_buffer_size { 582struct 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
588struct hci_rp_read_bd_addr { 591struct 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
607struct hci_ev_conn_complete { 610struct 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
616struct hci_ev_conn_request { 619struct 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
623struct hci_ev_disconn_complete { 626struct 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
630struct hci_ev_auth_complete { 633struct 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
636struct hci_ev_remote_name { 639struct 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
643struct hci_ev_encrypt_change { 646struct 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
650struct hci_ev_change_link_key_complete { 653struct 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
656struct hci_ev_remote_features { 659struct 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
663struct hci_ev_remote_version { 666struct 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
672struct hci_qos { 675struct 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;
679struct hci_ev_qos_setup_complete { 682struct 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
686struct hci_ev_cmd_complete { 689struct 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
692struct hci_ev_cmd_status { 695struct 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
699struct hci_ev_role_change { 702struct 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
706struct hci_ev_num_comp_pkts { 709struct 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
712struct hci_ev_mode_change { 715struct 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
720struct hci_ev_pin_code_req { 723struct 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
725struct hci_ev_link_key_req { 728struct 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
730struct hci_ev_link_key_notify { 733struct 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
737struct hci_ev_clock_offset { 740struct 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
744struct hci_ev_pkt_type_change { 747struct 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
751struct hci_ev_pscan_rep_mode { 754struct 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
757struct inquiry_info_with_rssi { 760struct 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;
765struct inquiry_info_with_rssi_and_pscan_mode { 768struct 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
776struct hci_ev_remote_ext_features { 779struct 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
785struct hci_ev_sync_conn_complete { 788struct 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
798struct hci_ev_sync_conn_changed { 801struct 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
808struct hci_ev_sniff_subrate { 811struct 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
818struct extended_inquiry_info { 821struct 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
829struct hci_ev_io_capa_request { 832struct 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
834struct hci_ev_simple_pair_complete { 837struct 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
840struct hci_ev_remote_host_features { 843struct 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
847struct hci_ev_stack_internal { 850struct 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
853struct hci_ev_si_device { 856struct 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
859struct hci_ev_si_security { 862struct 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 {
872struct hci_command_hdr { 875struct 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
877struct hci_event_hdr { 880struct hci_event_hdr {
878 __u8 evt; 881 __u8 evt;
879 __u8 plen; 882 __u8 plen;
880} __attribute__ ((packed)); 883} __packed;
881 884
882struct hci_acl_hdr { 885struct 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
887struct hci_sco_hdr { 890struct 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 e42f6ed5421c..350b3e6964bd 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
65struct bdaddr_list {
66 struct list_head list;
67 bdaddr_t bdaddr;
68};
69#define NUM_REASSEMBLY 4
65struct hci_dev { 70struct hci_dev {
66 struct list_head list; 71 struct list_head list;
67 spinlock_t lock; 72 spinlock_t lock;
@@ -118,7 +123,7 @@ struct hci_dev {
118 struct sk_buff_head cmd_q; 123 struct sk_buff_head cmd_q;
119 124
120 struct sk_buff *sent_cmd; 125 struct sk_buff *sent_cmd;
121 struct sk_buff *reassembly[3]; 126 struct sk_buff *reassembly[NUM_REASSEMBLY];
122 127
123 struct mutex req_lock; 128 struct mutex req_lock;
124 wait_queue_head_t req_wait_q; 129 wait_queue_head_t req_wait_q;
@@ -127,6 +132,7 @@ struct hci_dev {
127 132
128 struct inquiry_cache inq_cache; 133 struct inquiry_cache inq_cache;
129 struct hci_conn_hash conn_hash; 134 struct hci_conn_hash conn_hash;
135 struct bdaddr_list blacklist;
130 136
131 struct hci_dev_stats stat; 137 struct hci_dev_stats stat;
132 138
@@ -380,7 +386,7 @@ static inline void __hci_dev_put(struct hci_dev *d)
380} 386}
381 387
382static inline void hci_dev_put(struct hci_dev *d) 388static inline void hci_dev_put(struct hci_dev *d)
383{ 389{
384 __hci_dev_put(d); 390 __hci_dev_put(d);
385 module_put(d->owner); 391 module_put(d->owner);
386} 392}
@@ -424,10 +430,14 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
424int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); 430int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
425int hci_inquiry(void __user *arg); 431int hci_inquiry(void __user *arg);
426 432
433struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
434int hci_blacklist_clear(struct hci_dev *hdev);
435
427void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 436void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
428 437
429int hci_recv_frame(struct sk_buff *skb); 438int hci_recv_frame(struct sk_buff *skb);
430int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 439int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
440int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
431 441
432int hci_register_sysfs(struct hci_dev *hdev); 442int hci_register_sysfs(struct hci_dev *hdev);
433void hci_unregister_sysfs(struct hci_dev *hdev); 443void hci_unregister_sysfs(struct hci_dev *hdev);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7c695bfd853c..636724b203ee 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
@@ -129,31 +131,31 @@ struct l2cap_conninfo {
129struct l2cap_hdr { 131struct l2cap_hdr {
130 __le16 len; 132 __le16 len;
131 __le16 cid; 133 __le16 cid;
132} __attribute__ ((packed)); 134} __packed;
133#define L2CAP_HDR_SIZE 4 135#define L2CAP_HDR_SIZE 4
134 136
135struct l2cap_cmd_hdr { 137struct l2cap_cmd_hdr {
136 __u8 code; 138 __u8 code;
137 __u8 ident; 139 __u8 ident;
138 __le16 len; 140 __le16 len;
139} __attribute__ ((packed)); 141} __packed;
140#define L2CAP_CMD_HDR_SIZE 4 142#define L2CAP_CMD_HDR_SIZE 4
141 143
142struct l2cap_cmd_rej { 144struct l2cap_cmd_rej {
143 __le16 reason; 145 __le16 reason;
144} __attribute__ ((packed)); 146} __packed;
145 147
146struct l2cap_conn_req { 148struct l2cap_conn_req {
147 __le16 psm; 149 __le16 psm;
148 __le16 scid; 150 __le16 scid;
149} __attribute__ ((packed)); 151} __packed;
150 152
151struct l2cap_conn_rsp { 153struct l2cap_conn_rsp {
152 __le16 dcid; 154 __le16 dcid;
153 __le16 scid; 155 __le16 scid;
154 __le16 result; 156 __le16 result;
155 __le16 status; 157 __le16 status;
156} __attribute__ ((packed)); 158} __packed;
157 159
158/* channel indentifier */ 160/* channel indentifier */
159#define L2CAP_CID_SIGNALING 0x0001 161#define L2CAP_CID_SIGNALING 0x0001
@@ -177,14 +179,14 @@ struct l2cap_conf_req {
177 __le16 dcid; 179 __le16 dcid;
178 __le16 flags; 180 __le16 flags;
179 __u8 data[0]; 181 __u8 data[0];
180} __attribute__ ((packed)); 182} __packed;
181 183
182struct l2cap_conf_rsp { 184struct l2cap_conf_rsp {
183 __le16 scid; 185 __le16 scid;
184 __le16 flags; 186 __le16 flags;
185 __le16 result; 187 __le16 result;
186 __u8 data[0]; 188 __u8 data[0];
187} __attribute__ ((packed)); 189} __packed;
188 190
189#define L2CAP_CONF_SUCCESS 0x0000 191#define L2CAP_CONF_SUCCESS 0x0000
190#define L2CAP_CONF_UNACCEPT 0x0001 192#define L2CAP_CONF_UNACCEPT 0x0001
@@ -195,7 +197,7 @@ struct l2cap_conf_opt {
195 __u8 type; 197 __u8 type;
196 __u8 len; 198 __u8 len;
197 __u8 val[0]; 199 __u8 val[0];
198} __attribute__ ((packed)); 200} __packed;
199#define L2CAP_CONF_OPT_SIZE 2 201#define L2CAP_CONF_OPT_SIZE 2
200 202
201#define L2CAP_CONF_HINT 0x80 203#define L2CAP_CONF_HINT 0x80
@@ -216,7 +218,7 @@ struct l2cap_conf_rfc {
216 __le16 retrans_timeout; 218 __le16 retrans_timeout;
217 __le16 monitor_timeout; 219 __le16 monitor_timeout;
218 __le16 max_pdu_size; 220 __le16 max_pdu_size;
219} __attribute__ ((packed)); 221} __packed;
220 222
221#define L2CAP_MODE_BASIC 0x00 223#define L2CAP_MODE_BASIC 0x00
222#define L2CAP_MODE_RETRANS 0x01 224#define L2CAP_MODE_RETRANS 0x01
@@ -227,22 +229,22 @@ struct l2cap_conf_rfc {
227struct l2cap_disconn_req { 229struct l2cap_disconn_req {
228 __le16 dcid; 230 __le16 dcid;
229 __le16 scid; 231 __le16 scid;
230} __attribute__ ((packed)); 232} __packed;
231 233
232struct l2cap_disconn_rsp { 234struct l2cap_disconn_rsp {
233 __le16 dcid; 235 __le16 dcid;
234 __le16 scid; 236 __le16 scid;
235} __attribute__ ((packed)); 237} __packed;
236 238
237struct l2cap_info_req { 239struct l2cap_info_req {
238 __le16 type; 240 __le16 type;
239} __attribute__ ((packed)); 241} __packed;
240 242
241struct l2cap_info_rsp { 243struct l2cap_info_rsp {
242 __le16 type; 244 __le16 type;
243 __le16 result; 245 __le16 result;
244 __u8 data[0]; 246 __u8 data[0];
245} __attribute__ ((packed)); 247} __packed;
246 248
247/* info type */ 249/* info type */
248#define L2CAP_IT_CL_MTU 0x0001 250#define L2CAP_IT_CL_MTU 0x0001
@@ -287,6 +289,11 @@ struct l2cap_conn {
287 struct l2cap_chan_list chan_list; 289 struct l2cap_chan_list chan_list;
288}; 290};
289 291
292struct sock_del_list {
293 struct sock *sk;
294 struct list_head list;
295};
296
290#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 297#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
291#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 298#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
292#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 299#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
@@ -353,7 +360,6 @@ struct l2cap_pinfo {
353 360
354 __le16 sport; 361 __le16 sport;
355 362
356 spinlock_t send_lock;
357 struct timer_list retrans_timer; 363 struct timer_list retrans_timer;
358 struct timer_list monitor_timer; 364 struct timer_list monitor_timer;
359 struct timer_list ack_timer; 365 struct timer_list ack_timer;
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
111struct rfcomm_cmd { 111struct 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
118struct rfcomm_mcc { 118struct rfcomm_mcc {
119 u8 type; 119 u8 type;
120 u8 len; 120 u8 len;
121} __attribute__ ((packed)); 121} __packed;
122 122
123struct rfcomm_pn { 123struct 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
133struct rfcomm_rpn { 133struct 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
143struct rfcomm_rls { 143struct rfcomm_rls {
144 u8 dlci; 144 u8 dlci;
145 u8 status; 145 u8 status;
146} __attribute__ ((packed)); 146} __packed;
147 147
148struct rfcomm_msc { 148struct 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
index 318ab9478a44..6da573c75d54 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -50,6 +50,9 @@ struct caif_connect_request {
50 * @client_layer: User implementation of client layer. This layer 50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions 51 * MUST have receive and control callback functions
52 * implemented. 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.
53 * 56 *
54 * This function connects a CAIF channel. The Client must implement 57 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds 58 * the struct cflayer. This layer represents the Client layer and holds
@@ -59,8 +62,9 @@ struct caif_connect_request {
59 * E.g. CAIF Socket will call this function for each socket it connects 62 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket. 63 * and have one client_layer instance for each socket.
61 */ 64 */
62int caif_connect_client(struct caif_connect_request *config, 65int caif_connect_client(struct caif_connect_request *conn_req,
63 struct cflayer *client_layer); 66 struct cflayer *client_layer, int *ifindex,
67 int *headroom, int *tailroom);
64 68
65/** 69/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack. 70 * caif_disconnect_client - Disconnects a client from the CAIF stack.
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 25c472f0e5b8..c8b07a904e78 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -15,14 +15,8 @@ struct cfpktq;
15struct caif_payload_info; 15struct caif_payload_info;
16struct caif_packet_funcs; 16struct caif_packet_funcs;
17 17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22 18
23#define CAIF_LAYER_NAME_SZ 16 19#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26 20
27/** 21/**
28 * caif_assert() - Assert function for CAIF. 22 * caif_assert() - Assert function for CAIF.
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. */
55struct 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. */
65struct 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. */
72struct 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. */
82enum 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. */
99struct 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
135extern int spi_frm_align;
136extern int spi_up_head_align;
137extern int spi_up_tail_align;
138extern int spi_down_head_align;
139extern int spi_down_tail_align;
140extern struct platform_driver cfspi_spi_driver;
141
142void cfspi_dbg_state(struct cfspi *cfspi, int state);
143int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
144int cfspi_xmitlen(struct cfspi *cfspi);
145int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
146int cfspi_spi_remove(struct platform_device *pdev);
147int cfspi_spi_probe(struct platform_device *pdev);
148int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
149int cfspi_xmitlen(struct cfspi *cfspi);
150int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
151void 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
index 9fc2fc20b884..bd646faffa47 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -7,6 +7,7 @@
7#ifndef CFCNFG_H_ 7#ifndef CFCNFG_H_
8#define CFCNFG_H_ 8#define CFCNFG_H_
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/netdevice.h>
10#include <net/caif/caif_layer.h> 11#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h> 12#include <net/caif/cfctrl.h>
12 13
@@ -73,8 +74,8 @@ void cfcnfg_remove(struct cfcnfg *cfg);
73 74
74void 75void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, 76cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid, 77 struct net_device *dev, struct cflayer *phy_layer,
77 enum cfcnfg_phy_preference pref, 78 u16 *phyid, enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx); 79 bool fcs, bool stx);
79 80
80/** 81/**
@@ -114,11 +115,18 @@ void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
114 * @param: Link setup parameters. 115 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and 116 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure. 117 * flow-control functions MUST be set in the structure.
117 * 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.
118 */ 123 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, 124int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param, 125 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer); 126 struct cflayer *adap_layer,
127 int *ifindex,
128 int *proto_head,
129 int *proto_tail);
122 130
123/** 131/**
124 * cfcnfg_get_phyid() - Get physical ID, given type. 132 * cfcnfg_get_phyid() - Get physical ID, given type.
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
index 997603f2bf4c..9402543fc20d 100644
--- a/include/net/caif/cfctrl.h
+++ b/include/net/caif/cfctrl.h
@@ -94,8 +94,8 @@ struct cfctrl_request_info {
94 enum cfctrl_cmd cmd; 94 enum cfctrl_cmd cmd;
95 u8 channel_id; 95 u8 channel_id;
96 struct cfctrl_link_param param; 96 struct cfctrl_link_param param;
97 struct cfctrl_request_info *next;
98 struct cflayer *client_layer; 97 struct cflayer *client_layer;
98 struct list_head list;
99}; 99};
100 100
101struct cfctrl { 101struct cfctrl {
@@ -103,7 +103,7 @@ struct cfctrl {
103 struct cfctrl_rsp res; 103 struct cfctrl_rsp res;
104 atomic_t req_seq_no; 104 atomic_t req_seq_no;
105 atomic_t rsp_seq_no; 105 atomic_t rsp_seq_no;
106 struct cfctrl_request_info *first_req; 106 struct list_head list;
107 /* Protects from simultaneous access to first_req list */ 107 /* Protects from simultaneous access to first_req list */
108 spinlock_t info_list_lock; 108 spinlock_t info_list_lock;
109#ifndef CAIF_NO_LOOP 109#ifndef CAIF_NO_LOOP
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 2dc9eb193ecf..b1fa87ee0992 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -16,6 +16,8 @@ struct cfsrvl {
16 bool open; 16 bool open;
17 bool phy_flow_on; 17 bool phy_flow_on;
18 bool modem_flow_on; 18 bool modem_flow_on;
19 bool supports_flowctrl;
20 void (*release)(struct kref *);
19 struct dev_info dev_info; 21 struct dev_info dev_info;
20 struct kref ref; 22 struct kref ref;
21}; 23};
@@ -25,13 +27,15 @@ struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); 27struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); 28struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); 29struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info); 30struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
31 int mtu_size);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); 32struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); 33bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer); 34void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service, 35void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id, 36 u8 channel_id,
34 struct dev_info *dev_info); 37 struct dev_info *dev_info,
38 bool supports_flowctrl);
35bool cfsrvl_ready(struct cfsrvl *service, int *err); 39bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer); 40u8 cfsrvl_getphyid(struct cflayer *layer);
37 41
@@ -50,7 +54,10 @@ static inline void cfsrvl_put(struct cflayer *layr)
50 if (layr == NULL) 54 if (layr == NULL)
51 return; 55 return;
52 s = container_of(layr, struct cfsrvl, layer); 56 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release); 57
58 WARN_ON(!s->release);
59 if (s->release)
60 kref_put(&s->ref, s->release);
54} 61}
55 62
56#endif /* CFSRVL_H_ */ 63#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f68ae54cdae6..4d1f19d70798 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1358,26 +1358,15 @@ struct wiphy {
1358 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1358 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1359}; 1359};
1360 1360
1361#ifdef CONFIG_NET_NS
1362static inline struct net *wiphy_net(struct wiphy *wiphy)
1363{
1364 return wiphy->_net;
1365}
1366
1367static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1368{
1369 wiphy->_net = net;
1370}
1371#else
1372static inline struct net *wiphy_net(struct wiphy *wiphy) 1361static inline struct net *wiphy_net(struct wiphy *wiphy)
1373{ 1362{
1374 return &init_net; 1363 return read_pnet(&wiphy->_net);
1375} 1364}
1376 1365
1377static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1366static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1378{ 1367{
1368 write_pnet(&wiphy->_net, net);
1379} 1369}
1380#endif
1381 1370
1382/** 1371/**
1383 * wiphy_priv - return priv from wiphy 1372 * wiphy_priv - return priv from wiphy
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
new file mode 100644
index 000000000000..726cc3536409
--- /dev/null
+++ b/include/net/cls_cgroup.h
@@ -0,0 +1,63 @@
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
21struct cgroup_cls_state
22{
23 struct cgroup_subsys_state css;
24 u32 classid;
25};
26
27#ifdef CONFIG_NET_CLS_CGROUP
28static inline u32 task_cls_classid(struct task_struct *p)
29{
30 if (in_interrupt())
31 return 0;
32
33 return container_of(task_subsys_state(p, net_cls_subsys_id),
34 struct cgroup_cls_state, css)->classid;
35}
36#else
37extern int net_cls_subsys_id;
38
39static inline u32 task_cls_classid(struct task_struct *p)
40{
41 int id;
42 u32 classid = 0;
43
44 if (in_interrupt())
45 return 0;
46
47 rcu_read_lock();
48 id = rcu_dereference(net_cls_subsys_id);
49 if (id >= 0)
50 classid = container_of(task_subsys_state(p, id),
51 struct cgroup_cls_state, css)->classid;
52 rcu_read_unlock();
53
54 return classid;
55}
56#endif
57#else
58static inline u32 task_cls_classid(struct task_struct *p)
59{
60 return 0;
61}
62#endif
63#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
106struct dn_long_packet { 106struct 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
137struct rtnode_hello_message { 137struct 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
150extern void dn_dev_init(void); 150extern void dn_dev_init(void);
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
79struct nsp_data_opt_msg { 79struct 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
85struct nsp_data_opt_msg1 { 85struct 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 */
100struct nsp_conn_ack_msg { 100struct 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 */
123struct nsp_disconn_init_msg { 123struct 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 */
67struct dn_route { 67struct 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 612069beda73..81d1413a8701 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -250,11 +250,11 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
250 * Linux networking. Thus, destinations are stackable. 250 * Linux networking. Thus, destinations are stackable.
251 */ 251 */
252 252
253static inline struct dst_entry *dst_pop(struct dst_entry *dst) 253static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
254{ 254{
255 struct dst_entry *child = dst_clone(dst->child); 255 struct dst_entry *child = skb_dst(skb)->child;
256 256
257 dst_release(dst); 257 skb_dst_drop(skb);
258 return child; 258 return child;
259} 259}
260 260
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
72static inline struct net *genl_info_net(struct genl_info *info) 71static 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
77static inline void genl_info_net_set(struct genl_info *info, struct net *net) 76static 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
82static inline struct net *genl_info_net(struct genl_info *info)
83{
84 return &init_net;
85}
86
87static 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/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
4extern const struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern const struct proto_ops inet_dgram_ops; 5extern 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;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, 17extern 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); 19extern int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
20extern int inet_dgram_connect(struct socket *sock, 20 int addr_len, int flags);
21 struct sockaddr * uaddr, 21extern int inet_accept(struct socket *sock, struct socket *newsock, int flags);
22 int addr_len, int flags); 22extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock,
23extern int inet_accept(struct socket *sock, 23 struct msghdr *msg, size_t size);
24 struct socket *newsock, int flags); 24extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
25extern int inet_sendmsg(struct kiocb *iocb, 25 size_t size, int flags);
26 struct socket *sock, 26extern 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); 28extern int inet_shutdown(struct socket *sock, int how);
29extern int inet_shutdown(struct socket *sock, int how); 29extern int inet_listen(struct socket *sock, int backlog);
30extern int inet_listen(struct socket *sock, int backlog); 30extern void inet_sock_destruct(struct sock *sk);
31 31extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
32extern void inet_sock_destruct(struct sock *sk); 32extern int inet_getname(struct socket *sock, struct sockaddr *uaddr,
33 33 int *uaddr_len, int peer);
34extern int inet_bind(struct socket *sock, 34extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
35 struct sockaddr *uaddr, int addr_len); 35extern int inet_ctl_sock_create(struct sock **sk, unsigned short family,
36extern 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);
39extern int inet_ioctl(struct socket *sock,
40 unsigned int cmd, unsigned long arg);
41
42extern 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
48static inline void inet_ctl_sock_destroy(struct sock *sk) 39static 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_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 1653de515cee..1989cfd7405f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -137,7 +137,8 @@ struct inet_sock {
137 hdrincl:1, 137 hdrincl:1,
138 mc_loop:1, 138 mc_loop:1,
139 transparent:1, 139 transparent:1,
140 mc_all:1; 140 mc_all:1,
141 nodefrag:1;
141 int mc_index; 142 int mc_index;
142 __be32 mc_addr; 143 __be32 mc_addr;
143 struct ip_mc_socklist *mc_list; 144 struct ip_mc_socklist *mc_list;
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
31void inet_initpeers(void) __init; 42void 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 */
37extern void inet_putpeer(struct inet_peer *p); 48extern 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 */
54static 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 */
40static inline __u16 inet_getid(struct inet_peer *p, int more) 61static 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 63548f0a44b1..890f9725d681 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -61,11 +61,14 @@ struct ipcm_cookie {
61struct ip_ra_chain { 61struct 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
67extern struct ip_ra_chain *ip_ra_chain; 71extern struct ip_ra_chain *ip_ra_chain;
68extern 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" */
@@ -162,12 +165,12 @@ struct ipv4_config {
162}; 165};
163 166
164extern struct ipv4_config ipv4_config; 167extern 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
177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); 180extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); 181#if BITS_PER_LONG==32
182extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
183#else
184static 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
189extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
179extern void snmp_mib_free(void __percpu *ptr[2]); 190extern void snmp_mib_free(void __percpu *ptr[2]);
180 191
181extern struct local_ports { 192extern struct local_ports {
@@ -358,11 +369,11 @@ enum ip_defrag_users {
358 IP_DEFRAG_LOCAL_DELIVER, 369 IP_DEFRAG_LOCAL_DELIVER,
359 IP_DEFRAG_CALL_RA_CHAIN, 370 IP_DEFRAG_CALL_RA_CHAIN,
360 IP_DEFRAG_CONNTRACK_IN, 371 IP_DEFRAG_CONNTRACK_IN,
361 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX, 372 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX,
362 IP_DEFRAG_CONNTRACK_OUT, 373 IP_DEFRAG_CONNTRACK_OUT,
363 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX, 374 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
364 IP_DEFRAG_CONNTRACK_BRIDGE_IN, 375 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
365 __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,
366 IP_DEFRAG_VS_IN, 377 IP_DEFRAG_VS_IN,
367 IP_DEFRAG_VS_OUT, 378 IP_DEFRAG_VS_OUT,
368 IP_DEFRAG_VS_FWD 379 IP_DEFRAG_VS_FWD
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 4b1dc1161c37..062a823d311c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -84,13 +84,11 @@ struct rt6key {
84struct fib6_table; 84struct fib6_table;
85 85
86struct rt6_info { 86struct rt6_info {
87 union { 87 struct dst_entry dst;
88 struct dst_entry dst;
89 } u;
90 88
91#define rt6i_dev u.dst.dev 89#define rt6i_dev dst.dev
92#define rt6i_nexthop u.dst.neighbour 90#define rt6i_nexthop dst.neighbour
93#define rt6i_expires u.dst.expires 91#define rt6i_expires dst.expires
94 92
95 /* 93 /*
96 * Tail elements of dst_entry (__refcnt etc.) 94 * Tail elements of dst_entry (__refcnt etc.)
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/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 eba5cc00325a..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;
354enum ip6_defrag_users { 354enum 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
364struct ip6_create_arg { 364struct ip6_create_arg {
@@ -551,6 +551,10 @@ extern int ipv6_ext_hdr(u8 nexthdr);
551 551
552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
553 553
554extern 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 */
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
29struct ipxhdr { 29struct 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
45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
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/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 {
82struct nd_opt_hdr { 82struct 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
88extern int ndisc_init(void); 88extern int ndisc_init(void);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index eb21340a573b..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;
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
153static inline struct net *nf_ct_net(const struct nf_conn *ct) 153static 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 */
264extern struct nf_conn nf_conntrack_untracked; 260DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
261static inline struct nf_conn *nf_ct_untracked_get(void)
262{
263 return &__raw_get_cpu_var(nf_conntrack_untracked);
264}
265extern 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. */
267extern void 268extern 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
292static inline int nf_ct_is_untracked(const struct sk_buff *skb) 293static 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
297extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 298extern 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)
45extern unsigned int 45extern unsigned int
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
47 47
48/* Check if connection tracking accounting is enabled */
49static 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 */
55static inline void nf_ct_set_acct(struct net *net, bool enable)
56{
57 net->ct.sysctl_acct = enable;
58}
59
48extern int nf_conntrack_acct_init(struct net *net); 60extern int nf_conntrack_acct_init(struct net *net);
49extern void nf_conntrack_acct_fini(struct net *net); 61extern 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 3d7524fba194..aced085132e7 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -60,7 +60,7 @@ 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)) 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))
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
15extern unsigned int
16alloc_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/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
4struct xt_rateest { 4struct 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
14extern struct xt_rateest *xt_rateest_lookup(const char *name); 19extern 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/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
39int phonet_device_init(void); 40int phonet_device_init(void);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 9d4d87cc970e..d9549af6929a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q);
95 95
96static inline void qdisc_run(struct Qdisc *q) 96static 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/route.h b/include/net/route.h
index af6cf4b4c9dc..bd732d62e1c3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,9 +50,7 @@
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct rtable { 52struct 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;
@@ -144,7 +142,7 @@ extern void fib_add_ifaddr(struct in_ifaddr *);
144static inline void ip_rt_put(struct rtable * rt) 142static inline void ip_rt_put(struct rtable * rt)
145{ 143{
146 if (rt) 144 if (rt)
147 dst_release(&rt->u.dst); 145 dst_release(&rt->dst);
148} 146}
149 147
150#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) 148#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 03ca5d826757..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
25enum qdisc_state_t { 25enum 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 */
33enum qdisc___state_t {
34 __QDISC___STATE_RUNNING,
35};
36
31struct qdisc_size_table { 37struct qdisc_size_table {
32 struct list_head list; 38 struct list_head list;
33 struct tc_sizespec szopts; 39 struct tc_sizespec szopts;
@@ -72,10 +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;
76 struct rcu_head rcu_head; 83 struct rcu_head rcu_head;
84 spinlock_t busylock;
77}; 85};
78 86
87static inline bool qdisc_is_running(struct Qdisc *qdisc)
88{
89 return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
90}
91
92static inline bool qdisc_run_begin(struct Qdisc *qdisc)
93{
94 return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
95}
96
97static inline void qdisc_run_end(struct Qdisc *qdisc)
98{
99 __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
100}
101
79struct Qdisc_class_ops { 102struct Qdisc_class_ops {
80 /* Child qdisc manipulation */ 103 /* Child qdisc manipulation */
81 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); 104 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
@@ -313,12 +336,24 @@ extern void qdisc_calculate_pkt_len(struct sk_buff *skb,
313extern void tcf_destroy(struct tcf_proto *tp); 336extern void tcf_destroy(struct tcf_proto *tp);
314extern void tcf_destroy_chain(struct tcf_proto **fl); 337extern void tcf_destroy_chain(struct tcf_proto **fl);
315 338
316/* Reset all TX qdiscs of a device. */ 339/* Reset all TX qdiscs greater then index of a device. */
340static 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
317static inline void qdisc_reset_all_tx(struct net_device *dev) 354static inline void qdisc_reset_all_tx(struct net_device *dev)
318{ 355{
319 unsigned int i; 356 qdisc_reset_all_tx_gt(dev, 0);
320 for (i = 0; i < dev->num_tx_queues; i++)
321 qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc);
322} 357}
323 358
324/* Are all TX queues of the device empty? */ 359/* Are all TX queues of the device empty? */
@@ -571,9 +606,16 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
571} 606}
572 607
573#ifdef CONFIG_NET_CLS_ACT 608#ifdef CONFIG_NET_CLS_ACT
574static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) 609static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
610 int action)
575{ 611{
576 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);
577 619
578 if (n) { 620 if (n) {
579 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
21struct scm_cookie { 21struct 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
47static __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
55static __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
45static __inline__ void scm_destroy(struct scm_cookie *scm) 65static __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)
51static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 72static __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/structs.h b/include/net/sctp/structs.h
index 6173c619913a..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
@@ -876,7 +876,7 @@ struct sctp_transport {
876 876
877 /* Reference counting. */ 877 /* Reference counting. */
878 atomic_t refcnt; 878 atomic_t refcnt;
879 int dead:1, 879 __u32 dead:1,
880 /* RTO-Pending : A flag used to track if one of the DATA 880 /* RTO-Pending : A flag used to track if one of the DATA
881 * chunks sent to this address is currently being 881 * chunks sent to this address is currently being
882 * used to compute a RTT. If this flag is 0, 882 * used to compute a RTT. If this flag is 0,
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 92456f1035f5..a0e61806d480 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -47,15 +47,16 @@ 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 */
52#include <linux/u64_stats_sync.h>
54 53
55/* IPstats */ 54/* IPstats */
56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 55#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
57struct ipstats_mib { 56struct ipstats_mib {
58 unsigned long mibs[IPSTATS_MIB_MAX]; 57 /* mibs[] must be first field of struct ipstats_mib */
58 u64 mibs[IPSTATS_MIB_MAX];
59 struct u64_stats_sync syncp;
59}; 60};
60 61
61/* ICMP */ 62/* ICMP */
@@ -134,7 +135,7 @@ struct linux_xfrm_mib {
134#define SNMP_ADD_STATS_USER(mib, field, addend) \ 135#define SNMP_ADD_STATS_USER(mib, field, addend) \
135 this_cpu_add(mib[1]->mibs[field], addend) 136 this_cpu_add(mib[1]->mibs[field], addend)
136#define SNMP_ADD_STATS(mib, field, addend) \ 137#define SNMP_ADD_STATS(mib, field, addend) \
137 this_cpu_add(mib[0]->mibs[field], addend) 138 this_cpu_add(mib[!in_softirq()]->mibs[field], addend)
138/* 139/*
139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 140 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
140 * to make @ptr a non-percpu pointer. 141 * to make @ptr a non-percpu pointer.
@@ -155,4 +156,70 @@ struct linux_xfrm_mib {
155 ptr->mibs[basefield##PKTS]++; \ 156 ptr->mibs[basefield##PKTS]++; \
156 ptr->mibs[basefield##OCTETS] += addend;\ 157 ptr->mibs[basefield##OCTETS] += addend;\
157 } 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
158#endif 225#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 5697caf8cc76..a441c9cdd625 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -295,7 +295,8 @@ struct sock {
295 unsigned short sk_ack_backlog; 295 unsigned short sk_ack_backlog;
296 unsigned short sk_max_ack_backlog; 296 unsigned short sk_max_ack_backlog;
297 __u32 sk_priority; 297 __u32 sk_priority;
298 struct ucred sk_peercred; 298 struct pid *sk_peer_pid;
299 const struct cred *sk_peer_cred;
299 long sk_rcvtimeo; 300 long sk_rcvtimeo;
300 long sk_sndtimeo; 301 long sk_sndtimeo;
301 struct sk_filter *sk_filter; 302 struct sk_filter *sk_filter;
@@ -312,7 +313,7 @@ struct sock {
312 void *sk_security; 313 void *sk_security;
313#endif 314#endif
314 __u32 sk_mark; 315 __u32 sk_mark;
315 /* XXX 4 bytes hole on 64 bit */ 316 u32 sk_classid;
316 void (*sk_state_change)(struct sock *sk); 317 void (*sk_state_change)(struct sock *sk);
317 void (*sk_data_ready)(struct sock *sk, int bytes); 318 void (*sk_data_ready)(struct sock *sk, int bytes);
318 void (*sk_write_space)(struct sock *sk); 319 void (*sk_write_space)(struct sock *sk);
@@ -771,6 +772,7 @@ struct proto {
771 int *sysctl_wmem; 772 int *sysctl_wmem;
772 int *sysctl_rmem; 773 int *sysctl_rmem;
773 int max_header; 774 int max_header;
775 bool no_autobind;
774 776
775 struct kmem_cache *slab; 777 struct kmem_cache *slab;
776 unsigned int obj_size; 778 unsigned int obj_size;
@@ -1026,15 +1028,23 @@ extern void release_sock(struct sock *sk);
1026 SINGLE_DEPTH_NESTING) 1028 SINGLE_DEPTH_NESTING)
1027#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1029#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
1028 1030
1029static inline void lock_sock_bh(struct sock *sk) 1031extern bool lock_sock_fast(struct sock *sk);
1032/**
1033 * unlock_sock_fast - complement of lock_sock_fast
1034 * @sk: socket
1035 * @slow: slow mode
1036 *
1037 * fast unlock socket for user context.
1038 * If slow mode is on, we call regular release_sock()
1039 */
1040static inline void unlock_sock_fast(struct sock *sk, bool slow)
1030{ 1041{
1031 spin_lock_bh(&sk->sk_lock.slock); 1042 if (slow)
1043 release_sock(sk);
1044 else
1045 spin_unlock_bh(&sk->sk_lock.slock);
1032} 1046}
1033 1047
1034static inline void unlock_sock_bh(struct sock *sk)
1035{
1036 spin_unlock_bh(&sk->sk_lock.slock);
1037}
1038 1048
1039extern struct sock *sk_alloc(struct net *net, int family, 1049extern struct sock *sk_alloc(struct net *net, int family,
1040 gfp_t priority, 1050 gfp_t priority,
@@ -1074,6 +1084,14 @@ extern void *sock_kmalloc(struct sock *sk, int size,
1074extern void sock_kfree_s(struct sock *sk, void *mem, int size); 1084extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1075extern void sk_send_sigurg(struct sock *sk); 1085extern void sk_send_sigurg(struct sock *sk);
1076 1086
1087#ifdef CONFIG_CGROUPS
1088extern void sock_update_classid(struct sock *sk);
1089#else
1090static inline void sock_update_classid(struct sock *sk)
1091{
1092}
1093#endif
1094
1077/* 1095/*
1078 * Functions to fill in entries in struct proto_ops when a protocol 1096 * Functions to fill in entries in struct proto_ops when a protocol
1079 * does not implement a particular function. 1097 * does not implement a particular function.
@@ -1208,12 +1226,7 @@ static inline void sk_tx_queue_clear(struct sock *sk)
1208 1226
1209static inline int sk_tx_queue_get(const struct sock *sk) 1227static inline int sk_tx_queue_get(const struct sock *sk)
1210{ 1228{
1211 return sk->sk_tx_queue_mapping; 1229 return sk ? sk->sk_tx_queue_mapping : -1;
1212}
1213
1214static inline bool sk_tx_queue_recorded(const struct sock *sk)
1215{
1216 return (sk && sk->sk_tx_queue_mapping >= 0);
1217} 1230}
1218 1231
1219static inline void sk_set_socket(struct sock *sk, struct socket *sock) 1232static inline void sk_set_socket(struct sock *sk, struct socket *sock)
@@ -1404,7 +1417,7 @@ static inline int sk_has_allocations(const struct sock *sk)
1404 1417
1405/** 1418/**
1406 * wq_has_sleeper - check if there are any waiting processes 1419 * wq_has_sleeper - check if there are any waiting processes
1407 * @sk: struct socket_wq 1420 * @wq: struct socket_wq
1408 * 1421 *
1409 * Returns true if socket_wq has waiting processes 1422 * Returns true if socket_wq has waiting processes
1410 * 1423 *
@@ -1508,20 +1521,7 @@ extern void sk_stop_timer(struct sock *sk, struct timer_list* timer);
1508 1521
1509extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 1522extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1510 1523
1511static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 1524extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
1512{
1513 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
1514 number of warnings when compiling with -W --ANK
1515 */
1516 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
1517 (unsigned)sk->sk_rcvbuf)
1518 return -ENOMEM;
1519 skb_set_owner_r(skb, sk);
1520 skb_queue_tail(&sk->sk_error_queue, skb);
1521 if (!sock_flag(sk, SOCK_DEAD))
1522 sk->sk_data_ready(sk, skb->len);
1523 return 0;
1524}
1525 1525
1526/* 1526/*
1527 * Recover an error report and clear atomically 1527 * Recover an error report and clear atomically
@@ -1708,19 +1708,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1708static inline 1708static inline
1709struct net *sock_net(const struct sock *sk) 1709struct net *sock_net(const struct sock *sk)
1710{ 1710{
1711#ifdef CONFIG_NET_NS 1711 return read_pnet(&sk->sk_net);
1712 return sk->sk_net;
1713#else
1714 return &init_net;
1715#endif
1716} 1712}
1717 1713
1718static inline 1714static inline
1719void sock_net_set(struct sock *sk, struct net *net) 1715void sock_net_set(struct sock *sk, struct net *net)
1720{ 1716{
1721#ifdef CONFIG_NET_NS 1717 write_pnet(&sk->sk_net, net);
1722 sk->sk_net = net;
1723#endif
1724} 1718}
1725 1719
1726/* 1720/*
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a1449144848a..df6a2eb20193 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -296,45 +296,30 @@ extern struct proto tcp_prot;
296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
298 298
299extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
300 300
301extern void tcp_shutdown (struct sock *sk, int how); 301extern void tcp_shutdown (struct sock *sk, int how);
302 302
303extern int tcp_v4_rcv(struct sk_buff *skb); 303extern int tcp_v4_rcv(struct sk_buff *skb);
304 304
305extern int tcp_v4_remember_stamp(struct sock *sk); 305extern int tcp_v4_remember_stamp(struct sock *sk);
306 306extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
307extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 307extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
308 308 size_t size);
309extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, 309extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
310 struct msghdr *msg, size_t size); 310 size_t size, int flags);
311extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 311extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
312 312extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
313extern int tcp_ioctl(struct sock *sk, 313 struct tcphdr *th, unsigned len);
314 int cmd, 314extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
315 unsigned long arg); 315 struct tcphdr *th, unsigned len);
316 316extern void tcp_rcv_space_adjust(struct sock *sk);
317extern int tcp_rcv_state_process(struct sock *sk, 317extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
318 struct sk_buff *skb, 318extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
319 struct tcphdr *th, 319extern void tcp_twsk_destructor(struct sock *sk);
320 unsigned len); 320extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
321 321 struct pipe_inode_info *pipe, size_t len,
322extern int tcp_rcv_established(struct sock *sk, 322 unsigned int flags);
323 struct sk_buff *skb,
324 struct tcphdr *th,
325 unsigned len);
326
327extern void tcp_rcv_space_adjust(struct sock *sk);
328
329extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
330
331extern int tcp_twsk_unique(struct sock *sk,
332 struct sock *sktw, void *twp);
333
334extern void tcp_twsk_destructor(struct sock *sk);
335
336extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
337 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
338 323
339static inline void tcp_dec_quickack_mode(struct sock *sk, 324static inline void tcp_dec_quickack_mode(struct sock *sk,
340 const unsigned int pkts) 325 const unsigned int pkts)
@@ -372,88 +357,59 @@ enum tcp_tw_status {
372}; 357};
373 358
374 359
375extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 360extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
376 struct sk_buff *skb, 361 struct sk_buff *skb,
377 const struct tcphdr *th); 362 const struct tcphdr *th);
378 363extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
379extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 364 struct request_sock *req,
380 struct request_sock *req, 365 struct request_sock **prev);
381 struct request_sock **prev); 366extern int tcp_child_process(struct sock *parent, struct sock *child,
382extern int tcp_child_process(struct sock *parent, 367 struct sk_buff *skb);
383 struct sock *child, 368extern int tcp_use_frto(struct sock *sk);
384 struct sk_buff *skb); 369extern void tcp_enter_frto(struct sock *sk);
385extern int tcp_use_frto(struct sock *sk); 370extern void tcp_enter_loss(struct sock *sk, int how);
386extern void tcp_enter_frto(struct sock *sk); 371extern void tcp_clear_retrans(struct tcp_sock *tp);
387extern void tcp_enter_loss(struct sock *sk, int how); 372extern void tcp_update_metrics(struct sock *sk);
388extern void tcp_clear_retrans(struct tcp_sock *tp); 373extern void tcp_close(struct sock *sk, long timeout);
389extern void tcp_update_metrics(struct sock *sk); 374extern unsigned int tcp_poll(struct file * file, struct socket *sock,
390 375 struct poll_table_struct *wait);
391extern void tcp_close(struct sock *sk, 376extern int tcp_getsockopt(struct sock *sk, int level, int optname,
392 long timeout); 377 char __user *optval, int __user *optlen);
393extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); 378extern int tcp_setsockopt(struct sock *sk, int level, int optname,
394 379 char __user *optval, unsigned int optlen);
395extern int tcp_getsockopt(struct sock *sk, int level, 380extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
396 int optname, 381 char __user *optval, int __user *optlen);
397 char __user *optval, 382extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
398 int __user *optlen); 383 char __user *optval, unsigned int optlen);
399extern int tcp_setsockopt(struct sock *sk, int level, 384extern void tcp_set_keepalive(struct sock *sk, int val);
400 int optname, char __user *optval, 385extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
401 unsigned int optlen); 386extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
402extern int compat_tcp_getsockopt(struct sock *sk, 387 size_t len, int nonblock, int flags, int *addr_len);
403 int level, int optname, 388extern void tcp_parse_options(struct sk_buff *skb,
404 char __user *optval, int __user *optlen); 389 struct tcp_options_received *opt_rx, u8 **hvpp,
405extern int compat_tcp_setsockopt(struct sock *sk, 390 int estab);
406 int level, int optname, 391extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
407 char __user *optval, unsigned int optlen);
408extern void tcp_set_keepalive(struct sock *sk, int val);
409extern void tcp_syn_ack_timeout(struct sock *sk,
410 struct request_sock *req);
411extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
412 struct msghdr *msg,
413 size_t len, int nonblock,
414 int flags, int *addr_len);
415
416extern void tcp_parse_options(struct sk_buff *skb,
417 struct tcp_options_received *opt_rx,
418 u8 **hvpp,
419 int estab);
420
421extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
422 392
423/* 393/*
424 * TCP v4 functions exported for the inet6 API 394 * TCP v4 functions exported for the inet6 API
425 */ 395 */
426 396
427extern void tcp_v4_send_check(struct sock *sk, 397extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
428 struct sk_buff *skb); 398extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
429 399extern struct sock * tcp_create_openreq_child(struct sock *sk,
430extern int tcp_v4_conn_request(struct sock *sk, 400 struct request_sock *req,
431 struct sk_buff *skb);
432
433extern struct sock * tcp_create_openreq_child(struct sock *sk,
434 struct request_sock *req,
435 struct sk_buff *skb);
436
437extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk,
438 struct sk_buff *skb,
439 struct request_sock *req,
440 struct dst_entry *dst);
441
442extern int tcp_v4_do_rcv(struct sock *sk,
443 struct sk_buff *skb); 401 struct sk_buff *skb);
444 402extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
445extern int tcp_v4_connect(struct sock *sk, 403 struct request_sock *req,
446 struct sockaddr *uaddr, 404 struct dst_entry *dst);
447 int addr_len); 405extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
448 406extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
449extern int tcp_connect(struct sock *sk); 407 int addr_len);
450 408extern int tcp_connect(struct sock *sk);
451extern struct sk_buff * tcp_make_synack(struct sock *sk, 409extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
452 struct dst_entry *dst, 410 struct request_sock *req,
453 struct request_sock *req, 411 struct request_values *rvp);
454 struct request_values *rvp); 412extern int tcp_disconnect(struct sock *sk, int flags);
455
456extern int tcp_disconnect(struct sock *sk, int flags);
457 413
458 414
459/* From syncookies.c */ 415/* From syncookies.c */
@@ -464,7 +420,7 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
464 __u16 *mss); 420 __u16 *mss);
465 421
466extern __u32 cookie_init_timestamp(struct request_sock *req); 422extern __u32 cookie_init_timestamp(struct request_sock *req);
467extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt); 423extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *);
468 424
469/* From net/ipv6/syncookies.c */ 425/* From net/ipv6/syncookies.c */
470extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 426extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
@@ -485,10 +441,10 @@ extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
485 441
486extern void tcp_send_probe0(struct sock *); 442extern void tcp_send_probe0(struct sock *);
487extern void tcp_send_partial(struct sock *); 443extern void tcp_send_partial(struct sock *);
488extern int tcp_write_wakeup(struct sock *); 444extern int tcp_write_wakeup(struct sock *);
489extern void tcp_send_fin(struct sock *sk); 445extern void tcp_send_fin(struct sock *sk);
490extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 446extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
491extern int tcp_send_synack(struct sock *); 447extern int tcp_send_synack(struct sock *);
492extern void tcp_push_one(struct sock *, unsigned int mss_now); 448extern void tcp_push_one(struct sock *, unsigned int mss_now);
493extern void tcp_send_ack(struct sock *sk); 449extern void tcp_send_ack(struct sock *sk);
494extern void tcp_send_delayed_ack(struct sock *sk); 450extern void tcp_send_delayed_ack(struct sock *sk);
@@ -592,7 +548,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
592 * scaling applied to the result. The caller does these things 548 * scaling applied to the result. The caller does these things
593 * if necessary. This is a "raw" window selection. 549 * if necessary. This is a "raw" window selection.
594 */ 550 */
595extern u32 __tcp_select_window(struct sock *sk); 551extern u32 __tcp_select_window(struct sock *sk);
596 552
597/* TCP timestamps are only 32-bits, this causes a slight 553/* TCP timestamps are only 32-bits, this causes a slight
598 * complication on 64-bit systems since we store a snapshot 554 * complication on 64-bit systems since we store a snapshot
@@ -602,12 +558,22 @@ extern u32 __tcp_select_window(struct sock *sk);
602 */ 558 */
603#define tcp_time_stamp ((__u32)(jiffies)) 559#define tcp_time_stamp ((__u32)(jiffies))
604 560
561#define tcp_flag_byte(th) (((u_int8_t *)th)[13])
562
563#define TCPHDR_FIN 0x01
564#define TCPHDR_SYN 0x02
565#define TCPHDR_RST 0x04
566#define TCPHDR_PSH 0x08
567#define TCPHDR_ACK 0x10
568#define TCPHDR_URG 0x20
569#define TCPHDR_ECE 0x40
570#define TCPHDR_CWR 0x80
571
605/* This is what the send packet queuing engine uses to pass 572/* This is what the send packet queuing engine uses to pass
606 * TCP per-packet control information to the transmission 573 * TCP per-packet control information to the transmission code.
607 * code. We also store the host-order sequence numbers in 574 * We also store the host-order sequence numbers in here too.
608 * here too. This is 36 bytes on 32-bit architectures, 575 * This is 44 bytes if IPV6 is enabled.
609 * 40 bytes on 64-bit machines, if this grows please adjust 576 * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately.
610 * skbuff.h:skbuff->cb[xxx] size appropriately.
611 */ 577 */
612struct tcp_skb_cb { 578struct tcp_skb_cb {
613 union { 579 union {
@@ -620,19 +586,6 @@ struct tcp_skb_cb {
620 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 586 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
621 __u32 when; /* used to compute rtt's */ 587 __u32 when; /* used to compute rtt's */
622 __u8 flags; /* TCP header flags. */ 588 __u8 flags; /* TCP header flags. */
623
624 /* NOTE: These must match up to the flags byte in a
625 * real TCP header.
626 */
627#define TCPCB_FLAG_FIN 0x01
628#define TCPCB_FLAG_SYN 0x02
629#define TCPCB_FLAG_RST 0x04
630#define TCPCB_FLAG_PSH 0x08
631#define TCPCB_FLAG_ACK 0x10
632#define TCPCB_FLAG_URG 0x20
633#define TCPCB_FLAG_ECE 0x40
634#define TCPCB_FLAG_CWR 0x80
635
636 __u8 sacked; /* State flags for SACK/FACK. */ 589 __u8 sacked; /* State flags for SACK/FACK. */
637#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ 590#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
638#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 591#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
@@ -1176,22 +1129,14 @@ struct tcp_md5sig_pool {
1176#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ 1129#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1177 1130
1178/* - functions */ 1131/* - functions */
1179extern int tcp_v4_md5_hash_skb(char *md5_hash, 1132extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1180 struct tcp_md5sig_key *key, 1133 struct sock *sk, struct request_sock *req,
1181 struct sock *sk, 1134 struct sk_buff *skb);
1182 struct request_sock *req, 1135extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk,
1183 struct sk_buff *skb); 1136 struct sock *addr_sk);
1184 1137extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey,
1185extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 1138 u8 newkeylen);
1186 struct sock *addr_sk); 1139extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr);
1187
1188extern int tcp_v4_md5_do_add(struct sock *sk,
1189 __be32 addr,
1190 u8 *newkey,
1191 u8 newkeylen);
1192
1193extern int tcp_v4_md5_do_del(struct sock *sk,
1194 __be32 addr);
1195 1140
1196#ifdef CONFIG_TCP_MD5SIG 1141#ifdef CONFIG_TCP_MD5SIG
1197#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1142#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \
@@ -1204,10 +1149,10 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1204#endif 1149#endif
1205 1150
1206extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); 1151extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1207extern void tcp_free_md5sig_pool(void); 1152extern void tcp_free_md5sig_pool(void);
1208 1153
1209extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1154extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1210extern void tcp_put_md5sig_pool(void); 1155extern void tcp_put_md5sig_pool(void);
1211 1156
1212extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1157extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1213extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1158extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
@@ -1413,7 +1358,8 @@ struct tcp_iter_state {
1413 sa_family_t family; 1358 sa_family_t family;
1414 enum tcp_seq_states state; 1359 enum tcp_seq_states state;
1415 struct sock *syn_wait_sk; 1360 struct sock *syn_wait_sk;
1416 int bucket, sbucket, num, uid; 1361 int bucket, offset, sbucket, num, uid;
1362 loff_t last_pos;
1417}; 1363};
1418 1364
1419extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1365extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
@@ -1434,7 +1380,7 @@ extern int tcp_gro_complete(struct sk_buff *skb);
1434extern int tcp4_gro_complete(struct sk_buff *skb); 1380extern int tcp4_gro_complete(struct sk_buff *skb);
1435 1381
1436#ifdef CONFIG_PROC_FS 1382#ifdef CONFIG_PROC_FS
1437extern int tcp4_proc_init(void); 1383extern int tcp4_proc_init(void);
1438extern void tcp4_proc_exit(void); 1384extern void tcp4_proc_exit(void);
1439#endif 1385#endif
1440 1386
diff --git a/include/net/udp.h b/include/net/udp.h
index 5348d80b25bb..7abdf305da50 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -157,30 +157,28 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
157 sk_common_release(sk); 157 sk_common_release(sk);
158} 158}
159 159
160extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 160extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
161 int (*)(const struct sock *,const struct sock *), 161 int (*)(const struct sock *,const struct sock *),
162 unsigned int hash2_nulladdr); 162 unsigned int hash2_nulladdr);
163 163
164/* net/ipv4/udp.c */ 164/* net/ipv4/udp.c */
165extern int udp_get_port(struct sock *sk, unsigned short snum, 165extern int udp_get_port(struct sock *sk, unsigned short snum,
166 int (*saddr_cmp)(const struct sock *, const struct sock *)); 166 int (*saddr_cmp)(const struct sock *,
167extern void udp_err(struct sk_buff *, u32); 167 const struct sock *));
168 168extern void udp_err(struct sk_buff *, u32);
169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
170 struct msghdr *msg, size_t len); 170 struct msghdr *msg, size_t len);
171extern void udp_flush_pending_frames(struct sock *sk); 171extern void udp_flush_pending_frames(struct sock *sk);
172 172extern int udp_rcv(struct sk_buff *skb);
173extern int udp_rcv(struct sk_buff *skb); 173extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
174extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 174extern int udp_disconnect(struct sock *sk, int flags);
175extern int udp_disconnect(struct sock *sk, int flags);
176extern unsigned int udp_poll(struct file *file, struct socket *sock, 175extern unsigned int udp_poll(struct file *file, struct socket *sock,
177 poll_table *wait); 176 poll_table *wait);
178extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 177extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
179 char __user *optval, int __user *optlen); 178 char __user *optval, int __user *optlen);
180extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 179extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
181 char __user *optval, unsigned int optlen, 180 char __user *optval, unsigned int optlen,
182 int (*push_pending_frames)(struct sock *)); 181 int (*push_pending_frames)(struct sock *));
183
184extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 182extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
185 __be32 daddr, __be16 dport, 183 __be32 daddr, __be16 dport,
186 int dif); 184 int dif);
@@ -236,7 +234,7 @@ struct udp_iter_state {
236extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); 234extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
237extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); 235extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
238 236
239extern int udp4_proc_init(void); 237extern int udp4_proc_init(void);
240extern void udp4_proc_exit(void); 238extern void udp4_proc_exit(void);
241#endif 239#endif
242 240
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 1913af67c43d..fc8f36dd0f5c 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1586,7 +1586,7 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1586static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) 1586static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1587{ 1587{
1588 if (attrs[XFRMA_MARK]) 1588 if (attrs[XFRMA_MARK])
1589 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m)); 1589 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
1590 else 1590 else
1591 m->v = m->m = 0; 1591 m->v = m->m = 0;
1592 1592