diff options
Diffstat (limited to 'include/net')
52 files changed, 485 insertions, 166 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 750e2508dd9..3d71251b3ec 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -45,7 +45,6 @@ struct prefix_info { | |||
45 | 45 | ||
46 | #ifdef __KERNEL__ | 46 | #ifdef __KERNEL__ |
47 | 47 | ||
48 | #include <linux/config.h> | ||
49 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
50 | #include <net/if_inet6.h> | 49 | #include <net/if_inet6.h> |
51 | #include <net/ipv6.h> | 50 | #include <net/ipv6.h> |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 427dac94bc7..c0398f5a8cb 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __LINUX_NET_AFUNIX_H | 1 | #ifndef __LINUX_NET_AFUNIX_H |
2 | #define __LINUX_NET_AFUNIX_H | 2 | #define __LINUX_NET_AFUNIX_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | #include <linux/socket.h> | 4 | #include <linux/socket.h> |
6 | #include <linux/un.h> | 5 | #include <linux/un.h> |
7 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
@@ -54,14 +53,21 @@ struct unix_address { | |||
54 | struct unix_skb_parms { | 53 | struct unix_skb_parms { |
55 | struct ucred creds; /* Skb credentials */ | 54 | struct ucred creds; /* Skb credentials */ |
56 | struct scm_fp_list *fp; /* Passed files */ | 55 | struct scm_fp_list *fp; /* Passed files */ |
56 | #ifdef CONFIG_SECURITY_NETWORK | ||
57 | u32 secid; /* Security ID */ | ||
58 | #endif | ||
57 | }; | 59 | }; |
58 | 60 | ||
59 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) | 61 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) |
60 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) | 62 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) |
63 | #define UNIXSID(skb) (&UNIXCB((skb)).secid) | ||
61 | 64 | ||
62 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) | 65 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) |
63 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) | 66 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) |
64 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) | 67 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) |
68 | #define unix_state_wlock_nested(s) \ | ||
69 | spin_lock_nested(&unix_sk(s)->lock, \ | ||
70 | SINGLE_DEPTH_NESTING) | ||
65 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) | 71 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) |
66 | 72 | ||
67 | #ifdef __KERNEL__ | 73 | #ifdef __KERNEL__ |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 5bd99748705..69374cd1a85 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _AX25_H | 6 | #ifndef _AX25_H |
7 | #define _AX25_H | 7 | #define _AX25_H |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/ax25.h> | 9 | #include <linux/ax25.h> |
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/timer.h> | 11 | #include <linux/timer.h> |
@@ -183,14 +182,26 @@ typedef struct { | |||
183 | 182 | ||
184 | typedef struct ax25_route { | 183 | typedef struct ax25_route { |
185 | struct ax25_route *next; | 184 | struct ax25_route *next; |
186 | atomic_t ref; | 185 | atomic_t refcount; |
187 | ax25_address callsign; | 186 | ax25_address callsign; |
188 | struct net_device *dev; | 187 | struct net_device *dev; |
189 | ax25_digi *digipeat; | 188 | ax25_digi *digipeat; |
190 | char ip_mode; | 189 | char ip_mode; |
191 | struct timer_list timer; | ||
192 | } ax25_route; | 190 | } ax25_route; |
193 | 191 | ||
192 | static inline void ax25_hold_route(ax25_route *ax25_rt) | ||
193 | { | ||
194 | atomic_inc(&ax25_rt->refcount); | ||
195 | } | ||
196 | |||
197 | extern void __ax25_put_route(ax25_route *ax25_rt); | ||
198 | |||
199 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
200 | { | ||
201 | if (atomic_dec_and_test(&ax25_rt->refcount)) | ||
202 | __ax25_put_route(ax25_rt); | ||
203 | } | ||
204 | |||
194 | typedef struct { | 205 | typedef struct { |
195 | char slave; /* slave_mode? */ | 206 | char slave; /* slave_mode? */ |
196 | struct timer_list slave_timer; /* timeout timer */ | 207 | struct timer_list slave_timer; /* timeout timer */ |
@@ -349,17 +360,11 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); | |||
349 | extern void ax25_rt_device_down(struct net_device *); | 360 | extern void ax25_rt_device_down(struct net_device *); |
350 | extern int ax25_rt_ioctl(unsigned int, void __user *); | 361 | extern int ax25_rt_ioctl(unsigned int, void __user *); |
351 | extern struct file_operations ax25_route_fops; | 362 | extern struct file_operations ax25_route_fops; |
363 | extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); | ||
352 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); | 364 | extern int ax25_rt_autobind(ax25_cb *, ax25_address *); |
353 | extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *, | ||
354 | struct net_device *); | ||
355 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); | 365 | extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); |
356 | extern void ax25_rt_free(void); | 366 | extern void ax25_rt_free(void); |
357 | 367 | ||
358 | static inline void ax25_put_route(ax25_route *ax25_rt) | ||
359 | { | ||
360 | atomic_dec(&ax25_rt->ref); | ||
361 | } | ||
362 | |||
363 | /* ax25_std_in.c */ | 368 | /* ax25_std_in.c */ |
364 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); | 369 | extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); |
365 | 370 | ||
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 911ceb5cd26..771d17783c1 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -175,6 +175,6 @@ extern int hci_sock_cleanup(void); | |||
175 | extern int bt_sysfs_init(void); | 175 | extern int bt_sysfs_init(void); |
176 | extern void bt_sysfs_cleanup(void); | 176 | extern void bt_sysfs_cleanup(void); |
177 | 177 | ||
178 | extern struct class bt_class; | 178 | extern struct class *bt_class; |
179 | 179 | ||
180 | #endif /* __BLUETOOTH_H */ | 180 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b06a2d2f63d..b2bdb1aa042 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -54,7 +54,8 @@ | |||
54 | /* HCI device quirks */ | 54 | /* HCI device quirks */ |
55 | enum { | 55 | enum { |
56 | HCI_QUIRK_RESET_ON_INIT, | 56 | HCI_QUIRK_RESET_ON_INIT, |
57 | HCI_QUIRK_RAW_DEVICE | 57 | HCI_QUIRK_RAW_DEVICE, |
58 | HCI_QUIRK_FIXUP_BUFFER_SIZE | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | /* HCI device flags */ | 61 | /* HCI device flags */ |
@@ -100,9 +101,10 @@ enum { | |||
100 | #define HCIINQUIRY _IOR('H', 240, int) | 101 | #define HCIINQUIRY _IOR('H', 240, int) |
101 | 102 | ||
102 | /* HCI timeouts */ | 103 | /* HCI timeouts */ |
103 | #define HCI_CONN_TIMEOUT (HZ * 40) | 104 | #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ |
104 | #define HCI_DISCONN_TIMEOUT (HZ * 2) | 105 | #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ |
105 | #define HCI_CONN_IDLE_TIMEOUT (HZ * 60) | 106 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
107 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | ||
106 | 108 | ||
107 | /* HCI Packet types */ | 109 | /* HCI Packet types */ |
108 | #define HCI_COMMAND_PKT 0x01 | 110 | #define HCI_COMMAND_PKT 0x01 |
@@ -144,7 +146,7 @@ enum { | |||
144 | #define LMP_TACCURACY 0x10 | 146 | #define LMP_TACCURACY 0x10 |
145 | #define LMP_RSWITCH 0x20 | 147 | #define LMP_RSWITCH 0x20 |
146 | #define LMP_HOLD 0x40 | 148 | #define LMP_HOLD 0x40 |
147 | #define LMP_SNIF 0x80 | 149 | #define LMP_SNIFF 0x80 |
148 | 150 | ||
149 | #define LMP_PARK 0x01 | 151 | #define LMP_PARK 0x01 |
150 | #define LMP_RSSI 0x02 | 152 | #define LMP_RSSI 0x02 |
@@ -159,13 +161,21 @@ enum { | |||
159 | #define LMP_PSCHEME 0x02 | 161 | #define LMP_PSCHEME 0x02 |
160 | #define LMP_PCONTROL 0x04 | 162 | #define LMP_PCONTROL 0x04 |
161 | 163 | ||
164 | #define LMP_SNIFF_SUBR 0x02 | ||
165 | |||
166 | /* Connection modes */ | ||
167 | #define HCI_CM_ACTIVE 0x0000 | ||
168 | #define HCI_CM_HOLD 0x0001 | ||
169 | #define HCI_CM_SNIFF 0x0002 | ||
170 | #define HCI_CM_PARK 0x0003 | ||
171 | |||
162 | /* Link policies */ | 172 | /* Link policies */ |
163 | #define HCI_LP_RSWITCH 0x0001 | 173 | #define HCI_LP_RSWITCH 0x0001 |
164 | #define HCI_LP_HOLD 0x0002 | 174 | #define HCI_LP_HOLD 0x0002 |
165 | #define HCI_LP_SNIFF 0x0004 | 175 | #define HCI_LP_SNIFF 0x0004 |
166 | #define HCI_LP_PARK 0x0008 | 176 | #define HCI_LP_PARK 0x0008 |
167 | 177 | ||
168 | /* Link mode */ | 178 | /* Link modes */ |
169 | #define HCI_LM_ACCEPT 0x8000 | 179 | #define HCI_LM_ACCEPT 0x8000 |
170 | #define HCI_LM_MASTER 0x0001 | 180 | #define HCI_LM_MASTER 0x0001 |
171 | #define HCI_LM_AUTH 0x0002 | 181 | #define HCI_LM_AUTH 0x0002 |
@@ -191,7 +201,7 @@ struct hci_rp_read_loc_version { | |||
191 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
192 | 202 | ||
193 | #define OCF_READ_LOCAL_FEATURES 0x0003 | 203 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
194 | struct hci_rp_read_loc_features { | 204 | struct hci_rp_read_local_features { |
195 | __u8 status; | 205 | __u8 status; |
196 | __u8 features[8]; | 206 | __u8 features[8]; |
197 | } __attribute__ ((packed)); | 207 | } __attribute__ ((packed)); |
@@ -375,17 +385,32 @@ struct hci_cp_change_conn_link_key { | |||
375 | } __attribute__ ((packed)); | 385 | } __attribute__ ((packed)); |
376 | 386 | ||
377 | #define OCF_READ_REMOTE_FEATURES 0x001B | 387 | #define OCF_READ_REMOTE_FEATURES 0x001B |
378 | struct hci_cp_read_rmt_features { | 388 | struct hci_cp_read_remote_features { |
379 | __le16 handle; | 389 | __le16 handle; |
380 | } __attribute__ ((packed)); | 390 | } __attribute__ ((packed)); |
381 | 391 | ||
382 | #define OCF_READ_REMOTE_VERSION 0x001D | 392 | #define OCF_READ_REMOTE_VERSION 0x001D |
383 | struct hci_cp_read_rmt_version { | 393 | struct hci_cp_read_remote_version { |
384 | __le16 handle; | 394 | __le16 handle; |
385 | } __attribute__ ((packed)); | 395 | } __attribute__ ((packed)); |
386 | 396 | ||
387 | /* Link Policy */ | 397 | /* Link Policy */ |
388 | #define OGF_LINK_POLICY 0x02 | 398 | #define OGF_LINK_POLICY 0x02 |
399 | |||
400 | #define OCF_SNIFF_MODE 0x0003 | ||
401 | struct hci_cp_sniff_mode { | ||
402 | __le16 handle; | ||
403 | __le16 max_interval; | ||
404 | __le16 min_interval; | ||
405 | __le16 attempt; | ||
406 | __le16 timeout; | ||
407 | } __attribute__ ((packed)); | ||
408 | |||
409 | #define OCF_EXIT_SNIFF_MODE 0x0004 | ||
410 | struct hci_cp_exit_sniff_mode { | ||
411 | __le16 handle; | ||
412 | } __attribute__ ((packed)); | ||
413 | |||
389 | #define OCF_ROLE_DISCOVERY 0x0009 | 414 | #define OCF_ROLE_DISCOVERY 0x0009 |
390 | struct hci_cp_role_discovery { | 415 | struct hci_cp_role_discovery { |
391 | __le16 handle; | 416 | __le16 handle; |
@@ -406,7 +431,7 @@ struct hci_rp_read_link_policy { | |||
406 | __le16 policy; | 431 | __le16 policy; |
407 | } __attribute__ ((packed)); | 432 | } __attribute__ ((packed)); |
408 | 433 | ||
409 | #define OCF_SWITCH_ROLE 0x000B | 434 | #define OCF_SWITCH_ROLE 0x000B |
410 | struct hci_cp_switch_role { | 435 | struct hci_cp_switch_role { |
411 | bdaddr_t bdaddr; | 436 | bdaddr_t bdaddr; |
412 | __u8 role; | 437 | __u8 role; |
@@ -422,6 +447,14 @@ struct hci_rp_write_link_policy { | |||
422 | __le16 handle; | 447 | __le16 handle; |
423 | } __attribute__ ((packed)); | 448 | } __attribute__ ((packed)); |
424 | 449 | ||
450 | #define OCF_SNIFF_SUBRATE 0x0011 | ||
451 | struct hci_cp_sniff_subrate { | ||
452 | __le16 handle; | ||
453 | __le16 max_latency; | ||
454 | __le16 min_remote_timeout; | ||
455 | __le16 min_local_timeout; | ||
456 | } __attribute__ ((packed)); | ||
457 | |||
425 | /* Status params */ | 458 | /* Status params */ |
426 | #define OGF_STATUS_PARAM 0x05 | 459 | #define OGF_STATUS_PARAM 0x05 |
427 | 460 | ||
@@ -581,15 +614,15 @@ struct hci_ev_link_key_notify { | |||
581 | __u8 key_type; | 614 | __u8 key_type; |
582 | } __attribute__ ((packed)); | 615 | } __attribute__ ((packed)); |
583 | 616 | ||
584 | #define HCI_EV_RMT_FEATURES 0x0B | 617 | #define HCI_EV_REMOTE_FEATURES 0x0B |
585 | struct hci_ev_rmt_features { | 618 | struct hci_ev_remote_features { |
586 | __u8 status; | 619 | __u8 status; |
587 | __le16 handle; | 620 | __le16 handle; |
588 | __u8 features[8]; | 621 | __u8 features[8]; |
589 | } __attribute__ ((packed)); | 622 | } __attribute__ ((packed)); |
590 | 623 | ||
591 | #define HCI_EV_RMT_VERSION 0x0C | 624 | #define HCI_EV_REMOTE_VERSION 0x0C |
592 | struct hci_ev_rmt_version { | 625 | struct hci_ev_remote_version { |
593 | __u8 status; | 626 | __u8 status; |
594 | __le16 handle; | 627 | __le16 handle; |
595 | __u8 lmp_ver; | 628 | __u8 lmp_ver; |
@@ -610,6 +643,16 @@ struct hci_ev_pscan_rep_mode { | |||
610 | __u8 pscan_rep_mode; | 643 | __u8 pscan_rep_mode; |
611 | } __attribute__ ((packed)); | 644 | } __attribute__ ((packed)); |
612 | 645 | ||
646 | #define HCI_EV_SNIFF_SUBRATE 0x2E | ||
647 | struct hci_ev_sniff_subrate { | ||
648 | __u8 status; | ||
649 | __le16 handle; | ||
650 | __le16 max_tx_latency; | ||
651 | __le16 max_rx_latency; | ||
652 | __le16 max_remote_timeout; | ||
653 | __le16 max_local_timeout; | ||
654 | } __attribute__ ((packed)); | ||
655 | |||
613 | /* Internal events generated by Bluetooth stack */ | 656 | /* Internal events generated by Bluetooth stack */ |
614 | #define HCI_EV_STACK_INTERNAL 0xFD | 657 | #define HCI_EV_STACK_INTERNAL 0xFD |
615 | struct hci_ev_stack_internal { | 658 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index bb9f81dc872..d84855fe733 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -31,10 +31,7 @@ | |||
31 | #define HCI_PROTO_L2CAP 0 | 31 | #define HCI_PROTO_L2CAP 0 |
32 | #define HCI_PROTO_SCO 1 | 32 | #define HCI_PROTO_SCO 1 |
33 | 33 | ||
34 | #define HCI_INIT_TIMEOUT (HZ * 10) | ||
35 | |||
36 | /* HCI Core structures */ | 34 | /* HCI Core structures */ |
37 | |||
38 | struct inquiry_data { | 35 | struct inquiry_data { |
39 | bdaddr_t bdaddr; | 36 | bdaddr_t bdaddr; |
40 | __u8 pscan_rep_mode; | 37 | __u8 pscan_rep_mode; |
@@ -81,6 +78,10 @@ struct hci_dev { | |||
81 | __u16 link_policy; | 78 | __u16 link_policy; |
82 | __u16 link_mode; | 79 | __u16 link_mode; |
83 | 80 | ||
81 | __u32 idle_timeout; | ||
82 | __u16 sniff_min_interval; | ||
83 | __u16 sniff_max_interval; | ||
84 | |||
84 | unsigned long quirks; | 85 | unsigned long quirks; |
85 | 86 | ||
86 | atomic_t cmd_cnt; | 87 | atomic_t cmd_cnt; |
@@ -123,7 +124,8 @@ struct hci_dev { | |||
123 | 124 | ||
124 | atomic_t promisc; | 125 | atomic_t promisc; |
125 | 126 | ||
126 | struct class_device class_dev; | 127 | struct device *parent; |
128 | struct device dev; | ||
127 | 129 | ||
128 | struct module *owner; | 130 | struct module *owner; |
129 | 131 | ||
@@ -145,18 +147,24 @@ struct hci_conn { | |||
145 | bdaddr_t dst; | 147 | bdaddr_t dst; |
146 | __u16 handle; | 148 | __u16 handle; |
147 | __u16 state; | 149 | __u16 state; |
150 | __u8 mode; | ||
148 | __u8 type; | 151 | __u8 type; |
149 | __u8 out; | 152 | __u8 out; |
150 | __u8 dev_class[3]; | 153 | __u8 dev_class[3]; |
154 | __u8 features[8]; | ||
155 | __u16 interval; | ||
156 | __u16 link_policy; | ||
151 | __u32 link_mode; | 157 | __u32 link_mode; |
158 | __u8 power_save; | ||
152 | unsigned long pend; | 159 | unsigned long pend; |
153 | 160 | ||
154 | unsigned int sent; | 161 | unsigned int sent; |
155 | 162 | ||
156 | struct sk_buff_head data_q; | 163 | struct sk_buff_head data_q; |
157 | 164 | ||
158 | struct timer_list timer; | 165 | struct timer_list disc_timer; |
159 | 166 | struct timer_list idle_timer; | |
167 | |||
160 | struct hci_dev *hdev; | 168 | struct hci_dev *hdev; |
161 | void *l2cap_data; | 169 | void *l2cap_data; |
162 | void *sco_data; | 170 | void *sco_data; |
@@ -211,7 +219,8 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | |||
211 | enum { | 219 | enum { |
212 | HCI_CONN_AUTH_PEND, | 220 | HCI_CONN_AUTH_PEND, |
213 | HCI_CONN_ENCRYPT_PEND, | 221 | HCI_CONN_ENCRYPT_PEND, |
214 | HCI_CONN_RSWITCH_PEND | 222 | HCI_CONN_RSWITCH_PEND, |
223 | HCI_CONN_MODE_CHANGE_PEND, | ||
215 | }; | 224 | }; |
216 | 225 | ||
217 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 226 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
@@ -286,31 +295,27 @@ int hci_conn_encrypt(struct hci_conn *conn); | |||
286 | int hci_conn_change_link_key(struct hci_conn *conn); | 295 | int hci_conn_change_link_key(struct hci_conn *conn); |
287 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); | 296 | int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); |
288 | 297 | ||
289 | static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout) | 298 | void hci_conn_enter_active_mode(struct hci_conn *conn); |
290 | { | 299 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); |
291 | mod_timer(&conn->timer, jiffies + timeout); | ||
292 | } | ||
293 | |||
294 | static inline void hci_conn_del_timer(struct hci_conn *conn) | ||
295 | { | ||
296 | del_timer(&conn->timer); | ||
297 | } | ||
298 | 300 | ||
299 | static inline void hci_conn_hold(struct hci_conn *conn) | 301 | static inline void hci_conn_hold(struct hci_conn *conn) |
300 | { | 302 | { |
301 | atomic_inc(&conn->refcnt); | 303 | atomic_inc(&conn->refcnt); |
302 | hci_conn_del_timer(conn); | 304 | del_timer(&conn->disc_timer); |
303 | } | 305 | } |
304 | 306 | ||
305 | static inline void hci_conn_put(struct hci_conn *conn) | 307 | static inline void hci_conn_put(struct hci_conn *conn) |
306 | { | 308 | { |
307 | if (atomic_dec_and_test(&conn->refcnt)) { | 309 | if (atomic_dec_and_test(&conn->refcnt)) { |
310 | unsigned long timeo; | ||
308 | if (conn->type == ACL_LINK) { | 311 | if (conn->type == ACL_LINK) { |
309 | unsigned long timeo = (conn->out) ? | 312 | timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); |
310 | HCI_DISCONN_TIMEOUT : HCI_DISCONN_TIMEOUT * 2; | 313 | if (!conn->out) |
311 | hci_conn_set_timer(conn, timeo); | 314 | timeo *= 2; |
315 | del_timer(&conn->idle_timer); | ||
312 | } else | 316 | } else |
313 | hci_conn_set_timer(conn, HZ / 100); | 317 | timeo = msecs_to_jiffies(10); |
318 | mod_timer(&conn->disc_timer, jiffies + timeo); | ||
314 | } | 319 | } |
315 | } | 320 | } |
316 | 321 | ||
@@ -408,11 +413,13 @@ static inline int hci_recv_frame(struct sk_buff *skb) | |||
408 | int hci_register_sysfs(struct hci_dev *hdev); | 413 | int hci_register_sysfs(struct hci_dev *hdev); |
409 | void hci_unregister_sysfs(struct hci_dev *hdev); | 414 | void hci_unregister_sysfs(struct hci_dev *hdev); |
410 | 415 | ||
411 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->class_dev.dev = (pdev)) | 416 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) |
412 | 417 | ||
413 | /* ----- LMP capabilities ----- */ | 418 | /* ----- LMP capabilities ----- */ |
414 | #define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH) | 419 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) |
415 | #define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT) | 420 | #define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) |
421 | #define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) | ||
422 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | ||
416 | 423 | ||
417 | /* ----- HCI protocols ----- */ | 424 | /* ----- HCI protocols ----- */ |
418 | struct hci_proto { | 425 | struct hci_proto { |
diff --git a/include/net/compat.h b/include/net/compat.h index e65cbedb6ab..9859b60280d 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef NET_COMPAT_H | 1 | #ifndef NET_COMPAT_H |
2 | #define NET_COMPAT_H | 2 | #define NET_COMPAT_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | 4 | ||
6 | struct sock; | 5 | struct sock; |
7 | 6 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 5161e89017f..36d54fc248b 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #ifndef _NET_DST_H | 8 | #ifndef _NET_DST_H |
9 | #define _NET_DST_H | 9 | #define _NET_DST_H |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/netdevice.h> | 11 | #include <linux/netdevice.h> |
13 | #include <linux/rtnetlink.h> | 12 | #include <linux/rtnetlink.h> |
14 | #include <linux/rcupdate.h> | 13 | #include <linux/rcupdate.h> |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 805de50df00..8c228726426 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -150,4 +150,24 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) | |||
150 | return nlmsg_unicast(genl_sock, skb, pid); | 150 | return nlmsg_unicast(genl_sock, skb, pid); |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | ||
154 | * gennlmsg_data - head of message payload | ||
155 | * @gnlh: genetlink messsage header | ||
156 | */ | ||
157 | static inline void *genlmsg_data(const struct genlmsghdr *gnlh) | ||
158 | { | ||
159 | return ((unsigned char *) gnlh + GENL_HDRLEN); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * genlmsg_len - length of message payload | ||
164 | * @gnlh: genetlink message header | ||
165 | */ | ||
166 | static inline int genlmsg_len(const struct genlmsghdr *gnlh) | ||
167 | { | ||
168 | struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh - | ||
169 | NLMSG_HDRLEN); | ||
170 | return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); | ||
171 | } | ||
172 | |||
153 | #endif /* __NET_GENERIC_NETLINK_H */ | 173 | #endif /* __NET_GENERIC_NETLINK_H */ |
diff --git a/include/net/icmp.h b/include/net/icmp.h index e7c3f20fbaf..05f8ff7d931 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #ifndef _ICMP_H | 18 | #ifndef _ICMP_H |
19 | #define _ICMP_H | 19 | #define _ICMP_H |
20 | 20 | ||
21 | #include <linux/config.h> | ||
22 | #include <linux/icmp.h> | 21 | #include <linux/icmp.h> |
23 | 22 | ||
24 | #include <net/inet_sock.h> | 23 | #include <net/inet_sock.h> |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index d5926bfb1fc..ecc42864b00 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
30 | #include <linux/wireless.h> | 30 | #include <linux/wireless.h> |
31 | 31 | ||
32 | #define IEEE80211_VERSION "git-1.1.7" | 32 | #define IEEE80211_VERSION "git-1.1.13" |
33 | 33 | ||
34 | #define IEEE80211_DATA_LEN 2304 | 34 | #define IEEE80211_DATA_LEN 2304 |
35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
@@ -104,6 +104,9 @@ | |||
104 | #define IEEE80211_SCTL_FRAG 0x000F | 104 | #define IEEE80211_SCTL_FRAG 0x000F |
105 | #define IEEE80211_SCTL_SEQ 0xFFF0 | 105 | #define IEEE80211_SCTL_SEQ 0xFFF0 |
106 | 106 | ||
107 | /* QOS control */ | ||
108 | #define IEEE80211_QCTL_TID 0x000F | ||
109 | |||
107 | /* debug macros */ | 110 | /* debug macros */ |
108 | 111 | ||
109 | #ifdef CONFIG_IEEE80211_DEBUG | 112 | #ifdef CONFIG_IEEE80211_DEBUG |
@@ -965,6 +968,7 @@ enum ieee80211_state { | |||
965 | 968 | ||
966 | enum { | 969 | enum { |
967 | IEEE80211_CH_PASSIVE_ONLY = (1 << 0), | 970 | IEEE80211_CH_PASSIVE_ONLY = (1 << 0), |
971 | IEEE80211_CH_80211H_RULES = (1 << 1), | ||
968 | IEEE80211_CH_B_ONLY = (1 << 2), | 972 | IEEE80211_CH_B_ONLY = (1 << 2), |
969 | IEEE80211_CH_NO_IBSS = (1 << 3), | 973 | IEEE80211_CH_NO_IBSS = (1 << 3), |
970 | IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), | 974 | IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), |
@@ -973,10 +977,10 @@ enum { | |||
973 | }; | 977 | }; |
974 | 978 | ||
975 | struct ieee80211_channel { | 979 | struct ieee80211_channel { |
976 | u32 freq; | 980 | u32 freq; /* in MHz */ |
977 | u8 channel; | 981 | u8 channel; |
978 | u8 flags; | 982 | u8 flags; |
979 | u8 max_power; | 983 | u8 max_power; /* in dBm */ |
980 | }; | 984 | }; |
981 | 985 | ||
982 | struct ieee80211_geo { | 986 | struct ieee80211_geo { |
@@ -1075,6 +1079,7 @@ struct ieee80211_device { | |||
1075 | 1079 | ||
1076 | int (*handle_management) (struct net_device * dev, | 1080 | int (*handle_management) (struct net_device * dev, |
1077 | struct ieee80211_network * network, u16 type); | 1081 | struct ieee80211_network * network, u16 type); |
1082 | int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); | ||
1078 | 1083 | ||
1079 | /* Typical STA methods */ | 1084 | /* Typical STA methods */ |
1080 | int (*handle_auth) (struct net_device * dev, | 1085 | int (*handle_auth) (struct net_device * dev, |
@@ -1243,7 +1248,8 @@ extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | |||
1243 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); | 1248 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); |
1244 | extern void ieee80211_txb_free(struct ieee80211_txb *); | 1249 | extern void ieee80211_txb_free(struct ieee80211_txb *); |
1245 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | 1250 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, |
1246 | struct ieee80211_hdr *frame, int len); | 1251 | struct ieee80211_hdr *frame, int hdr_len, |
1252 | int total_len, int encrypt_mpdu); | ||
1247 | 1253 | ||
1248 | /* ieee80211_rx.c */ | 1254 | /* ieee80211_rx.c */ |
1249 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1255 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 052ed596a4e..00ad810eb88 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -86,6 +86,9 @@ struct ieee80211softmac_assoc_info { | |||
86 | 86 | ||
87 | /* BSSID we're trying to associate to */ | 87 | /* BSSID we're trying to associate to */ |
88 | char bssid[ETH_ALEN]; | 88 | char bssid[ETH_ALEN]; |
89 | |||
90 | /* Rates supported by the network */ | ||
91 | struct ieee80211softmac_ratesinfo supported_rates; | ||
89 | 92 | ||
90 | /* some flags. | 93 | /* some flags. |
91 | * static_essid is valid if the essid is constant, | 94 | * static_essid is valid if the essid is constant, |
@@ -101,6 +104,7 @@ struct ieee80211softmac_assoc_info { | |||
101 | */ | 104 | */ |
102 | u8 static_essid:1, | 105 | u8 static_essid:1, |
103 | associating:1, | 106 | associating:1, |
107 | assoc_wait:1, | ||
104 | bssvalid:1, | 108 | bssvalid:1, |
105 | bssfixed:1; | 109 | bssfixed:1; |
106 | 110 | ||
@@ -132,23 +136,26 @@ enum { | |||
132 | struct ieee80211softmac_txrates { | 136 | struct ieee80211softmac_txrates { |
133 | /* The Bit-Rate to be used for multicast frames. */ | 137 | /* The Bit-Rate to be used for multicast frames. */ |
134 | u8 mcast_rate; | 138 | u8 mcast_rate; |
135 | /* The Bit-Rate to be used for multicast fallback | 139 | |
136 | * (If the device supports fallback and hardware-retry) | 140 | /* The Bit-Rate to be used for multicast management frames. */ |
137 | */ | 141 | u8 mgt_mcast_rate; |
138 | u8 mcast_fallback; | 142 | |
139 | /* The Bit-Rate to be used for any other (normal) data packet. */ | 143 | /* The Bit-Rate to be used for any other (normal) data packet. */ |
140 | u8 default_rate; | 144 | u8 default_rate; |
141 | /* The Bit-Rate to be used for default fallback | 145 | /* The Bit-Rate to be used for default fallback |
142 | * (If the device supports fallback and hardware-retry) | 146 | * (If the device supports fallback and hardware-retry) |
143 | */ | 147 | */ |
144 | u8 default_fallback; | 148 | u8 default_fallback; |
149 | |||
150 | /* This is the rate that the user asked for */ | ||
151 | u8 user_rate; | ||
145 | }; | 152 | }; |
146 | 153 | ||
147 | /* Bits for txrates_change callback. */ | 154 | /* Bits for txrates_change callback. */ |
148 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ | 155 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ |
149 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ | 156 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ |
150 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ | 157 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ |
151 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */ | 158 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ |
152 | 159 | ||
153 | struct ieee80211softmac_device { | 160 | struct ieee80211softmac_device { |
154 | /* 802.11 structure for data stuff */ | 161 | /* 802.11 structure for data stuff */ |
@@ -250,6 +257,28 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
250 | * Note that the rates need to be sorted. */ | 257 | * Note that the rates need to be sorted. */ |
251 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 258 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
252 | 259 | ||
260 | /* Helper function which advises you the rate at which a frame should be | ||
261 | * transmitted at. */ | ||
262 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | ||
263 | int is_multicast, | ||
264 | int is_mgt) | ||
265 | { | ||
266 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | ||
267 | |||
268 | if (!mac->associated) | ||
269 | return txrates->mgt_mcast_rate; | ||
270 | |||
271 | /* We are associated, sending unicast frame */ | ||
272 | if (!is_multicast) | ||
273 | return txrates->default_rate; | ||
274 | |||
275 | /* We are associated, sending multicast frame */ | ||
276 | if (is_mgt) | ||
277 | return txrates->mgt_mcast_rate; | ||
278 | else | ||
279 | return txrates->mcast_rate; | ||
280 | } | ||
281 | |||
253 | /* Start the SoftMAC. Call this after you initialized the device | 282 | /* Start the SoftMAC. Call this after you initialized the device |
254 | * and it is ready to run. | 283 | * and it is ready to run. |
255 | */ | 284 | */ |
@@ -282,7 +311,7 @@ extern void ieee80211softmac_stop(struct net_device *dev); | |||
282 | * - context set to the context data you want passed | 311 | * - context set to the context data you want passed |
283 | * The return value is 0, or an error. | 312 | * The return value is 0, or an error. |
284 | */ | 313 | */ |
285 | typedef void (*notify_function_ptr)(struct net_device *dev, void *context); | 314 | typedef void (*notify_function_ptr)(struct net_device *dev, int event_type, void *context); |
286 | 315 | ||
287 | #define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); | 316 | #define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); |
288 | #define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); | 317 | #define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); |
diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h index 3e0be453ece..4ee3ad57283 100644 --- a/include/net/ieee80211softmac_wx.h +++ b/include/net/ieee80211softmac_wx.h | |||
@@ -91,4 +91,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev, | |||
91 | struct iw_request_info *info, | 91 | struct iw_request_info *info, |
92 | union iwreq_data *wrqu, | 92 | union iwreq_data *wrqu, |
93 | char *extra); | 93 | char *extra); |
94 | extern int | ||
95 | ieee80211softmac_wx_set_mlme(struct net_device *dev, | ||
96 | struct iw_request_info *info, | ||
97 | union iwreq_data *wrqu, | ||
98 | char *extra); | ||
94 | #endif /* _IEEE80211SOFTMAC_WX */ | 99 | #endif /* _IEEE80211SOFTMAC_WX */ |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 59f0c83d55a..bc6a71dce98 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #ifndef _INET6_HASHTABLES_H | 14 | #ifndef _INET6_HASHTABLES_H |
15 | #define _INET6_HASHTABLES_H | 15 | #define _INET6_HASHTABLES_H |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | 17 | ||
19 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 18 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
20 | #include <linux/in6.h> | 19 | #include <linux/in6.h> |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 135d80fd658..98e0bb3014f 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #ifndef _INET_HASHTABLES_H | 14 | #ifndef _INET_HASHTABLES_H |
15 | #define _INET_HASHTABLES_H | 15 | #define _INET_HASHTABLES_H |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | 17 | ||
19 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
20 | #include <linux/ipv6.h> | 19 | #include <linux/ipv6.h> |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 883eb529ef8..1f4a9a60d4c 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #ifndef _INET_SOCK_H | 16 | #ifndef _INET_SOCK_H |
17 | #define _INET_SOCK_H | 17 | #define _INET_SOCK_H |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | 19 | ||
21 | #include <linux/string.h> | 20 | #include <linux/string.h> |
22 | #include <linux/types.h> | 21 | #include <linux/types.h> |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index e837f98fdb5..600cb543550 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #ifndef _INET_TIMEWAIT_SOCK_ | 15 | #ifndef _INET_TIMEWAIT_SOCK_ |
16 | #define _INET_TIMEWAIT_SOCK_ | 16 | #define _INET_TIMEWAIT_SOCK_ |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | 18 | ||
20 | #include <linux/list.h> | 19 | #include <linux/list.h> |
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
diff --git a/include/net/ip.h b/include/net/ip.h index 3d2e5ca62a5..98f90840077 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #ifndef _IP_H | 22 | #ifndef _IP_H |
23 | #define _IP_H | 23 | #define _IP_H |
24 | 24 | ||
25 | #include <linux/config.h> | ||
26 | #include <linux/types.h> | 25 | #include <linux/types.h> |
27 | #include <linux/ip.h> | 26 | #include <linux/ip.h> |
28 | #include <linux/in.h> | 27 | #include <linux/in.h> |
@@ -147,7 +146,6 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
147 | struct ipv4_config | 146 | struct ipv4_config |
148 | { | 147 | { |
149 | int log_martians; | 148 | int log_martians; |
150 | int autoconfig; | ||
151 | int no_pmtu_disc; | 149 | int no_pmtu_disc; |
152 | }; | 150 | }; |
153 | 151 | ||
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index a398ae5e30f..96b0e66406e 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -139,16 +139,22 @@ extern rwlock_t rt6_lock; | |||
139 | /* | 139 | /* |
140 | * Store a destination cache entry in a socket | 140 | * Store a destination cache entry in a socket |
141 | */ | 141 | */ |
142 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | 142 | static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, |
143 | struct in6_addr *daddr) | 143 | struct in6_addr *daddr) |
144 | { | 144 | { |
145 | struct ipv6_pinfo *np = inet6_sk(sk); | 145 | struct ipv6_pinfo *np = inet6_sk(sk); |
146 | struct rt6_info *rt = (struct rt6_info *) dst; | 146 | struct rt6_info *rt = (struct rt6_info *) dst; |
147 | 147 | ||
148 | write_lock(&sk->sk_dst_lock); | 148 | sk_setup_caps(sk, dst); |
149 | __sk_dst_set(sk, dst); | ||
150 | np->daddr_cache = daddr; | 149 | np->daddr_cache = daddr; |
151 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; | 150 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; |
151 | } | ||
152 | |||
153 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | ||
154 | struct in6_addr *daddr) | ||
155 | { | ||
156 | write_lock(&sk->sk_dst_lock); | ||
157 | __ip6_dst_store(sk, dst, daddr); | ||
152 | write_unlock(&sk->sk_dst_lock); | 158 | write_unlock(&sk->sk_dst_lock); |
153 | } | 159 | } |
154 | 160 | ||
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index e000fa2cd5f..a095d1dec7a 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #ifndef _NET_IP_FIB_H | 16 | #ifndef _NET_IP_FIB_H |
17 | #define _NET_IP_FIB_H | 17 | #define _NET_IP_FIB_H |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <net/flow.h> | 19 | #include <net/flow.h> |
21 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
22 | 21 | ||
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h index 77225735cbd..ac747b64734 100644 --- a/include/net/ip_mp_alg.h +++ b/include/net/ip_mp_alg.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #ifndef _NET_IP_MP_ALG_H | 7 | #ifndef _NET_IP_MP_ALG_H |
8 | #define _NET_IP_MP_ALG_H | 8 | #define _NET_IP_MP_ALG_H |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/ip_mp_alg.h> | 10 | #include <linux/ip_mp_alg.h> |
12 | #include <net/flow.h> | 11 | #include <net/flow.h> |
13 | #include <net/route.h> | 12 | #include <net/route.h> |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 7d2674fde19..3b57b159b65 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -248,7 +248,6 @@ struct ip_vs_daemon_user { | |||
248 | 248 | ||
249 | #ifdef __KERNEL__ | 249 | #ifdef __KERNEL__ |
250 | 250 | ||
251 | #include <linux/config.h> | ||
252 | #include <linux/list.h> /* for struct list_head */ | 251 | #include <linux/list.h> /* for struct list_head */ |
253 | #include <linux/spinlock.h> /* for struct rwlock_t */ | 252 | #include <linux/spinlock.h> /* for struct rwlock_t */ |
254 | #include <asm/atomic.h> /* for struct atomic_t */ | 253 | #include <asm/atomic.h> /* for struct atomic_t */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4abedb8eaec..ece7e8a84ff 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -104,7 +104,6 @@ struct frag_hdr { | |||
104 | 104 | ||
105 | #ifdef __KERNEL__ | 105 | #ifdef __KERNEL__ |
106 | 106 | ||
107 | #include <linux/config.h> | ||
108 | #include <net/sock.h> | 107 | #include <net/sock.h> |
109 | 108 | ||
110 | /* sysctls */ | 109 | /* sysctls */ |
@@ -469,6 +468,9 @@ extern void ip6_flush_pending_frames(struct sock *sk); | |||
469 | extern int ip6_dst_lookup(struct sock *sk, | 468 | extern int ip6_dst_lookup(struct sock *sk, |
470 | struct dst_entry **dst, | 469 | struct dst_entry **dst, |
471 | struct flowi *fl); | 470 | struct flowi *fl); |
471 | extern int ip6_sk_dst_lookup(struct sock *sk, | ||
472 | struct dst_entry **dst, | ||
473 | struct flowi *fl); | ||
472 | 474 | ||
473 | /* | 475 | /* |
474 | * skb processing functions | 476 | * skb processing functions |
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index 1880e46ecc9..1cb0607fcbb 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #ifndef NET_IRDA_H | 26 | #ifndef NET_IRDA_H |
27 | #define NET_IRDA_H | 27 | #define NET_IRDA_H |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/skbuff.h> /* struct sk_buff */ | 29 | #include <linux/skbuff.h> /* struct sk_buff */ |
31 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
32 | #include <linux/if.h> /* sa_family_t in <linux/irda.h> */ | 31 | #include <linux/if.h> /* sa_family_t in <linux/irda.h> */ |
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index 92c828029cd..bca19ca7bdd 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h | |||
@@ -39,7 +39,6 @@ | |||
39 | #ifndef IRDA_DEVICE_H | 39 | #ifndef IRDA_DEVICE_H |
40 | #define IRDA_DEVICE_H | 40 | #define IRDA_DEVICE_H |
41 | 41 | ||
42 | #include <linux/config.h> | ||
43 | #include <linux/tty.h> | 42 | #include <linux/tty.h> |
44 | #include <linux/netdevice.h> | 43 | #include <linux/netdevice.h> |
45 | #include <linux/spinlock.h> | 44 | #include <linux/spinlock.h> |
@@ -161,7 +160,7 @@ typedef struct { | |||
161 | int irq, irq2; /* Interrupts used */ | 160 | int irq, irq2; /* Interrupts used */ |
162 | int dma, dma2; /* DMA channel(s) used */ | 161 | int dma, dma2; /* DMA channel(s) used */ |
163 | int fifo_size; /* FIFO size */ | 162 | int fifo_size; /* FIFO size */ |
164 | int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */ | 163 | int irqflags; /* interrupt flags (ie, IRQF_SHARED|IRQF_DISABLED) */ |
165 | int direction; /* Link direction, used by some FIR drivers */ | 164 | int direction; /* Link direction, used by some FIR drivers */ |
166 | int enabled; /* Powered on? */ | 165 | int enabled; /* Powered on? */ |
167 | int suspended; /* Suspended by APM */ | 166 | int suspended; /* Suspended by APM */ |
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index 2127cae1e0a..e77eb88d922 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #ifndef IRLAP_H | 27 | #ifndef IRLAP_H |
28 | #define IRLAP_H | 28 | #define IRLAP_H |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/types.h> | 30 | #include <linux/types.h> |
32 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
33 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index c0c895d379b..11ecfa58a64 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include <asm/param.h> /* for HZ */ | 30 | #include <asm/param.h> /* for HZ */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | 33 | ||
35 | #include <net/irda/irda.h> | 34 | #include <net/irda/irda.h> |
diff --git a/include/net/irda/irlmp_frame.h b/include/net/irda/irlmp_frame.h index eb3ad158c02..c463f8bca85 100644 --- a/include/net/irda/irlmp_frame.h +++ b/include/net/irda/irlmp_frame.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #ifndef IRMLP_FRAME_H | 26 | #ifndef IRMLP_FRAME_H |
27 | #define IRMLP_FRAME_H | 27 | #define IRMLP_FRAME_H |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
31 | 30 | ||
32 | #include <net/irda/discovery.h> | 31 | #include <net/irda/discovery.h> |
diff --git a/include/net/irda/qos.h b/include/net/irda/qos.h index 9ae3d6bc242..cc577dc0a0e 100644 --- a/include/net/irda/qos.h +++ b/include/net/irda/qos.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #ifndef IRDA_QOS_H | 31 | #ifndef IRDA_QOS_H |
32 | #define IRDA_QOS_H | 32 | #define IRDA_QOS_H |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
36 | 35 | ||
37 | #include <net/irda/parameters.h> | 36 | #include <net/irda/parameters.h> |
diff --git a/include/net/llc_if.h b/include/net/llc_if.h index 090eaa0d71f..c608812a8e8 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/if.h> | 16 | #include <linux/if.h> |
17 | #include <linux/if_arp.h> | 17 | #include <linux/if_arp.h> |
18 | #include <linux/llc.h> | 18 | #include <linux/llc.h> |
19 | #include <linux/etherdevice.h> | ||
19 | #include <net/llc.h> | 20 | #include <net/llc.h> |
20 | 21 | ||
21 | #define LLC_DATAUNIT_PRIM 1 | 22 | #define LLC_DATAUNIT_PRIM 1 |
@@ -61,8 +62,6 @@ | |||
61 | #define LLC_STATUS_CONFLICT 7 /* disconnect conn */ | 62 | #define LLC_STATUS_CONFLICT 7 /* disconnect conn */ |
62 | #define LLC_STATUS_RESET_DONE 8 /* */ | 63 | #define LLC_STATUS_RESET_DONE 8 /* */ |
63 | 64 | ||
64 | extern u8 llc_mac_null_var[IFHWADDRLEN]; | ||
65 | |||
66 | /** | 65 | /** |
67 | * llc_mac_null - determines if a address is a null mac address | 66 | * llc_mac_null - determines if a address is a null mac address |
68 | * @mac: Mac address to test if null. | 67 | * @mac: Mac address to test if null. |
@@ -70,16 +69,20 @@ extern u8 llc_mac_null_var[IFHWADDRLEN]; | |||
70 | * Determines if a given address is a null mac address. Returns 0 if the | 69 | * Determines if a given address is a null mac address. Returns 0 if the |
71 | * address is not a null mac, 1 if the address is a null mac. | 70 | * address is not a null mac, 1 if the address is a null mac. |
72 | */ | 71 | */ |
73 | static __inline__ int llc_mac_null(u8 *mac) | 72 | static inline int llc_mac_null(const u8 *mac) |
74 | { | 73 | { |
75 | return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN); | 74 | return is_zero_ether_addr(mac); |
76 | } | 75 | } |
77 | 76 | ||
78 | static __inline__ int llc_addrany(struct llc_addr *addr) | 77 | static inline int llc_addrany(const struct llc_addr *addr) |
79 | { | 78 | { |
80 | return llc_mac_null(addr->mac) && !addr->lsap; | 79 | return llc_mac_null(addr->mac) && !addr->lsap; |
81 | } | 80 | } |
82 | 81 | ||
82 | static inline int llc_mac_multicast(const u8 *mac) | ||
83 | { | ||
84 | return is_multicast_ether_addr(mac); | ||
85 | } | ||
83 | /** | 86 | /** |
84 | * llc_mac_match - determines if two mac addresses are the same | 87 | * llc_mac_match - determines if two mac addresses are the same |
85 | * @mac1: First mac address to compare. | 88 | * @mac1: First mac address to compare. |
@@ -89,9 +92,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr) | |||
89 | * is not a complete match up to len, 1 if a complete match up to len is | 92 | * is not a complete match up to len, 1 if a complete match up to len is |
90 | * found. | 93 | * found. |
91 | */ | 94 | */ |
92 | static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2) | 95 | static inline int llc_mac_match(const u8 *mac1, const u8 *mac2) |
93 | { | 96 | { |
94 | return !memcmp(mac1, mac2, IFHWADDRLEN); | 97 | return !compare_ether_addr(mac1, mac2); |
95 | } | 98 | } |
96 | 99 | ||
97 | extern int llc_establish_connection(struct sock *sk, u8 *lmac, | 100 | extern int llc_establish_connection(struct sock *sk, u8 *lmac, |
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 91fa271a006..d3915dabe6d 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -37,7 +37,6 @@ enum { | |||
37 | 37 | ||
38 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
39 | 39 | ||
40 | #include <linux/config.h> | ||
41 | #include <linux/compiler.h> | 40 | #include <linux/compiler.h> |
42 | #include <linux/icmpv6.h> | 41 | #include <linux/icmpv6.h> |
43 | #include <linux/in6.h> | 42 | #include <linux/in6.h> |
diff --git a/include/net/netdma.h b/include/net/netdma.h new file mode 100644 index 00000000000..7f53cd1d8b1 --- /dev/null +++ b/include/net/netdma.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the Free | ||
6 | * Software Foundation; either version 2 of the License, or (at your option) | ||
7 | * any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 | ||
16 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called COPYING. | ||
20 | */ | ||
21 | #ifndef NETDMA_H | ||
22 | #define NETDMA_H | ||
23 | #include <linux/config.h> | ||
24 | #ifdef CONFIG_NET_DMA | ||
25 | #include <linux/dmaengine.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | |||
28 | static inline struct dma_chan *get_softnet_dma(void) | ||
29 | { | ||
30 | struct dma_chan *chan; | ||
31 | rcu_read_lock(); | ||
32 | chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma); | ||
33 | if (chan) | ||
34 | dma_chan_get(chan); | ||
35 | rcu_read_unlock(); | ||
36 | return chan; | ||
37 | } | ||
38 | |||
39 | int dma_skb_copy_datagram_iovec(struct dma_chan* chan, | ||
40 | struct sk_buff *skb, int offset, struct iovec *to, | ||
41 | size_t len, struct dma_pinned_list *pinned_list); | ||
42 | |||
43 | #endif /* CONFIG_NET_DMA */ | ||
44 | #endif /* NETDMA_H */ | ||
diff --git a/include/net/netevent.h b/include/net/netevent.h new file mode 100644 index 00000000000..e5d21624142 --- /dev/null +++ b/include/net/netevent.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _NET_EVENT_H | ||
2 | #define _NET_EVENT_H | ||
3 | |||
4 | /* | ||
5 | * Generic netevent notifiers | ||
6 | * | ||
7 | * Authors: | ||
8 | * Tom Tucker <tom@opengridcomputing.com> | ||
9 | * Steve Wise <swise@opengridcomputing.com> | ||
10 | * | ||
11 | * Changes: | ||
12 | */ | ||
13 | #ifdef __KERNEL__ | ||
14 | |||
15 | #include <net/dst.h> | ||
16 | |||
17 | struct netevent_redirect { | ||
18 | struct dst_entry *old; | ||
19 | struct dst_entry *new; | ||
20 | }; | ||
21 | |||
22 | enum netevent_notif_type { | ||
23 | NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ | ||
24 | NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */ | ||
25 | NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ | ||
26 | }; | ||
27 | |||
28 | extern int register_netevent_notifier(struct notifier_block *nb); | ||
29 | extern int unregister_netevent_notifier(struct notifier_block *nb); | ||
30 | extern int call_netevent_notifiers(unsigned long val, void *v); | ||
31 | |||
32 | #endif | ||
33 | #endif | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 916013ca4a5..1fbd8193d5f 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/netfilter/nf_conntrack_common.h> | 15 | #include <linux/netfilter/nf_conntrack_common.h> |
16 | 16 | ||
17 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
18 | #include <linux/config.h> | ||
19 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
20 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
21 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
@@ -114,6 +113,10 @@ struct nf_conn | |||
114 | u_int32_t mark; | 113 | u_int32_t mark; |
115 | #endif | 114 | #endif |
116 | 115 | ||
116 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | ||
117 | u_int32_t secmark; | ||
118 | #endif | ||
119 | |||
117 | /* Storage reserved for other modules: */ | 120 | /* Storage reserved for other modules: */ |
118 | union nf_conntrack_proto proto; | 121 | union nf_conntrack_proto proto; |
119 | 122 | ||
@@ -285,6 +288,7 @@ static inline int nf_ct_is_dying(struct nf_conn *ct) | |||
285 | } | 288 | } |
286 | 289 | ||
287 | extern unsigned int nf_conntrack_htable_size; | 290 | extern unsigned int nf_conntrack_htable_size; |
291 | extern int nf_conntrack_checksum; | ||
288 | 292 | ||
289 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) | 293 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) |
290 | 294 | ||
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h index 3cac19fb364..f1b1482d720 100644 --- a/include/net/netfilter/nf_conntrack_compat.h +++ b/include/net/netfilter/nf_conntrack_compat.h | |||
@@ -20,6 +20,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | |||
20 | } | 20 | } |
21 | #endif /* CONFIG_IP_NF_CONNTRACK_MARK */ | 21 | #endif /* CONFIG_IP_NF_CONNTRACK_MARK */ |
22 | 22 | ||
23 | #ifdef CONFIG_IP_NF_CONNTRACK_SECMARK | ||
24 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
25 | u_int32_t *ctinfo) | ||
26 | { | ||
27 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
28 | |||
29 | if (ct) | ||
30 | return &ct->secmark; | ||
31 | else | ||
32 | return NULL; | ||
33 | } | ||
34 | #endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */ | ||
35 | |||
23 | #ifdef CONFIG_IP_NF_CT_ACCT | 36 | #ifdef CONFIG_IP_NF_CT_ACCT |
24 | static inline struct ip_conntrack_counter * | 37 | static inline struct ip_conntrack_counter * |
25 | nf_ct_get_counters(const struct sk_buff *skb) | 38 | nf_ct_get_counters(const struct sk_buff *skb) |
@@ -70,6 +83,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | |||
70 | } | 83 | } |
71 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | 84 | #endif /* CONFIG_NF_CONNTRACK_MARK */ |
72 | 85 | ||
86 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | ||
87 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
88 | u_int32_t *ctinfo) | ||
89 | { | ||
90 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
91 | |||
92 | if (ct) | ||
93 | return &ct->secmark; | ||
94 | else | ||
95 | return NULL; | ||
96 | } | ||
97 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
98 | |||
73 | #ifdef CONFIG_NF_CT_ACCT | 99 | #ifdef CONFIG_NF_CT_ACCT |
74 | static inline struct ip_conntrack_counter * | 100 | static inline struct ip_conntrack_counter * |
75 | nf_ct_get_counters(const struct sk_buff *skb) | 101 | nf_ct_get_counters(const struct sk_buff *skb) |
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h index b225d8472b7..cf5e4d2e4c2 100644 --- a/include/net/pkt_act.h +++ b/include/net/pkt_act.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <asm/uaccess.h> | 4 | #include <asm/uaccess.h> |
5 | #include <asm/system.h> | 5 | #include <asm/system.h> |
6 | #include <linux/bitops.h> | 6 | #include <linux/bitops.h> |
7 | #include <linux/config.h> | ||
8 | #include <linux/types.h> | 7 | #include <linux/types.h> |
9 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
10 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index b94d1ad92c4..f6afee73235 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -171,14 +171,14 @@ psched_tod_diff(int delta_sec, int bound) | |||
171 | ({ \ | 171 | ({ \ |
172 | int __delta = (tv).tv_usec + (delta); \ | 172 | int __delta = (tv).tv_usec + (delta); \ |
173 | (tv_res).tv_sec = (tv).tv_sec; \ | 173 | (tv_res).tv_sec = (tv).tv_sec; \ |
174 | if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ | 174 | while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ |
175 | (tv_res).tv_usec = __delta; \ | 175 | (tv_res).tv_usec = __delta; \ |
176 | }) | 176 | }) |
177 | 177 | ||
178 | #define PSCHED_TADD(tv, delta) \ | 178 | #define PSCHED_TADD(tv, delta) \ |
179 | ({ \ | 179 | ({ \ |
180 | (tv).tv_usec += (delta); \ | 180 | (tv).tv_usec += (delta); \ |
181 | if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \ | 181 | while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \ |
182 | (tv).tv_usec -= USEC_PER_SEC; } \ | 182 | (tv).tv_usec -= USEC_PER_SEC; } \ |
183 | }) | 183 | }) |
184 | 184 | ||
@@ -218,12 +218,13 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, | |||
218 | struct rtattr *tab); | 218 | struct rtattr *tab); |
219 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); | 219 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); |
220 | 220 | ||
221 | extern int qdisc_restart(struct net_device *dev); | 221 | extern void __qdisc_run(struct net_device *dev); |
222 | 222 | ||
223 | static inline void qdisc_run(struct net_device *dev) | 223 | static inline void qdisc_run(struct net_device *dev) |
224 | { | 224 | { |
225 | while (!netif_queue_stopped(dev) && qdisc_restart(dev) < 0) | 225 | if (!netif_queue_stopped(dev) && |
226 | /* NOTHING */; | 226 | !test_and_set_bit(__LINK_STATE_QDISC_RUNNING, &dev->state)) |
227 | __qdisc_run(dev); | ||
227 | } | 228 | } |
228 | 229 | ||
229 | extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, | 230 | extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, |
diff --git a/include/net/protocol.h b/include/net/protocol.h index 6dc5970612d..c643bce64e5 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _PROTOCOL_H | 24 | #ifndef _PROTOCOL_H |
25 | #define _PROTOCOL_H | 25 | #define _PROTOCOL_H |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/in6.h> | 27 | #include <linux/in6.h> |
29 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 28 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
30 | #include <linux/ipv6.h> | 29 | #include <linux/ipv6.h> |
@@ -37,6 +36,9 @@ | |||
37 | struct net_protocol { | 36 | struct net_protocol { |
38 | int (*handler)(struct sk_buff *skb); | 37 | int (*handler)(struct sk_buff *skb); |
39 | void (*err_handler)(struct sk_buff *skb, u32 info); | 38 | void (*err_handler)(struct sk_buff *skb, u32 info); |
39 | int (*gso_send_check)(struct sk_buff *skb); | ||
40 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | ||
41 | int features); | ||
40 | int no_policy; | 42 | int no_policy; |
41 | }; | 43 | }; |
42 | 44 | ||
@@ -49,11 +51,18 @@ struct inet6_protocol | |||
49 | struct inet6_skb_parm *opt, | 51 | struct inet6_skb_parm *opt, |
50 | int type, int code, int offset, | 52 | int type, int code, int offset, |
51 | __u32 info); | 53 | __u32 info); |
54 | |||
55 | int (*gso_send_check)(struct sk_buff *skb); | ||
56 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | ||
57 | int features); | ||
58 | |||
52 | unsigned int flags; /* INET6_PROTO_xxx */ | 59 | unsigned int flags; /* INET6_PROTO_xxx */ |
53 | }; | 60 | }; |
54 | 61 | ||
55 | #define INET6_PROTO_NOPOLICY 0x1 | 62 | #define INET6_PROTO_NOPOLICY 0x1 |
56 | #define INET6_PROTO_FINAL 0x2 | 63 | #define INET6_PROTO_FINAL 0x2 |
64 | /* This should be set for any extension header which is compatible with GSO. */ | ||
65 | #define INET6_PROTO_GSO_EXTHDR 0x4 | ||
57 | #endif | 66 | #endif |
58 | 67 | ||
59 | /* This is used to register socket interfaces for IP protocols. */ | 68 | /* This is used to register socket interfaces for IP protocols. */ |
diff --git a/include/net/raw.h b/include/net/raw.h index e67b28a0248..e4af5978194 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #ifndef _RAW_H | 17 | #ifndef _RAW_H |
18 | #define _RAW_H | 18 | #define _RAW_H |
19 | 19 | ||
20 | #include <linux/config.h> | ||
21 | 20 | ||
22 | #include <net/protocol.h> | 21 | #include <net/protocol.h> |
23 | 22 | ||
@@ -36,7 +35,7 @@ extern rwlock_t raw_v4_lock; | |||
36 | 35 | ||
37 | 36 | ||
38 | extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, | 37 | extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, |
39 | unsigned long raddr, unsigned long laddr, | 38 | __be32 raddr, __be32 laddr, |
40 | int dif); | 39 | int dif); |
41 | 40 | ||
42 | extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); | 41 | extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); |
diff --git a/include/net/red.h b/include/net/red.h index 2ed4358e329..a4eb37946f2 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __NET_SCHED_RED_H | 1 | #ifndef __NET_SCHED_RED_H |
2 | #define __NET_SCHED_RED_H | 2 | #define __NET_SCHED_RED_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | #include <net/pkt_sched.h> | 5 | #include <net/pkt_sched.h> |
7 | #include <net/inet_ecn.h> | 6 | #include <net/inet_ecn.h> |
@@ -213,7 +212,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
213 | * Seems, it is the best solution to | 212 | * Seems, it is the best solution to |
214 | * problem of too coarse exponent tabulation. | 213 | * problem of too coarse exponent tabulation. |
215 | */ | 214 | */ |
216 | us_idle = (p->qavg * us_idle) >> p->Scell_log; | 215 | us_idle = (p->qavg * (u64)us_idle) >> p->Scell_log; |
217 | 216 | ||
218 | if (us_idle < (p->qavg >> 1)) | 217 | if (us_idle < (p->qavg >> 1)) |
219 | return p->qavg - us_idle; | 218 | return p->qavg - us_idle; |
diff --git a/include/net/route.h b/include/net/route.h index 98c915abdec..c4a068692dc 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _ROUTE_H | 24 | #ifndef _ROUTE_H |
25 | #define _ROUTE_H | 25 | #define _ROUTE_H |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <net/dst.h> | 27 | #include <net/dst.h> |
29 | #include <net/inetpeer.h> | 28 | #include <net/inetpeer.h> |
30 | #include <net/flow.h> | 29 | #include <net/flow.h> |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 7b6ec998671..b0e9108a4e1 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __NET_SCHED_GENERIC_H | 1 | #ifndef __NET_SCHED_GENERIC_H |
2 | #define __NET_SCHED_GENERIC_H | 2 | #define __NET_SCHED_GENERIC_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
6 | #include <linux/types.h> | 5 | #include <linux/types.h> |
7 | #include <linux/rcupdate.h> | 6 | #include <linux/rcupdate.h> |
diff --git a/include/net/scm.h b/include/net/scm.h index 540619cb716..5637d5e22d5 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/limits.h> | 4 | #include <linux/limits.h> |
5 | #include <linux/net.h> | 5 | #include <linux/net.h> |
6 | #include <linux/security.h> | ||
6 | 7 | ||
7 | /* Well, we should have at least one descriptor open | 8 | /* Well, we should have at least one descriptor open |
8 | * to accept passed FDs 8) | 9 | * to accept passed FDs 8) |
@@ -19,6 +20,9 @@ struct scm_cookie | |||
19 | { | 20 | { |
20 | struct ucred creds; /* Skb credentials */ | 21 | struct ucred creds; /* Skb credentials */ |
21 | struct scm_fp_list *fp; /* Passed files */ | 22 | struct scm_fp_list *fp; /* Passed files */ |
23 | #ifdef CONFIG_SECURITY_NETWORK | ||
24 | u32 secid; /* Passed security ID */ | ||
25 | #endif | ||
22 | unsigned long seq; /* Connection seqno */ | 26 | unsigned long seq; /* Connection seqno */ |
23 | }; | 27 | }; |
24 | 28 | ||
@@ -28,6 +32,16 @@ extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie | |||
28 | extern void __scm_destroy(struct scm_cookie *scm); | 32 | extern void __scm_destroy(struct scm_cookie *scm); |
29 | extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); | 33 | extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); |
30 | 34 | ||
35 | #ifdef CONFIG_SECURITY_NETWORK | ||
36 | static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) | ||
37 | { | ||
38 | security_socket_getpeersec_dgram(sock, NULL, &scm->secid); | ||
39 | } | ||
40 | #else | ||
41 | static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) | ||
42 | { } | ||
43 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
44 | |||
31 | static __inline__ void scm_destroy(struct scm_cookie *scm) | 45 | static __inline__ void scm_destroy(struct scm_cookie *scm) |
32 | { | 46 | { |
33 | if (scm && scm->fp) | 47 | if (scm && scm->fp) |
@@ -43,11 +57,33 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, | |||
43 | scm->creds.pid = p->tgid; | 57 | scm->creds.pid = p->tgid; |
44 | scm->fp = NULL; | 58 | scm->fp = NULL; |
45 | scm->seq = 0; | 59 | scm->seq = 0; |
60 | unix_get_peersec_dgram(sock, scm); | ||
46 | if (msg->msg_controllen <= 0) | 61 | if (msg->msg_controllen <= 0) |
47 | return 0; | 62 | return 0; |
48 | return __scm_send(sock, msg, scm); | 63 | return __scm_send(sock, msg, scm); |
49 | } | 64 | } |
50 | 65 | ||
66 | #ifdef CONFIG_SECURITY_NETWORK | ||
67 | static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) | ||
68 | { | ||
69 | char *secdata; | ||
70 | u32 seclen; | ||
71 | int err; | ||
72 | |||
73 | if (test_bit(SOCK_PASSSEC, &sock->flags)) { | ||
74 | err = security_secid_to_secctx(scm->secid, &secdata, &seclen); | ||
75 | |||
76 | if (!err) { | ||
77 | put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, seclen, secdata); | ||
78 | security_release_secctx(secdata, seclen); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | #else | ||
83 | static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) | ||
84 | { } | ||
85 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
86 | |||
51 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | 87 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, |
52 | struct scm_cookie *scm, int flags) | 88 | struct scm_cookie *scm, int flags) |
53 | { | 89 | { |
@@ -62,6 +98,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, | |||
62 | if (test_bit(SOCK_PASSCRED, &sock->flags)) | 98 | if (test_bit(SOCK_PASSCRED, &sock->flags)) |
63 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); | 99 | put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); |
64 | 100 | ||
101 | scm_passec(sock, msg, scm); | ||
102 | |||
65 | if (!scm->fp) | 103 | if (!scm->fp) |
66 | return; | 104 | return; |
67 | 105 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index aa6033ca7cd..92eae0e0f3f 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -63,7 +63,6 @@ | |||
63 | */ | 63 | */ |
64 | 64 | ||
65 | 65 | ||
66 | #include <linux/config.h> | ||
67 | 66 | ||
68 | #ifdef TEST_FRAME | 67 | #ifdef TEST_FRAME |
69 | #undef CONFIG_PROC_FS | 68 | #undef CONFIG_PROC_FS |
@@ -405,19 +404,6 @@ static inline int sctp_list_single_entry(struct list_head *head) | |||
405 | return ((head->next != head) && (head->next == head->prev)); | 404 | return ((head->next != head) && (head->next == head->prev)); |
406 | } | 405 | } |
407 | 406 | ||
408 | /* Calculate the size (in bytes) occupied by the data of an iovec. */ | ||
409 | static inline size_t get_user_iov_size(struct iovec *iov, int iovlen) | ||
410 | { | ||
411 | size_t retval = 0; | ||
412 | |||
413 | for (; iovlen > 0; --iovlen) { | ||
414 | retval += iov->iov_len; | ||
415 | iov++; | ||
416 | } | ||
417 | |||
418 | return retval; | ||
419 | } | ||
420 | |||
421 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ | 407 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ |
422 | static inline __s32 sctp_jitter(__u32 rto) | 408 | static inline __s32 sctp_jitter(__u32 rto) |
423 | { | 409 | { |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 1eac3d0eb7a..de313de4fef 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -221,8 +221,7 @@ struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *, | |||
221 | const struct sctp_chunk *, | 221 | const struct sctp_chunk *, |
222 | __u32 tsn); | 222 | __u32 tsn); |
223 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, | 223 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, |
224 | const struct sctp_chunk *, | 224 | const struct msghdr *, size_t msg_len); |
225 | const struct msghdr *); | ||
226 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, | 225 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, |
227 | const struct sctp_chunk *, | 226 | const struct sctp_chunk *, |
228 | const __u8 *, | 227 | const __u8 *, |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 7f4fea173fb..e5aa7ff1f5b 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -445,6 +445,7 @@ typedef struct sctp_sender_hb_info { | |||
445 | struct sctp_paramhdr param_hdr; | 445 | struct sctp_paramhdr param_hdr; |
446 | union sctp_addr daddr; | 446 | union sctp_addr daddr; |
447 | unsigned long sent_at; | 447 | unsigned long sent_at; |
448 | __u64 hb_nonce; | ||
448 | } __attribute__((packed)) sctp_sender_hb_info_t; | 449 | } __attribute__((packed)) sctp_sender_hb_info_t; |
449 | 450 | ||
450 | /* | 451 | /* |
@@ -555,7 +556,8 @@ struct sctp_af { | |||
555 | int (*to_addr_param) (const union sctp_addr *, | 556 | int (*to_addr_param) (const union sctp_addr *, |
556 | union sctp_addr_param *); | 557 | union sctp_addr_param *); |
557 | int (*addr_valid) (union sctp_addr *, | 558 | int (*addr_valid) (union sctp_addr *, |
558 | struct sctp_sock *); | 559 | struct sctp_sock *, |
560 | const struct sk_buff *); | ||
559 | sctp_scope_t (*scope) (union sctp_addr *); | 561 | sctp_scope_t (*scope) (union sctp_addr *); |
560 | void (*inaddr_any) (union sctp_addr *, unsigned short); | 562 | void (*inaddr_any) (union sctp_addr *, unsigned short); |
561 | int (*is_any) (const union sctp_addr *); | 563 | int (*is_any) (const union sctp_addr *); |
@@ -729,13 +731,10 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, | |||
729 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | 731 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); |
730 | 732 | ||
731 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 733 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
732 | /* sin_family -- AF_INET or AF_INET6 | ||
733 | * sin_port -- ordinary port number | ||
734 | * sin_addr -- cast to either (struct in_addr) or (struct in6_addr) | ||
735 | */ | ||
736 | struct sctp_sockaddr_entry { | 734 | struct sctp_sockaddr_entry { |
737 | struct list_head list; | 735 | struct list_head list; |
738 | union sctp_addr a; | 736 | union sctp_addr a; |
737 | __u8 use_as_src; | ||
739 | }; | 738 | }; |
740 | 739 | ||
741 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); | 740 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); |
@@ -983,6 +982,9 @@ struct sctp_transport { | |||
983 | */ | 982 | */ |
984 | char cacc_saw_newack; | 983 | char cacc_saw_newack; |
985 | } cacc; | 984 | } cacc; |
985 | |||
986 | /* 64-bit random number sent with heartbeat. */ | ||
987 | __u64 hb_nonce; | ||
986 | }; | 988 | }; |
987 | 989 | ||
988 | struct sctp_transport *sctp_transport_new(const union sctp_addr *, | 990 | struct sctp_transport *sctp_transport_new(const union sctp_addr *, |
@@ -1137,7 +1139,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
1137 | sctp_scope_t scope, gfp_t gfp, | 1139 | sctp_scope_t scope, gfp_t gfp, |
1138 | int flags); | 1140 | int flags); |
1139 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1141 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1140 | gfp_t gfp); | 1142 | __u8 use_as_src, gfp_t gfp); |
1141 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1143 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
1142 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1144 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1143 | struct sctp_sock *); | 1145 | struct sctp_sock *); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 8a6bef6f91e..1b7aae6cdd8 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -560,9 +560,18 @@ struct sctp_paddrinfo { | |||
560 | } __attribute__((packed, aligned(4))); | 560 | } __attribute__((packed, aligned(4))); |
561 | 561 | ||
562 | /* Peer addresses's state. */ | 562 | /* Peer addresses's state. */ |
563 | /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] | ||
564 | * calls. | ||
565 | * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. | ||
566 | * Not yet confirmed by a heartbeat and not available for data | ||
567 | * transfers. | ||
568 | * ACTIVE : Peer address confirmed, active and available for data transfers. | ||
569 | * INACTIVE: Peer address inactive and not available for data transfers. | ||
570 | */ | ||
563 | enum sctp_spinfo_state { | 571 | enum sctp_spinfo_state { |
564 | SCTP_INACTIVE, | 572 | SCTP_INACTIVE, |
565 | SCTP_ACTIVE, | 573 | SCTP_ACTIVE, |
574 | SCTP_UNCONFIRMED, | ||
566 | SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ | 575 | SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ |
567 | }; | 576 | }; |
568 | 577 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index c9fad6fb629..324b3ea233d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -40,11 +40,11 @@ | |||
40 | #ifndef _SOCK_H | 40 | #ifndef _SOCK_H |
41 | #define _SOCK_H | 41 | #define _SOCK_H |
42 | 42 | ||
43 | #include <linux/config.h> | ||
44 | #include <linux/list.h> | 43 | #include <linux/list.h> |
45 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
46 | #include <linux/cache.h> | 45 | #include <linux/cache.h> |
47 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/lockdep.h> | ||
48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
49 | #include <linux/skbuff.h> /* struct sk_buff */ | 49 | #include <linux/skbuff.h> /* struct sk_buff */ |
50 | #include <linux/security.h> | 50 | #include <linux/security.h> |
@@ -79,14 +79,17 @@ typedef struct { | |||
79 | spinlock_t slock; | 79 | spinlock_t slock; |
80 | struct sock_iocb *owner; | 80 | struct sock_iocb *owner; |
81 | wait_queue_head_t wq; | 81 | wait_queue_head_t wq; |
82 | /* | ||
83 | * We express the mutex-alike socket_lock semantics | ||
84 | * to the lock validator by explicitly managing | ||
85 | * the slock as a lock variant (in addition to | ||
86 | * the slock itself): | ||
87 | */ | ||
88 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
89 | struct lockdep_map dep_map; | ||
90 | #endif | ||
82 | } socket_lock_t; | 91 | } socket_lock_t; |
83 | 92 | ||
84 | #define sock_lock_init(__sk) \ | ||
85 | do { spin_lock_init(&((__sk)->sk_lock.slock)); \ | ||
86 | (__sk)->sk_lock.owner = NULL; \ | ||
87 | init_waitqueue_head(&((__sk)->sk_lock.wq)); \ | ||
88 | } while(0) | ||
89 | |||
90 | struct sock; | 93 | struct sock; |
91 | struct proto; | 94 | struct proto; |
92 | 95 | ||
@@ -132,6 +135,7 @@ struct sock_common { | |||
132 | * @sk_receive_queue: incoming packets | 135 | * @sk_receive_queue: incoming packets |
133 | * @sk_wmem_alloc: transmit queue bytes committed | 136 | * @sk_wmem_alloc: transmit queue bytes committed |
134 | * @sk_write_queue: Packet sending queue | 137 | * @sk_write_queue: Packet sending queue |
138 | * @sk_async_wait_queue: DMA copied packets | ||
135 | * @sk_omem_alloc: "o" is "option" or "other" | 139 | * @sk_omem_alloc: "o" is "option" or "other" |
136 | * @sk_wmem_queued: persistent queue size | 140 | * @sk_wmem_queued: persistent queue size |
137 | * @sk_forward_alloc: space allocated forward | 141 | * @sk_forward_alloc: space allocated forward |
@@ -140,6 +144,7 @@ struct sock_common { | |||
140 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings | 144 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings |
141 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 145 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
142 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 146 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
147 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | ||
143 | * @sk_lingertime: %SO_LINGER l_linger setting | 148 | * @sk_lingertime: %SO_LINGER l_linger setting |
144 | * @sk_backlog: always used with the per-socket spinlock held | 149 | * @sk_backlog: always used with the per-socket spinlock held |
145 | * @sk_callback_lock: used with the callbacks in the end of this struct | 150 | * @sk_callback_lock: used with the callbacks in the end of this struct |
@@ -205,11 +210,13 @@ struct sock { | |||
205 | atomic_t sk_omem_alloc; | 210 | atomic_t sk_omem_alloc; |
206 | struct sk_buff_head sk_receive_queue; | 211 | struct sk_buff_head sk_receive_queue; |
207 | struct sk_buff_head sk_write_queue; | 212 | struct sk_buff_head sk_write_queue; |
213 | struct sk_buff_head sk_async_wait_queue; | ||
208 | int sk_wmem_queued; | 214 | int sk_wmem_queued; |
209 | int sk_forward_alloc; | 215 | int sk_forward_alloc; |
210 | gfp_t sk_allocation; | 216 | gfp_t sk_allocation; |
211 | int sk_sndbuf; | 217 | int sk_sndbuf; |
212 | int sk_route_caps; | 218 | int sk_route_caps; |
219 | int sk_gso_type; | ||
213 | int sk_rcvlowat; | 220 | int sk_rcvlowat; |
214 | unsigned long sk_flags; | 221 | unsigned long sk_flags; |
215 | unsigned long sk_lingertime; | 222 | unsigned long sk_lingertime; |
@@ -382,7 +389,6 @@ enum sock_flags { | |||
382 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ | 389 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ |
383 | SOCK_DBG, /* %SO_DEBUG setting */ | 390 | SOCK_DBG, /* %SO_DEBUG setting */ |
384 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ | 391 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ |
385 | SOCK_NO_LARGESEND, /* whether to sent large segments or not */ | ||
386 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 392 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
387 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 393 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
388 | }; | 394 | }; |
@@ -745,6 +751,9 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
745 | 751 | ||
746 | /* BH context may only use the following locking interface. */ | 752 | /* BH context may only use the following locking interface. */ |
747 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) | 753 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) |
754 | #define bh_lock_sock_nested(__sk) \ | ||
755 | spin_lock_nested(&((__sk)->sk_lock.slock), \ | ||
756 | SINGLE_DEPTH_NESTING) | ||
748 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 757 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
749 | 758 | ||
750 | extern struct sock *sk_alloc(int family, | 759 | extern struct sock *sk_alloc(int family, |
@@ -871,10 +880,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | |||
871 | if (filter) { | 880 | if (filter) { |
872 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, | 881 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, |
873 | filter->len); | 882 | filter->len); |
874 | if (!pkt_len) | 883 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; |
875 | err = -EPERM; | ||
876 | else | ||
877 | skb_trim(skb, pkt_len); | ||
878 | } | 884 | } |
879 | 885 | ||
880 | if (needlock) | 886 | if (needlock) |
@@ -1028,13 +1034,22 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | |||
1028 | 1034 | ||
1029 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); | 1035 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); |
1030 | 1036 | ||
1037 | static inline int sk_can_gso(const struct sock *sk) | ||
1038 | { | ||
1039 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); | ||
1040 | } | ||
1041 | |||
1031 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1042 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) |
1032 | { | 1043 | { |
1033 | __sk_dst_set(sk, dst); | 1044 | __sk_dst_set(sk, dst); |
1034 | sk->sk_route_caps = dst->dev->features; | 1045 | sk->sk_route_caps = dst->dev->features; |
1035 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1046 | if (sk->sk_route_caps & NETIF_F_GSO) |
1036 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) | 1047 | sk->sk_route_caps |= NETIF_F_GSO_MASK; |
1037 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1048 | if (sk_can_gso(sk)) { |
1049 | if (dst->header_len) | ||
1050 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; | ||
1051 | else | ||
1052 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
1038 | } | 1053 | } |
1039 | } | 1054 | } |
1040 | 1055 | ||
@@ -1267,15 +1282,27 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
1267 | * sk_eat_skb - Release a skb if it is no longer needed | 1282 | * sk_eat_skb - Release a skb if it is no longer needed |
1268 | * @sk: socket to eat this skb from | 1283 | * @sk: socket to eat this skb from |
1269 | * @skb: socket buffer to eat | 1284 | * @skb: socket buffer to eat |
1285 | * @copied_early: flag indicating whether DMA operations copied this data early | ||
1270 | * | 1286 | * |
1271 | * This routine must be called with interrupts disabled or with the socket | 1287 | * This routine must be called with interrupts disabled or with the socket |
1272 | * locked so that the sk_buff queue operation is ok. | 1288 | * locked so that the sk_buff queue operation is ok. |
1273 | */ | 1289 | */ |
1274 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) | 1290 | #ifdef CONFIG_NET_DMA |
1291 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) | ||
1292 | { | ||
1293 | __skb_unlink(skb, &sk->sk_receive_queue); | ||
1294 | if (!copied_early) | ||
1295 | __kfree_skb(skb); | ||
1296 | else | ||
1297 | __skb_queue_tail(&sk->sk_async_wait_queue, skb); | ||
1298 | } | ||
1299 | #else | ||
1300 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) | ||
1275 | { | 1301 | { |
1276 | __skb_unlink(skb, &sk->sk_receive_queue); | 1302 | __skb_unlink(skb, &sk->sk_receive_queue); |
1277 | __kfree_skb(skb); | 1303 | __kfree_skb(skb); |
1278 | } | 1304 | } |
1305 | #endif | ||
1279 | 1306 | ||
1280 | extern void sock_enable_timestamp(struct sock *sk); | 1307 | extern void sock_enable_timestamp(struct sock *sk); |
1281 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1308 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 3c989db8a7a..7a093d0aa0f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -21,13 +21,13 @@ | |||
21 | #define TCP_DEBUG 1 | 21 | #define TCP_DEBUG 1 |
22 | #define FASTRETRANS_DEBUG 1 | 22 | #define FASTRETRANS_DEBUG 1 |
23 | 23 | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/list.h> | 24 | #include <linux/list.h> |
26 | #include <linux/tcp.h> | 25 | #include <linux/tcp.h> |
27 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
28 | #include <linux/cache.h> | 27 | #include <linux/cache.h> |
29 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
30 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
30 | #include <linux/dmaengine.h> | ||
31 | 31 | ||
32 | #include <net/inet_connection_sock.h> | 32 | #include <net/inet_connection_sock.h> |
33 | #include <net/inet_timewait_sock.h> | 33 | #include <net/inet_timewait_sock.h> |
@@ -218,6 +218,7 @@ extern int sysctl_tcp_adv_win_scale; | |||
218 | extern int sysctl_tcp_tw_reuse; | 218 | extern int sysctl_tcp_tw_reuse; |
219 | extern int sysctl_tcp_frto; | 219 | extern int sysctl_tcp_frto; |
220 | extern int sysctl_tcp_low_latency; | 220 | extern int sysctl_tcp_low_latency; |
221 | extern int sysctl_tcp_dma_copybreak; | ||
221 | extern int sysctl_tcp_nometrics_save; | 222 | extern int sysctl_tcp_nometrics_save; |
222 | extern int sysctl_tcp_moderate_rcvbuf; | 223 | extern int sysctl_tcp_moderate_rcvbuf; |
223 | extern int sysctl_tcp_tso_win_divisor; | 224 | extern int sysctl_tcp_tso_win_divisor; |
@@ -225,6 +226,7 @@ extern int sysctl_tcp_abc; | |||
225 | extern int sysctl_tcp_mtu_probing; | 226 | extern int sysctl_tcp_mtu_probing; |
226 | extern int sysctl_tcp_base_mss; | 227 | extern int sysctl_tcp_base_mss; |
227 | extern int sysctl_tcp_workaround_signed_windows; | 228 | extern int sysctl_tcp_workaround_signed_windows; |
229 | extern int sysctl_tcp_slow_start_after_idle; | ||
228 | 230 | ||
229 | extern atomic_t tcp_memory_allocated; | 231 | extern atomic_t tcp_memory_allocated; |
230 | extern atomic_t tcp_sockets_allocated; | 232 | extern atomic_t tcp_sockets_allocated; |
@@ -293,6 +295,8 @@ extern int tcp_rcv_established(struct sock *sk, | |||
293 | 295 | ||
294 | extern void tcp_rcv_space_adjust(struct sock *sk); | 296 | extern void tcp_rcv_space_adjust(struct sock *sk); |
295 | 297 | ||
298 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | ||
299 | |||
296 | extern int tcp_twsk_unique(struct sock *sk, | 300 | extern int tcp_twsk_unique(struct sock *sk, |
297 | struct sock *sktw, void *twp); | 301 | struct sock *sktw, void *twp); |
298 | 302 | ||
@@ -565,13 +569,13 @@ struct tcp_skb_cb { | |||
565 | */ | 569 | */ |
566 | static inline int tcp_skb_pcount(const struct sk_buff *skb) | 570 | static inline int tcp_skb_pcount(const struct sk_buff *skb) |
567 | { | 571 | { |
568 | return skb_shinfo(skb)->tso_segs; | 572 | return skb_shinfo(skb)->gso_segs; |
569 | } | 573 | } |
570 | 574 | ||
571 | /* This is valid iff tcp_skb_pcount() > 1. */ | 575 | /* This is valid iff tcp_skb_pcount() > 1. */ |
572 | static inline int tcp_skb_mss(const struct sk_buff *skb) | 576 | static inline int tcp_skb_mss(const struct sk_buff *skb) |
573 | { | 577 | { |
574 | return skb_shinfo(skb)->tso_size; | 578 | return skb_shinfo(skb)->gso_size; |
575 | } | 579 | } |
576 | 580 | ||
577 | static inline void tcp_dec_pcount_approx(__u32 *count, | 581 | static inline void tcp_dec_pcount_approx(__u32 *count, |
@@ -628,7 +632,7 @@ struct tcp_congestion_ops { | |||
628 | /* return slow start threshold (required) */ | 632 | /* return slow start threshold (required) */ |
629 | u32 (*ssthresh)(struct sock *sk); | 633 | u32 (*ssthresh)(struct sock *sk); |
630 | /* lower bound for congestion window (optional) */ | 634 | /* lower bound for congestion window (optional) */ |
631 | u32 (*min_cwnd)(struct sock *sk); | 635 | u32 (*min_cwnd)(const struct sock *sk); |
632 | /* do new cwnd calculation (required) */ | 636 | /* do new cwnd calculation (required) */ |
633 | void (*cong_avoid)(struct sock *sk, u32 ack, | 637 | void (*cong_avoid)(struct sock *sk, u32 ack, |
634 | u32 rtt, u32 in_flight, int good_ack); | 638 | u32 rtt, u32 in_flight, int good_ack); |
@@ -663,7 +667,7 @@ extern struct tcp_congestion_ops tcp_init_congestion_ops; | |||
663 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 667 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
664 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, | 668 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, |
665 | u32 rtt, u32 in_flight, int flag); | 669 | u32 rtt, u32 in_flight, int flag); |
666 | extern u32 tcp_reno_min_cwnd(struct sock *sk); | 670 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); |
667 | extern struct tcp_congestion_ops tcp_reno; | 671 | extern struct tcp_congestion_ops tcp_reno; |
668 | 672 | ||
669 | static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) | 673 | static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) |
@@ -747,7 +751,7 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | |||
747 | if (in_flight >= tp->snd_cwnd) | 751 | if (in_flight >= tp->snd_cwnd) |
748 | return 1; | 752 | return 1; |
749 | 753 | ||
750 | if (!(sk->sk_route_caps & NETIF_F_TSO)) | 754 | if (!sk_can_gso(sk)) |
751 | return 0; | 755 | return 0; |
752 | 756 | ||
753 | left = tp->snd_cwnd - in_flight; | 757 | left = tp->snd_cwnd - in_flight; |
@@ -817,6 +821,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp) | |||
817 | tp->ucopy.len = 0; | 821 | tp->ucopy.len = 0; |
818 | tp->ucopy.memory = 0; | 822 | tp->ucopy.memory = 0; |
819 | skb_queue_head_init(&tp->ucopy.prequeue); | 823 | skb_queue_head_init(&tp->ucopy.prequeue); |
824 | #ifdef CONFIG_NET_DMA | ||
825 | tp->ucopy.dma_chan = NULL; | ||
826 | tp->ucopy.wakeup = 0; | ||
827 | tp->ucopy.pinned_list = NULL; | ||
828 | tp->ucopy.dma_cookie = 0; | ||
829 | #endif | ||
820 | } | 830 | } |
821 | 831 | ||
822 | /* Packet is added to VJ-style prequeue for processing in process | 832 | /* Packet is added to VJ-style prequeue for processing in process |
@@ -904,6 +914,9 @@ static inline void tcp_set_state(struct sock *sk, int state) | |||
904 | 914 | ||
905 | static inline void tcp_done(struct sock *sk) | 915 | static inline void tcp_done(struct sock *sk) |
906 | { | 916 | { |
917 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | ||
918 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
919 | |||
907 | tcp_set_state(sk, TCP_CLOSE); | 920 | tcp_set_state(sk, TCP_CLOSE); |
908 | tcp_clear_xmit_timers(sk); | 921 | tcp_clear_xmit_timers(sk); |
909 | 922 | ||
@@ -1076,6 +1089,9 @@ extern struct request_sock_ops tcp_request_sock_ops; | |||
1076 | 1089 | ||
1077 | extern int tcp_v4_destroy_sock(struct sock *sk); | 1090 | extern int tcp_v4_destroy_sock(struct sock *sk); |
1078 | 1091 | ||
1092 | extern int tcp_v4_gso_send_check(struct sk_buff *skb); | ||
1093 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); | ||
1094 | |||
1079 | #ifdef CONFIG_PROC_FS | 1095 | #ifdef CONFIG_PROC_FS |
1080 | extern int tcp4_proc_init(void); | 1096 | extern int tcp4_proc_init(void); |
1081 | extern void tcp4_proc_exit(void); | 1097 | extern void tcp4_proc_exit(void); |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index c6b84397448..4629d77173f 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
@@ -31,10 +31,9 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, | |||
31 | struct sk_buff *skb) | 31 | struct sk_buff *skb) |
32 | { | 32 | { |
33 | tp->ecn_flags = 0; | 33 | tp->ecn_flags = 0; |
34 | if (sysctl_tcp_ecn && !(sk->sk_route_caps & NETIF_F_TSO)) { | 34 | if (sysctl_tcp_ecn) { |
35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; | 35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; |
36 | tp->ecn_flags = TCP_ECN_OK; | 36 | tp->ecn_flags = TCP_ECN_OK; |
37 | sock_set_flag(sk, SOCK_NO_LARGESEND); | ||
38 | } | 37 | } |
39 | } | 38 | } |
40 | 39 | ||
@@ -56,6 +55,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
56 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | 55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { |
57 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | 56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; |
58 | skb->h.th->cwr = 1; | 57 | skb->h.th->cwr = 1; |
58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | ||
59 | } | 59 | } |
60 | } else { | 60 | } else { |
61 | /* ACK or retransmitted segment: clear ECT|CE */ | 61 | /* ACK or retransmitted segment: clear ECT|CE */ |
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h index 098607cd4b7..e07136d74c2 100644 --- a/include/net/tipc/tipc_bearer.h +++ b/include/net/tipc/tipc_bearer.h | |||
@@ -49,10 +49,18 @@ | |||
49 | 49 | ||
50 | #define TIPC_MEDIA_TYPE_ETH 1 | 50 | #define TIPC_MEDIA_TYPE_ETH 1 |
51 | 51 | ||
52 | /* | ||
53 | * Destination address structure used by TIPC bearers when sending messages | ||
54 | * | ||
55 | * IMPORTANT: The fields of this structure MUST be stored using the specified | ||
56 | * byte order indicated below, as the structure is exchanged between nodes | ||
57 | * as part of a link setup process. | ||
58 | */ | ||
59 | |||
52 | struct tipc_media_addr { | 60 | struct tipc_media_addr { |
53 | __u32 type; | 61 | __u32 type; /* bearer type (network byte order) */ |
54 | union { | 62 | union { |
55 | __u8 eth_addr[6]; /* Ethernet bearer */ | 63 | __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ |
56 | #if 0 | 64 | #if 0 |
57 | /* Prototypes for other possible bearer types */ | 65 | /* Prototypes for other possible bearer types */ |
58 | 66 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index afa508d92c9..9c5ee9f20b6 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <net/ip6_fib.h> | 20 | #include <net/ip6_fib.h> |
21 | 21 | ||
22 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) | 22 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) |
23 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ | ||
24 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) | ||
23 | 25 | ||
24 | extern struct sock *xfrm_nl; | 26 | extern struct sock *xfrm_nl; |
25 | extern u32 sysctl_xfrm_aevent_etime; | 27 | extern u32 sysctl_xfrm_aevent_etime; |
@@ -164,6 +166,7 @@ struct xfrm_state | |||
164 | /* Reference to data common to all the instances of this | 166 | /* Reference to data common to all the instances of this |
165 | * transformer. */ | 167 | * transformer. */ |
166 | struct xfrm_type *type; | 168 | struct xfrm_type *type; |
169 | struct xfrm_mode *mode; | ||
167 | 170 | ||
168 | /* Security context */ | 171 | /* Security context */ |
169 | struct xfrm_sec_ctx *security; | 172 | struct xfrm_sec_ctx *security; |
@@ -204,8 +207,8 @@ struct xfrm_type; | |||
204 | struct xfrm_dst; | 207 | struct xfrm_dst; |
205 | struct xfrm_policy_afinfo { | 208 | struct xfrm_policy_afinfo { |
206 | unsigned short family; | 209 | unsigned short family; |
207 | rwlock_t lock; | 210 | struct xfrm_type *type_map[IPPROTO_MAX]; |
208 | struct xfrm_type_map *type_map; | 211 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
209 | struct dst_ops *dst_ops; | 212 | struct dst_ops *dst_ops; |
210 | void (*garbage_collect)(void); | 213 | void (*garbage_collect)(void); |
211 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | 214 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); |
@@ -232,7 +235,6 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
232 | 235 | ||
233 | struct xfrm_state_afinfo { | 236 | struct xfrm_state_afinfo { |
234 | unsigned short family; | 237 | unsigned short family; |
235 | rwlock_t lock; | ||
236 | struct list_head *state_bydst; | 238 | struct list_head *state_bydst; |
237 | struct list_head *state_byspi; | 239 | struct list_head *state_byspi; |
238 | int (*init_flags)(struct xfrm_state *x); | 240 | int (*init_flags)(struct xfrm_state *x); |
@@ -264,16 +266,24 @@ struct xfrm_type | |||
264 | u32 (*get_max_size)(struct xfrm_state *, int size); | 266 | u32 (*get_max_size)(struct xfrm_state *, int size); |
265 | }; | 267 | }; |
266 | 268 | ||
267 | struct xfrm_type_map { | ||
268 | rwlock_t lock; | ||
269 | struct xfrm_type *map[256]; | ||
270 | }; | ||
271 | |||
272 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); | 269 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); |
273 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); | 270 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); |
274 | extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); | 271 | extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); |
275 | extern void xfrm_put_type(struct xfrm_type *type); | 272 | extern void xfrm_put_type(struct xfrm_type *type); |
276 | 273 | ||
274 | struct xfrm_mode { | ||
275 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | ||
276 | int (*output)(struct sk_buff *skb); | ||
277 | |||
278 | struct module *owner; | ||
279 | unsigned int encap; | ||
280 | }; | ||
281 | |||
282 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); | ||
283 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); | ||
284 | extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family); | ||
285 | extern void xfrm_put_mode(struct xfrm_mode *mode); | ||
286 | |||
277 | struct xfrm_tmpl | 287 | struct xfrm_tmpl |
278 | { | 288 | { |
279 | /* id in template is interpreted as: | 289 | /* id in template is interpreted as: |