diff options
Diffstat (limited to 'include/net')
50 files changed, 655 insertions, 641 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 88df8fc814e4..f3531d0bcd05 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -73,7 +73,9 @@ extern int ipv6_get_saddr(struct dst_entry *dst, | |||
73 | extern int ipv6_dev_get_saddr(struct net_device *dev, | 73 | extern int ipv6_dev_get_saddr(struct net_device *dev, |
74 | struct in6_addr *daddr, | 74 | struct in6_addr *daddr, |
75 | struct in6_addr *saddr); | 75 | struct in6_addr *saddr); |
76 | extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); | 76 | extern int ipv6_get_lladdr(struct net_device *dev, |
77 | struct in6_addr *addr, | ||
78 | unsigned char banned_flags); | ||
77 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, | 79 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, |
78 | const struct sock *sk2); | 80 | const struct sock *sk2); |
79 | extern void addrconf_join_solict(struct net_device *dev, | 81 | extern void addrconf_join_solict(struct net_device *dev, |
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h new file mode 100644 index 000000000000..00c2eaa07c25 --- /dev/null +++ b/include/net/af_rxrpc.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* RxRPC kernel service interface definitions | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _NET_RXRPC_H | ||
13 | #define _NET_RXRPC_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/rxrpc.h> | ||
18 | |||
19 | struct rxrpc_call; | ||
20 | |||
21 | /* | ||
22 | * the mark applied to socket buffers that may be intercepted | ||
23 | */ | ||
24 | enum { | ||
25 | RXRPC_SKB_MARK_DATA, /* data message */ | ||
26 | RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */ | ||
27 | RXRPC_SKB_MARK_BUSY, /* server busy message */ | ||
28 | RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */ | ||
29 | RXRPC_SKB_MARK_NET_ERROR, /* network error message */ | ||
30 | RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */ | ||
31 | RXRPC_SKB_MARK_NEW_CALL, /* local error message */ | ||
32 | }; | ||
33 | |||
34 | typedef void (*rxrpc_interceptor_t)(struct sock *, unsigned long, | ||
35 | struct sk_buff *); | ||
36 | extern void rxrpc_kernel_intercept_rx_messages(struct socket *, | ||
37 | rxrpc_interceptor_t); | ||
38 | extern struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *, | ||
39 | struct sockaddr_rxrpc *, | ||
40 | struct key *, | ||
41 | unsigned long, | ||
42 | gfp_t); | ||
43 | extern int rxrpc_kernel_send_data(struct rxrpc_call *, struct msghdr *, | ||
44 | size_t); | ||
45 | extern void rxrpc_kernel_abort_call(struct rxrpc_call *, u32); | ||
46 | extern void rxrpc_kernel_end_call(struct rxrpc_call *); | ||
47 | extern bool rxrpc_kernel_is_data_last(struct sk_buff *); | ||
48 | extern u32 rxrpc_kernel_get_abort_code(struct sk_buff *); | ||
49 | extern int rxrpc_kernel_get_error_number(struct sk_buff *); | ||
50 | extern void rxrpc_kernel_data_delivered(struct sk_buff *); | ||
51 | extern void rxrpc_kernel_free_skb(struct sk_buff *); | ||
52 | extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *, | ||
53 | unsigned long); | ||
54 | extern int rxrpc_kernel_reject_call(struct socket *); | ||
55 | |||
56 | #endif /* __KERNEL__ */ | ||
57 | #endif /* _NET_RXRPC_H */ | ||
diff --git a/include/net/ax25.h b/include/net/ax25.h index 47ff2f46e908..99a4e364c74a 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -263,8 +263,8 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) | |||
263 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) | 263 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) |
264 | { | 264 | { |
265 | skb->dev = dev; | 265 | skb->dev = dev; |
266 | skb_reset_mac_header(skb); | ||
266 | skb->pkt_type = PACKET_HOST; | 267 | skb->pkt_type = PACKET_HOST; |
267 | skb->mac.raw = skb->data; | ||
268 | return htons(ETH_P_AX25); | 268 | return htons(ETH_P_AX25); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 41456c148842..93ce272a5d27 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -709,6 +709,24 @@ struct hci_sco_hdr { | |||
709 | __u8 dlen; | 709 | __u8 dlen; |
710 | } __attribute__ ((packed)); | 710 | } __attribute__ ((packed)); |
711 | 711 | ||
712 | #ifdef __KERNEL__ | ||
713 | #include <linux/skbuff.h> | ||
714 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | ||
715 | { | ||
716 | return (struct hci_event_hdr *)skb->data; | ||
717 | } | ||
718 | |||
719 | static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) | ||
720 | { | ||
721 | return (struct hci_acl_hdr *)skb->data; | ||
722 | } | ||
723 | |||
724 | static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | ||
725 | { | ||
726 | return (struct hci_sco_hdr *)skb->data; | ||
727 | } | ||
728 | #endif | ||
729 | |||
712 | /* Command opcode pack/unpack */ | 730 | /* Command opcode pack/unpack */ |
713 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 731 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
714 | #define hci_opcode_ogf(op) (op >> 10) | 732 | #define hci_opcode_ogf(op) (op >> 10) |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h new file mode 100644 index 000000000000..88171f8ce58a --- /dev/null +++ b/include/net/cfg80211.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef __NET_CFG80211_H | ||
2 | #define __NET_CFG80211_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | #include <linux/skbuff.h> | ||
6 | #include <net/genetlink.h> | ||
7 | |||
8 | /* | ||
9 | * 802.11 configuration in-kernel interface | ||
10 | * | ||
11 | * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> | ||
12 | */ | ||
13 | |||
14 | /* from net/wireless.h */ | ||
15 | struct wiphy; | ||
16 | |||
17 | /** | ||
18 | * struct cfg80211_ops - backend description for wireless configuration | ||
19 | * | ||
20 | * This struct is registered by fullmac card drivers and/or wireless stacks | ||
21 | * in order to handle configuration requests on their interfaces. | ||
22 | * | ||
23 | * All callbacks except where otherwise noted should return 0 | ||
24 | * on success or a negative error code. | ||
25 | * | ||
26 | * All operations are currently invoked under rtnl for consistency with the | ||
27 | * wireless extensions but this is subject to reevaluation as soon as this | ||
28 | * code is used more widely and we have a first user without wext. | ||
29 | * | ||
30 | * @add_virtual_intf: create a new virtual interface with the given name | ||
31 | * | ||
32 | * @del_virtual_intf: remove the virtual interface determined by ifindex. | ||
33 | */ | ||
34 | struct cfg80211_ops { | ||
35 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | ||
36 | unsigned int type); | ||
37 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | ||
38 | }; | ||
39 | |||
40 | #endif /* __NET_CFG80211_H */ | ||
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h index 4c9522c5178f..4f90f5554fac 100644 --- a/include/net/cipso_ipv4.h +++ b/include/net/cipso_ipv4.h | |||
@@ -120,7 +120,7 @@ extern int cipso_v4_rbm_strictvalid; | |||
120 | */ | 120 | */ |
121 | 121 | ||
122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) | 122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) |
123 | #define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) | 123 | #define CIPSO_V4_OPTPTR(x) (skb_network_header(x) + IPCB(x)->opt.cipso) |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * DOI List Functions | 126 | * DOI List Functions |
diff --git a/include/net/compat.h b/include/net/compat.h index 9859b60280d5..406db242f73a 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -25,6 +25,7 @@ struct compat_cmsghdr { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); | 27 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); |
28 | extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | ||
28 | 29 | ||
29 | #else /* defined(CONFIG_COMPAT) */ | 30 | #else /* defined(CONFIG_COMPAT) */ |
30 | #define compat_msghdr msghdr /* to avoid compiler warnings */ | 31 | #define compat_msghdr msghdr /* to avoid compiler warnings */ |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index f01626cbbed6..30125119c950 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void); | |||
148 | extern unsigned dnet_addr_type(__le16 addr); | 148 | extern unsigned dnet_addr_type(__le16 addr); |
149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
150 | 150 | ||
151 | /* | ||
152 | * rtnetlink interface | ||
153 | */ | ||
154 | extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
155 | extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
156 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 151 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
157 | 152 | ||
158 | extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
159 | extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
160 | extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
161 | |||
162 | extern void dn_fib_free_info(struct dn_fib_info *fi); | 153 | extern void dn_fib_free_info(struct dn_fib_info *fi); |
163 | 154 | ||
164 | static inline void dn_fib_info_put(struct dn_fib_info *fi) | 155 | static inline void dn_fib_info_put(struct dn_fib_info *fi) |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index a566944c4962..c10e8e7e59a7 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -18,7 +18,6 @@ | |||
18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); | 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); |
19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); | 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); |
20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
21 | extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
22 | extern void dn_rt_cache_flush(int delay); | 21 | extern void dn_rt_cache_flush(int delay); |
23 | 22 | ||
24 | /* Masks for flags field */ | 23 | /* Masks for flags field */ |
diff --git a/include/net/esp.h b/include/net/esp.h index 713d039f4af7..d05d8d2c78f4 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
@@ -40,8 +40,6 @@ struct esp_data | |||
40 | } auth; | 40 | } auth; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len); | ||
44 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); | ||
45 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); | 43 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); |
46 | 44 | ||
47 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, | 45 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index d585ea9fa97d..ed3a8872c6ca 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/fib_rules.h> | 6 | #include <linux/fib_rules.h> |
7 | #include <net/flow.h> | 7 | #include <net/flow.h> |
8 | #include <net/netlink.h> | 8 | #include <net/rtnetlink.h> |
9 | 9 | ||
10 | struct fib_rule | 10 | struct fib_rule |
11 | { | 11 | { |
@@ -19,6 +19,8 @@ struct fib_rule | |||
19 | u32 flags; | 19 | u32 flags; |
20 | u32 table; | 20 | u32 table; |
21 | u8 action; | 21 | u8 action; |
22 | u32 target; | ||
23 | struct fib_rule * ctarget; | ||
22 | struct rcu_head rcu; | 24 | struct rcu_head rcu; |
23 | }; | 25 | }; |
24 | 26 | ||
@@ -35,6 +37,8 @@ struct fib_rules_ops | |||
35 | struct list_head list; | 37 | struct list_head list; |
36 | int rule_size; | 38 | int rule_size; |
37 | int addr_size; | 39 | int addr_size; |
40 | int unresolved_rules; | ||
41 | int nr_goto_rules; | ||
38 | 42 | ||
39 | int (*action)(struct fib_rule *, | 43 | int (*action)(struct fib_rule *, |
40 | struct flowi *, int, | 44 | struct flowi *, int, |
@@ -55,6 +59,10 @@ struct fib_rules_ops | |||
55 | u32 (*default_pref)(void); | 59 | u32 (*default_pref)(void); |
56 | size_t (*nlmsg_payload)(struct fib_rule *); | 60 | size_t (*nlmsg_payload)(struct fib_rule *); |
57 | 61 | ||
62 | /* Called after modifications to the rules set, must flush | ||
63 | * the route cache if one exists. */ | ||
64 | void (*flush_cache)(void); | ||
65 | |||
58 | int nlgroup; | 66 | int nlgroup; |
59 | struct nla_policy *policy; | 67 | struct nla_policy *policy; |
60 | struct list_head *rules_list; | 68 | struct list_head *rules_list; |
@@ -66,7 +74,8 @@ struct fib_rules_ops | |||
66 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ | 74 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ |
67 | [FRA_FWMARK] = { .type = NLA_U32 }, \ | 75 | [FRA_FWMARK] = { .type = NLA_U32 }, \ |
68 | [FRA_FWMASK] = { .type = NLA_U32 }, \ | 76 | [FRA_FWMASK] = { .type = NLA_U32 }, \ |
69 | [FRA_TABLE] = { .type = NLA_U32 } | 77 | [FRA_TABLE] = { .type = NLA_U32 }, \ |
78 | [FRA_GOTO] = { .type = NLA_U32 } | ||
70 | 79 | ||
71 | static inline void fib_rule_get(struct fib_rule *rule) | 80 | static inline void fib_rule_get(struct fib_rule *rule) |
72 | { | 81 | { |
@@ -98,11 +107,4 @@ extern int fib_rules_unregister(struct fib_rules_ops *); | |||
98 | extern int fib_rules_lookup(struct fib_rules_ops *, | 107 | extern int fib_rules_lookup(struct fib_rules_ops *, |
99 | struct flowi *, int flags, | 108 | struct flowi *, int flags, |
100 | struct fib_lookup_arg *); | 109 | struct fib_lookup_arg *); |
101 | |||
102 | extern int fib_nl_newrule(struct sk_buff *, | ||
103 | struct nlmsghdr *, void *); | ||
104 | extern int fib_nl_delrule(struct sk_buff *, | ||
105 | struct nlmsghdr *, void *); | ||
106 | extern int fib_rules_dump(struct sk_buff *, | ||
107 | struct netlink_callback *, int); | ||
108 | #endif | 110 | #endif |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index c28e424f53d9..668056b4bb0b 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/in6.h> | 19 | #include <linux/in6.h> |
20 | #include <linux/ipv6.h> | 20 | #include <linux/ipv6.h> |
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/jhash.h> | ||
23 | |||
24 | #include <net/inet_sock.h> | ||
22 | 25 | ||
23 | #include <net/ipv6.h> | 26 | #include <net/ipv6.h> |
24 | 27 | ||
@@ -28,12 +31,11 @@ struct inet_hashinfo; | |||
28 | static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, | 31 | static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, |
29 | const struct in6_addr *faddr, const __be16 fport) | 32 | const struct in6_addr *faddr, const __be16 fport) |
30 | { | 33 | { |
31 | unsigned int hashent = (lport ^ (__force u16)fport); | 34 | u32 ports = (lport ^ (__force u16)fport); |
32 | 35 | ||
33 | hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); | 36 | return jhash_3words((__force u32)laddr->s6_addr32[3], |
34 | hashent ^= hashent >> 16; | 37 | (__force u32)faddr->s6_addr32[3], |
35 | hashent ^= hashent >> 8; | 38 | ports, inet_ehash_secret); |
36 | return hashent; | ||
37 | } | 39 | } |
38 | 40 | ||
39 | static inline int inet6_sk_ehashfn(const struct sock *sk) | 41 | static inline int inet6_sk_ehashfn(const struct sock *sk) |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 10117c8503e8..de8399a79774 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) | |||
114 | { | 114 | { |
115 | switch (skb->protocol) { | 115 | switch (skb->protocol) { |
116 | case __constant_htons(ETH_P_IP): | 116 | case __constant_htons(ETH_P_IP): |
117 | if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) | 117 | if (skb->network_header + sizeof(struct iphdr) <= skb->tail) |
118 | return IP_ECN_set_ce(skb->nh.iph); | 118 | return IP_ECN_set_ce(ip_hdr(skb)); |
119 | break; | 119 | break; |
120 | 120 | ||
121 | case __constant_htons(ETH_P_IPV6): | 121 | case __constant_htons(ETH_P_IPV6): |
122 | if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) | 122 | if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) |
123 | return IP6_ECN_set_ce(skb->nh.ipv6h); | 123 | return IP6_ECN_set_ce(ipv6_hdr(skb)); |
124 | break; | 124 | break; |
125 | } | 125 | } |
126 | 126 | ||
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index ce6da97bc848..62daf214931f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/jhash.h> | ||
22 | 23 | ||
23 | #include <net/flow.h> | 24 | #include <net/flow.h> |
24 | #include <net/sock.h> | 25 | #include <net/sock.h> |
@@ -167,13 +168,15 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
167 | 168 | ||
168 | extern int inet_sk_rebuild_header(struct sock *sk); | 169 | extern int inet_sk_rebuild_header(struct sock *sk); |
169 | 170 | ||
171 | extern u32 inet_ehash_secret; | ||
172 | extern void build_ehash_secret(void); | ||
173 | |||
170 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, | 174 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, |
171 | const __be32 faddr, const __be16 fport) | 175 | const __be32 faddr, const __be16 fport) |
172 | { | 176 | { |
173 | unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); | 177 | return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr, |
174 | h ^= h >> 16; | 178 | ((__u32) lport) << 16 | (__force __u32)fport, |
175 | h ^= h >> 8; | 179 | inet_ehash_secret); |
176 | return h; | ||
177 | } | 180 | } |
178 | 181 | ||
179 | static inline int inet_sk_ehashfn(const struct sock *sk) | 182 | static inline int inet_sk_ehashfn(const struct sock *sk) |
diff --git a/include/net/ip.h b/include/net/ip.h index e79c3e3aa4f6..bb207db03675 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/ip.h> | 26 | #include <linux/ip.h> |
27 | #include <linux/in.h> | 27 | #include <linux/in.h> |
28 | #include <linux/skbuff.h> | ||
28 | 29 | ||
29 | #include <net/inet_sock.h> | 30 | #include <net/inet_sock.h> |
30 | #include <net/snmp.h> | 31 | #include <net/snmp.h> |
@@ -43,6 +44,11 @@ struct inet_skb_parm | |||
43 | #define IPSKB_REROUTED 16 | 44 | #define IPSKB_REROUTED 16 |
44 | }; | 45 | }; |
45 | 46 | ||
47 | static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | ||
48 | { | ||
49 | return ip_hdr(skb)->ihl * 4; | ||
50 | } | ||
51 | |||
46 | struct ipcm_cookie | 52 | struct ipcm_cookie |
47 | { | 53 | { |
48 | __be32 addr; | 54 | __be32 addr; |
@@ -74,7 +80,6 @@ struct msghdr; | |||
74 | struct net_device; | 80 | struct net_device; |
75 | struct packet_type; | 81 | struct packet_type; |
76 | struct rtable; | 82 | struct rtable; |
77 | struct sk_buff; | ||
78 | struct sockaddr; | 83 | struct sockaddr; |
79 | 84 | ||
80 | extern void ip_mc_dropsocket(struct sock *); | 85 | extern void ip_mc_dropsocket(struct sock *); |
@@ -161,6 +166,10 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics); | |||
161 | #define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) | 166 | #define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) |
162 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) | 167 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) |
163 | 168 | ||
169 | extern unsigned long snmp_fold_field(void *mib[], int offt); | ||
170 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | ||
171 | extern void snmp_mib_free(void *ptr[2]); | ||
172 | |||
164 | extern int sysctl_local_port_range[2]; | 173 | extern int sysctl_local_port_range[2]; |
165 | extern int sysctl_ip_default_ttl; | 174 | extern int sysctl_ip_default_ttl; |
166 | extern int sysctl_ip_nonlocal_bind; | 175 | extern int sysctl_ip_nonlocal_bind; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index cf355a3c2ad5..c48ea873f1e0 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -219,8 +219,6 @@ extern void fib6_init(void); | |||
219 | 219 | ||
220 | extern void fib6_rules_init(void); | 220 | extern void fib6_rules_init(void); |
221 | extern void fib6_rules_cleanup(void); | 221 | extern void fib6_rules_cleanup(void); |
222 | extern int fib6_rules_dump(struct sk_buff *, | ||
223 | struct netlink_callback *); | ||
224 | 222 | ||
225 | #endif | 223 | #endif |
226 | #endif | 224 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 4e927ebd1cb3..5456fdd6d047 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr, | |||
116 | struct net_device *dev, | 116 | struct net_device *dev, |
117 | u32 pmtu); | 117 | u32 pmtu); |
118 | 118 | ||
119 | struct nlmsghdr; | ||
120 | struct netlink_callback; | 119 | struct netlink_callback; |
121 | extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | ||
122 | extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
123 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
124 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
125 | 120 | ||
126 | struct rt6_rtnl_dump_arg | 121 | struct rt6_rtnl_dump_arg |
127 | { | 122 | { |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 36c635ca1aa6..5a4a0366c24f 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | |||
215 | /* Exported by fib_frontend.c */ | 215 | /* Exported by fib_frontend.c */ |
216 | extern struct nla_policy rtm_ipv4_policy[]; | 216 | extern struct nla_policy rtm_ipv4_policy[]; |
217 | extern void ip_fib_init(void); | 217 | extern void ip_fib_init(void); |
218 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
219 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
220 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
221 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | ||
222 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 218 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
223 | struct net_device *dev, __be32 *spec_dst, u32 *itag); | 219 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
224 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 220 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); |
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res); | |||
235 | extern struct fib_table *fib_hash_init(u32 id); | 231 | extern struct fib_table *fib_hash_init(u32 id); |
236 | 232 | ||
237 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 233 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
238 | extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb); | ||
239 | |||
240 | extern void __init fib4_rules_init(void); | 234 | extern void __init fib4_rules_init(void); |
241 | 235 | ||
242 | #ifdef CONFIG_NET_CLS_ROUTE | 236 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 00328b71a08c..f70afef9c3cc 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -166,13 +166,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | |||
166 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | 166 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ |
167 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | 167 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) |
168 | 168 | ||
169 | int snmp6_register_dev(struct inet6_dev *idev); | ||
170 | int snmp6_unregister_dev(struct inet6_dev *idev); | ||
171 | int snmp6_alloc_dev(struct inet6_dev *idev); | ||
172 | int snmp6_free_dev(struct inet6_dev *idev); | ||
173 | int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | ||
174 | void snmp6_mib_free(void *ptr[2]); | ||
175 | |||
176 | struct ip6_ra_chain | 169 | struct ip6_ra_chain |
177 | { | 170 | { |
178 | struct ip6_ra_chain *next; | 171 | struct ip6_ra_chain *next; |
@@ -605,8 +598,20 @@ extern int udplite6_proc_init(void); | |||
605 | extern void udplite6_proc_exit(void); | 598 | extern void udplite6_proc_exit(void); |
606 | extern int ipv6_misc_proc_init(void); | 599 | extern int ipv6_misc_proc_init(void); |
607 | extern void ipv6_misc_proc_exit(void); | 600 | extern void ipv6_misc_proc_exit(void); |
601 | extern int snmp6_register_dev(struct inet6_dev *idev); | ||
602 | extern int snmp6_unregister_dev(struct inet6_dev *idev); | ||
608 | 603 | ||
609 | extern struct rt6_statistics rt6_stats; | 604 | extern struct rt6_statistics rt6_stats; |
605 | #else | ||
606 | static inline int snmp6_register_dev(struct inet6_dev *idev) | ||
607 | { | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | static inline int snmp6_unregister_dev(struct inet6_dev *idev) | ||
612 | { | ||
613 | return 0; | ||
614 | } | ||
610 | #endif | 615 | #endif |
611 | 616 | ||
612 | #ifdef CONFIG_SYSCTL | 617 | #ifdef CONFIG_SYSCTL |
diff --git a/include/net/ipx.h b/include/net/ipx.h index c6b2ee610866..4cc0b4eca948 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
@@ -43,7 +43,7 @@ struct ipxhdr { | |||
43 | 43 | ||
44 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) | 44 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) |
45 | { | 45 | { |
46 | return (struct ipxhdr *)skb->h.raw; | 46 | return (struct ipxhdr *)skb_transport_header(skb); |
47 | } | 47 | } |
48 | 48 | ||
49 | struct ipx_interface { | 49 | struct ipx_interface { |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index 8a830188354d..f23d07ca7c59 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
@@ -431,26 +431,7 @@ struct iw_public_data { | |||
431 | * Those may be called only within the kernel. | 431 | * Those may be called only within the kernel. |
432 | */ | 432 | */ |
433 | 433 | ||
434 | /* First : function strictly used inside the kernel */ | 434 | /* functions that may be called by driver modules */ |
435 | |||
436 | /* Handle /proc/net/wireless, called in net/code/dev.c */ | ||
437 | extern int dev_get_wireless_info(char * buffer, char **start, off_t offset, | ||
438 | int length); | ||
439 | |||
440 | /* Handle IOCTLs, called in net/core/dev.c */ | ||
441 | extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd); | ||
442 | |||
443 | /* Handle RtNetlink requests, called in net/core/rtnetlink.c */ | ||
444 | extern int wireless_rtnetlink_set(struct net_device * dev, | ||
445 | char * data, | ||
446 | int len); | ||
447 | extern int wireless_rtnetlink_get(struct net_device * dev, | ||
448 | char * data, | ||
449 | int len, | ||
450 | char ** p_buf, | ||
451 | int * p_len); | ||
452 | |||
453 | /* Second : functions that may be called by driver modules */ | ||
454 | 435 | ||
455 | /* Send a single event to user space */ | 436 | /* Send a single event to user space */ |
456 | extern void wireless_send_event(struct net_device * dev, | 437 | extern void wireless_send_event(struct net_device * dev, |
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h index aa33a477c3fb..4a8f58b17e43 100644 --- a/include/net/llc_pdu.h +++ b/include/net/llc_pdu.h | |||
@@ -203,7 +203,7 @@ struct llc_pdu_sn { | |||
203 | 203 | ||
204 | static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) | 204 | static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) |
205 | { | 205 | { |
206 | return (struct llc_pdu_sn *)skb->nh.raw; | 206 | return (struct llc_pdu_sn *)skb_network_header(skb); |
207 | } | 207 | } |
208 | 208 | ||
209 | /* Un-numbered PDU format (3 bytes in length) */ | 209 | /* Un-numbered PDU format (3 bytes in length) */ |
@@ -215,12 +215,7 @@ struct llc_pdu_un { | |||
215 | 215 | ||
216 | static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) | 216 | static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) |
217 | { | 217 | { |
218 | return (struct llc_pdu_un *)skb->nh.raw; | 218 | return (struct llc_pdu_un *)skb_network_header(skb); |
219 | } | ||
220 | |||
221 | static inline void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr) | ||
222 | { | ||
223 | return skb->nh.raw = ptr; | ||
224 | } | 219 | } |
225 | 220 | ||
226 | /** | 221 | /** |
@@ -237,7 +232,11 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, | |||
237 | u8 ssap, u8 dsap, u8 cr) | 232 | u8 ssap, u8 dsap, u8 cr) |
238 | { | 233 | { |
239 | const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; | 234 | const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; |
240 | struct llc_pdu_un *pdu = llc_set_pdu_hdr(skb, skb_push(skb, hlen)); | 235 | struct llc_pdu_un *pdu; |
236 | |||
237 | skb_push(skb, hlen); | ||
238 | skb_reset_network_header(skb); | ||
239 | pdu = llc_pdu_un_hdr(skb); | ||
241 | pdu->dsap = dsap; | 240 | pdu->dsap = dsap; |
242 | pdu->ssap = ssap; | 241 | pdu->ssap = ssap; |
243 | pdu->ssap |= cr; | 242 | pdu->ssap |= cr; |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index ad7fe1121412..a4f26187fc1a 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
27 | #include <net/rtnetlink.h> | ||
27 | 28 | ||
28 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) | 29 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) |
29 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) | 30 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) |
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
213 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); | 214 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); |
214 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); | 215 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); |
215 | 216 | ||
216 | struct netlink_callback; | ||
217 | struct nlmsghdr; | ||
218 | extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb); | ||
219 | extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
220 | extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
221 | extern void neigh_app_ns(struct neighbour *n); | 217 | extern void neigh_app_ns(struct neighbour *n); |
222 | |||
223 | extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb); | ||
224 | extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
225 | |||
226 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 218 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
227 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); | 219 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); |
228 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); | 220 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 0e690e34c00b..1c6b8bd09b9a 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -250,6 +250,11 @@ static inline int nf_ct_is_dying(struct nf_conn *ct) | |||
250 | return test_bit(IPS_DYING_BIT, &ct->status); | 250 | return test_bit(IPS_DYING_BIT, &ct->status); |
251 | } | 251 | } |
252 | 252 | ||
253 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
254 | { | ||
255 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | ||
256 | } | ||
257 | |||
253 | extern unsigned int nf_conntrack_htable_size; | 258 | extern unsigned int nf_conntrack_htable_size; |
254 | extern int nf_conntrack_checksum; | 259 | extern int nf_conntrack_checksum; |
255 | extern atomic_t nf_conntrack_count; | 260 | extern atomic_t nf_conntrack_count; |
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h deleted file mode 100644 index 6f84c1f7fcd4..000000000000 --- a/include/net/netfilter/nf_conntrack_compat.h +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | #ifndef _NF_CONNTRACK_COMPAT_H | ||
2 | #define _NF_CONNTRACK_COMPAT_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) | ||
7 | |||
8 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
9 | #include <linux/socket.h> | ||
10 | |||
11 | #ifdef CONFIG_IP_NF_CONNTRACK_MARK | ||
12 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
13 | u_int32_t *ctinfo) | ||
14 | { | ||
15 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
16 | |||
17 | if (ct) | ||
18 | return &ct->mark; | ||
19 | else | ||
20 | return NULL; | ||
21 | } | ||
22 | #endif /* CONFIG_IP_NF_CONNTRACK_MARK */ | ||
23 | |||
24 | #ifdef CONFIG_IP_NF_CONNTRACK_SECMARK | ||
25 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
26 | u_int32_t *ctinfo) | ||
27 | { | ||
28 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
29 | |||
30 | if (ct) | ||
31 | return &ct->secmark; | ||
32 | else | ||
33 | return NULL; | ||
34 | } | ||
35 | #endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */ | ||
36 | |||
37 | #ifdef CONFIG_IP_NF_CT_ACCT | ||
38 | static inline struct ip_conntrack_counter * | ||
39 | nf_ct_get_counters(const struct sk_buff *skb) | ||
40 | { | ||
41 | enum ip_conntrack_info ctinfo; | ||
42 | struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo); | ||
43 | |||
44 | if (ct) | ||
45 | return ct->counters; | ||
46 | else | ||
47 | return NULL; | ||
48 | } | ||
49 | #endif /* CONFIG_IP_NF_CT_ACCT */ | ||
50 | |||
51 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
52 | { | ||
53 | return (skb->nfct == &ip_conntrack_untracked.ct_general); | ||
54 | } | ||
55 | |||
56 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
57 | { | ||
58 | skb->nfct = &ip_conntrack_untracked.ct_general; | ||
59 | } | ||
60 | |||
61 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
62 | enum ip_conntrack_info *ctinfo) | ||
63 | { | ||
64 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
65 | return (ct != NULL); | ||
66 | } | ||
67 | |||
68 | static inline int nf_ct_l3proto_try_module_get(unsigned short l3proto) | ||
69 | { | ||
70 | need_conntrack(); | ||
71 | return l3proto == PF_INET ? 0 : -1; | ||
72 | } | ||
73 | |||
74 | static inline void nf_ct_l3proto_module_put(unsigned short l3proto) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | #else /* CONFIG_IP_NF_CONNTRACK */ | ||
79 | |||
80 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | ||
81 | #include <net/netfilter/nf_conntrack.h> | ||
82 | |||
83 | #ifdef CONFIG_NF_CONNTRACK_MARK | ||
84 | |||
85 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
86 | u_int32_t *ctinfo) | ||
87 | { | ||
88 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
89 | |||
90 | if (ct) | ||
91 | return &ct->mark; | ||
92 | else | ||
93 | return NULL; | ||
94 | } | ||
95 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
96 | |||
97 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | ||
98 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
99 | u_int32_t *ctinfo) | ||
100 | { | ||
101 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
102 | |||
103 | if (ct) | ||
104 | return &ct->secmark; | ||
105 | else | ||
106 | return NULL; | ||
107 | } | ||
108 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
109 | |||
110 | #ifdef CONFIG_NF_CT_ACCT | ||
111 | static inline struct ip_conntrack_counter * | ||
112 | nf_ct_get_counters(const struct sk_buff *skb) | ||
113 | { | ||
114 | enum ip_conntrack_info ctinfo; | ||
115 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | ||
116 | |||
117 | if (ct) | ||
118 | return ct->counters; | ||
119 | else | ||
120 | return NULL; | ||
121 | } | ||
122 | #endif /* CONFIG_NF_CT_ACCT */ | ||
123 | |||
124 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
125 | { | ||
126 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | ||
127 | } | ||
128 | |||
129 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
130 | { | ||
131 | skb->nfct = &nf_conntrack_untracked.ct_general; | ||
132 | } | ||
133 | |||
134 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
135 | enum ip_conntrack_info *ctinfo) | ||
136 | { | ||
137 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
138 | return (ct != NULL); | ||
139 | } | ||
140 | |||
141 | #endif /* CONFIG_IP_NF_CONNTRACK */ | ||
142 | |||
143 | #endif /* __KERNEL__ */ | ||
144 | |||
145 | #endif /* _NF_CONNTRACK_COMPAT_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 85634e1865c3..9fb906688ffa 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -27,6 +27,9 @@ extern unsigned int nf_conntrack_in(int pf, | |||
27 | extern int nf_conntrack_init(void); | 27 | extern int nf_conntrack_init(void); |
28 | extern void nf_conntrack_cleanup(void); | 28 | extern void nf_conntrack_cleanup(void); |
29 | 29 | ||
30 | extern int nf_conntrack_proto_init(void); | ||
31 | extern void nf_conntrack_proto_fini(void); | ||
32 | |||
30 | struct nf_conntrack_l3proto; | 33 | struct nf_conntrack_l3proto; |
31 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | 34 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); |
32 | /* Like above, but you already have conntrack read lock. */ | 35 | /* Like above, but you already have conntrack read lock. */ |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index b62a8a9ec9d8..811c9073c532 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -20,30 +20,8 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); | |||
20 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) | 20 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) |
21 | 21 | ||
22 | extern struct atomic_notifier_head nf_conntrack_chain; | 22 | extern struct atomic_notifier_head nf_conntrack_chain; |
23 | extern struct atomic_notifier_head nf_conntrack_expect_chain; | 23 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); |
24 | 24 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | |
25 | static inline int nf_conntrack_register_notifier(struct notifier_block *nb) | ||
26 | { | ||
27 | return atomic_notifier_chain_register(&nf_conntrack_chain, nb); | ||
28 | } | ||
29 | |||
30 | static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb) | ||
31 | { | ||
32 | return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb); | ||
33 | } | ||
34 | |||
35 | static inline int | ||
36 | nf_conntrack_expect_register_notifier(struct notifier_block *nb) | ||
37 | { | ||
38 | return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb); | ||
39 | } | ||
40 | |||
41 | static inline int | ||
42 | nf_conntrack_expect_unregister_notifier(struct notifier_block *nb) | ||
43 | { | ||
44 | return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain, | ||
45 | nb); | ||
46 | } | ||
47 | 25 | ||
48 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); | 26 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); |
49 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); | 27 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); |
@@ -71,6 +49,10 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event, | |||
71 | atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); | 49 | atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); |
72 | } | 50 | } |
73 | 51 | ||
52 | extern struct atomic_notifier_head nf_conntrack_expect_chain; | ||
53 | extern int nf_conntrack_expect_register_notifier(struct notifier_block *nb); | ||
54 | extern int nf_conntrack_expect_unregister_notifier(struct notifier_block *nb); | ||
55 | |||
74 | static inline void | 56 | static inline void |
75 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, | 57 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, |
76 | struct nf_conntrack_expect *exp) | 58 | struct nf_conntrack_expect *exp) |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index eb575cbd4c95..f32f714e5d92 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -90,10 +90,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | |||
90 | /* Protocol registration. */ | 90 | /* Protocol registration. */ |
91 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | 91 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); |
92 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | 92 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); |
93 | 93 | extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); | |
94 | extern struct nf_conntrack_l3proto * | ||
95 | nf_ct_l3proto_find_get(u_int16_t l3proto); | ||
96 | |||
97 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); | 94 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); |
98 | 95 | ||
99 | /* Existing built-in protocols */ | 96 | /* Existing built-in protocols */ |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 8415182ec126..f46cb930414c 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -97,7 +97,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; | |||
97 | extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; | 97 | extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; |
98 | 98 | ||
99 | #define MAX_NF_CT_PROTO 256 | 99 | #define MAX_NF_CT_PROTO 256 |
100 | extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX]; | ||
101 | 100 | ||
102 | extern struct nf_conntrack_l4proto * | 101 | extern struct nf_conntrack_l4proto * |
103 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); | 102 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); |
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h index f191c672bcc6..e76565459ad9 100644 --- a/include/net/netfilter/nf_nat_rule.h +++ b/include/net/netfilter/nf_nat_rule.h | |||
@@ -4,16 +4,6 @@ | |||
4 | #include <net/netfilter/nf_nat.h> | 4 | #include <net/netfilter/nf_nat.h> |
5 | #include <linux/netfilter_ipv4/ip_tables.h> | 5 | #include <linux/netfilter_ipv4/ip_tables.h> |
6 | 6 | ||
7 | /* Compatibility definitions for ipt_FOO modules */ | ||
8 | #define ip_nat_range nf_nat_range | ||
9 | #define ip_conntrack_tuple nf_conntrack_tuple | ||
10 | #define ip_conntrack_get nf_ct_get | ||
11 | #define ip_conntrack nf_conn | ||
12 | #define ip_nat_setup_info nf_nat_setup_info | ||
13 | #define ip_nat_multi_range_compat nf_nat_multi_range_compat | ||
14 | #define ip_ct_iterate_cleanup nf_ct_iterate_cleanup | ||
15 | #define IP_NF_ASSERT NF_CT_ASSERT | ||
16 | |||
17 | extern int nf_nat_rule_init(void) __init; | 7 | extern int nf_nat_rule_init(void) __init; |
18 | extern void nf_nat_rule_cleanup(void); | 8 | extern void nf_nat_rule_cleanup(void); |
19 | extern int nf_nat_rule_find(struct sk_buff **pskb, | 9 | extern int nf_nat_rule_find(struct sk_buff **pskb, |
diff --git a/include/net/netlink.h b/include/net/netlink.h index bcaf67b7a19d..0bf325c29aff 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -171,6 +171,7 @@ enum { | |||
171 | NLA_MSECS, | 171 | NLA_MSECS, |
172 | NLA_NESTED, | 172 | NLA_NESTED, |
173 | NLA_NUL_STRING, | 173 | NLA_NUL_STRING, |
174 | NLA_BINARY, | ||
174 | __NLA_TYPE_MAX, | 175 | __NLA_TYPE_MAX, |
175 | }; | 176 | }; |
176 | 177 | ||
@@ -188,12 +189,13 @@ enum { | |||
188 | * NLA_STRING Maximum length of string | 189 | * NLA_STRING Maximum length of string |
189 | * NLA_NUL_STRING Maximum length of string (excluding NUL) | 190 | * NLA_NUL_STRING Maximum length of string (excluding NUL) |
190 | * NLA_FLAG Unused | 191 | * NLA_FLAG Unused |
192 | * NLA_BINARY Maximum length of attribute payload | ||
191 | * All other Exact length of attribute payload | 193 | * All other Exact length of attribute payload |
192 | * | 194 | * |
193 | * Example: | 195 | * Example: |
194 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 196 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { |
195 | * [ATTR_FOO] = { .type = NLA_U16 }, | 197 | * [ATTR_FOO] = { .type = NLA_U16 }, |
196 | * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, | 198 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, |
197 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, | 199 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
198 | * }; | 200 | * }; |
199 | */ | 201 | */ |
@@ -214,9 +216,7 @@ struct nl_info { | |||
214 | 216 | ||
215 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 217 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
216 | int (*cb)(struct sk_buff *, | 218 | int (*cb)(struct sk_buff *, |
217 | struct nlmsghdr *, int *)); | 219 | struct nlmsghdr *)); |
218 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | ||
219 | struct sk_buff *skb); | ||
220 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | 220 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, |
221 | u32 pid, unsigned int group, int report, | 221 | u32 pid, unsigned int group, int report, |
222 | gfp_t flags); | 222 | gfp_t flags); |
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) | |||
525 | */ | 525 | */ |
526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | 526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) |
527 | { | 527 | { |
528 | nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; | 528 | nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; |
529 | 529 | ||
530 | return skb->len; | 530 | return skb->len; |
531 | } | 531 | } |
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
538 | */ | 538 | */ |
539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) | 539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) |
540 | { | 540 | { |
541 | return skb->tail; | 541 | return skb_tail_pointer(skb); |
542 | } | 542 | } |
543 | 543 | ||
544 | /** | 544 | /** |
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb) | |||
548 | * | 548 | * |
549 | * Trims the message to the provided mark. Returns -1. | 549 | * Trims the message to the provided mark. Returns -1. |
550 | */ | 550 | */ |
551 | static inline int nlmsg_trim(struct sk_buff *skb, void *mark) | 551 | static inline int nlmsg_trim(struct sk_buff *skb, const void *mark) |
552 | { | 552 | { |
553 | if (mark) | 553 | if (mark) |
554 | skb_trim(skb, (unsigned char *) mark - skb->data); | 554 | skb_trim(skb, (unsigned char *) mark - skb->data); |
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla) | |||
940 | */ | 940 | */ |
941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | 941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) |
942 | { | 942 | { |
943 | struct nlattr *start = (struct nlattr *) skb->tail; | 943 | struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb); |
944 | 944 | ||
945 | if (nla_put(skb, attrtype, 0, NULL) < 0) | 945 | if (nla_put(skb, attrtype, 0, NULL) < 0) |
946 | return NULL; | 946 | return NULL; |
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | |||
960 | */ | 960 | */ |
961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | 961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) |
962 | { | 962 | { |
963 | start->nla_len = skb->tail - (unsigned char *) start; | 963 | start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start; |
964 | return skb->len; | 964 | return skb->len; |
965 | } | 965 | } |
966 | 966 | ||
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 02647fe3d74b..4129df708079 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -326,18 +326,18 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer) | |||
326 | case TCF_LAYER_LINK: | 326 | case TCF_LAYER_LINK: |
327 | return skb->data; | 327 | return skb->data; |
328 | case TCF_LAYER_NETWORK: | 328 | case TCF_LAYER_NETWORK: |
329 | return skb->nh.raw; | 329 | return skb_network_header(skb); |
330 | case TCF_LAYER_TRANSPORT: | 330 | case TCF_LAYER_TRANSPORT: |
331 | return skb->h.raw; | 331 | return skb_transport_header(skb); |
332 | } | 332 | } |
333 | 333 | ||
334 | return NULL; | 334 | return NULL; |
335 | } | 335 | } |
336 | 336 | ||
337 | static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr, | 337 | static inline int tcf_valid_offset(const struct sk_buff *skb, |
338 | int len) | 338 | const unsigned char *ptr, const int len) |
339 | { | 339 | { |
340 | return unlikely((ptr + len) < skb->tail && ptr > skb->head); | 340 | return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head); |
341 | } | 341 | } |
342 | 342 | ||
343 | #ifdef CONFIG_NET_CLS_IND | 343 | #ifdef CONFIG_NET_CLS_IND |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index f6afee73235d..5754d53d9efc 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_PKT_SCHED_H | 2 | #define __NET_PKT_SCHED_H |
3 | 3 | ||
4 | #include <linux/jiffies.h> | 4 | #include <linux/jiffies.h> |
5 | #include <linux/ktime.h> | ||
5 | #include <net/sch_generic.h> | 6 | #include <net/sch_generic.h> |
6 | 7 | ||
7 | struct qdisc_walker | 8 | struct qdisc_walker |
@@ -12,8 +13,6 @@ struct qdisc_walker | |||
12 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); | 13 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); |
13 | }; | 14 | }; |
14 | 15 | ||
15 | extern rwlock_t qdisc_tree_lock; | ||
16 | |||
17 | #define QDISC_ALIGNTO 32 | 16 | #define QDISC_ALIGNTO 32 |
18 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) | 17 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) |
19 | 18 | ||
@@ -37,175 +36,38 @@ static inline void *qdisc_priv(struct Qdisc *q) | |||
37 | The things are not so bad, because we may use artifical | 36 | The things are not so bad, because we may use artifical |
38 | clock evaluated by integration of network data flow | 37 | clock evaluated by integration of network data flow |
39 | in the most critical places. | 38 | in the most critical places. |
40 | |||
41 | Note: we do not use fastgettimeofday. | ||
42 | The reason is that, when it is not the same thing as | ||
43 | gettimeofday, it returns invalid timestamp, which is | ||
44 | not updated, when net_bh is active. | ||
45 | */ | ||
46 | |||
47 | /* General note about internal clock. | ||
48 | |||
49 | Any clock source returns time intervals, measured in units | ||
50 | close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely | ||
51 | microseconds, otherwise something close but different chosen to minimize | ||
52 | arithmetic cost. Ratio usec/internal untis in form nominator/denominator | ||
53 | may be read from /proc/net/psched. | ||
54 | */ | 39 | */ |
55 | 40 | ||
56 | |||
57 | #ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY | ||
58 | |||
59 | typedef struct timeval psched_time_t; | ||
60 | typedef long psched_tdiff_t; | ||
61 | |||
62 | #define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) | ||
63 | #define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs) | ||
64 | #define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay) | ||
65 | |||
66 | #else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
67 | |||
68 | typedef u64 psched_time_t; | 41 | typedef u64 psched_time_t; |
69 | typedef long psched_tdiff_t; | 42 | typedef long psched_tdiff_t; |
70 | 43 | ||
71 | #ifdef CONFIG_NET_SCH_CLK_JIFFIES | 44 | /* Avoid doing 64 bit divide by 1000 */ |
72 | 45 | #define PSCHED_US2NS(x) ((s64)(x) << 10) | |
73 | #if HZ < 96 | 46 | #define PSCHED_NS2US(x) ((x) >> 10) |
74 | #define PSCHED_JSCALE 14 | ||
75 | #elif HZ >= 96 && HZ < 192 | ||
76 | #define PSCHED_JSCALE 13 | ||
77 | #elif HZ >= 192 && HZ < 384 | ||
78 | #define PSCHED_JSCALE 12 | ||
79 | #elif HZ >= 384 && HZ < 768 | ||
80 | #define PSCHED_JSCALE 11 | ||
81 | #elif HZ >= 768 | ||
82 | #define PSCHED_JSCALE 10 | ||
83 | #endif | ||
84 | 47 | ||
85 | #define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<<PSCHED_JSCALE)) | 48 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) |
86 | #define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) | 49 | #define PSCHED_PASTPERFECT 0 |
87 | #define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) | 50 | |
88 | 51 | static inline psched_time_t psched_get_time(void) | |
89 | #endif /* CONFIG_NET_SCH_CLK_JIFFIES */ | ||
90 | #ifdef CONFIG_NET_SCH_CLK_CPU | ||
91 | #include <asm/timex.h> | ||
92 | |||
93 | extern psched_tdiff_t psched_clock_per_hz; | ||
94 | extern int psched_clock_scale; | ||
95 | extern psched_time_t psched_time_base; | ||
96 | extern cycles_t psched_time_mark; | ||
97 | |||
98 | #define PSCHED_GET_TIME(stamp) \ | ||
99 | do { \ | ||
100 | cycles_t cur = get_cycles(); \ | ||
101 | if (sizeof(cycles_t) == sizeof(u32)) { \ | ||
102 | if (cur <= psched_time_mark) \ | ||
103 | psched_time_base += 0x100000000ULL; \ | ||
104 | psched_time_mark = cur; \ | ||
105 | (stamp) = (psched_time_base + cur)>>psched_clock_scale; \ | ||
106 | } else { \ | ||
107 | (stamp) = cur>>psched_clock_scale; \ | ||
108 | } \ | ||
109 | } while (0) | ||
110 | #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) | ||
111 | #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) | ||
112 | |||
113 | #endif /* CONFIG_NET_SCH_CLK_CPU */ | ||
114 | |||
115 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
116 | |||
117 | #ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY | ||
118 | #define PSCHED_TDIFF(tv1, tv2) \ | ||
119 | ({ \ | ||
120 | int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ | ||
121 | int __delta = (tv1).tv_usec - (tv2).tv_usec; \ | ||
122 | if (__delta_sec) { \ | ||
123 | switch (__delta_sec) { \ | ||
124 | default: \ | ||
125 | __delta = 0; \ | ||
126 | case 2: \ | ||
127 | __delta += USEC_PER_SEC; \ | ||
128 | case 1: \ | ||
129 | __delta += USEC_PER_SEC; \ | ||
130 | } \ | ||
131 | } \ | ||
132 | __delta; \ | ||
133 | }) | ||
134 | |||
135 | static inline int | ||
136 | psched_tod_diff(int delta_sec, int bound) | ||
137 | { | 52 | { |
138 | int delta; | 53 | return PSCHED_NS2US(ktime_to_ns(ktime_get())); |
139 | |||
140 | if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1) | ||
141 | return bound; | ||
142 | delta = delta_sec * USEC_PER_SEC; | ||
143 | if (delta > bound || delta < 0) | ||
144 | delta = bound; | ||
145 | return delta; | ||
146 | } | 54 | } |
147 | 55 | ||
148 | #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ | 56 | static inline psched_tdiff_t |
149 | ({ \ | 57 | psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) |
150 | int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ | 58 | { |
151 | int __delta = (tv1).tv_usec - (tv2).tv_usec; \ | 59 | return min(tv1 - tv2, bound); |
152 | switch (__delta_sec) { \ | 60 | } |
153 | default: \ | ||
154 | __delta = psched_tod_diff(__delta_sec, bound); break; \ | ||
155 | case 2: \ | ||
156 | __delta += USEC_PER_SEC; \ | ||
157 | case 1: \ | ||
158 | __delta += USEC_PER_SEC; \ | ||
159 | case 0: \ | ||
160 | if (__delta > bound || __delta < 0) \ | ||
161 | __delta = bound; \ | ||
162 | } \ | ||
163 | __delta; \ | ||
164 | }) | ||
165 | |||
166 | #define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \ | ||
167 | (tv1).tv_sec <= (tv2).tv_sec) || \ | ||
168 | (tv1).tv_sec < (tv2).tv_sec) | ||
169 | |||
170 | #define PSCHED_TADD2(tv, delta, tv_res) \ | ||
171 | ({ \ | ||
172 | int __delta = (tv).tv_usec + (delta); \ | ||
173 | (tv_res).tv_sec = (tv).tv_sec; \ | ||
174 | while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ | ||
175 | (tv_res).tv_usec = __delta; \ | ||
176 | }) | ||
177 | |||
178 | #define PSCHED_TADD(tv, delta) \ | ||
179 | ({ \ | ||
180 | (tv).tv_usec += (delta); \ | ||
181 | while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \ | ||
182 | (tv).tv_usec -= USEC_PER_SEC; } \ | ||
183 | }) | ||
184 | |||
185 | /* Set/check that time is in the "past perfect"; | ||
186 | it depends on concrete representation of system time | ||
187 | */ | ||
188 | |||
189 | #define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0) | ||
190 | #define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0) | ||
191 | |||
192 | #define PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; }) | ||
193 | |||
194 | #else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
195 | |||
196 | #define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2)) | ||
197 | #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ | ||
198 | min_t(long long, (tv1) - (tv2), bound) | ||
199 | |||
200 | 61 | ||
201 | #define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2)) | 62 | struct qdisc_watchdog { |
202 | #define PSCHED_TADD2(tv, delta, tv_res) ((tv_res) = (tv) + (delta)) | 63 | struct hrtimer timer; |
203 | #define PSCHED_TADD(tv, delta) ((tv) += (delta)) | 64 | struct Qdisc *qdisc; |
204 | #define PSCHED_SET_PASTPERFECT(t) ((t) = 0) | 65 | }; |
205 | #define PSCHED_IS_PASTPERFECT(t) ((t) == 0) | ||
206 | #define PSCHED_AUDIT_TDIFF(t) | ||
207 | 66 | ||
208 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | 67 | extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); |
68 | extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, | ||
69 | psched_time_t expires); | ||
70 | extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); | ||
209 | 71 | ||
210 | extern struct Qdisc_ops pfifo_qdisc_ops; | 72 | extern struct Qdisc_ops pfifo_qdisc_ops; |
211 | extern struct Qdisc_ops bfifo_qdisc_ops; | 73 | extern struct Qdisc_ops bfifo_qdisc_ops; |
diff --git a/include/net/red.h b/include/net/red.h index a4eb37946f2c..3cf31d466a81 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -151,17 +151,17 @@ static inline void red_set_parms(struct red_parms *p, | |||
151 | 151 | ||
152 | static inline int red_is_idling(struct red_parms *p) | 152 | static inline int red_is_idling(struct red_parms *p) |
153 | { | 153 | { |
154 | return !PSCHED_IS_PASTPERFECT(p->qidlestart); | 154 | return p->qidlestart != PSCHED_PASTPERFECT; |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline void red_start_of_idle_period(struct red_parms *p) | 157 | static inline void red_start_of_idle_period(struct red_parms *p) |
158 | { | 158 | { |
159 | PSCHED_GET_TIME(p->qidlestart); | 159 | p->qidlestart = psched_get_time(); |
160 | } | 160 | } |
161 | 161 | ||
162 | static inline void red_end_of_idle_period(struct red_parms *p) | 162 | static inline void red_end_of_idle_period(struct red_parms *p) |
163 | { | 163 | { |
164 | PSCHED_SET_PASTPERFECT(p->qidlestart); | 164 | p->qidlestart = PSCHED_PASTPERFECT; |
165 | } | 165 | } |
166 | 166 | ||
167 | static inline void red_restart(struct red_parms *p) | 167 | static inline void red_restart(struct red_parms *p) |
@@ -177,8 +177,8 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
177 | long us_idle; | 177 | long us_idle; |
178 | int shift; | 178 | int shift; |
179 | 179 | ||
180 | PSCHED_GET_TIME(now); | 180 | now = psched_get_time(); |
181 | us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); | 181 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * The problem: ideally, average length queue recalcultion should | 184 | * The problem: ideally, average length queue recalcultion should |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h new file mode 100644 index 000000000000..3b3d4745618d --- /dev/null +++ b/include/net/rtnetlink.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __NET_RTNETLINK_H | ||
2 | #define __NET_RTNETLINK_H | ||
3 | |||
4 | #include <linux/rtnetlink.h> | ||
5 | #include <net/netlink.h> | ||
6 | |||
7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); | ||
8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); | ||
9 | |||
10 | extern int __rtnl_register(int protocol, int msgtype, | ||
11 | rtnl_doit_func, rtnl_dumpit_func); | ||
12 | extern void rtnl_register(int protocol, int msgtype, | ||
13 | rtnl_doit_func, rtnl_dumpit_func); | ||
14 | extern int rtnl_unregister(int protocol, int msgtype); | ||
15 | extern void rtnl_unregister_all(int protocol); | ||
16 | |||
17 | static inline int rtnl_msg_family(struct nlmsghdr *nlh) | ||
18 | { | ||
19 | if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) | ||
20 | return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; | ||
21 | else | ||
22 | return AF_UNSPEC; | ||
23 | } | ||
24 | |||
25 | #endif | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 82086392735a..1b8e35197ebe 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -5,10 +5,10 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/rcupdate.h> | 6 | #include <linux/rcupdate.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/rtnetlink.h> | ||
9 | #include <linux/pkt_sched.h> | 8 | #include <linux/pkt_sched.h> |
10 | #include <linux/pkt_cls.h> | 9 | #include <linux/pkt_cls.h> |
11 | #include <net/gen_stats.h> | 10 | #include <net/gen_stats.h> |
11 | #include <net/rtnetlink.h> | ||
12 | 12 | ||
13 | struct Qdisc_ops; | 13 | struct Qdisc_ops; |
14 | struct qdisc_walker; | 14 | struct qdisc_walker; |
@@ -177,14 +177,8 @@ extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); | |||
177 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); | 177 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); |
178 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, | 178 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, |
179 | struct Qdisc_ops *ops, u32 parentid); | 179 | struct Qdisc_ops *ops, u32 parentid); |
180 | 180 | extern void tcf_destroy(struct tcf_proto *tp); | |
181 | static inline void | 181 | extern void tcf_destroy_chain(struct tcf_proto *fl); |
182 | tcf_destroy(struct tcf_proto *tp) | ||
183 | { | ||
184 | tp->ops->destroy(tp); | ||
185 | module_put(tp->ops->owner); | ||
186 | kfree(tp); | ||
187 | } | ||
188 | 182 | ||
189 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | 183 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |
190 | struct sk_buff_head *list) | 184 | struct sk_buff_head *list) |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 5ddb85599863..bb37724495a5 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -283,7 +283,7 @@ enum { SCTP_MAX_GABS = 16 }; | |||
283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ | 283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ |
284 | 284 | ||
285 | /* Maximum number of new data packets that can be sent in a burst. */ | 285 | /* Maximum number of new data packets that can be sent in a burst. */ |
286 | #define SCTP_MAX_BURST 4 | 286 | #define SCTP_DEFAULT_MAX_BURST 4 |
287 | 287 | ||
288 | #define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ | 288 | #define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ |
289 | 289 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index f431acf3dcea..7b4fff93ba7f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -276,6 +276,7 @@ struct sctp_sock { | |||
276 | __u32 default_context; | 276 | __u32 default_context; |
277 | __u32 default_timetolive; | 277 | __u32 default_timetolive; |
278 | __u32 default_rcv_context; | 278 | __u32 default_rcv_context; |
279 | int max_burst; | ||
279 | 280 | ||
280 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | 281 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to |
281 | * the destination address every heartbeat interval. This value | 282 | * the destination address every heartbeat interval. This value |
@@ -304,10 +305,12 @@ struct sctp_sock { | |||
304 | __u32 autoclose; | 305 | __u32 autoclose; |
305 | __u8 nodelay; | 306 | __u8 nodelay; |
306 | __u8 disable_fragments; | 307 | __u8 disable_fragments; |
307 | __u8 pd_mode; | ||
308 | __u8 v4mapped; | 308 | __u8 v4mapped; |
309 | __u8 frag_interleave; | ||
309 | __u32 adaptation_ind; | 310 | __u32 adaptation_ind; |
311 | __u32 pd_point; | ||
310 | 312 | ||
313 | atomic_t pd_mode; | ||
311 | /* Receive to here while partial delivery is in effect. */ | 314 | /* Receive to here while partial delivery is in effect. */ |
312 | struct sk_buff_head pd_lobby; | 315 | struct sk_buff_head pd_lobby; |
313 | }; | 316 | }; |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index 2923e3d31a08..de88ed5b0ba6 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -89,6 +89,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
89 | __u16 error, | 89 | __u16 error, |
90 | __u16 outbound, | 90 | __u16 outbound, |
91 | __u16 inbound, | 91 | __u16 inbound, |
92 | struct sctp_chunk *chunk, | ||
92 | gfp_t gfp); | 93 | gfp_t gfp); |
93 | 94 | ||
94 | struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( | 95 | struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( |
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h index ab26ab3adae1..39ea3f442b47 100644 --- a/include/net/sctp/ulpqueue.h +++ b/include/net/sctp/ulpqueue.h | |||
@@ -78,7 +78,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); | |||
78 | void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); | 78 | void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); |
79 | 79 | ||
80 | /* Clear the partial data delivery condition on this socket. */ | 80 | /* Clear the partial data delivery condition on this socket. */ |
81 | int sctp_clear_pd(struct sock *sk); | 81 | int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc); |
82 | 82 | ||
83 | /* Skip over an SSN. */ | 83 | /* Skip over an SSN. */ |
84 | void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); | 84 | void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 67a30eb2b3a4..6d2b57758cca 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -97,6 +97,12 @@ enum sctp_optname { | |||
97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME | 97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME |
98 | SCTP_CONTEXT, /* Receive Context */ | 98 | SCTP_CONTEXT, /* Receive Context */ |
99 | #define SCTP_CONTEXT SCTP_CONTEXT | 99 | #define SCTP_CONTEXT SCTP_CONTEXT |
100 | SCTP_FRAGMENT_INTERLEAVE, | ||
101 | #define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE | ||
102 | SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ | ||
103 | #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT | ||
104 | SCTP_MAX_BURST, /* Set/Get max burst */ | ||
105 | #define SCTP_MAX_BURST SCTP_MAX_BURST | ||
100 | 106 | ||
101 | /* Internal Socket Options. Some of the sctp library functions are | 107 | /* Internal Socket Options. Some of the sctp library functions are |
102 | * implemented using these socket options. | 108 | * implemented using these socket options. |
@@ -213,6 +219,7 @@ struct sctp_assoc_change { | |||
213 | __u16 sac_outbound_streams; | 219 | __u16 sac_outbound_streams; |
214 | __u16 sac_inbound_streams; | 220 | __u16 sac_inbound_streams; |
215 | sctp_assoc_t sac_assoc_id; | 221 | sctp_assoc_t sac_assoc_id; |
222 | __u8 sac_info[0]; | ||
216 | }; | 223 | }; |
217 | 224 | ||
218 | /* | 225 | /* |
@@ -261,6 +268,7 @@ enum sctp_spc_state { | |||
261 | SCTP_ADDR_REMOVED, | 268 | SCTP_ADDR_REMOVED, |
262 | SCTP_ADDR_ADDED, | 269 | SCTP_ADDR_ADDED, |
263 | SCTP_ADDR_MADE_PRIM, | 270 | SCTP_ADDR_MADE_PRIM, |
271 | SCTP_ADDR_CONFIRMED, | ||
264 | }; | 272 | }; |
265 | 273 | ||
266 | 274 | ||
@@ -508,16 +516,17 @@ struct sctp_setadaptation { | |||
508 | * address's parameters: | 516 | * address's parameters: |
509 | */ | 517 | */ |
510 | enum sctp_spp_flags { | 518 | enum sctp_spp_flags { |
511 | SPP_HB_ENABLE = 1, /*Enable heartbeats*/ | 519 | SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ |
512 | SPP_HB_DISABLE = 2, /*Disable heartbeats*/ | 520 | SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ |
513 | SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, | 521 | SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, |
514 | SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ | 522 | SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ |
515 | SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ | 523 | SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ |
516 | SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ | 524 | SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ |
517 | SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, | 525 | SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, |
518 | SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ | 526 | SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ |
519 | SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ | 527 | SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ |
520 | SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, | 528 | SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, |
529 | SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ | ||
521 | }; | 530 | }; |
522 | 531 | ||
523 | struct sctp_paddrparams { | 532 | struct sctp_paddrparams { |
@@ -530,7 +539,7 @@ struct sctp_paddrparams { | |||
530 | __u32 spp_flags; | 539 | __u32 spp_flags; |
531 | } __attribute__((packed, aligned(4))); | 540 | } __attribute__((packed, aligned(4))); |
532 | 541 | ||
533 | /* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) | 542 | /* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) |
534 | * | 543 | * |
535 | * This options will get or set the delayed ack timer. The time is set | 544 | * This options will get or set the delayed ack timer. The time is set |
536 | * in milliseconds. If the assoc_id is 0, then this sets or gets the | 545 | * in milliseconds. If the assoc_id is 0, then this sets or gets the |
diff --git a/include/net/sock.h b/include/net/sock.h index 2c7d60ca3548..25c37e34bfdc 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -202,6 +202,15 @@ struct sock { | |||
202 | unsigned short sk_type; | 202 | unsigned short sk_type; |
203 | int sk_rcvbuf; | 203 | int sk_rcvbuf; |
204 | socket_lock_t sk_lock; | 204 | socket_lock_t sk_lock; |
205 | /* | ||
206 | * The backlog queue is special, it is always used with | ||
207 | * the per-socket spinlock held and requires low latency | ||
208 | * access. Therefore we special case it's implementation. | ||
209 | */ | ||
210 | struct { | ||
211 | struct sk_buff *head; | ||
212 | struct sk_buff *tail; | ||
213 | } sk_backlog; | ||
205 | wait_queue_head_t *sk_sleep; | 214 | wait_queue_head_t *sk_sleep; |
206 | struct dst_entry *sk_dst_cache; | 215 | struct dst_entry *sk_dst_cache; |
207 | struct xfrm_policy *sk_policy[2]; | 216 | struct xfrm_policy *sk_policy[2]; |
@@ -221,15 +230,6 @@ struct sock { | |||
221 | int sk_rcvlowat; | 230 | int sk_rcvlowat; |
222 | unsigned long sk_flags; | 231 | unsigned long sk_flags; |
223 | unsigned long sk_lingertime; | 232 | unsigned long sk_lingertime; |
224 | /* | ||
225 | * The backlog queue is special, it is always used with | ||
226 | * the per-socket spinlock held and requires low latency | ||
227 | * access. Therefore we special case it's implementation. | ||
228 | */ | ||
229 | struct { | ||
230 | struct sk_buff *head; | ||
231 | struct sk_buff *tail; | ||
232 | } sk_backlog; | ||
233 | struct sk_buff_head sk_error_queue; | 233 | struct sk_buff_head sk_error_queue; |
234 | struct proto *sk_prot_creator; | 234 | struct proto *sk_prot_creator; |
235 | rwlock_t sk_callback_lock; | 235 | rwlock_t sk_callback_lock; |
@@ -244,7 +244,7 @@ struct sock { | |||
244 | struct sk_filter *sk_filter; | 244 | struct sk_filter *sk_filter; |
245 | void *sk_protinfo; | 245 | void *sk_protinfo; |
246 | struct timer_list sk_timer; | 246 | struct timer_list sk_timer; |
247 | struct timeval sk_stamp; | 247 | ktime_t sk_stamp; |
248 | struct socket *sk_socket; | 248 | struct socket *sk_socket; |
249 | void *sk_user_data; | 249 | void *sk_user_data; |
250 | struct page *sk_sndmsg_page; | 250 | struct page *sk_sndmsg_page; |
@@ -390,6 +390,7 @@ enum sock_flags { | |||
390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ | 390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ |
391 | SOCK_DBG, /* %SO_DEBUG setting */ | 391 | SOCK_DBG, /* %SO_DEBUG setting */ |
392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ | 392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ |
393 | SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ | ||
393 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 394 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
394 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 395 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
395 | }; | 396 | }; |
@@ -710,15 +711,6 @@ static inline void sk_stream_mem_reclaim(struct sock *sk) | |||
710 | __sk_stream_mem_reclaim(sk); | 711 | __sk_stream_mem_reclaim(sk); |
711 | } | 712 | } |
712 | 713 | ||
713 | static inline void sk_stream_writequeue_purge(struct sock *sk) | ||
714 | { | ||
715 | struct sk_buff *skb; | ||
716 | |||
717 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | ||
718 | sk_stream_free_skb(sk, skb); | ||
719 | sk_stream_mem_reclaim(sk); | ||
720 | } | ||
721 | |||
722 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) | 714 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) |
723 | { | 715 | { |
724 | return (int)skb->truesize <= sk->sk_forward_alloc || | 716 | return (int)skb->truesize <= sk->sk_forward_alloc || |
@@ -1083,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk) | |||
1083 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); | 1075 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); |
1084 | } | 1076 | } |
1085 | 1077 | ||
1086 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1078 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); |
1087 | { | ||
1088 | __sk_dst_set(sk, dst); | ||
1089 | sk->sk_route_caps = dst->dev->features; | ||
1090 | if (sk->sk_route_caps & NETIF_F_GSO) | ||
1091 | sk->sk_route_caps |= NETIF_F_GSO_MASK; | ||
1092 | if (sk_can_gso(sk)) { | ||
1093 | if (dst->header_len) | ||
1094 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; | ||
1095 | else | ||
1096 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
1097 | } | ||
1098 | } | ||
1099 | 1079 | ||
1100 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) | 1080 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) |
1101 | { | 1081 | { |
@@ -1256,18 +1236,6 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) | |||
1256 | return page; | 1236 | return page; |
1257 | } | 1237 | } |
1258 | 1238 | ||
1259 | #define sk_stream_for_retrans_queue(skb, sk) \ | ||
1260 | for (skb = (sk)->sk_write_queue.next; \ | ||
1261 | (skb != (sk)->sk_send_head) && \ | ||
1262 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1263 | skb = skb->next) | ||
1264 | |||
1265 | /*from STCP for fast SACK Process*/ | ||
1266 | #define sk_stream_for_retrans_queue_from(skb, sk) \ | ||
1267 | for (; (skb != (sk)->sk_send_head) && \ | ||
1268 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1269 | skb = skb->next) | ||
1270 | |||
1271 | /* | 1239 | /* |
1272 | * Default write policy as shown to user space via poll/select/SIGIO | 1240 | * Default write policy as shown to user space via poll/select/SIGIO |
1273 | */ | 1241 | */ |
@@ -1304,22 +1272,18 @@ static inline int sock_intr_errno(long timeo) | |||
1304 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; | 1272 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; |
1305 | } | 1273 | } |
1306 | 1274 | ||
1275 | extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | ||
1276 | struct sk_buff *skb); | ||
1277 | |||
1307 | static __inline__ void | 1278 | static __inline__ void |
1308 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 1279 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
1309 | { | 1280 | { |
1310 | struct timeval stamp; | 1281 | ktime_t kt = skb->tstamp; |
1311 | 1282 | ||
1312 | skb_get_timestamp(skb, &stamp); | 1283 | if (sock_flag(sk, SOCK_RCVTSTAMP)) |
1313 | if (sock_flag(sk, SOCK_RCVTSTAMP)) { | 1284 | __sock_recv_timestamp(msg, sk, skb); |
1314 | /* Race occurred between timestamp enabling and packet | 1285 | else |
1315 | receiving. Fill in the current time for now. */ | 1286 | sk->sk_stamp = kt; |
1316 | if (stamp.tv_sec == 0) | ||
1317 | do_gettimeofday(&stamp); | ||
1318 | skb_set_timestamp(skb, &stamp); | ||
1319 | put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval), | ||
1320 | &stamp); | ||
1321 | } else | ||
1322 | sk->sk_stamp = stamp; | ||
1323 | } | 1287 | } |
1324 | 1288 | ||
1325 | /** | 1289 | /** |
@@ -1350,18 +1314,17 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1350 | 1314 | ||
1351 | extern void sock_enable_timestamp(struct sock *sk); | 1315 | extern void sock_enable_timestamp(struct sock *sk); |
1352 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1316 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
1317 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); | ||
1353 | 1318 | ||
1354 | /* | 1319 | /* |
1355 | * Enable debug/info messages | 1320 | * Enable debug/info messages |
1356 | */ | 1321 | */ |
1322 | extern int net_msg_warn; | ||
1323 | #define NETDEBUG(fmt, args...) \ | ||
1324 | do { if (net_msg_warn) printk(fmt,##args); } while (0) | ||
1357 | 1325 | ||
1358 | #ifdef CONFIG_NETDEBUG | 1326 | #define LIMIT_NETDEBUG(fmt, args...) \ |
1359 | #define NETDEBUG(fmt, args...) printk(fmt,##args) | 1327 | do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0) |
1360 | #define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0) | ||
1361 | #else | ||
1362 | #define NETDEBUG(fmt, args...) do { } while (0) | ||
1363 | #define LIMIT_NETDEBUG(fmt, args...) do { } while(0) | ||
1364 | #endif | ||
1365 | 1328 | ||
1366 | /* | 1329 | /* |
1367 | * Macros for sleeping on a socket. Use them like this: | 1330 | * Macros for sleeping on a socket. Use them like this: |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 5c472f255b77..a385797f160a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -220,6 +220,7 @@ extern int sysctl_tcp_app_win; | |||
220 | extern int sysctl_tcp_adv_win_scale; | 220 | extern int sysctl_tcp_adv_win_scale; |
221 | extern int sysctl_tcp_tw_reuse; | 221 | extern int sysctl_tcp_tw_reuse; |
222 | extern int sysctl_tcp_frto; | 222 | extern int sysctl_tcp_frto; |
223 | extern int sysctl_tcp_frto_response; | ||
223 | extern int sysctl_tcp_low_latency; | 224 | extern int sysctl_tcp_low_latency; |
224 | extern int sysctl_tcp_dma_copybreak; | 225 | extern int sysctl_tcp_dma_copybreak; |
225 | extern int sysctl_tcp_nometrics_save; | 226 | extern int sysctl_tcp_nometrics_save; |
@@ -230,6 +231,7 @@ extern int sysctl_tcp_mtu_probing; | |||
230 | extern int sysctl_tcp_base_mss; | 231 | extern int sysctl_tcp_base_mss; |
231 | extern int sysctl_tcp_workaround_signed_windows; | 232 | extern int sysctl_tcp_workaround_signed_windows; |
232 | extern int sysctl_tcp_slow_start_after_idle; | 233 | extern int sysctl_tcp_slow_start_after_idle; |
234 | extern int sysctl_tcp_max_ssthresh; | ||
233 | 235 | ||
234 | extern atomic_t tcp_memory_allocated; | 236 | extern atomic_t tcp_memory_allocated; |
235 | extern atomic_t tcp_sockets_allocated; | 237 | extern atomic_t tcp_sockets_allocated; |
@@ -341,6 +343,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
341 | extern int tcp_child_process(struct sock *parent, | 343 | extern int tcp_child_process(struct sock *parent, |
342 | struct sock *child, | 344 | struct sock *child, |
343 | struct sk_buff *skb); | 345 | struct sk_buff *skb); |
346 | extern int tcp_use_frto(struct sock *sk); | ||
344 | extern void tcp_enter_frto(struct sock *sk); | 347 | extern void tcp_enter_frto(struct sock *sk); |
345 | extern void tcp_enter_loss(struct sock *sk, int how); | 348 | extern void tcp_enter_loss(struct sock *sk, int how); |
346 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 349 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
@@ -417,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | |||
417 | 420 | ||
418 | /* tcp_output.c */ | 421 | /* tcp_output.c */ |
419 | 422 | ||
420 | extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, | 423 | extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, |
421 | unsigned int cur_mss, int nonagle); | 424 | int nonagle); |
422 | extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); | 425 | extern int tcp_may_send_now(struct sock *sk); |
423 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); | 426 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); |
424 | extern void tcp_xmit_retransmit_queue(struct sock *); | 427 | extern void tcp_xmit_retransmit_queue(struct sock *); |
425 | extern void tcp_simple_retransmit(struct sock *); | 428 | extern void tcp_simple_retransmit(struct sock *); |
@@ -476,8 +479,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp) | |||
476 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); | 479 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); |
477 | } | 480 | } |
478 | 481 | ||
479 | static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) | 482 | static inline void tcp_fast_path_check(struct sock *sk) |
480 | { | 483 | { |
484 | struct tcp_sock *tp = tcp_sk(sk); | ||
485 | |||
481 | if (skb_queue_empty(&tp->out_of_order_queue) && | 486 | if (skb_queue_empty(&tp->out_of_order_queue) && |
482 | tp->rcv_wnd && | 487 | tp->rcv_wnd && |
483 | atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && | 488 | atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && |
@@ -588,10 +593,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count, | |||
588 | } | 593 | } |
589 | } | 594 | } |
590 | 595 | ||
591 | static inline void tcp_packets_out_inc(struct sock *sk, | 596 | static inline void tcp_packets_out_inc(struct sock *sk, |
592 | struct tcp_sock *tp, | ||
593 | const struct sk_buff *skb) | 597 | const struct sk_buff *skb) |
594 | { | 598 | { |
599 | struct tcp_sock *tp = tcp_sk(sk); | ||
595 | int orig = tp->packets_out; | 600 | int orig = tp->packets_out; |
596 | 601 | ||
597 | tp->packets_out += tcp_skb_pcount(skb); | 602 | tp->packets_out += tcp_skb_pcount(skb); |
@@ -624,9 +629,12 @@ enum tcp_ca_event { | |||
624 | #define TCP_CA_MAX 128 | 629 | #define TCP_CA_MAX 128 |
625 | #define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) | 630 | #define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) |
626 | 631 | ||
632 | #define TCP_CONG_NON_RESTRICTED 0x1 | ||
633 | #define TCP_CONG_RTT_STAMP 0x2 | ||
634 | |||
627 | struct tcp_congestion_ops { | 635 | struct tcp_congestion_ops { |
628 | struct list_head list; | 636 | struct list_head list; |
629 | int non_restricted; | 637 | unsigned long flags; |
630 | 638 | ||
631 | /* initialize private data (optional) */ | 639 | /* initialize private data (optional) */ |
632 | void (*init)(struct sock *sk); | 640 | void (*init)(struct sock *sk); |
@@ -640,8 +648,6 @@ struct tcp_congestion_ops { | |||
640 | /* do new cwnd calculation (required) */ | 648 | /* do new cwnd calculation (required) */ |
641 | void (*cong_avoid)(struct sock *sk, u32 ack, | 649 | void (*cong_avoid)(struct sock *sk, u32 ack, |
642 | u32 rtt, u32 in_flight, int good_ack); | 650 | u32 rtt, u32 in_flight, int good_ack); |
643 | /* round trip time sample per acked packet (optional) */ | ||
644 | void (*rtt_sample)(struct sock *sk, u32 usrtt); | ||
645 | /* call before changing ca_state (optional) */ | 651 | /* call before changing ca_state (optional) */ |
646 | void (*set_state)(struct sock *sk, u8 new_state); | 652 | void (*set_state)(struct sock *sk, u8 new_state); |
647 | /* call when cwnd event occurs (optional) */ | 653 | /* call when cwnd event occurs (optional) */ |
@@ -649,7 +655,7 @@ struct tcp_congestion_ops { | |||
649 | /* new value of cwnd after loss (optional) */ | 655 | /* new value of cwnd after loss (optional) */ |
650 | u32 (*undo_cwnd)(struct sock *sk); | 656 | u32 (*undo_cwnd)(struct sock *sk); |
651 | /* hook for packet ack accounting (optional) */ | 657 | /* hook for packet ack accounting (optional) */ |
652 | void (*pkts_acked)(struct sock *sk, u32 num_acked); | 658 | void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last); |
653 | /* get info for inet_diag (optional) */ | 659 | /* get info for inet_diag (optional) */ |
654 | void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); | 660 | void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); |
655 | 661 | ||
@@ -736,7 +742,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) | |||
736 | tp->left_out = tp->sacked_out + tp->lost_out; | 742 | tp->left_out = tp->sacked_out + tp->lost_out; |
737 | } | 743 | } |
738 | 744 | ||
739 | extern void tcp_enter_cwr(struct sock *sk); | 745 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
740 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 746 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
741 | 747 | ||
742 | /* Slow start with delack produces 3 packets of burst, so that | 748 | /* Slow start with delack produces 3 packets of burst, so that |
@@ -775,18 +781,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss, | |||
775 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; | 781 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; |
776 | } | 782 | } |
777 | 783 | ||
778 | static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) | 784 | static inline void tcp_check_probe_timer(struct sock *sk) |
779 | { | 785 | { |
786 | struct tcp_sock *tp = tcp_sk(sk); | ||
780 | const struct inet_connection_sock *icsk = inet_csk(sk); | 787 | const struct inet_connection_sock *icsk = inet_csk(sk); |
788 | |||
781 | if (!tp->packets_out && !icsk->icsk_pending) | 789 | if (!tp->packets_out && !icsk->icsk_pending) |
782 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, | 790 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, |
783 | icsk->icsk_rto, TCP_RTO_MAX); | 791 | icsk->icsk_rto, TCP_RTO_MAX); |
784 | } | 792 | } |
785 | 793 | ||
786 | static inline void tcp_push_pending_frames(struct sock *sk, | 794 | static inline void tcp_push_pending_frames(struct sock *sk) |
787 | struct tcp_sock *tp) | ||
788 | { | 795 | { |
789 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); | 796 | struct tcp_sock *tp = tcp_sk(sk); |
797 | |||
798 | __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); | ||
790 | } | 799 | } |
791 | 800 | ||
792 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 801 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) |
@@ -815,7 +824,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb) | |||
815 | 824 | ||
816 | static inline int tcp_checksum_complete(struct sk_buff *skb) | 825 | static inline int tcp_checksum_complete(struct sk_buff *skb) |
817 | { | 826 | { |
818 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 827 | return !skb_csum_unnecessary(skb) && |
819 | __tcp_checksum_complete(skb); | 828 | __tcp_checksum_complete(skb); |
820 | } | 829 | } |
821 | 830 | ||
@@ -918,21 +927,7 @@ static inline void tcp_set_state(struct sock *sk, int state) | |||
918 | #endif | 927 | #endif |
919 | } | 928 | } |
920 | 929 | ||
921 | static inline void tcp_done(struct sock *sk) | 930 | extern void tcp_done(struct sock *sk); |
922 | { | ||
923 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | ||
924 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
925 | |||
926 | tcp_set_state(sk, TCP_CLOSE); | ||
927 | tcp_clear_xmit_timers(sk); | ||
928 | |||
929 | sk->sk_shutdown = SHUTDOWN_MASK; | ||
930 | |||
931 | if (!sock_flag(sk, SOCK_DEAD)) | ||
932 | sk->sk_state_change(sk); | ||
933 | else | ||
934 | inet_csk_destroy_sock(sk); | ||
935 | } | ||
936 | 931 | ||
937 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | 932 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) |
938 | { | 933 | { |
@@ -981,7 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
981 | ireq->wscale_ok = rx_opt->wscale_ok; | 976 | ireq->wscale_ok = rx_opt->wscale_ok; |
982 | ireq->acked = 0; | 977 | ireq->acked = 0; |
983 | ireq->ecn_ok = 0; | 978 | ireq->ecn_ok = 0; |
984 | ireq->rmt_port = skb->h.th->source; | 979 | ireq->rmt_port = tcp_hdr(skb)->source; |
985 | } | 980 | } |
986 | 981 | ||
987 | extern void tcp_enter_memory_pressure(void); | 982 | extern void tcp_enter_memory_pressure(void); |
@@ -1011,7 +1006,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int | |||
1011 | { | 1006 | { |
1012 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) | 1007 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) |
1013 | return 0; | 1008 | return 0; |
1014 | if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) | 1009 | if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) |
1015 | return 0; | 1010 | return 0; |
1016 | 1011 | ||
1017 | /* RST segments are not recommended to carry timestamp, | 1012 | /* RST segments are not recommended to carry timestamp, |
@@ -1026,26 +1021,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int | |||
1026 | 1021 | ||
1027 | However, we can relax time bounds for RST segments to MSL. | 1022 | However, we can relax time bounds for RST segments to MSL. |
1028 | */ | 1023 | */ |
1029 | if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) | 1024 | if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) |
1030 | return 0; | 1025 | return 0; |
1031 | return 1; | 1026 | return 1; |
1032 | } | 1027 | } |
1033 | 1028 | ||
1034 | #define TCP_CHECK_TIMER(sk) do { } while (0) | 1029 | #define TCP_CHECK_TIMER(sk) do { } while (0) |
1035 | 1030 | ||
1036 | static inline int tcp_use_frto(const struct sock *sk) | ||
1037 | { | ||
1038 | const struct tcp_sock *tp = tcp_sk(sk); | ||
1039 | |||
1040 | /* F-RTO must be activated in sysctl and there must be some | ||
1041 | * unsent new data, and the advertised window should allow | ||
1042 | * sending it. | ||
1043 | */ | ||
1044 | return (sysctl_tcp_frto && sk->sk_send_head && | ||
1045 | !after(TCP_SKB_CB(sk->sk_send_head)->end_seq, | ||
1046 | tp->snd_una + tp->snd_wnd)); | ||
1047 | } | ||
1048 | |||
1049 | static inline void tcp_mib_init(void) | 1031 | static inline void tcp_mib_init(void) |
1050 | { | 1032 | { |
1051 | /* See RFC 2012 */ | 1033 | /* See RFC 2012 */ |
@@ -1172,6 +1154,120 @@ static inline void tcp_put_md5sig_pool(void) | |||
1172 | put_cpu(); | 1154 | put_cpu(); |
1173 | } | 1155 | } |
1174 | 1156 | ||
1157 | /* write queue abstraction */ | ||
1158 | static inline void tcp_write_queue_purge(struct sock *sk) | ||
1159 | { | ||
1160 | struct sk_buff *skb; | ||
1161 | |||
1162 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | ||
1163 | sk_stream_free_skb(sk, skb); | ||
1164 | sk_stream_mem_reclaim(sk); | ||
1165 | } | ||
1166 | |||
1167 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | ||
1168 | { | ||
1169 | struct sk_buff *skb = sk->sk_write_queue.next; | ||
1170 | if (skb == (struct sk_buff *) &sk->sk_write_queue) | ||
1171 | return NULL; | ||
1172 | return skb; | ||
1173 | } | ||
1174 | |||
1175 | static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk) | ||
1176 | { | ||
1177 | struct sk_buff *skb = sk->sk_write_queue.prev; | ||
1178 | if (skb == (struct sk_buff *) &sk->sk_write_queue) | ||
1179 | return NULL; | ||
1180 | return skb; | ||
1181 | } | ||
1182 | |||
1183 | static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb) | ||
1184 | { | ||
1185 | return skb->next; | ||
1186 | } | ||
1187 | |||
1188 | #define tcp_for_write_queue(skb, sk) \ | ||
1189 | for (skb = (sk)->sk_write_queue.next; \ | ||
1190 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1191 | skb = skb->next) | ||
1192 | |||
1193 | #define tcp_for_write_queue_from(skb, sk) \ | ||
1194 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ | ||
1195 | skb = skb->next) | ||
1196 | |||
1197 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | ||
1198 | { | ||
1199 | return sk->sk_send_head; | ||
1200 | } | ||
1201 | |||
1202 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) | ||
1203 | { | ||
1204 | sk->sk_send_head = skb->next; | ||
1205 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) | ||
1206 | sk->sk_send_head = NULL; | ||
1207 | } | ||
1208 | |||
1209 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) | ||
1210 | { | ||
1211 | if (sk->sk_send_head == skb_unlinked) | ||
1212 | sk->sk_send_head = NULL; | ||
1213 | } | ||
1214 | |||
1215 | static inline void tcp_init_send_head(struct sock *sk) | ||
1216 | { | ||
1217 | sk->sk_send_head = NULL; | ||
1218 | } | ||
1219 | |||
1220 | static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb) | ||
1221 | { | ||
1222 | __skb_queue_tail(&sk->sk_write_queue, skb); | ||
1223 | } | ||
1224 | |||
1225 | static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb) | ||
1226 | { | ||
1227 | __tcp_add_write_queue_tail(sk, skb); | ||
1228 | |||
1229 | /* Queue it, remembering where we must start sending. */ | ||
1230 | if (sk->sk_send_head == NULL) | ||
1231 | sk->sk_send_head = skb; | ||
1232 | } | ||
1233 | |||
1234 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) | ||
1235 | { | ||
1236 | __skb_queue_head(&sk->sk_write_queue, skb); | ||
1237 | } | ||
1238 | |||
1239 | /* Insert buff after skb on the write queue of sk. */ | ||
1240 | static inline void tcp_insert_write_queue_after(struct sk_buff *skb, | ||
1241 | struct sk_buff *buff, | ||
1242 | struct sock *sk) | ||
1243 | { | ||
1244 | __skb_append(skb, buff, &sk->sk_write_queue); | ||
1245 | } | ||
1246 | |||
1247 | /* Insert skb between prev and next on the write queue of sk. */ | ||
1248 | static inline void tcp_insert_write_queue_before(struct sk_buff *new, | ||
1249 | struct sk_buff *skb, | ||
1250 | struct sock *sk) | ||
1251 | { | ||
1252 | __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); | ||
1253 | } | ||
1254 | |||
1255 | static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) | ||
1256 | { | ||
1257 | __skb_unlink(skb, &sk->sk_write_queue); | ||
1258 | } | ||
1259 | |||
1260 | static inline int tcp_skb_is_last(const struct sock *sk, | ||
1261 | const struct sk_buff *skb) | ||
1262 | { | ||
1263 | return skb->next == (struct sk_buff *)&sk->sk_write_queue; | ||
1264 | } | ||
1265 | |||
1266 | static inline int tcp_write_queue_empty(struct sock *sk) | ||
1267 | { | ||
1268 | return skb_queue_empty(&sk->sk_write_queue); | ||
1269 | } | ||
1270 | |||
1175 | /* /proc */ | 1271 | /* /proc */ |
1176 | enum tcp_seq_states { | 1272 | enum tcp_seq_states { |
1177 | TCP_SEQ_STATE_LISTENING, | 1273 | TCP_SEQ_STATE_LISTENING, |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index 4629d77173f2..89eb3e05116d 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(struct tcp_sock *tp, | |||
27 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; | 27 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; |
28 | } | 28 | } |
29 | 29 | ||
30 | static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, | 30 | static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb) |
31 | struct sk_buff *skb) | ||
32 | { | 31 | { |
32 | struct tcp_sock *tp = tcp_sk(sk); | ||
33 | |||
33 | tp->ecn_flags = 0; | 34 | tp->ecn_flags = 0; |
34 | if (sysctl_tcp_ecn) { | 35 | if (sysctl_tcp_ecn) { |
35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; | 36 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; |
@@ -44,9 +45,11 @@ TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th) | |||
44 | th->ece = 1; | 45 | th->ece = 1; |
45 | } | 46 | } |
46 | 47 | ||
47 | static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | 48 | static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb, |
48 | struct sk_buff *skb, int tcp_header_len) | 49 | int tcp_header_len) |
49 | { | 50 | { |
51 | struct tcp_sock *tp = tcp_sk(sk); | ||
52 | |||
50 | if (tp->ecn_flags & TCP_ECN_OK) { | 53 | if (tp->ecn_flags & TCP_ECN_OK) { |
51 | /* Not-retransmitted data segment: set ECT and inject CWR. */ | 54 | /* Not-retransmitted data segment: set ECT and inject CWR. */ |
52 | if (skb->len != tcp_header_len && | 55 | if (skb->len != tcp_header_len && |
@@ -54,7 +57,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
54 | INET_ECN_xmit(sk); | 57 | INET_ECN_xmit(sk); |
55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | 58 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { |
56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | 59 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; |
57 | skb->h.th->cwr = 1; | 60 | tcp_hdr(skb)->cwr = 1; |
58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | 61 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; |
59 | } | 62 | } |
60 | } else { | 63 | } else { |
@@ -62,7 +65,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
62 | INET_ECN_dontxmit(sk); | 65 | INET_ECN_dontxmit(sk); |
63 | } | 66 | } |
64 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) | 67 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) |
65 | skb->h.th->ece = 1; | 68 | tcp_hdr(skb)->ece = 1; |
66 | } | 69 | } |
67 | } | 70 | } |
68 | 71 | ||
@@ -70,7 +73,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
70 | 73 | ||
71 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) | 74 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) |
72 | { | 75 | { |
73 | if (skb->h.th->cwr) | 76 | if (tcp_hdr(skb)->cwr) |
74 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | 77 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
75 | } | 78 | } |
76 | 79 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 1b921fa81474..98755ebaf163 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -72,15 +72,12 @@ struct sk_buff; | |||
72 | */ | 72 | */ |
73 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) | 73 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) |
74 | { | 74 | { |
75 | if (! UDP_SKB_CB(skb)->partial_cov) | 75 | return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); |
76 | return __skb_checksum_complete(skb); | ||
77 | return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov, | ||
78 | skb->csum)); | ||
79 | } | 76 | } |
80 | 77 | ||
81 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) | 78 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) |
82 | { | 79 | { |
83 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 80 | return !skb_csum_unnecessary(skb) && |
84 | __udp_lib_checksum_complete(skb); | 81 | __udp_lib_checksum_complete(skb); |
85 | } | 82 | } |
86 | 83 | ||
@@ -92,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb) | |||
92 | */ | 89 | */ |
93 | static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 90 | static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
94 | { | 91 | { |
95 | __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); | 92 | __wsum csum = csum_partial(skb_transport_header(skb), |
96 | 93 | sizeof(struct udphdr), 0); | |
97 | skb_queue_walk(&sk->sk_write_queue, skb) { | 94 | skb_queue_walk(&sk->sk_write_queue, skb) { |
98 | csum = csum_add(csum, skb->csum); | 95 | csum = csum_add(csum, skb->csum); |
99 | } | 96 | } |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 67ac51424307..635b0eafca95 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | UDP_SKB_CB(skb)->partial_cov = 0; | ||
51 | cscov = ntohs(uh->len); | 50 | cscov = ntohs(uh->len); |
52 | 51 | ||
53 | if (cscov == 0) /* Indicates that full coverage is required. */ | 52 | if (cscov == 0) /* Indicates that full coverage is required. */ |
54 | cscov = skb->len; | 53 | ; |
55 | else if (cscov < 8 || cscov > skb->len) { | 54 | else if (cscov < 8 || cscov > skb->len) { |
56 | /* | 55 | /* |
57 | * Coverage length violates RFC 3828: log and discard silently. | 56 | * Coverage length violates RFC 3828: log and discard silently. |
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
60 | cscov, skb->len); | 59 | cscov, skb->len); |
61 | return 1; | 60 | return 1; |
62 | 61 | ||
63 | } else if (cscov < skb->len) | 62 | } else if (cscov < skb->len) { |
64 | UDP_SKB_CB(skb)->partial_cov = 1; | 63 | UDP_SKB_CB(skb)->partial_cov = 1; |
65 | 64 | UDP_SKB_CB(skb)->cscov = cscov; | |
66 | UDP_SKB_CB(skb)->cscov = cscov; | 65 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
67 | 66 | skb->ip_summed = CHECKSUM_NONE; | |
68 | /* | 67 | } |
69 | * There is no known NIC manufacturer supporting UDP-Lite yet, | ||
70 | * hence ip_summed is always (re-)set to CHECKSUM_NONE. | ||
71 | */ | ||
72 | skb->ip_summed = CHECKSUM_NONE; | ||
73 | 68 | ||
74 | return 0; | 69 | return 0; |
75 | } | 70 | } |
76 | 71 | ||
77 | static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
78 | { | ||
79 | int rc = udplite_checksum_init(skb, uh); | ||
80 | |||
81 | if (!rc) | ||
82 | skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr, | ||
83 | skb->nh.iph->daddr, | ||
84 | skb->len, IPPROTO_UDPLITE, 0); | ||
85 | return rc; | ||
86 | } | ||
87 | |||
88 | static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
89 | { | ||
90 | int rc = udplite_checksum_init(skb, uh); | ||
91 | |||
92 | if (!rc) | ||
93 | skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, | ||
94 | &skb->nh.ipv6h->daddr, | ||
95 | skb->len, IPPROTO_UDPLITE, 0)); | ||
96 | return rc; | ||
97 | } | ||
98 | |||
99 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | 72 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) |
100 | { | 73 | { |
101 | int cscov = up->len; | 74 | int cscov = up->len; |
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | |||
128 | 101 | ||
129 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 102 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
130 | { | 103 | { |
131 | int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); | 104 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); |
132 | __wsum csum = 0; | 105 | __wsum csum = 0; |
133 | 106 | ||
134 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ | 107 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ |
135 | 108 | ||
136 | skb_queue_walk(&sk->sk_write_queue, skb) { | 109 | skb_queue_walk(&sk->sk_write_queue, skb) { |
137 | off = skb->h.raw - skb->data; | 110 | const int off = skb_transport_offset(skb); |
138 | len = skb->len - off; | 111 | const int len = skb->len - off; |
139 | 112 | ||
140 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); | 113 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); |
141 | 114 | ||
diff --git a/include/net/wext.h b/include/net/wext.h new file mode 100644 index 000000000000..55741836a675 --- /dev/null +++ b/include/net/wext.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __NET_WEXT_H | ||
2 | #define __NET_WEXT_H | ||
3 | |||
4 | /* | ||
5 | * wireless extensions interface to the core code | ||
6 | */ | ||
7 | |||
8 | #ifdef CONFIG_WIRELESS_EXT | ||
9 | extern int wext_proc_init(void); | ||
10 | extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | ||
11 | void __user *arg); | ||
12 | #else | ||
13 | static inline int wext_proc_init() | ||
14 | { | ||
15 | return 0; | ||
16 | } | ||
17 | static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | ||
18 | void __user *arg) | ||
19 | { | ||
20 | return -EINVAL; | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #endif /* __NET_WEXT_H */ | ||
diff --git a/include/net/wireless.h b/include/net/wireless.h new file mode 100644 index 000000000000..d30c4ba8fd99 --- /dev/null +++ b/include/net/wireless.h | |||
@@ -0,0 +1,139 @@ | |||
1 | #ifndef __NET_WIRELESS_H | ||
2 | #define __NET_WIRELESS_H | ||
3 | |||
4 | /* | ||
5 | * 802.11 device management | ||
6 | * | ||
7 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
8 | */ | ||
9 | |||
10 | #include <linux/netdevice.h> | ||
11 | #include <linux/debugfs.h> | ||
12 | #include <linux/list.h> | ||
13 | #include <net/cfg80211.h> | ||
14 | |||
15 | /** | ||
16 | * struct wiphy - wireless hardware description | ||
17 | * @idx: the wiphy index assigned to this item | ||
18 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
19 | */ | ||
20 | struct wiphy { | ||
21 | /* assign these fields before you register the wiphy */ | ||
22 | |||
23 | /* permanent MAC address */ | ||
24 | u8 perm_addr[ETH_ALEN]; | ||
25 | |||
26 | /* If multiple wiphys are registered and you're handed e.g. | ||
27 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
28 | * know whether it points to a wiphy your driver has registered | ||
29 | * or not. Assign this to something global to your driver to | ||
30 | * help determine whether you own this wiphy or not. */ | ||
31 | void *privid; | ||
32 | |||
33 | /* fields below are read-only, assigned by cfg80211 */ | ||
34 | |||
35 | /* the item in /sys/class/ieee80211/ points to this, | ||
36 | * you need use set_wiphy_dev() (see below) */ | ||
37 | struct device dev; | ||
38 | |||
39 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
40 | struct dentry *debugfsdir; | ||
41 | |||
42 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
43 | }; | ||
44 | |||
45 | /** struct wireless_dev - wireless per-netdev state | ||
46 | * | ||
47 | * This structure must be allocated by the driver/stack | ||
48 | * that uses the ieee80211_ptr field in struct net_device | ||
49 | * (this is intentional so it can be allocated along with | ||
50 | * the netdev.) | ||
51 | * | ||
52 | * @wiphy: pointer to hardware description | ||
53 | */ | ||
54 | struct wireless_dev { | ||
55 | struct wiphy *wiphy; | ||
56 | |||
57 | /* private to the generic wireless code */ | ||
58 | struct list_head list; | ||
59 | struct net_device *netdev; | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | * wiphy_priv - return priv from wiphy | ||
64 | */ | ||
65 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
66 | { | ||
67 | BUG_ON(!wiphy); | ||
68 | return &wiphy->priv; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * set_wiphy_dev - set device pointer for wiphy | ||
73 | */ | ||
74 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
75 | { | ||
76 | wiphy->dev.parent = dev; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * wiphy_dev - get wiphy dev pointer | ||
81 | */ | ||
82 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
83 | { | ||
84 | return wiphy->dev.parent; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * wiphy_name - get wiphy name | ||
89 | */ | ||
90 | static inline char *wiphy_name(struct wiphy *wiphy) | ||
91 | { | ||
92 | return wiphy->dev.bus_id; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * wdev_priv - return wiphy priv from wireless_dev | ||
97 | */ | ||
98 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
99 | { | ||
100 | BUG_ON(!wdev); | ||
101 | return wiphy_priv(wdev->wiphy); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
106 | * | ||
107 | * create a new wiphy and associate the given operations with it. | ||
108 | * @sizeof_priv bytes are allocated for private use. | ||
109 | * | ||
110 | * the returned pointer must be assigned to each netdev's | ||
111 | * ieee80211_ptr for proper operation. | ||
112 | */ | ||
113 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | ||
114 | |||
115 | /** | ||
116 | * wiphy_register - register a wiphy with cfg80211 | ||
117 | * | ||
118 | * register the given wiphy | ||
119 | * | ||
120 | * Returns a non-negative wiphy index or a negative error code. | ||
121 | */ | ||
122 | extern int wiphy_register(struct wiphy *wiphy); | ||
123 | |||
124 | /** | ||
125 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
126 | * | ||
127 | * unregister a device with the given priv pointer. | ||
128 | * After this call, no more requests can be made with this priv | ||
129 | * pointer, but the call may sleep to wait for an outstanding | ||
130 | * request that is being handled. | ||
131 | */ | ||
132 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
133 | |||
134 | /** | ||
135 | * wiphy_free - free wiphy | ||
136 | */ | ||
137 | extern void wiphy_free(struct wiphy *wiphy); | ||
138 | |||
139 | #endif /* __NET_WIRELESS_H */ | ||
diff --git a/include/net/x25device.h b/include/net/x25device.h index 1d10c879f7e2..1415bcf93980 100644 --- a/include/net/x25device.h +++ b/include/net/x25device.h | |||
@@ -7,8 +7,8 @@ | |||
7 | 7 | ||
8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) | 8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) |
9 | { | 9 | { |
10 | skb->mac.raw = skb->data; | ||
11 | skb->dev = dev; | 10 | skb->dev = dev; |
11 | skb_reset_mac_header(skb); | ||
12 | skb->pkt_type = PACKET_HOST; | 12 | skb->pkt_type = PACKET_HOST; |
13 | 13 | ||
14 | return htons(ETH_P_X25); | 14 | return htons(ETH_P_X25); |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 5a00aa85b756..8287081d77f2 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -279,7 +279,7 @@ struct xfrm_type | |||
279 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | 279 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); |
280 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | 280 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); |
281 | /* Estimate maximal size of result of transformation of a dgram */ | 281 | /* Estimate maximal size of result of transformation of a dgram */ |
282 | u32 (*get_max_size)(struct xfrm_state *, int size); | 282 | u32 (*get_mtu)(struct xfrm_state *, int size); |
283 | }; | 283 | }; |
284 | 284 | ||
285 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); | 285 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); |
@@ -416,6 +416,13 @@ struct xfrm_audit | |||
416 | u32 secid; | 416 | u32 secid; |
417 | }; | 417 | }; |
418 | 418 | ||
419 | /* SAD metadata, add more later */ | ||
420 | struct xfrm_sadinfo | ||
421 | { | ||
422 | u32 sadhcnt; /* current hash bkts */ | ||
423 | u32 sadhmcnt; /* max allowed hash bkts */ | ||
424 | u32 sadcnt; /* current running count */ | ||
425 | }; | ||
419 | #ifdef CONFIG_AUDITSYSCALL | 426 | #ifdef CONFIG_AUDITSYSCALL |
420 | extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, | 427 | extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, |
421 | struct xfrm_policy *xp, struct xfrm_state *x); | 428 | struct xfrm_policy *xp, struct xfrm_state *x); |
@@ -938,6 +945,7 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s | |||
938 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 945 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
939 | extern int xfrm_state_delete(struct xfrm_state *x); | 946 | extern int xfrm_state_delete(struct xfrm_state *x); |
940 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 947 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); |
948 | extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si); | ||
941 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 949 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
942 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 950 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
943 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 951 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |