diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:40:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:40:14 -0400 |
commit | 038a5008b2f395c85e6e71d6ddf3c684e7c405b0 (patch) | |
tree | 4735eab577e97e5a22c3141e3f60071c8065585e /include | |
parent | dd6d1844af33acb4edd0a40b1770d091a22c94be (diff) | |
parent | 266918303226cceac7eca38ced30f15f277bd89c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (867 commits)
[SKY2]: status polling loop (post merge)
[NET]: Fix NAPI completion handling in some drivers.
[TCP]: Limit processing lost_retrans loop to work-to-do cases
[TCP]: Fix lost_retrans loop vs fastpath problems
[TCP]: No need to re-count fackets_out/sacked_out at RTO
[TCP]: Extract tcp_match_queue_to_sack from sacktag code
[TCP]: Kill almost unused variable pcount from sacktag
[TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L
[TCP]: Add bytes_acked (ABC) clearing to FRTO too
[IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2
[NETFILTER]: x_tables: add missing ip6t_modulename aliases
[NETFILTER]: nf_conntrack_tcp: fix connection reopening
[QETH]: fix qeth_main.c
[NETLINK]: fib_frontend build fixes
[IPv6]: Export userland ND options through netlink (RDNSS support)
[9P]: build fix with !CONFIG_SYSCTL
[NET]: Fix dev_put() and dev_hold() comments
[NET]: make netlink user -> kernel interface synchronious
[NET]: unify netlink kernel socket recognition
[NET]: cleanup 3rd argument in netlink_sendskb
...
Fix up conflicts manually in Documentation/feature-removal-schedule.txt
and my new least favourite crap, the "mod_devicetable" support in the
files include/linux/mod_devicetable.h and scripts/mod/file2alias.c.
(The latter files seem to be explicitly _designed_ to get conflicts when
different subsystems work with them - that have an absolutely horrid
lack of subsystem separation!)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
116 files changed, 4919 insertions, 1183 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index b2b1e6efd812..b9b05d399d2b 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -91,9 +91,11 @@ struct blkcipher_walk { | |||
91 | u8 *iv; | 91 | u8 *iv; |
92 | 92 | ||
93 | int flags; | 93 | int flags; |
94 | unsigned int blocksize; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | extern const struct crypto_type crypto_ablkcipher_type; | 97 | extern const struct crypto_type crypto_ablkcipher_type; |
98 | extern const struct crypto_type crypto_aead_type; | ||
97 | extern const struct crypto_type crypto_blkcipher_type; | 99 | extern const struct crypto_type crypto_blkcipher_type; |
98 | extern const struct crypto_type crypto_hash_type; | 100 | extern const struct crypto_type crypto_hash_type; |
99 | 101 | ||
@@ -111,7 +113,8 @@ struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, | |||
111 | 113 | ||
112 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); | 114 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); |
113 | int crypto_check_attr_type(struct rtattr **tb, u32 type); | 115 | int crypto_check_attr_type(struct rtattr **tb, u32 type); |
114 | struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask); | 116 | struct crypto_alg *crypto_attr_alg(struct rtattr *rta, u32 type, u32 mask); |
117 | int crypto_attr_u32(struct rtattr *rta, u32 *num); | ||
115 | struct crypto_instance *crypto_alloc_instance(const char *name, | 118 | struct crypto_instance *crypto_alloc_instance(const char *name, |
116 | struct crypto_alg *alg); | 119 | struct crypto_alg *alg); |
117 | 120 | ||
@@ -127,6 +130,9 @@ int blkcipher_walk_virt(struct blkcipher_desc *desc, | |||
127 | struct blkcipher_walk *walk); | 130 | struct blkcipher_walk *walk); |
128 | int blkcipher_walk_phys(struct blkcipher_desc *desc, | 131 | int blkcipher_walk_phys(struct blkcipher_desc *desc, |
129 | struct blkcipher_walk *walk); | 132 | struct blkcipher_walk *walk); |
133 | int blkcipher_walk_virt_block(struct blkcipher_desc *desc, | ||
134 | struct blkcipher_walk *walk, | ||
135 | unsigned int blocksize); | ||
130 | 136 | ||
131 | static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) | 137 | static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) |
132 | { | 138 | { |
@@ -160,6 +166,36 @@ static inline void *crypto_ablkcipher_ctx(struct crypto_ablkcipher *tfm) | |||
160 | return crypto_tfm_ctx(&tfm->base); | 166 | return crypto_tfm_ctx(&tfm->base); |
161 | } | 167 | } |
162 | 168 | ||
169 | static inline void *crypto_ablkcipher_ctx_aligned(struct crypto_ablkcipher *tfm) | ||
170 | { | ||
171 | return crypto_tfm_ctx_aligned(&tfm->base); | ||
172 | } | ||
173 | |||
174 | static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm) | ||
175 | { | ||
176 | return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead; | ||
177 | } | ||
178 | |||
179 | static inline void *crypto_aead_ctx(struct crypto_aead *tfm) | ||
180 | { | ||
181 | return crypto_tfm_ctx(&tfm->base); | ||
182 | } | ||
183 | |||
184 | static inline struct crypto_instance *crypto_aead_alg_instance( | ||
185 | struct crypto_aead *aead) | ||
186 | { | ||
187 | return crypto_tfm_alg_instance(&aead->base); | ||
188 | } | ||
189 | |||
190 | static inline struct crypto_ablkcipher *crypto_spawn_ablkcipher( | ||
191 | struct crypto_spawn *spawn) | ||
192 | { | ||
193 | u32 type = CRYPTO_ALG_TYPE_BLKCIPHER; | ||
194 | u32 mask = CRYPTO_ALG_TYPE_MASK; | ||
195 | |||
196 | return __crypto_ablkcipher_cast(crypto_spawn_tfm(spawn, type, mask)); | ||
197 | } | ||
198 | |||
163 | static inline struct crypto_blkcipher *crypto_spawn_blkcipher( | 199 | static inline struct crypto_blkcipher *crypto_spawn_blkcipher( |
164 | struct crypto_spawn *spawn) | 200 | struct crypto_spawn *spawn) |
165 | { | 201 | { |
@@ -223,16 +259,16 @@ static inline struct crypto_async_request *crypto_get_backlog( | |||
223 | container_of(queue->backlog, struct crypto_async_request, list); | 259 | container_of(queue->backlog, struct crypto_async_request, list); |
224 | } | 260 | } |
225 | 261 | ||
226 | static inline int ablkcipher_enqueue_request(struct ablkcipher_alg *alg, | 262 | static inline int ablkcipher_enqueue_request(struct crypto_queue *queue, |
227 | struct ablkcipher_request *request) | 263 | struct ablkcipher_request *request) |
228 | { | 264 | { |
229 | return crypto_enqueue_request(alg->queue, &request->base); | 265 | return crypto_enqueue_request(queue, &request->base); |
230 | } | 266 | } |
231 | 267 | ||
232 | static inline struct ablkcipher_request *ablkcipher_dequeue_request( | 268 | static inline struct ablkcipher_request *ablkcipher_dequeue_request( |
233 | struct ablkcipher_alg *alg) | 269 | struct crypto_queue *queue) |
234 | { | 270 | { |
235 | return ablkcipher_request_cast(crypto_dequeue_request(alg->queue)); | 271 | return ablkcipher_request_cast(crypto_dequeue_request(queue)); |
236 | } | 272 | } |
237 | 273 | ||
238 | static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) | 274 | static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) |
@@ -240,10 +276,31 @@ static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) | |||
240 | return req->__ctx; | 276 | return req->__ctx; |
241 | } | 277 | } |
242 | 278 | ||
243 | static inline int ablkcipher_tfm_in_queue(struct crypto_ablkcipher *tfm) | 279 | static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue, |
280 | struct crypto_ablkcipher *tfm) | ||
281 | { | ||
282 | return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); | ||
283 | } | ||
284 | |||
285 | static inline void *aead_request_ctx(struct aead_request *req) | ||
286 | { | ||
287 | return req->__ctx; | ||
288 | } | ||
289 | |||
290 | static inline void aead_request_complete(struct aead_request *req, int err) | ||
291 | { | ||
292 | req->base.complete(&req->base, err); | ||
293 | } | ||
294 | |||
295 | static inline u32 aead_request_flags(struct aead_request *req) | ||
296 | { | ||
297 | return req->base.flags; | ||
298 | } | ||
299 | |||
300 | static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, | ||
301 | u32 type, u32 mask) | ||
244 | { | 302 | { |
245 | return crypto_tfm_in_queue(crypto_ablkcipher_alg(tfm)->queue, | 303 | return crypto_attr_alg(tb[1], type, mask); |
246 | crypto_ablkcipher_tfm(tfm)); | ||
247 | } | 304 | } |
248 | 305 | ||
249 | #endif /* _CRYPTO_ALGAPI_H */ | 306 | #endif /* _CRYPTO_ALGAPI_H */ |
diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h index 4fd315202442..4086b8ebfafe 100644 --- a/include/crypto/gf128mul.h +++ b/include/crypto/gf128mul.h | |||
@@ -161,6 +161,8 @@ void gf128mul_lle(be128 *a, const be128 *b); | |||
161 | 161 | ||
162 | void gf128mul_bbe(be128 *a, const be128 *b); | 162 | void gf128mul_bbe(be128 *a, const be128 *b); |
163 | 163 | ||
164 | /* multiply by x in ble format, needed by XTS */ | ||
165 | void gf128mul_x_ble(be128 *a, const be128 *b); | ||
164 | 166 | ||
165 | /* 4k table optimization */ | 167 | /* 4k table optimization */ |
166 | 168 | ||
diff --git a/include/crypto/sha.h b/include/crypto/sha.h new file mode 100644 index 000000000000..0686e1f7a24b --- /dev/null +++ b/include/crypto/sha.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Common values for SHA algorithms | ||
3 | */ | ||
4 | |||
5 | #ifndef _CRYPTO_SHA_H | ||
6 | #define _CRYPTO_SHA_H | ||
7 | |||
8 | #define SHA1_DIGEST_SIZE 20 | ||
9 | #define SHA1_BLOCK_SIZE 64 | ||
10 | |||
11 | #define SHA256_DIGEST_SIZE 32 | ||
12 | #define SHA256_BLOCK_SIZE 64 | ||
13 | |||
14 | #define SHA384_DIGEST_SIZE 48 | ||
15 | #define SHA384_BLOCK_SIZE 128 | ||
16 | |||
17 | #define SHA512_DIGEST_SIZE 64 | ||
18 | #define SHA512_BLOCK_SIZE 128 | ||
19 | |||
20 | #define SHA1_H0 0x67452301UL | ||
21 | #define SHA1_H1 0xefcdab89UL | ||
22 | #define SHA1_H2 0x98badcfeUL | ||
23 | #define SHA1_H3 0x10325476UL | ||
24 | #define SHA1_H4 0xc3d2e1f0UL | ||
25 | |||
26 | #define SHA256_H0 0x6a09e667UL | ||
27 | #define SHA256_H1 0xbb67ae85UL | ||
28 | #define SHA256_H2 0x3c6ef372UL | ||
29 | #define SHA256_H3 0xa54ff53aUL | ||
30 | #define SHA256_H4 0x510e527fUL | ||
31 | #define SHA256_H5 0x9b05688cUL | ||
32 | #define SHA256_H6 0x1f83d9abUL | ||
33 | #define SHA256_H7 0x5be0cd19UL | ||
34 | |||
35 | #define SHA384_H0 0xcbbb9d5dc1059ed8ULL | ||
36 | #define SHA384_H1 0x629a292a367cd507ULL | ||
37 | #define SHA384_H2 0x9159015a3070dd17ULL | ||
38 | #define SHA384_H3 0x152fecd8f70e5939ULL | ||
39 | #define SHA384_H4 0x67332667ffc00b31ULL | ||
40 | #define SHA384_H5 0x8eb44a8768581511ULL | ||
41 | #define SHA384_H6 0xdb0c2e0d64f98fa7ULL | ||
42 | #define SHA384_H7 0x47b5481dbefa4fa4ULL | ||
43 | |||
44 | #define SHA512_H0 0x6a09e667f3bcc908ULL | ||
45 | #define SHA512_H1 0xbb67ae8584caa73bULL | ||
46 | #define SHA512_H2 0x3c6ef372fe94f82bULL | ||
47 | #define SHA512_H3 0xa54ff53a5f1d36f1ULL | ||
48 | #define SHA512_H4 0x510e527fade682d1ULL | ||
49 | #define SHA512_H5 0x9b05688c2b3e6c1fULL | ||
50 | #define SHA512_H6 0x1f83d9abfb41bd6bULL | ||
51 | #define SHA512_H7 0x5be0cd19137e2179ULL | ||
52 | |||
53 | #endif | ||
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index 2f85049cfb3d..fde675872c56 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h | |||
@@ -214,7 +214,7 @@ extern struct ArcProto *arc_proto_map[256], *arc_proto_default, | |||
214 | */ | 214 | */ |
215 | struct Incoming { | 215 | struct Incoming { |
216 | struct sk_buff *skb; /* packet data buffer */ | 216 | struct sk_buff *skb; /* packet data buffer */ |
217 | uint16_t sequence; /* sequence number of assembly */ | 217 | __be16 sequence; /* sequence number of assembly */ |
218 | uint8_t lastpacket, /* number of last packet (from 1) */ | 218 | uint8_t lastpacket, /* number of last packet (from 1) */ |
219 | numpackets; /* number of packets in split */ | 219 | numpackets; /* number of packets in split */ |
220 | }; | 220 | }; |
@@ -292,7 +292,7 @@ struct arcnet_local { | |||
292 | 292 | ||
293 | struct { | 293 | struct { |
294 | uint16_t sequence; /* sequence number (incs with each packet) */ | 294 | uint16_t sequence; /* sequence number (incs with each packet) */ |
295 | uint16_t aborted_seq; | 295 | __be16 aborted_seq; |
296 | 296 | ||
297 | struct Incoming incoming[256]; /* one from each address */ | 297 | struct Incoming incoming[256]; /* one from each address */ |
298 | } rfc1201; | 298 | } rfc1201; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index d6579df8dadf..9ae740936a65 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -108,10 +108,11 @@ | |||
108 | #define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ | 108 | #define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ |
109 | #define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ | 109 | #define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ |
110 | #define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ | 110 | #define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ |
111 | #define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */ | 111 | #define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */ |
112 | #define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */ | 112 | #define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */ |
113 | #define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */ | 113 | #define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ |
114 | #define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */ | 114 | #define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ |
115 | #define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ | ||
115 | 116 | ||
116 | #define AUDIT_FIRST_KERN_ANOM_MSG 1700 | 117 | #define AUDIT_FIRST_KERN_ANOM_MSG 1700 |
117 | #define AUDIT_LAST_KERN_ANOM_MSG 1799 | 118 | #define AUDIT_LAST_KERN_ANOM_MSG 1799 |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 10eb56b2940a..b62f823e90cf 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -153,7 +153,7 @@ struct cn_dev { | |||
153 | 153 | ||
154 | u32 seq, groups; | 154 | u32 seq, groups; |
155 | struct sock *nls; | 155 | struct sock *nls; |
156 | void (*input) (struct sock * sk, int len); | 156 | void (*input) (struct sk_buff *skb); |
157 | 157 | ||
158 | struct cn_queue_dev *cbdev; | 158 | struct cn_queue_dev *cbdev; |
159 | }; | 159 | }; |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 357e8cfedc37..fc32694287e2 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #define CRYPTO_ALG_TYPE_HASH 0x00000003 | 34 | #define CRYPTO_ALG_TYPE_HASH 0x00000003 |
35 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 | 35 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 |
36 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 | 36 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 |
37 | #define CRYPTO_ALG_TYPE_AEAD 0x00000006 | ||
37 | 38 | ||
38 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | 39 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
39 | 40 | ||
@@ -91,9 +92,9 @@ | |||
91 | struct scatterlist; | 92 | struct scatterlist; |
92 | struct crypto_ablkcipher; | 93 | struct crypto_ablkcipher; |
93 | struct crypto_async_request; | 94 | struct crypto_async_request; |
95 | struct crypto_aead; | ||
94 | struct crypto_blkcipher; | 96 | struct crypto_blkcipher; |
95 | struct crypto_hash; | 97 | struct crypto_hash; |
96 | struct crypto_queue; | ||
97 | struct crypto_tfm; | 98 | struct crypto_tfm; |
98 | struct crypto_type; | 99 | struct crypto_type; |
99 | 100 | ||
@@ -121,6 +122,32 @@ struct ablkcipher_request { | |||
121 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | 122 | void *__ctx[] CRYPTO_MINALIGN_ATTR; |
122 | }; | 123 | }; |
123 | 124 | ||
125 | /** | ||
126 | * struct aead_request - AEAD request | ||
127 | * @base: Common attributes for async crypto requests | ||
128 | * @assoclen: Length in bytes of associated data for authentication | ||
129 | * @cryptlen: Length of data to be encrypted or decrypted | ||
130 | * @iv: Initialisation vector | ||
131 | * @assoc: Associated data | ||
132 | * @src: Source data | ||
133 | * @dst: Destination data | ||
134 | * @__ctx: Start of private context data | ||
135 | */ | ||
136 | struct aead_request { | ||
137 | struct crypto_async_request base; | ||
138 | |||
139 | unsigned int assoclen; | ||
140 | unsigned int cryptlen; | ||
141 | |||
142 | u8 *iv; | ||
143 | |||
144 | struct scatterlist *assoc; | ||
145 | struct scatterlist *src; | ||
146 | struct scatterlist *dst; | ||
147 | |||
148 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
149 | }; | ||
150 | |||
124 | struct blkcipher_desc { | 151 | struct blkcipher_desc { |
125 | struct crypto_blkcipher *tfm; | 152 | struct crypto_blkcipher *tfm; |
126 | void *info; | 153 | void *info; |
@@ -150,13 +177,21 @@ struct ablkcipher_alg { | |||
150 | int (*encrypt)(struct ablkcipher_request *req); | 177 | int (*encrypt)(struct ablkcipher_request *req); |
151 | int (*decrypt)(struct ablkcipher_request *req); | 178 | int (*decrypt)(struct ablkcipher_request *req); |
152 | 179 | ||
153 | struct crypto_queue *queue; | ||
154 | |||
155 | unsigned int min_keysize; | 180 | unsigned int min_keysize; |
156 | unsigned int max_keysize; | 181 | unsigned int max_keysize; |
157 | unsigned int ivsize; | 182 | unsigned int ivsize; |
158 | }; | 183 | }; |
159 | 184 | ||
185 | struct aead_alg { | ||
186 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, | ||
187 | unsigned int keylen); | ||
188 | int (*encrypt)(struct aead_request *req); | ||
189 | int (*decrypt)(struct aead_request *req); | ||
190 | |||
191 | unsigned int ivsize; | ||
192 | unsigned int authsize; | ||
193 | }; | ||
194 | |||
160 | struct blkcipher_alg { | 195 | struct blkcipher_alg { |
161 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | 196 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, |
162 | unsigned int keylen); | 197 | unsigned int keylen); |
@@ -212,6 +247,7 @@ struct compress_alg { | |||
212 | }; | 247 | }; |
213 | 248 | ||
214 | #define cra_ablkcipher cra_u.ablkcipher | 249 | #define cra_ablkcipher cra_u.ablkcipher |
250 | #define cra_aead cra_u.aead | ||
215 | #define cra_blkcipher cra_u.blkcipher | 251 | #define cra_blkcipher cra_u.blkcipher |
216 | #define cra_cipher cra_u.cipher | 252 | #define cra_cipher cra_u.cipher |
217 | #define cra_digest cra_u.digest | 253 | #define cra_digest cra_u.digest |
@@ -237,6 +273,7 @@ struct crypto_alg { | |||
237 | 273 | ||
238 | union { | 274 | union { |
239 | struct ablkcipher_alg ablkcipher; | 275 | struct ablkcipher_alg ablkcipher; |
276 | struct aead_alg aead; | ||
240 | struct blkcipher_alg blkcipher; | 277 | struct blkcipher_alg blkcipher; |
241 | struct cipher_alg cipher; | 278 | struct cipher_alg cipher; |
242 | struct digest_alg digest; | 279 | struct digest_alg digest; |
@@ -284,6 +321,16 @@ struct ablkcipher_tfm { | |||
284 | unsigned int reqsize; | 321 | unsigned int reqsize; |
285 | }; | 322 | }; |
286 | 323 | ||
324 | struct aead_tfm { | ||
325 | int (*setkey)(struct crypto_aead *tfm, const u8 *key, | ||
326 | unsigned int keylen); | ||
327 | int (*encrypt)(struct aead_request *req); | ||
328 | int (*decrypt)(struct aead_request *req); | ||
329 | unsigned int ivsize; | ||
330 | unsigned int authsize; | ||
331 | unsigned int reqsize; | ||
332 | }; | ||
333 | |||
287 | struct blkcipher_tfm { | 334 | struct blkcipher_tfm { |
288 | void *iv; | 335 | void *iv; |
289 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | 336 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, |
@@ -323,6 +370,7 @@ struct compress_tfm { | |||
323 | }; | 370 | }; |
324 | 371 | ||
325 | #define crt_ablkcipher crt_u.ablkcipher | 372 | #define crt_ablkcipher crt_u.ablkcipher |
373 | #define crt_aead crt_u.aead | ||
326 | #define crt_blkcipher crt_u.blkcipher | 374 | #define crt_blkcipher crt_u.blkcipher |
327 | #define crt_cipher crt_u.cipher | 375 | #define crt_cipher crt_u.cipher |
328 | #define crt_hash crt_u.hash | 376 | #define crt_hash crt_u.hash |
@@ -334,6 +382,7 @@ struct crypto_tfm { | |||
334 | 382 | ||
335 | union { | 383 | union { |
336 | struct ablkcipher_tfm ablkcipher; | 384 | struct ablkcipher_tfm ablkcipher; |
385 | struct aead_tfm aead; | ||
337 | struct blkcipher_tfm blkcipher; | 386 | struct blkcipher_tfm blkcipher; |
338 | struct cipher_tfm cipher; | 387 | struct cipher_tfm cipher; |
339 | struct hash_tfm hash; | 388 | struct hash_tfm hash; |
@@ -349,6 +398,10 @@ struct crypto_ablkcipher { | |||
349 | struct crypto_tfm base; | 398 | struct crypto_tfm base; |
350 | }; | 399 | }; |
351 | 400 | ||
401 | struct crypto_aead { | ||
402 | struct crypto_tfm base; | ||
403 | }; | ||
404 | |||
352 | struct crypto_blkcipher { | 405 | struct crypto_blkcipher { |
353 | struct crypto_tfm base; | 406 | struct crypto_tfm base; |
354 | }; | 407 | }; |
@@ -369,11 +422,15 @@ enum { | |||
369 | CRYPTOA_UNSPEC, | 422 | CRYPTOA_UNSPEC, |
370 | CRYPTOA_ALG, | 423 | CRYPTOA_ALG, |
371 | CRYPTOA_TYPE, | 424 | CRYPTOA_TYPE, |
425 | CRYPTOA_U32, | ||
372 | __CRYPTOA_MAX, | 426 | __CRYPTOA_MAX, |
373 | }; | 427 | }; |
374 | 428 | ||
375 | #define CRYPTOA_MAX (__CRYPTOA_MAX - 1) | 429 | #define CRYPTOA_MAX (__CRYPTOA_MAX - 1) |
376 | 430 | ||
431 | /* Maximum number of (rtattr) parameters for each template. */ | ||
432 | #define CRYPTO_MAX_ATTRS 32 | ||
433 | |||
377 | struct crypto_attr_alg { | 434 | struct crypto_attr_alg { |
378 | char name[CRYPTO_MAX_ALG_NAME]; | 435 | char name[CRYPTO_MAX_ALG_NAME]; |
379 | }; | 436 | }; |
@@ -383,6 +440,10 @@ struct crypto_attr_type { | |||
383 | u32 mask; | 440 | u32 mask; |
384 | }; | 441 | }; |
385 | 442 | ||
443 | struct crypto_attr_u32 { | ||
444 | u32 num; | ||
445 | }; | ||
446 | |||
386 | /* | 447 | /* |
387 | * Transform user interface. | 448 | * Transform user interface. |
388 | */ | 449 | */ |
@@ -563,7 +624,8 @@ static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req) | |||
563 | return crt->decrypt(req); | 624 | return crt->decrypt(req); |
564 | } | 625 | } |
565 | 626 | ||
566 | static inline int crypto_ablkcipher_reqsize(struct crypto_ablkcipher *tfm) | 627 | static inline unsigned int crypto_ablkcipher_reqsize( |
628 | struct crypto_ablkcipher *tfm) | ||
567 | { | 629 | { |
568 | return crypto_ablkcipher_crt(tfm)->reqsize; | 630 | return crypto_ablkcipher_crt(tfm)->reqsize; |
569 | } | 631 | } |
@@ -619,6 +681,150 @@ static inline void ablkcipher_request_set_crypt( | |||
619 | req->info = iv; | 681 | req->info = iv; |
620 | } | 682 | } |
621 | 683 | ||
684 | static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm) | ||
685 | { | ||
686 | return (struct crypto_aead *)tfm; | ||
687 | } | ||
688 | |||
689 | static inline struct crypto_aead *crypto_alloc_aead(const char *alg_name, | ||
690 | u32 type, u32 mask) | ||
691 | { | ||
692 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
693 | type |= CRYPTO_ALG_TYPE_AEAD; | ||
694 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
695 | |||
696 | return __crypto_aead_cast(crypto_alloc_base(alg_name, type, mask)); | ||
697 | } | ||
698 | |||
699 | static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm) | ||
700 | { | ||
701 | return &tfm->base; | ||
702 | } | ||
703 | |||
704 | static inline void crypto_free_aead(struct crypto_aead *tfm) | ||
705 | { | ||
706 | crypto_free_tfm(crypto_aead_tfm(tfm)); | ||
707 | } | ||
708 | |||
709 | static inline struct aead_tfm *crypto_aead_crt(struct crypto_aead *tfm) | ||
710 | { | ||
711 | return &crypto_aead_tfm(tfm)->crt_aead; | ||
712 | } | ||
713 | |||
714 | static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm) | ||
715 | { | ||
716 | return crypto_aead_crt(tfm)->ivsize; | ||
717 | } | ||
718 | |||
719 | static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm) | ||
720 | { | ||
721 | return crypto_aead_crt(tfm)->authsize; | ||
722 | } | ||
723 | |||
724 | static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm) | ||
725 | { | ||
726 | return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm)); | ||
727 | } | ||
728 | |||
729 | static inline unsigned int crypto_aead_alignmask(struct crypto_aead *tfm) | ||
730 | { | ||
731 | return crypto_tfm_alg_alignmask(crypto_aead_tfm(tfm)); | ||
732 | } | ||
733 | |||
734 | static inline u32 crypto_aead_get_flags(struct crypto_aead *tfm) | ||
735 | { | ||
736 | return crypto_tfm_get_flags(crypto_aead_tfm(tfm)); | ||
737 | } | ||
738 | |||
739 | static inline void crypto_aead_set_flags(struct crypto_aead *tfm, u32 flags) | ||
740 | { | ||
741 | crypto_tfm_set_flags(crypto_aead_tfm(tfm), flags); | ||
742 | } | ||
743 | |||
744 | static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags) | ||
745 | { | ||
746 | crypto_tfm_clear_flags(crypto_aead_tfm(tfm), flags); | ||
747 | } | ||
748 | |||
749 | static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key, | ||
750 | unsigned int keylen) | ||
751 | { | ||
752 | return crypto_aead_crt(tfm)->setkey(tfm, key, keylen); | ||
753 | } | ||
754 | |||
755 | static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req) | ||
756 | { | ||
757 | return __crypto_aead_cast(req->base.tfm); | ||
758 | } | ||
759 | |||
760 | static inline int crypto_aead_encrypt(struct aead_request *req) | ||
761 | { | ||
762 | return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req); | ||
763 | } | ||
764 | |||
765 | static inline int crypto_aead_decrypt(struct aead_request *req) | ||
766 | { | ||
767 | return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req); | ||
768 | } | ||
769 | |||
770 | static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm) | ||
771 | { | ||
772 | return crypto_aead_crt(tfm)->reqsize; | ||
773 | } | ||
774 | |||
775 | static inline void aead_request_set_tfm(struct aead_request *req, | ||
776 | struct crypto_aead *tfm) | ||
777 | { | ||
778 | req->base.tfm = crypto_aead_tfm(tfm); | ||
779 | } | ||
780 | |||
781 | static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, | ||
782 | gfp_t gfp) | ||
783 | { | ||
784 | struct aead_request *req; | ||
785 | |||
786 | req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp); | ||
787 | |||
788 | if (likely(req)) | ||
789 | aead_request_set_tfm(req, tfm); | ||
790 | |||
791 | return req; | ||
792 | } | ||
793 | |||
794 | static inline void aead_request_free(struct aead_request *req) | ||
795 | { | ||
796 | kfree(req); | ||
797 | } | ||
798 | |||
799 | static inline void aead_request_set_callback(struct aead_request *req, | ||
800 | u32 flags, | ||
801 | crypto_completion_t complete, | ||
802 | void *data) | ||
803 | { | ||
804 | req->base.complete = complete; | ||
805 | req->base.data = data; | ||
806 | req->base.flags = flags; | ||
807 | } | ||
808 | |||
809 | static inline void aead_request_set_crypt(struct aead_request *req, | ||
810 | struct scatterlist *src, | ||
811 | struct scatterlist *dst, | ||
812 | unsigned int cryptlen, u8 *iv) | ||
813 | { | ||
814 | req->src = src; | ||
815 | req->dst = dst; | ||
816 | req->cryptlen = cryptlen; | ||
817 | req->iv = iv; | ||
818 | } | ||
819 | |||
820 | static inline void aead_request_set_assoc(struct aead_request *req, | ||
821 | struct scatterlist *assoc, | ||
822 | unsigned int assoclen) | ||
823 | { | ||
824 | req->assoc = assoc; | ||
825 | req->assoclen = assoclen; | ||
826 | } | ||
827 | |||
622 | static inline struct crypto_blkcipher *__crypto_blkcipher_cast( | 828 | static inline struct crypto_blkcipher *__crypto_blkcipher_cast( |
623 | struct crypto_tfm *tfm) | 829 | struct crypto_tfm *tfm) |
624 | { | 830 | { |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index fda2148d8c85..f3fc4392e93d 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -56,10 +56,9 @@ struct dccp_hdr_ext { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * struct dccp_hdr_request - Conection initiation request header | 59 | * struct dccp_hdr_request - Connection initiation request header |
60 | * | 60 | * |
61 | * @dccph_req_service - Service to which the client app wants to connect | 61 | * @dccph_req_service - Service to which the client app wants to connect |
62 | * @dccph_req_options - list of options (must be a multiple of 32 bits | ||
63 | */ | 62 | */ |
64 | struct dccp_hdr_request { | 63 | struct dccp_hdr_request { |
65 | __be32 dccph_req_service; | 64 | __be32 dccph_req_service; |
@@ -76,12 +75,10 @@ struct dccp_hdr_ack_bits { | |||
76 | __be32 dccph_ack_nr_low; | 75 | __be32 dccph_ack_nr_low; |
77 | }; | 76 | }; |
78 | /** | 77 | /** |
79 | * struct dccp_hdr_response - Conection initiation response header | 78 | * struct dccp_hdr_response - Connection initiation response header |
80 | * | 79 | * |
81 | * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR | 80 | * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3) |
82 | * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR | ||
83 | * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request | 81 | * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request |
84 | * @dccph_resp_options - list of options (must be a multiple of 32 bits | ||
85 | */ | 82 | */ |
86 | struct dccp_hdr_response { | 83 | struct dccp_hdr_response { |
87 | struct dccp_hdr_ack_bits dccph_resp_ack; | 84 | struct dccp_hdr_ack_bits dccph_resp_ack; |
@@ -91,8 +88,9 @@ struct dccp_hdr_response { | |||
91 | /** | 88 | /** |
92 | * struct dccp_hdr_reset - Unconditionally shut down a connection | 89 | * struct dccp_hdr_reset - Unconditionally shut down a connection |
93 | * | 90 | * |
94 | * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request | 91 | * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6) |
95 | * @dccph_reset_options - list of options (must be a multiple of 32 bits | 92 | * @dccph_reset_code - one of %dccp_reset_codes |
93 | * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6 | ||
96 | */ | 94 | */ |
97 | struct dccp_hdr_reset { | 95 | struct dccp_hdr_reset { |
98 | struct dccp_hdr_ack_bits dccph_reset_ack; | 96 | struct dccp_hdr_ack_bits dccph_reset_ack; |
@@ -204,6 +202,7 @@ struct dccp_so_feat { | |||
204 | #define DCCP_SOCKOPT_SERVICE 2 | 202 | #define DCCP_SOCKOPT_SERVICE 2 |
205 | #define DCCP_SOCKOPT_CHANGE_L 3 | 203 | #define DCCP_SOCKOPT_CHANGE_L 3 |
206 | #define DCCP_SOCKOPT_CHANGE_R 4 | 204 | #define DCCP_SOCKOPT_CHANGE_R 4 |
205 | #define DCCP_SOCKOPT_GET_CUR_MPS 5 | ||
207 | #define DCCP_SOCKOPT_SEND_CSCOV 10 | 206 | #define DCCP_SOCKOPT_SEND_CSCOV 10 |
208 | #define DCCP_SOCKOPT_RECV_CSCOV 11 | 207 | #define DCCP_SOCKOPT_RECV_CSCOV 11 |
209 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 | 208 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 |
@@ -215,6 +214,7 @@ struct dccp_so_feat { | |||
215 | #ifdef __KERNEL__ | 214 | #ifdef __KERNEL__ |
216 | 215 | ||
217 | #include <linux/in.h> | 216 | #include <linux/in.h> |
217 | #include <linux/ktime.h> | ||
218 | #include <linux/list.h> | 218 | #include <linux/list.h> |
219 | #include <linux/uio.h> | 219 | #include <linux/uio.h> |
220 | #include <linux/workqueue.h> | 220 | #include <linux/workqueue.h> |
@@ -391,7 +391,6 @@ struct dccp_opt_pend { | |||
391 | struct dccp_opt_conf *dccpop_sc; | 391 | struct dccp_opt_conf *dccpop_sc; |
392 | }; | 392 | }; |
393 | 393 | ||
394 | extern void __dccp_minisock_init(struct dccp_minisock *dmsk); | ||
395 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); | 394 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); |
396 | 395 | ||
397 | extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); | 396 | extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); |
@@ -471,6 +470,7 @@ struct dccp_ackvec; | |||
471 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) | 470 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) |
472 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 471 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
473 | * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) | 472 | * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) |
473 | * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) | ||
474 | * @dccps_minisock - associated minisock (accessed via dccp_msk) | 474 | * @dccps_minisock - associated minisock (accessed via dccp_msk) |
475 | * @dccps_hc_rx_ackvec - rx half connection ack vector | 475 | * @dccps_hc_rx_ackvec - rx half connection ack vector |
476 | * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) | 476 | * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) |
@@ -498,7 +498,7 @@ struct dccp_sock { | |||
498 | __u64 dccps_gar; | 498 | __u64 dccps_gar; |
499 | __be32 dccps_service; | 499 | __be32 dccps_service; |
500 | struct dccp_service_list *dccps_service_list; | 500 | struct dccp_service_list *dccps_service_list; |
501 | struct timeval dccps_timestamp_time; | 501 | ktime_t dccps_timestamp_time; |
502 | __u32 dccps_timestamp_echo; | 502 | __u32 dccps_timestamp_echo; |
503 | __u16 dccps_l_ack_ratio; | 503 | __u16 dccps_l_ack_ratio; |
504 | __u16 dccps_r_ack_ratio; | 504 | __u16 dccps_r_ack_ratio; |
@@ -506,12 +506,12 @@ struct dccp_sock { | |||
506 | __u16 dccps_pcrlen; | 506 | __u16 dccps_pcrlen; |
507 | unsigned long dccps_ndp_count; | 507 | unsigned long dccps_ndp_count; |
508 | __u32 dccps_mss_cache; | 508 | __u32 dccps_mss_cache; |
509 | unsigned long dccps_rate_last; | ||
509 | struct dccp_minisock dccps_minisock; | 510 | struct dccp_minisock dccps_minisock; |
510 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 511 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
511 | struct ccid *dccps_hc_rx_ccid; | 512 | struct ccid *dccps_hc_rx_ccid; |
512 | struct ccid *dccps_hc_tx_ccid; | 513 | struct ccid *dccps_hc_tx_ccid; |
513 | struct dccp_options_received dccps_options_received; | 514 | struct dccp_options_received dccps_options_received; |
514 | struct timeval dccps_epoch; | ||
515 | enum dccp_role dccps_role:2; | 515 | enum dccp_role dccps_role:2; |
516 | __u8 dccps_hc_rx_insert_options:1; | 516 | __u8 dccps_hc_rx_insert_options:1; |
517 | __u8 dccps_hc_tx_insert_options:1; | 517 | __u8 dccps_hc_tx_insert_options:1; |
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h index d774b7778c91..a55c873e8b66 100644 --- a/include/linux/eeprom_93cx6.h +++ b/include/linux/eeprom_93cx6.h | |||
@@ -21,13 +21,14 @@ | |||
21 | /* | 21 | /* |
22 | Module: eeprom_93cx6 | 22 | Module: eeprom_93cx6 |
23 | Abstract: EEPROM reader datastructures for 93cx6 chipsets. | 23 | Abstract: EEPROM reader datastructures for 93cx6 chipsets. |
24 | Supported chipsets: 93c46 & 93c66. | 24 | Supported chipsets: 93c46, 93c56 and 93c66. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * EEPROM operation defines. | 28 | * EEPROM operation defines. |
29 | */ | 29 | */ |
30 | #define PCI_EEPROM_WIDTH_93C46 6 | 30 | #define PCI_EEPROM_WIDTH_93C46 6 |
31 | #define PCI_EEPROM_WIDTH_93C56 8 | ||
31 | #define PCI_EEPROM_WIDTH_93C66 8 | 32 | #define PCI_EEPROM_WIDTH_93C66 8 |
32 | #define PCI_EEPROM_WIDTH_OPCODE 3 | 33 | #define PCI_EEPROM_WIDTH_OPCODE 3 |
33 | #define PCI_EEPROM_WRITE_OPCODE 0x05 | 34 | #define PCI_EEPROM_WRITE_OPCODE 0x05 |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 6cdb97365e47..b7558ec81ed5 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -29,15 +29,19 @@ | |||
29 | #include <linux/random.h> | 29 | #include <linux/random.h> |
30 | 30 | ||
31 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
32 | extern int eth_header(struct sk_buff *skb, struct net_device *dev, | ||
33 | unsigned short type, void *daddr, | ||
34 | void *saddr, unsigned len); | ||
35 | extern int eth_rebuild_header(struct sk_buff *skb); | ||
36 | extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); | 32 | extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); |
37 | extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, | 33 | extern const struct header_ops eth_header_ops; |
38 | unsigned char * haddr); | 34 | |
39 | extern int eth_header_cache(struct neighbour *neigh, | 35 | extern int eth_header(struct sk_buff *skb, struct net_device *dev, |
40 | struct hh_cache *hh); | 36 | unsigned short type, |
37 | const void *daddr, const void *saddr, unsigned len); | ||
38 | extern int eth_rebuild_header(struct sk_buff *skb); | ||
39 | extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | ||
40 | extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh); | ||
41 | extern void eth_header_cache_update(struct hh_cache *hh, | ||
42 | const struct net_device *dev, | ||
43 | const unsigned char *haddr); | ||
44 | |||
41 | 45 | ||
42 | extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); | 46 | extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); |
43 | #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) | 47 | #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 23ccea811297..71d4ada6f315 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -39,7 +39,8 @@ struct ethtool_drvinfo { | |||
39 | char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ | 39 | char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ |
40 | /* For PCI devices, use pci_name(pci_dev). */ | 40 | /* For PCI devices, use pci_name(pci_dev). */ |
41 | char reserved1[32]; | 41 | char reserved1[32]; |
42 | char reserved2[16]; | 42 | char reserved2[12]; |
43 | __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ | ||
43 | __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ | 44 | __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ |
44 | __u32 testinfo_len; | 45 | __u32 testinfo_len; |
45 | __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ | 46 | __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ |
@@ -219,6 +220,7 @@ struct ethtool_pauseparam { | |||
219 | enum ethtool_stringset { | 220 | enum ethtool_stringset { |
220 | ETH_SS_TEST = 0, | 221 | ETH_SS_TEST = 0, |
221 | ETH_SS_STATS, | 222 | ETH_SS_STATS, |
223 | ETH_SS_PRIV_FLAGS, | ||
222 | }; | 224 | }; |
223 | 225 | ||
224 | /* for passing string sets for data tagging */ | 226 | /* for passing string sets for data tagging */ |
@@ -256,6 +258,19 @@ struct ethtool_perm_addr { | |||
256 | __u8 data[0]; | 258 | __u8 data[0]; |
257 | }; | 259 | }; |
258 | 260 | ||
261 | /* boolean flags controlling per-interface behavior characteristics. | ||
262 | * When reading, the flag indicates whether or not a certain behavior | ||
263 | * is enabled/present. When writing, the flag indicates whether | ||
264 | * or not the driver should turn on (set) or off (clear) a behavior. | ||
265 | * | ||
266 | * Some behaviors may read-only (unconditionally absent or present). | ||
267 | * If such is the case, return EINVAL in the set-flags operation if the | ||
268 | * flag differs from the read-only value. | ||
269 | */ | ||
270 | enum ethtool_flags { | ||
271 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | ||
272 | }; | ||
273 | |||
259 | #ifdef __KERNEL__ | 274 | #ifdef __KERNEL__ |
260 | 275 | ||
261 | struct net_device; | 276 | struct net_device; |
@@ -272,6 +287,8 @@ u32 ethtool_op_get_tso(struct net_device *dev); | |||
272 | int ethtool_op_set_tso(struct net_device *dev, u32 data); | 287 | int ethtool_op_set_tso(struct net_device *dev, u32 data); |
273 | u32 ethtool_op_get_ufo(struct net_device *dev); | 288 | u32 ethtool_op_get_ufo(struct net_device *dev); |
274 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); | 289 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); |
290 | u32 ethtool_op_get_flags(struct net_device *dev); | ||
291 | int ethtool_op_set_flags(struct net_device *dev, u32 data); | ||
275 | 292 | ||
276 | /** | 293 | /** |
277 | * ðtool_ops - Alter and report network device settings | 294 | * ðtool_ops - Alter and report network device settings |
@@ -307,6 +324,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); | |||
307 | * get_strings: Return a set of strings that describe the requested objects | 324 | * get_strings: Return a set of strings that describe the requested objects |
308 | * phys_id: Identify the device | 325 | * phys_id: Identify the device |
309 | * get_stats: Return statistics about the device | 326 | * get_stats: Return statistics about the device |
327 | * get_flags: get 32-bit flags bitmap | ||
328 | * set_flags: set 32-bit flags bitmap | ||
310 | * | 329 | * |
311 | * Description: | 330 | * Description: |
312 | * | 331 | * |
@@ -359,16 +378,23 @@ struct ethtool_ops { | |||
359 | int (*set_sg)(struct net_device *, u32); | 378 | int (*set_sg)(struct net_device *, u32); |
360 | u32 (*get_tso)(struct net_device *); | 379 | u32 (*get_tso)(struct net_device *); |
361 | int (*set_tso)(struct net_device *, u32); | 380 | int (*set_tso)(struct net_device *, u32); |
362 | int (*self_test_count)(struct net_device *); | ||
363 | void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); | 381 | void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); |
364 | void (*get_strings)(struct net_device *, u32 stringset, u8 *); | 382 | void (*get_strings)(struct net_device *, u32 stringset, u8 *); |
365 | int (*phys_id)(struct net_device *, u32); | 383 | int (*phys_id)(struct net_device *, u32); |
366 | int (*get_stats_count)(struct net_device *); | ||
367 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); | 384 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); |
368 | int (*begin)(struct net_device *); | 385 | int (*begin)(struct net_device *); |
369 | void (*complete)(struct net_device *); | 386 | void (*complete)(struct net_device *); |
370 | u32 (*get_ufo)(struct net_device *); | 387 | u32 (*get_ufo)(struct net_device *); |
371 | int (*set_ufo)(struct net_device *, u32); | 388 | int (*set_ufo)(struct net_device *, u32); |
389 | u32 (*get_flags)(struct net_device *); | ||
390 | int (*set_flags)(struct net_device *, u32); | ||
391 | u32 (*get_priv_flags)(struct net_device *); | ||
392 | int (*set_priv_flags)(struct net_device *, u32); | ||
393 | int (*get_sset_count)(struct net_device *, int); | ||
394 | |||
395 | /* the following hooks are obsolete */ | ||
396 | int (*self_test_count)(struct net_device *);/* use get_sset_count */ | ||
397 | int (*get_stats_count)(struct net_device *);/* use get_sset_count */ | ||
372 | }; | 398 | }; |
373 | #endif /* __KERNEL__ */ | 399 | #endif /* __KERNEL__ */ |
374 | 400 | ||
@@ -410,6 +436,10 @@ struct ethtool_ops { | |||
410 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ | 436 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ |
411 | #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ | 437 | #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ |
412 | #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ | 438 | #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ |
439 | #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ | ||
440 | #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ | ||
441 | #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ | ||
442 | #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ | ||
413 | 443 | ||
414 | /* compatibility with older code */ | 444 | /* compatibility with older code */ |
415 | #define SPARC_ETH_GSET ETHTOOL_GSET | 445 | #define SPARC_ETH_GSET ETHTOOL_GSET |
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 543cd3cd9e77..9bc045b8c478 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #ifndef FS_ENET_PD_H | 16 | #ifndef FS_ENET_PD_H |
17 | #define FS_ENET_PD_H | 17 | #define FS_ENET_PD_H |
18 | 18 | ||
19 | #include <linux/string.h> | ||
19 | #include <asm/types.h> | 20 | #include <asm/types.h> |
20 | 21 | ||
21 | #define FS_ENET_NAME "fs_enet" | 22 | #define FS_ENET_NAME "fs_enet" |
@@ -119,6 +120,7 @@ struct fs_platform_info { | |||
119 | 120 | ||
120 | u32 cp_page; /* CPM page */ | 121 | u32 cp_page; /* CPM page */ |
121 | u32 cp_block; /* CPM sblock */ | 122 | u32 cp_block; /* CPM sblock */ |
123 | u32 cp_command; /* CPM page/sblock/mcn */ | ||
122 | 124 | ||
123 | u32 clk_trx; /* some stuff for pins & mux configuration*/ | 125 | u32 clk_trx; /* some stuff for pins & mux configuration*/ |
124 | u32 clk_rx; | 126 | u32 clk_rx; |
@@ -133,7 +135,11 @@ struct fs_platform_info { | |||
133 | u32 device_flags; | 135 | u32 device_flags; |
134 | 136 | ||
135 | int phy_addr; /* the phy address (-1 no phy) */ | 137 | int phy_addr; /* the phy address (-1 no phy) */ |
138 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
139 | char bus_id[16]; | ||
140 | #else | ||
136 | const char* bus_id; | 141 | const char* bus_id; |
142 | #endif | ||
137 | int phy_irq; /* the phy irq (if it exists) */ | 143 | int phy_irq; /* the phy irq (if it exists) */ |
138 | 144 | ||
139 | const struct fs_mii_bus_info *bus_info; | 145 | const struct fs_mii_bus_info *bus_info; |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 272f8c8c90da..30621c27159f 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define IEEE80211_H | 16 | #define IEEE80211_H |
17 | 17 | ||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <asm/byteorder.h> | ||
19 | 20 | ||
20 | #define FCS_LEN 4 | 21 | #define FCS_LEN 4 |
21 | 22 | ||
@@ -350,4 +351,64 @@ enum ieee80211_eid { | |||
350 | 351 | ||
351 | #define WLAN_MAX_KEY_LEN 32 | 352 | #define WLAN_MAX_KEY_LEN 32 |
352 | 353 | ||
354 | /** | ||
355 | * ieee80211_get_SA - get pointer to SA | ||
356 | * | ||
357 | * Given an 802.11 frame, this function returns the offset | ||
358 | * to the source address (SA). It does not verify that the | ||
359 | * header is long enough to contain the address, and the | ||
360 | * header must be long enough to contain the frame control | ||
361 | * field. | ||
362 | * | ||
363 | * @hdr: the frame | ||
364 | */ | ||
365 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | ||
366 | { | ||
367 | u8 *raw = (u8 *) hdr; | ||
368 | u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ | ||
369 | |||
370 | switch (tofrom) { | ||
371 | case 2: | ||
372 | return hdr->addr3; | ||
373 | case 3: | ||
374 | return hdr->addr4; | ||
375 | } | ||
376 | return hdr->addr2; | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * ieee80211_get_DA - get pointer to DA | ||
381 | * | ||
382 | * Given an 802.11 frame, this function returns the offset | ||
383 | * to the destination address (DA). It does not verify that | ||
384 | * the header is long enough to contain the address, and the | ||
385 | * header must be long enough to contain the frame control | ||
386 | * field. | ||
387 | * | ||
388 | * @hdr: the frame | ||
389 | */ | ||
390 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | ||
391 | { | ||
392 | u8 *raw = (u8 *) hdr; | ||
393 | u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */ | ||
394 | |||
395 | if (to_ds) | ||
396 | return hdr->addr3; | ||
397 | return hdr->addr1; | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set | ||
402 | * | ||
403 | * This function determines whether the "more fragments" bit is set | ||
404 | * in the frame. | ||
405 | * | ||
406 | * @hdr: the frame | ||
407 | */ | ||
408 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | ||
409 | { | ||
410 | return (le16_to_cpu(hdr->frame_control) & | ||
411 | IEEE80211_FCTL_MOREFRAGS) != 0; | ||
412 | } | ||
413 | |||
353 | #endif /* IEEE80211_H */ | 414 | #endif /* IEEE80211_H */ |
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h index af380cb876a0..27ea2ac445ad 100644 --- a/include/linux/if_arcnet.h +++ b/include/linux/if_arcnet.h | |||
@@ -59,7 +59,7 @@ struct arc_rfc1201 | |||
59 | { | 59 | { |
60 | uint8_t proto; /* protocol ID field - varies */ | 60 | uint8_t proto; /* protocol ID field - varies */ |
61 | uint8_t split_flag; /* for use with split packets */ | 61 | uint8_t split_flag; /* for use with split packets */ |
62 | uint16_t sequence; /* sequence number */ | 62 | __be16 sequence; /* sequence number */ |
63 | uint8_t payload[0]; /* space remaining in packet (504 bytes)*/ | 63 | uint8_t payload[0]; /* space remaining in packet (504 bytes)*/ |
64 | }; | 64 | }; |
65 | #define RFC1201_HDR_SIZE 4 | 65 | #define RFC1201_HDR_SIZE 4 |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 4ff211d98769..99e3a1a00099 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
@@ -104,7 +104,7 @@ struct __fdb_entry | |||
104 | 104 | ||
105 | #include <linux/netdevice.h> | 105 | #include <linux/netdevice.h> |
106 | 106 | ||
107 | extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); | 107 | extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); |
108 | extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, | 108 | extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, |
109 | struct sk_buff *skb); | 109 | struct sk_buff *skb); |
110 | extern int (*br_should_route_hook)(struct sk_buff **pskb); | 110 | extern int (*br_should_route_hook)(struct sk_buff **pskb); |
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h index b68752fdc5c4..79c4f268410d 100644 --- a/include/linux/if_eql.h +++ b/include/linux/if_eql.h | |||
@@ -58,7 +58,6 @@ typedef struct equalizer { | |||
58 | slave_queue_t queue; | 58 | slave_queue_t queue; |
59 | int min_slaves; | 59 | int min_slaves; |
60 | int max_slaves; | 60 | int max_slaves; |
61 | struct net_device_stats stats; | ||
62 | struct timer_list timer; | 61 | struct timer_list timer; |
63 | } equalizer_t; | 62 | } equalizer_t; |
64 | 63 | ||
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 3213f6f4aa58..5f9297793661 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -117,9 +117,19 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | |||
117 | return (struct ethhdr *)skb_mac_header(skb); | 117 | return (struct ethhdr *)skb_mac_header(skb); |
118 | } | 118 | } |
119 | 119 | ||
120 | int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | ||
121 | |||
120 | #ifdef CONFIG_SYSCTL | 122 | #ifdef CONFIG_SYSCTL |
121 | extern struct ctl_table ether_table[]; | 123 | extern struct ctl_table ether_table[]; |
122 | #endif | 124 | #endif |
125 | |||
126 | /* | ||
127 | * Display a 6 byte device address (MAC) in a readable format. | ||
128 | */ | ||
129 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
130 | extern char *print_mac(char *buf, const u8 *addr); | ||
131 | #define DECLARE_MAC_BUF(var) char var[18] __maybe_unused | ||
132 | |||
123 | #endif | 133 | #endif |
124 | 134 | ||
125 | #endif /* _LINUX_IF_ETHER_H */ | 135 | #endif /* _LINUX_IF_ETHER_H */ |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 422084d18ce1..84c3492ae5cb 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
@@ -78,6 +78,7 @@ enum | |||
78 | IFLA_LINKMODE, | 78 | IFLA_LINKMODE, |
79 | IFLA_LINKINFO, | 79 | IFLA_LINKINFO, |
80 | #define IFLA_LINKINFO IFLA_LINKINFO | 80 | #define IFLA_LINKINFO IFLA_LINKINFO |
81 | IFLA_NET_NS_PID, | ||
81 | __IFLA_MAX | 82 | __IFLA_MAX |
82 | }; | 83 | }; |
83 | 84 | ||
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 25652545ba6e..40743e032845 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h | |||
@@ -40,7 +40,7 @@ | |||
40 | /************************************************************************ | 40 | /************************************************************************ |
41 | * PPPoE addressing definition | 41 | * PPPoE addressing definition |
42 | */ | 42 | */ |
43 | typedef __u16 sid_t; | 43 | typedef __be16 sid_t; |
44 | struct pppoe_addr{ | 44 | struct pppoe_addr{ |
45 | sid_t sid; /* Session identifier */ | 45 | sid_t sid; /* Session identifier */ |
46 | unsigned char remote[ETH_ALEN]; /* Remote address */ | 46 | unsigned char remote[ETH_ALEN]; /* Remote address */ |
@@ -90,8 +90,8 @@ struct sockaddr_pppol2tp { | |||
90 | #define PADS_CODE 0x65 | 90 | #define PADS_CODE 0x65 |
91 | #define PADT_CODE 0xa7 | 91 | #define PADT_CODE 0xa7 |
92 | struct pppoe_tag { | 92 | struct pppoe_tag { |
93 | __u16 tag_type; | 93 | __be16 tag_type; |
94 | __u16 tag_len; | 94 | __be16 tag_len; |
95 | char tag_data[0]; | 95 | char tag_data[0]; |
96 | } __attribute ((packed)); | 96 | } __attribute ((packed)); |
97 | 97 | ||
@@ -118,8 +118,8 @@ struct pppoe_hdr { | |||
118 | #error "Please fix <asm/byteorder.h>" | 118 | #error "Please fix <asm/byteorder.h>" |
119 | #endif | 119 | #endif |
120 | __u8 code; | 120 | __u8 code; |
121 | __u16 sid; | 121 | __be16 sid; |
122 | __u16 length; | 122 | __be16 length; |
123 | struct pppoe_tag tag[0]; | 123 | struct pppoe_tag tag[0]; |
124 | } __attribute__ ((packed)); | 124 | } __attribute__ ((packed)); |
125 | 125 | ||
@@ -152,7 +152,7 @@ struct pppox_sock { | |||
152 | union { | 152 | union { |
153 | struct pppoe_opt pppoe; | 153 | struct pppoe_opt pppoe; |
154 | } proto; | 154 | } proto; |
155 | unsigned short num; | 155 | __be16 num; |
156 | }; | 156 | }; |
157 | #define pppoe_dev proto.pppoe.dev | 157 | #define pppoe_dev proto.pppoe.dev |
158 | #define pppoe_ifindex proto.pppoe.ifindex | 158 | #define pppoe_ifindex proto.pppoe.ifindex |
@@ -172,7 +172,7 @@ static inline struct sock *sk_pppox(struct pppox_sock *po) | |||
172 | struct module; | 172 | struct module; |
173 | 173 | ||
174 | struct pppox_proto { | 174 | struct pppox_proto { |
175 | int (*create)(struct socket *sock); | 175 | int (*create)(struct net *net, struct socket *sock); |
176 | int (*ioctl)(struct socket *sock, unsigned int cmd, | 176 | int (*ioctl)(struct socket *sock, unsigned int cmd, |
177 | unsigned long arg); | 177 | unsigned long arg); |
178 | struct module *owner; | 178 | struct module *owner; |
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 68c896a36a34..3b1b7ba19825 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h | |||
@@ -24,19 +24,7 @@ struct shaper | |||
24 | unsigned long recovery; /* Time we can next clock a packet out on | 24 | unsigned long recovery; /* Time we can next clock a packet out on |
25 | an empty queue */ | 25 | an empty queue */ |
26 | spinlock_t lock; | 26 | spinlock_t lock; |
27 | struct net_device_stats stats; | ||
28 | struct net_device *dev; | 27 | struct net_device *dev; |
29 | int (*hard_start_xmit) (struct sk_buff *skb, | ||
30 | struct net_device *dev); | ||
31 | int (*hard_header) (struct sk_buff *skb, | ||
32 | struct net_device *dev, | ||
33 | unsigned short type, | ||
34 | void *daddr, | ||
35 | void *saddr, | ||
36 | unsigned len); | ||
37 | int (*rebuild_header)(struct sk_buff *skb); | ||
38 | int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); | ||
39 | void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); | ||
40 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 28 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
41 | struct timer_list timer; | 29 | struct timer_list timer; |
42 | }; | 30 | }; |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 42eb6945b93e..33e489d5bb33 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
@@ -42,7 +42,6 @@ struct tun_struct { | |||
42 | struct sk_buff_head readq; | 42 | struct sk_buff_head readq; |
43 | 43 | ||
44 | struct net_device *dev; | 44 | struct net_device *dev; |
45 | struct net_device_stats stats; | ||
46 | 45 | ||
47 | struct fasync_struct *fasync; | 46 | struct fasync_struct *fasync; |
48 | 47 | ||
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index f8443fdb124a..976d4b1067d1 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -62,7 +62,7 @@ struct vlan_hdr { | |||
62 | #define VLAN_VID_MASK 0xfff | 62 | #define VLAN_VID_MASK 0xfff |
63 | 63 | ||
64 | /* found in socket.c */ | 64 | /* found in socket.c */ |
65 | extern void vlan_ioctl_set(int (*hook)(void __user *)); | 65 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
66 | 66 | ||
67 | #define VLAN_NAME "vlan" | 67 | #define VLAN_NAME "vlan" |
68 | 68 | ||
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h new file mode 100644 index 000000000000..e1fc1d16d3cd --- /dev/null +++ b/include/linux/inet_lro.h | |||
@@ -0,0 +1,177 @@ | |||
1 | /* | ||
2 | * linux/include/linux/inet_lro.h | ||
3 | * | ||
4 | * Large Receive Offload (ipv4 / tcp) | ||
5 | * | ||
6 | * (C) Copyright IBM Corp. 2007 | ||
7 | * | ||
8 | * Authors: | ||
9 | * Jan-Bernd Themann <themann@de.ibm.com> | ||
10 | * Christoph Raisch <raisch@de.ibm.com> | ||
11 | * | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2, or (at your option) | ||
16 | * any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __INET_LRO_H_ | ||
29 | #define __INET_LRO_H_ | ||
30 | |||
31 | #include <net/ip.h> | ||
32 | #include <net/tcp.h> | ||
33 | |||
34 | /* | ||
35 | * LRO statistics | ||
36 | */ | ||
37 | |||
38 | struct net_lro_stats { | ||
39 | unsigned long aggregated; | ||
40 | unsigned long flushed; | ||
41 | unsigned long no_desc; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * LRO descriptor for a tcp session | ||
46 | */ | ||
47 | struct net_lro_desc { | ||
48 | struct sk_buff *parent; | ||
49 | struct sk_buff *last_skb; | ||
50 | struct skb_frag_struct *next_frag; | ||
51 | struct iphdr *iph; | ||
52 | struct tcphdr *tcph; | ||
53 | struct vlan_group *vgrp; | ||
54 | __wsum data_csum; | ||
55 | u32 tcp_rcv_tsecr; | ||
56 | u32 tcp_rcv_tsval; | ||
57 | u32 tcp_ack; | ||
58 | u32 tcp_next_seq; | ||
59 | u32 skb_tot_frags_len; | ||
60 | u16 ip_tot_len; | ||
61 | u16 tcp_saw_tstamp; /* timestamps enabled */ | ||
62 | u16 tcp_window; | ||
63 | u16 vlan_tag; | ||
64 | int pkt_aggr_cnt; /* counts aggregated packets */ | ||
65 | int vlan_packet; | ||
66 | int mss; | ||
67 | int active; | ||
68 | }; | ||
69 | |||
70 | /* | ||
71 | * Large Receive Offload (LRO) Manager | ||
72 | * | ||
73 | * Fields must be set by driver | ||
74 | */ | ||
75 | |||
76 | struct net_lro_mgr { | ||
77 | struct net_device *dev; | ||
78 | struct net_lro_stats stats; | ||
79 | |||
80 | /* LRO features */ | ||
81 | unsigned long features; | ||
82 | #define LRO_F_NAPI 1 /* Pass packets to stack via NAPI */ | ||
83 | #define LRO_F_EXTRACT_VLAN_ID 2 /* Set flag if VLAN IDs are extracted | ||
84 | from received packets and eth protocol | ||
85 | is still ETH_P_8021Q */ | ||
86 | |||
87 | u32 ip_summed; /* Set in non generated SKBs in page mode */ | ||
88 | u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY | ||
89 | * or CHECKSUM_NONE */ | ||
90 | |||
91 | int max_desc; /* Max number of LRO descriptors */ | ||
92 | int max_aggr; /* Max number of LRO packets to be aggregated */ | ||
93 | |||
94 | struct net_lro_desc *lro_arr; /* Array of LRO descriptors */ | ||
95 | |||
96 | /* | ||
97 | * Optimized driver functions | ||
98 | * | ||
99 | * get_skb_header: returns tcp and ip header for packet in SKB | ||
100 | */ | ||
101 | int (*get_skb_header)(struct sk_buff *skb, void **ip_hdr, | ||
102 | void **tcpudp_hdr, u64 *hdr_flags, void *priv); | ||
103 | |||
104 | /* hdr_flags: */ | ||
105 | #define LRO_IPV4 1 /* ip_hdr is IPv4 header */ | ||
106 | #define LRO_TCP 2 /* tcpudp_hdr is TCP header */ | ||
107 | |||
108 | /* | ||
109 | * get_frag_header: returns mac, tcp and ip header for packet in SKB | ||
110 | * | ||
111 | * @hdr_flags: Indicate what kind of LRO has to be done | ||
112 | * (IPv4/IPv6/TCP/UDP) | ||
113 | */ | ||
114 | int (*get_frag_header)(struct skb_frag_struct *frag, void **mac_hdr, | ||
115 | void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, | ||
116 | void *priv); | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * Processes a SKB | ||
121 | * | ||
122 | * @lro_mgr: LRO manager to use | ||
123 | * @skb: SKB to aggregate | ||
124 | * @priv: Private data that may be used by driver functions | ||
125 | * (for example get_tcp_ip_hdr) | ||
126 | */ | ||
127 | |||
128 | void lro_receive_skb(struct net_lro_mgr *lro_mgr, | ||
129 | struct sk_buff *skb, | ||
130 | void *priv); | ||
131 | |||
132 | /* | ||
133 | * Processes a SKB with VLAN HW acceleration support | ||
134 | */ | ||
135 | |||
136 | void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr, | ||
137 | struct sk_buff *skb, | ||
138 | struct vlan_group *vgrp, | ||
139 | u16 vlan_tag, | ||
140 | void *priv); | ||
141 | |||
142 | /* | ||
143 | * Processes a fragment list | ||
144 | * | ||
145 | * This functions aggregate fragments and generate SKBs do pass | ||
146 | * the packets to the stack. | ||
147 | * | ||
148 | * @lro_mgr: LRO manager to use | ||
149 | * @frags: Fragment to be processed. Must contain entire header in first | ||
150 | * element. | ||
151 | * @len: Length of received data | ||
152 | * @true_size: Actual size of memory the fragment is consuming | ||
153 | * @priv: Private data that may be used by driver functions | ||
154 | * (for example get_tcp_ip_hdr) | ||
155 | */ | ||
156 | |||
157 | void lro_receive_frags(struct net_lro_mgr *lro_mgr, | ||
158 | struct skb_frag_struct *frags, | ||
159 | int len, int true_size, void *priv, __wsum sum); | ||
160 | |||
161 | void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr, | ||
162 | struct skb_frag_struct *frags, | ||
163 | int len, int true_size, | ||
164 | struct vlan_group *vgrp, | ||
165 | u16 vlan_tag, | ||
166 | void *priv, __wsum sum); | ||
167 | |||
168 | /* | ||
169 | * Forward all aggregated SKBs held by lro_mgr to network stack | ||
170 | */ | ||
171 | |||
172 | void lro_flush_all(struct net_lro_mgr *lro_mgr); | ||
173 | |||
174 | void lro_flush_pkt(struct net_lro_mgr *lro_mgr, | ||
175 | struct iphdr *iph, struct tcphdr *tcph); | ||
176 | |||
177 | #endif | ||
diff --git a/include/linux/init.h b/include/linux/init.h index 74b1f43bf982..f8d9d0b5cffc 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -57,6 +57,7 @@ | |||
57 | * The markers follow same syntax rules as __init / __initdata. */ | 57 | * The markers follow same syntax rules as __init / __initdata. */ |
58 | #define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) | 58 | #define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) |
59 | #define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) | 59 | #define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) |
60 | #define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) | ||
60 | 61 | ||
61 | #ifdef MODULE | 62 | #ifdef MODULE |
62 | #define __exit __attribute__ ((__section__(".exit.text"))) __cold | 63 | #define __exit __attribute__ ((__section__(".exit.text"))) __cold |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index f8abfa349ef9..513bc3e489f0 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/ipc.h> | 9 | #include <linux/ipc.h> |
10 | #include <linux/pid_namespace.h> | 10 | #include <linux/pid_namespace.h> |
11 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
12 | #include <net/net_namespace.h> | ||
12 | 13 | ||
13 | #define INIT_FDTABLE \ | 14 | #define INIT_FDTABLE \ |
14 | { \ | 15 | { \ |
@@ -78,6 +79,7 @@ extern struct nsproxy init_nsproxy; | |||
78 | .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \ | 79 | .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \ |
79 | .uts_ns = &init_uts_ns, \ | 80 | .uts_ns = &init_uts_ns, \ |
80 | .mnt_ns = NULL, \ | 81 | .mnt_ns = NULL, \ |
82 | INIT_NET_NS(net_ns) \ | ||
81 | INIT_IPC_NS(ipc_ns) \ | 83 | INIT_IPC_NS(ipc_ns) \ |
82 | .user_ns = &init_user_ns, \ | 84 | .user_ns = &init_user_ns, \ |
83 | } | 85 | } |
diff --git a/include/linux/input.h b/include/linux/input.h index 36e00aa6f03b..6eb3aead7f1d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -360,6 +360,7 @@ struct input_absinfo { | |||
360 | 360 | ||
361 | #define KEY_BLUETOOTH 237 | 361 | #define KEY_BLUETOOTH 237 |
362 | #define KEY_WLAN 238 | 362 | #define KEY_WLAN 238 |
363 | #define KEY_UWB 239 | ||
363 | 364 | ||
364 | #define KEY_UNKNOWN 240 | 365 | #define KEY_UNKNOWN 240 |
365 | 366 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 4ca60c3320fb..5d35a4cc3bff 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -96,27 +96,6 @@ struct ipv6_destopt_hao { | |||
96 | struct in6_addr addr; | 96 | struct in6_addr addr; |
97 | } __attribute__ ((__packed__)); | 97 | } __attribute__ ((__packed__)); |
98 | 98 | ||
99 | struct ipv6_auth_hdr { | ||
100 | __u8 nexthdr; | ||
101 | __u8 hdrlen; /* This one is measured in 32 bit units! */ | ||
102 | __be16 reserved; | ||
103 | __be32 spi; | ||
104 | __be32 seq_no; /* Sequence number */ | ||
105 | __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ | ||
106 | }; | ||
107 | |||
108 | struct ipv6_esp_hdr { | ||
109 | __be32 spi; | ||
110 | __be32 seq_no; /* Sequence number */ | ||
111 | __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ | ||
112 | }; | ||
113 | |||
114 | struct ipv6_comp_hdr { | ||
115 | __u8 nexthdr; | ||
116 | __u8 flags; | ||
117 | __be16 cpi; | ||
118 | }; | ||
119 | |||
120 | /* | 99 | /* |
121 | * IPv6 fixed header | 100 | * IPv6 fixed header |
122 | * | 101 | * |
diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 3c7875b7ab5b..ad09506554a3 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h | |||
@@ -353,13 +353,6 @@ typedef struct isdn_net_local_s { | |||
353 | /* a particular channel (including */ | 353 | /* a particular channel (including */ |
354 | /* the frame_cnt */ | 354 | /* the frame_cnt */ |
355 | 355 | ||
356 | int (*org_hhc)( | ||
357 | struct neighbour *neigh, | ||
358 | struct hh_cache *hh); | ||
359 | /* Ptr to orig. header_cache_update */ | ||
360 | void (*org_hcu)(struct hh_cache *, | ||
361 | struct net_device *, | ||
362 | unsigned char *); | ||
363 | int pppbind; /* ippp device for bindings */ | 356 | int pppbind; /* ippp device for bindings */ |
364 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ | 357 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ |
365 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ | 358 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ |
@@ -389,7 +382,7 @@ typedef struct isdn_net_dev_s { | |||
389 | online */ | 382 | online */ |
390 | spinlock_t queue_lock; /* lock to protect queue */ | 383 | spinlock_t queue_lock; /* lock to protect queue */ |
391 | void *next; /* Pointer to next isdn-interface */ | 384 | void *next; /* Pointer to next isdn-interface */ |
392 | struct net_device dev; /* interface to upper levels */ | 385 | struct net_device *dev; /* interface to upper levels */ |
393 | #ifdef CONFIG_ISDN_PPP | 386 | #ifdef CONFIG_ISDN_PPP |
394 | ippp_bundle * pb; /* pointer to the common bundle structure | 387 | ippp_bundle * pb; /* pointer to the common bundle structure |
395 | * with the per-bundle data */ | 388 | * with the per-bundle data */ |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index dae7143644fe..a6ddec141f96 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -102,6 +102,13 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | |||
102 | #define ktime_add_ns(kt, nsval) \ | 102 | #define ktime_add_ns(kt, nsval) \ |
103 | ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) | 103 | ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) |
104 | 104 | ||
105 | /* | ||
106 | * Subtract a scalar nanosecod from a ktime_t variable | ||
107 | * res = kt - nsval: | ||
108 | */ | ||
109 | #define ktime_sub_ns(kt, nsval) \ | ||
110 | ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; }) | ||
111 | |||
105 | /* convert a timespec to ktime_t format: */ | 112 | /* convert a timespec to ktime_t format: */ |
106 | static inline ktime_t timespec_to_ktime(struct timespec ts) | 113 | static inline ktime_t timespec_to_ktime(struct timespec ts) |
107 | { | 114 | { |
@@ -200,6 +207,15 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) | |||
200 | extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); | 207 | extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); |
201 | 208 | ||
202 | /** | 209 | /** |
210 | * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable | ||
211 | * @kt: minuend | ||
212 | * @nsec: the scalar nsec value to subtract | ||
213 | * | ||
214 | * Returns the subtraction of @nsec from @kt in ktime_t format | ||
215 | */ | ||
216 | extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec); | ||
217 | |||
218 | /** | ||
203 | * timespec_to_ktime - convert a timespec to ktime_t format | 219 | * timespec_to_ktime - convert a timespec to ktime_t format |
204 | * @ts: the timespec variable to convert | 220 | * @ts: the timespec variable to convert |
205 | * | 221 | * |
@@ -289,6 +305,11 @@ static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) | |||
289 | return ktime_add_ns(kt, usec * 1000); | 305 | return ktime_add_ns(kt, usec * 1000); |
290 | } | 306 | } |
291 | 307 | ||
308 | static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | ||
309 | { | ||
310 | return ktime_sub_ns(kt, usec * 1000); | ||
311 | } | ||
312 | |||
292 | /* | 313 | /* |
293 | * The resolution of the clocks. The resolution value is returned in | 314 | * The resolution of the clocks. The resolution value is returned in |
294 | * the clock_getres() system call to give application programmers an | 315 | * the clock_getres() system call to give application programmers an |
diff --git a/include/linux/list.h b/include/linux/list.h index f29fc9c1a964..ad9dcb9e3375 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -525,6 +525,20 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
525 | pos = list_entry(pos->member.next, typeof(*pos), member)) | 525 | pos = list_entry(pos->member.next, typeof(*pos), member)) |
526 | 526 | ||
527 | /** | 527 | /** |
528 | * list_for_each_entry_continue_reverse - iterate backwards from the given point | ||
529 | * @pos: the type * to use as a loop cursor. | ||
530 | * @head: the head for your list. | ||
531 | * @member: the name of the list_struct within the struct. | ||
532 | * | ||
533 | * Start to iterate over list of given type backwards, continuing after | ||
534 | * the current position. | ||
535 | */ | ||
536 | #define list_for_each_entry_continue_reverse(pos, head, member) \ | ||
537 | for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ | ||
538 | prefetch(pos->member.prev), &pos->member != (head); \ | ||
539 | pos = list_entry(pos->member.prev, typeof(*pos), member)) | ||
540 | |||
541 | /** | ||
528 | * list_for_each_entry_from - iterate over list of given type from the current point | 542 | * list_for_each_entry_from - iterate over list of given type from the current point |
529 | * @pos: the type * to use as a loop cursor. | 543 | * @pos: the type * to use as a loop cursor. |
530 | * @head: the head for your list. | 544 | * @head: the head for your list. |
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h new file mode 100644 index 000000000000..8ea9a42a4c02 --- /dev/null +++ b/include/linux/mdio-bitbang.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef __LINUX_MDIO_BITBANG_H | ||
2 | #define __LINUX_MDIO_BITBANG_H | ||
3 | |||
4 | #include <linux/phy.h> | ||
5 | #include <linux/module.h> | ||
6 | |||
7 | struct mdiobb_ctrl; | ||
8 | |||
9 | struct mdiobb_ops { | ||
10 | struct module *owner; | ||
11 | |||
12 | /* Set the Management Data Clock high if level is one, | ||
13 | * low if level is zero. | ||
14 | */ | ||
15 | void (*set_mdc)(struct mdiobb_ctrl *ctrl, int level); | ||
16 | |||
17 | /* Configure the Management Data I/O pin as an input if | ||
18 | * "output" is zero, or an output if "output" is one. | ||
19 | */ | ||
20 | void (*set_mdio_dir)(struct mdiobb_ctrl *ctrl, int output); | ||
21 | |||
22 | /* Set the Management Data I/O pin high if value is one, | ||
23 | * low if "value" is zero. This may only be called | ||
24 | * when the MDIO pin is configured as an output. | ||
25 | */ | ||
26 | void (*set_mdio_data)(struct mdiobb_ctrl *ctrl, int value); | ||
27 | |||
28 | /* Retrieve the state Management Data I/O pin. */ | ||
29 | int (*get_mdio_data)(struct mdiobb_ctrl *ctrl); | ||
30 | }; | ||
31 | |||
32 | struct mdiobb_ctrl { | ||
33 | const struct mdiobb_ops *ops; | ||
34 | }; | ||
35 | |||
36 | /* The returned bus is not yet registered with the phy layer. */ | ||
37 | struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl); | ||
38 | |||
39 | /* The bus must already have been unregistered. */ | ||
40 | void free_mdio_bitbang(struct mii_bus *bus); | ||
41 | |||
42 | #endif | ||
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index e47e5951058b..74523d999f7a 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -351,4 +351,19 @@ struct sdio_device_id { | |||
351 | kernel_ulong_t driver_data; /* Data private to the driver */ | 351 | kernel_ulong_t driver_data; /* Data private to the driver */ |
352 | }; | 352 | }; |
353 | 353 | ||
354 | /* SSB core, see drivers/ssb/ */ | ||
355 | struct ssb_device_id { | ||
356 | __u16 vendor; | ||
357 | __u16 coreid; | ||
358 | __u8 revision; | ||
359 | }; | ||
360 | #define SSB_DEVICE(_vendor, _coreid, _revision) \ | ||
361 | { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } | ||
362 | #define SSB_DEVTABLE_END \ | ||
363 | { 0, }, | ||
364 | |||
365 | #define SSB_ANY_VENDOR 0xFFFF | ||
366 | #define SSB_ANY_ID 0xFFFF | ||
367 | #define SSB_ANY_REV 0xFF | ||
368 | |||
354 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 369 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/net.h b/include/linux/net.h index efc45177b503..c136abce7ef6 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | struct poll_table_struct; | 24 | struct poll_table_struct; |
25 | struct inode; | 25 | struct inode; |
26 | struct net; | ||
26 | 27 | ||
27 | #define NPROTO 34 /* should be enough for now.. */ | 28 | #define NPROTO 34 /* should be enough for now.. */ |
28 | 29 | ||
@@ -169,7 +170,7 @@ struct proto_ops { | |||
169 | 170 | ||
170 | struct net_proto_family { | 171 | struct net_proto_family { |
171 | int family; | 172 | int family; |
172 | int (*create)(struct socket *sock, int protocol); | 173 | int (*create)(struct net *net, struct socket *sock, int protocol); |
173 | struct module *owner; | 174 | struct module *owner; |
174 | }; | 175 | }; |
175 | 176 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index e679b2751665..5a11f889e56a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
33 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
34 | #include <linux/delay.h> | ||
34 | #include <asm/atomic.h> | 35 | #include <asm/atomic.h> |
35 | #include <asm/cache.h> | 36 | #include <asm/cache.h> |
36 | #include <asm/byteorder.h> | 37 | #include <asm/byteorder.h> |
@@ -38,6 +39,9 @@ | |||
38 | #include <linux/device.h> | 39 | #include <linux/device.h> |
39 | #include <linux/percpu.h> | 40 | #include <linux/percpu.h> |
40 | #include <linux/dmaengine.h> | 41 | #include <linux/dmaengine.h> |
42 | #include <linux/workqueue.h> | ||
43 | |||
44 | #include <net/net_namespace.h> | ||
41 | 45 | ||
42 | struct vlan_group; | 46 | struct vlan_group; |
43 | struct ethtool_ops; | 47 | struct ethtool_ops; |
@@ -246,6 +250,19 @@ struct hh_cache | |||
246 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ | 250 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ |
247 | ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) | 251 | ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) |
248 | 252 | ||
253 | struct header_ops { | ||
254 | int (*create) (struct sk_buff *skb, struct net_device *dev, | ||
255 | unsigned short type, const void *daddr, | ||
256 | const void *saddr, unsigned len); | ||
257 | int (*parse)(const struct sk_buff *skb, unsigned char *haddr); | ||
258 | int (*rebuild)(struct sk_buff *skb); | ||
259 | #define HAVE_HEADER_CACHE | ||
260 | int (*cache)(const struct neighbour *neigh, struct hh_cache *hh); | ||
261 | void (*cache_update)(struct hh_cache *hh, | ||
262 | const struct net_device *dev, | ||
263 | const unsigned char *haddr); | ||
264 | }; | ||
265 | |||
249 | /* These flag bits are private to the generic network queueing | 266 | /* These flag bits are private to the generic network queueing |
250 | * layer, they may not be explicitly referenced by any other | 267 | * layer, they may not be explicitly referenced by any other |
251 | * code. | 268 | * code. |
@@ -258,7 +275,6 @@ enum netdev_state_t | |||
258 | __LINK_STATE_PRESENT, | 275 | __LINK_STATE_PRESENT, |
259 | __LINK_STATE_SCHED, | 276 | __LINK_STATE_SCHED, |
260 | __LINK_STATE_NOCARRIER, | 277 | __LINK_STATE_NOCARRIER, |
261 | __LINK_STATE_RX_SCHED, | ||
262 | __LINK_STATE_LINKWATCH_PENDING, | 278 | __LINK_STATE_LINKWATCH_PENDING, |
263 | __LINK_STATE_DORMANT, | 279 | __LINK_STATE_DORMANT, |
264 | __LINK_STATE_QDISC_RUNNING, | 280 | __LINK_STATE_QDISC_RUNNING, |
@@ -278,6 +294,120 @@ struct netdev_boot_setup { | |||
278 | extern int __init netdev_boot_setup(char *str); | 294 | extern int __init netdev_boot_setup(char *str); |
279 | 295 | ||
280 | /* | 296 | /* |
297 | * Structure for NAPI scheduling similar to tasklet but with weighting | ||
298 | */ | ||
299 | struct napi_struct { | ||
300 | /* The poll_list must only be managed by the entity which | ||
301 | * changes the state of the NAPI_STATE_SCHED bit. This means | ||
302 | * whoever atomically sets that bit can add this napi_struct | ||
303 | * to the per-cpu poll_list, and whoever clears that bit | ||
304 | * can remove from the list right before clearing the bit. | ||
305 | */ | ||
306 | struct list_head poll_list; | ||
307 | |||
308 | unsigned long state; | ||
309 | int weight; | ||
310 | int (*poll)(struct napi_struct *, int); | ||
311 | #ifdef CONFIG_NETPOLL | ||
312 | spinlock_t poll_lock; | ||
313 | int poll_owner; | ||
314 | struct net_device *dev; | ||
315 | struct list_head dev_list; | ||
316 | #endif | ||
317 | }; | ||
318 | |||
319 | enum | ||
320 | { | ||
321 | NAPI_STATE_SCHED, /* Poll is scheduled */ | ||
322 | }; | ||
323 | |||
324 | extern void FASTCALL(__napi_schedule(struct napi_struct *n)); | ||
325 | |||
326 | /** | ||
327 | * napi_schedule_prep - check if napi can be scheduled | ||
328 | * @n: napi context | ||
329 | * | ||
330 | * Test if NAPI routine is already running, and if not mark | ||
331 | * it as running. This is used as a condition variable | ||
332 | * insure only one NAPI poll instance runs | ||
333 | */ | ||
334 | static inline int napi_schedule_prep(struct napi_struct *n) | ||
335 | { | ||
336 | return !test_and_set_bit(NAPI_STATE_SCHED, &n->state); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * napi_schedule - schedule NAPI poll | ||
341 | * @n: napi context | ||
342 | * | ||
343 | * Schedule NAPI poll routine to be called if it is not already | ||
344 | * running. | ||
345 | */ | ||
346 | static inline void napi_schedule(struct napi_struct *n) | ||
347 | { | ||
348 | if (napi_schedule_prep(n)) | ||
349 | __napi_schedule(n); | ||
350 | } | ||
351 | |||
352 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ | ||
353 | static inline int napi_reschedule(struct napi_struct *napi) | ||
354 | { | ||
355 | if (napi_schedule_prep(napi)) { | ||
356 | __napi_schedule(napi); | ||
357 | return 1; | ||
358 | } | ||
359 | return 0; | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * napi_complete - NAPI processing complete | ||
364 | * @n: napi context | ||
365 | * | ||
366 | * Mark NAPI processing as complete. | ||
367 | */ | ||
368 | static inline void __napi_complete(struct napi_struct *n) | ||
369 | { | ||
370 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | ||
371 | list_del(&n->poll_list); | ||
372 | smp_mb__before_clear_bit(); | ||
373 | clear_bit(NAPI_STATE_SCHED, &n->state); | ||
374 | } | ||
375 | |||
376 | static inline void napi_complete(struct napi_struct *n) | ||
377 | { | ||
378 | local_irq_disable(); | ||
379 | __napi_complete(n); | ||
380 | local_irq_enable(); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * napi_disable - prevent NAPI from scheduling | ||
385 | * @n: napi context | ||
386 | * | ||
387 | * Stop NAPI from being scheduled on this context. | ||
388 | * Waits till any outstanding processing completes. | ||
389 | */ | ||
390 | static inline void napi_disable(struct napi_struct *n) | ||
391 | { | ||
392 | while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) | ||
393 | msleep_interruptible(1); | ||
394 | } | ||
395 | |||
396 | /** | ||
397 | * napi_enable - enable NAPI scheduling | ||
398 | * @n: napi context | ||
399 | * | ||
400 | * Resume NAPI from being scheduled on this context. | ||
401 | * Must be paired with napi_disable. | ||
402 | */ | ||
403 | static inline void napi_enable(struct napi_struct *n) | ||
404 | { | ||
405 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | ||
406 | smp_mb__before_clear_bit(); | ||
407 | clear_bit(NAPI_STATE_SCHED, &n->state); | ||
408 | } | ||
409 | |||
410 | /* | ||
281 | * The DEVICE structure. | 411 | * The DEVICE structure. |
282 | * Actually, this whole structure is a big mistake. It mixes I/O | 412 | * Actually, this whole structure is a big mistake. It mixes I/O |
283 | * data with strictly "high-level" data, and it has to know about | 413 | * data with strictly "high-level" data, and it has to know about |
@@ -319,6 +449,9 @@ struct net_device | |||
319 | unsigned long state; | 449 | unsigned long state; |
320 | 450 | ||
321 | struct list_head dev_list; | 451 | struct list_head dev_list; |
452 | #ifdef CONFIG_NETPOLL | ||
453 | struct list_head napi_list; | ||
454 | #endif | ||
322 | 455 | ||
323 | /* The device initialization function. Called only once. */ | 456 | /* The device initialization function. Called only once. */ |
324 | int (*init)(struct net_device *dev); | 457 | int (*init)(struct net_device *dev); |
@@ -339,8 +472,11 @@ struct net_device | |||
339 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ | 472 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ |
340 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | 473 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ |
341 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ | 474 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ |
342 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 475 | #define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ |
476 | /* do not use LLTX in new drivers */ | ||
477 | #define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ | ||
343 | #define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */ | 478 | #define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */ |
479 | #define NETIF_F_LRO 32768 /* large receive offload */ | ||
344 | 480 | ||
345 | /* Segmentation offload features */ | 481 | /* Segmentation offload features */ |
346 | #define NETIF_F_GSO_SHIFT 16 | 482 | #define NETIF_F_GSO_SHIFT 16 |
@@ -379,6 +515,9 @@ struct net_device | |||
379 | #endif | 515 | #endif |
380 | const struct ethtool_ops *ethtool_ops; | 516 | const struct ethtool_ops *ethtool_ops; |
381 | 517 | ||
518 | /* Hardware header description */ | ||
519 | const struct header_ops *header_ops; | ||
520 | |||
382 | /* | 521 | /* |
383 | * This marks the end of the "visible" part of the structure. All | 522 | * This marks the end of the "visible" part of the structure. All |
384 | * fields hereafter are internal to the system, and may change at | 523 | * fields hereafter are internal to the system, and may change at |
@@ -430,12 +569,6 @@ struct net_device | |||
430 | /* | 569 | /* |
431 | * Cache line mostly used on receive path (including eth_type_trans()) | 570 | * Cache line mostly used on receive path (including eth_type_trans()) |
432 | */ | 571 | */ |
433 | struct list_head poll_list ____cacheline_aligned_in_smp; | ||
434 | /* Link to poll list */ | ||
435 | |||
436 | int (*poll) (struct net_device *dev, int *quota); | ||
437 | int quota; | ||
438 | int weight; | ||
439 | unsigned long last_rx; /* Time of last Rx */ | 572 | unsigned long last_rx; /* Time of last Rx */ |
440 | /* Interface address info used in eth_type_trans() */ | 573 | /* Interface address info used in eth_type_trans() */ |
441 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast | 574 | unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast |
@@ -508,13 +641,6 @@ struct net_device | |||
508 | int (*open)(struct net_device *dev); | 641 | int (*open)(struct net_device *dev); |
509 | int (*stop)(struct net_device *dev); | 642 | int (*stop)(struct net_device *dev); |
510 | #define HAVE_NETDEV_POLL | 643 | #define HAVE_NETDEV_POLL |
511 | int (*hard_header) (struct sk_buff *skb, | ||
512 | struct net_device *dev, | ||
513 | unsigned short type, | ||
514 | void *daddr, | ||
515 | void *saddr, | ||
516 | unsigned len); | ||
517 | int (*rebuild_header)(struct sk_buff *skb); | ||
518 | #define HAVE_CHANGE_RX_FLAGS | 644 | #define HAVE_CHANGE_RX_FLAGS |
519 | void (*change_rx_flags)(struct net_device *dev, | 645 | void (*change_rx_flags)(struct net_device *dev, |
520 | int flags); | 646 | int flags); |
@@ -531,12 +657,6 @@ struct net_device | |||
531 | #define HAVE_SET_CONFIG | 657 | #define HAVE_SET_CONFIG |
532 | int (*set_config)(struct net_device *dev, | 658 | int (*set_config)(struct net_device *dev, |
533 | struct ifmap *map); | 659 | struct ifmap *map); |
534 | #define HAVE_HEADER_CACHE | ||
535 | int (*hard_header_cache)(struct neighbour *neigh, | ||
536 | struct hh_cache *hh); | ||
537 | void (*header_cache_update)(struct hh_cache *hh, | ||
538 | struct net_device *dev, | ||
539 | unsigned char * haddr); | ||
540 | #define HAVE_CHANGE_MTU | 660 | #define HAVE_CHANGE_MTU |
541 | int (*change_mtu)(struct net_device *dev, int new_mtu); | 661 | int (*change_mtu)(struct net_device *dev, int new_mtu); |
542 | 662 | ||
@@ -550,8 +670,6 @@ struct net_device | |||
550 | void (*vlan_rx_kill_vid)(struct net_device *dev, | 670 | void (*vlan_rx_kill_vid)(struct net_device *dev, |
551 | unsigned short vid); | 671 | unsigned short vid); |
552 | 672 | ||
553 | int (*hard_header_parse)(struct sk_buff *skb, | ||
554 | unsigned char *haddr); | ||
555 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); | 673 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); |
556 | #ifdef CONFIG_NETPOLL | 674 | #ifdef CONFIG_NETPOLL |
557 | struct netpoll_info *npinfo; | 675 | struct netpoll_info *npinfo; |
@@ -560,6 +678,9 @@ struct net_device | |||
560 | void (*poll_controller)(struct net_device *dev); | 678 | void (*poll_controller)(struct net_device *dev); |
561 | #endif | 679 | #endif |
562 | 680 | ||
681 | /* Network namespace this network device is inside */ | ||
682 | struct net *nd_net; | ||
683 | |||
563 | /* bridge stuff */ | 684 | /* bridge stuff */ |
564 | struct net_bridge_port *br_port; | 685 | struct net_bridge_port *br_port; |
565 | /* macvlan */ | 686 | /* macvlan */ |
@@ -582,17 +703,39 @@ struct net_device | |||
582 | #define NETDEV_ALIGN 32 | 703 | #define NETDEV_ALIGN 32 |
583 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) | 704 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) |
584 | 705 | ||
706 | /** | ||
707 | * netdev_priv - access network device private data | ||
708 | * @dev: network device | ||
709 | * | ||
710 | * Get network device private data | ||
711 | */ | ||
585 | static inline void *netdev_priv(const struct net_device *dev) | 712 | static inline void *netdev_priv(const struct net_device *dev) |
586 | { | 713 | { |
587 | return dev->priv; | 714 | return dev->priv; |
588 | } | 715 | } |
589 | 716 | ||
590 | #define SET_MODULE_OWNER(dev) do { } while (0) | ||
591 | /* Set the sysfs physical device reference for the network logical device | 717 | /* Set the sysfs physical device reference for the network logical device |
592 | * if set prior to registration will cause a symlink during initialization. | 718 | * if set prior to registration will cause a symlink during initialization. |
593 | */ | 719 | */ |
594 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) | 720 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) |
595 | 721 | ||
722 | static inline void netif_napi_add(struct net_device *dev, | ||
723 | struct napi_struct *napi, | ||
724 | int (*poll)(struct napi_struct *, int), | ||
725 | int weight) | ||
726 | { | ||
727 | INIT_LIST_HEAD(&napi->poll_list); | ||
728 | napi->poll = poll; | ||
729 | napi->weight = weight; | ||
730 | #ifdef CONFIG_NETPOLL | ||
731 | napi->dev = dev; | ||
732 | list_add(&napi->dev_list, &dev->napi_list); | ||
733 | spin_lock_init(&napi->poll_lock); | ||
734 | napi->poll_owner = -1; | ||
735 | #endif | ||
736 | set_bit(NAPI_STATE_SCHED, &napi->state); | ||
737 | } | ||
738 | |||
596 | struct packet_type { | 739 | struct packet_type { |
597 | __be16 type; /* This is really htons(ether_type). */ | 740 | __be16 type; /* This is really htons(ether_type). */ |
598 | struct net_device *dev; /* NULL is wildcarded here */ | 741 | struct net_device *dev; /* NULL is wildcarded here */ |
@@ -610,45 +753,46 @@ struct packet_type { | |||
610 | #include <linux/interrupt.h> | 753 | #include <linux/interrupt.h> |
611 | #include <linux/notifier.h> | 754 | #include <linux/notifier.h> |
612 | 755 | ||
613 | extern struct net_device loopback_dev; /* The loopback */ | ||
614 | extern struct list_head dev_base_head; /* All devices */ | ||
615 | extern rwlock_t dev_base_lock; /* Device list lock */ | 756 | extern rwlock_t dev_base_lock; /* Device list lock */ |
616 | 757 | ||
617 | #define for_each_netdev(d) \ | 758 | |
618 | list_for_each_entry(d, &dev_base_head, dev_list) | 759 | #define for_each_netdev(net, d) \ |
619 | #define for_each_netdev_safe(d, n) \ | 760 | list_for_each_entry(d, &(net)->dev_base_head, dev_list) |
620 | list_for_each_entry_safe(d, n, &dev_base_head, dev_list) | 761 | #define for_each_netdev_safe(net, d, n) \ |
621 | #define for_each_netdev_continue(d) \ | 762 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) |
622 | list_for_each_entry_continue(d, &dev_base_head, dev_list) | 763 | #define for_each_netdev_continue(net, d) \ |
764 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | ||
623 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 765 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
624 | 766 | ||
625 | static inline struct net_device *next_net_device(struct net_device *dev) | 767 | static inline struct net_device *next_net_device(struct net_device *dev) |
626 | { | 768 | { |
627 | struct list_head *lh; | 769 | struct list_head *lh; |
770 | struct net *net; | ||
628 | 771 | ||
772 | net = dev->nd_net; | ||
629 | lh = dev->dev_list.next; | 773 | lh = dev->dev_list.next; |
630 | return lh == &dev_base_head ? NULL : net_device_entry(lh); | 774 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
631 | } | 775 | } |
632 | 776 | ||
633 | static inline struct net_device *first_net_device(void) | 777 | static inline struct net_device *first_net_device(struct net *net) |
634 | { | 778 | { |
635 | return list_empty(&dev_base_head) ? NULL : | 779 | return list_empty(&net->dev_base_head) ? NULL : |
636 | net_device_entry(dev_base_head.next); | 780 | net_device_entry(net->dev_base_head.next); |
637 | } | 781 | } |
638 | 782 | ||
639 | extern int netdev_boot_setup_check(struct net_device *dev); | 783 | extern int netdev_boot_setup_check(struct net_device *dev); |
640 | extern unsigned long netdev_boot_base(const char *prefix, int unit); | 784 | extern unsigned long netdev_boot_base(const char *prefix, int unit); |
641 | extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); | 785 | extern struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr); |
642 | extern struct net_device *dev_getfirstbyhwtype(unsigned short type); | 786 | extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); |
643 | extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); | 787 | extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); |
644 | extern void dev_add_pack(struct packet_type *pt); | 788 | extern void dev_add_pack(struct packet_type *pt); |
645 | extern void dev_remove_pack(struct packet_type *pt); | 789 | extern void dev_remove_pack(struct packet_type *pt); |
646 | extern void __dev_remove_pack(struct packet_type *pt); | 790 | extern void __dev_remove_pack(struct packet_type *pt); |
647 | 791 | ||
648 | extern struct net_device *dev_get_by_flags(unsigned short flags, | 792 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, |
649 | unsigned short mask); | 793 | unsigned short mask); |
650 | extern struct net_device *dev_get_by_name(const char *name); | 794 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); |
651 | extern struct net_device *__dev_get_by_name(const char *name); | 795 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); |
652 | extern int dev_alloc_name(struct net_device *dev, const char *name); | 796 | extern int dev_alloc_name(struct net_device *dev, const char *name); |
653 | extern int dev_open(struct net_device *dev); | 797 | extern int dev_open(struct net_device *dev); |
654 | extern int dev_close(struct net_device *dev); | 798 | extern int dev_close(struct net_device *dev); |
@@ -659,14 +803,35 @@ extern void free_netdev(struct net_device *dev); | |||
659 | extern void synchronize_net(void); | 803 | extern void synchronize_net(void); |
660 | extern int register_netdevice_notifier(struct notifier_block *nb); | 804 | extern int register_netdevice_notifier(struct notifier_block *nb); |
661 | extern int unregister_netdevice_notifier(struct notifier_block *nb); | 805 | extern int unregister_netdevice_notifier(struct notifier_block *nb); |
662 | extern int call_netdevice_notifiers(unsigned long val, void *v); | 806 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
663 | extern struct net_device *dev_get_by_index(int ifindex); | 807 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
664 | extern struct net_device *__dev_get_by_index(int ifindex); | 808 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
665 | extern int dev_restart(struct net_device *dev); | 809 | extern int dev_restart(struct net_device *dev); |
666 | #ifdef CONFIG_NETPOLL_TRAP | 810 | #ifdef CONFIG_NETPOLL_TRAP |
667 | extern int netpoll_trap(void); | 811 | extern int netpoll_trap(void); |
668 | #endif | 812 | #endif |
669 | 813 | ||
814 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | ||
815 | unsigned short type, | ||
816 | const void *daddr, const void *saddr, | ||
817 | unsigned len) | ||
818 | { | ||
819 | if (!dev->header_ops) | ||
820 | return 0; | ||
821 | |||
822 | return dev->header_ops->create(skb, dev, type, daddr, saddr, len); | ||
823 | } | ||
824 | |||
825 | static inline int dev_parse_header(const struct sk_buff *skb, | ||
826 | unsigned char *haddr) | ||
827 | { | ||
828 | const struct net_device *dev = skb->dev; | ||
829 | |||
830 | if (!dev->header_ops->parse) | ||
831 | return 0; | ||
832 | return dev->header_ops->parse(skb, haddr); | ||
833 | } | ||
834 | |||
670 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); | 835 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); |
671 | extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); | 836 | extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); |
672 | static inline int unregister_gifconf(unsigned int family) | 837 | static inline int unregister_gifconf(unsigned int family) |
@@ -678,7 +843,6 @@ static inline int unregister_gifconf(unsigned int family) | |||
678 | * Incoming packets are placed on per-cpu queues so that | 843 | * Incoming packets are placed on per-cpu queues so that |
679 | * no locking is needed. | 844 | * no locking is needed. |
680 | */ | 845 | */ |
681 | |||
682 | struct softnet_data | 846 | struct softnet_data |
683 | { | 847 | { |
684 | struct net_device *output_queue; | 848 | struct net_device *output_queue; |
@@ -686,7 +850,7 @@ struct softnet_data | |||
686 | struct list_head poll_list; | 850 | struct list_head poll_list; |
687 | struct sk_buff *completion_queue; | 851 | struct sk_buff *completion_queue; |
688 | 852 | ||
689 | struct net_device backlog_dev; /* Sorry. 8) */ | 853 | struct napi_struct backlog; |
690 | #ifdef CONFIG_NET_DMA | 854 | #ifdef CONFIG_NET_DMA |
691 | struct dma_chan *net_dma; | 855 | struct dma_chan *net_dma; |
692 | #endif | 856 | #endif |
@@ -704,11 +868,24 @@ static inline void netif_schedule(struct net_device *dev) | |||
704 | __netif_schedule(dev); | 868 | __netif_schedule(dev); |
705 | } | 869 | } |
706 | 870 | ||
871 | /** | ||
872 | * netif_start_queue - allow transmit | ||
873 | * @dev: network device | ||
874 | * | ||
875 | * Allow upper layers to call the device hard_start_xmit routine. | ||
876 | */ | ||
707 | static inline void netif_start_queue(struct net_device *dev) | 877 | static inline void netif_start_queue(struct net_device *dev) |
708 | { | 878 | { |
709 | clear_bit(__LINK_STATE_XOFF, &dev->state); | 879 | clear_bit(__LINK_STATE_XOFF, &dev->state); |
710 | } | 880 | } |
711 | 881 | ||
882 | /** | ||
883 | * netif_wake_queue - restart transmit | ||
884 | * @dev: network device | ||
885 | * | ||
886 | * Allow upper layers to call the device hard_start_xmit routine. | ||
887 | * Used for flow control when transmit resources are available. | ||
888 | */ | ||
712 | static inline void netif_wake_queue(struct net_device *dev) | 889 | static inline void netif_wake_queue(struct net_device *dev) |
713 | { | 890 | { |
714 | #ifdef CONFIG_NETPOLL_TRAP | 891 | #ifdef CONFIG_NETPOLL_TRAP |
@@ -721,16 +898,35 @@ static inline void netif_wake_queue(struct net_device *dev) | |||
721 | __netif_schedule(dev); | 898 | __netif_schedule(dev); |
722 | } | 899 | } |
723 | 900 | ||
901 | /** | ||
902 | * netif_stop_queue - stop transmitted packets | ||
903 | * @dev: network device | ||
904 | * | ||
905 | * Stop upper layers calling the device hard_start_xmit routine. | ||
906 | * Used for flow control when transmit resources are unavailable. | ||
907 | */ | ||
724 | static inline void netif_stop_queue(struct net_device *dev) | 908 | static inline void netif_stop_queue(struct net_device *dev) |
725 | { | 909 | { |
726 | set_bit(__LINK_STATE_XOFF, &dev->state); | 910 | set_bit(__LINK_STATE_XOFF, &dev->state); |
727 | } | 911 | } |
728 | 912 | ||
913 | /** | ||
914 | * netif_queue_stopped - test if transmit queue is flowblocked | ||
915 | * @dev: network device | ||
916 | * | ||
917 | * Test if transmit queue on device is currently unable to send. | ||
918 | */ | ||
729 | static inline int netif_queue_stopped(const struct net_device *dev) | 919 | static inline int netif_queue_stopped(const struct net_device *dev) |
730 | { | 920 | { |
731 | return test_bit(__LINK_STATE_XOFF, &dev->state); | 921 | return test_bit(__LINK_STATE_XOFF, &dev->state); |
732 | } | 922 | } |
733 | 923 | ||
924 | /** | ||
925 | * netif_running - test if up | ||
926 | * @dev: network device | ||
927 | * | ||
928 | * Test if the device has been brought up. | ||
929 | */ | ||
734 | static inline int netif_running(const struct net_device *dev) | 930 | static inline int netif_running(const struct net_device *dev) |
735 | { | 931 | { |
736 | return test_bit(__LINK_STATE_START, &dev->state); | 932 | return test_bit(__LINK_STATE_START, &dev->state); |
@@ -742,6 +938,14 @@ static inline int netif_running(const struct net_device *dev) | |||
742 | * done at the overall netdevice level. | 938 | * done at the overall netdevice level. |
743 | * Also test the device if we're multiqueue. | 939 | * Also test the device if we're multiqueue. |
744 | */ | 940 | */ |
941 | |||
942 | /** | ||
943 | * netif_start_subqueue - allow sending packets on subqueue | ||
944 | * @dev: network device | ||
945 | * @queue_index: sub queue index | ||
946 | * | ||
947 | * Start individual transmit queue of a device with multiple transmit queues. | ||
948 | */ | ||
745 | static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) | 949 | static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) |
746 | { | 950 | { |
747 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 951 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE |
@@ -749,6 +953,13 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) | |||
749 | #endif | 953 | #endif |
750 | } | 954 | } |
751 | 955 | ||
956 | /** | ||
957 | * netif_stop_subqueue - stop sending packets on subqueue | ||
958 | * @dev: network device | ||
959 | * @queue_index: sub queue index | ||
960 | * | ||
961 | * Stop individual transmit queue of a device with multiple transmit queues. | ||
962 | */ | ||
752 | static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | 963 | static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) |
753 | { | 964 | { |
754 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 965 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE |
@@ -760,6 +971,13 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | |||
760 | #endif | 971 | #endif |
761 | } | 972 | } |
762 | 973 | ||
974 | /** | ||
975 | * netif_subqueue_stopped - test status of subqueue | ||
976 | * @dev: network device | ||
977 | * @queue_index: sub queue index | ||
978 | * | ||
979 | * Check individual transmit queue of a device with multiple transmit queues. | ||
980 | */ | ||
763 | static inline int netif_subqueue_stopped(const struct net_device *dev, | 981 | static inline int netif_subqueue_stopped(const struct net_device *dev, |
764 | u16 queue_index) | 982 | u16 queue_index) |
765 | { | 983 | { |
@@ -771,6 +989,14 @@ static inline int netif_subqueue_stopped(const struct net_device *dev, | |||
771 | #endif | 989 | #endif |
772 | } | 990 | } |
773 | 991 | ||
992 | |||
993 | /** | ||
994 | * netif_wake_subqueue - allow sending packets on subqueue | ||
995 | * @dev: network device | ||
996 | * @queue_index: sub queue index | ||
997 | * | ||
998 | * Resume individual transmit queue of a device with multiple transmit queues. | ||
999 | */ | ||
774 | static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | 1000 | static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) |
775 | { | 1001 | { |
776 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1002 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE |
@@ -784,6 +1010,13 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
784 | #endif | 1010 | #endif |
785 | } | 1011 | } |
786 | 1012 | ||
1013 | /** | ||
1014 | * netif_is_multiqueue - test if device has multiple transmit queues | ||
1015 | * @dev: network device | ||
1016 | * | ||
1017 | * Check if device has multiple transmit queues | ||
1018 | * Always falls if NETDEVICE_MULTIQUEUE is not configured | ||
1019 | */ | ||
787 | static inline int netif_is_multiqueue(const struct net_device *dev) | 1020 | static inline int netif_is_multiqueue(const struct net_device *dev) |
788 | { | 1021 | { |
789 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 1022 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE |
@@ -796,20 +1029,7 @@ static inline int netif_is_multiqueue(const struct net_device *dev) | |||
796 | /* Use this variant when it is known for sure that it | 1029 | /* Use this variant when it is known for sure that it |
797 | * is executing from interrupt context. | 1030 | * is executing from interrupt context. |
798 | */ | 1031 | */ |
799 | static inline void dev_kfree_skb_irq(struct sk_buff *skb) | 1032 | extern void dev_kfree_skb_irq(struct sk_buff *skb); |
800 | { | ||
801 | if (atomic_dec_and_test(&skb->users)) { | ||
802 | struct softnet_data *sd; | ||
803 | unsigned long flags; | ||
804 | |||
805 | local_irq_save(flags); | ||
806 | sd = &__get_cpu_var(softnet_data); | ||
807 | skb->next = sd->completion_queue; | ||
808 | sd->completion_queue = skb; | ||
809 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | ||
810 | local_irq_restore(flags); | ||
811 | } | ||
812 | } | ||
813 | 1033 | ||
814 | /* Use this variant in places where it could be invoked | 1034 | /* Use this variant in places where it could be invoked |
815 | * either from interrupt or non-interrupt context. | 1035 | * either from interrupt or non-interrupt context. |
@@ -822,29 +1042,41 @@ extern int netif_rx_ni(struct sk_buff *skb); | |||
822 | #define HAVE_NETIF_RECEIVE_SKB 1 | 1042 | #define HAVE_NETIF_RECEIVE_SKB 1 |
823 | extern int netif_receive_skb(struct sk_buff *skb); | 1043 | extern int netif_receive_skb(struct sk_buff *skb); |
824 | extern int dev_valid_name(const char *name); | 1044 | extern int dev_valid_name(const char *name); |
825 | extern int dev_ioctl(unsigned int cmd, void __user *); | 1045 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
826 | extern int dev_ethtool(struct ifreq *); | 1046 | extern int dev_ethtool(struct net *net, struct ifreq *); |
827 | extern unsigned dev_get_flags(const struct net_device *); | 1047 | extern unsigned dev_get_flags(const struct net_device *); |
828 | extern int dev_change_flags(struct net_device *, unsigned); | 1048 | extern int dev_change_flags(struct net_device *, unsigned); |
829 | extern int dev_change_name(struct net_device *, char *); | 1049 | extern int dev_change_name(struct net_device *, char *); |
1050 | extern int dev_change_net_namespace(struct net_device *, | ||
1051 | struct net *, const char *); | ||
830 | extern int dev_set_mtu(struct net_device *, int); | 1052 | extern int dev_set_mtu(struct net_device *, int); |
831 | extern int dev_set_mac_address(struct net_device *, | 1053 | extern int dev_set_mac_address(struct net_device *, |
832 | struct sockaddr *); | 1054 | struct sockaddr *); |
833 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 1055 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
834 | struct net_device *dev); | 1056 | struct net_device *dev); |
835 | 1057 | ||
836 | extern void dev_init(void); | ||
837 | |||
838 | extern int netdev_budget; | 1058 | extern int netdev_budget; |
839 | 1059 | ||
840 | /* Called by rtnetlink.c:rtnl_unlock() */ | 1060 | /* Called by rtnetlink.c:rtnl_unlock() */ |
841 | extern void netdev_run_todo(void); | 1061 | extern void netdev_run_todo(void); |
842 | 1062 | ||
1063 | /** | ||
1064 | * dev_put - release reference to device | ||
1065 | * @dev: network device | ||
1066 | * | ||
1067 | * Release reference to device to allow it to be freed. | ||
1068 | */ | ||
843 | static inline void dev_put(struct net_device *dev) | 1069 | static inline void dev_put(struct net_device *dev) |
844 | { | 1070 | { |
845 | atomic_dec(&dev->refcnt); | 1071 | atomic_dec(&dev->refcnt); |
846 | } | 1072 | } |
847 | 1073 | ||
1074 | /** | ||
1075 | * dev_hold - get reference to device | ||
1076 | * @dev: network device | ||
1077 | * | ||
1078 | * Hold reference to device to keep it from being freed. | ||
1079 | */ | ||
848 | static inline void dev_hold(struct net_device *dev) | 1080 | static inline void dev_hold(struct net_device *dev) |
849 | { | 1081 | { |
850 | atomic_inc(&dev->refcnt); | 1082 | atomic_inc(&dev->refcnt); |
@@ -861,6 +1093,12 @@ static inline void dev_hold(struct net_device *dev) | |||
861 | 1093 | ||
862 | extern void linkwatch_fire_event(struct net_device *dev); | 1094 | extern void linkwatch_fire_event(struct net_device *dev); |
863 | 1095 | ||
1096 | /** | ||
1097 | * netif_carrier_ok - test if carrier present | ||
1098 | * @dev: network device | ||
1099 | * | ||
1100 | * Check if carrier is present on device | ||
1101 | */ | ||
864 | static inline int netif_carrier_ok(const struct net_device *dev) | 1102 | static inline int netif_carrier_ok(const struct net_device *dev) |
865 | { | 1103 | { |
866 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); | 1104 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); |
@@ -872,30 +1110,66 @@ extern void netif_carrier_on(struct net_device *dev); | |||
872 | 1110 | ||
873 | extern void netif_carrier_off(struct net_device *dev); | 1111 | extern void netif_carrier_off(struct net_device *dev); |
874 | 1112 | ||
1113 | /** | ||
1114 | * netif_dormant_on - mark device as dormant. | ||
1115 | * @dev: network device | ||
1116 | * | ||
1117 | * Mark device as dormant (as per RFC2863). | ||
1118 | * | ||
1119 | * The dormant state indicates that the relevant interface is not | ||
1120 | * actually in a condition to pass packets (i.e., it is not 'up') but is | ||
1121 | * in a "pending" state, waiting for some external event. For "on- | ||
1122 | * demand" interfaces, this new state identifies the situation where the | ||
1123 | * interface is waiting for events to place it in the up state. | ||
1124 | * | ||
1125 | */ | ||
875 | static inline void netif_dormant_on(struct net_device *dev) | 1126 | static inline void netif_dormant_on(struct net_device *dev) |
876 | { | 1127 | { |
877 | if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) | 1128 | if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) |
878 | linkwatch_fire_event(dev); | 1129 | linkwatch_fire_event(dev); |
879 | } | 1130 | } |
880 | 1131 | ||
1132 | /** | ||
1133 | * netif_dormant_off - set device as not dormant. | ||
1134 | * @dev: network device | ||
1135 | * | ||
1136 | * Device is not in dormant state. | ||
1137 | */ | ||
881 | static inline void netif_dormant_off(struct net_device *dev) | 1138 | static inline void netif_dormant_off(struct net_device *dev) |
882 | { | 1139 | { |
883 | if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) | 1140 | if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) |
884 | linkwatch_fire_event(dev); | 1141 | linkwatch_fire_event(dev); |
885 | } | 1142 | } |
886 | 1143 | ||
1144 | /** | ||
1145 | * netif_dormant - test if carrier present | ||
1146 | * @dev: network device | ||
1147 | * | ||
1148 | * Check if carrier is present on device | ||
1149 | */ | ||
887 | static inline int netif_dormant(const struct net_device *dev) | 1150 | static inline int netif_dormant(const struct net_device *dev) |
888 | { | 1151 | { |
889 | return test_bit(__LINK_STATE_DORMANT, &dev->state); | 1152 | return test_bit(__LINK_STATE_DORMANT, &dev->state); |
890 | } | 1153 | } |
891 | 1154 | ||
892 | 1155 | ||
1156 | /** | ||
1157 | * netif_oper_up - test if device is operational | ||
1158 | * @dev: network device | ||
1159 | * | ||
1160 | * Check if carrier is operational | ||
1161 | */ | ||
893 | static inline int netif_oper_up(const struct net_device *dev) { | 1162 | static inline int netif_oper_up(const struct net_device *dev) { |
894 | return (dev->operstate == IF_OPER_UP || | 1163 | return (dev->operstate == IF_OPER_UP || |
895 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 1164 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
896 | } | 1165 | } |
897 | 1166 | ||
898 | /* Hot-plugging. */ | 1167 | /** |
1168 | * netif_device_present - is device available or removed | ||
1169 | * @dev: network device | ||
1170 | * | ||
1171 | * Check if device has not been removed from system. | ||
1172 | */ | ||
899 | static inline int netif_device_present(struct net_device *dev) | 1173 | static inline int netif_device_present(struct net_device *dev) |
900 | { | 1174 | { |
901 | return test_bit(__LINK_STATE_PRESENT, &dev->state); | 1175 | return test_bit(__LINK_STATE_PRESENT, &dev->state); |
@@ -955,46 +1229,38 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) | |||
955 | return (1 << debug_value) - 1; | 1229 | return (1 << debug_value) - 1; |
956 | } | 1230 | } |
957 | 1231 | ||
958 | /* Test if receive needs to be scheduled */ | ||
959 | static inline int __netif_rx_schedule_prep(struct net_device *dev) | ||
960 | { | ||
961 | return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state); | ||
962 | } | ||
963 | |||
964 | /* Test if receive needs to be scheduled but only if up */ | 1232 | /* Test if receive needs to be scheduled but only if up */ |
965 | static inline int netif_rx_schedule_prep(struct net_device *dev) | 1233 | static inline int netif_rx_schedule_prep(struct net_device *dev, |
1234 | struct napi_struct *napi) | ||
966 | { | 1235 | { |
967 | return netif_running(dev) && __netif_rx_schedule_prep(dev); | 1236 | return netif_running(dev) && napi_schedule_prep(napi); |
968 | } | 1237 | } |
969 | 1238 | ||
970 | /* Add interface to tail of rx poll list. This assumes that _prep has | 1239 | /* Add interface to tail of rx poll list. This assumes that _prep has |
971 | * already been called and returned 1. | 1240 | * already been called and returned 1. |
972 | */ | 1241 | */ |
973 | 1242 | static inline void __netif_rx_schedule(struct net_device *dev, | |
974 | extern void __netif_rx_schedule(struct net_device *dev); | 1243 | struct napi_struct *napi) |
1244 | { | ||
1245 | dev_hold(dev); | ||
1246 | __napi_schedule(napi); | ||
1247 | } | ||
975 | 1248 | ||
976 | /* Try to reschedule poll. Called by irq handler. */ | 1249 | /* Try to reschedule poll. Called by irq handler. */ |
977 | 1250 | ||
978 | static inline void netif_rx_schedule(struct net_device *dev) | 1251 | static inline void netif_rx_schedule(struct net_device *dev, |
1252 | struct napi_struct *napi) | ||
979 | { | 1253 | { |
980 | if (netif_rx_schedule_prep(dev)) | 1254 | if (netif_rx_schedule_prep(dev, napi)) |
981 | __netif_rx_schedule(dev); | 1255 | __netif_rx_schedule(dev, napi); |
982 | } | 1256 | } |
983 | 1257 | ||
984 | /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). | 1258 | /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ |
985 | * Do not inline this? | 1259 | static inline int netif_rx_reschedule(struct net_device *dev, |
986 | */ | 1260 | struct napi_struct *napi) |
987 | static inline int netif_rx_reschedule(struct net_device *dev, int undo) | ||
988 | { | 1261 | { |
989 | if (netif_rx_schedule_prep(dev)) { | 1262 | if (napi_schedule_prep(napi)) { |
990 | unsigned long flags; | 1263 | __netif_rx_schedule(dev, napi); |
991 | |||
992 | dev->quota += undo; | ||
993 | |||
994 | local_irq_save(flags); | ||
995 | list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); | ||
996 | __raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||
997 | local_irq_restore(flags); | ||
998 | return 1; | 1264 | return 1; |
999 | } | 1265 | } |
1000 | return 0; | 1266 | return 0; |
@@ -1003,12 +1269,11 @@ static inline int netif_rx_reschedule(struct net_device *dev, int undo) | |||
1003 | /* same as netif_rx_complete, except that local_irq_save(flags) | 1269 | /* same as netif_rx_complete, except that local_irq_save(flags) |
1004 | * has already been issued | 1270 | * has already been issued |
1005 | */ | 1271 | */ |
1006 | static inline void __netif_rx_complete(struct net_device *dev) | 1272 | static inline void __netif_rx_complete(struct net_device *dev, |
1273 | struct napi_struct *napi) | ||
1007 | { | 1274 | { |
1008 | BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | 1275 | __napi_complete(napi); |
1009 | list_del(&dev->poll_list); | 1276 | dev_put(dev); |
1010 | smp_mb__before_clear_bit(); | ||
1011 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | ||
1012 | } | 1277 | } |
1013 | 1278 | ||
1014 | /* Remove interface from poll list: it must be in the poll list | 1279 | /* Remove interface from poll list: it must be in the poll list |
@@ -1016,32 +1281,31 @@ static inline void __netif_rx_complete(struct net_device *dev) | |||
1016 | * it completes the work. The device cannot be out of poll list at this | 1281 | * it completes the work. The device cannot be out of poll list at this |
1017 | * moment, it is BUG(). | 1282 | * moment, it is BUG(). |
1018 | */ | 1283 | */ |
1019 | static inline void netif_rx_complete(struct net_device *dev) | 1284 | static inline void netif_rx_complete(struct net_device *dev, |
1285 | struct napi_struct *napi) | ||
1020 | { | 1286 | { |
1021 | unsigned long flags; | 1287 | unsigned long flags; |
1022 | 1288 | ||
1023 | local_irq_save(flags); | 1289 | local_irq_save(flags); |
1024 | __netif_rx_complete(dev); | 1290 | __netif_rx_complete(dev, napi); |
1025 | local_irq_restore(flags); | 1291 | local_irq_restore(flags); |
1026 | } | 1292 | } |
1027 | 1293 | ||
1028 | static inline void netif_poll_disable(struct net_device *dev) | 1294 | /** |
1029 | { | 1295 | * netif_tx_lock - grab network device transmit lock |
1030 | while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) | 1296 | * @dev: network device |
1031 | /* No hurry. */ | 1297 | * |
1032 | schedule_timeout_interruptible(1); | 1298 | * Get network device transmit lock |
1033 | } | 1299 | */ |
1034 | 1300 | static inline void __netif_tx_lock(struct net_device *dev, int cpu) | |
1035 | static inline void netif_poll_enable(struct net_device *dev) | ||
1036 | { | 1301 | { |
1037 | smp_mb__before_clear_bit(); | 1302 | spin_lock(&dev->_xmit_lock); |
1038 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | 1303 | dev->xmit_lock_owner = cpu; |
1039 | } | 1304 | } |
1040 | 1305 | ||
1041 | static inline void netif_tx_lock(struct net_device *dev) | 1306 | static inline void netif_tx_lock(struct net_device *dev) |
1042 | { | 1307 | { |
1043 | spin_lock(&dev->_xmit_lock); | 1308 | __netif_tx_lock(dev, smp_processor_id()); |
1044 | dev->xmit_lock_owner = smp_processor_id(); | ||
1045 | } | 1309 | } |
1046 | 1310 | ||
1047 | static inline void netif_tx_lock_bh(struct net_device *dev) | 1311 | static inline void netif_tx_lock_bh(struct net_device *dev) |
@@ -1070,6 +1334,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev) | |||
1070 | spin_unlock_bh(&dev->_xmit_lock); | 1334 | spin_unlock_bh(&dev->_xmit_lock); |
1071 | } | 1335 | } |
1072 | 1336 | ||
1337 | #define HARD_TX_LOCK(dev, cpu) { \ | ||
1338 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1339 | __netif_tx_lock(dev, cpu); \ | ||
1340 | } \ | ||
1341 | } | ||
1342 | |||
1343 | #define HARD_TX_UNLOCK(dev) { \ | ||
1344 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1345 | netif_tx_unlock(dev); \ | ||
1346 | } \ | ||
1347 | } | ||
1348 | |||
1073 | static inline void netif_tx_disable(struct net_device *dev) | 1349 | static inline void netif_tx_disable(struct net_device *dev) |
1074 | { | 1350 | { |
1075 | netif_tx_lock_bh(dev); | 1351 | netif_tx_lock_bh(dev); |
@@ -1105,7 +1381,7 @@ extern void dev_set_allmulti(struct net_device *dev, int inc); | |||
1105 | extern void netdev_state_change(struct net_device *dev); | 1381 | extern void netdev_state_change(struct net_device *dev); |
1106 | extern void netdev_features_change(struct net_device *dev); | 1382 | extern void netdev_features_change(struct net_device *dev); |
1107 | /* Load a device via the kmod */ | 1383 | /* Load a device via the kmod */ |
1108 | extern void dev_load(const char *name); | 1384 | extern void dev_load(struct net *net, const char *name); |
1109 | extern void dev_mcast_init(void); | 1385 | extern void dev_mcast_init(void); |
1110 | extern int netdev_max_backlog; | 1386 | extern int netdev_max_backlog; |
1111 | extern int weight_p; | 1387 | extern int weight_p; |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index ab57cb7d7c61..f2eaea2234ec 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -40,5 +40,6 @@ unifdef-y += nf_conntrack_common.h | |||
40 | unifdef-y += nf_conntrack_ftp.h | 40 | unifdef-y += nf_conntrack_ftp.h |
41 | unifdef-y += nf_conntrack_tcp.h | 41 | unifdef-y += nf_conntrack_tcp.h |
42 | unifdef-y += nfnetlink.h | 42 | unifdef-y += nfnetlink.h |
43 | unifdef-y += nfnetlink_compat.h | ||
43 | unifdef-y += x_tables.h | 44 | unifdef-y += x_tables.h |
44 | unifdef-y += xt_physdev.h | 45 | unifdef-y += xt_physdev.h |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 0f9311df1559..0d8424f76899 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -1,16 +1,7 @@ | |||
1 | #ifndef _NFNETLINK_H | 1 | #ifndef _NFNETLINK_H |
2 | #define _NFNETLINK_H | 2 | #define _NFNETLINK_H |
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | 4 | #include <linux/netfilter/nfnetlink_compat.h> | |
5 | #ifndef __KERNEL__ | ||
6 | /* nfnetlink groups: Up to 32 maximum - backwards compatibility for userspace */ | ||
7 | #define NF_NETLINK_CONNTRACK_NEW 0x00000001 | ||
8 | #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 | ||
9 | #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 | ||
10 | #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 | ||
11 | #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 | ||
12 | #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 | ||
13 | #endif | ||
14 | 5 | ||
15 | enum nfnetlink_groups { | 6 | enum nfnetlink_groups { |
16 | NFNLGRP_NONE, | 7 | NFNLGRP_NONE, |
@@ -31,48 +22,6 @@ enum nfnetlink_groups { | |||
31 | }; | 22 | }; |
32 | #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) | 23 | #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) |
33 | 24 | ||
34 | /* Generic structure for encapsulation optional netfilter information. | ||
35 | * It is reminiscent of sockaddr, but with sa_family replaced | ||
36 | * with attribute type. | ||
37 | * ! This should someday be put somewhere generic as now rtnetlink and | ||
38 | * ! nfnetlink use the same attributes methods. - J. Schulist. | ||
39 | */ | ||
40 | |||
41 | struct nfattr | ||
42 | { | ||
43 | u_int16_t nfa_len; | ||
44 | u_int16_t nfa_type; /* we use 15 bits for the type, and the highest | ||
45 | * bit to indicate whether the payload is nested */ | ||
46 | }; | ||
47 | |||
48 | /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from | ||
49 | * rtnetlink.h, it's time to put this in a generic file */ | ||
50 | |||
51 | #define NFNL_NFA_NEST 0x8000 | ||
52 | #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) | ||
53 | |||
54 | #define NFA_ALIGNTO 4 | ||
55 | #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) | ||
56 | #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ | ||
57 | && (nfa)->nfa_len <= (len)) | ||
58 | #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ | ||
59 | (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) | ||
60 | #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) | ||
61 | #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) | ||
62 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | ||
63 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | ||
64 | #define NFA_NEST(skb, type) \ | ||
65 | ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ | ||
66 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | ||
67 | __start; }) | ||
68 | #define NFA_NEST_END(skb, start) \ | ||
69 | ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ | ||
70 | (skb)->len; }) | ||
71 | #define NFA_NEST_CANCEL(skb, start) \ | ||
72 | ({ if (start) \ | ||
73 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | ||
74 | -1; }) | ||
75 | |||
76 | /* General form of address family dependent message. | 25 | /* General form of address family dependent message. |
77 | */ | 26 | */ |
78 | struct nfgenmsg { | 27 | struct nfgenmsg { |
@@ -83,10 +32,6 @@ struct nfgenmsg { | |||
83 | 32 | ||
84 | #define NFNETLINK_V0 0 | 33 | #define NFNETLINK_V0 0 |
85 | 34 | ||
86 | #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ | ||
87 | + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) | ||
88 | #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) | ||
89 | |||
90 | /* netfilter netlink message types are split in two pieces: | 35 | /* netfilter netlink message types are split in two pieces: |
91 | * 8 bit subsystem, 8bit operation. | 36 | * 8 bit subsystem, 8bit operation. |
92 | */ | 37 | */ |
@@ -107,49 +52,26 @@ struct nfgenmsg { | |||
107 | 52 | ||
108 | #include <linux/netlink.h> | 53 | #include <linux/netlink.h> |
109 | #include <linux/capability.h> | 54 | #include <linux/capability.h> |
55 | #include <net/netlink.h> | ||
110 | 56 | ||
111 | struct nfnl_callback | 57 | struct nfnl_callback |
112 | { | 58 | { |
113 | int (*call)(struct sock *nl, struct sk_buff *skb, | 59 | int (*call)(struct sock *nl, struct sk_buff *skb, |
114 | struct nlmsghdr *nlh, struct nfattr *cda[]); | 60 | struct nlmsghdr *nlh, struct nlattr *cda[]); |
115 | u_int16_t attr_count; /* number of nfattr's */ | 61 | const struct nla_policy *policy; /* netlink attribute policy */ |
62 | const u_int16_t attr_count; /* number of nlattr's */ | ||
116 | }; | 63 | }; |
117 | 64 | ||
118 | struct nfnetlink_subsystem | 65 | struct nfnetlink_subsystem |
119 | { | 66 | { |
120 | const char *name; | 67 | const char *name; |
121 | __u8 subsys_id; /* nfnetlink subsystem ID */ | 68 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
122 | __u8 cb_count; /* number of callbacks */ | 69 | __u8 cb_count; /* number of callbacks */ |
123 | struct nfnl_callback *cb; /* callback for individual types */ | 70 | const struct nfnl_callback *cb; /* callback for individual types */ |
124 | }; | 71 | }; |
125 | 72 | ||
126 | extern void __nfa_fill(struct sk_buff *skb, int attrtype, | 73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
127 | int attrlen, const void *data); | 74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
128 | #define NFA_PUT(skb, attrtype, attrlen, data) \ | ||
129 | ({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ | ||
130 | __nfa_fill(skb, attrtype, attrlen, data); }) | ||
131 | |||
132 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | ||
133 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | ||
134 | |||
135 | extern void nfattr_parse(struct nfattr *tb[], int maxattr, | ||
136 | struct nfattr *nfa, int len); | ||
137 | |||
138 | #define nfattr_parse_nested(tb, max, nfa) \ | ||
139 | nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa))) | ||
140 | |||
141 | #define nfattr_bad_size(tb, max, cta_min) \ | ||
142 | ({ int __i, __res = 0; \ | ||
143 | for (__i=0; __i<max; __i++) { \ | ||
144 | if (!cta_min[__i]) \ | ||
145 | continue; \ | ||
146 | if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \ | ||
147 | __res = 1; \ | ||
148 | break; \ | ||
149 | } \ | ||
150 | } \ | ||
151 | __res; \ | ||
152 | }) | ||
153 | 75 | ||
154 | extern int nfnetlink_has_listeners(unsigned int group); | 76 | extern int nfnetlink_has_listeners(unsigned int group); |
155 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | 77 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, |
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h new file mode 100644 index 000000000000..02a42d875cf7 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_compat.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _NFNETLINK_COMPAT_H | ||
2 | #define _NFNETLINK_COMPAT_H | ||
3 | #ifndef __KERNEL | ||
4 | /* Old nfnetlink macros for userspace */ | ||
5 | |||
6 | /* nfnetlink groups: Up to 32 maximum */ | ||
7 | #define NF_NETLINK_CONNTRACK_NEW 0x00000001 | ||
8 | #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 | ||
9 | #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 | ||
10 | #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 | ||
11 | #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 | ||
12 | #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 | ||
13 | |||
14 | /* Generic structure for encapsulation optional netfilter information. | ||
15 | * It is reminiscent of sockaddr, but with sa_family replaced | ||
16 | * with attribute type. | ||
17 | * ! This should someday be put somewhere generic as now rtnetlink and | ||
18 | * ! nfnetlink use the same attributes methods. - J. Schulist. | ||
19 | */ | ||
20 | |||
21 | struct nfattr | ||
22 | { | ||
23 | u_int16_t nfa_len; | ||
24 | u_int16_t nfa_type; /* we use 15 bits for the type, and the highest | ||
25 | * bit to indicate whether the payload is nested */ | ||
26 | }; | ||
27 | |||
28 | /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from | ||
29 | * rtnetlink.h, it's time to put this in a generic file */ | ||
30 | |||
31 | #define NFNL_NFA_NEST 0x8000 | ||
32 | #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) | ||
33 | |||
34 | #define NFA_ALIGNTO 4 | ||
35 | #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) | ||
36 | #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ | ||
37 | && (nfa)->nfa_len <= (len)) | ||
38 | #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ | ||
39 | (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) | ||
40 | #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) | ||
41 | #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) | ||
42 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | ||
43 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | ||
44 | #define NFA_NEST(skb, type) \ | ||
45 | ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ | ||
46 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | ||
47 | __start; }) | ||
48 | #define NFA_NEST_END(skb, start) \ | ||
49 | ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ | ||
50 | (skb)->len; }) | ||
51 | #define NFA_NEST_CANCEL(skb, start) \ | ||
52 | ({ if (start) \ | ||
53 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | ||
54 | -1; }) | ||
55 | |||
56 | #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ | ||
57 | + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) | ||
58 | #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) | ||
59 | |||
60 | #endif /* ! __KERNEL__ */ | ||
61 | #endif /* _NFNETLINK_COMPAT_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index d7c35039721e..4affa3fe78e0 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -36,6 +36,7 @@ enum ctattr_type { | |||
36 | CTA_USE, | 36 | CTA_USE, |
37 | CTA_ID, | 37 | CTA_ID, |
38 | CTA_NAT_DST, | 38 | CTA_NAT_DST, |
39 | CTA_TUPLE_MASTER, | ||
39 | __CTA_MAX | 40 | __CTA_MAX |
40 | }; | 41 | }; |
41 | #define CTA_MAX (__CTA_MAX - 1) | 42 | #define CTA_MAX (__CTA_MAX - 1) |
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h new file mode 100644 index 000000000000..14b6df412c9f --- /dev/null +++ b/include/linux/netfilter/xt_time.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _XT_TIME_H | ||
2 | #define _XT_TIME_H 1 | ||
3 | |||
4 | struct xt_time_info { | ||
5 | u_int32_t date_start; | ||
6 | u_int32_t date_stop; | ||
7 | u_int32_t daytime_start; | ||
8 | u_int32_t daytime_stop; | ||
9 | u_int32_t monthdays_match; | ||
10 | u_int8_t weekdays_match; | ||
11 | u_int8_t flags; | ||
12 | }; | ||
13 | |||
14 | enum { | ||
15 | /* Match against local time (instead of UTC) */ | ||
16 | XT_TIME_LOCAL_TZ = 1 << 0, | ||
17 | |||
18 | /* Shortcuts */ | ||
19 | XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, | ||
20 | XT_TIME_ALL_WEEKDAYS = 0xFE, | ||
21 | XT_TIME_MIN_DAYTIME = 0, | ||
22 | XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, | ||
23 | }; | ||
24 | |||
25 | #endif /* _XT_TIME_H */ | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 83d8239f0cce..7c1f3b1d2ee5 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #define MAX_LINKS 32 | 28 | #define MAX_LINKS 32 |
29 | 29 | ||
30 | struct net; | ||
31 | |||
30 | struct sockaddr_nl | 32 | struct sockaddr_nl |
31 | { | 33 | { |
32 | sa_family_t nl_family; /* AF_NETLINK */ | 34 | sa_family_t nl_family; /* AF_NETLINK */ |
@@ -129,6 +131,20 @@ struct nlattr | |||
129 | __u16 nla_type; | 131 | __u16 nla_type; |
130 | }; | 132 | }; |
131 | 133 | ||
134 | /* | ||
135 | * nla_type (16 bits) | ||
136 | * +---+---+-------------------------------+ | ||
137 | * | N | O | Attribute Type | | ||
138 | * +---+---+-------------------------------+ | ||
139 | * N := Carries nested attributes | ||
140 | * O := Payload stored in network byte order | ||
141 | * | ||
142 | * Note: The N and O flag are mutually exclusive. | ||
143 | */ | ||
144 | #define NLA_F_NESTED (1 << 15) | ||
145 | #define NLA_F_NET_BYTEORDER (1 << 14) | ||
146 | #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) | ||
147 | |||
132 | #define NLA_ALIGNTO 4 | 148 | #define NLA_ALIGNTO 4 |
133 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) | 149 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) |
134 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) | 150 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) |
@@ -157,8 +173,9 @@ struct netlink_skb_parms | |||
157 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) | 173 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) |
158 | 174 | ||
159 | 175 | ||
160 | extern struct sock *netlink_kernel_create(int unit, unsigned int groups, | 176 | extern struct sock *netlink_kernel_create(struct net *net, |
161 | void (*input)(struct sock *sk, int len), | 177 | int unit,unsigned int groups, |
178 | void (*input)(struct sk_buff *skb), | ||
162 | struct mutex *cb_mutex, | 179 | struct mutex *cb_mutex, |
163 | struct module *module); | 180 | struct module *module); |
164 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); | 181 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); |
@@ -177,7 +194,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp); | |||
177 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | 194 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, |
178 | long timeo, struct sock *ssk); | 195 | long timeo, struct sock *ssk); |
179 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); | 196 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); |
180 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); | 197 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb); |
181 | 198 | ||
182 | /* | 199 | /* |
183 | * skb should fit one page. This choice is good for headerless malloc. | 200 | * skb should fit one page. This choice is good for headerless malloc. |
@@ -206,6 +223,7 @@ struct netlink_callback | |||
206 | 223 | ||
207 | struct netlink_notify | 224 | struct netlink_notify |
208 | { | 225 | { |
226 | struct net *net; | ||
209 | int pid; | 227 | int pid; |
210 | int protocol; | 228 | int protocol; |
211 | }; | 229 | }; |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 29930b71a9aa..20250d963d72 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -25,8 +25,6 @@ struct netpoll { | |||
25 | 25 | ||
26 | struct netpoll_info { | 26 | struct netpoll_info { |
27 | atomic_t refcnt; | 27 | atomic_t refcnt; |
28 | spinlock_t poll_lock; | ||
29 | int poll_owner; | ||
30 | int rx_flags; | 28 | int rx_flags; |
31 | spinlock_t rx_lock; | 29 | spinlock_t rx_lock; |
32 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 30 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ |
@@ -37,6 +35,7 @@ struct netpoll_info { | |||
37 | 35 | ||
38 | void netpoll_poll(struct netpoll *np); | 36 | void netpoll_poll(struct netpoll *np); |
39 | void netpoll_send_udp(struct netpoll *np, const char *msg, int len); | 37 | void netpoll_send_udp(struct netpoll *np, const char *msg, int len); |
38 | void netpoll_print_options(struct netpoll *np); | ||
40 | int netpoll_parse_options(struct netpoll *np, char *opt); | 39 | int netpoll_parse_options(struct netpoll *np, char *opt); |
41 | int netpoll_setup(struct netpoll *np); | 40 | int netpoll_setup(struct netpoll *np); |
42 | int netpoll_trap(void); | 41 | int netpoll_trap(void); |
@@ -64,32 +63,61 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
64 | return ret; | 63 | return ret; |
65 | } | 64 | } |
66 | 65 | ||
67 | static inline void *netpoll_poll_lock(struct net_device *dev) | 66 | static inline int netpoll_receive_skb(struct sk_buff *skb) |
68 | { | 67 | { |
68 | if (!list_empty(&skb->dev->napi_list)) | ||
69 | return netpoll_rx(skb); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static inline void *netpoll_poll_lock(struct napi_struct *napi) | ||
74 | { | ||
75 | struct net_device *dev = napi->dev; | ||
76 | |||
69 | rcu_read_lock(); /* deal with race on ->npinfo */ | 77 | rcu_read_lock(); /* deal with race on ->npinfo */ |
70 | if (dev->npinfo) { | 78 | if (dev && dev->npinfo) { |
71 | spin_lock(&dev->npinfo->poll_lock); | 79 | spin_lock(&napi->poll_lock); |
72 | dev->npinfo->poll_owner = smp_processor_id(); | 80 | napi->poll_owner = smp_processor_id(); |
73 | return dev->npinfo; | 81 | return napi; |
74 | } | 82 | } |
75 | return NULL; | 83 | return NULL; |
76 | } | 84 | } |
77 | 85 | ||
78 | static inline void netpoll_poll_unlock(void *have) | 86 | static inline void netpoll_poll_unlock(void *have) |
79 | { | 87 | { |
80 | struct netpoll_info *npi = have; | 88 | struct napi_struct *napi = have; |
81 | 89 | ||
82 | if (npi) { | 90 | if (napi) { |
83 | npi->poll_owner = -1; | 91 | napi->poll_owner = -1; |
84 | spin_unlock(&npi->poll_lock); | 92 | spin_unlock(&napi->poll_lock); |
85 | } | 93 | } |
86 | rcu_read_unlock(); | 94 | rcu_read_unlock(); |
87 | } | 95 | } |
88 | 96 | ||
97 | static inline void netpoll_netdev_init(struct net_device *dev) | ||
98 | { | ||
99 | INIT_LIST_HEAD(&dev->napi_list); | ||
100 | } | ||
101 | |||
89 | #else | 102 | #else |
90 | #define netpoll_rx(a) 0 | 103 | static inline int netpoll_rx(struct sk_buff *skb) |
91 | #define netpoll_poll_lock(a) NULL | 104 | { |
92 | #define netpoll_poll_unlock(a) | 105 | return 0; |
106 | } | ||
107 | static inline int netpoll_receive_skb(struct sk_buff *skb) | ||
108 | { | ||
109 | return 0; | ||
110 | } | ||
111 | static inline void *netpoll_poll_lock(struct napi_struct *napi) | ||
112 | { | ||
113 | return NULL; | ||
114 | } | ||
115 | static inline void netpoll_poll_unlock(void *have) | ||
116 | { | ||
117 | } | ||
118 | static inline void netpoll_netdev_init(struct net_device *dev) | ||
119 | { | ||
120 | } | ||
93 | #endif | 121 | #endif |
94 | 122 | ||
95 | #endif | 123 | #endif |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 9a30ba2ca75e..538ee1dd3d0a 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -7,7 +7,97 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * enum nl80211_commands - supported nl80211 commands | ||
11 | * | ||
12 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | ||
13 | * | ||
14 | * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request | ||
15 | * to get a list of all present wiphys. | ||
16 | * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and | ||
17 | * %NL80211_ATTR_WIPHY_NAME. | ||
18 | * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request | ||
19 | * or rename notification. Has attributes %NL80211_ATTR_WIPHY and | ||
20 | * %NL80211_ATTR_WIPHY_NAME. | ||
21 | * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes | ||
22 | * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. | ||
23 | * | ||
24 | * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; | ||
25 | * either a dump request on a %NL80211_ATTR_WIPHY or a specific get | ||
26 | * on an %NL80211_ATTR_IFINDEX is supported. | ||
27 | * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires | ||
28 | * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. | ||
29 | * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response | ||
30 | * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, | ||
31 | * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also | ||
32 | * be sent from userspace to request creation of a new virtual interface, | ||
33 | * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and | ||
34 | * %NL80211_ATTR_IFNAME. | ||
35 | * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes | ||
36 | * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from | ||
37 | * userspace to request deletion of a virtual interface, then requires | ||
38 | * attribute %NL80211_ATTR_IFINDEX. | ||
39 | * | ||
40 | * @NL80211_CMD_MAX: highest used command number | ||
41 | * @__NL80211_CMD_AFTER_LAST: internal use | ||
42 | */ | ||
43 | enum nl80211_commands { | ||
44 | /* don't change the order or add anything inbetween, this is ABI! */ | ||
45 | NL80211_CMD_UNSPEC, | ||
46 | |||
47 | NL80211_CMD_GET_WIPHY, /* can dump */ | ||
48 | NL80211_CMD_SET_WIPHY, | ||
49 | NL80211_CMD_NEW_WIPHY, | ||
50 | NL80211_CMD_DEL_WIPHY, | ||
51 | |||
52 | NL80211_CMD_GET_INTERFACE, /* can dump */ | ||
53 | NL80211_CMD_SET_INTERFACE, | ||
54 | NL80211_CMD_NEW_INTERFACE, | ||
55 | NL80211_CMD_DEL_INTERFACE, | ||
56 | |||
57 | /* add commands here */ | ||
58 | |||
59 | /* used to define NL80211_CMD_MAX below */ | ||
60 | __NL80211_CMD_AFTER_LAST, | ||
61 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 | ||
62 | }; | ||
63 | |||
64 | |||
65 | /** | ||
66 | * enum nl80211_attrs - nl80211 netlink attributes | ||
67 | * | ||
68 | * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors | ||
69 | * | ||
70 | * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. | ||
71 | * /sys/class/ieee80211/<phyname>/index | ||
72 | * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) | ||
73 | * | ||
74 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on | ||
75 | * @NL80211_ATTR_IFNAME: network interface name | ||
76 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype | ||
77 | * | ||
78 | * @NL80211_ATTR_MAX: highest attribute number currently defined | ||
79 | * @__NL80211_ATTR_AFTER_LAST: internal use | ||
80 | */ | ||
81 | enum nl80211_attrs { | ||
82 | /* don't change the order or add anything inbetween, this is ABI! */ | ||
83 | NL80211_ATTR_UNSPEC, | ||
84 | |||
85 | NL80211_ATTR_WIPHY, | ||
86 | NL80211_ATTR_WIPHY_NAME, | ||
87 | |||
88 | NL80211_ATTR_IFINDEX, | ||
89 | NL80211_ATTR_IFNAME, | ||
90 | NL80211_ATTR_IFTYPE, | ||
91 | |||
92 | /* add attributes here, update the policy in nl80211.c */ | ||
93 | |||
94 | __NL80211_ATTR_AFTER_LAST, | ||
95 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | ||
96 | }; | ||
97 | |||
98 | /** | ||
10 | * enum nl80211_iftype - (virtual) interface types | 99 | * enum nl80211_iftype - (virtual) interface types |
100 | * | ||
11 | * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides | 101 | * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides |
12 | * @NL80211_IFTYPE_ADHOC: independent BSS member | 102 | * @NL80211_IFTYPE_ADHOC: independent BSS member |
13 | * @NL80211_IFTYPE_STATION: managed BSS member | 103 | * @NL80211_IFTYPE_STATION: managed BSS member |
@@ -15,9 +105,10 @@ | |||
15 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points | 105 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points |
16 | * @NL80211_IFTYPE_WDS: wireless distribution interface | 106 | * @NL80211_IFTYPE_WDS: wireless distribution interface |
17 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames | 107 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames |
108 | * @NL80211_IFTYPE_MAX: highest interface type number currently defined | ||
18 | * @__NL80211_IFTYPE_AFTER_LAST: internal use | 109 | * @__NL80211_IFTYPE_AFTER_LAST: internal use |
19 | * | 110 | * |
20 | * These values are used with the NL80211_ATTR_IFTYPE | 111 | * These values are used with the %NL80211_ATTR_IFTYPE |
21 | * to set the type of an interface. | 112 | * to set the type of an interface. |
22 | * | 113 | * |
23 | */ | 114 | */ |
@@ -31,8 +122,8 @@ enum nl80211_iftype { | |||
31 | NL80211_IFTYPE_MONITOR, | 122 | NL80211_IFTYPE_MONITOR, |
32 | 123 | ||
33 | /* keep last */ | 124 | /* keep last */ |
34 | __NL80211_IFTYPE_AFTER_LAST | 125 | __NL80211_IFTYPE_AFTER_LAST, |
126 | NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 | ||
35 | }; | 127 | }; |
36 | #define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1) | ||
37 | 128 | ||
38 | #endif /* __LINUX_NL80211_H */ | 129 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index ce06188b7a56..bec4485e3d76 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h | |||
@@ -29,6 +29,7 @@ struct nsproxy { | |||
29 | struct mnt_namespace *mnt_ns; | 29 | struct mnt_namespace *mnt_ns; |
30 | struct pid_namespace *pid_ns; | 30 | struct pid_namespace *pid_ns; |
31 | struct user_namespace *user_ns; | 31 | struct user_namespace *user_ns; |
32 | struct net *net_ns; | ||
32 | }; | 33 | }; |
33 | extern struct nsproxy init_nsproxy; | 34 | extern struct nsproxy init_nsproxy; |
34 | 35 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index cfee06bca2d3..8acae4eeaa76 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1848,6 +1848,8 @@ | |||
1848 | #define PCI_VENDOR_ID_ABOCOM 0x13D1 | 1848 | #define PCI_VENDOR_ID_ABOCOM 0x13D1 |
1849 | #define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 | 1849 | #define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 |
1850 | 1850 | ||
1851 | #define PCI_VENDOR_ID_SUNDANCE 0x13f0 | ||
1852 | |||
1851 | #define PCI_VENDOR_ID_CMEDIA 0x13f6 | 1853 | #define PCI_VENDOR_ID_CMEDIA 0x13f6 |
1852 | #define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 | 1854 | #define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 |
1853 | #define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 | 1855 | #define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 |
@@ -1955,8 +1957,12 @@ | |||
1955 | #define PCI_DEVICE_ID_TIGON3_5751M 0x167d | 1957 | #define PCI_DEVICE_ID_TIGON3_5751M 0x167d |
1956 | #define PCI_DEVICE_ID_TIGON3_5751F 0x167e | 1958 | #define PCI_DEVICE_ID_TIGON3_5751F 0x167e |
1957 | #define PCI_DEVICE_ID_TIGON3_5787F 0x167f | 1959 | #define PCI_DEVICE_ID_TIGON3_5787F 0x167f |
1960 | #define PCI_DEVICE_ID_TIGON3_5761E 0x1680 | ||
1961 | #define PCI_DEVICE_ID_TIGON3_5761 0x1681 | ||
1962 | #define PCI_DEVICE_ID_TIGON3_5764 0x1684 | ||
1958 | #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 | 1963 | #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 |
1959 | #define PCI_DEVICE_ID_TIGON3_5782 0x1696 | 1964 | #define PCI_DEVICE_ID_TIGON3_5782 0x1696 |
1965 | #define PCI_DEVICE_ID_TIGON3_5784 0x1698 | ||
1960 | #define PCI_DEVICE_ID_TIGON3_5786 0x169a | 1966 | #define PCI_DEVICE_ID_TIGON3_5786 0x169a |
1961 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b | 1967 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b |
1962 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c | 1968 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c |
@@ -2130,6 +2136,11 @@ | |||
2130 | #define PCI_VENDOR_ID_TEKRAM 0x1de1 | 2136 | #define PCI_VENDOR_ID_TEKRAM 0x1de1 |
2131 | #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 | 2137 | #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 |
2132 | 2138 | ||
2139 | #define PCI_VENDOR_ID_TEHUTI 0x1fc9 | ||
2140 | #define PCI_DEVICE_ID_TEHUTI_3009 0x3009 | ||
2141 | #define PCI_DEVICE_ID_TEHUTI_3010 0x3010 | ||
2142 | #define PCI_DEVICE_ID_TEHUTI_3014 0x3014 | ||
2143 | |||
2133 | #define PCI_VENDOR_ID_HINT 0x3388 | 2144 | #define PCI_VENDOR_ID_HINT 0x3388 |
2134 | #define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 | 2145 | #define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 |
2135 | 2146 | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 495d368390e0..423d592c55d5 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -316,7 +316,20 @@ | |||
316 | #define PCI_X_CMD 2 /* Modes & Features */ | 316 | #define PCI_X_CMD 2 /* Modes & Features */ |
317 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ | 317 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ |
318 | #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ | 318 | #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ |
319 | #define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ | ||
320 | #define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ | ||
321 | #define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ | ||
322 | #define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ | ||
319 | #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ | 323 | #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ |
324 | /* Max # of outstanding split transactions */ | ||
325 | #define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ | ||
326 | #define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ | ||
327 | #define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ | ||
328 | #define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ | ||
329 | #define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ | ||
330 | #define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ | ||
331 | #define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ | ||
332 | #define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ | ||
320 | #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ | 333 | #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ |
321 | #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ | 334 | #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ |
322 | #define PCI_X_STATUS 4 /* PCI-X capabilities */ | 335 | #define PCI_X_STATUS 4 /* PCI-X capabilities */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 2a659789f9ca..f0742b6aaa64 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
27 | 27 | ||
28 | #include <asm/atomic.h> | ||
29 | |||
28 | #define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ | 30 | #define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ |
29 | SUPPORTED_10baseT_Full | \ | 31 | SUPPORTED_10baseT_Full | \ |
30 | SUPPORTED_100baseT_Half | \ | 32 | SUPPORTED_100baseT_Half | \ |
@@ -281,6 +283,7 @@ struct phy_device { | |||
281 | /* Interrupt and Polling infrastructure */ | 283 | /* Interrupt and Polling infrastructure */ |
282 | struct work_struct phy_queue; | 284 | struct work_struct phy_queue; |
283 | struct timer_list phy_timer; | 285 | struct timer_list phy_timer; |
286 | atomic_t irq_disable; | ||
284 | 287 | ||
285 | spinlock_t lock; | 288 | spinlock_t lock; |
286 | 289 | ||
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h new file mode 100644 index 000000000000..04ba70d49fb8 --- /dev/null +++ b/include/linux/phy_fixed.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef __PHY_FIXED_H | ||
2 | #define __PHY_FIXED_H | ||
3 | |||
4 | #define MII_REGS_NUM 29 | ||
5 | |||
6 | /* max number of virtual phy stuff */ | ||
7 | #define MAX_PHY_AMNT 10 | ||
8 | /* | ||
9 | The idea is to emulate normal phy behavior by responding with | ||
10 | pre-defined values to mii BMCR read, so that read_status hook could | ||
11 | take all the needed info. | ||
12 | */ | ||
13 | |||
14 | struct fixed_phy_status { | ||
15 | u8 link; | ||
16 | u16 speed; | ||
17 | u8 duplex; | ||
18 | }; | ||
19 | |||
20 | /*----------------------------------------------------------------------------- | ||
21 | * Private information hoder for mii_bus | ||
22 | *-----------------------------------------------------------------------------*/ | ||
23 | struct fixed_info { | ||
24 | u16 *regs; | ||
25 | u8 regs_num; | ||
26 | struct fixed_phy_status phy_status; | ||
27 | struct phy_device *phydev; /* pointer to the container */ | ||
28 | /* link & speed cb */ | ||
29 | int (*link_update) (struct net_device *, struct fixed_phy_status *); | ||
30 | |||
31 | }; | ||
32 | |||
33 | |||
34 | int fixed_mdio_set_link_update(struct phy_device *, | ||
35 | int (*link_update) (struct net_device *, struct fixed_phy_status *)); | ||
36 | struct fixed_info *fixed_mdio_get_phydev (int phydev_ind); | ||
37 | |||
38 | #endif /* __PHY_FIXED_H */ | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 268c51599eb8..919af93b7059 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -77,8 +77,8 @@ struct tc_ratespec | |||
77 | { | 77 | { |
78 | unsigned char cell_log; | 78 | unsigned char cell_log; |
79 | unsigned char __reserved; | 79 | unsigned char __reserved; |
80 | unsigned short feature; | 80 | unsigned short overhead; |
81 | short addend; | 81 | short cell_align; |
82 | unsigned short mpu; | 82 | unsigned short mpu; |
83 | __u32 rate; | 83 | __u32 rate; |
84 | }; | 84 | }; |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index cd13a78c5db8..20741f668f7b 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/magic.h> | 7 | #include <linux/magic.h> |
8 | #include <asm/atomic.h> | 8 | #include <asm/atomic.h> |
9 | 9 | ||
10 | struct net; | ||
10 | struct completion; | 11 | struct completion; |
11 | 12 | ||
12 | /* | 13 | /* |
@@ -97,8 +98,6 @@ struct vmcore { | |||
97 | 98 | ||
98 | extern struct proc_dir_entry proc_root; | 99 | extern struct proc_dir_entry proc_root; |
99 | extern struct proc_dir_entry *proc_root_fs; | 100 | extern struct proc_dir_entry *proc_root_fs; |
100 | extern struct proc_dir_entry *proc_net; | ||
101 | extern struct proc_dir_entry *proc_net_stat; | ||
102 | extern struct proc_dir_entry *proc_bus; | 101 | extern struct proc_dir_entry *proc_bus; |
103 | extern struct proc_dir_entry *proc_root_driver; | 102 | extern struct proc_dir_entry *proc_root_driver; |
104 | extern struct proc_dir_entry *proc_root_kcore; | 103 | extern struct proc_dir_entry *proc_root_kcore; |
@@ -192,36 +191,21 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | |||
192 | if (res) res->get_info=get_info; | 191 | if (res) res->get_info=get_info; |
193 | return res; | 192 | return res; |
194 | } | 193 | } |
195 | |||
196 | static inline struct proc_dir_entry *proc_net_create(const char *name, | ||
197 | mode_t mode, get_info_t *get_info) | ||
198 | { | ||
199 | return create_proc_info_entry(name,mode,proc_net,get_info); | ||
200 | } | ||
201 | 194 | ||
202 | static inline struct proc_dir_entry *proc_net_fops_create(const char *name, | 195 | extern struct proc_dir_entry *proc_net_create(struct net *net, |
203 | mode_t mode, const struct file_operations *fops) | 196 | const char *name, mode_t mode, get_info_t *get_info); |
204 | { | 197 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, |
205 | struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); | 198 | const char *name, mode_t mode, const struct file_operations *fops); |
206 | if (res) | 199 | extern void proc_net_remove(struct net *net, const char *name); |
207 | res->proc_fops = fops; | ||
208 | return res; | ||
209 | } | ||
210 | |||
211 | static inline void proc_net_remove(const char *name) | ||
212 | { | ||
213 | remove_proc_entry(name,proc_net); | ||
214 | } | ||
215 | 200 | ||
216 | #else | 201 | #else |
217 | 202 | ||
218 | #define proc_root_driver NULL | 203 | #define proc_root_driver NULL |
219 | #define proc_net NULL | ||
220 | #define proc_bus NULL | 204 | #define proc_bus NULL |
221 | 205 | ||
222 | #define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; }) | 206 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) |
223 | #define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) | 207 | #define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; }) |
224 | static inline void proc_net_remove(const char *name) {} | 208 | static inline void proc_net_remove(struct net *net, const char *name) {} |
225 | 209 | ||
226 | static inline void proc_flush_task(struct task_struct *task) { } | 210 | static inline void proc_flush_task(struct task_struct *task) { } |
227 | 211 | ||
@@ -281,6 +265,13 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode) | |||
281 | return PROC_I(inode)->pde; | 265 | return PROC_I(inode)->pde; |
282 | } | 266 | } |
283 | 267 | ||
268 | static inline struct net *PDE_NET(struct proc_dir_entry *pde) | ||
269 | { | ||
270 | return pde->parent->data; | ||
271 | } | ||
272 | |||
273 | struct net *get_proc_net(const struct inode *inode); | ||
274 | |||
284 | struct proc_maps_private { | 275 | struct proc_maps_private { |
285 | struct pid *pid; | 276 | struct pid *pid; |
286 | struct task_struct *task; | 277 | struct task_struct *task; |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index a8a6ea809da0..0ce5e0b52dbd 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __RFKILL_H | 2 | #define __RFKILL_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (C) 2006 Ivo van Doorn | 5 | * Copyright (C) 2006 - 2007 Ivo van Doorn |
6 | * Copyright (C) 2007 Dmitry Torokhov | 6 | * Copyright (C) 2007 Dmitry Torokhov |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -26,18 +26,19 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/device.h> | 28 | #include <linux/device.h> |
29 | #include <linux/leds.h> | ||
29 | 30 | ||
30 | /** | 31 | /** |
31 | * enum rfkill_type - type of rfkill switch. | 32 | * enum rfkill_type - type of rfkill switch. |
32 | * RFKILL_TYPE_WLAN: switch is no a Wireless network devices. | 33 | * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. |
33 | * RFKILL_TYPE_BlUETOOTH: switch is on a bluetooth device. | 34 | * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. |
34 | * RFKILL_TYPE_IRDA: switch is on an infrared devices. | 35 | * RFKILL_TYPE_UWB: switch is on a ultra wideband device. |
35 | */ | 36 | */ |
36 | enum rfkill_type { | 37 | enum rfkill_type { |
37 | RFKILL_TYPE_WLAN = 0, | 38 | RFKILL_TYPE_WLAN , |
38 | RFKILL_TYPE_BLUETOOTH = 1, | 39 | RFKILL_TYPE_BLUETOOTH, |
39 | RFKILL_TYPE_IRDA = 2, | 40 | RFKILL_TYPE_UWB, |
40 | RFKILL_TYPE_MAX = 3, | 41 | RFKILL_TYPE_MAX, |
41 | }; | 42 | }; |
42 | 43 | ||
43 | enum rfkill_state { | 44 | enum rfkill_state { |
@@ -51,11 +52,14 @@ enum rfkill_state { | |||
51 | * @type: Radio type which the button controls, the value stored | 52 | * @type: Radio type which the button controls, the value stored |
52 | * here should be a value from enum rfkill_type. | 53 | * here should be a value from enum rfkill_type. |
53 | * @state: State of the switch (on/off). | 54 | * @state: State of the switch (on/off). |
55 | * @user_claim_unsupported: Whether the hardware supports exclusive | ||
56 | * RF-kill control by userspace. Set this before registering. | ||
54 | * @user_claim: Set when the switch is controlled exlusively by userspace. | 57 | * @user_claim: Set when the switch is controlled exlusively by userspace. |
55 | * @mutex: Guards switch state transitions | 58 | * @mutex: Guards switch state transitions |
56 | * @data: Pointer to the RF button drivers private data which will be | 59 | * @data: Pointer to the RF button drivers private data which will be |
57 | * passed along when toggling radio state. | 60 | * passed along when toggling radio state. |
58 | * @toggle_radio(): Mandatory handler to control state of the radio. | 61 | * @toggle_radio(): Mandatory handler to control state of the radio. |
62 | * @led_trigger: A LED trigger for this button's LED. | ||
59 | * @dev: Device structure integrating the switch into device tree. | 63 | * @dev: Device structure integrating the switch into device tree. |
60 | * @node: Used to place switch into list of all switches known to the | 64 | * @node: Used to place switch into list of all switches known to the |
61 | * the system. | 65 | * the system. |
@@ -67,6 +71,7 @@ struct rfkill { | |||
67 | enum rfkill_type type; | 71 | enum rfkill_type type; |
68 | 72 | ||
69 | enum rfkill_state state; | 73 | enum rfkill_state state; |
74 | bool user_claim_unsupported; | ||
70 | bool user_claim; | 75 | bool user_claim; |
71 | 76 | ||
72 | struct mutex mutex; | 77 | struct mutex mutex; |
@@ -74,6 +79,10 @@ struct rfkill { | |||
74 | void *data; | 79 | void *data; |
75 | int (*toggle_radio)(void *data, enum rfkill_state state); | 80 | int (*toggle_radio)(void *data, enum rfkill_state state); |
76 | 81 | ||
82 | #ifdef CONFIG_RFKILL_LEDS | ||
83 | struct led_trigger led_trigger; | ||
84 | #endif | ||
85 | |||
77 | struct device dev; | 86 | struct device dev; |
78 | struct list_head node; | 87 | struct list_head node; |
79 | }; | 88 | }; |
@@ -84,6 +93,19 @@ void rfkill_free(struct rfkill *rfkill); | |||
84 | int rfkill_register(struct rfkill *rfkill); | 93 | int rfkill_register(struct rfkill *rfkill); |
85 | void rfkill_unregister(struct rfkill *rfkill); | 94 | void rfkill_unregister(struct rfkill *rfkill); |
86 | 95 | ||
87 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); | 96 | /** |
97 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. | ||
98 | * This function might return a NULL pointer if registering of the | ||
99 | * LED trigger failed. | ||
100 | * Use this as "default_trigger" for the LED. | ||
101 | */ | ||
102 | static inline char *rfkill_get_led_name(struct rfkill *rfkill) | ||
103 | { | ||
104 | #ifdef CONFIG_RFKILL_LEDS | ||
105 | return (char *)(rfkill->led_trigger.name); | ||
106 | #else | ||
107 | return NULL; | ||
108 | #endif | ||
109 | } | ||
88 | 110 | ||
89 | #endif /* RFKILL_H */ | 111 | #endif /* RFKILL_H */ |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index dff3192374f8..5bf618241ab9 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -97,6 +97,9 @@ enum { | |||
97 | RTM_SETNEIGHTBL, | 97 | RTM_SETNEIGHTBL, |
98 | #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL | 98 | #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL |
99 | 99 | ||
100 | RTM_NEWNDUSEROPT = 68, | ||
101 | #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT | ||
102 | |||
100 | __RTM_MAX, | 103 | __RTM_MAX, |
101 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) | 104 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) |
102 | }; | 105 | }; |
@@ -479,6 +482,30 @@ enum | |||
479 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) | 482 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) |
480 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) | 483 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) |
481 | 484 | ||
485 | /******************************************************************** | ||
486 | * Neighbor Discovery userland options | ||
487 | ****/ | ||
488 | |||
489 | struct nduseroptmsg | ||
490 | { | ||
491 | unsigned char nduseropt_family; | ||
492 | unsigned char nduseropt_pad1; | ||
493 | unsigned short nduseropt_opts_len; /* Total length of options */ | ||
494 | __u8 nduseropt_icmp_type; | ||
495 | __u8 nduseropt_icmp_code; | ||
496 | unsigned short nduseropt_pad2; | ||
497 | /* Followed by one or more ND options */ | ||
498 | }; | ||
499 | |||
500 | enum | ||
501 | { | ||
502 | NDUSEROPT_UNSPEC, | ||
503 | NDUSEROPT_SRCADDR, | ||
504 | __NDUSEROPT_MAX | ||
505 | }; | ||
506 | |||
507 | #define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) | ||
508 | |||
482 | #ifndef __KERNEL__ | 509 | #ifndef __KERNEL__ |
483 | /* RTnetlink multicast groups - backwards compatibility for userspace */ | 510 | /* RTnetlink multicast groups - backwards compatibility for userspace */ |
484 | #define RTMGRP_LINK 1 | 511 | #define RTMGRP_LINK 1 |
@@ -542,6 +569,8 @@ enum rtnetlink_groups { | |||
542 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX | 569 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX |
543 | RTNLGRP_IPV6_RULE, | 570 | RTNLGRP_IPV6_RULE, |
544 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE | 571 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE |
572 | RTNLGRP_ND_USEROPT, | ||
573 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT | ||
545 | __RTNLGRP_MAX | 574 | __RTNLGRP_MAX |
546 | }; | 575 | }; |
547 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 576 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 313c6b6e774f..833f7dc2b8de 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define CLONE_NEWUTS 0x04000000 /* New utsname group? */ | 27 | #define CLONE_NEWUTS 0x04000000 /* New utsname group? */ |
28 | #define CLONE_NEWIPC 0x08000000 /* New ipcs */ | 28 | #define CLONE_NEWIPC 0x08000000 /* New ipcs */ |
29 | #define CLONE_NEWUSER 0x10000000 /* New user namespace */ | 29 | #define CLONE_NEWUSER 0x10000000 /* New user namespace */ |
30 | #define CLONE_NEWNET 0x40000000 /* New network namespace */ | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Scheduling policies | 33 | * Scheduling policies |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index d70df61a029f..5eb38cc0e5a4 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -102,6 +102,9 @@ typedef enum { | |||
102 | SCTP_CID_ECN_CWR = 13, | 102 | SCTP_CID_ECN_CWR = 13, |
103 | SCTP_CID_SHUTDOWN_COMPLETE = 14, | 103 | SCTP_CID_SHUTDOWN_COMPLETE = 14, |
104 | 104 | ||
105 | /* AUTH Extension Section 4.1 */ | ||
106 | SCTP_CID_AUTH = 0x0F, | ||
107 | |||
105 | /* PR-SCTP Sec 3.2 */ | 108 | /* PR-SCTP Sec 3.2 */ |
106 | SCTP_CID_FWD_TSN = 0xC0, | 109 | SCTP_CID_FWD_TSN = 0xC0, |
107 | 110 | ||
@@ -180,6 +183,14 @@ typedef enum { | |||
180 | SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12), | 183 | SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12), |
181 | SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000), | 184 | SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000), |
182 | 185 | ||
186 | /* AUTH Extension Section 3 */ | ||
187 | SCTP_PARAM_RANDOM = __constant_htons(0x8002), | ||
188 | SCTP_PARAM_CHUNKS = __constant_htons(0x8003), | ||
189 | SCTP_PARAM_HMAC_ALGO = __constant_htons(0x8004), | ||
190 | |||
191 | /* Add-IP: Supported Extensions, Section 4.2 */ | ||
192 | SCTP_PARAM_SUPPORTED_EXT = __constant_htons(0x8008), | ||
193 | |||
183 | /* PR-SCTP Sec 3.1 */ | 194 | /* PR-SCTP Sec 3.1 */ |
184 | SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000), | 195 | SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000), |
185 | 196 | ||
@@ -296,6 +307,30 @@ typedef struct sctp_adaptation_ind_param { | |||
296 | __be32 adaptation_ind; | 307 | __be32 adaptation_ind; |
297 | } __attribute__((packed)) sctp_adaptation_ind_param_t; | 308 | } __attribute__((packed)) sctp_adaptation_ind_param_t; |
298 | 309 | ||
310 | /* ADDIP Section 4.2.7 Supported Extensions Parameter */ | ||
311 | typedef struct sctp_supported_ext_param { | ||
312 | struct sctp_paramhdr param_hdr; | ||
313 | __u8 chunks[0]; | ||
314 | } __attribute__((packed)) sctp_supported_ext_param_t; | ||
315 | |||
316 | /* AUTH Section 3.1 Random */ | ||
317 | typedef struct sctp_random_param { | ||
318 | sctp_paramhdr_t param_hdr; | ||
319 | __u8 random_val[0]; | ||
320 | } __attribute__((packed)) sctp_random_param_t; | ||
321 | |||
322 | /* AUTH Section 3.2 Chunk List */ | ||
323 | typedef struct sctp_chunks_param { | ||
324 | sctp_paramhdr_t param_hdr; | ||
325 | __u8 chunks[0]; | ||
326 | } __attribute__((packed)) sctp_chunks_param_t; | ||
327 | |||
328 | /* AUTH Section 3.3 HMAC Algorithm */ | ||
329 | typedef struct sctp_hmac_algo_param { | ||
330 | sctp_paramhdr_t param_hdr; | ||
331 | __be16 hmac_ids[0]; | ||
332 | } __attribute__((packed)) sctp_hmac_algo_param_t; | ||
333 | |||
299 | /* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): | 334 | /* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): |
300 | * The INIT ACK chunk is used to acknowledge the initiation of an SCTP | 335 | * The INIT ACK chunk is used to acknowledge the initiation of an SCTP |
301 | * association. | 336 | * association. |
@@ -462,7 +497,19 @@ typedef enum { | |||
462 | SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101), | 497 | SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101), |
463 | SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102), | 498 | SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102), |
464 | SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103), | 499 | SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103), |
465 | SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104) | 500 | SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104), |
501 | |||
502 | /* AUTH Section 4. New Error Cause | ||
503 | * | ||
504 | * This section defines a new error cause that will be sent if an AUTH | ||
505 | * chunk is received with an unsupported HMAC identifier. | ||
506 | * illustrates the new error cause. | ||
507 | * | ||
508 | * Cause Code Error Cause Name | ||
509 | * -------------------------------------------------------------- | ||
510 | * 0x0105 Unsupported HMAC Identifier | ||
511 | */ | ||
512 | SCTP_ERROR_UNSUP_HMAC = __constant_htons(0x0105) | ||
466 | } sctp_error_t; | 513 | } sctp_error_t; |
467 | 514 | ||
468 | 515 | ||
@@ -600,4 +647,64 @@ typedef struct sctp_addip_chunk { | |||
600 | sctp_addiphdr_t addip_hdr; | 647 | sctp_addiphdr_t addip_hdr; |
601 | } __attribute__((packed)) sctp_addip_chunk_t; | 648 | } __attribute__((packed)) sctp_addip_chunk_t; |
602 | 649 | ||
650 | /* AUTH | ||
651 | * Section 4.1 Authentication Chunk (AUTH) | ||
652 | * | ||
653 | * This chunk is used to hold the result of the HMAC calculation. | ||
654 | * | ||
655 | * 0 1 2 3 | ||
656 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | ||
657 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
658 | * | Type = 0x0F | Flags=0 | Length | | ||
659 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
660 | * | Shared Key Identifier | HMAC Identifier | | ||
661 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
662 | * | | | ||
663 | * \ HMAC / | ||
664 | * / \ | ||
665 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
666 | * | ||
667 | * Type: 1 byte (unsigned integer) | ||
668 | * This value MUST be set to 0x0F for all AUTH-chunks. | ||
669 | * | ||
670 | * Flags: 1 byte (unsigned integer) | ||
671 | * Set to zero on transmit and ignored on receipt. | ||
672 | * | ||
673 | * Length: 2 bytes (unsigned integer) | ||
674 | * This value holds the length of the HMAC in bytes plus 8. | ||
675 | * | ||
676 | * Shared Key Identifier: 2 bytes (unsigned integer) | ||
677 | * This value describes which endpoint pair shared key is used. | ||
678 | * | ||
679 | * HMAC Identifier: 2 bytes (unsigned integer) | ||
680 | * This value describes which message digest is being used. Table 2 | ||
681 | * shows the currently defined values. | ||
682 | * | ||
683 | * The following Table 2 shows the currently defined values for HMAC | ||
684 | * identifiers. | ||
685 | * | ||
686 | * +-----------------+--------------------------+ | ||
687 | * | HMAC Identifier | Message Digest Algorithm | | ||
688 | * +-----------------+--------------------------+ | ||
689 | * | 0 | Reserved | | ||
690 | * | 1 | SHA-1 defined in [8] | | ||
691 | * | 2 | Reserved | | ||
692 | * | 3 | SHA-256 defined in [8] | | ||
693 | * +-----------------+--------------------------+ | ||
694 | * | ||
695 | * | ||
696 | * HMAC: n bytes (unsigned integer) This hold the result of the HMAC | ||
697 | * calculation. | ||
698 | */ | ||
699 | typedef struct sctp_authhdr { | ||
700 | __be16 shkey_id; | ||
701 | __be16 hmac_id; | ||
702 | __u8 hmac[0]; | ||
703 | } __attribute__((packed)) sctp_authhdr_t; | ||
704 | |||
705 | typedef struct sctp_auth_chunk { | ||
706 | sctp_chunkhdr_t chunk_hdr; | ||
707 | sctp_authhdr_t auth_hdr; | ||
708 | } __attribute__((packed)) sctp_auth_chunk_t; | ||
709 | |||
603 | #endif /* __LINUX_SCTP_H__ */ | 710 | #endif /* __LINUX_SCTP_H__ */ |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 83783ab0f552..8bf1e05115b4 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -46,6 +46,8 @@ int seq_path(struct seq_file *, struct vfsmount *, struct dentry *, char *); | |||
46 | 46 | ||
47 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); | 47 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); |
48 | int single_release(struct inode *, struct file *); | 48 | int single_release(struct inode *, struct file *); |
49 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | ||
50 | int seq_open_private(struct file *, const struct seq_operations *, int); | ||
49 | int seq_release_private(struct inode *, struct file *); | 51 | int seq_release_private(struct inode *, struct file *); |
50 | 52 | ||
51 | #define SEQ_START_TOKEN ((void *)1) | 53 | #define SEQ_START_TOKEN ((void *)1) |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 802b3a38b041..89f0c2b5f405 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -82,6 +82,8 @@ enum | |||
82 | __ICMP_MIB_MAX | 82 | __ICMP_MIB_MAX |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */ | ||
86 | |||
85 | /* icmp6 mib definitions */ | 87 | /* icmp6 mib definitions */ |
86 | /* | 88 | /* |
87 | * RFC 2466: ICMPv6-MIB | 89 | * RFC 2466: ICMPv6-MIB |
@@ -91,35 +93,12 @@ enum | |||
91 | ICMP6_MIB_NUM = 0, | 93 | ICMP6_MIB_NUM = 0, |
92 | ICMP6_MIB_INMSGS, /* InMsgs */ | 94 | ICMP6_MIB_INMSGS, /* InMsgs */ |
93 | ICMP6_MIB_INERRORS, /* InErrors */ | 95 | ICMP6_MIB_INERRORS, /* InErrors */ |
94 | ICMP6_MIB_INDESTUNREACHS, /* InDestUnreachs */ | ||
95 | ICMP6_MIB_INPKTTOOBIGS, /* InPktTooBigs */ | ||
96 | ICMP6_MIB_INTIMEEXCDS, /* InTimeExcds */ | ||
97 | ICMP6_MIB_INPARMPROBLEMS, /* InParmProblems */ | ||
98 | ICMP6_MIB_INECHOS, /* InEchos */ | ||
99 | ICMP6_MIB_INECHOREPLIES, /* InEchoReplies */ | ||
100 | ICMP6_MIB_INGROUPMEMBQUERIES, /* InGroupMembQueries */ | ||
101 | ICMP6_MIB_INGROUPMEMBRESPONSES, /* InGroupMembResponses */ | ||
102 | ICMP6_MIB_INGROUPMEMBREDUCTIONS, /* InGroupMembReductions */ | ||
103 | ICMP6_MIB_INROUTERSOLICITS, /* InRouterSolicits */ | ||
104 | ICMP6_MIB_INROUTERADVERTISEMENTS, /* InRouterAdvertisements */ | ||
105 | ICMP6_MIB_INNEIGHBORSOLICITS, /* InNeighborSolicits */ | ||
106 | ICMP6_MIB_INNEIGHBORADVERTISEMENTS, /* InNeighborAdvertisements */ | ||
107 | ICMP6_MIB_INREDIRECTS, /* InRedirects */ | ||
108 | ICMP6_MIB_OUTMSGS, /* OutMsgs */ | 96 | ICMP6_MIB_OUTMSGS, /* OutMsgs */ |
109 | ICMP6_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */ | ||
110 | ICMP6_MIB_OUTPKTTOOBIGS, /* OutPktTooBigs */ | ||
111 | ICMP6_MIB_OUTTIMEEXCDS, /* OutTimeExcds */ | ||
112 | ICMP6_MIB_OUTPARMPROBLEMS, /* OutParmProblems */ | ||
113 | ICMP6_MIB_OUTECHOREPLIES, /* OutEchoReplies */ | ||
114 | ICMP6_MIB_OUTROUTERSOLICITS, /* OutRouterSolicits */ | ||
115 | ICMP6_MIB_OUTNEIGHBORSOLICITS, /* OutNeighborSolicits */ | ||
116 | ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS, /* OutNeighborAdvertisements */ | ||
117 | ICMP6_MIB_OUTREDIRECTS, /* OutRedirects */ | ||
118 | ICMP6_MIB_OUTGROUPMEMBRESPONSES, /* OutGroupMembResponses */ | ||
119 | ICMP6_MIB_OUTGROUPMEMBREDUCTIONS, /* OutGroupMembReductions */ | ||
120 | __ICMP6_MIB_MAX | 97 | __ICMP6_MIB_MAX |
121 | }; | 98 | }; |
122 | 99 | ||
100 | #define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */ | ||
101 | |||
123 | /* tcp mib definitions */ | 102 | /* tcp mib definitions */ |
124 | /* | 103 | /* |
125 | * RFC 1213: MIB-II TCP group | 104 | * RFC 1213: MIB-II TCP group |
@@ -231,6 +210,10 @@ enum | |||
231 | LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ | 210 | LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ |
232 | LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ | 211 | LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ |
233 | LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ | 212 | LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ |
213 | LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ | ||
214 | LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ | ||
215 | LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ | ||
216 | LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ | ||
234 | __LINUX_MIB_MAX | 217 | __LINUX_MIB_MAX |
235 | }; | 218 | }; |
236 | 219 | ||
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h new file mode 100644 index 000000000000..2b5c312c4960 --- /dev/null +++ b/include/linux/ssb/ssb.h | |||
@@ -0,0 +1,424 @@ | |||
1 | #ifndef LINUX_SSB_H_ | ||
2 | #define LINUX_SSB_H_ | ||
3 | |||
4 | #include <linux/device.h> | ||
5 | #include <linux/list.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/spinlock.h> | ||
8 | #include <linux/pci.h> | ||
9 | #include <linux/mod_devicetable.h> | ||
10 | |||
11 | #include <linux/ssb/ssb_regs.h> | ||
12 | |||
13 | |||
14 | struct pcmcia_device; | ||
15 | struct ssb_bus; | ||
16 | struct ssb_driver; | ||
17 | |||
18 | |||
19 | struct ssb_sprom_r1 { | ||
20 | u16 pci_spid; /* Subsystem Product ID for PCI */ | ||
21 | u16 pci_svid; /* Subsystem Vendor ID for PCI */ | ||
22 | u16 pci_pid; /* Product ID for PCI */ | ||
23 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | ||
24 | u8 et0mac[6]; /* MAC address for Ethernet */ | ||
25 | u8 et1mac[6]; /* MAC address for 802.11a */ | ||
26 | u8 et0phyaddr:5; /* MII address for enet0 */ | ||
27 | u8 et1phyaddr:5; /* MII address for enet1 */ | ||
28 | u8 et0mdcport:1; /* MDIO for enet0 */ | ||
29 | u8 et1mdcport:1; /* MDIO for enet1 */ | ||
30 | u8 board_rev; /* Board revision */ | ||
31 | u8 country_code:4; /* Country Code */ | ||
32 | u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */ | ||
33 | u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */ | ||
34 | u16 pa0b0; | ||
35 | u16 pa0b1; | ||
36 | u16 pa0b2; | ||
37 | u16 pa1b0; | ||
38 | u16 pa1b1; | ||
39 | u16 pa1b2; | ||
40 | u8 gpio0; /* GPIO pin 0 */ | ||
41 | u8 gpio1; /* GPIO pin 1 */ | ||
42 | u8 gpio2; /* GPIO pin 2 */ | ||
43 | u8 gpio3; /* GPIO pin 3 */ | ||
44 | u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */ | ||
45 | u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */ | ||
46 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ | ||
47 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ | ||
48 | u16 boardflags_lo; /* Boardflags (low 16 bits) */ | ||
49 | u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */ | ||
50 | u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */ | ||
51 | u8 oem[8]; /* OEM string (rev 1 only) */ | ||
52 | }; | ||
53 | |||
54 | struct ssb_sprom_r2 { | ||
55 | u16 boardflags_hi; /* Boardflags (high 16 bits) */ | ||
56 | u8 maxpwr_a_lo; /* A-PHY Max Power Low */ | ||
57 | u8 maxpwr_a_hi; /* A-PHY Max Power High */ | ||
58 | u16 pa1lob0; /* A-PHY PA Low Settings */ | ||
59 | u16 pa1lob1; /* A-PHY PA Low Settings */ | ||
60 | u16 pa1lob2; /* A-PHY PA Low Settings */ | ||
61 | u16 pa1hib0; /* A-PHY PA High Settings */ | ||
62 | u16 pa1hib1; /* A-PHY PA High Settings */ | ||
63 | u16 pa1hib2; /* A-PHY PA High Settings */ | ||
64 | u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */ | ||
65 | u8 country_str[2]; /* Two char Country Code */ | ||
66 | }; | ||
67 | |||
68 | struct ssb_sprom_r3 { | ||
69 | u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */ | ||
70 | u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */ | ||
71 | u32 ofdmahpo; /* A-PHY OFDM High Power Offset */ | ||
72 | u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */ | ||
73 | u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */ | ||
74 | u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */ | ||
75 | u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */ | ||
76 | u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */ | ||
77 | u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */ | ||
78 | u32 ofdmgpo; /* G-PHY OFDM Power Offset */ | ||
79 | }; | ||
80 | |||
81 | struct ssb_sprom_r4 { | ||
82 | /* TODO */ | ||
83 | }; | ||
84 | |||
85 | struct ssb_sprom { | ||
86 | u8 revision; | ||
87 | u8 crc; | ||
88 | /* The valid r# fields are selected by the "revision". | ||
89 | * Revision 3 and lower inherit from lower revisions. | ||
90 | */ | ||
91 | union { | ||
92 | struct { | ||
93 | struct ssb_sprom_r1 r1; | ||
94 | struct ssb_sprom_r2 r2; | ||
95 | struct ssb_sprom_r3 r3; | ||
96 | }; | ||
97 | struct ssb_sprom_r4 r4; | ||
98 | }; | ||
99 | }; | ||
100 | |||
101 | /* Information about the PCB the circuitry is soldered on. */ | ||
102 | struct ssb_boardinfo { | ||
103 | u16 vendor; | ||
104 | u16 type; | ||
105 | u16 rev; | ||
106 | }; | ||
107 | |||
108 | |||
109 | struct ssb_device; | ||
110 | /* Lowlevel read/write operations on the device MMIO. | ||
111 | * Internal, don't use that outside of ssb. */ | ||
112 | struct ssb_bus_ops { | ||
113 | u16 (*read16)(struct ssb_device *dev, u16 offset); | ||
114 | u32 (*read32)(struct ssb_device *dev, u16 offset); | ||
115 | void (*write16)(struct ssb_device *dev, u16 offset, u16 value); | ||
116 | void (*write32)(struct ssb_device *dev, u16 offset, u32 value); | ||
117 | }; | ||
118 | |||
119 | |||
120 | /* Core-ID values. */ | ||
121 | #define SSB_DEV_CHIPCOMMON 0x800 | ||
122 | #define SSB_DEV_ILINE20 0x801 | ||
123 | #define SSB_DEV_SDRAM 0x803 | ||
124 | #define SSB_DEV_PCI 0x804 | ||
125 | #define SSB_DEV_MIPS 0x805 | ||
126 | #define SSB_DEV_ETHERNET 0x806 | ||
127 | #define SSB_DEV_V90 0x807 | ||
128 | #define SSB_DEV_USB11_HOSTDEV 0x808 | ||
129 | #define SSB_DEV_ADSL 0x809 | ||
130 | #define SSB_DEV_ILINE100 0x80A | ||
131 | #define SSB_DEV_IPSEC 0x80B | ||
132 | #define SSB_DEV_PCMCIA 0x80D | ||
133 | #define SSB_DEV_INTERNAL_MEM 0x80E | ||
134 | #define SSB_DEV_MEMC_SDRAM 0x80F | ||
135 | #define SSB_DEV_EXTIF 0x811 | ||
136 | #define SSB_DEV_80211 0x812 | ||
137 | #define SSB_DEV_MIPS_3302 0x816 | ||
138 | #define SSB_DEV_USB11_HOST 0x817 | ||
139 | #define SSB_DEV_USB11_DEV 0x818 | ||
140 | #define SSB_DEV_USB20_HOST 0x819 | ||
141 | #define SSB_DEV_USB20_DEV 0x81A | ||
142 | #define SSB_DEV_SDIO_HOST 0x81B | ||
143 | #define SSB_DEV_ROBOSWITCH 0x81C | ||
144 | #define SSB_DEV_PARA_ATA 0x81D | ||
145 | #define SSB_DEV_SATA_XORDMA 0x81E | ||
146 | #define SSB_DEV_ETHERNET_GBIT 0x81F | ||
147 | #define SSB_DEV_PCIE 0x820 | ||
148 | #define SSB_DEV_MIMO_PHY 0x821 | ||
149 | #define SSB_DEV_SRAM_CTRLR 0x822 | ||
150 | #define SSB_DEV_MINI_MACPHY 0x823 | ||
151 | #define SSB_DEV_ARM_1176 0x824 | ||
152 | #define SSB_DEV_ARM_7TDMI 0x825 | ||
153 | |||
154 | /* Vendor-ID values */ | ||
155 | #define SSB_VENDOR_BROADCOM 0x4243 | ||
156 | |||
157 | /* Some kernel subsystems poke with dev->drvdata, so we must use the | ||
158 | * following ugly workaround to get from struct device to struct ssb_device */ | ||
159 | struct __ssb_dev_wrapper { | ||
160 | struct device dev; | ||
161 | struct ssb_device *sdev; | ||
162 | }; | ||
163 | |||
164 | struct ssb_device { | ||
165 | /* Having a copy of the ops pointer in each dev struct | ||
166 | * is an optimization. */ | ||
167 | const struct ssb_bus_ops *ops; | ||
168 | |||
169 | struct device *dev; | ||
170 | struct ssb_bus *bus; | ||
171 | struct ssb_device_id id; | ||
172 | |||
173 | u8 core_index; | ||
174 | unsigned int irq; | ||
175 | |||
176 | /* Internal-only stuff follows. */ | ||
177 | void *drvdata; /* Per-device data */ | ||
178 | void *devtypedata; /* Per-devicetype (eg 802.11) data */ | ||
179 | }; | ||
180 | |||
181 | /* Go from struct device to struct ssb_device. */ | ||
182 | static inline | ||
183 | struct ssb_device * dev_to_ssb_dev(struct device *dev) | ||
184 | { | ||
185 | struct __ssb_dev_wrapper *wrap; | ||
186 | wrap = container_of(dev, struct __ssb_dev_wrapper, dev); | ||
187 | return wrap->sdev; | ||
188 | } | ||
189 | |||
190 | /* Device specific user data */ | ||
191 | static inline | ||
192 | void ssb_set_drvdata(struct ssb_device *dev, void *data) | ||
193 | { | ||
194 | dev->drvdata = data; | ||
195 | } | ||
196 | static inline | ||
197 | void * ssb_get_drvdata(struct ssb_device *dev) | ||
198 | { | ||
199 | return dev->drvdata; | ||
200 | } | ||
201 | |||
202 | /* Devicetype specific user data. This is per device-type (not per device) */ | ||
203 | void ssb_set_devtypedata(struct ssb_device *dev, void *data); | ||
204 | static inline | ||
205 | void * ssb_get_devtypedata(struct ssb_device *dev) | ||
206 | { | ||
207 | return dev->devtypedata; | ||
208 | } | ||
209 | |||
210 | |||
211 | struct ssb_driver { | ||
212 | const char *name; | ||
213 | const struct ssb_device_id *id_table; | ||
214 | |||
215 | int (*probe)(struct ssb_device *dev, const struct ssb_device_id *id); | ||
216 | void (*remove)(struct ssb_device *dev); | ||
217 | int (*suspend)(struct ssb_device *dev, pm_message_t state); | ||
218 | int (*resume)(struct ssb_device *dev); | ||
219 | void (*shutdown)(struct ssb_device *dev); | ||
220 | |||
221 | struct device_driver drv; | ||
222 | }; | ||
223 | #define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) | ||
224 | |||
225 | extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); | ||
226 | static inline int ssb_driver_register(struct ssb_driver *drv) | ||
227 | { | ||
228 | return __ssb_driver_register(drv, THIS_MODULE); | ||
229 | } | ||
230 | extern void ssb_driver_unregister(struct ssb_driver *drv); | ||
231 | |||
232 | |||
233 | |||
234 | |||
235 | enum ssb_bustype { | ||
236 | SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */ | ||
237 | SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */ | ||
238 | SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */ | ||
239 | }; | ||
240 | |||
241 | /* board_vendor */ | ||
242 | #define SSB_BOARDVENDOR_BCM 0x14E4 /* Broadcom */ | ||
243 | #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ | ||
244 | #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ | ||
245 | /* board_type */ | ||
246 | #define SSB_BOARD_BCM94306MP 0x0418 | ||
247 | #define SSB_BOARD_BCM4309G 0x0421 | ||
248 | #define SSB_BOARD_BCM4306CB 0x0417 | ||
249 | #define SSB_BOARD_BCM4309MP 0x040C | ||
250 | #define SSB_BOARD_MP4318 0x044A | ||
251 | #define SSB_BOARD_BU4306 0x0416 | ||
252 | #define SSB_BOARD_BU4309 0x040A | ||
253 | /* chip_package */ | ||
254 | #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ | ||
255 | #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ | ||
256 | #define SSB_CHIPPACK_BCM4712L 0 /* Large 340pin 4712 */ | ||
257 | |||
258 | #include <linux/ssb/ssb_driver_chipcommon.h> | ||
259 | #include <linux/ssb/ssb_driver_mips.h> | ||
260 | #include <linux/ssb/ssb_driver_extif.h> | ||
261 | #include <linux/ssb/ssb_driver_pci.h> | ||
262 | |||
263 | struct ssb_bus { | ||
264 | /* The MMIO area. */ | ||
265 | void __iomem *mmio; | ||
266 | |||
267 | const struct ssb_bus_ops *ops; | ||
268 | |||
269 | /* The core in the basic address register window. (PCI bus only) */ | ||
270 | struct ssb_device *mapped_device; | ||
271 | /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ | ||
272 | u8 mapped_pcmcia_seg; | ||
273 | /* Lock for core and segment switching. */ | ||
274 | spinlock_t bar_lock; | ||
275 | |||
276 | /* The bus this backplane is running on. */ | ||
277 | enum ssb_bustype bustype; | ||
278 | /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */ | ||
279 | struct pci_dev *host_pci; | ||
280 | /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ | ||
281 | struct pcmcia_device *host_pcmcia; | ||
282 | |||
283 | #ifdef CONFIG_SSB_PCIHOST | ||
284 | /* Mutex to protect the SPROM writing. */ | ||
285 | struct mutex pci_sprom_mutex; | ||
286 | #endif | ||
287 | |||
288 | /* ID information about the Chip. */ | ||
289 | u16 chip_id; | ||
290 | u16 chip_rev; | ||
291 | u8 chip_package; | ||
292 | |||
293 | /* List of devices (cores) on the backplane. */ | ||
294 | struct ssb_device devices[SSB_MAX_NR_CORES]; | ||
295 | u8 nr_devices; | ||
296 | |||
297 | /* Reference count. Number of suspended devices. */ | ||
298 | u8 suspend_cnt; | ||
299 | |||
300 | /* Software ID number for this bus. */ | ||
301 | unsigned int busnumber; | ||
302 | |||
303 | /* The ChipCommon device (if available). */ | ||
304 | struct ssb_chipcommon chipco; | ||
305 | /* The PCI-core device (if available). */ | ||
306 | struct ssb_pcicore pcicore; | ||
307 | /* The MIPS-core device (if available). */ | ||
308 | struct ssb_mipscore mipscore; | ||
309 | /* The EXTif-core device (if available). */ | ||
310 | struct ssb_extif extif; | ||
311 | |||
312 | /* The following structure elements are not available in early | ||
313 | * SSB initialization. Though, they are available for regular | ||
314 | * registered drivers at any stage. So be careful when | ||
315 | * using them in the ssb core code. */ | ||
316 | |||
317 | /* ID information about the PCB. */ | ||
318 | struct ssb_boardinfo boardinfo; | ||
319 | /* Contents of the SPROM. */ | ||
320 | struct ssb_sprom sprom; | ||
321 | |||
322 | /* Internal-only stuff follows. Do not touch. */ | ||
323 | struct list_head list; | ||
324 | #ifdef CONFIG_SSB_DEBUG | ||
325 | /* Is the bus already powered up? */ | ||
326 | bool powered_up; | ||
327 | int power_warn_count; | ||
328 | #endif /* DEBUG */ | ||
329 | }; | ||
330 | |||
331 | /* The initialization-invariants. */ | ||
332 | struct ssb_init_invariants { | ||
333 | struct ssb_boardinfo boardinfo; | ||
334 | struct ssb_sprom sprom; | ||
335 | }; | ||
336 | /* Type of function to fetch the invariants. */ | ||
337 | typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, | ||
338 | struct ssb_init_invariants *iv); | ||
339 | |||
340 | /* Register a SSB system bus. get_invariants() is called after the | ||
341 | * basic system devices are initialized. | ||
342 | * The invariants are usually fetched from some NVRAM. | ||
343 | * Put the invariants into the struct pointed to by iv. */ | ||
344 | extern int ssb_bus_ssbbus_register(struct ssb_bus *bus, | ||
345 | unsigned long baseaddr, | ||
346 | ssb_invariants_func_t get_invariants); | ||
347 | #ifdef CONFIG_SSB_PCIHOST | ||
348 | extern int ssb_bus_pcibus_register(struct ssb_bus *bus, | ||
349 | struct pci_dev *host_pci); | ||
350 | #endif /* CONFIG_SSB_PCIHOST */ | ||
351 | #ifdef CONFIG_SSB_PCMCIAHOST | ||
352 | extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus, | ||
353 | struct pcmcia_device *pcmcia_dev, | ||
354 | unsigned long baseaddr); | ||
355 | #endif /* CONFIG_SSB_PCMCIAHOST */ | ||
356 | |||
357 | extern void ssb_bus_unregister(struct ssb_bus *bus); | ||
358 | |||
359 | extern u32 ssb_clockspeed(struct ssb_bus *bus); | ||
360 | |||
361 | /* Is the device enabled in hardware? */ | ||
362 | int ssb_device_is_enabled(struct ssb_device *dev); | ||
363 | /* Enable a device and pass device-specific SSB_TMSLOW flags. | ||
364 | * If no device-specific flags are available, use 0. */ | ||
365 | void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags); | ||
366 | /* Disable a device in hardware and pass SSB_TMSLOW flags (if any). */ | ||
367 | void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags); | ||
368 | |||
369 | |||
370 | /* Device MMIO register read/write functions. */ | ||
371 | static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) | ||
372 | { | ||
373 | return dev->ops->read16(dev, offset); | ||
374 | } | ||
375 | static inline u32 ssb_read32(struct ssb_device *dev, u16 offset) | ||
376 | { | ||
377 | return dev->ops->read32(dev, offset); | ||
378 | } | ||
379 | static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) | ||
380 | { | ||
381 | dev->ops->write16(dev, offset, value); | ||
382 | } | ||
383 | static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value) | ||
384 | { | ||
385 | dev->ops->write32(dev, offset, value); | ||
386 | } | ||
387 | |||
388 | |||
389 | /* Translation (routing) bits that need to be ORed to DMA | ||
390 | * addresses before they are given to a device. */ | ||
391 | extern u32 ssb_dma_translation(struct ssb_device *dev); | ||
392 | #define SSB_DMA_TRANSLATION_MASK 0xC0000000 | ||
393 | #define SSB_DMA_TRANSLATION_SHIFT 30 | ||
394 | |||
395 | extern int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask); | ||
396 | |||
397 | |||
398 | #ifdef CONFIG_SSB_PCIHOST | ||
399 | /* PCI-host wrapper driver */ | ||
400 | extern int ssb_pcihost_register(struct pci_driver *driver); | ||
401 | static inline void ssb_pcihost_unregister(struct pci_driver *driver) | ||
402 | { | ||
403 | pci_unregister_driver(driver); | ||
404 | } | ||
405 | #endif /* CONFIG_SSB_PCIHOST */ | ||
406 | |||
407 | |||
408 | /* If a driver is shutdown or suspended, call this to signal | ||
409 | * that the bus may be completely powered down. SSB will decide, | ||
410 | * if it's really time to power down the bus, based on if there | ||
411 | * are other devices that want to run. */ | ||
412 | extern int ssb_bus_may_powerdown(struct ssb_bus *bus); | ||
413 | /* Before initializing and enabling a device, call this to power-up the bus. | ||
414 | * If you want to allow use of dynamic-power-control, pass the flag. | ||
415 | * Otherwise static always-on powercontrol will be used. */ | ||
416 | extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); | ||
417 | |||
418 | |||
419 | /* Various helper functions */ | ||
420 | extern u32 ssb_admatch_base(u32 adm); | ||
421 | extern u32 ssb_admatch_size(u32 adm); | ||
422 | |||
423 | |||
424 | #endif /* LINUX_SSB_H_ */ | ||
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h new file mode 100644 index 000000000000..4cb995494662 --- /dev/null +++ b/include/linux/ssb/ssb_driver_chipcommon.h | |||
@@ -0,0 +1,396 @@ | |||
1 | #ifndef LINUX_SSB_CHIPCO_H_ | ||
2 | #define LINUX_SSB_CHIPCO_H_ | ||
3 | |||
4 | /* SonicsSiliconBackplane CHIPCOMMON core hardware definitions | ||
5 | * | ||
6 | * The chipcommon core provides chip identification, SB control, | ||
7 | * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer, | ||
8 | * gpio interface, extbus, and support for serial and parallel flashes. | ||
9 | * | ||
10 | * Copyright 2005, Broadcom Corporation | ||
11 | * Copyright 2006, Michael Buesch <mb@bu3sch.de> | ||
12 | * | ||
13 | * Licensed under the GPL version 2. See COPYING for details. | ||
14 | */ | ||
15 | |||
16 | /** ChipCommon core registers. **/ | ||
17 | |||
18 | #define SSB_CHIPCO_CHIPID 0x0000 | ||
19 | #define SSB_CHIPCO_IDMASK 0x0000FFFF | ||
20 | #define SSB_CHIPCO_REVMASK 0x000F0000 | ||
21 | #define SSB_CHIPCO_REVSHIFT 16 | ||
22 | #define SSB_CHIPCO_PACKMASK 0x00F00000 | ||
23 | #define SSB_CHIPCO_PACKSHIFT 20 | ||
24 | #define SSB_CHIPCO_NRCORESMASK 0x0F000000 | ||
25 | #define SSB_CHIPCO_NRCORESSHIFT 24 | ||
26 | #define SSB_CHIPCO_CAP 0x0004 /* Capabilities */ | ||
27 | #define SSB_CHIPCO_CAP_NRUART 0x00000003 /* # of UARTs */ | ||
28 | #define SSB_CHIPCO_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */ | ||
29 | #define SSB_CHIPCO_CAP_UARTCLK 0x00000018 /* UART clock select */ | ||
30 | #define SSB_CHIPCO_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */ | ||
31 | #define SSB_CHIPCO_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */ | ||
32 | #define SSB_CHIPCO_CAP_EXTBUS 0x000000C0 /* External buses present */ | ||
33 | #define SSB_CHIPCO_CAP_FLASHT 0x00000700 /* Flash Type */ | ||
34 | #define SSB_CHIPCO_FLASHT_NONE 0x00000000 /* No flash */ | ||
35 | #define SSB_CHIPCO_FLASHT_STSER 0x00000100 /* ST serial flash */ | ||
36 | #define SSB_CHIPCO_FLASHT_ATSER 0x00000200 /* Atmel serial flash */ | ||
37 | #define SSB_CHIPCO_FLASHT_PARA 0x00000700 /* Parallel flash */ | ||
38 | #define SSB_CHIPCO_CAP_PLLT 0x00038000 /* PLL Type */ | ||
39 | #define SSB_PLLTYPE_NONE 0x00000000 | ||
40 | #define SSB_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */ | ||
41 | #define SSB_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */ | ||
42 | #define SSB_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */ | ||
43 | #define SSB_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */ | ||
44 | #define SSB_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */ | ||
45 | #define SSB_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */ | ||
46 | #define SSB_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */ | ||
47 | #define SSB_CHIPCO_CAP_PCTL 0x00040000 /* Power Control */ | ||
48 | #define SSB_CHIPCO_CAP_OTPS 0x00380000 /* OTP size */ | ||
49 | #define SSB_CHIPCO_CAP_OTPS_SHIFT 19 | ||
50 | #define SSB_CHIPCO_CAP_OTPS_BASE 5 | ||
51 | #define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */ | ||
52 | #define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */ | ||
53 | #define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ | ||
54 | #define SSB_CHIPCO_CORECTL 0x0008 | ||
55 | #define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ | ||
56 | #define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ | ||
57 | #define SSB_CHIPCO_BIST 0x000C | ||
58 | #define SSB_CHIPCO_OTPS 0x0010 /* OTP status */ | ||
59 | #define SSB_CHIPCO_OTPS_PROGFAIL 0x80000000 | ||
60 | #define SSB_CHIPCO_OTPS_PROTECT 0x00000007 | ||
61 | #define SSB_CHIPCO_OTPS_HW_PROTECT 0x00000001 | ||
62 | #define SSB_CHIPCO_OTPS_SW_PROTECT 0x00000002 | ||
63 | #define SSB_CHIPCO_OTPS_CID_PROTECT 0x00000004 | ||
64 | #define SSB_CHIPCO_OTPC 0x0014 /* OTP control */ | ||
65 | #define SSB_CHIPCO_OTPC_RECWAIT 0xFF000000 | ||
66 | #define SSB_CHIPCO_OTPC_PROGWAIT 0x00FFFF00 | ||
67 | #define SSB_CHIPCO_OTPC_PRW_SHIFT 8 | ||
68 | #define SSB_CHIPCO_OTPC_MAXFAIL 0x00000038 | ||
69 | #define SSB_CHIPCO_OTPC_VSEL 0x00000006 | ||
70 | #define SSB_CHIPCO_OTPC_SELVL 0x00000001 | ||
71 | #define SSB_CHIPCO_OTPP 0x0018 /* OTP prog */ | ||
72 | #define SSB_CHIPCO_OTPP_COL 0x000000FF | ||
73 | #define SSB_CHIPCO_OTPP_ROW 0x0000FF00 | ||
74 | #define SSB_CHIPCO_OTPP_ROW_SHIFT 8 | ||
75 | #define SSB_CHIPCO_OTPP_READERR 0x10000000 | ||
76 | #define SSB_CHIPCO_OTPP_VALUE 0x20000000 | ||
77 | #define SSB_CHIPCO_OTPP_READ 0x40000000 | ||
78 | #define SSB_CHIPCO_OTPP_START 0x80000000 | ||
79 | #define SSB_CHIPCO_OTPP_BUSY 0x80000000 | ||
80 | #define SSB_CHIPCO_IRQSTAT 0x0020 | ||
81 | #define SSB_CHIPCO_IRQMASK 0x0024 | ||
82 | #define SSB_CHIPCO_IRQ_GPIO 0x00000001 /* gpio intr */ | ||
83 | #define SSB_CHIPCO_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */ | ||
84 | #define SSB_CHIPCO_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ | ||
85 | #define SSB_CHIPCO_CHIPCTL 0x0028 /* Rev >= 11 only */ | ||
86 | #define SSB_CHIPCO_CHIPSTAT 0x002C /* Rev >= 11 only */ | ||
87 | #define SSB_CHIPCO_JCMD 0x0030 /* Rev >= 10 only */ | ||
88 | #define SSB_CHIPCO_JCMD_START 0x80000000 | ||
89 | #define SSB_CHIPCO_JCMD_BUSY 0x80000000 | ||
90 | #define SSB_CHIPCO_JCMD_PAUSE 0x40000000 | ||
91 | #define SSB_CHIPCO_JCMD0_ACC_MASK 0x0000F000 | ||
92 | #define SSB_CHIPCO_JCMD0_ACC_IRDR 0x00000000 | ||
93 | #define SSB_CHIPCO_JCMD0_ACC_DR 0x00001000 | ||
94 | #define SSB_CHIPCO_JCMD0_ACC_IR 0x00002000 | ||
95 | #define SSB_CHIPCO_JCMD0_ACC_RESET 0x00003000 | ||
96 | #define SSB_CHIPCO_JCMD0_ACC_IRPDR 0x00004000 | ||
97 | #define SSB_CHIPCO_JCMD0_ACC_PDR 0x00005000 | ||
98 | #define SSB_CHIPCO_JCMD0_IRW_MASK 0x00000F00 | ||
99 | #define SSB_CHIPCO_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */ | ||
100 | #define SSB_CHIPCO_JCMD_ACC_IRDR 0x00000000 | ||
101 | #define SSB_CHIPCO_JCMD_ACC_DR 0x00010000 | ||
102 | #define SSB_CHIPCO_JCMD_ACC_IR 0x00020000 | ||
103 | #define SSB_CHIPCO_JCMD_ACC_RESET 0x00030000 | ||
104 | #define SSB_CHIPCO_JCMD_ACC_IRPDR 0x00040000 | ||
105 | #define SSB_CHIPCO_JCMD_ACC_PDR 0x00050000 | ||
106 | #define SSB_CHIPCO_JCMD_IRW_MASK 0x00001F00 | ||
107 | #define SSB_CHIPCO_JCMD_IRW_SHIFT 8 | ||
108 | #define SSB_CHIPCO_JCMD_DRW_MASK 0x0000003F | ||
109 | #define SSB_CHIPCO_JIR 0x0034 /* Rev >= 10 only */ | ||
110 | #define SSB_CHIPCO_JDR 0x0038 /* Rev >= 10 only */ | ||
111 | #define SSB_CHIPCO_JCTL 0x003C /* Rev >= 10 only */ | ||
112 | #define SSB_CHIPCO_JCTL_FORCE_CLK 4 /* Force clock */ | ||
113 | #define SSB_CHIPCO_JCTL_EXT_EN 2 /* Enable external targets */ | ||
114 | #define SSB_CHIPCO_JCTL_EN 1 /* Enable Jtag master */ | ||
115 | #define SSB_CHIPCO_FLASHCTL 0x0040 | ||
116 | #define SSB_CHIPCO_FLASHCTL_START 0x80000000 | ||
117 | #define SSB_CHIPCO_FLASHCTL_BUSY SSB_CHIPCO_FLASHCTL_START | ||
118 | #define SSB_CHIPCO_FLASHADDR 0x0044 | ||
119 | #define SSB_CHIPCO_FLASHDATA 0x0048 | ||
120 | #define SSB_CHIPCO_BCAST_ADDR 0x0050 | ||
121 | #define SSB_CHIPCO_BCAST_DATA 0x0054 | ||
122 | #define SSB_CHIPCO_GPIOIN 0x0060 | ||
123 | #define SSB_CHIPCO_GPIOOUT 0x0064 | ||
124 | #define SSB_CHIPCO_GPIOOUTEN 0x0068 | ||
125 | #define SSB_CHIPCO_GPIOCTL 0x006C | ||
126 | #define SSB_CHIPCO_GPIOPOL 0x0070 | ||
127 | #define SSB_CHIPCO_GPIOIRQ 0x0074 | ||
128 | #define SSB_CHIPCO_WATCHDOG 0x0080 | ||
129 | #define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */ | ||
130 | #define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16 | ||
131 | #define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */ | ||
132 | #define SSB_CHIPCO_CLOCK_N 0x0090 | ||
133 | #define SSB_CHIPCO_CLOCK_SB 0x0094 | ||
134 | #define SSB_CHIPCO_CLOCK_PCI 0x0098 | ||
135 | #define SSB_CHIPCO_CLOCK_M2 0x009C | ||
136 | #define SSB_CHIPCO_CLOCK_MIPS 0x00A0 | ||
137 | #define SSB_CHIPCO_CLKDIV 0x00A4 /* Rev >= 3 only */ | ||
138 | #define SSB_CHIPCO_CLKDIV_SFLASH 0x0F000000 | ||
139 | #define SSB_CHIPCO_CLKDIV_SFLASH_SHIFT 24 | ||
140 | #define SSB_CHIPCO_CLKDIV_OTP 0x000F0000 | ||
141 | #define SSB_CHIPCO_CLKDIV_OTP_SHIFT 16 | ||
142 | #define SSB_CHIPCO_CLKDIV_JTAG 0x00000F00 | ||
143 | #define SSB_CHIPCO_CLKDIV_JTAG_SHIFT 8 | ||
144 | #define SSB_CHIPCO_CLKDIV_UART 0x000000FF | ||
145 | #define SSB_CHIPCO_PLLONDELAY 0x00B0 /* Rev >= 4 only */ | ||
146 | #define SSB_CHIPCO_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ | ||
147 | #define SSB_CHIPCO_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ | ||
148 | #define SSB_CHIPCO_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */ | ||
149 | #define SSB_CHIPCO_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */ | ||
150 | #define SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */ | ||
151 | #define SSB_CHIPCO_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */ | ||
152 | #define SSB_CHIPCO_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */ | ||
153 | #define SSB_CHIPCO_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */ | ||
154 | #define SSB_CHIPCO_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */ | ||
155 | #define SSB_CHIPCO_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */ | ||
156 | #define SSB_CHIPCO_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */ | ||
157 | #define SSB_CHIPCO_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */ | ||
158 | #define SSB_CHIPCO_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */ | ||
159 | #define SSB_CHIPCO_SLOWCLKCTL_CLKDIV_SHIFT 16 | ||
160 | #define SSB_CHIPCO_SYSCLKCTL 0x00C0 /* Rev >= 3 only */ | ||
161 | #define SSB_CHIPCO_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */ | ||
162 | #define SSB_CHIPCO_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */ | ||
163 | #define SSB_CHIPCO_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */ | ||
164 | #define SSB_CHIPCO_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */ | ||
165 | #define SSB_CHIPCO_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */ | ||
166 | #define SSB_CHIPCO_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */ | ||
167 | #define SSB_CHIPCO_SYSCLKCTL_CLKDIV_SHIFT 16 | ||
168 | #define SSB_CHIPCO_CLKSTSTR 0x00C4 /* Rev >= 3 only */ | ||
169 | #define SSB_CHIPCO_PCMCIA_CFG 0x0100 | ||
170 | #define SSB_CHIPCO_PCMCIA_MEMWAIT 0x0104 | ||
171 | #define SSB_CHIPCO_PCMCIA_ATTRWAIT 0x0108 | ||
172 | #define SSB_CHIPCO_PCMCIA_IOWAIT 0x010C | ||
173 | #define SSB_CHIPCO_IDE_CFG 0x0110 | ||
174 | #define SSB_CHIPCO_IDE_MEMWAIT 0x0114 | ||
175 | #define SSB_CHIPCO_IDE_ATTRWAIT 0x0118 | ||
176 | #define SSB_CHIPCO_IDE_IOWAIT 0x011C | ||
177 | #define SSB_CHIPCO_PROG_CFG 0x0120 | ||
178 | #define SSB_CHIPCO_PROG_WAITCNT 0x0124 | ||
179 | #define SSB_CHIPCO_FLASH_CFG 0x0128 | ||
180 | #define SSB_CHIPCO_FLASH_WAITCNT 0x012C | ||
181 | #define SSB_CHIPCO_UART0_DATA 0x0300 | ||
182 | #define SSB_CHIPCO_UART0_IMR 0x0304 | ||
183 | #define SSB_CHIPCO_UART0_FCR 0x0308 | ||
184 | #define SSB_CHIPCO_UART0_LCR 0x030C | ||
185 | #define SSB_CHIPCO_UART0_MCR 0x0310 | ||
186 | #define SSB_CHIPCO_UART0_LSR 0x0314 | ||
187 | #define SSB_CHIPCO_UART0_MSR 0x0318 | ||
188 | #define SSB_CHIPCO_UART0_SCRATCH 0x031C | ||
189 | #define SSB_CHIPCO_UART1_DATA 0x0400 | ||
190 | #define SSB_CHIPCO_UART1_IMR 0x0404 | ||
191 | #define SSB_CHIPCO_UART1_FCR 0x0408 | ||
192 | #define SSB_CHIPCO_UART1_LCR 0x040C | ||
193 | #define SSB_CHIPCO_UART1_MCR 0x0410 | ||
194 | #define SSB_CHIPCO_UART1_LSR 0x0414 | ||
195 | #define SSB_CHIPCO_UART1_MSR 0x0418 | ||
196 | #define SSB_CHIPCO_UART1_SCRATCH 0x041C | ||
197 | |||
198 | |||
199 | |||
200 | /** Clockcontrol masks and values **/ | ||
201 | |||
202 | /* SSB_CHIPCO_CLOCK_N */ | ||
203 | #define SSB_CHIPCO_CLK_N1 0x0000003F /* n1 control */ | ||
204 | #define SSB_CHIPCO_CLK_N2 0x00003F00 /* n2 control */ | ||
205 | #define SSB_CHIPCO_CLK_N2_SHIFT 8 | ||
206 | #define SSB_CHIPCO_CLK_PLLC 0x000F0000 /* pll control */ | ||
207 | #define SSB_CHIPCO_CLK_PLLC_SHIFT 16 | ||
208 | |||
209 | /* SSB_CHIPCO_CLOCK_SB/PCI/UART */ | ||
210 | #define SSB_CHIPCO_CLK_M1 0x0000003F /* m1 control */ | ||
211 | #define SSB_CHIPCO_CLK_M2 0x00003F00 /* m2 control */ | ||
212 | #define SSB_CHIPCO_CLK_M2_SHIFT 8 | ||
213 | #define SSB_CHIPCO_CLK_M3 0x003F0000 /* m3 control */ | ||
214 | #define SSB_CHIPCO_CLK_M3_SHIFT 16 | ||
215 | #define SSB_CHIPCO_CLK_MC 0x1F000000 /* mux control */ | ||
216 | #define SSB_CHIPCO_CLK_MC_SHIFT 24 | ||
217 | |||
218 | /* N3M Clock control magic field values */ | ||
219 | #define SSB_CHIPCO_CLK_F6_2 0x02 /* A factor of 2 in */ | ||
220 | #define SSB_CHIPCO_CLK_F6_3 0x03 /* 6-bit fields like */ | ||
221 | #define SSB_CHIPCO_CLK_F6_4 0x05 /* N1, M1 or M3 */ | ||
222 | #define SSB_CHIPCO_CLK_F6_5 0x09 | ||
223 | #define SSB_CHIPCO_CLK_F6_6 0x11 | ||
224 | #define SSB_CHIPCO_CLK_F6_7 0x21 | ||
225 | |||
226 | #define SSB_CHIPCO_CLK_F5_BIAS 5 /* 5-bit fields get this added */ | ||
227 | |||
228 | #define SSB_CHIPCO_CLK_MC_BYPASS 0x08 | ||
229 | #define SSB_CHIPCO_CLK_MC_M1 0x04 | ||
230 | #define SSB_CHIPCO_CLK_MC_M1M2 0x02 | ||
231 | #define SSB_CHIPCO_CLK_MC_M1M2M3 0x01 | ||
232 | #define SSB_CHIPCO_CLK_MC_M1M3 0x11 | ||
233 | |||
234 | /* Type 2 Clock control magic field values */ | ||
235 | #define SSB_CHIPCO_CLK_T2_BIAS 2 /* n1, n2, m1 & m3 bias */ | ||
236 | #define SSB_CHIPCO_CLK_T2M2_BIAS 3 /* m2 bias */ | ||
237 | |||
238 | #define SSB_CHIPCO_CLK_T2MC_M1BYP 1 | ||
239 | #define SSB_CHIPCO_CLK_T2MC_M2BYP 2 | ||
240 | #define SSB_CHIPCO_CLK_T2MC_M3BYP 4 | ||
241 | |||
242 | /* Type 6 Clock control magic field values */ | ||
243 | #define SSB_CHIPCO_CLK_T6_MMASK 1 /* bits of interest in m */ | ||
244 | #define SSB_CHIPCO_CLK_T6_M0 120000000 /* sb clock for m = 0 */ | ||
245 | #define SSB_CHIPCO_CLK_T6_M1 100000000 /* sb clock for m = 1 */ | ||
246 | #define SSB_CHIPCO_CLK_SB2MIPS_T6(sb) (2 * (sb)) | ||
247 | |||
248 | /* Common clock base */ | ||
249 | #define SSB_CHIPCO_CLK_BASE1 24000000 /* Half the clock freq */ | ||
250 | #define SSB_CHIPCO_CLK_BASE2 12500000 /* Alternate crystal on some PLL's */ | ||
251 | |||
252 | /* Clock control values for 200Mhz in 5350 */ | ||
253 | #define SSB_CHIPCO_CLK_5350_N 0x0311 | ||
254 | #define SSB_CHIPCO_CLK_5350_M 0x04020009 | ||
255 | |||
256 | |||
257 | /** Bits in the config registers **/ | ||
258 | |||
259 | #define SSB_CHIPCO_CFG_EN 0x0001 /* Enable */ | ||
260 | #define SSB_CHIPCO_CFG_EXTM 0x000E /* Extif Mode */ | ||
261 | #define SSB_CHIPCO_CFG_EXTM_ASYNC 0x0002 /* Async/Parallel flash */ | ||
262 | #define SSB_CHIPCO_CFG_EXTM_SYNC 0x0004 /* Synchronous */ | ||
263 | #define SSB_CHIPCO_CFG_EXTM_PCMCIA 0x0008 /* PCMCIA */ | ||
264 | #define SSB_CHIPCO_CFG_EXTM_IDE 0x000A /* IDE */ | ||
265 | #define SSB_CHIPCO_CFG_DS16 0x0010 /* Data size, 0=8bit, 1=16bit */ | ||
266 | #define SSB_CHIPCO_CFG_CLKDIV 0x0060 /* Sync: Clock divisor */ | ||
267 | #define SSB_CHIPCO_CFG_CLKEN 0x0080 /* Sync: Clock enable */ | ||
268 | #define SSB_CHIPCO_CFG_BSTRO 0x0100 /* Sync: Size/Bytestrobe */ | ||
269 | |||
270 | |||
271 | /** Flash-specific control/status values */ | ||
272 | |||
273 | /* flashcontrol opcodes for ST flashes */ | ||
274 | #define SSB_CHIPCO_FLASHCTL_ST_WREN 0x0006 /* Write Enable */ | ||
275 | #define SSB_CHIPCO_FLASHCTL_ST_WRDIS 0x0004 /* Write Disable */ | ||
276 | #define SSB_CHIPCO_FLASHCTL_ST_RDSR 0x0105 /* Read Status Register */ | ||
277 | #define SSB_CHIPCO_FLASHCTL_ST_WRSR 0x0101 /* Write Status Register */ | ||
278 | #define SSB_CHIPCO_FLASHCTL_ST_READ 0x0303 /* Read Data Bytes */ | ||
279 | #define SSB_CHIPCO_FLASHCTL_ST_PP 0x0302 /* Page Program */ | ||
280 | #define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */ | ||
281 | #define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */ | ||
282 | #define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */ | ||
283 | #define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */ | ||
284 | |||
285 | /* Status register bits for ST flashes */ | ||
286 | #define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */ | ||
287 | #define SSB_CHIPCO_FLASHSTA_ST_WEL 0x02 /* Write Enable Latch */ | ||
288 | #define SSB_CHIPCO_FLASHSTA_ST_BP 0x1C /* Block Protect */ | ||
289 | #define SSB_CHIPCO_FLASHSTA_ST_BP_SHIFT 2 | ||
290 | #define SSB_CHIPCO_FLASHSTA_ST_SRWD 0x80 /* Status Register Write Disable */ | ||
291 | |||
292 | /* flashcontrol opcodes for Atmel flashes */ | ||
293 | #define SSB_CHIPCO_FLASHCTL_AT_READ 0x07E8 | ||
294 | #define SSB_CHIPCO_FLASHCTL_AT_PAGE_READ 0x07D2 | ||
295 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_READ /* FIXME */ | ||
296 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_READ /* FIXME */ | ||
297 | #define SSB_CHIPCO_FLASHCTL_AT_STATUS 0x01D7 | ||
298 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRITE 0x0384 | ||
299 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRITE 0x0387 | ||
300 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_ERASE_PRGM 0x0283 /* Erase program */ | ||
301 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_ERASE_PRGM 0x0286 /* Erase program */ | ||
302 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_PROGRAM 0x0288 | ||
303 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_PROGRAM 0x0289 | ||
304 | #define SSB_CHIPCO_FLASHCTL_AT_PAGE_ERASE 0x0281 | ||
305 | #define SSB_CHIPCO_FLASHCTL_AT_BLOCK_ERASE 0x0250 | ||
306 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRER_PRGM 0x0382 /* Write erase program */ | ||
307 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRER_PRGM 0x0385 /* Write erase program */ | ||
308 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_LOAD 0x0253 | ||
309 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_LOAD 0x0255 | ||
310 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_COMPARE 0x0260 | ||
311 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_COMPARE 0x0261 | ||
312 | #define SSB_CHIPCO_FLASHCTL_AT_BUF1_REPROGRAM 0x0258 | ||
313 | #define SSB_CHIPCO_FLASHCTL_AT_BUF2_REPROGRAM 0x0259 | ||
314 | |||
315 | /* Status register bits for Atmel flashes */ | ||
316 | #define SSB_CHIPCO_FLASHSTA_AT_READY 0x80 | ||
317 | #define SSB_CHIPCO_FLASHSTA_AT_MISMATCH 0x40 | ||
318 | #define SSB_CHIPCO_FLASHSTA_AT_ID 0x38 | ||
319 | #define SSB_CHIPCO_FLASHSTA_AT_ID_SHIFT 3 | ||
320 | |||
321 | |||
322 | /** OTP **/ | ||
323 | |||
324 | /* OTP regions */ | ||
325 | #define SSB_CHIPCO_OTP_HW_REGION SSB_CHIPCO_OTPS_HW_PROTECT | ||
326 | #define SSB_CHIPCO_OTP_SW_REGION SSB_CHIPCO_OTPS_SW_PROTECT | ||
327 | #define SSB_CHIPCO_OTP_CID_REGION SSB_CHIPCO_OTPS_CID_PROTECT | ||
328 | |||
329 | /* OTP regions (Byte offsets from otp size) */ | ||
330 | #define SSB_CHIPCO_OTP_SWLIM_OFF (-8) | ||
331 | #define SSB_CHIPCO_OTP_CIDBASE_OFF 0 | ||
332 | #define SSB_CHIPCO_OTP_CIDLIM_OFF 8 | ||
333 | |||
334 | /* Predefined OTP words (Word offset from otp size) */ | ||
335 | #define SSB_CHIPCO_OTP_BOUNDARY_OFF (-4) | ||
336 | #define SSB_CHIPCO_OTP_HWSIGN_OFF (-3) | ||
337 | #define SSB_CHIPCO_OTP_SWSIGN_OFF (-2) | ||
338 | #define SSB_CHIPCO_OTP_CIDSIGN_OFF (-1) | ||
339 | |||
340 | #define SSB_CHIPCO_OTP_CID_OFF 0 | ||
341 | #define SSB_CHIPCO_OTP_PKG_OFF 1 | ||
342 | #define SSB_CHIPCO_OTP_FID_OFF 2 | ||
343 | #define SSB_CHIPCO_OTP_RSV_OFF 3 | ||
344 | #define SSB_CHIPCO_OTP_LIM_OFF 4 | ||
345 | |||
346 | #define SSB_CHIPCO_OTP_SIGNATURE 0x578A | ||
347 | #define SSB_CHIPCO_OTP_MAGIC 0x4E56 | ||
348 | |||
349 | |||
350 | struct ssb_device; | ||
351 | struct ssb_serial_port; | ||
352 | |||
353 | struct ssb_chipcommon { | ||
354 | struct ssb_device *dev; | ||
355 | u32 capabilities; | ||
356 | /* Fast Powerup Delay constant */ | ||
357 | u16 fast_pwrup_delay; | ||
358 | }; | ||
359 | |||
360 | extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); | ||
361 | |||
362 | #include <linux/pm.h> | ||
363 | extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state); | ||
364 | extern void ssb_chipco_resume(struct ssb_chipcommon *cc); | ||
365 | |||
366 | extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, | ||
367 | u32 *plltype, u32 *n, u32 *m); | ||
368 | extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc, | ||
369 | u32 *plltype, u32 *n, u32 *m); | ||
370 | extern void ssb_chipco_timing_init(struct ssb_chipcommon *cc, | ||
371 | unsigned long ns_per_cycle); | ||
372 | |||
373 | enum ssb_clkmode { | ||
374 | SSB_CLKMODE_SLOW, | ||
375 | SSB_CLKMODE_FAST, | ||
376 | SSB_CLKMODE_DYNAMIC, | ||
377 | }; | ||
378 | |||
379 | extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, | ||
380 | enum ssb_clkmode mode); | ||
381 | |||
382 | extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, | ||
383 | u32 ticks); | ||
384 | |||
385 | u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); | ||
386 | |||
387 | void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); | ||
388 | |||
389 | void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value); | ||
390 | |||
391 | #ifdef CONFIG_SSB_SERIAL | ||
392 | extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc, | ||
393 | struct ssb_serial_port *ports); | ||
394 | #endif /* CONFIG_SSB_SERIAL */ | ||
395 | |||
396 | #endif /* LINUX_SSB_CHIPCO_H_ */ | ||
diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h new file mode 100644 index 000000000000..a9164357b5ae --- /dev/null +++ b/include/linux/ssb/ssb_driver_extif.h | |||
@@ -0,0 +1,204 @@ | |||
1 | /* | ||
2 | * Hardware-specific External Interface I/O core definitions | ||
3 | * for the BCM47xx family of SiliconBackplane-based chips. | ||
4 | * | ||
5 | * The External Interface core supports a total of three external chip selects | ||
6 | * supporting external interfaces. One of the external chip selects is | ||
7 | * used for Flash, one is used for PCMCIA, and the other may be | ||
8 | * programmed to support either a synchronous interface or an | ||
9 | * asynchronous interface. The asynchronous interface can be used to | ||
10 | * support external devices such as UARTs and the BCM2019 Bluetooth | ||
11 | * baseband processor. | ||
12 | * The external interface core also contains 2 on-chip 16550 UARTs, clock | ||
13 | * frequency control, a watchdog interrupt timer, and a GPIO interface. | ||
14 | * | ||
15 | * Copyright 2005, Broadcom Corporation | ||
16 | * Copyright 2006, Michael Buesch | ||
17 | * | ||
18 | * Licensed under the GPL version 2. See COPYING for details. | ||
19 | */ | ||
20 | #ifndef LINUX_SSB_EXTIFCORE_H_ | ||
21 | #define LINUX_SSB_EXTIFCORE_H_ | ||
22 | |||
23 | /* external interface address space */ | ||
24 | #define SSB_EXTIF_PCMCIA_MEMBASE(x) (x) | ||
25 | #define SSB_EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000) | ||
26 | #define SSB_EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000) | ||
27 | #define SSB_EXTIF_CFGIF_BASE(x) ((x) + 0x800000) | ||
28 | #define SSB_EXTIF_FLASH_BASE(x) ((x) + 0xc00000) | ||
29 | |||
30 | #define SSB_EXTIF_NR_GPIOOUT 5 | ||
31 | /* GPIO NOTE: | ||
32 | * The multiple instances of output and output enable registers | ||
33 | * are present to allow driver software for multiple cores to control | ||
34 | * gpio outputs without needing to share a single register pair. | ||
35 | * Use the following helper macro to get a register offset value. | ||
36 | */ | ||
37 | #define SSB_EXTIF_GPIO_OUT(index) ({ \ | ||
38 | BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \ | ||
39 | SSB_EXTIF_GPIO_OUT_BASE + ((index) * 8); \ | ||
40 | }) | ||
41 | #define SSB_EXTIF_GPIO_OUTEN(index) ({ \ | ||
42 | BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \ | ||
43 | SSB_EXTIF_GPIO_OUTEN_BASE + ((index) * 8); \ | ||
44 | }) | ||
45 | |||
46 | /** EXTIF core registers **/ | ||
47 | |||
48 | #define SSB_EXTIF_CTL 0x0000 | ||
49 | #define SSB_EXTIF_CTL_UARTEN (1 << 0) /* UART enable */ | ||
50 | #define SSB_EXTIF_EXTSTAT 0x0004 | ||
51 | #define SSB_EXTIF_EXTSTAT_EMODE (1 << 0) /* Endian mode (ro) */ | ||
52 | #define SSB_EXTIF_EXTSTAT_EIRQPIN (1 << 1) /* External interrupt pin (ro) */ | ||
53 | #define SSB_EXTIF_EXTSTAT_GPIOIRQPIN (1 << 2) /* GPIO interrupt pin (ro) */ | ||
54 | #define SSB_EXTIF_PCMCIA_CFG 0x0010 | ||
55 | #define SSB_EXTIF_PCMCIA_MEMWAIT 0x0014 | ||
56 | #define SSB_EXTIF_PCMCIA_ATTRWAIT 0x0018 | ||
57 | #define SSB_EXTIF_PCMCIA_IOWAIT 0x001C | ||
58 | #define SSB_EXTIF_PROG_CFG 0x0020 | ||
59 | #define SSB_EXTIF_PROG_WAITCNT 0x0024 | ||
60 | #define SSB_EXTIF_FLASH_CFG 0x0028 | ||
61 | #define SSB_EXTIF_FLASH_WAITCNT 0x002C | ||
62 | #define SSB_EXTIF_WATCHDOG 0x0040 | ||
63 | #define SSB_EXTIF_CLOCK_N 0x0044 | ||
64 | #define SSB_EXTIF_CLOCK_SB 0x0048 | ||
65 | #define SSB_EXTIF_CLOCK_PCI 0x004C | ||
66 | #define SSB_EXTIF_CLOCK_MII 0x0050 | ||
67 | #define SSB_EXTIF_GPIO_IN 0x0060 | ||
68 | #define SSB_EXTIF_GPIO_OUT_BASE 0x0064 | ||
69 | #define SSB_EXTIF_GPIO_OUTEN_BASE 0x0068 | ||
70 | #define SSB_EXTIF_EJTAG_OUTEN 0x0090 | ||
71 | #define SSB_EXTIF_GPIO_INTPOL 0x0094 | ||
72 | #define SSB_EXTIF_GPIO_INTMASK 0x0098 | ||
73 | #define SSB_EXTIF_UART_DATA 0x0300 | ||
74 | #define SSB_EXTIF_UART_TIMER 0x0310 | ||
75 | #define SSB_EXTIF_UART_FCR 0x0320 | ||
76 | #define SSB_EXTIF_UART_LCR 0x0330 | ||
77 | #define SSB_EXTIF_UART_MCR 0x0340 | ||
78 | #define SSB_EXTIF_UART_LSR 0x0350 | ||
79 | #define SSB_EXTIF_UART_MSR 0x0360 | ||
80 | #define SSB_EXTIF_UART_SCRATCH 0x0370 | ||
81 | |||
82 | |||
83 | |||
84 | |||
85 | /* pcmcia/prog/flash_config */ | ||
86 | #define SSB_EXTCFG_EN (1 << 0) /* enable */ | ||
87 | #define SSB_EXTCFG_MODE 0xE /* mode */ | ||
88 | #define SSB_EXTCFG_MODE_SHIFT 1 | ||
89 | #define SSB_EXTCFG_MODE_FLASH 0x0 /* flash/asynchronous mode */ | ||
90 | #define SSB_EXTCFG_MODE_SYNC 0x2 /* synchronous mode */ | ||
91 | #define SSB_EXTCFG_MODE_PCMCIA 0x4 /* pcmcia mode */ | ||
92 | #define SSB_EXTCFG_DS16 (1 << 4) /* destsize: 0=8bit, 1=16bit */ | ||
93 | #define SSB_EXTCFG_BSWAP (1 << 5) /* byteswap */ | ||
94 | #define SSB_EXTCFG_CLKDIV 0xC0 /* clock divider */ | ||
95 | #define SSB_EXTCFG_CLKDIV_SHIFT 6 | ||
96 | #define SSB_EXTCFG_CLKDIV_2 0x0 /* backplane/2 */ | ||
97 | #define SSB_EXTCFG_CLKDIV_3 0x40 /* backplane/3 */ | ||
98 | #define SSB_EXTCFG_CLKDIV_4 0x80 /* backplane/4 */ | ||
99 | #define SSB_EXTCFG_CLKEN (1 << 8) /* clock enable */ | ||
100 | #define SSB_EXTCFG_STROBE (1 << 9) /* size/bytestrobe (synch only) */ | ||
101 | |||
102 | /* pcmcia_memwait */ | ||
103 | #define SSB_PCMCIA_MEMW_0 0x0000003F /* waitcount0 */ | ||
104 | #define SSB_PCMCIA_MEMW_1 0x00001F00 /* waitcount1 */ | ||
105 | #define SSB_PCMCIA_MEMW_1_SHIFT 8 | ||
106 | #define SSB_PCMCIA_MEMW_2 0x001F0000 /* waitcount2 */ | ||
107 | #define SSB_PCMCIA_MEMW_2_SHIFT 16 | ||
108 | #define SSB_PCMCIA_MEMW_3 0x1F000000 /* waitcount3 */ | ||
109 | #define SSB_PCMCIA_MEMW_3_SHIFT 24 | ||
110 | |||
111 | /* pcmcia_attrwait */ | ||
112 | #define SSB_PCMCIA_ATTW_0 0x0000003F /* waitcount0 */ | ||
113 | #define SSB_PCMCIA_ATTW_1 0x00001F00 /* waitcount1 */ | ||
114 | #define SSB_PCMCIA_ATTW_1_SHIFT 8 | ||
115 | #define SSB_PCMCIA_ATTW_2 0x001F0000 /* waitcount2 */ | ||
116 | #define SSB_PCMCIA_ATTW_2_SHIFT 16 | ||
117 | #define SSB_PCMCIA_ATTW_3 0x1F000000 /* waitcount3 */ | ||
118 | #define SSB_PCMCIA_ATTW_3_SHIFT 24 | ||
119 | |||
120 | /* pcmcia_iowait */ | ||
121 | #define SSB_PCMCIA_IOW_0 0x0000003F /* waitcount0 */ | ||
122 | #define SSB_PCMCIA_IOW_1 0x00001F00 /* waitcount1 */ | ||
123 | #define SSB_PCMCIA_IOW_1_SHIFT 8 | ||
124 | #define SSB_PCMCIA_IOW_2 0x001F0000 /* waitcount2 */ | ||
125 | #define SSB_PCMCIA_IOW_2_SHIFT 16 | ||
126 | #define SSB_PCMCIA_IOW_3 0x1F000000 /* waitcount3 */ | ||
127 | #define SSB_PCMCIA_IOW_3_SHIFT 24 | ||
128 | |||
129 | /* prog_waitcount */ | ||
130 | #define SSB_PROG_WCNT_0 0x0000001F /* waitcount0 */ | ||
131 | #define SSB_PROG_WCNT_1 0x00001F00 /* waitcount1 */ | ||
132 | #define SSB_PROG_WCNT_1_SHIFT 8 | ||
133 | #define SSB_PROG_WCNT_2 0x001F0000 /* waitcount2 */ | ||
134 | #define SSB_PROG_WCNT_2_SHIFT 16 | ||
135 | #define SSB_PROG_WCNT_3 0x1F000000 /* waitcount3 */ | ||
136 | #define SSB_PROG_WCNT_3_SHIFT 24 | ||
137 | |||
138 | #define SSB_PROG_W0 0x0000000C | ||
139 | #define SSB_PROG_W1 0x00000A00 | ||
140 | #define SSB_PROG_W2 0x00020000 | ||
141 | #define SSB_PROG_W3 0x01000000 | ||
142 | |||
143 | /* flash_waitcount */ | ||
144 | #define SSB_FLASH_WCNT_0 0x0000001F /* waitcount0 */ | ||
145 | #define SSB_FLASH_WCNT_1 0x00001F00 /* waitcount1 */ | ||
146 | #define SSB_FLASH_WCNT_1_SHIFT 8 | ||
147 | #define SSB_FLASH_WCNT_2 0x001F0000 /* waitcount2 */ | ||
148 | #define SSB_FLASH_WCNT_2_SHIFT 16 | ||
149 | #define SSB_FLASH_WCNT_3 0x1F000000 /* waitcount3 */ | ||
150 | #define SSB_FLASH_WCNT_3_SHIFT 24 | ||
151 | |||
152 | /* watchdog */ | ||
153 | #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ | ||
154 | |||
155 | |||
156 | |||
157 | #ifdef CONFIG_SSB_DRIVER_EXTIF | ||
158 | |||
159 | struct ssb_extif { | ||
160 | struct ssb_device *dev; | ||
161 | }; | ||
162 | |||
163 | static inline bool ssb_extif_available(struct ssb_extif *extif) | ||
164 | { | ||
165 | return (extif->dev != NULL); | ||
166 | } | ||
167 | |||
168 | extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif, | ||
169 | u32 *plltype, u32 *n, u32 *m); | ||
170 | |||
171 | extern void ssb_extif_timing_init(struct ssb_extif *extif, | ||
172 | unsigned long ns); | ||
173 | |||
174 | u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); | ||
175 | |||
176 | void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value); | ||
177 | |||
178 | void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value); | ||
179 | |||
180 | #ifdef CONFIG_SSB_SERIAL | ||
181 | extern int ssb_extif_serial_init(struct ssb_extif *extif, | ||
182 | struct ssb_serial_port *ports); | ||
183 | #endif /* CONFIG_SSB_SERIAL */ | ||
184 | |||
185 | |||
186 | #else /* CONFIG_SSB_DRIVER_EXTIF */ | ||
187 | /* extif disabled */ | ||
188 | |||
189 | struct ssb_extif { | ||
190 | }; | ||
191 | |||
192 | static inline bool ssb_extif_available(struct ssb_extif *extif) | ||
193 | { | ||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static inline | ||
198 | void ssb_extif_get_clockcontrol(struct ssb_extif *extif, | ||
199 | u32 *plltype, u32 *n, u32 *m) | ||
200 | { | ||
201 | } | ||
202 | |||
203 | #endif /* CONFIG_SSB_DRIVER_EXTIF */ | ||
204 | #endif /* LINUX_SSB_EXTIFCORE_H_ */ | ||
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h new file mode 100644 index 000000000000..5f44e9740cd2 --- /dev/null +++ b/include/linux/ssb/ssb_driver_mips.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef LINUX_SSB_MIPSCORE_H_ | ||
2 | #define LINUX_SSB_MIPSCORE_H_ | ||
3 | |||
4 | #ifdef CONFIG_SSB_DRIVER_MIPS | ||
5 | |||
6 | struct ssb_device; | ||
7 | |||
8 | struct ssb_serial_port { | ||
9 | void *regs; | ||
10 | unsigned long clockspeed; | ||
11 | unsigned int irq; | ||
12 | unsigned int baud_base; | ||
13 | unsigned int reg_shift; | ||
14 | }; | ||
15 | |||
16 | |||
17 | struct ssb_mipscore { | ||
18 | struct ssb_device *dev; | ||
19 | |||
20 | int nr_serial_ports; | ||
21 | struct ssb_serial_port serial_ports[4]; | ||
22 | |||
23 | u8 flash_buswidth; | ||
24 | u32 flash_window; | ||
25 | u32 flash_window_size; | ||
26 | }; | ||
27 | |||
28 | extern void ssb_mipscore_init(struct ssb_mipscore *mcore); | ||
29 | extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore); | ||
30 | |||
31 | extern unsigned int ssb_mips_irq(struct ssb_device *dev); | ||
32 | |||
33 | |||
34 | #else /* CONFIG_SSB_DRIVER_MIPS */ | ||
35 | |||
36 | struct ssb_mipscore { | ||
37 | }; | ||
38 | |||
39 | static inline | ||
40 | void ssb_mipscore_init(struct ssb_mipscore *mcore) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | #endif /* CONFIG_SSB_DRIVER_MIPS */ | ||
45 | |||
46 | #endif /* LINUX_SSB_MIPSCORE_H_ */ | ||
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h new file mode 100644 index 000000000000..9cfffb7b1a27 --- /dev/null +++ b/include/linux/ssb/ssb_driver_pci.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #ifndef LINUX_SSB_PCICORE_H_ | ||
2 | #define LINUX_SSB_PCICORE_H_ | ||
3 | |||
4 | #ifdef CONFIG_SSB_DRIVER_PCICORE | ||
5 | |||
6 | /* PCI core registers. */ | ||
7 | #define SSB_PCICORE_CTL 0x0000 /* PCI Control */ | ||
8 | #define SSB_PCICORE_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */ | ||
9 | #define SSB_PCICORE_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */ | ||
10 | #define SSB_PCICORE_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */ | ||
11 | #define SSB_PCICORE_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */ | ||
12 | #define SSB_PCICORE_ARBCTL 0x0010 /* PCI Arbiter Control */ | ||
13 | #define SSB_PCICORE_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */ | ||
14 | #define SSB_PCICORE_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */ | ||
15 | #define SSB_PCICORE_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */ | ||
16 | #define SSB_PCICORE_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */ | ||
17 | #define SSB_PCICORE_ARBCTL_PARKID_4710 0x00000002 /* 4710 */ | ||
18 | #define SSB_PCICORE_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */ | ||
19 | #define SSB_PCICORE_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */ | ||
20 | #define SSB_PCICORE_ISTAT 0x0020 /* Interrupt status */ | ||
21 | #define SSB_PCICORE_ISTAT_INTA 0x00000001 /* PCI INTA# */ | ||
22 | #define SSB_PCICORE_ISTAT_INTB 0x00000002 /* PCI INTB# */ | ||
23 | #define SSB_PCICORE_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */ | ||
24 | #define SSB_PCICORE_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */ | ||
25 | #define SSB_PCICORE_ISTAT_PME 0x00000010 /* PCI PME# */ | ||
26 | #define SSB_PCICORE_IMASK 0x0024 /* Interrupt mask */ | ||
27 | #define SSB_PCICORE_IMASK_INTA 0x00000001 /* PCI INTA# */ | ||
28 | #define SSB_PCICORE_IMASK_INTB 0x00000002 /* PCI INTB# */ | ||
29 | #define SSB_PCICORE_IMASK_SERR 0x00000004 /* PCI SERR# */ | ||
30 | #define SSB_PCICORE_IMASK_PERR 0x00000008 /* PCI PERR# */ | ||
31 | #define SSB_PCICORE_IMASK_PME 0x00000010 /* PCI PME# */ | ||
32 | #define SSB_PCICORE_MBOX 0x0028 /* Backplane to PCI Mailbox */ | ||
33 | #define SSB_PCICORE_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */ | ||
34 | #define SSB_PCICORE_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */ | ||
35 | #define SSB_PCICORE_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */ | ||
36 | #define SSB_PCICORE_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */ | ||
37 | #define SSB_PCICORE_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */ | ||
38 | #define SSB_PCICORE_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */ | ||
39 | #define SSB_PCICORE_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */ | ||
40 | #define SSB_PCICORE_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */ | ||
41 | #define SSB_PCICORE_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */ | ||
42 | #define SSB_PCICORE_BCAST_ADDR_MASK 0x000000FF | ||
43 | #define SSB_PCICORE_BCAST_DATA 0x0054 /* Backplane Broadcast Data */ | ||
44 | #define SSB_PCICORE_GPIO_IN 0x0060 /* rev >= 2 only */ | ||
45 | #define SSB_PCICORE_GPIO_OUT 0x0064 /* rev >= 2 only */ | ||
46 | #define SSB_PCICORE_GPIO_ENABLE 0x0068 /* rev >= 2 only */ | ||
47 | #define SSB_PCICORE_GPIO_CTL 0x006C /* rev >= 2 only */ | ||
48 | #define SSB_PCICORE_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */ | ||
49 | #define SSB_PCICORE_SBTOPCI0_MASK 0xFC000000 | ||
50 | #define SSB_PCICORE_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */ | ||
51 | #define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000 | ||
52 | #define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ | ||
53 | #define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000 | ||
54 | |||
55 | /* SBtoPCIx */ | ||
56 | #define SSB_PCICORE_SBTOPCI_MEM 0x00000000 | ||
57 | #define SSB_PCICORE_SBTOPCI_IO 0x00000001 | ||
58 | #define SSB_PCICORE_SBTOPCI_CFG0 0x00000002 | ||
59 | #define SSB_PCICORE_SBTOPCI_CFG1 0x00000003 | ||
60 | #define SSB_PCICORE_SBTOPCI_PREF 0x00000004 /* Prefetch enable */ | ||
61 | #define SSB_PCICORE_SBTOPCI_BURST 0x00000008 /* Burst enable */ | ||
62 | #define SSB_PCICORE_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */ | ||
63 | #define SSB_PCICORE_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */ | ||
64 | #define SSB_PCICORE_SBTOPCI_RC_READ 0x00000000 /* Memory read */ | ||
65 | #define SSB_PCICORE_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ | ||
66 | #define SSB_PCICORE_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ | ||
67 | |||
68 | |||
69 | /* PCIcore specific boardflags */ | ||
70 | #define SSB_PCICORE_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ | ||
71 | |||
72 | |||
73 | struct ssb_pcicore { | ||
74 | struct ssb_device *dev; | ||
75 | u8 setup_done:1; | ||
76 | u8 hostmode:1; | ||
77 | u8 cardbusmode:1; | ||
78 | }; | ||
79 | |||
80 | extern void ssb_pcicore_init(struct ssb_pcicore *pc); | ||
81 | |||
82 | /* Enable IRQ routing for a specific device */ | ||
83 | extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, | ||
84 | struct ssb_device *dev); | ||
85 | |||
86 | |||
87 | #else /* CONFIG_SSB_DRIVER_PCICORE */ | ||
88 | |||
89 | |||
90 | struct ssb_pcicore { | ||
91 | }; | ||
92 | |||
93 | static inline | ||
94 | void ssb_pcicore_init(struct ssb_pcicore *pc) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | static inline | ||
99 | int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, | ||
100 | struct ssb_device *dev) | ||
101 | { | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | #endif /* CONFIG_SSB_DRIVER_PCICORE */ | ||
106 | #endif /* LINUX_SSB_PCICORE_H_ */ | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h new file mode 100644 index 000000000000..47c7c71a5acf --- /dev/null +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -0,0 +1,292 @@ | |||
1 | #ifndef LINUX_SSB_REGS_H_ | ||
2 | #define LINUX_SSB_REGS_H_ | ||
3 | |||
4 | |||
5 | /* SiliconBackplane Address Map. | ||
6 | * All regions may not exist on all chips. | ||
7 | */ | ||
8 | #define SSB_SDRAM_BASE 0x00000000U /* Physical SDRAM */ | ||
9 | #define SSB_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */ | ||
10 | #define SSB_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */ | ||
11 | #define SSB_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */ | ||
12 | #define SSB_ENUM_BASE 0x18000000U /* Enumeration space base */ | ||
13 | #define SSB_ENUM_LIMIT 0x18010000U /* Enumeration space limit */ | ||
14 | |||
15 | #define SSB_FLASH2 0x1c000000U /* Flash Region 2 (region 1 shadowed here) */ | ||
16 | #define SSB_FLASH2_SZ 0x02000000U /* Size of Flash Region 2 */ | ||
17 | |||
18 | #define SSB_EXTIF_BASE 0x1f000000U /* External Interface region base address */ | ||
19 | #define SSB_FLASH1 0x1fc00000U /* Flash Region 1 */ | ||
20 | #define SSB_FLASH1_SZ 0x00400000U /* Size of Flash Region 1 */ | ||
21 | |||
22 | #define SSB_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */ | ||
23 | #define SSB_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */ | ||
24 | #define SSB_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */ | ||
25 | #define SSB_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ | ||
26 | #define SSB_EUART (SSB_EXTIF_BASE + 0x00800000) | ||
27 | #define SSB_LED (SSB_EXTIF_BASE + 0x00900000) | ||
28 | |||
29 | |||
30 | /* Enumeration space constants */ | ||
31 | #define SSB_CORE_SIZE 0x1000 /* Size of a core MMIO area */ | ||
32 | #define SSB_MAX_NR_CORES ((SSB_ENUM_LIMIT - SSB_ENUM_BASE) / SSB_CORE_SIZE) | ||
33 | |||
34 | |||
35 | /* mips address */ | ||
36 | #define SSB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ | ||
37 | |||
38 | |||
39 | /* SSB PCI config space registers. */ | ||
40 | #define SSB_PMCSR 0x44 | ||
41 | #define SSB_PE 0x100 | ||
42 | #define SSB_BAR0_WIN 0x80 /* Backplane address space 0 */ | ||
43 | #define SSB_BAR1_WIN 0x84 /* Backplane address space 1 */ | ||
44 | #define SSB_SPROMCTL 0x88 /* SPROM control */ | ||
45 | #define SSB_SPROMCTL_WE 0x10 /* SPROM write enable */ | ||
46 | #define SSB_BAR1_CONTROL 0x8c /* Address space 1 burst control */ | ||
47 | #define SSB_PCI_IRQS 0x90 /* PCI interrupts */ | ||
48 | #define SSB_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */ | ||
49 | #define SSB_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */ | ||
50 | #define SSB_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */ | ||
51 | #define SSB_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */ | ||
52 | #define SSB_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */ | ||
53 | #define SSB_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */ | ||
54 | #define SSB_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */ | ||
55 | #define SSB_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ | ||
56 | #define SSB_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ | ||
57 | |||
58 | |||
59 | #define SSB_BAR0_MAX_RETRIES 50 | ||
60 | |||
61 | /* Silicon backplane configuration register definitions */ | ||
62 | #define SSB_IPSFLAG 0x0F08 | ||
63 | #define SSB_IPSFLAG_IRQ1 0x0000003F /* which sbflags get routed to mips interrupt 1 */ | ||
64 | #define SSB_IPSFLAG_IRQ1_SHIFT 0 | ||
65 | #define SSB_IPSFLAG_IRQ2 0x00003F00 /* which sbflags get routed to mips interrupt 2 */ | ||
66 | #define SSB_IPSFLAG_IRQ2_SHIFT 8 | ||
67 | #define SSB_IPSFLAG_IRQ3 0x003F0000 /* which sbflags get routed to mips interrupt 3 */ | ||
68 | #define SSB_IPSFLAG_IRQ3_SHIFT 16 | ||
69 | #define SSB_IPSFLAG_IRQ4 0x3F000000 /* which sbflags get routed to mips interrupt 4 */ | ||
70 | #define SSB_IPSFLAG_IRQ4_SHIFT 24 | ||
71 | #define SSB_TPSFLAG 0x0F18 | ||
72 | #define SSB_TPSFLAG_BPFLAG 0x0000003F /* Backplane flag # */ | ||
73 | #define SSB_TPSFLAG_ALWAYSIRQ 0x00000040 /* IRQ is always sent on the Backplane */ | ||
74 | #define SSB_TMERRLOGA 0x0F48 | ||
75 | #define SSB_TMERRLOG 0x0F50 | ||
76 | #define SSB_ADMATCH3 0x0F60 | ||
77 | #define SSB_ADMATCH2 0x0F68 | ||
78 | #define SSB_ADMATCH1 0x0F70 | ||
79 | #define SSB_IMSTATE 0x0F90 /* SB Initiator Agent State */ | ||
80 | #define SSB_IMSTATE_PC 0x0000000f /* Pipe Count */ | ||
81 | #define SSB_IMSTATE_AP_MASK 0x00000030 /* Arbitration Priority */ | ||
82 | #define SSB_IMSTATE_AP_BOTH 0x00000000 /* Use both timeslices and token */ | ||
83 | #define SSB_IMSTATE_AP_TS 0x00000010 /* Use timeslices only */ | ||
84 | #define SSB_IMSTATE_AP_TK 0x00000020 /* Use token only */ | ||
85 | #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ | ||
86 | #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ | ||
87 | #define SSB_IMSTATE_TO 0x00040000 /* Timeout */ | ||
88 | #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ | ||
89 | #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ | ||
90 | #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ | ||
91 | #define SSB_INTVEC_ILINE20 0x00000004 /* Enable interrupts for iline20 */ | ||
92 | #define SSB_INTVEC_CODEC 0x00000008 /* Enable interrupts for v90 codec */ | ||
93 | #define SSB_INTVEC_USB 0x00000010 /* Enable interrupts for usb */ | ||
94 | #define SSB_INTVEC_EXTIF 0x00000020 /* Enable interrupts for external i/f */ | ||
95 | #define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */ | ||
96 | #define SSB_TMSLOW 0x0F98 /* SB Target State Low */ | ||
97 | #define SSB_TMSLOW_RESET 0x00000001 /* Reset */ | ||
98 | #define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ | ||
99 | #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ | ||
100 | #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ | ||
101 | #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ | ||
102 | #define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ | ||
103 | #define SSB_TMSLOW_BE 0x80000000 /* BIST Enable */ | ||
104 | #define SSB_TMSHIGH 0x0F9C /* SB Target State High */ | ||
105 | #define SSB_TMSHIGH_SERR 0x00000001 /* S-error */ | ||
106 | #define SSB_TMSHIGH_INT 0x00000002 /* Interrupt */ | ||
107 | #define SSB_TMSHIGH_BUSY 0x00000004 /* Busy */ | ||
108 | #define SSB_TMSHIGH_TO 0x00000020 /* Timeout. Backplane rev >= 2.3 only */ | ||
109 | #define SSB_TMSHIGH_COREFL 0x1FFF0000 /* Core specific flags */ | ||
110 | #define SSB_TMSHIGH_COREFL_SHIFT 16 | ||
111 | #define SSB_TMSHIGH_DMA64 0x10000000 /* 64bit DMA supported */ | ||
112 | #define SSB_TMSHIGH_GCR 0x20000000 /* Gated Clock Request */ | ||
113 | #define SSB_TMSHIGH_BISTF 0x40000000 /* BIST Failed */ | ||
114 | #define SSB_TMSHIGH_BISTD 0x80000000 /* BIST Done */ | ||
115 | #define SSB_BWA0 0x0FA0 | ||
116 | #define SSB_IMCFGLO 0x0FA8 | ||
117 | #define SSB_IMCFGLO_SERTO 0x00000007 /* Service timeout */ | ||
118 | #define SSB_IMCFGLO_REQTO 0x00000070 /* Request timeout */ | ||
119 | #define SSB_IMCFGLO_REQTO_SHIFT 4 | ||
120 | #define SSB_IMCFGLO_CONNID 0x00FF0000 /* Connection ID */ | ||
121 | #define SSB_IMCFGLO_CONNID_SHIFT 16 | ||
122 | #define SSB_IMCFGHI 0x0FAC | ||
123 | #define SSB_ADMATCH0 0x0FB0 | ||
124 | #define SSB_TMCFGLO 0x0FB8 | ||
125 | #define SSB_TMCFGHI 0x0FBC | ||
126 | #define SSB_BCONFIG 0x0FC0 | ||
127 | #define SSB_BSTATE 0x0FC8 | ||
128 | #define SSB_ACTCFG 0x0FD8 | ||
129 | #define SSB_FLAGST 0x0FE8 | ||
130 | #define SSB_IDLOW 0x0FF8 | ||
131 | #define SSB_IDLOW_CFGSP 0x00000003 /* Config Space */ | ||
132 | #define SSB_IDLOW_ADDRNGE 0x00000038 /* Address Ranges supported */ | ||
133 | #define SSB_IDLOW_ADDRNGE_SHIFT 3 | ||
134 | #define SSB_IDLOW_SYNC 0x00000040 | ||
135 | #define SSB_IDLOW_INITIATOR 0x00000080 | ||
136 | #define SSB_IDLOW_MIBL 0x00000F00 /* Minimum Backplane latency */ | ||
137 | #define SSB_IDLOW_MIBL_SHIFT 8 | ||
138 | #define SSB_IDLOW_MABL 0x0000F000 /* Maximum Backplane latency */ | ||
139 | #define SSB_IDLOW_MABL_SHIFT 12 | ||
140 | #define SSB_IDLOW_TIF 0x00010000 /* This Initiator is first */ | ||
141 | #define SSB_IDLOW_CCW 0x000C0000 /* Cycle counter width */ | ||
142 | #define SSB_IDLOW_CCW_SHIFT 18 | ||
143 | #define SSB_IDLOW_TPT 0x00F00000 /* Target ports */ | ||
144 | #define SSB_IDLOW_TPT_SHIFT 20 | ||
145 | #define SSB_IDLOW_INITP 0x0F000000 /* Initiator ports */ | ||
146 | #define SSB_IDLOW_INITP_SHIFT 24 | ||
147 | #define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ | ||
148 | #define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ | ||
149 | #define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ | ||
150 | #define SSB_IDHIGH 0x0FFC /* SB Identification High */ | ||
151 | #define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ | ||
152 | #define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ | ||
153 | #define SSB_IDHIGH_CC_SHIFT 4 | ||
154 | #define SSB_IDHIGH_RCHI 0x00007000 /* Revision Code (high part) */ | ||
155 | #define SSB_IDHIGH_RCHI_SHIFT 8 /* yes, shift 8 is right */ | ||
156 | #define SSB_IDHIGH_VC 0xFFFF0000 /* Vendor Code */ | ||
157 | #define SSB_IDHIGH_VC_SHIFT 16 | ||
158 | |||
159 | /* SPROM shadow area. If not otherwise noted, fields are | ||
160 | * two bytes wide. Note that the SPROM can _only_ be read | ||
161 | * in two-byte quantinies. | ||
162 | */ | ||
163 | #define SSB_SPROMSIZE_WORDS 64 | ||
164 | #define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) | ||
165 | #define SSB_SPROM_BASE 0x1000 | ||
166 | #define SSB_SPROM_REVISION 0x107E | ||
167 | #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ | ||
168 | #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ | ||
169 | #define SSB_SPROM_REVISION_CRC_SHIFT 8 | ||
170 | /* SPROM Revision 1 */ | ||
171 | #define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ | ||
172 | #define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ | ||
173 | #define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */ | ||
174 | #define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */ | ||
175 | #define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */ | ||
176 | #define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */ | ||
177 | #define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */ | ||
178 | #define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ | ||
179 | #define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ | ||
180 | #define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5 | ||
181 | #define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ | ||
182 | #define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ | ||
183 | #define SSB_SPROM1_BINF 0x105C /* Board info */ | ||
184 | #define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ | ||
185 | #define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ | ||
186 | #define SSB_SPROM1_BINF_CCODE_SHIFT 8 | ||
187 | #define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */ | ||
188 | #define SSB_SPROM1_BINF_ANTA_SHIFT 12 | ||
189 | #define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */ | ||
190 | #define SSB_SPROM1_BINF_ANTBG_SHIFT 14 | ||
191 | #define SSB_SPROM1_PA0B0 0x105E | ||
192 | #define SSB_SPROM1_PA0B1 0x1060 | ||
193 | #define SSB_SPROM1_PA0B2 0x1062 | ||
194 | #define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */ | ||
195 | #define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */ | ||
196 | #define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */ | ||
197 | #define SSB_SPROM1_GPIOA_P1_SHIFT 8 | ||
198 | #define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */ | ||
199 | #define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */ | ||
200 | #define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */ | ||
201 | #define SSB_SPROM1_GPIOB_P3_SHIFT 8 | ||
202 | #define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */ | ||
203 | #define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */ | ||
204 | #define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */ | ||
205 | #define SSB_SPROM1_MAXPWR_A_SHIFT 8 | ||
206 | #define SSB_SPROM1_PA1B0 0x106A | ||
207 | #define SSB_SPROM1_PA1B1 0x106C | ||
208 | #define SSB_SPROM1_PA1B2 0x106E | ||
209 | #define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */ | ||
210 | #define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/ | ||
211 | #define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */ | ||
212 | #define SSB_SPROM1_ITSSI_A_SHIFT 8 | ||
213 | #define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ | ||
214 | #define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ | ||
215 | #define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */ | ||
216 | #define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */ | ||
217 | #define SSB_SPROM1_AGAIN_BG_SHIFT 8 | ||
218 | #define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */ | ||
219 | /* SPROM Revision 2 (inherits from rev 1) */ | ||
220 | #define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ | ||
221 | #define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ | ||
222 | #define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */ | ||
223 | #define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */ | ||
224 | #define SSB_SPROM2_MAXP_A_LO_SHIFT 8 | ||
225 | #define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */ | ||
226 | #define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */ | ||
227 | #define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */ | ||
228 | #define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */ | ||
229 | #define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */ | ||
230 | #define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */ | ||
231 | #define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */ | ||
232 | #define SSB_SPROM2_OPO_VALUE 0x00FF | ||
233 | #define SSB_SPROM2_OPO_UNUSED 0xFF00 | ||
234 | #define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ | ||
235 | /* SPROM Revision 3 (inherits from rev 2) */ | ||
236 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ | ||
237 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ | ||
238 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ | ||
239 | #define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */ | ||
240 | #define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */ | ||
241 | #define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8 | ||
242 | #define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */ | ||
243 | #define SSB_SPROM3_GPIOLDC_ON_SHIFT 16 | ||
244 | #define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */ | ||
245 | #define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */ | ||
246 | #define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */ | ||
247 | #define SSB_SPROM3_CCKPO_2M_SHIFT 4 | ||
248 | #define SSB_SPROM3_CCKPO_55M 0x0F00 /* 5.5M Rate PO */ | ||
249 | #define SSB_SPROM3_CCKPO_55M_SHIFT 8 | ||
250 | #define SSB_SPROM3_CCKPO_11M 0xF000 /* 11M Rate PO */ | ||
251 | #define SSB_SPROM3_CCKPO_11M_SHIFT 12 | ||
252 | #define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ | ||
253 | |||
254 | /* Values for SSB_SPROM1_BINF_CCODE */ | ||
255 | enum { | ||
256 | SSB_SPROM1CCODE_WORLD = 0, | ||
257 | SSB_SPROM1CCODE_THAILAND, | ||
258 | SSB_SPROM1CCODE_ISRAEL, | ||
259 | SSB_SPROM1CCODE_JORDAN, | ||
260 | SSB_SPROM1CCODE_CHINA, | ||
261 | SSB_SPROM1CCODE_JAPAN, | ||
262 | SSB_SPROM1CCODE_USA_CANADA_ANZ, | ||
263 | SSB_SPROM1CCODE_EUROPE, | ||
264 | SSB_SPROM1CCODE_USA_LOW, | ||
265 | SSB_SPROM1CCODE_JAPAN_HIGH, | ||
266 | SSB_SPROM1CCODE_ALL, | ||
267 | SSB_SPROM1CCODE_NONE, | ||
268 | }; | ||
269 | |||
270 | /* Address-Match values and masks (SSB_ADMATCHxxx) */ | ||
271 | #define SSB_ADM_TYPE 0x00000003 /* Address type */ | ||
272 | #define SSB_ADM_TYPE0 0 | ||
273 | #define SSB_ADM_TYPE1 1 | ||
274 | #define SSB_ADM_TYPE2 2 | ||
275 | #define SSB_ADM_AD64 0x00000004 | ||
276 | #define SSB_ADM_SZ0 0x000000F8 /* Type0 size */ | ||
277 | #define SSB_ADM_SZ0_SHIFT 3 | ||
278 | #define SSB_ADM_SZ1 0x000001F8 /* Type1 size */ | ||
279 | #define SSB_ADM_SZ1_SHIFT 3 | ||
280 | #define SSB_ADM_SZ2 0x000001F8 /* Type2 size */ | ||
281 | #define SSB_ADM_SZ2_SHIFT 3 | ||
282 | #define SSB_ADM_EN 0x00000400 /* Enable */ | ||
283 | #define SSB_ADM_NEG 0x00000800 /* Negative decode */ | ||
284 | #define SSB_ADM_BASE0 0xFFFFFF00 /* Type0 base address */ | ||
285 | #define SSB_ADM_BASE0_SHIFT 8 | ||
286 | #define SSB_ADM_BASE1 0xFFFFF000 /* Type1 base address for the core */ | ||
287 | #define SSB_ADM_BASE1_SHIFT 12 | ||
288 | #define SSB_ADM_BASE2 0xFFFF0000 /* Type2 base address for the core */ | ||
289 | #define SSB_ADM_BASE2_SHIFT 16 | ||
290 | |||
291 | |||
292 | #endif /* LINUX_SSB_REGS_H_ */ | ||
diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h new file mode 100644 index 000000000000..e7cf31e8ba79 --- /dev/null +++ b/include/linux/tc_act/tc_nat.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __LINUX_TC_NAT_H | ||
2 | #define __LINUX_TC_NAT_H | ||
3 | |||
4 | #include <linux/pkt_cls.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | #define TCA_ACT_NAT 9 | ||
8 | |||
9 | enum | ||
10 | { | ||
11 | TCA_NAT_UNSPEC, | ||
12 | TCA_NAT_PARMS, | ||
13 | TCA_NAT_TM, | ||
14 | __TCA_NAT_MAX | ||
15 | }; | ||
16 | #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) | ||
17 | |||
18 | #define TCA_NAT_FLAG_EGRESS 1 | ||
19 | |||
20 | struct tc_nat | ||
21 | { | ||
22 | tc_gen; | ||
23 | __be32 old_addr; | ||
24 | __be32 new_addr; | ||
25 | __be32 mask; | ||
26 | __u32 flags; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index c6b9f92e8289..c5b94c1a5ee2 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -304,7 +304,6 @@ struct tcp_sock { | |||
304 | u32 rtt_seq; /* sequence number to update rttvar */ | 304 | u32 rtt_seq; /* sequence number to update rttvar */ |
305 | 305 | ||
306 | u32 packets_out; /* Packets which are "in flight" */ | 306 | u32 packets_out; /* Packets which are "in flight" */ |
307 | u32 left_out; /* Packets which leaved network */ | ||
308 | u32 retrans_out; /* Retransmitted packets out */ | 307 | u32 retrans_out; /* Retransmitted packets out */ |
309 | /* | 308 | /* |
310 | * Options received (usually on last packet, some only on SYN packets). | 309 | * Options received (usually on last packet, some only on SYN packets). |
@@ -333,6 +332,9 @@ struct tcp_sock { | |||
333 | 332 | ||
334 | struct tcp_sack_block_wire recv_sack_cache[4]; | 333 | struct tcp_sack_block_wire recv_sack_cache[4]; |
335 | 334 | ||
335 | u32 highest_sack; /* Start seq of globally highest revd SACK | ||
336 | * (validity guaranteed only if sacked_out > 0) */ | ||
337 | |||
336 | /* from STCP, retrans queue hinting */ | 338 | /* from STCP, retrans queue hinting */ |
337 | struct sk_buff* lost_skb_hint; | 339 | struct sk_buff* lost_skb_hint; |
338 | 340 | ||
@@ -341,10 +343,12 @@ struct tcp_sock { | |||
341 | struct sk_buff *forward_skb_hint; | 343 | struct sk_buff *forward_skb_hint; |
342 | struct sk_buff *fastpath_skb_hint; | 344 | struct sk_buff *fastpath_skb_hint; |
343 | 345 | ||
344 | int fastpath_cnt_hint; | 346 | int fastpath_cnt_hint; /* Lags behind by current skb's pcount |
347 | * compared to respective fackets_out */ | ||
345 | int lost_cnt_hint; | 348 | int lost_cnt_hint; |
346 | int retransmit_cnt_hint; | 349 | int retransmit_cnt_hint; |
347 | int forward_cnt_hint; | 350 | |
351 | u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ | ||
348 | 352 | ||
349 | u16 advmss; /* Advertised MSS */ | 353 | u16 advmss; /* Advertised MSS */ |
350 | u16 prior_ssthresh; /* ssthresh saved at recovery start */ | 354 | u16 prior_ssthresh; /* ssthresh saved at recovery start */ |
diff --git a/include/linux/zlib.h b/include/linux/zlib.h index 9e3192a7dc6f..40c49cb3eb51 100644 --- a/include/linux/zlib.h +++ b/include/linux/zlib.h | |||
@@ -82,7 +82,7 @@ | |||
82 | struct internal_state; | 82 | struct internal_state; |
83 | 83 | ||
84 | typedef struct z_stream_s { | 84 | typedef struct z_stream_s { |
85 | Byte *next_in; /* next input byte */ | 85 | const Byte *next_in; /* next input byte */ |
86 | uInt avail_in; /* number of bytes available at next_in */ | 86 | uInt avail_in; /* number of bytes available at next_in */ |
87 | uLong total_in; /* total nb of input bytes read so far */ | 87 | uLong total_in; /* total nb of input bytes read so far */ |
88 | 88 | ||
@@ -699,4 +699,8 @@ extern int zlib_inflateInit2(z_streamp strm, int windowBits); | |||
699 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | 699 | struct internal_state {int dummy;}; /* hack for buggy compilers */ |
700 | #endif | 700 | #endif |
701 | 701 | ||
702 | /* Utility function: initialize zlib, unpack binary blob, clean up zlib, | ||
703 | * return len or negative error code. */ | ||
704 | extern int zlib_inflate_blob(void *dst, unsigned dst_sz, const void *src, unsigned src_sz); | ||
705 | |||
702 | #endif /* _ZLIB_H */ | 706 | #endif /* _ZLIB_H */ |
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 88884d39f28f..7726ff41c3e6 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -412,6 +412,18 @@ int p9_idpool_check(int id, struct p9_idpool *p); | |||
412 | 412 | ||
413 | int p9_error_init(void); | 413 | int p9_error_init(void); |
414 | int p9_errstr2errno(char *, int); | 414 | int p9_errstr2errno(char *, int); |
415 | |||
416 | #ifdef CONFIG_SYSCTL | ||
415 | int __init p9_sysctl_register(void); | 417 | int __init p9_sysctl_register(void); |
416 | void __exit p9_sysctl_unregister(void); | 418 | void __exit p9_sysctl_unregister(void); |
419 | #else | ||
420 | static inline int p9_sysctl_register(void) | ||
421 | { | ||
422 | return 0; | ||
423 | } | ||
424 | static inline void p9_sysctl_unregister(void) | ||
425 | { | ||
426 | } | ||
427 | #endif | ||
428 | |||
417 | #endif /* NET_9P_H */ | 429 | #endif /* NET_9P_H */ |
diff --git a/include/net/ah.h b/include/net/ah.h index 8f257c159902..ae1c322f4242 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
@@ -9,8 +9,6 @@ | |||
9 | 9 | ||
10 | struct ah_data | 10 | struct ah_data |
11 | { | 11 | { |
12 | u8 *key; | ||
13 | int key_len; | ||
14 | u8 *work_icv; | 12 | u8 *work_icv; |
15 | int icv_full_len; | 13 | int icv_full_len; |
16 | int icv_trunc_len; | 14 | int icv_trunc_len; |
@@ -40,4 +38,11 @@ out: | |||
40 | return err; | 38 | return err; |
41 | } | 39 | } |
42 | 40 | ||
41 | struct ip_auth_hdr; | ||
42 | |||
43 | static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) | ||
44 | { | ||
45 | return (struct ip_auth_hdr *)skb_transport_header(skb); | ||
46 | } | ||
47 | |||
43 | #endif | 48 | #endif |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 99a4e364c74a..4e3cd93f81fc 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -363,8 +363,11 @@ extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); | |||
363 | extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); | 363 | extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); |
364 | 364 | ||
365 | /* ax25_ip.c */ | 365 | /* ax25_ip.c */ |
366 | extern int ax25_hard_header(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); | 366 | extern int ax25_hard_header(struct sk_buff *, struct net_device *, |
367 | unsigned short, const void *, | ||
368 | const void *, unsigned int); | ||
367 | extern int ax25_rebuild_header(struct sk_buff *); | 369 | extern int ax25_rebuild_header(struct sk_buff *); |
370 | extern const struct header_ops ax25_header_ops; | ||
368 | 371 | ||
369 | /* ax25_out.c */ | 372 | /* ax25_out.c */ |
370 | extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); | 373 | extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); |
diff --git a/include/net/ax88796.h b/include/net/ax88796.h index ee786a043b3d..51329dae44e6 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #define AXFLG_HAS_EEPROM (1<<0) | 15 | #define AXFLG_HAS_EEPROM (1<<0) |
16 | #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ | 16 | #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ |
17 | #define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ | ||
17 | 18 | ||
18 | struct ax_plat_data { | 19 | struct ax_plat_data { |
19 | unsigned int flags; | 20 | unsigned int flags; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7edaef6b29d6..d30960e1755c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -3,15 +3,15 @@ | |||
3 | 3 | ||
4 | #include <linux/netlink.h> | 4 | #include <linux/netlink.h> |
5 | #include <linux/skbuff.h> | 5 | #include <linux/skbuff.h> |
6 | #include <linux/nl80211.h> | ||
6 | #include <net/genetlink.h> | 7 | #include <net/genetlink.h> |
7 | 8 | ||
8 | /* | 9 | /* |
9 | * 802.11 configuration in-kernel interface | 10 | * 802.11 configuration in-kernel interface |
10 | * | 11 | * |
11 | * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> | 12 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> |
12 | */ | 13 | */ |
13 | 14 | ||
14 | |||
15 | /* Radiotap header iteration | 15 | /* Radiotap header iteration |
16 | * implemented in net/wireless/radiotap.c | 16 | * implemented in net/wireless/radiotap.c |
17 | * docs in Documentation/networking/radiotap-headers.txt | 17 | * docs in Documentation/networking/radiotap-headers.txt |
@@ -68,11 +68,16 @@ struct wiphy; | |||
68 | * @add_virtual_intf: create a new virtual interface with the given name | 68 | * @add_virtual_intf: create a new virtual interface with the given name |
69 | * | 69 | * |
70 | * @del_virtual_intf: remove the virtual interface determined by ifindex. | 70 | * @del_virtual_intf: remove the virtual interface determined by ifindex. |
71 | * | ||
72 | * @change_virtual_intf: change type of virtual interface | ||
73 | * | ||
71 | */ | 74 | */ |
72 | struct cfg80211_ops { | 75 | struct cfg80211_ops { |
73 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 76 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
74 | unsigned int type); | 77 | enum nl80211_iftype type); |
75 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | 78 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); |
79 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, | ||
80 | enum nl80211_iftype type); | ||
76 | }; | 81 | }; |
77 | 82 | ||
78 | #endif /* __NET_CFG80211_H */ | 83 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index c10e8e7e59a7..60c9f22d8694 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -100,8 +100,7 @@ static inline void dn_rt_finish_output(struct sk_buff *skb, char *dst, char *src | |||
100 | if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_LOOPBACK)) | 100 | if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_LOOPBACK)) |
101 | dst = NULL; | 101 | dst = NULL; |
102 | 102 | ||
103 | if (!dev->hard_header || (dev->hard_header(skb, dev, ETH_P_DNA_RT, | 103 | if (dev_hard_header(skb, dev, ETH_P_DNA_RT, dst, src, skb->len) >= 0) |
104 | dst, src, skb->len) >= 0)) | ||
105 | dn_rt_send(skb); | 104 | dn_rt_send(skb); |
106 | else | 105 | else |
107 | kfree_skb(skb); | 106 | kfree_skb(skb); |
diff --git a/include/net/esp.h b/include/net/esp.h index d05d8d2c78f4..c1bc529809da 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
@@ -13,8 +13,6 @@ struct esp_data | |||
13 | 13 | ||
14 | /* Confidentiality */ | 14 | /* Confidentiality */ |
15 | struct { | 15 | struct { |
16 | u8 *key; /* Key */ | ||
17 | int key_len; /* Key length */ | ||
18 | int padlen; /* 0..255 */ | 16 | int padlen; /* 0..255 */ |
19 | /* ivlen is offset from enc_data, where encrypted data start. | 17 | /* ivlen is offset from enc_data, where encrypted data start. |
20 | * It is logically different of crypto_tfm_alg_ivsize(tfm). | 18 | * It is logically different of crypto_tfm_alg_ivsize(tfm). |
@@ -28,14 +26,9 @@ struct esp_data | |||
28 | 26 | ||
29 | /* Integrity. It is active when icv_full_len != 0 */ | 27 | /* Integrity. It is active when icv_full_len != 0 */ |
30 | struct { | 28 | struct { |
31 | u8 *key; /* Key */ | ||
32 | int key_len; /* Length of the key */ | ||
33 | u8 *work_icv; | 29 | u8 *work_icv; |
34 | int icv_full_len; | 30 | int icv_full_len; |
35 | int icv_trunc_len; | 31 | int icv_trunc_len; |
36 | void (*icv)(struct esp_data*, | ||
37 | struct sk_buff *skb, | ||
38 | int offset, int len, u8 *icv); | ||
39 | struct crypto_hash *tfm; | 32 | struct crypto_hash *tfm; |
40 | } auth; | 33 | } auth; |
41 | }; | 34 | }; |
@@ -60,4 +53,11 @@ static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, | |||
60 | return crypto_hash_final(&desc, esp->auth.work_icv); | 53 | return crypto_hash_final(&desc, esp->auth.work_icv); |
61 | } | 54 | } |
62 | 55 | ||
56 | struct ip_esp_hdr; | ||
57 | |||
58 | static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) | ||
59 | { | ||
60 | return (struct ip_esp_hdr *)skb_transport_header(skb); | ||
61 | } | ||
62 | |||
63 | #endif | 63 | #endif |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 83e41dd15ccd..017aebd90683 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -65,7 +65,7 @@ struct fib_rules_ops | |||
65 | 65 | ||
66 | int nlgroup; | 66 | int nlgroup; |
67 | const struct nla_policy *policy; | 67 | const struct nla_policy *policy; |
68 | struct list_head *rules_list; | 68 | struct list_head rules_list; |
69 | struct module *owner; | 69 | struct module *owner; |
70 | }; | 70 | }; |
71 | 71 | ||
diff --git a/include/net/icmp.h b/include/net/icmp.h index dc09474efcf3..9f7ef3c8baef 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -30,9 +30,16 @@ struct icmp_err { | |||
30 | 30 | ||
31 | extern struct icmp_err icmp_err_convert[]; | 31 | extern struct icmp_err icmp_err_convert[]; |
32 | DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics); | 32 | DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics); |
33 | DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); | ||
33 | #define ICMP_INC_STATS(field) SNMP_INC_STATS(icmp_statistics, field) | 34 | #define ICMP_INC_STATS(field) SNMP_INC_STATS(icmp_statistics, field) |
34 | #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) | 35 | #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) |
35 | #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) | 36 | #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) |
37 | #define ICMPMSGOUT_INC_STATS(field) SNMP_INC_STATS(icmpmsg_statistics, field+256) | ||
38 | #define ICMPMSGOUT_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmpmsg_statistics, field+256) | ||
39 | #define ICMPMSGOUT_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmpmsg_statistics, field+256) | ||
40 | #define ICMPMSGIN_INC_STATS(field) SNMP_INC_STATS(icmpmsg_statistics, field) | ||
41 | #define ICMPMSGIN_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmpmsg_statistics, field) | ||
42 | #define ICMPMSGIN_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmpmsg_statistics, field) | ||
36 | 43 | ||
37 | struct dst_entry; | 44 | struct dst_entry; |
38 | struct net_proto_family; | 45 | struct net_proto_family; |
@@ -42,6 +49,7 @@ extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); | |||
42 | extern int icmp_rcv(struct sk_buff *skb); | 49 | extern int icmp_rcv(struct sk_buff *skb); |
43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 50 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
44 | extern void icmp_init(struct net_proto_family *ops); | 51 | extern void icmp_init(struct net_proto_family *ops); |
52 | extern void icmp_out_count(unsigned char type); | ||
45 | 53 | ||
46 | /* Move into dst.h ? */ | 54 | /* Move into dst.h ? */ |
47 | extern int xrlim_allow(struct dst_entry *dst, int timeout); | 55 | extern int xrlim_allow(struct dst_entry *dst, int timeout); |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index bbd85cd61ed5..164d13211165 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -119,11 +119,6 @@ do { if (ieee80211_debug_level & (level)) \ | |||
119 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 119 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
120 | #endif /* CONFIG_IEEE80211_DEBUG */ | 120 | #endif /* CONFIG_IEEE80211_DEBUG */ |
121 | 121 | ||
122 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ | ||
123 | |||
124 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
125 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | ||
126 | |||
127 | /* escape_essid() is intended to be used in debug (and possibly error) | 122 | /* escape_essid() is intended to be used in debug (and possibly error) |
128 | * messages. It should never be used for passing essid to user space. */ | 123 | * messages. It should never be used for passing essid to user space. */ |
129 | const char *escape_essid(const char *essid, u8 essid_len); | 124 | const char *escape_essid(const char *essid, u8 essid_len); |
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index a0c2b41a24d7..dfd8bf66ce27 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #include <linux/if_ether.h> | 41 | #include <linux/if_ether.h> |
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <asm/unaligned.h> | ||
43 | 44 | ||
44 | /* Radiotap header version (from official NetBSD feed) */ | 45 | /* Radiotap header version (from official NetBSD feed) */ |
45 | #define IEEE80211RADIOTAP_VERSION "1.5" | 46 | #define IEEE80211RADIOTAP_VERSION "1.5" |
@@ -255,4 +256,13 @@ enum ieee80211_radiotap_type { | |||
255 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ | 256 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ |
256 | ((x) + 1000) * 5) | 257 | ((x) + 1000) * 5) |
257 | 258 | ||
259 | /* helpers */ | ||
260 | static inline int ieee80211_get_radiotap_len(unsigned char *data) | ||
261 | { | ||
262 | struct ieee80211_radiotap_header *hdr = | ||
263 | (struct ieee80211_radiotap_header *)data; | ||
264 | |||
265 | return le16_to_cpu(get_unaligned(&hdr->it_len)); | ||
266 | } | ||
267 | |||
258 | #endif /* IEEE80211_RADIOTAP_H */ | 268 | #endif /* IEEE80211_RADIOTAP_H */ |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 89119277553d..1ef6282fdded 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -229,6 +229,8 @@ struct ieee80211softmac_device { | |||
229 | /* this lock protects this structure */ | 229 | /* this lock protects this structure */ |
230 | spinlock_t lock; | 230 | spinlock_t lock; |
231 | 231 | ||
232 | struct workqueue_struct *wq; | ||
233 | |||
232 | u8 running; /* SoftMAC started? */ | 234 | u8 running; /* SoftMAC started? */ |
233 | u8 scanning; | 235 | u8 scanning; |
234 | 236 | ||
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 3ec7d07346d6..448eccb20638 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -154,6 +154,7 @@ struct ipv6_devstat { | |||
154 | struct proc_dir_entry *proc_dir_entry; | 154 | struct proc_dir_entry *proc_dir_entry; |
155 | DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); | 155 | DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); |
156 | DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6); | 156 | DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6); |
157 | DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg); | ||
157 | }; | 158 | }; |
158 | 159 | ||
159 | struct inet6_dev | 160 | struct inet6_dev |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index d27ee8c0da3f..8228b57eb18f 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -107,7 +107,7 @@ struct inet_hashinfo { | |||
107 | */ | 107 | */ |
108 | struct inet_bind_hashbucket *bhash; | 108 | struct inet_bind_hashbucket *bhash; |
109 | 109 | ||
110 | int bhash_size; | 110 | unsigned int bhash_size; |
111 | unsigned int ehash_size; | 111 | unsigned int ehash_size; |
112 | 112 | ||
113 | /* All sockets in TCP_LISTEN state will be in here. This is the only | 113 | /* All sockets in TCP_LISTEN state will be in here. This is the only |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 47d52b2414db..abaff0597270 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -115,6 +115,7 @@ struct inet_timewait_sock { | |||
115 | #define tw_refcnt __tw_common.skc_refcnt | 115 | #define tw_refcnt __tw_common.skc_refcnt |
116 | #define tw_hash __tw_common.skc_hash | 116 | #define tw_hash __tw_common.skc_hash |
117 | #define tw_prot __tw_common.skc_prot | 117 | #define tw_prot __tw_common.skc_prot |
118 | #define tw_net __tw_common.skc_net | ||
118 | volatile unsigned char tw_substate; | 119 | volatile unsigned char tw_substate; |
119 | /* 3 bits hole, try to pack */ | 120 | /* 3 bits hole, try to pack */ |
120 | unsigned char tw_rcv_wscale; | 121 | unsigned char tw_rcv_wscale; |
diff --git a/include/net/ip.h b/include/net/ip.h index abf2820a1125..3af3ed9d320b 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -171,7 +171,8 @@ extern unsigned long snmp_fold_field(void *mib[], int offt); | |||
171 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | 171 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); |
172 | extern void snmp_mib_free(void *ptr[2]); | 172 | extern void snmp_mib_free(void *ptr[2]); |
173 | 173 | ||
174 | extern int sysctl_local_port_range[2]; | 174 | extern void inet_get_local_port_range(int *low, int *high); |
175 | |||
175 | extern int sysctl_ip_default_ttl; | 176 | extern int sysctl_ip_default_ttl; |
176 | extern int sysctl_ip_nonlocal_bind; | 177 | extern int sysctl_ip_nonlocal_bind; |
177 | 178 | ||
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index c48ea873f1e0..857821360bb6 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -105,6 +105,10 @@ struct rt6_info | |||
105 | struct rt6key rt6i_src; | 105 | struct rt6key rt6i_src; |
106 | 106 | ||
107 | u8 rt6i_protocol; | 107 | u8 rt6i_protocol; |
108 | |||
109 | #ifdef CONFIG_XFRM | ||
110 | u32 rt6i_flow_cache_genid; | ||
111 | #endif | ||
108 | }; | 112 | }; |
109 | 113 | ||
110 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | 114 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index 87c1af3e5e82..330b74e813a9 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
@@ -1,14 +1,23 @@ | |||
1 | #ifndef _NET_IPCOMP_H | 1 | #ifndef _NET_IPCOMP_H |
2 | #define _NET_IPCOMP_H | 2 | #define _NET_IPCOMP_H |
3 | 3 | ||
4 | #include <linux/crypto.h> | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | 5 | ||
7 | #define IPCOMP_SCRATCH_SIZE 65400 | 6 | #define IPCOMP_SCRATCH_SIZE 65400 |
8 | 7 | ||
8 | struct crypto_comp; | ||
9 | |||
9 | struct ipcomp_data { | 10 | struct ipcomp_data { |
10 | u16 threshold; | 11 | u16 threshold; |
11 | struct crypto_comp **tfms; | 12 | struct crypto_comp **tfms; |
12 | }; | 13 | }; |
13 | 14 | ||
15 | struct ip_comp_hdr; | ||
16 | struct sk_buff; | ||
17 | |||
18 | static inline struct ip_comp_hdr *ip_comp_hdr(const struct sk_buff *skb) | ||
19 | { | ||
20 | return (struct ip_comp_hdr *)skb_transport_header(skb); | ||
21 | } | ||
22 | |||
14 | #endif | 23 | #endif |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 9059e0ed7fe3..31b3f1b45a2b 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -112,45 +112,28 @@ struct frag_hdr { | |||
112 | extern int sysctl_ipv6_bindv6only; | 112 | extern int sysctl_ipv6_bindv6only; |
113 | extern int sysctl_mld_max_msf; | 113 | extern int sysctl_mld_max_msf; |
114 | 114 | ||
115 | /* MIBs */ | 115 | #define _DEVINC(statname, modifier, idev, field) \ |
116 | DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); | 116 | ({ \ |
117 | #define IP6_INC_STATS(idev,field) ({ \ | ||
118 | struct inet6_dev *_idev = (idev); \ | ||
119 | if (likely(_idev != NULL)) \ | ||
120 | SNMP_INC_STATS(_idev->stats.ipv6, field); \ | ||
121 | SNMP_INC_STATS(ipv6_statistics, field); \ | ||
122 | }) | ||
123 | #define IP6_INC_STATS_BH(idev,field) ({ \ | ||
124 | struct inet6_dev *_idev = (idev); \ | ||
125 | if (likely(_idev != NULL)) \ | ||
126 | SNMP_INC_STATS_BH(_idev->stats.ipv6, field); \ | ||
127 | SNMP_INC_STATS_BH(ipv6_statistics, field); \ | ||
128 | }) | ||
129 | #define IP6_INC_STATS_USER(idev,field) ({ \ | ||
130 | struct inet6_dev *_idev = (idev); \ | 117 | struct inet6_dev *_idev = (idev); \ |
131 | if (likely(_idev != NULL)) \ | 118 | if (likely(_idev != NULL)) \ |
132 | SNMP_INC_STATS_USER(_idev->stats.ipv6, field); \ | 119 | SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \ |
133 | SNMP_INC_STATS_USER(ipv6_statistics, field); \ | 120 | SNMP_INC_STATS##modifier(statname##_statistics, (field)); \ |
134 | }) | 121 | }) |
122 | |||
123 | /* MIBs */ | ||
124 | DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); | ||
125 | |||
126 | #define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field) | ||
127 | #define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) | ||
128 | #define IP6_INC_STATS_USER(idev,field) _DEVINC(ipv6, _USER, idev, field) | ||
129 | |||
135 | DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); | 130 | DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); |
136 | #define ICMP6_INC_STATS(idev, field) ({ \ | 131 | DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); |
137 | struct inet6_dev *_idev = (idev); \ | 132 | |
138 | if (likely(_idev != NULL)) \ | 133 | #define ICMP6_INC_STATS(idev, field) _DEVINC(icmpv6, , idev, field) |
139 | SNMP_INC_STATS(idev->stats.icmpv6, field); \ | 134 | #define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) |
140 | SNMP_INC_STATS(icmpv6_statistics, field); \ | 135 | #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field) |
141 | }) | 136 | |
142 | #define ICMP6_INC_STATS_BH(idev, field) ({ \ | ||
143 | struct inet6_dev *_idev = (idev); \ | ||
144 | if (likely(_idev != NULL)) \ | ||
145 | SNMP_INC_STATS_BH((_idev)->stats.icmpv6, field); \ | ||
146 | SNMP_INC_STATS_BH(icmpv6_statistics, field); \ | ||
147 | }) | ||
148 | #define ICMP6_INC_STATS_USER(idev, field) ({ \ | ||
149 | struct inet6_dev *_idev = (idev); \ | ||
150 | if (likely(_idev != NULL)) \ | ||
151 | SNMP_INC_STATS_USER(_idev->stats.icmpv6, field); \ | ||
152 | SNMP_INC_STATS_USER(icmpv6_statistics, field); \ | ||
153 | }) | ||
154 | #define ICMP6_INC_STATS_OFFSET_BH(idev, field, offset) ({ \ | 137 | #define ICMP6_INC_STATS_OFFSET_BH(idev, field, offset) ({ \ |
155 | struct inet6_dev *_idev = idev; \ | 138 | struct inet6_dev *_idev = idev; \ |
156 | __typeof__(offset) _offset = (offset); \ | 139 | __typeof__(offset) _offset = (offset); \ |
@@ -158,6 +141,20 @@ DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); | |||
158 | SNMP_INC_STATS_OFFSET_BH(_idev->stats.icmpv6, field, _offset); \ | 141 | SNMP_INC_STATS_OFFSET_BH(_idev->stats.icmpv6, field, _offset); \ |
159 | SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ | 142 | SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ |
160 | }) | 143 | }) |
144 | |||
145 | #define ICMP6MSGOUT_INC_STATS(idev, field) \ | ||
146 | _DEVINC(icmpv6msg, , idev, field +256) | ||
147 | #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ | ||
148 | _DEVINC(icmpv6msg, _BH, idev, field +256) | ||
149 | #define ICMP6MSGOUT_INC_STATS_USER(idev, field) \ | ||
150 | _DEVINC(icmpv6msg, _USER, idev, field +256) | ||
151 | #define ICMP6MSGIN_INC_STATS(idev, field) \ | ||
152 | _DEVINC(icmpv6msg, , idev, field) | ||
153 | #define ICMP6MSGIN_INC_STATS_BH(idev, field) \ | ||
154 | _DEVINC(icmpv6msg, _BH, idev, field) | ||
155 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ | ||
156 | _DEVINC(icmpv6msg, _USER, idev, field) | ||
157 | |||
161 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | 158 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); |
162 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | 159 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); |
163 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | 160 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ |
@@ -377,6 +374,12 @@ static inline int ipv6_addr_any(const struct in6_addr *a) | |||
377 | a->s6_addr32[2] | a->s6_addr32[3] ) == 0); | 374 | a->s6_addr32[2] | a->s6_addr32[3] ) == 0); |
378 | } | 375 | } |
379 | 376 | ||
377 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) | ||
378 | { | ||
379 | return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 && | ||
380 | a->s6_addr32[2] == htonl(0x0000ffff)); | ||
381 | } | ||
382 | |||
380 | /* | 383 | /* |
381 | * find the first different bit between two addresses | 384 | * find the first different bit between two addresses |
382 | * length of address must be a multiple of 32bits | 385 | * length of address must be a multiple of 32bits |
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index b6c468cd7f5b..85f80eadfa35 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h | |||
@@ -50,6 +50,12 @@ struct sockaddr_iucv { | |||
50 | 50 | ||
51 | 51 | ||
52 | /* Common socket structures and functions */ | 52 | /* Common socket structures and functions */ |
53 | struct sock_msg_q { | ||
54 | struct iucv_path *path; | ||
55 | struct iucv_message msg; | ||
56 | struct list_head list; | ||
57 | spinlock_t lock; | ||
58 | }; | ||
53 | 59 | ||
54 | #define iucv_sk(__sk) ((struct iucv_sock *) __sk) | 60 | #define iucv_sk(__sk) ((struct iucv_sock *) __sk) |
55 | 61 | ||
@@ -65,6 +71,7 @@ struct iucv_sock { | |||
65 | struct iucv_path *path; | 71 | struct iucv_path *path; |
66 | struct sk_buff_head send_skb_q; | 72 | struct sk_buff_head send_skb_q; |
67 | struct sk_buff_head backlog_skb_q; | 73 | struct sk_buff_head backlog_skb_q; |
74 | struct sock_msg_q message_q; | ||
68 | unsigned int send_tag; | 75 | unsigned int send_tag; |
69 | }; | 76 | }; |
70 | 77 | ||
@@ -74,29 +81,8 @@ struct iucv_sock_list { | |||
74 | atomic_t autobind_name; | 81 | atomic_t autobind_name; |
75 | }; | 82 | }; |
76 | 83 | ||
77 | static void iucv_sock_destruct(struct sock *sk); | ||
78 | static void iucv_sock_cleanup_listen(struct sock *parent); | ||
79 | static void iucv_sock_kill(struct sock *sk); | ||
80 | static void iucv_sock_close(struct sock *sk); | ||
81 | static int iucv_sock_create(struct socket *sock, int proto); | ||
82 | static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, | ||
83 | int addr_len); | ||
84 | static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr, | ||
85 | int alen, int flags); | ||
86 | static int iucv_sock_listen(struct socket *sock, int backlog); | ||
87 | static int iucv_sock_accept(struct socket *sock, struct socket *newsock, | ||
88 | int flags); | ||
89 | static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr, | ||
90 | int *len, int peer); | ||
91 | static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | ||
92 | struct msghdr *msg, size_t len); | ||
93 | static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
94 | struct msghdr *msg, size_t len, int flags); | ||
95 | unsigned int iucv_sock_poll(struct file *file, struct socket *sock, | 84 | unsigned int iucv_sock_poll(struct file *file, struct socket *sock, |
96 | poll_table *wait); | 85 | poll_table *wait); |
97 | static int iucv_sock_release(struct socket *sock); | ||
98 | static int iucv_sock_shutdown(struct socket *sock, int how); | ||
99 | |||
100 | void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); | 86 | void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); |
101 | void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); | 87 | void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); |
102 | int iucv_sock_wait_state(struct sock *sk, int state, int state2, | 88 | int iucv_sock_wait_state(struct sock *sk, int state, int state2, |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index f23d07ca7c59..369d50e08b99 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
@@ -431,7 +431,13 @@ 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 | /* functions that may be called by driver modules */ | 434 | /* First : function strictly used inside the kernel */ |
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 | /* Second : functions that may be called by driver modules */ | ||
435 | 441 | ||
436 | /* Send a single event to user space */ | 442 | /* Send a single event to user space */ |
437 | extern void wireless_send_event(struct net_device * dev, | 443 | extern void wireless_send_event(struct net_device * dev, |
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index 00730d21b522..e2374e34989f 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h | |||
@@ -93,7 +93,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb) | |||
93 | return skb->cb[sizeof(skb->cb) - 1]; | 93 | return skb->cb[sizeof(skb->cb) - 1]; |
94 | } | 94 | } |
95 | 95 | ||
96 | extern struct sock *llc_sk_alloc(int family, gfp_t priority, | 96 | extern struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, |
97 | struct proto *prot); | 97 | struct proto *prot); |
98 | extern void llc_sk_free(struct sock *sk); | 98 | extern void llc_sk_free(struct sock *sk); |
99 | 99 | ||
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index c34fd9a6160a..5fcc4c104340 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1,7 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * Low-level hardware driver -- IEEE 802.11 driver (80211.o) interface | 2 | * mac80211 <-> driver interface |
3 | * | ||
3 | * Copyright 2002-2005, Devicescape Software, Inc. | 4 | * Copyright 2002-2005, Devicescape Software, Inc. |
4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
6 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
5 | * | 7 | * |
6 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -20,29 +22,51 @@ | |||
20 | #include <net/wireless.h> | 22 | #include <net/wireless.h> |
21 | #include <net/cfg80211.h> | 23 | #include <net/cfg80211.h> |
22 | 24 | ||
23 | /* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be | 25 | /** |
26 | * DOC: Introduction | ||
27 | * | ||
28 | * mac80211 is the Linux stack for 802.11 hardware that implements | ||
29 | * only partial functionality in hard- or firmware. This document | ||
30 | * defines the interface between mac80211 and low-level hardware | ||
31 | * drivers. | ||
32 | */ | ||
33 | |||
34 | /** | ||
35 | * DOC: Calling mac80211 from interrupts | ||
36 | * | ||
37 | * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be | ||
24 | * called in hardware interrupt context. The low-level driver must not call any | 38 | * called in hardware interrupt context. The low-level driver must not call any |
25 | * other functions in hardware interrupt context. If there is a need for such | 39 | * other functions in hardware interrupt context. If there is a need for such |
26 | * call, the low-level driver should first ACK the interrupt and perform the | 40 | * call, the low-level driver should first ACK the interrupt and perform the |
27 | * IEEE 802.11 code call after this, e.g., from a scheduled tasklet (in | 41 | * IEEE 802.11 code call after this, e.g. from a scheduled workqueue function. |
28 | * software interrupt context). | ||
29 | */ | 42 | */ |
30 | 43 | ||
31 | /* | 44 | /** |
32 | * Frame format used when passing frame between low-level hardware drivers | 45 | * DOC: Warning |
33 | * and IEEE 802.11 driver the same as used in the wireless media, i.e., | 46 | * |
34 | * buffers start with IEEE 802.11 header and include the same octets that | 47 | * If you're reading this document and not the header file itself, it will |
35 | * are sent over air. | 48 | * be incomplete because not all documentation has been converted yet. |
36 | * | 49 | */ |
37 | * If hardware uses IEEE 802.3 headers (and perform 802.3 <-> 802.11 | 50 | |
38 | * conversion in firmware), upper layer 802.11 code needs to be changed to | 51 | /** |
39 | * support this. | 52 | * DOC: Frame format |
40 | * | 53 | * |
41 | * If the receive frame format is not the same as the real frame sent | 54 | * As a general rule, when frames are passed between mac80211 and the driver, |
42 | * on the wireless media (e.g., due to padding etc.), upper layer 802.11 code | 55 | * they start with the IEEE 802.11 header and include the same octets that are |
43 | * could be updated to provide support for such format assuming this would | 56 | * sent over the air except for the FCS which should be calculated by the |
44 | * optimize the performance, e.g., by removing need to re-allocation and | 57 | * hardware. |
45 | * copying of the data. | 58 | * |
59 | * There are, however, various exceptions to this rule for advanced features: | ||
60 | * | ||
61 | * The first exception is for hardware encryption and decryption offload | ||
62 | * where the IV/ICV may or may not be generated in hardware. | ||
63 | * | ||
64 | * Secondly, when the hardware handles fragmentation, the frame handed to | ||
65 | * the driver from mac80211 is the MSDU, not the MPDU. | ||
66 | * | ||
67 | * Finally, for received frames, the driver is able to indicate that it has | ||
68 | * filled a radiotap header and put that in front of the frame; if it does | ||
69 | * not do so then mac80211 may add this under certain circumstances. | ||
46 | */ | 70 | */ |
47 | 71 | ||
48 | #define IEEE80211_CHAN_W_SCAN 0x00000001 | 72 | #define IEEE80211_CHAN_W_SCAN 0x00000001 |
@@ -71,14 +95,13 @@ struct ieee80211_channel { | |||
71 | #define IEEE80211_RATE_SUPPORTED 0x00000010 | 95 | #define IEEE80211_RATE_SUPPORTED 0x00000010 |
72 | #define IEEE80211_RATE_OFDM 0x00000020 | 96 | #define IEEE80211_RATE_OFDM 0x00000020 |
73 | #define IEEE80211_RATE_CCK 0x00000040 | 97 | #define IEEE80211_RATE_CCK 0x00000040 |
74 | #define IEEE80211_RATE_TURBO 0x00000080 | ||
75 | #define IEEE80211_RATE_MANDATORY 0x00000100 | 98 | #define IEEE80211_RATE_MANDATORY 0x00000100 |
76 | 99 | ||
77 | #define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2) | 100 | #define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2) |
78 | #define IEEE80211_RATE_MODULATION(f) \ | 101 | #define IEEE80211_RATE_MODULATION(f) \ |
79 | (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM)) | 102 | (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM)) |
80 | 103 | ||
81 | /* Low-level driver should set PREAMBLE2, OFDM, CCK, and TURBO flags. | 104 | /* Low-level driver should set PREAMBLE2, OFDM and CCK flags. |
82 | * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the | 105 | * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the |
83 | * configuration. */ | 106 | * configuration. */ |
84 | struct ieee80211_rate { | 107 | struct ieee80211_rate { |
@@ -97,44 +120,96 @@ struct ieee80211_rate { | |||
97 | * optimizing channel utilization estimates */ | 120 | * optimizing channel utilization estimates */ |
98 | }; | 121 | }; |
99 | 122 | ||
100 | /* 802.11g is backwards-compatible with 802.11b, so a wlan card can | 123 | /** |
101 | * actually be both in 11b and 11g modes at the same time. */ | 124 | * enum ieee80211_phymode - PHY modes |
102 | enum { | 125 | * |
103 | MODE_IEEE80211A, /* IEEE 802.11a */ | 126 | * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h |
104 | MODE_IEEE80211B, /* IEEE 802.11b only */ | 127 | * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b |
105 | MODE_ATHEROS_TURBO, /* Atheros Turbo mode (2x.11a at 5 GHz) */ | 128 | * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM), |
106 | MODE_IEEE80211G, /* IEEE 802.11g (and 802.11b compatibility) */ | 129 | * backwards compatible with 11b mode |
107 | MODE_ATHEROS_TURBOG, /* Atheros Turbo mode (2x.11g at 2.4 GHz) */ | 130 | * @NUM_IEEE80211_MODES: internal |
131 | */ | ||
132 | enum ieee80211_phymode { | ||
133 | MODE_IEEE80211A, | ||
134 | MODE_IEEE80211B, | ||
135 | MODE_IEEE80211G, | ||
108 | 136 | ||
109 | /* keep last */ | 137 | /* keep last */ |
110 | NUM_IEEE80211_MODES | 138 | NUM_IEEE80211_MODES |
111 | }; | 139 | }; |
112 | 140 | ||
141 | /** | ||
142 | * struct ieee80211_hw_mode - PHY mode definition | ||
143 | * | ||
144 | * This structure describes the capabilities supported by the device | ||
145 | * in a single PHY mode. | ||
146 | * | ||
147 | * @mode: the PHY mode for this definition | ||
148 | * @num_channels: number of supported channels | ||
149 | * @channels: pointer to array of supported channels | ||
150 | * @num_rates: number of supported bitrates | ||
151 | * @rates: pointer to array of supported bitrates | ||
152 | * @list: internal | ||
153 | */ | ||
113 | struct ieee80211_hw_mode { | 154 | struct ieee80211_hw_mode { |
114 | int mode; /* MODE_IEEE80211... */ | 155 | struct list_head list; |
115 | int num_channels; /* Number of channels (below) */ | 156 | struct ieee80211_channel *channels; |
116 | struct ieee80211_channel *channels; /* Array of supported channels */ | 157 | struct ieee80211_rate *rates; |
117 | int num_rates; /* Number of rates (below) */ | 158 | enum ieee80211_phymode mode; |
118 | struct ieee80211_rate *rates; /* Array of supported rates */ | 159 | int num_channels; |
119 | 160 | int num_rates; | |
120 | struct list_head list; /* Internal, don't touch */ | ||
121 | }; | 161 | }; |
122 | 162 | ||
163 | /** | ||
164 | * struct ieee80211_tx_queue_params - transmit queue configuration | ||
165 | * | ||
166 | * The information provided in this structure is required for QoS | ||
167 | * transmit queue configuration. | ||
168 | * | ||
169 | * @aifs: arbitration interface space [0..255, -1: use default] | ||
170 | * @cw_min: minimum contention window [will be a value of the form | ||
171 | * 2^n-1 in the range 1..1023; 0: use default] | ||
172 | * @cw_max: maximum contention window [like @cw_min] | ||
173 | * @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled | ||
174 | */ | ||
123 | struct ieee80211_tx_queue_params { | 175 | struct ieee80211_tx_queue_params { |
124 | int aifs; /* 0 .. 255; -1 = use default */ | 176 | int aifs; |
125 | int cw_min; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */ | 177 | int cw_min; |
126 | int cw_max; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */ | 178 | int cw_max; |
127 | int burst_time; /* maximum burst time in 0.1 ms (i.e., 10 = 1 ms); | 179 | int burst_time; |
128 | * 0 = disabled */ | ||
129 | }; | 180 | }; |
130 | 181 | ||
182 | /** | ||
183 | * struct ieee80211_tx_queue_stats_data - transmit queue statistics | ||
184 | * | ||
185 | * @len: number of packets in queue | ||
186 | * @limit: queue length limit | ||
187 | * @count: number of frames sent | ||
188 | */ | ||
131 | struct ieee80211_tx_queue_stats_data { | 189 | struct ieee80211_tx_queue_stats_data { |
132 | unsigned int len; /* num packets in queue */ | 190 | unsigned int len; |
133 | unsigned int limit; /* queue len (soft) limit */ | 191 | unsigned int limit; |
134 | unsigned int count; /* total num frames sent */ | 192 | unsigned int count; |
135 | }; | 193 | }; |
136 | 194 | ||
137 | enum { | 195 | /** |
196 | * enum ieee80211_tx_queue - transmit queue number | ||
197 | * | ||
198 | * These constants are used with some callbacks that take a | ||
199 | * queue number to set parameters for a queue. | ||
200 | * | ||
201 | * @IEEE80211_TX_QUEUE_DATA0: data queue 0 | ||
202 | * @IEEE80211_TX_QUEUE_DATA1: data queue 1 | ||
203 | * @IEEE80211_TX_QUEUE_DATA2: data queue 2 | ||
204 | * @IEEE80211_TX_QUEUE_DATA3: data queue 3 | ||
205 | * @IEEE80211_TX_QUEUE_DATA4: data queue 4 | ||
206 | * @IEEE80211_TX_QUEUE_SVP: ?? | ||
207 | * @NUM_TX_DATA_QUEUES: number of data queues | ||
208 | * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be | ||
209 | * sent after a beacon | ||
210 | * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames | ||
211 | */ | ||
212 | enum ieee80211_tx_queue { | ||
138 | IEEE80211_TX_QUEUE_DATA0, | 213 | IEEE80211_TX_QUEUE_DATA0, |
139 | IEEE80211_TX_QUEUE_DATA1, | 214 | IEEE80211_TX_QUEUE_DATA1, |
140 | IEEE80211_TX_QUEUE_DATA2, | 215 | IEEE80211_TX_QUEUE_DATA2, |
@@ -165,7 +240,6 @@ struct ieee80211_low_level_stats { | |||
165 | /* Transmit control fields. This data structure is passed to low-level driver | 240 | /* Transmit control fields. This data structure is passed to low-level driver |
166 | * with each TX frame. The low-level driver is responsible for configuring | 241 | * with each TX frame. The low-level driver is responsible for configuring |
167 | * the hardware to use given values (depending on what is supported). */ | 242 | * the hardware to use given values (depending on what is supported). */ |
168 | #define HW_KEY_IDX_INVALID -1 | ||
169 | 243 | ||
170 | struct ieee80211_tx_control { | 244 | struct ieee80211_tx_control { |
171 | int tx_rate; /* Transmit rate, given as the hw specific value for the | 245 | int tx_rate; /* Transmit rate, given as the hw specific value for the |
@@ -191,22 +265,23 @@ struct ieee80211_tx_control { | |||
191 | #define IEEE80211_TXCTL_REQUEUE (1<<7) | 265 | #define IEEE80211_TXCTL_REQUEUE (1<<7) |
192 | #define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of | 266 | #define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of |
193 | * the frame */ | 267 | * the frame */ |
194 | #define IEEE80211_TXCTL_TKIP_NEW_PHASE1_KEY (1<<9) | 268 | #define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send |
269 | * using the through | ||
270 | * set_retry_limit configured | ||
271 | * long retry value */ | ||
195 | u32 flags; /* tx control flags defined | 272 | u32 flags; /* tx control flags defined |
196 | * above */ | 273 | * above */ |
197 | u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. */ | 274 | u8 key_idx; /* keyidx from hw->set_key(), undefined if |
275 | * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */ | ||
276 | u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. | ||
277 | * This could be used when set_retry_limit | ||
278 | * is not implemented by the driver */ | ||
198 | u8 power_level; /* per-packet transmit power level, in dBm */ | 279 | u8 power_level; /* per-packet transmit power level, in dBm */ |
199 | u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ | 280 | u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ |
200 | s8 key_idx; /* -1 = do not encrypt, >= 0 keyidx from | ||
201 | * hw->set_key() */ | ||
202 | u8 icv_len; /* length of the ICV/MIC field in octets */ | 281 | u8 icv_len; /* length of the ICV/MIC field in octets */ |
203 | u8 iv_len; /* length of the IV field in octets */ | 282 | u8 iv_len; /* length of the IV field in octets */ |
204 | u8 tkip_key[16]; /* generated phase2/phase1 key for hw TKIP */ | ||
205 | u8 queue; /* hardware queue to use for this frame; | 283 | u8 queue; /* hardware queue to use for this frame; |
206 | * 0 = highest, hw->queues-1 = lowest */ | 284 | * 0 = highest, hw->queues-1 = lowest */ |
207 | u8 sw_retry_attempt; /* number of times hw has tried to | ||
208 | * transmit frame (not incl. hw retries) */ | ||
209 | |||
210 | struct ieee80211_rate *rate; /* internal 80211.o rate */ | 285 | struct ieee80211_rate *rate; /* internal 80211.o rate */ |
211 | struct ieee80211_rate *rts_rate; /* internal 80211.o rate | 286 | struct ieee80211_rate *rts_rate; /* internal 80211.o rate |
212 | * for RTS/CTS */ | 287 | * for RTS/CTS */ |
@@ -219,44 +294,124 @@ struct ieee80211_tx_control { | |||
219 | int ifindex; /* internal */ | 294 | int ifindex; /* internal */ |
220 | }; | 295 | }; |
221 | 296 | ||
222 | /* Receive status. The low-level driver should provide this information | 297 | |
223 | * (the subset supported by hardware) to the 802.11 code with each received | 298 | /** |
224 | * frame. */ | 299 | * enum mac80211_rx_flags - receive flags |
300 | * | ||
301 | * These flags are used with the @flag member of &struct ieee80211_rx_status. | ||
302 | * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. | ||
303 | * Use together with %RX_FLAG_MMIC_STRIPPED. | ||
304 | * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. | ||
305 | * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header. | ||
306 | * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, | ||
307 | * verification has been done by the hardware. | ||
308 | * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. | ||
309 | * If this flag is set, the stack cannot do any replay detection | ||
310 | * hence the driver or hardware will have to do that. | ||
311 | * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on | ||
312 | * the frame. | ||
313 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on | ||
314 | * the frame. | ||
315 | */ | ||
316 | enum mac80211_rx_flags { | ||
317 | RX_FLAG_MMIC_ERROR = 1<<0, | ||
318 | RX_FLAG_DECRYPTED = 1<<1, | ||
319 | RX_FLAG_RADIOTAP = 1<<2, | ||
320 | RX_FLAG_MMIC_STRIPPED = 1<<3, | ||
321 | RX_FLAG_IV_STRIPPED = 1<<4, | ||
322 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | ||
323 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | ||
324 | }; | ||
325 | |||
326 | /** | ||
327 | * struct ieee80211_rx_status - receive status | ||
328 | * | ||
329 | * The low-level driver should provide this information (the subset | ||
330 | * supported by hardware) to the 802.11 code with each received | ||
331 | * frame. | ||
332 | * @mactime: MAC timestamp as defined by 802.11 | ||
333 | * @freq: frequency the radio was tuned to when receiving this frame, in MHz | ||
334 | * @channel: channel the radio was tuned to | ||
335 | * @phymode: active PHY mode | ||
336 | * @ssi: signal strength when receiving this frame | ||
337 | * @signal: used as 'qual' in statistics reporting | ||
338 | * @noise: PHY noise when receiving this frame | ||
339 | * @antenna: antenna used | ||
340 | * @rate: data rate | ||
341 | * @flag: %RX_FLAG_* | ||
342 | */ | ||
225 | struct ieee80211_rx_status { | 343 | struct ieee80211_rx_status { |
226 | u64 mactime; | 344 | u64 mactime; |
227 | int freq; /* receive frequency in Mhz */ | 345 | int freq; |
228 | int channel; | 346 | int channel; |
229 | int phymode; | 347 | enum ieee80211_phymode phymode; |
230 | int ssi; | 348 | int ssi; |
231 | int signal; /* used as qual in statistics reporting */ | 349 | int signal; |
232 | int noise; | 350 | int noise; |
233 | int antenna; | 351 | int antenna; |
234 | int rate; | 352 | int rate; |
235 | #define RX_FLAG_MMIC_ERROR (1<<0) | ||
236 | #define RX_FLAG_DECRYPTED (1<<1) | ||
237 | #define RX_FLAG_RADIOTAP (1<<2) | ||
238 | int flag; | 353 | int flag; |
239 | }; | 354 | }; |
240 | 355 | ||
241 | /* Transmit status. The low-level driver should provide this information | 356 | /** |
242 | * (the subset supported by hardware) to the 802.11 code for each transmit | 357 | * enum ieee80211_tx_status_flags - transmit status flags |
243 | * frame. */ | 358 | * |
359 | * Status flags to indicate various transmit conditions. | ||
360 | * | ||
361 | * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted | ||
362 | * because the destination STA was in powersave mode. | ||
363 | * | ||
364 | * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged | ||
365 | */ | ||
366 | enum ieee80211_tx_status_flags { | ||
367 | IEEE80211_TX_STATUS_TX_FILTERED = 1<<0, | ||
368 | IEEE80211_TX_STATUS_ACK = 1<<1, | ||
369 | }; | ||
370 | |||
371 | /** | ||
372 | * struct ieee80211_tx_status - transmit status | ||
373 | * | ||
374 | * As much information as possible should be provided for each transmitted | ||
375 | * frame with ieee80211_tx_status(). | ||
376 | * | ||
377 | * @control: a copy of the &struct ieee80211_tx_control passed to the driver | ||
378 | * in the tx() callback. | ||
379 | * | ||
380 | * @flags: transmit status flags, defined above | ||
381 | * | ||
382 | * @ack_signal: signal strength of the ACK frame | ||
383 | * | ||
384 | * @excessive_retries: set to 1 if the frame was retried many times | ||
385 | * but not acknowledged | ||
386 | * | ||
387 | * @retry_count: number of retries | ||
388 | * | ||
389 | * @queue_length: ?? REMOVE | ||
390 | * @queue_number: ?? REMOVE | ||
391 | */ | ||
244 | struct ieee80211_tx_status { | 392 | struct ieee80211_tx_status { |
245 | /* copied ieee80211_tx_control structure */ | ||
246 | struct ieee80211_tx_control control; | 393 | struct ieee80211_tx_control control; |
247 | 394 | u8 flags; | |
248 | #define IEEE80211_TX_STATUS_TX_FILTERED (1<<0) | 395 | bool excessive_retries; |
249 | #define IEEE80211_TX_STATUS_ACK (1<<1) /* whether the TX frame was ACKed */ | 396 | u8 retry_count; |
250 | u32 flags; /* tx staus flags defined above */ | 397 | int ack_signal; |
251 | 398 | int queue_length; | |
252 | int ack_signal; /* measured signal strength of the ACK frame */ | ||
253 | int excessive_retries; | ||
254 | int retry_count; | ||
255 | |||
256 | int queue_length; /* information about TX queue */ | ||
257 | int queue_number; | 399 | int queue_number; |
258 | }; | 400 | }; |
259 | 401 | ||
402 | /** | ||
403 | * enum ieee80211_conf_flags - configuration flags | ||
404 | * | ||
405 | * Flags to define PHY configuration options | ||
406 | * | ||
407 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time | ||
408 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | ||
409 | * | ||
410 | */ | ||
411 | enum ieee80211_conf_flags { | ||
412 | IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0, | ||
413 | IEEE80211_CONF_RADIOTAP = 1<<1, | ||
414 | }; | ||
260 | 415 | ||
261 | /** | 416 | /** |
262 | * struct ieee80211_conf - configuration of the device | 417 | * struct ieee80211_conf - configuration of the device |
@@ -264,57 +419,46 @@ struct ieee80211_tx_status { | |||
264 | * This struct indicates how the driver shall configure the hardware. | 419 | * This struct indicates how the driver shall configure the hardware. |
265 | * | 420 | * |
266 | * @radio_enabled: when zero, driver is required to switch off the radio. | 421 | * @radio_enabled: when zero, driver is required to switch off the radio. |
422 | * TODO make a flag | ||
423 | * @channel: IEEE 802.11 channel number | ||
424 | * @freq: frequency in MHz | ||
425 | * @channel_val: hardware specific channel value for the channel | ||
426 | * @phymode: PHY mode to activate (REMOVE) | ||
427 | * @chan: channel to switch to, pointer to the channel information | ||
428 | * @mode: pointer to mode definition | ||
429 | * @regulatory_domain: ?? | ||
430 | * @beacon_int: beacon interval (TODO make interface config) | ||
431 | * @flags: configuration flags defined above | ||
432 | * @power_level: transmit power limit for current regulatory domain in dBm | ||
433 | * @antenna_max: maximum antenna gain | ||
434 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, | ||
435 | * 1/2: antenna 0/1 | ||
436 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx | ||
267 | */ | 437 | */ |
268 | struct ieee80211_conf { | 438 | struct ieee80211_conf { |
269 | int channel; /* IEEE 802.11 channel number */ | 439 | int channel; /* IEEE 802.11 channel number */ |
270 | int freq; /* MHz */ | 440 | int freq; /* MHz */ |
271 | int channel_val; /* hw specific value for the channel */ | 441 | int channel_val; /* hw specific value for the channel */ |
272 | 442 | ||
273 | int phymode; /* MODE_IEEE80211A, .. */ | 443 | enum ieee80211_phymode phymode; |
274 | struct ieee80211_channel *chan; | 444 | struct ieee80211_channel *chan; |
275 | struct ieee80211_hw_mode *mode; | 445 | struct ieee80211_hw_mode *mode; |
276 | unsigned int regulatory_domain; | 446 | unsigned int regulatory_domain; |
277 | int radio_enabled; | 447 | int radio_enabled; |
278 | 448 | ||
279 | int beacon_int; | 449 | int beacon_int; |
280 | 450 | u32 flags; | |
281 | #define IEEE80211_CONF_SHORT_SLOT_TIME (1<<0) /* use IEEE 802.11g Short Slot | 451 | u8 power_level; |
282 | * Time */ | 452 | u8 antenna_max; |
283 | #define IEEE80211_CONF_SSID_HIDDEN (1<<1) /* do not broadcast the ssid */ | ||
284 | #define IEEE80211_CONF_RADIOTAP (1<<2) /* use radiotap if supported | ||
285 | check this bit at RX time */ | ||
286 | u32 flags; /* configuration flags defined above */ | ||
287 | |||
288 | u8 power_level; /* transmit power limit for current | ||
289 | * regulatory domain; in dBm */ | ||
290 | u8 antenna_max; /* maximum antenna gain */ | ||
291 | short tx_power_reduction; /* in 0.1 dBm */ | ||
292 | |||
293 | /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ | ||
294 | u8 antenna_sel_tx; | 453 | u8 antenna_sel_tx; |
295 | u8 antenna_sel_rx; | 454 | u8 antenna_sel_rx; |
296 | |||
297 | int antenna_def; | ||
298 | int antenna_mode; | ||
299 | |||
300 | /* Following five fields are used for IEEE 802.11H */ | ||
301 | unsigned int radar_detect; | ||
302 | unsigned int spect_mgmt; | ||
303 | /* All following fields are currently unused. */ | ||
304 | unsigned int quiet_duration; /* duration of quiet period */ | ||
305 | unsigned int quiet_offset; /* how far into the beacon is the quiet | ||
306 | * period */ | ||
307 | unsigned int quiet_period; | ||
308 | u8 radar_firpwr_threshold; | ||
309 | u8 radar_rssi_threshold; | ||
310 | u8 pulse_height_threshold; | ||
311 | u8 pulse_rssi_threshold; | ||
312 | u8 pulse_inband_threshold; | ||
313 | }; | 455 | }; |
314 | 456 | ||
315 | /** | 457 | /** |
316 | * enum ieee80211_if_types - types of 802.11 network interfaces | 458 | * enum ieee80211_if_types - types of 802.11 network interfaces |
317 | * | 459 | * |
460 | * @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used | ||
461 | * by mac80211 itself | ||
318 | * @IEEE80211_IF_TYPE_AP: interface in AP mode. | 462 | * @IEEE80211_IF_TYPE_AP: interface in AP mode. |
319 | * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap | 463 | * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap |
320 | * daemon. Drivers should never see this type. | 464 | * daemon. Drivers should never see this type. |
@@ -322,16 +466,17 @@ struct ieee80211_conf { | |||
322 | * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode. | 466 | * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode. |
323 | * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode. | 467 | * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode. |
324 | * @IEEE80211_IF_TYPE_WDS: interface in WDS mode. | 468 | * @IEEE80211_IF_TYPE_WDS: interface in WDS mode. |
325 | * @IEEE80211_IF_TYPE_VLAN: not used. | 469 | * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers |
470 | * will never see this type. | ||
326 | */ | 471 | */ |
327 | enum ieee80211_if_types { | 472 | enum ieee80211_if_types { |
328 | IEEE80211_IF_TYPE_AP = 0x00000000, | 473 | IEEE80211_IF_TYPE_INVALID, |
329 | IEEE80211_IF_TYPE_MGMT = 0x00000001, | 474 | IEEE80211_IF_TYPE_AP, |
330 | IEEE80211_IF_TYPE_STA = 0x00000002, | 475 | IEEE80211_IF_TYPE_STA, |
331 | IEEE80211_IF_TYPE_IBSS = 0x00000003, | 476 | IEEE80211_IF_TYPE_IBSS, |
332 | IEEE80211_IF_TYPE_MNTR = 0x00000004, | 477 | IEEE80211_IF_TYPE_MNTR, |
333 | IEEE80211_IF_TYPE_WDS = 0x5A580211, | 478 | IEEE80211_IF_TYPE_WDS, |
334 | IEEE80211_IF_TYPE_VLAN = 0x00080211, | 479 | IEEE80211_IF_TYPE_VLAN, |
335 | }; | 480 | }; |
336 | 481 | ||
337 | /** | 482 | /** |
@@ -347,7 +492,6 @@ enum ieee80211_if_types { | |||
347 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 492 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
348 | * until the interface is removed (i.e. it cannot be used after | 493 | * until the interface is removed (i.e. it cannot be used after |
349 | * remove_interface() callback was called for this interface). | 494 | * remove_interface() callback was called for this interface). |
350 | * This pointer will be %NULL for monitor interfaces, be careful. | ||
351 | * | 495 | * |
352 | * This structure is used in add_interface() and remove_interface() | 496 | * This structure is used in add_interface() and remove_interface() |
353 | * callbacks of &struct ieee80211_hw. | 497 | * callbacks of &struct ieee80211_hw. |
@@ -360,7 +504,7 @@ enum ieee80211_if_types { | |||
360 | */ | 504 | */ |
361 | struct ieee80211_if_init_conf { | 505 | struct ieee80211_if_init_conf { |
362 | int if_id; | 506 | int if_id; |
363 | int type; | 507 | enum ieee80211_if_types type; |
364 | void *mac_addr; | 508 | void *mac_addr; |
365 | }; | 509 | }; |
366 | 510 | ||
@@ -377,11 +521,6 @@ struct ieee80211_if_init_conf { | |||
377 | * config_interface() call, so copy the value somewhere if you need | 521 | * config_interface() call, so copy the value somewhere if you need |
378 | * it. | 522 | * it. |
379 | * @ssid_len: length of the @ssid field. | 523 | * @ssid_len: length of the @ssid field. |
380 | * @generic_elem: used (together with @generic_elem_len) by drivers for | ||
381 | * hardware that generate beacons independently. The pointer is valid | ||
382 | * only during the config_interface() call, so copy the value somewhere | ||
383 | * if you need it. | ||
384 | * @generic_elem_len: length of the generic element. | ||
385 | * @beacon: beacon template. Valid only if @host_gen_beacon_template in | 524 | * @beacon: beacon template. Valid only if @host_gen_beacon_template in |
386 | * &struct ieee80211_hw is set. The driver is responsible of freeing | 525 | * &struct ieee80211_hw is set. The driver is responsible of freeing |
387 | * the sk_buff. | 526 | * the sk_buff. |
@@ -396,368 +535,571 @@ struct ieee80211_if_conf { | |||
396 | u8 *bssid; | 535 | u8 *bssid; |
397 | u8 *ssid; | 536 | u8 *ssid; |
398 | size_t ssid_len; | 537 | size_t ssid_len; |
399 | u8 *generic_elem; | ||
400 | size_t generic_elem_len; | ||
401 | struct sk_buff *beacon; | 538 | struct sk_buff *beacon; |
402 | struct ieee80211_tx_control *beacon_control; | 539 | struct ieee80211_tx_control *beacon_control; |
403 | }; | 540 | }; |
404 | 541 | ||
405 | typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL } | 542 | /** |
406 | ieee80211_key_alg; | 543 | * enum ieee80211_key_alg - key algorithm |
544 | * @ALG_WEP: WEP40 or WEP104 | ||
545 | * @ALG_TKIP: TKIP | ||
546 | * @ALG_CCMP: CCMP (AES) | ||
547 | */ | ||
548 | enum ieee80211_key_alg { | ||
549 | ALG_WEP, | ||
550 | ALG_TKIP, | ||
551 | ALG_CCMP, | ||
552 | }; | ||
407 | 553 | ||
408 | 554 | ||
409 | struct ieee80211_key_conf { | 555 | /** |
556 | * enum ieee80211_key_flags - key flags | ||
557 | * | ||
558 | * These flags are used for communication about keys between the driver | ||
559 | * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. | ||
560 | * | ||
561 | * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates | ||
562 | * that the STA this key will be used with could be using QoS. | ||
563 | * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the | ||
564 | * driver to indicate that it requires IV generation for this | ||
565 | * particular key. | ||
566 | * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by | ||
567 | * the driver for a TKIP key if it requires Michael MIC | ||
568 | * generation in software. | ||
569 | */ | ||
570 | enum ieee80211_key_flags { | ||
571 | IEEE80211_KEY_FLAG_WMM_STA = 1<<0, | ||
572 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, | ||
573 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, | ||
574 | }; | ||
410 | 575 | ||
411 | int hw_key_idx; /* filled + used by low-level driver */ | 576 | /** |
412 | ieee80211_key_alg alg; | 577 | * struct ieee80211_key_conf - key information |
413 | int keylen; | 578 | * |
414 | 579 | * This key information is given by mac80211 to the driver by | |
415 | #define IEEE80211_KEY_FORCE_SW_ENCRYPT (1<<0) /* to be cleared by low-level | 580 | * the set_key() callback in &struct ieee80211_ops. |
416 | driver */ | 581 | * |
417 | #define IEEE80211_KEY_DEFAULT_TX_KEY (1<<1) /* This key is the new default TX | 582 | * @hw_key_idx: To be set by the driver, this is the key index the driver |
418 | key (used only for broadcast | 583 | * wants to be given when a frame is transmitted and needs to be |
419 | keys). */ | 584 | * encrypted in hardware. |
420 | #define IEEE80211_KEY_DEFAULT_WEP_ONLY (1<<2) /* static WEP is the only | 585 | * @alg: The key algorithm. |
421 | configured security policy; | 586 | * @flags: key flags, see &enum ieee80211_key_flags. |
422 | this allows some low-level | 587 | * @keyidx: the key index (0-3) |
423 | drivers to determine when | 588 | * @keylen: key material length |
424 | hwaccel can be used */ | 589 | * @key: key material |
425 | u32 flags; /* key configuration flags defined above */ | 590 | */ |
426 | 591 | struct ieee80211_key_conf { | |
427 | s8 keyidx; /* WEP key index */ | 592 | enum ieee80211_key_alg alg; |
593 | u8 hw_key_idx; | ||
594 | u8 flags; | ||
595 | s8 keyidx; | ||
596 | u8 keylen; | ||
428 | u8 key[0]; | 597 | u8 key[0]; |
429 | }; | 598 | }; |
430 | 599 | ||
431 | #define IEEE80211_SEQ_COUNTER_RX 0 | 600 | #define IEEE80211_SEQ_COUNTER_RX 0 |
432 | #define IEEE80211_SEQ_COUNTER_TX 1 | 601 | #define IEEE80211_SEQ_COUNTER_TX 1 |
433 | 602 | ||
434 | typedef enum { | 603 | /** |
435 | SET_KEY, DISABLE_KEY, REMOVE_ALL_KEYS, | 604 | * enum set_key_cmd - key command |
436 | } set_key_cmd; | 605 | * |
606 | * Used with the set_key() callback in &struct ieee80211_ops, this | ||
607 | * indicates whether a key is being removed or added. | ||
608 | * | ||
609 | * @SET_KEY: a key is set | ||
610 | * @DISABLE_KEY: a key must be disabled | ||
611 | */ | ||
612 | enum set_key_cmd { | ||
613 | SET_KEY, DISABLE_KEY, | ||
614 | }; | ||
437 | 615 | ||
438 | /* This is driver-visible part of the per-hw state the stack keeps. */ | 616 | /** |
439 | struct ieee80211_hw { | 617 | * enum sta_notify_cmd - sta notify command |
440 | /* points to the cfg80211 wiphy for this piece. Note | 618 | * |
441 | * that you must fill in the perm_addr and dev fields | 619 | * Used with the sta_notify() callback in &struct ieee80211_ops, this |
442 | * of this structure, use the macros provided below. */ | 620 | * indicates addition and removal of a station to station table |
443 | struct wiphy *wiphy; | 621 | * |
622 | * @STA_NOTIFY_ADD: a station was added to the station table | ||
623 | * @STA_NOTIFY_REMOVE: a station being removed from the station table | ||
624 | */ | ||
625 | enum sta_notify_cmd { | ||
626 | STA_NOTIFY_ADD, STA_NOTIFY_REMOVE | ||
627 | }; | ||
444 | 628 | ||
445 | /* assigned by mac80211, don't write */ | 629 | /** |
446 | struct ieee80211_conf conf; | 630 | * enum ieee80211_hw_flags - hardware flags |
631 | * | ||
632 | * These flags are used to indicate hardware capabilities to | ||
633 | * the stack. Generally, flags here should have their meaning | ||
634 | * done in a way that the simplest hardware doesn't need setting | ||
635 | * any particular flags. There are some exceptions to this rule, | ||
636 | * however, so you are advised to review these flags carefully. | ||
637 | * | ||
638 | * @IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE: | ||
639 | * The device only needs to be supplied with a beacon template. | ||
640 | * If you need the host to generate each beacon then don't use | ||
641 | * this flag and call ieee80211_beacon_get() when you need the | ||
642 | * next beacon frame. Note that if you set this flag, you must | ||
643 | * implement the set_tim() callback for powersave mode to work | ||
644 | * properly. | ||
645 | * This flag is only relevant for access-point mode. | ||
646 | * | ||
647 | * @IEEE80211_HW_RX_INCLUDES_FCS: | ||
648 | * Indicates that received frames passed to the stack include | ||
649 | * the FCS at the end. | ||
650 | * | ||
651 | * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING: | ||
652 | * Some wireless LAN chipsets buffer broadcast/multicast frames | ||
653 | * for power saving stations in the hardware/firmware and others | ||
654 | * rely on the host system for such buffering. This option is used | ||
655 | * to configure the IEEE 802.11 upper layer to buffer broadcast and | ||
656 | * multicast frames when there are power saving stations so that | ||
657 | * the driver can fetch them with ieee80211_get_buffered_bc(). Note | ||
658 | * that not setting this flag works properly only when the | ||
659 | * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because | ||
660 | * otherwise the stack will not know when the DTIM beacon was sent. | ||
661 | * | ||
662 | * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED: | ||
663 | * Channels are already configured to the default regulatory domain | ||
664 | * specified in the device's EEPROM | ||
665 | */ | ||
666 | enum ieee80211_hw_flags { | ||
667 | IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0, | ||
668 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, | ||
669 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, | ||
670 | IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED = 1<<3, | ||
671 | }; | ||
447 | 672 | ||
448 | /* Single thread workqueue available for driver use | 673 | /** |
449 | * Allocated by mac80211 on registration */ | 674 | * struct ieee80211_hw - hardware information and state |
675 | * | ||
676 | * This structure contains the configuration and hardware | ||
677 | * information for an 802.11 PHY. | ||
678 | * | ||
679 | * @wiphy: This points to the &struct wiphy allocated for this | ||
680 | * 802.11 PHY. You must fill in the @perm_addr and @dev | ||
681 | * members of this structure using SET_IEEE80211_DEV() | ||
682 | * and SET_IEEE80211_PERM_ADDR(). | ||
683 | * | ||
684 | * @conf: &struct ieee80211_conf, device configuration, don't use. | ||
685 | * | ||
686 | * @workqueue: single threaded workqueue available for driver use, | ||
687 | * allocated by mac80211 on registration and flushed on | ||
688 | * unregistration. | ||
689 | * | ||
690 | * @priv: pointer to private area that was allocated for driver use | ||
691 | * along with this structure. | ||
692 | * | ||
693 | * @flags: hardware flags, see &enum ieee80211_hw_flags. | ||
694 | * | ||
695 | * @extra_tx_headroom: headroom to reserve in each transmit skb | ||
696 | * for use by the driver (e.g. for transmit headers.) | ||
697 | * | ||
698 | * @channel_change_time: time (in microseconds) it takes to change channels. | ||
699 | * | ||
700 | * @max_rssi: Maximum value for ssi in RX information, use | ||
701 | * negative numbers for dBm and 0 to indicate no support. | ||
702 | * | ||
703 | * @max_signal: like @max_rssi, but for the signal value. | ||
704 | * | ||
705 | * @max_noise: like @max_rssi, but for the noise value. | ||
706 | * | ||
707 | * @queues: number of available hardware transmit queues for | ||
708 | * data packets. WMM/QoS requires at least four. | ||
709 | */ | ||
710 | struct ieee80211_hw { | ||
711 | struct ieee80211_conf conf; | ||
712 | struct wiphy *wiphy; | ||
450 | struct workqueue_struct *workqueue; | 713 | struct workqueue_struct *workqueue; |
451 | |||
452 | /* Pointer to the private area that was | ||
453 | * allocated with this struct for you. */ | ||
454 | void *priv; | 714 | void *priv; |
455 | 715 | u32 flags; | |
456 | /* The rest is information about your hardware */ | ||
457 | |||
458 | /* TODO: frame_type 802.11/802.3, sw_encryption requirements */ | ||
459 | |||
460 | /* Some wireless LAN chipsets generate beacons in the hardware/firmware | ||
461 | * and others rely on host generated beacons. This option is used to | ||
462 | * configure the upper layer IEEE 802.11 module to generate beacons. | ||
463 | * The low-level driver can use ieee80211_beacon_get() to fetch the | ||
464 | * next beacon frame. */ | ||
465 | #define IEEE80211_HW_HOST_GEN_BEACON (1<<0) | ||
466 | |||
467 | /* The device needs to be supplied with a beacon template only. */ | ||
468 | #define IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE (1<<1) | ||
469 | |||
470 | /* Some devices handle decryption internally and do not | ||
471 | * indicate whether the frame was encrypted (unencrypted frames | ||
472 | * will be dropped by the hardware, unless specifically allowed | ||
473 | * through) */ | ||
474 | #define IEEE80211_HW_DEVICE_HIDES_WEP (1<<2) | ||
475 | |||
476 | /* Whether RX frames passed to ieee80211_rx() include FCS in the end */ | ||
477 | #define IEEE80211_HW_RX_INCLUDES_FCS (1<<3) | ||
478 | |||
479 | /* Some wireless LAN chipsets buffer broadcast/multicast frames for | ||
480 | * power saving stations in the hardware/firmware and others rely on | ||
481 | * the host system for such buffering. This option is used to | ||
482 | * configure the IEEE 802.11 upper layer to buffer broadcast/multicast | ||
483 | * frames when there are power saving stations so that low-level driver | ||
484 | * can fetch them with ieee80211_get_buffered_bc(). */ | ||
485 | #define IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING (1<<4) | ||
486 | |||
487 | #define IEEE80211_HW_WEP_INCLUDE_IV (1<<5) | ||
488 | |||
489 | /* will data nullfunc frames get proper TX status callback */ | ||
490 | #define IEEE80211_HW_DATA_NULLFUNC_ACK (1<<6) | ||
491 | |||
492 | /* Force software encryption for TKIP packets if WMM is enabled. */ | ||
493 | #define IEEE80211_HW_NO_TKIP_WMM_HWACCEL (1<<7) | ||
494 | |||
495 | /* Some devices handle Michael MIC internally and do not include MIC in | ||
496 | * the received packets passed up. device_strips_mic must be set | ||
497 | * for such devices. The 'encryption' frame control bit is expected to | ||
498 | * be still set in the IEEE 802.11 header with this option unlike with | ||
499 | * the device_hides_wep configuration option. | ||
500 | */ | ||
501 | #define IEEE80211_HW_DEVICE_STRIPS_MIC (1<<8) | ||
502 | |||
503 | /* Device is capable of performing full monitor mode even during | ||
504 | * normal operation. */ | ||
505 | #define IEEE80211_HW_MONITOR_DURING_OPER (1<<9) | ||
506 | |||
507 | /* Device does not need BSSID filter set to broadcast in order to | ||
508 | * receive all probe responses while scanning */ | ||
509 | #define IEEE80211_HW_NO_PROBE_FILTERING (1<<10) | ||
510 | |||
511 | /* Channels are already configured to the default regulatory domain | ||
512 | * specified in the device's EEPROM */ | ||
513 | #define IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED (1<<11) | ||
514 | |||
515 | /* calculate Michael MIC for an MSDU when doing hwcrypto */ | ||
516 | #define IEEE80211_HW_TKIP_INCLUDE_MMIC (1<<12) | ||
517 | /* Do TKIP phase1 key mixing in stack to support cards only do | ||
518 | * phase2 key mixing when doing hwcrypto */ | ||
519 | #define IEEE80211_HW_TKIP_REQ_PHASE1_KEY (1<<13) | ||
520 | /* Do TKIP phase1 and phase2 key mixing in stack and send the generated | ||
521 | * per-packet RC4 key with each TX frame when doing hwcrypto */ | ||
522 | #define IEEE80211_HW_TKIP_REQ_PHASE2_KEY (1<<14) | ||
523 | |||
524 | u32 flags; /* hardware flags defined above */ | ||
525 | |||
526 | /* Set to the size of a needed device specific skb headroom for TX skbs. */ | ||
527 | unsigned int extra_tx_headroom; | 716 | unsigned int extra_tx_headroom; |
528 | |||
529 | /* This is the time in us to change channels | ||
530 | */ | ||
531 | int channel_change_time; | 717 | int channel_change_time; |
532 | /* Maximum values for various statistics. | 718 | u8 queues; |
533 | * Leave at 0 to indicate no support. Use negative numbers for dBm. */ | ||
534 | s8 max_rssi; | 719 | s8 max_rssi; |
535 | s8 max_signal; | 720 | s8 max_signal; |
536 | s8 max_noise; | 721 | s8 max_noise; |
537 | |||
538 | /* Number of available hardware TX queues for data packets. | ||
539 | * WMM requires at least four queues. */ | ||
540 | int queues; | ||
541 | }; | 722 | }; |
542 | 723 | ||
724 | /** | ||
725 | * SET_IEEE80211_DEV - set device for 802.11 hardware | ||
726 | * | ||
727 | * @hw: the &struct ieee80211_hw to set the device for | ||
728 | * @dev: the &struct device of this 802.11 device | ||
729 | */ | ||
543 | static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) | 730 | static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) |
544 | { | 731 | { |
545 | set_wiphy_dev(hw->wiphy, dev); | 732 | set_wiphy_dev(hw->wiphy, dev); |
546 | } | 733 | } |
547 | 734 | ||
735 | /** | ||
736 | * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware | ||
737 | * | ||
738 | * @hw: the &struct ieee80211_hw to set the MAC address for | ||
739 | * @addr: the address to set | ||
740 | */ | ||
548 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) | 741 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) |
549 | { | 742 | { |
550 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); | 743 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); |
551 | } | 744 | } |
552 | 745 | ||
553 | /* Configuration block used by the low-level driver to tell the 802.11 code | 746 | /** |
554 | * about supported hardware features and to pass function pointers to callback | 747 | * DOC: Hardware crypto acceleration |
555 | * functions. */ | 748 | * |
749 | * mac80211 is capable of taking advantage of many hardware | ||
750 | * acceleration designs for encryption and decryption operations. | ||
751 | * | ||
752 | * The set_key() callback in the &struct ieee80211_ops for a given | ||
753 | * device is called to enable hardware acceleration of encryption and | ||
754 | * decryption. The callback takes an @address parameter that will be | ||
755 | * the broadcast address for default keys, the other station's hardware | ||
756 | * address for individual keys or the zero address for keys that will | ||
757 | * be used only for transmission. | ||
758 | * Multiple transmission keys with the same key index may be used when | ||
759 | * VLANs are configured for an access point. | ||
760 | * | ||
761 | * The @local_address parameter will always be set to our own address, | ||
762 | * this is only relevant if you support multiple local addresses. | ||
763 | * | ||
764 | * When transmitting, the TX control data will use the @hw_key_idx | ||
765 | * selected by the driver by modifying the &struct ieee80211_key_conf | ||
766 | * pointed to by the @key parameter to the set_key() function. | ||
767 | * | ||
768 | * The set_key() call for the %SET_KEY command should return 0 if | ||
769 | * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be | ||
770 | * added; if you return 0 then hw_key_idx must be assigned to the | ||
771 | * hardware key index, you are free to use the full u8 range. | ||
772 | * | ||
773 | * When the cmd is %DISABLE_KEY then it must succeed. | ||
774 | * | ||
775 | * Note that it is permissible to not decrypt a frame even if a key | ||
776 | * for it has been uploaded to hardware, the stack will not make any | ||
777 | * decision based on whether a key has been uploaded or not but rather | ||
778 | * based on the receive flags. | ||
779 | * | ||
780 | * The &struct ieee80211_key_conf structure pointed to by the @key | ||
781 | * parameter is guaranteed to be valid until another call to set_key() | ||
782 | * removes it, but it can only be used as a cookie to differentiate | ||
783 | * keys. | ||
784 | */ | ||
785 | |||
786 | /** | ||
787 | * DOC: Frame filtering | ||
788 | * | ||
789 | * mac80211 requires to see many management frames for proper | ||
790 | * operation, and users may want to see many more frames when | ||
791 | * in monitor mode. However, for best CPU usage and power consumption, | ||
792 | * having as few frames as possible percolate through the stack is | ||
793 | * desirable. Hence, the hardware should filter as much as possible. | ||
794 | * | ||
795 | * To achieve this, mac80211 uses filter flags (see below) to tell | ||
796 | * the driver's configure_filter() function which frames should be | ||
797 | * passed to mac80211 and which should be filtered out. | ||
798 | * | ||
799 | * The configure_filter() callback is invoked with the parameters | ||
800 | * @mc_count and @mc_list for the combined multicast address list | ||
801 | * of all virtual interfaces, @changed_flags telling which flags | ||
802 | * were changed and @total_flags with the new flag states. | ||
803 | * | ||
804 | * If your device has no multicast address filters your driver will | ||
805 | * need to check both the %FIF_ALLMULTI flag and the @mc_count | ||
806 | * parameter to see whether multicast frames should be accepted | ||
807 | * or dropped. | ||
808 | * | ||
809 | * All unsupported flags in @total_flags must be cleared, i.e. you | ||
810 | * should clear all bits except those you honoured. | ||
811 | */ | ||
812 | |||
813 | /** | ||
814 | * enum ieee80211_filter_flags - hardware filter flags | ||
815 | * | ||
816 | * These flags determine what the filter in hardware should be | ||
817 | * programmed to let through and what should not be passed to the | ||
818 | * stack. It is always safe to pass more frames than requested, | ||
819 | * but this has negative impact on power consumption. | ||
820 | * | ||
821 | * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS, | ||
822 | * think of the BSS as your network segment and then this corresponds | ||
823 | * to the regular ethernet device promiscuous mode. | ||
824 | * | ||
825 | * @FIF_ALLMULTI: pass all multicast frames, this is used if requested | ||
826 | * by the user or if the hardware is not capable of filtering by | ||
827 | * multicast address. | ||
828 | * | ||
829 | * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the | ||
830 | * %RX_FLAG_FAILED_FCS_CRC for them) | ||
831 | * | ||
832 | * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set | ||
833 | * the %RX_FLAG_FAILED_PLCP_CRC for them | ||
834 | * | ||
835 | * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate | ||
836 | * to the hardware that it should not filter beacons or probe responses | ||
837 | * by BSSID. Filtering them can greatly reduce the amount of processing | ||
838 | * mac80211 needs to do and the amount of CPU wakeups, so you should | ||
839 | * honour this flag if possible. | ||
840 | * | ||
841 | * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then | ||
842 | * only those addressed to this station | ||
843 | * | ||
844 | * @FIF_OTHER_BSS: pass frames destined to other BSSes | ||
845 | */ | ||
846 | enum ieee80211_filter_flags { | ||
847 | FIF_PROMISC_IN_BSS = 1<<0, | ||
848 | FIF_ALLMULTI = 1<<1, | ||
849 | FIF_FCSFAIL = 1<<2, | ||
850 | FIF_PLCPFAIL = 1<<3, | ||
851 | FIF_BCN_PRBRESP_PROMISC = 1<<4, | ||
852 | FIF_CONTROL = 1<<5, | ||
853 | FIF_OTHER_BSS = 1<<6, | ||
854 | }; | ||
855 | |||
856 | /** | ||
857 | * enum ieee80211_erp_change_flags - erp change flags | ||
858 | * | ||
859 | * These flags are used with the erp_ie_changed() callback in | ||
860 | * &struct ieee80211_ops to indicate which parameter(s) changed. | ||
861 | * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed | ||
862 | * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed | ||
863 | */ | ||
864 | enum ieee80211_erp_change_flags { | ||
865 | IEEE80211_ERP_CHANGE_PROTECTION = 1<<0, | ||
866 | IEEE80211_ERP_CHANGE_PREAMBLE = 1<<1, | ||
867 | }; | ||
868 | |||
869 | |||
870 | /** | ||
871 | * struct ieee80211_ops - callbacks from mac80211 to the driver | ||
872 | * | ||
873 | * This structure contains various callbacks that the driver may | ||
874 | * handle or, in some cases, must handle, for example to configure | ||
875 | * the hardware to a new channel or to transmit a frame. | ||
876 | * | ||
877 | * @tx: Handler that 802.11 module calls for each transmitted frame. | ||
878 | * skb contains the buffer starting from the IEEE 802.11 header. | ||
879 | * The low-level driver should send the frame out based on | ||
880 | * configuration in the TX control data. Must be implemented and | ||
881 | * atomic. | ||
882 | * | ||
883 | * @start: Called before the first netdevice attached to the hardware | ||
884 | * is enabled. This should turn on the hardware and must turn on | ||
885 | * frame reception (for possibly enabled monitor interfaces.) | ||
886 | * Returns negative error codes, these may be seen in userspace, | ||
887 | * or zero. | ||
888 | * When the device is started it should not have a MAC address | ||
889 | * to avoid acknowledging frames before a non-monitor device | ||
890 | * is added. | ||
891 | * Must be implemented. | ||
892 | * | ||
893 | * @stop: Called after last netdevice attached to the hardware | ||
894 | * is disabled. This should turn off the hardware (at least | ||
895 | * it must turn off frame reception.) | ||
896 | * May be called right after add_interface if that rejects | ||
897 | * an interface. | ||
898 | * Must be implemented. | ||
899 | * | ||
900 | * @add_interface: Called when a netdevice attached to the hardware is | ||
901 | * enabled. Because it is not called for monitor mode devices, @open | ||
902 | * and @stop must be implemented. | ||
903 | * The driver should perform any initialization it needs before | ||
904 | * the device can be enabled. The initial configuration for the | ||
905 | * interface is given in the conf parameter. | ||
906 | * The callback may refuse to add an interface by returning a | ||
907 | * negative error code (which will be seen in userspace.) | ||
908 | * Must be implemented. | ||
909 | * | ||
910 | * @remove_interface: Notifies a driver that an interface is going down. | ||
911 | * The @stop callback is called after this if it is the last interface | ||
912 | * and no monitor interfaces are present. | ||
913 | * When all interfaces are removed, the MAC address in the hardware | ||
914 | * must be cleared so the device no longer acknowledges packets, | ||
915 | * the mac_addr member of the conf structure is, however, set to the | ||
916 | * MAC address of the device going away. | ||
917 | * Hence, this callback must be implemented. | ||
918 | * | ||
919 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | ||
920 | * function to change hardware configuration, e.g., channel. | ||
921 | * | ||
922 | * @config_interface: Handler for configuration requests related to interfaces | ||
923 | * (e.g. BSSID changes.) | ||
924 | * | ||
925 | * @configure_filter: Configure the device's RX filter. | ||
926 | * See the section "Frame filtering" for more information. | ||
927 | * This callback must be implemented and atomic. | ||
928 | * | ||
929 | * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon | ||
930 | * generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set) | ||
931 | * mac80211 calls this function when a TIM bit must be set or cleared | ||
932 | * for a given AID. Must be atomic. | ||
933 | * | ||
934 | * @set_key: See the section "Hardware crypto acceleration" | ||
935 | * This callback can sleep, and is only called between add_interface | ||
936 | * and remove_interface calls, i.e. while the interface with the | ||
937 | * given local_address is enabled. | ||
938 | * | ||
939 | * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card | ||
940 | * to pass unencrypted EAPOL-Key frames even when encryption is | ||
941 | * configured. If the wlan card does not require such a configuration, | ||
942 | * this function pointer can be set to NULL. | ||
943 | * | ||
944 | * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be | ||
945 | * authorized (@authorized=1) or unauthorized (=0). This function can be | ||
946 | * used if the wlan hardware or low-level driver implements PAE. | ||
947 | * mac80211 will filter frames based on authorization state in any case, | ||
948 | * so this function pointer can be NULL if low-level driver does not | ||
949 | * require event notification about port state changes. | ||
950 | * | ||
951 | * @hw_scan: Ask the hardware to service the scan request, no need to start | ||
952 | * the scan state machine in stack. | ||
953 | * | ||
954 | * @get_stats: return low-level statistics | ||
955 | * | ||
956 | * @set_privacy_invoked: For devices that generate their own beacons and probe | ||
957 | * response or association responses this updates the state of privacy_invoked | ||
958 | * returns 0 for success or an error number. | ||
959 | * | ||
960 | * @get_sequence_counter: For devices that have internal sequence counters this | ||
961 | * callback allows mac80211 to access the current value of a counter. | ||
962 | * This callback seems not well-defined, tell us if you need it. | ||
963 | * | ||
964 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | ||
965 | * | ||
966 | * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if | ||
967 | * the device does fragmentation by itself; if this method is assigned then | ||
968 | * the stack will not do fragmentation. | ||
969 | * | ||
970 | * @set_retry_limit: Configuration of retry limits (if device needs it) | ||
971 | * | ||
972 | * @sta_notify: Notifies low level driver about addition or removal | ||
973 | * of assocaited station or AP. | ||
974 | * | ||
975 | * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. | ||
976 | * | ||
977 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | ||
978 | * bursting) for a hardware TX queue. The @queue parameter uses the | ||
979 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. | ||
980 | * | ||
981 | * @get_tx_stats: Get statistics of the current TX queue status. This is used | ||
982 | * to get number of currently queued packets (queue length), maximum queue | ||
983 | * size (limit), and total number of packets sent using each TX queue | ||
984 | * (count). This information is used for WMM to find out which TX | ||
985 | * queues have room for more packets and by hostapd to provide | ||
986 | * statistics about the current queueing state to external programs. | ||
987 | * | ||
988 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, | ||
989 | * this is only used for IBSS mode debugging and, as such, is not a | ||
990 | * required function. Must be atomic. | ||
991 | * | ||
992 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize | ||
993 | * with other STAs in the IBSS. This is only used in IBSS mode. This | ||
994 | * function is optional if the firmware/hardware takes full care of | ||
995 | * TSF synchronization. | ||
996 | * | ||
997 | * @beacon_update: Setup beacon data for IBSS beacons. Unlike access point, | ||
998 | * IBSS uses a fixed beacon frame which is configured using this | ||
999 | * function. | ||
1000 | * If the driver returns success (0) from this callback, it owns | ||
1001 | * the skb. That means the driver is responsible to kfree_skb() it. | ||
1002 | * The control structure is not dynamically allocated. That means the | ||
1003 | * driver does not own the pointer and if it needs it somewhere | ||
1004 | * outside of the context of this function, it must copy it | ||
1005 | * somewhere else. | ||
1006 | * This handler is required only for IBSS mode. | ||
1007 | * | ||
1008 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | ||
1009 | * This is needed only for IBSS mode and the result of this function is | ||
1010 | * used to determine whether to reply to Probe Requests. | ||
1011 | */ | ||
556 | struct ieee80211_ops { | 1012 | struct ieee80211_ops { |
557 | /* Handler that 802.11 module calls for each transmitted frame. | ||
558 | * skb contains the buffer starting from the IEEE 802.11 header. | ||
559 | * The low-level driver should send the frame out based on | ||
560 | * configuration in the TX control data. | ||
561 | * Must be atomic. */ | ||
562 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | 1013 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, |
563 | struct ieee80211_tx_control *control); | 1014 | struct ieee80211_tx_control *control); |
564 | 1015 | int (*start)(struct ieee80211_hw *hw); | |
565 | /* Handler for performing hardware reset. */ | 1016 | void (*stop)(struct ieee80211_hw *hw); |
566 | int (*reset)(struct ieee80211_hw *hw); | ||
567 | |||
568 | /* Handler that is called when any netdevice attached to the hardware | ||
569 | * device is set UP for the first time. This can be used, e.g., to | ||
570 | * enable interrupts and beacon sending. */ | ||
571 | int (*open)(struct ieee80211_hw *hw); | ||
572 | |||
573 | /* Handler that is called when the last netdevice attached to the | ||
574 | * hardware device is set DOWN. This can be used, e.g., to disable | ||
575 | * interrupts and beacon sending. */ | ||
576 | int (*stop)(struct ieee80211_hw *hw); | ||
577 | |||
578 | /* Handler for asking a driver if a new interface can be added (or, | ||
579 | * more exactly, set UP). If the handler returns zero, the interface | ||
580 | * is added. Driver should perform any initialization it needs prior | ||
581 | * to returning zero. By returning non-zero addition of the interface | ||
582 | * is inhibited. Unless monitor_during_oper is set, it is guaranteed | ||
583 | * that monitor interfaces and normal interfaces are mutually | ||
584 | * exclusive. If assigned, the open() handler is called after | ||
585 | * add_interface() if this is the first device added. The | ||
586 | * add_interface() callback has to be assigned because it is the only | ||
587 | * way to obtain the requested MAC address for any interface. | ||
588 | */ | ||
589 | int (*add_interface)(struct ieee80211_hw *hw, | 1017 | int (*add_interface)(struct ieee80211_hw *hw, |
590 | struct ieee80211_if_init_conf *conf); | 1018 | struct ieee80211_if_init_conf *conf); |
591 | |||
592 | /* Notify a driver that an interface is going down. The stop() handler | ||
593 | * is called prior to this if this is a last interface. */ | ||
594 | void (*remove_interface)(struct ieee80211_hw *hw, | 1019 | void (*remove_interface)(struct ieee80211_hw *hw, |
595 | struct ieee80211_if_init_conf *conf); | 1020 | struct ieee80211_if_init_conf *conf); |
596 | |||
597 | /* Handler for configuration requests. IEEE 802.11 code calls this | ||
598 | * function to change hardware configuration, e.g., channel. */ | ||
599 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1021 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
600 | |||
601 | /* Handler for configuration requests related to interfaces (e.g. | ||
602 | * BSSID). */ | ||
603 | int (*config_interface)(struct ieee80211_hw *hw, | 1022 | int (*config_interface)(struct ieee80211_hw *hw, |
604 | int if_id, struct ieee80211_if_conf *conf); | 1023 | int if_id, struct ieee80211_if_conf *conf); |
605 | 1024 | void (*configure_filter)(struct ieee80211_hw *hw, | |
606 | /* ieee80211 drivers do not have access to the &struct net_device | 1025 | unsigned int changed_flags, |
607 | * that is (are) connected with their device. Hence (and because | 1026 | unsigned int *total_flags, |
608 | * we need to combine the multicast lists and flags for multiple | 1027 | int mc_count, struct dev_addr_list *mc_list); |
609 | * virtual interfaces), they cannot assign set_multicast_list. | ||
610 | * The parameters here replace dev->flags and dev->mc_count, | ||
611 | * dev->mc_list is replaced by calling ieee80211_get_mc_list_item. | ||
612 | * Must be atomic. */ | ||
613 | void (*set_multicast_list)(struct ieee80211_hw *hw, | ||
614 | unsigned short flags, int mc_count); | ||
615 | |||
616 | /* Set TIM bit handler. If the hardware/firmware takes care of beacon | ||
617 | * generation, IEEE 802.11 code uses this function to tell the | ||
618 | * low-level to set (or clear if set==0) TIM bit for the given aid. If | ||
619 | * host system is used to generate beacons, this handler is not used | ||
620 | * and low-level driver should set it to NULL. | ||
621 | * Must be atomic. */ | ||
622 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); | 1028 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); |
623 | 1029 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |
624 | /* Set encryption key. IEEE 802.11 module calls this function to set | 1030 | const u8 *local_address, const u8 *address, |
625 | * encryption keys. addr is ff:ff:ff:ff:ff:ff for default keys and | 1031 | struct ieee80211_key_conf *key); |
626 | * station hwaddr for individual keys. aid of the station is given | ||
627 | * to help low-level driver in selecting which key->hw_key_idx to use | ||
628 | * for this key. TX control data will use the hw_key_idx selected by | ||
629 | * the low-level driver. | ||
630 | * Must be atomic. */ | ||
631 | int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, | ||
632 | u8 *addr, struct ieee80211_key_conf *key, int aid); | ||
633 | |||
634 | /* Set TX key index for default/broadcast keys. This is needed in cases | ||
635 | * where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv | ||
636 | * is not set), in other cases, this function pointer can be set to | ||
637 | * NULL since the IEEE 802. 11 module takes care of selecting the key | ||
638 | * index for each TX frame. */ | ||
639 | int (*set_key_idx)(struct ieee80211_hw *hw, int idx); | ||
640 | |||
641 | /* Enable/disable IEEE 802.1X. This item requests wlan card to pass | ||
642 | * unencrypted EAPOL-Key frames even when encryption is configured. | ||
643 | * If the wlan card does not require such a configuration, this | ||
644 | * function pointer can be set to NULL. */ | ||
645 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); | 1032 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); |
646 | |||
647 | /* Set port authorization state (IEEE 802.1X PAE) to be authorized | ||
648 | * (authorized=1) or unauthorized (authorized=0). This function can be | ||
649 | * used if the wlan hardware or low-level driver implements PAE. | ||
650 | * 80211.o module will anyway filter frames based on authorization | ||
651 | * state, so this function pointer can be NULL if low-level driver does | ||
652 | * not require event notification about port state changes. | ||
653 | * Currently unused. */ | ||
654 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, | 1033 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, |
655 | int authorized); | 1034 | int authorized); |
656 | |||
657 | /* Ask the hardware to service the scan request, no need to start | ||
658 | * the scan state machine in stack. */ | ||
659 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1035 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
660 | |||
661 | /* return low-level statistics */ | ||
662 | int (*get_stats)(struct ieee80211_hw *hw, | 1036 | int (*get_stats)(struct ieee80211_hw *hw, |
663 | struct ieee80211_low_level_stats *stats); | 1037 | struct ieee80211_low_level_stats *stats); |
664 | |||
665 | /* For devices that generate their own beacons and probe response | ||
666 | * or association responses this updates the state of privacy_invoked | ||
667 | * returns 0 for success or an error number */ | ||
668 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, | 1038 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, |
669 | int privacy_invoked); | 1039 | int privacy_invoked); |
670 | |||
671 | /* For devices that have internal sequence counters, allow 802.11 | ||
672 | * code to access the current value of a counter */ | ||
673 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1040 | int (*get_sequence_counter)(struct ieee80211_hw *hw, |
674 | u8* addr, u8 keyidx, u8 txrx, | 1041 | u8* addr, u8 keyidx, u8 txrx, |
675 | u32* iv32, u16* iv16); | 1042 | u32* iv32, u16* iv16); |
676 | |||
677 | /* Configuration of RTS threshold (if device needs it) */ | ||
678 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1043 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
679 | |||
680 | /* Configuration of fragmentation threshold. | ||
681 | * Assign this if the device does fragmentation by itself, | ||
682 | * if this method is assigned then the stack will not do | ||
683 | * fragmentation. */ | ||
684 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1044 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); |
685 | |||
686 | /* Configuration of retry limits (if device needs it) */ | ||
687 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1045 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
688 | u32 short_retry, u32 long_retr); | 1046 | u32 short_retry, u32 long_retr); |
689 | 1047 | void (*sta_notify)(struct ieee80211_hw *hw, int if_id, | |
690 | /* Number of STAs in STA table notification (NULL = disabled). | 1048 | enum sta_notify_cmd, const u8 *addr); |
691 | * Must be atomic. */ | 1049 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, |
692 | void (*sta_table_notification)(struct ieee80211_hw *hw, | 1050 | int cts_protection, int preamble); |
693 | int num_sta); | ||
694 | |||
695 | /* Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | ||
696 | * bursting) for a hardware TX queue. | ||
697 | * queue = IEEE80211_TX_QUEUE_*. | ||
698 | * Must be atomic. */ | ||
699 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, | 1051 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, |
700 | const struct ieee80211_tx_queue_params *params); | 1052 | const struct ieee80211_tx_queue_params *params); |
701 | |||
702 | /* Get statistics of the current TX queue status. This is used to get | ||
703 | * number of currently queued packets (queue length), maximum queue | ||
704 | * size (limit), and total number of packets sent using each TX queue | ||
705 | * (count). | ||
706 | * Currently unused. */ | ||
707 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1053 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
708 | struct ieee80211_tx_queue_stats *stats); | 1054 | struct ieee80211_tx_queue_stats *stats); |
709 | |||
710 | /* Get the current TSF timer value from firmware/hardware. Currently, | ||
711 | * this is only used for IBSS mode debugging and, as such, is not a | ||
712 | * required function. | ||
713 | * Must be atomic. */ | ||
714 | u64 (*get_tsf)(struct ieee80211_hw *hw); | 1055 | u64 (*get_tsf)(struct ieee80211_hw *hw); |
715 | |||
716 | /* Reset the TSF timer and allow firmware/hardware to synchronize with | ||
717 | * other STAs in the IBSS. This is only used in IBSS mode. This | ||
718 | * function is optional if the firmware/hardware takes full care of | ||
719 | * TSF synchronization. */ | ||
720 | void (*reset_tsf)(struct ieee80211_hw *hw); | 1056 | void (*reset_tsf)(struct ieee80211_hw *hw); |
721 | |||
722 | /* Setup beacon data for IBSS beacons. Unlike access point (Master), | ||
723 | * IBSS uses a fixed beacon frame which is configured using this | ||
724 | * function. This handler is required only for IBSS mode. */ | ||
725 | int (*beacon_update)(struct ieee80211_hw *hw, | 1057 | int (*beacon_update)(struct ieee80211_hw *hw, |
726 | struct sk_buff *skb, | 1058 | struct sk_buff *skb, |
727 | struct ieee80211_tx_control *control); | 1059 | struct ieee80211_tx_control *control); |
728 | |||
729 | /* Determine whether the last IBSS beacon was sent by us. This is | ||
730 | * needed only for IBSS mode and the result of this function is used to | ||
731 | * determine whether to reply to Probe Requests. */ | ||
732 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1060 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
733 | }; | 1061 | }; |
734 | 1062 | ||
735 | /* Allocate a new hardware device. This must be called once for each | 1063 | /** |
736 | * hardware device. The returned pointer must be used to refer to this | 1064 | * ieee80211_alloc_hw - Allocate a new hardware device |
737 | * device when calling other functions. 802.11 code allocates a private data | 1065 | * |
738 | * area for the low-level driver. The size of this area is given as | 1066 | * This must be called once for each hardware device. The returned pointer |
739 | * priv_data_len. | 1067 | * must be used to refer to this device when calling other functions. |
1068 | * mac80211 allocates a private data area for the driver pointed to by | ||
1069 | * @priv in &struct ieee80211_hw, the size of this area is given as | ||
1070 | * @priv_data_len. | ||
1071 | * | ||
1072 | * @priv_data_len: length of private data | ||
1073 | * @ops: callbacks for this device | ||
740 | */ | 1074 | */ |
741 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 1075 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
742 | const struct ieee80211_ops *ops); | 1076 | const struct ieee80211_ops *ops); |
743 | 1077 | ||
744 | /* Register hardware device to the IEEE 802.11 code and kernel. Low-level | 1078 | /** |
745 | * drivers must call this function before using any other IEEE 802.11 | 1079 | * ieee80211_register_hw - Register hardware device |
746 | * function except ieee80211_register_hwmode. */ | 1080 | * |
1081 | * You must call this function before any other functions | ||
1082 | * except ieee80211_register_hwmode. | ||
1083 | * | ||
1084 | * @hw: the device to register as returned by ieee80211_alloc_hw() | ||
1085 | */ | ||
747 | int ieee80211_register_hw(struct ieee80211_hw *hw); | 1086 | int ieee80211_register_hw(struct ieee80211_hw *hw); |
748 | 1087 | ||
749 | /* driver can use this and ieee80211_get_rx_led_name to get the | ||
750 | * name of the registered LEDs after ieee80211_register_hw | ||
751 | * was called. | ||
752 | * This is useful to set the default trigger on the LED class | ||
753 | * device that your driver should export for each LED the device | ||
754 | * has, that way the default behaviour will be as expected but | ||
755 | * the user can still change it/turn off the LED etc. | ||
756 | */ | ||
757 | #ifdef CONFIG_MAC80211_LEDS | 1088 | #ifdef CONFIG_MAC80211_LEDS |
758 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); | 1089 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); |
759 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); | 1090 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); |
1091 | extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); | ||
760 | #endif | 1092 | #endif |
1093 | /** | ||
1094 | * ieee80211_get_tx_led_name - get name of TX LED | ||
1095 | * | ||
1096 | * mac80211 creates a transmit LED trigger for each wireless hardware | ||
1097 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1098 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1099 | * of the trigger so you can automatically link the LED device. | ||
1100 | * | ||
1101 | * @hw: the hardware to get the LED trigger name for | ||
1102 | */ | ||
761 | static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) | 1103 | static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) |
762 | { | 1104 | { |
763 | #ifdef CONFIG_MAC80211_LEDS | 1105 | #ifdef CONFIG_MAC80211_LEDS |
@@ -767,6 +1109,16 @@ static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) | |||
767 | #endif | 1109 | #endif |
768 | } | 1110 | } |
769 | 1111 | ||
1112 | /** | ||
1113 | * ieee80211_get_rx_led_name - get name of RX LED | ||
1114 | * | ||
1115 | * mac80211 creates a receive LED trigger for each wireless hardware | ||
1116 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1117 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1118 | * of the trigger so you can automatically link the LED device. | ||
1119 | * | ||
1120 | * @hw: the hardware to get the LED trigger name for | ||
1121 | */ | ||
770 | static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | 1122 | static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) |
771 | { | 1123 | { |
772 | #ifdef CONFIG_MAC80211_LEDS | 1124 | #ifdef CONFIG_MAC80211_LEDS |
@@ -776,33 +1128,94 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | |||
776 | #endif | 1128 | #endif |
777 | } | 1129 | } |
778 | 1130 | ||
1131 | static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | ||
1132 | { | ||
1133 | #ifdef CONFIG_MAC80211_LEDS | ||
1134 | return __ieee80211_get_assoc_led_name(hw); | ||
1135 | #else | ||
1136 | return NULL; | ||
1137 | #endif | ||
1138 | } | ||
1139 | |||
1140 | |||
779 | /* Register a new hardware PHYMODE capability to the stack. */ | 1141 | /* Register a new hardware PHYMODE capability to the stack. */ |
780 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, | 1142 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, |
781 | struct ieee80211_hw_mode *mode); | 1143 | struct ieee80211_hw_mode *mode); |
782 | 1144 | ||
783 | /* Unregister a hardware device. This function instructs 802.11 code to free | 1145 | /** |
784 | * allocated resources and unregister netdevices from the kernel. */ | 1146 | * ieee80211_unregister_hw - Unregister a hardware device |
1147 | * | ||
1148 | * This function instructs mac80211 to free allocated resources | ||
1149 | * and unregister netdevices from the networking subsystem. | ||
1150 | * | ||
1151 | * @hw: the hardware to unregister | ||
1152 | */ | ||
785 | void ieee80211_unregister_hw(struct ieee80211_hw *hw); | 1153 | void ieee80211_unregister_hw(struct ieee80211_hw *hw); |
786 | 1154 | ||
787 | /* Free everything that was allocated including private data of a driver. */ | 1155 | /** |
1156 | * ieee80211_free_hw - free hardware descriptor | ||
1157 | * | ||
1158 | * This function frees everything that was allocated, including the | ||
1159 | * private data for the driver. You must call ieee80211_unregister_hw() | ||
1160 | * before calling this function | ||
1161 | * | ||
1162 | * @hw: the hardware to free | ||
1163 | */ | ||
788 | void ieee80211_free_hw(struct ieee80211_hw *hw); | 1164 | void ieee80211_free_hw(struct ieee80211_hw *hw); |
789 | 1165 | ||
790 | /* Receive frame callback function. The low-level driver uses this function to | 1166 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ |
791 | * send received frames to the IEEE 802.11 code. Receive buffer (skb) must | ||
792 | * start with IEEE 802.11 header. */ | ||
793 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | 1167 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, |
794 | struct ieee80211_rx_status *status); | 1168 | struct ieee80211_rx_status *status); |
1169 | |||
1170 | /** | ||
1171 | * ieee80211_rx - receive frame | ||
1172 | * | ||
1173 | * Use this function to hand received frames to mac80211. The receive | ||
1174 | * buffer in @skb must start with an IEEE 802.11 header or a radiotap | ||
1175 | * header if %RX_FLAG_RADIOTAP is set in the @status flags. | ||
1176 | * | ||
1177 | * This function may not be called in IRQ context. | ||
1178 | * | ||
1179 | * @hw: the hardware this frame came in on | ||
1180 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
1181 | * @status: status of this frame; the status pointer need not be valid | ||
1182 | * after this function returns | ||
1183 | */ | ||
1184 | static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
1185 | struct ieee80211_rx_status *status) | ||
1186 | { | ||
1187 | __ieee80211_rx(hw, skb, status); | ||
1188 | } | ||
1189 | |||
1190 | /** | ||
1191 | * ieee80211_rx_irqsafe - receive frame | ||
1192 | * | ||
1193 | * Like ieee80211_rx() but can be called in IRQ context | ||
1194 | * (internally defers to a workqueue.) | ||
1195 | * | ||
1196 | * @hw: the hardware this frame came in on | ||
1197 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
1198 | * @status: status of this frame; the status pointer need not be valid | ||
1199 | * after this function returns and is not freed by mac80211, | ||
1200 | * it is recommended that it points to a stack area | ||
1201 | */ | ||
795 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, | 1202 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, |
796 | struct sk_buff *skb, | 1203 | struct sk_buff *skb, |
797 | struct ieee80211_rx_status *status); | 1204 | struct ieee80211_rx_status *status); |
798 | 1205 | ||
799 | /* Transmit status callback function. The low-level driver must call this | 1206 | /** |
800 | * function to report transmit status for all the TX frames that had | 1207 | * ieee80211_tx_status - transmit status callback |
801 | * req_tx_status set in the transmit control fields. In addition, this should | 1208 | * |
802 | * be called at least for all unicast frames to provide information for TX rate | 1209 | * Call this function for all transmitted frames after they have been |
803 | * control algorithm. In order to maintain all statistics, this function is | 1210 | * transmitted. It is permissible to not call this function for |
804 | * recommended to be called after each frame, including multicast/broadcast, is | 1211 | * multicast frames but this can affect statistics. |
805 | * sent. */ | 1212 | * |
1213 | * @hw: the hardware the frame was transmitted by | ||
1214 | * @skb: the frame that was transmitted, owned by mac80211 after this call | ||
1215 | * @status: status information for this frame; the status pointer need not | ||
1216 | * be valid after this function returns and is not freed by mac80211, | ||
1217 | * it is recommended that it points to a stack area | ||
1218 | */ | ||
806 | void ieee80211_tx_status(struct ieee80211_hw *hw, | 1219 | void ieee80211_tx_status(struct ieee80211_hw *hw, |
807 | struct sk_buff *skb, | 1220 | struct sk_buff *skb, |
808 | struct ieee80211_tx_status *status); | 1221 | struct ieee80211_tx_status *status); |
@@ -830,6 +1243,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
830 | /** | 1243 | /** |
831 | * ieee80211_rts_get - RTS frame generation function | 1244 | * ieee80211_rts_get - RTS frame generation function |
832 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1245 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1246 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | ||
833 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1247 | * @frame: pointer to the frame that is going to be protected by the RTS. |
834 | * @frame_len: the frame length (in octets). | 1248 | * @frame_len: the frame length (in octets). |
835 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1249 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -840,7 +1254,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
840 | * the next RTS frame from the 802.11 code. The low-level is responsible | 1254 | * the next RTS frame from the 802.11 code. The low-level is responsible |
841 | * for calling this function before and RTS frame is needed. | 1255 | * for calling this function before and RTS frame is needed. |
842 | */ | 1256 | */ |
843 | void ieee80211_rts_get(struct ieee80211_hw *hw, | 1257 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, |
844 | const void *frame, size_t frame_len, | 1258 | const void *frame, size_t frame_len, |
845 | const struct ieee80211_tx_control *frame_txctl, | 1259 | const struct ieee80211_tx_control *frame_txctl, |
846 | struct ieee80211_rts *rts); | 1260 | struct ieee80211_rts *rts); |
@@ -848,6 +1262,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, | |||
848 | /** | 1262 | /** |
849 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 1263 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
850 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1264 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1265 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | ||
851 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 1266 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
852 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1267 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
853 | * | 1268 | * |
@@ -855,13 +1270,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, | |||
855 | * the duration field, the low-level driver uses this function to receive | 1270 | * the duration field, the low-level driver uses this function to receive |
856 | * the duration field value in little-endian byteorder. | 1271 | * the duration field value in little-endian byteorder. |
857 | */ | 1272 | */ |
858 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | 1273 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, |
859 | size_t frame_len, | 1274 | size_t frame_len, |
860 | const struct ieee80211_tx_control *frame_txctl); | 1275 | const struct ieee80211_tx_control *frame_txctl); |
861 | 1276 | ||
862 | /** | 1277 | /** |
863 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 1278 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
864 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1279 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1280 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | ||
865 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 1281 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
866 | * @frame_len: the frame length (in octets). | 1282 | * @frame_len: the frame length (in octets). |
867 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1283 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -872,7 +1288,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
872 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible | 1288 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible |
873 | * for calling this function before and CTS-to-self frame is needed. | 1289 | * for calling this function before and CTS-to-self frame is needed. |
874 | */ | 1290 | */ |
875 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | 1291 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, |
876 | const void *frame, size_t frame_len, | 1292 | const void *frame, size_t frame_len, |
877 | const struct ieee80211_tx_control *frame_txctl, | 1293 | const struct ieee80211_tx_control *frame_txctl, |
878 | struct ieee80211_cts *cts); | 1294 | struct ieee80211_cts *cts); |
@@ -880,6 +1296,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | |||
880 | /** | 1296 | /** |
881 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 1297 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
882 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1298 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1299 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | ||
883 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 1300 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
884 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1301 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
885 | * | 1302 | * |
@@ -887,20 +1304,21 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | |||
887 | * the duration field, the low-level driver uses this function to receive | 1304 | * the duration field, the low-level driver uses this function to receive |
888 | * the duration field value in little-endian byteorder. | 1305 | * the duration field value in little-endian byteorder. |
889 | */ | 1306 | */ |
890 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | 1307 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, |
891 | size_t frame_len, | 1308 | size_t frame_len, |
892 | const struct ieee80211_tx_control *frame_txctl); | 1309 | const struct ieee80211_tx_control *frame_txctl); |
893 | 1310 | ||
894 | /** | 1311 | /** |
895 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 1312 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
896 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1313 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1314 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | ||
897 | * @frame_len: the length of the frame. | 1315 | * @frame_len: the length of the frame. |
898 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. | 1316 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. |
899 | * | 1317 | * |
900 | * Calculate the duration field of some generic frame, given its | 1318 | * Calculate the duration field of some generic frame, given its |
901 | * length and transmission rate (in 100kbps). | 1319 | * length and transmission rate (in 100kbps). |
902 | */ | 1320 | */ |
903 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | 1321 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, |
904 | size_t frame_len, | 1322 | size_t frame_len, |
905 | int rate); | 1323 | int rate); |
906 | 1324 | ||
@@ -929,14 +1347,26 @@ struct sk_buff * | |||
929 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1347 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, |
930 | struct ieee80211_tx_control *control); | 1348 | struct ieee80211_tx_control *control); |
931 | 1349 | ||
932 | /* Given an sk_buff with a raw 802.11 header at the data pointer this function | 1350 | /** |
1351 | * ieee80211_get_hdrlen_from_skb - get header length from data | ||
1352 | * | ||
1353 | * Given an skb with a raw 802.11 header at the data pointer this function | ||
933 | * returns the 802.11 header length in bytes (not including encryption | 1354 | * returns the 802.11 header length in bytes (not including encryption |
934 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 | 1355 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 |
935 | * header the function returns 0. | 1356 | * header the function returns 0. |
1357 | * | ||
1358 | * @skb: the frame | ||
936 | */ | 1359 | */ |
937 | int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | 1360 | int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); |
938 | 1361 | ||
939 | /* Like ieee80211_get_hdrlen_from_skb() but takes a FC in CPU order. */ | 1362 | /** |
1363 | * ieee80211_get_hdrlen - get header length from frame control | ||
1364 | * | ||
1365 | * This function returns the 802.11 header length in bytes (not including | ||
1366 | * encryption headers.) | ||
1367 | * | ||
1368 | * @fc: the frame control field (in CPU endianness) | ||
1369 | */ | ||
940 | int ieee80211_get_hdrlen(u16 fc); | 1370 | int ieee80211_get_hdrlen(u16 fc); |
941 | 1371 | ||
942 | /** | 1372 | /** |
@@ -982,66 +1412,14 @@ void ieee80211_stop_queues(struct ieee80211_hw *hw); | |||
982 | void ieee80211_wake_queues(struct ieee80211_hw *hw); | 1412 | void ieee80211_wake_queues(struct ieee80211_hw *hw); |
983 | 1413 | ||
984 | /** | 1414 | /** |
985 | * ieee80211_get_mc_list_item - iteration over items in multicast list | 1415 | * ieee80211_scan_completed - completed hardware scan |
986 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 1416 | * |
987 | * @prev: value returned by previous call to ieee80211_get_mc_list_item() or | 1417 | * When hardware scan offload is used (i.e. the hw_scan() callback is |
988 | * NULL to start a new iteration. | 1418 | * assigned) this function needs to be called by the driver to notify |
989 | * @ptr: pointer to buffer of void * type for internal usage of | 1419 | * mac80211 that the scan finished. |
990 | * ieee80211_get_mc_list_item(). | 1420 | * |
991 | * | 1421 | * @hw: the hardware that finished the scan |
992 | * Iterates over items in multicast list of given device. To get the first | ||
993 | * item, pass NULL in @prev and in *@ptr. In subsequent calls, pass the | ||
994 | * value returned by previous call in @prev. Don't alter *@ptr during | ||
995 | * iteration. When there are no more items, NULL is returned. | ||
996 | */ | 1422 | */ |
997 | struct dev_mc_list * | ||
998 | ieee80211_get_mc_list_item(struct ieee80211_hw *hw, | ||
999 | struct dev_mc_list *prev, | ||
1000 | void **ptr); | ||
1001 | |||
1002 | /* called by driver to notify scan status completed */ | ||
1003 | void ieee80211_scan_completed(struct ieee80211_hw *hw); | 1423 | void ieee80211_scan_completed(struct ieee80211_hw *hw); |
1004 | 1424 | ||
1005 | /* Function to indicate Radar Detection. The low level driver must call this | ||
1006 | * function to indicate the presence of radar in the current channel. | ||
1007 | * Additionally the radar type also could be sent */ | ||
1008 | int ieee80211_radar_status(struct ieee80211_hw *hw, int channel, | ||
1009 | int radar, int radar_type); | ||
1010 | |||
1011 | /* return a pointer to the source address (SA) */ | ||
1012 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | ||
1013 | { | ||
1014 | u8 *raw = (u8 *) hdr; | ||
1015 | u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ | ||
1016 | |||
1017 | switch (tofrom) { | ||
1018 | case 2: | ||
1019 | return hdr->addr3; | ||
1020 | case 3: | ||
1021 | return hdr->addr4; | ||
1022 | } | ||
1023 | return hdr->addr2; | ||
1024 | } | ||
1025 | |||
1026 | /* return a pointer to the destination address (DA) */ | ||
1027 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | ||
1028 | { | ||
1029 | u8 *raw = (u8 *) hdr; | ||
1030 | u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */ | ||
1031 | |||
1032 | if (to_ds) | ||
1033 | return hdr->addr3; | ||
1034 | return hdr->addr1; | ||
1035 | } | ||
1036 | |||
1037 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | ||
1038 | { | ||
1039 | return (le16_to_cpu(hdr->frame_control) & | ||
1040 | IEEE80211_FCTL_MOREFRAGS) != 0; | ||
1041 | } | ||
1042 | |||
1043 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
1044 | #define MAC_ARG(x) ((u8*)(x))[0], ((u8*)(x))[1], ((u8*)(x))[2], \ | ||
1045 | ((u8*)(x))[3], ((u8*)(x))[4], ((u8*)(x))[5] | ||
1046 | |||
1047 | #endif /* MAC80211_H */ | 1425 | #endif /* MAC80211_H */ |
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 475b10c575b3..6684f7efbeeb 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -24,6 +24,7 @@ enum { | |||
24 | ND_OPT_MTU = 5, /* RFC2461 */ | 24 | ND_OPT_MTU = 5, /* RFC2461 */ |
25 | __ND_OPT_ARRAY_MAX, | 25 | __ND_OPT_ARRAY_MAX, |
26 | ND_OPT_ROUTE_INFO = 24, /* RFC4191 */ | 26 | ND_OPT_ROUTE_INFO = 24, /* RFC4191 */ |
27 | ND_OPT_RDNSS = 25, /* RFC5006 */ | ||
27 | __ND_OPT_MAX | 28 | __ND_OPT_MAX |
28 | }; | 29 | }; |
29 | 30 | ||
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h new file mode 100644 index 000000000000..93aa87d32804 --- /dev/null +++ b/include/net/net_namespace.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * Operations on the network namespace | ||
3 | */ | ||
4 | #ifndef __NET_NET_NAMESPACE_H | ||
5 | #define __NET_NET_NAMESPACE_H | ||
6 | |||
7 | #include <asm/atomic.h> | ||
8 | #include <linux/workqueue.h> | ||
9 | #include <linux/list.h> | ||
10 | |||
11 | struct proc_dir_entry; | ||
12 | struct net_device; | ||
13 | struct net { | ||
14 | atomic_t count; /* To decided when the network | ||
15 | * namespace should be freed. | ||
16 | */ | ||
17 | atomic_t use_count; /* To track references we | ||
18 | * destroy on demand | ||
19 | */ | ||
20 | struct list_head list; /* list of network namespaces */ | ||
21 | struct work_struct work; /* work struct for freeing */ | ||
22 | |||
23 | struct proc_dir_entry *proc_net; | ||
24 | struct proc_dir_entry *proc_net_stat; | ||
25 | struct proc_dir_entry *proc_net_root; | ||
26 | |||
27 | struct net_device *loopback_dev; /* The loopback */ | ||
28 | |||
29 | struct list_head dev_base_head; | ||
30 | struct hlist_head *dev_name_head; | ||
31 | struct hlist_head *dev_index_head; | ||
32 | }; | ||
33 | |||
34 | #ifdef CONFIG_NET | ||
35 | /* Init's network namespace */ | ||
36 | extern struct net init_net; | ||
37 | #define INIT_NET_NS(net_ns) .net_ns = &init_net, | ||
38 | #else | ||
39 | #define INIT_NET_NS(net_ns) | ||
40 | #endif | ||
41 | |||
42 | extern struct list_head net_namespace_list; | ||
43 | |||
44 | #ifdef CONFIG_NET | ||
45 | extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); | ||
46 | #else | ||
47 | static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) | ||
48 | { | ||
49 | /* There is nothing to copy so this is a noop */ | ||
50 | return net_ns; | ||
51 | } | ||
52 | #endif | ||
53 | |||
54 | extern void __put_net(struct net *net); | ||
55 | |||
56 | static inline struct net *get_net(struct net *net) | ||
57 | { | ||
58 | #ifdef CONFIG_NET | ||
59 | atomic_inc(&net->count); | ||
60 | #endif | ||
61 | return net; | ||
62 | } | ||
63 | |||
64 | static inline struct net *maybe_get_net(struct net *net) | ||
65 | { | ||
66 | /* Used when we know struct net exists but we | ||
67 | * aren't guaranteed a previous reference count | ||
68 | * exists. If the reference count is zero this | ||
69 | * function fails and returns NULL. | ||
70 | */ | ||
71 | if (!atomic_inc_not_zero(&net->count)) | ||
72 | net = NULL; | ||
73 | return net; | ||
74 | } | ||
75 | |||
76 | static inline void put_net(struct net *net) | ||
77 | { | ||
78 | #ifdef CONFIG_NET | ||
79 | if (atomic_dec_and_test(&net->count)) | ||
80 | __put_net(net); | ||
81 | #endif | ||
82 | } | ||
83 | |||
84 | static inline struct net *hold_net(struct net *net) | ||
85 | { | ||
86 | #ifdef CONFIG_NET | ||
87 | atomic_inc(&net->use_count); | ||
88 | #endif | ||
89 | return net; | ||
90 | } | ||
91 | |||
92 | static inline void release_net(struct net *net) | ||
93 | { | ||
94 | #ifdef CONFIG_NET | ||
95 | atomic_dec(&net->use_count); | ||
96 | #endif | ||
97 | } | ||
98 | |||
99 | #define for_each_net(VAR) \ | ||
100 | list_for_each_entry(VAR, &net_namespace_list, list) | ||
101 | |||
102 | #ifdef CONFIG_NET_NS | ||
103 | #define __net_init | ||
104 | #define __net_exit | ||
105 | #define __net_initdata | ||
106 | #else | ||
107 | #define __net_init __init | ||
108 | #define __net_exit __exit_refok | ||
109 | #define __net_initdata __initdata | ||
110 | #endif | ||
111 | |||
112 | struct pernet_operations { | ||
113 | struct list_head list; | ||
114 | int (*init)(struct net *net); | ||
115 | void (*exit)(struct net *net); | ||
116 | }; | ||
117 | |||
118 | extern int register_pernet_subsys(struct pernet_operations *); | ||
119 | extern void unregister_pernet_subsys(struct pernet_operations *); | ||
120 | extern int register_pernet_device(struct pernet_operations *); | ||
121 | extern void unregister_pernet_device(struct pernet_operations *); | ||
122 | |||
123 | #endif /* __NET_NET_NAMESPACE_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 810020ec345d..90fb66d99d0c 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -116,9 +116,6 @@ struct nf_conn | |||
116 | struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; | 116 | struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | /* Unique ID that identifies this conntrack*/ | ||
120 | unsigned int id; | ||
121 | |||
122 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 119 | #if defined(CONFIG_NF_CONNTRACK_MARK) |
123 | u_int32_t mark; | 120 | u_int32_t mark; |
124 | #endif | 121 | #endif |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index cae1a0dce365..b47c04f12dbe 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -38,9 +38,6 @@ struct nf_conntrack_expect | |||
38 | /* Usage count. */ | 38 | /* Usage count. */ |
39 | atomic_t use; | 39 | atomic_t use; |
40 | 40 | ||
41 | /* Unique ID */ | ||
42 | unsigned int id; | ||
43 | |||
44 | /* Flags */ | 41 | /* Flags */ |
45 | unsigned int flags; | 42 | unsigned int flags; |
46 | 43 | ||
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index d04f99964d94..0dcc4c828ce9 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -36,7 +36,7 @@ struct nf_conntrack_helper | |||
36 | 36 | ||
37 | void (*destroy)(struct nf_conn *ct); | 37 | void (*destroy)(struct nf_conn *ct); |
38 | 38 | ||
39 | int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct); | 39 | int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct); |
40 | }; | 40 | }; |
41 | 41 | ||
42 | extern struct nf_conntrack_helper * | 42 | extern struct nf_conntrack_helper * |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 3c58a2c4df28..15888fc7b72d 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -11,11 +11,11 @@ | |||
11 | 11 | ||
12 | #ifndef _NF_CONNTRACK_L3PROTO_H | 12 | #ifndef _NF_CONNTRACK_L3PROTO_H |
13 | #define _NF_CONNTRACK_L3PROTO_H | 13 | #define _NF_CONNTRACK_L3PROTO_H |
14 | #include <linux/netlink.h> | ||
15 | #include <net/netlink.h> | ||
14 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
15 | #include <net/netfilter/nf_conntrack.h> | 17 | #include <net/netfilter/nf_conntrack.h> |
16 | 18 | ||
17 | struct nfattr; | ||
18 | |||
19 | struct nf_conntrack_l3proto | 19 | struct nf_conntrack_l3proto |
20 | { | 20 | { |
21 | /* L3 Protocol Family number. ex) PF_INET */ | 21 | /* L3 Protocol Family number. ex) PF_INET */ |
@@ -64,11 +64,12 @@ struct nf_conntrack_l3proto | |||
64 | int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff, | 64 | int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff, |
65 | unsigned int *dataoff, u_int8_t *protonum); | 65 | unsigned int *dataoff, u_int8_t *protonum); |
66 | 66 | ||
67 | int (*tuple_to_nfattr)(struct sk_buff *skb, | 67 | int (*tuple_to_nlattr)(struct sk_buff *skb, |
68 | const struct nf_conntrack_tuple *t); | 68 | const struct nf_conntrack_tuple *t); |
69 | 69 | ||
70 | int (*nfattr_to_tuple)(struct nfattr *tb[], | 70 | int (*nlattr_to_tuple)(struct nlattr *tb[], |
71 | struct nf_conntrack_tuple *t); | 71 | struct nf_conntrack_tuple *t); |
72 | const struct nla_policy *nla_policy; | ||
72 | 73 | ||
73 | #ifdef CONFIG_SYSCTL | 74 | #ifdef CONFIG_SYSCTL |
74 | struct ctl_table_header *ctl_table_header; | 75 | struct ctl_table_header *ctl_table_header; |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index f46cb930414c..fb50c217ba0a 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -9,10 +9,11 @@ | |||
9 | 9 | ||
10 | #ifndef _NF_CONNTRACK_L4PROTO_H | 10 | #ifndef _NF_CONNTRACK_L4PROTO_H |
11 | #define _NF_CONNTRACK_L4PROTO_H | 11 | #define _NF_CONNTRACK_L4PROTO_H |
12 | #include <linux/netlink.h> | ||
13 | #include <net/netlink.h> | ||
12 | #include <net/netfilter/nf_conntrack.h> | 14 | #include <net/netfilter/nf_conntrack.h> |
13 | 15 | ||
14 | struct seq_file; | 16 | struct seq_file; |
15 | struct nfattr; | ||
16 | 17 | ||
17 | struct nf_conntrack_l4proto | 18 | struct nf_conntrack_l4proto |
18 | { | 19 | { |
@@ -65,16 +66,17 @@ struct nf_conntrack_l4proto | |||
65 | int pf, unsigned int hooknum); | 66 | int pf, unsigned int hooknum); |
66 | 67 | ||
67 | /* convert protoinfo to nfnetink attributes */ | 68 | /* convert protoinfo to nfnetink attributes */ |
68 | int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa, | 69 | int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, |
69 | const struct nf_conn *ct); | 70 | const struct nf_conn *ct); |
70 | 71 | ||
71 | /* convert nfnetlink attributes to protoinfo */ | 72 | /* convert nfnetlink attributes to protoinfo */ |
72 | int (*from_nfattr)(struct nfattr *tb[], struct nf_conn *ct); | 73 | int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct); |
73 | 74 | ||
74 | int (*tuple_to_nfattr)(struct sk_buff *skb, | 75 | int (*tuple_to_nlattr)(struct sk_buff *skb, |
75 | const struct nf_conntrack_tuple *t); | 76 | const struct nf_conntrack_tuple *t); |
76 | int (*nfattr_to_tuple)(struct nfattr *tb[], | 77 | int (*nlattr_to_tuple)(struct nlattr *tb[], |
77 | struct nf_conntrack_tuple *t); | 78 | struct nf_conntrack_tuple *t); |
79 | const struct nla_policy *nla_policy; | ||
78 | 80 | ||
79 | #ifdef CONFIG_SYSCTL | 81 | #ifdef CONFIG_SYSCTL |
80 | struct ctl_table_header **ctl_table_header; | 82 | struct ctl_table_header **ctl_table_header; |
@@ -111,10 +113,11 @@ extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); | |||
111 | extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); | 113 | extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); |
112 | 114 | ||
113 | /* Generic netlink helpers */ | 115 | /* Generic netlink helpers */ |
114 | extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, | 116 | extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, |
115 | const struct nf_conntrack_tuple *tuple); | 117 | const struct nf_conntrack_tuple *tuple); |
116 | extern int nf_ct_port_nfattr_to_tuple(struct nfattr *tb[], | 118 | extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], |
117 | struct nf_conntrack_tuple *t); | 119 | struct nf_conntrack_tuple *t); |
120 | extern const struct nla_policy nf_ct_port_nla_policy[]; | ||
118 | 121 | ||
119 | /* Log invalid packets */ | 122 | /* Log invalid packets */ |
120 | extern unsigned int nf_ct_log_invalid; | 123 | extern unsigned int nf_ct_log_invalid; |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index a9ec5ef61468..14c7b2d7263c 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
@@ -38,10 +38,10 @@ struct nf_nat_protocol | |||
38 | enum nf_nat_manip_type maniptype, | 38 | enum nf_nat_manip_type maniptype, |
39 | const struct nf_conn *ct); | 39 | const struct nf_conn *ct); |
40 | 40 | ||
41 | int (*range_to_nfattr)(struct sk_buff *skb, | 41 | int (*range_to_nlattr)(struct sk_buff *skb, |
42 | const struct nf_nat_range *range); | 42 | const struct nf_nat_range *range); |
43 | 43 | ||
44 | int (*nfattr_to_range)(struct nfattr *tb[], | 44 | int (*nlattr_to_range)(struct nlattr *tb[], |
45 | struct nf_nat_range *range); | 45 | struct nf_nat_range *range); |
46 | }; | 46 | }; |
47 | 47 | ||
@@ -62,9 +62,9 @@ extern int init_protocols(void) __init; | |||
62 | extern void cleanup_protocols(void); | 62 | extern void cleanup_protocols(void); |
63 | extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); | 63 | extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); |
64 | 64 | ||
65 | extern int nf_nat_port_range_to_nfattr(struct sk_buff *skb, | 65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, |
66 | const struct nf_nat_range *range); | 66 | const struct nf_nat_range *range); |
67 | extern int nf_nat_port_nfattr_to_range(struct nfattr *tb[], | 67 | extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[], |
68 | struct nf_nat_range *range); | 68 | struct nf_nat_range *range); |
69 | 69 | ||
70 | #endif /*_NF_NAT_PROTO_H*/ | 70 | #endif /*_NF_NAT_PROTO_H*/ |
diff --git a/include/net/netlink.h b/include/net/netlink.h index d7b824be5422..9298218c07f9 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -84,7 +84,7 @@ | |||
84 | * nla_next(nla)-----------------------------' | 84 | * nla_next(nla)-----------------------------' |
85 | * | 85 | * |
86 | * Data Structures: | 86 | * Data Structures: |
87 | * struct nlattr netlink attribtue header | 87 | * struct nlattr netlink attribute header |
88 | * | 88 | * |
89 | * Attribute Construction: | 89 | * Attribute Construction: |
90 | * nla_reserve(skb, type, len) reserve room for an attribute | 90 | * nla_reserve(skb, type, len) reserve room for an attribute |
@@ -220,9 +220,9 @@ struct nl_info { | |||
220 | u32 pid; | 220 | u32 pid; |
221 | }; | 221 | }; |
222 | 222 | ||
223 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 223 | extern int netlink_rcv_skb(struct sk_buff *skb, |
224 | int (*cb)(struct sk_buff *, | 224 | int (*cb)(struct sk_buff *, |
225 | struct nlmsghdr *)); | 225 | struct nlmsghdr *)); |
226 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | 226 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, |
227 | u32 pid, unsigned int group, int report, | 227 | u32 pid, unsigned int group, int report, |
228 | gfp_t flags); | 228 | gfp_t flags); |
@@ -667,6 +667,15 @@ static inline int nla_padlen(int payload) | |||
667 | } | 667 | } |
668 | 668 | ||
669 | /** | 669 | /** |
670 | * nla_type - attribute type | ||
671 | * @nla: netlink attribute | ||
672 | */ | ||
673 | static inline int nla_type(const struct nlattr *nla) | ||
674 | { | ||
675 | return nla->nla_type & NLA_TYPE_MASK; | ||
676 | } | ||
677 | |||
678 | /** | ||
670 | * nla_data - head of payload | 679 | * nla_data - head of payload |
671 | * @nla: netlink attribute | 680 | * @nla: netlink attribute |
672 | */ | 681 | */ |
@@ -697,7 +706,7 @@ static inline int nla_ok(const struct nlattr *nla, int remaining) | |||
697 | } | 706 | } |
698 | 707 | ||
699 | /** | 708 | /** |
700 | * nla_next - next netlink attribte in attribute stream | 709 | * nla_next - next netlink attribute in attribute stream |
701 | * @nla: netlink attribute | 710 | * @nla: netlink attribute |
702 | * @remaining: number of bytes remaining in attribute stream | 711 | * @remaining: number of bytes remaining in attribute stream |
703 | * | 712 | * |
@@ -773,7 +782,7 @@ static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype, | |||
773 | ({ data = nla_len(nla) >= len ? nla_data(nla) : NULL; \ | 782 | ({ data = nla_len(nla) >= len ? nla_data(nla) : NULL; \ |
774 | __nla_parse_nested_compat(tb, maxtype, nla, policy, len); }) | 783 | __nla_parse_nested_compat(tb, maxtype, nla, policy, len); }) |
775 | /** | 784 | /** |
776 | * nla_put_u8 - Add a u16 netlink attribute to a socket buffer | 785 | * nla_put_u8 - Add a u8 netlink attribute to a socket buffer |
777 | * @skb: socket buffer to add attribute to | 786 | * @skb: socket buffer to add attribute to |
778 | * @attrtype: attribute type | 787 | * @attrtype: attribute type |
779 | * @value: numeric value | 788 | * @value: numeric value |
@@ -989,7 +998,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | |||
989 | 998 | ||
990 | /** | 999 | /** |
991 | * nla_nest_end - Finalize nesting of attributes | 1000 | * nla_nest_end - Finalize nesting of attributes |
992 | * @skb: socket buffer the attribtues are stored in | 1001 | * @skb: socket buffer the attributes are stored in |
993 | * @start: container attribute | 1002 | * @start: container attribute |
994 | * | 1003 | * |
995 | * Corrects the container attribute header to include the all | 1004 | * Corrects the container attribute header to include the all |
@@ -1032,7 +1041,7 @@ static inline struct nlattr *nla_nest_compat_start(struct sk_buff *skb, | |||
1032 | 1041 | ||
1033 | /** | 1042 | /** |
1034 | * nla_nest_compat_end - Finalize nesting of compat attributes | 1043 | * nla_nest_compat_end - Finalize nesting of compat attributes |
1035 | * @skb: socket buffer the attribtues are stored in | 1044 | * @skb: socket buffer the attributes are stored in |
1036 | * @start: container attribute | 1045 | * @start: container attribute |
1037 | * | 1046 | * |
1038 | * Corrects the container attribute header to include the all | 1047 | * Corrects the container attribute header to include the all |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 7968b1d66369..f285de69c615 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_PKT_CLS_H | 2 | #define __NET_PKT_CLS_H |
3 | 3 | ||
4 | #include <linux/pkt_cls.h> | 4 | #include <linux/pkt_cls.h> |
5 | #include <net/net_namespace.h> | ||
5 | #include <net/sch_generic.h> | 6 | #include <net/sch_generic.h> |
6 | #include <net/act_api.h> | 7 | #include <net/act_api.h> |
7 | 8 | ||
@@ -351,7 +352,7 @@ tcf_match_indev(struct sk_buff *skb, char *indev) | |||
351 | if (indev[0]) { | 352 | if (indev[0]) { |
352 | if (!skb->iif) | 353 | if (!skb->iif) |
353 | return 0; | 354 | return 0; |
354 | dev = __dev_get_by_index(skb->iif); | 355 | dev = __dev_get_by_index(&init_net, skb->iif); |
355 | if (!dev || strcmp(indev, dev->name)) | 356 | if (!dev || strcmp(indev, dev->name)) |
356 | return 0; | 357 | return 0; |
357 | } | 358 | } |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 9e22526e80e7..ab61809a9616 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -97,10 +97,9 @@ extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
97 | /* Calculate maximal size of packet seen by hard_start_xmit | 97 | /* Calculate maximal size of packet seen by hard_start_xmit |
98 | routine of this device. | 98 | routine of this device. |
99 | */ | 99 | */ |
100 | static inline unsigned psched_mtu(struct net_device *dev) | 100 | static inline unsigned psched_mtu(const struct net_device *dev) |
101 | { | 101 | { |
102 | unsigned mtu = dev->mtu; | 102 | return dev->mtu + dev->hard_header_len; |
103 | return dev->hard_header ? mtu + dev->hard_header_len : mtu; | ||
104 | } | 103 | } |
105 | 104 | ||
106 | #endif | 105 | #endif |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 3861c05cdf0f..793863e09c69 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
@@ -78,6 +78,10 @@ extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); | |||
78 | extern int rtnl_link_register(struct rtnl_link_ops *ops); | 78 | extern int rtnl_link_register(struct rtnl_link_ops *ops); |
79 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); | 79 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); |
80 | 80 | ||
81 | extern struct net_device *rtnl_create_link(struct net *net, char *ifname, | ||
82 | const struct rtnl_link_ops *ops, struct nlattr *tb[]); | ||
83 | extern const struct nla_policy ifla_policy[IFLA_MAX+1]; | ||
84 | |||
81 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) | 85 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) |
82 | 86 | ||
83 | #endif | 87 | #endif |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 8a67f24cbe02..a02ec9e5fea5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -302,4 +302,18 @@ drop: | |||
302 | return NET_XMIT_DROP; | 302 | return NET_XMIT_DROP; |
303 | } | 303 | } |
304 | 304 | ||
305 | /* Length to Time (L2T) lookup in a qdisc_rate_table, to determine how | ||
306 | long it will take to send a packet given its size. | ||
307 | */ | ||
308 | static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) | ||
309 | { | ||
310 | int slot = pktlen + rtab->rate.cell_align + rtab->rate.overhead; | ||
311 | if (slot < 0) | ||
312 | slot = 0; | ||
313 | slot >>= rtab->rate.cell_log; | ||
314 | if (slot > 255) | ||
315 | return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]); | ||
316 | return rtab->data[slot]; | ||
317 | } | ||
318 | |||
305 | #endif | 319 | #endif |
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h new file mode 100644 index 000000000000..4945954a16af --- /dev/null +++ b/include/net/sctp/auth.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* SCTP kernel reference Implementation | ||
2 | * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. | ||
3 | * | ||
4 | * This file is part of the SCTP kernel reference Implementation | ||
5 | * | ||
6 | * The SCTP reference implementation is free software; | ||
7 | * you can redistribute it and/or modify it under the terms of | ||
8 | * the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2, or (at your option) | ||
10 | * any later version. | ||
11 | * | ||
12 | * The SCTP reference implementation is distributed in the hope that it | ||
13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
14 | * ************************ | ||
15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | * See the GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with GNU CC; see the file COPYING. If not, write to | ||
20 | * the Free Software Foundation, 59 Temple Place - Suite 330, | ||
21 | * Boston, MA 02111-1307, USA. | ||
22 | * | ||
23 | * Please send any bug reports or fixes you make to the | ||
24 | * email address(es): | ||
25 | * lksctp developers <lksctp-developers@lists.sourceforge.net> | ||
26 | * | ||
27 | * Or submit a bug report through the following website: | ||
28 | * http://www.sf.net/projects/lksctp | ||
29 | * | ||
30 | * Written or modified by: | ||
31 | * Vlad Yasevich <vladislav.yasevich@hp.com> | ||
32 | * | ||
33 | * Any bugs reported given to us we will try to fix... any fixes shared will | ||
34 | * be incorporated into the next SCTP release. | ||
35 | */ | ||
36 | |||
37 | #ifndef __sctp_auth_h__ | ||
38 | #define __sctp_auth_h__ | ||
39 | |||
40 | #include <linux/list.h> | ||
41 | #include <linux/crypto.h> | ||
42 | |||
43 | struct sctp_endpoint; | ||
44 | struct sctp_association; | ||
45 | struct sctp_authkey; | ||
46 | struct sctp_hmacalgo; | ||
47 | |||
48 | /* | ||
49 | * Define a generic struct that will hold all the info | ||
50 | * necessary for an HMAC transform | ||
51 | */ | ||
52 | struct sctp_hmac { | ||
53 | __u16 hmac_id; /* one of the above ids */ | ||
54 | char *hmac_name; /* name for loading */ | ||
55 | __u16 hmac_len; /* length of the signature */ | ||
56 | }; | ||
57 | |||
58 | /* This is generic structure that containst authentication bytes used | ||
59 | * as keying material. It's a what is referred to as byte-vector all | ||
60 | * over SCTP-AUTH | ||
61 | */ | ||
62 | struct sctp_auth_bytes { | ||
63 | atomic_t refcnt; | ||
64 | __u32 len; | ||
65 | __u8 data[]; | ||
66 | }; | ||
67 | |||
68 | /* Definition for a shared key, weather endpoint or association */ | ||
69 | struct sctp_shared_key { | ||
70 | struct list_head key_list; | ||
71 | __u16 key_id; | ||
72 | struct sctp_auth_bytes *key; | ||
73 | }; | ||
74 | |||
75 | #define key_for_each(__key, __list_head) \ | ||
76 | list_for_each_entry(__key, __list_head, key_list) | ||
77 | |||
78 | #define key_for_each_safe(__key, __tmp, __list_head) \ | ||
79 | list_for_each_entry_safe(__key, __tmp, __list_head, key_list) | ||
80 | |||
81 | static inline void sctp_auth_key_hold(struct sctp_auth_bytes *key) | ||
82 | { | ||
83 | if (!key) | ||
84 | return; | ||
85 | |||
86 | atomic_inc(&key->refcnt); | ||
87 | } | ||
88 | |||
89 | void sctp_auth_key_put(struct sctp_auth_bytes *key); | ||
90 | struct sctp_shared_key *sctp_auth_shkey_create(__u16 key_id, gfp_t gfp); | ||
91 | void sctp_auth_shkey_free(struct sctp_shared_key *sh_key); | ||
92 | void sctp_auth_destroy_keys(struct list_head *keys); | ||
93 | int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp); | ||
94 | struct sctp_shared_key *sctp_auth_get_shkey( | ||
95 | const struct sctp_association *asoc, | ||
96 | __u16 key_id); | ||
97 | int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep, | ||
98 | struct sctp_association *asoc, | ||
99 | gfp_t gfp); | ||
100 | int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp); | ||
101 | void sctp_auth_destroy_hmacs(struct crypto_hash *auth_hmacs[]); | ||
102 | struct sctp_hmac *sctp_auth_get_hmac(__u16 hmac_id); | ||
103 | struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc); | ||
104 | void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, | ||
105 | struct sctp_hmac_algo_param *hmacs); | ||
106 | int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, | ||
107 | __u16 hmac_id); | ||
108 | int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); | ||
109 | int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); | ||
110 | void sctp_auth_calculate_hmac(const struct sctp_association *asoc, | ||
111 | struct sk_buff *skb, | ||
112 | struct sctp_auth_chunk *auth, gfp_t gfp); | ||
113 | |||
114 | /* API Helpers */ | ||
115 | int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id); | ||
116 | int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, | ||
117 | struct sctp_hmacalgo *hmacs); | ||
118 | int sctp_auth_set_key(struct sctp_endpoint *ep, | ||
119 | struct sctp_association *asoc, | ||
120 | struct sctp_authkey *auth_key); | ||
121 | int sctp_auth_set_active_key(struct sctp_endpoint *ep, | ||
122 | struct sctp_association *asoc, | ||
123 | __u16 key_id); | ||
124 | int sctp_auth_del_key_id(struct sctp_endpoint *ep, | ||
125 | struct sctp_association *asoc, | ||
126 | __u16 key_id); | ||
127 | |||
128 | #endif | ||
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index f56c8d695a82..b8733364557f 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -102,6 +102,7 @@ typedef enum { | |||
102 | SCTP_CMD_SET_SK_ERR, /* Set sk_err */ | 102 | SCTP_CMD_SET_SK_ERR, /* Set sk_err */ |
103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ | 103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ |
104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ | 104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ |
105 | SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ | ||
105 | SCTP_CMD_LAST | 106 | SCTP_CMD_LAST |
106 | } sctp_verb_t; | 107 | } sctp_verb_t; |
107 | 108 | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index bb37724495a5..da8354e8e33c 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -64,12 +64,18 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM }; | |||
64 | #define SCTP_CID_MAX SCTP_CID_ASCONF_ACK | 64 | #define SCTP_CID_MAX SCTP_CID_ASCONF_ACK |
65 | 65 | ||
66 | #define SCTP_NUM_BASE_CHUNK_TYPES (SCTP_CID_BASE_MAX + 1) | 66 | #define SCTP_NUM_BASE_CHUNK_TYPES (SCTP_CID_BASE_MAX + 1) |
67 | #define SCTP_NUM_CHUNK_TYPES (SCTP_NUM_BASE_CHUNKTYPES + 2) | ||
68 | 67 | ||
69 | #define SCTP_NUM_ADDIP_CHUNK_TYPES 2 | 68 | #define SCTP_NUM_ADDIP_CHUNK_TYPES 2 |
70 | 69 | ||
71 | #define SCTP_NUM_PRSCTP_CHUNK_TYPES 1 | 70 | #define SCTP_NUM_PRSCTP_CHUNK_TYPES 1 |
72 | 71 | ||
72 | #define SCTP_NUM_AUTH_CHUNK_TYPES 1 | ||
73 | |||
74 | #define SCTP_NUM_CHUNK_TYPES (SCTP_NUM_BASE_CHUNK_TYPES + \ | ||
75 | SCTP_NUM_ADDIP_CHUNK_TYPES +\ | ||
76 | SCTP_NUM_PRSCTP_CHUNK_TYPES +\ | ||
77 | SCTP_NUM_AUTH_CHUNK_TYPES) | ||
78 | |||
73 | /* These are the different flavours of event. */ | 79 | /* These are the different flavours of event. */ |
74 | typedef enum { | 80 | typedef enum { |
75 | 81 | ||
@@ -177,7 +183,9 @@ typedef enum { | |||
177 | SCTP_IERROR_NO_DATA, | 183 | SCTP_IERROR_NO_DATA, |
178 | SCTP_IERROR_BAD_STREAM, | 184 | SCTP_IERROR_BAD_STREAM, |
179 | SCTP_IERROR_BAD_PORTS, | 185 | SCTP_IERROR_BAD_PORTS, |
180 | 186 | SCTP_IERROR_AUTH_BAD_HMAC, | |
187 | SCTP_IERROR_AUTH_BAD_KEYID, | ||
188 | SCTP_IERROR_PROTO_VIOLATION, | ||
181 | } sctp_ierror_t; | 189 | } sctp_ierror_t; |
182 | 190 | ||
183 | 191 | ||
@@ -409,4 +417,45 @@ typedef enum { | |||
409 | SCTP_LOWER_CWND_INACTIVE, | 417 | SCTP_LOWER_CWND_INACTIVE, |
410 | } sctp_lower_cwnd_t; | 418 | } sctp_lower_cwnd_t; |
411 | 419 | ||
420 | |||
421 | /* SCTP-AUTH Necessary constants */ | ||
422 | |||
423 | /* SCTP-AUTH, Section 3.3 | ||
424 | * | ||
425 | * The following Table 2 shows the currently defined values for HMAC | ||
426 | * identifiers. | ||
427 | * | ||
428 | * +-----------------+--------------------------+ | ||
429 | * | HMAC Identifier | Message Digest Algorithm | | ||
430 | * +-----------------+--------------------------+ | ||
431 | * | 0 | Reserved | | ||
432 | * | 1 | SHA-1 defined in [8] | | ||
433 | * | 2 | Reserved | | ||
434 | * | 3 | SHA-256 defined in [8] | | ||
435 | * +-----------------+--------------------------+ | ||
436 | */ | ||
437 | enum { | ||
438 | SCTP_AUTH_HMAC_ID_RESERVED_0, | ||
439 | SCTP_AUTH_HMAC_ID_SHA1, | ||
440 | SCTP_AUTH_HMAC_ID_RESERVED_2, | ||
441 | SCTP_AUTH_HMAC_ID_SHA256 | ||
442 | }; | ||
443 | |||
444 | #define SCTP_AUTH_HMAC_ID_MAX SCTP_AUTH_HMAC_ID_SHA256 | ||
445 | #define SCTP_AUTH_NUM_HMACS (SCTP_AUTH_HMAC_ID_SHA256 + 1) | ||
446 | #define SCTP_SHA1_SIG_SIZE 20 | ||
447 | #define SCTP_SHA256_SIG_SIZE 32 | ||
448 | |||
449 | /* SCTP-AUTH, Section 3.2 | ||
450 | * The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH chunks | ||
451 | * MUST NOT be listed in the CHUNKS parameter | ||
452 | */ | ||
453 | #define SCTP_NUM_NOAUTH_CHUNKS 4 | ||
454 | #define SCTP_AUTH_MAX_CHUNKS (SCTP_NUM_CHUNK_TYPES - SCTP_NUM_NOAUTH_CHUNKS) | ||
455 | |||
456 | /* SCTP-AUTH Section 6.1 | ||
457 | * The RANDOM parameter MUST contain a 32 byte random number. | ||
458 | */ | ||
459 | #define SCTP_AUTH_RANDOM_LENGTH 32 | ||
460 | |||
412 | #endif /* __sctp_constants_h__ */ | 461 | #endif /* __sctp_constants_h__ */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index c9cc00c85782..119f5a1ed499 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -341,6 +341,7 @@ extern atomic_t sctp_dbg_objcnt_bind_bucket; | |||
341 | extern atomic_t sctp_dbg_objcnt_addr; | 341 | extern atomic_t sctp_dbg_objcnt_addr; |
342 | extern atomic_t sctp_dbg_objcnt_ssnmap; | 342 | extern atomic_t sctp_dbg_objcnt_ssnmap; |
343 | extern atomic_t sctp_dbg_objcnt_datamsg; | 343 | extern atomic_t sctp_dbg_objcnt_datamsg; |
344 | extern atomic_t sctp_dbg_objcnt_keys; | ||
344 | 345 | ||
345 | /* Macros to atomically increment/decrement objcnt counters. */ | 346 | /* Macros to atomically increment/decrement objcnt counters. */ |
346 | #define SCTP_DBG_OBJCNT_INC(name) \ | 347 | #define SCTP_DBG_OBJCNT_INC(name) \ |
@@ -469,6 +470,11 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
469 | skb->sk = sk; | 470 | skb->sk = sk; |
470 | skb->destructor = sctp_sock_rfree; | 471 | skb->destructor = sctp_sock_rfree; |
471 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); | 472 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); |
473 | /* | ||
474 | * This mimics the behavior of | ||
475 | * sk_stream_set_owner_r | ||
476 | */ | ||
477 | sk->sk_forward_alloc -= event->rmem_len; | ||
472 | } | 478 | } |
473 | 479 | ||
474 | /* Tests if the list has one and only one entry. */ | 480 | /* Tests if the list has one and only one entry. */ |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index e8e3a64eb322..bf2f5ed69c15 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -143,6 +143,7 @@ sctp_state_fn_t sctp_sf_do_asconf_ack; | |||
143 | sctp_state_fn_t sctp_sf_do_9_2_reshutack; | 143 | sctp_state_fn_t sctp_sf_do_9_2_reshutack; |
144 | sctp_state_fn_t sctp_sf_eat_fwd_tsn; | 144 | sctp_state_fn_t sctp_sf_eat_fwd_tsn; |
145 | sctp_state_fn_t sctp_sf_eat_fwd_tsn_fast; | 145 | sctp_state_fn_t sctp_sf_eat_fwd_tsn_fast; |
146 | sctp_state_fn_t sctp_sf_eat_auth; | ||
146 | 147 | ||
147 | /* Prototypes for primitive event state functions. */ | 148 | /* Prototypes for primitive event state functions. */ |
148 | sctp_state_fn_t sctp_sf_do_prm_asoc; | 149 | sctp_state_fn_t sctp_sf_do_prm_asoc; |
@@ -256,6 +257,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
256 | struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, | 257 | struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, |
257 | __u32 new_cum_tsn, size_t nstreams, | 258 | __u32 new_cum_tsn, size_t nstreams, |
258 | struct sctp_fwdtsn_skip *skiplist); | 259 | struct sctp_fwdtsn_skip *skiplist); |
260 | struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc); | ||
259 | 261 | ||
260 | void sctp_chunk_assign_tsn(struct sctp_chunk *); | 262 | void sctp_chunk_assign_tsn(struct sctp_chunk *); |
261 | void sctp_chunk_assign_ssn(struct sctp_chunk *); | 263 | void sctp_chunk_assign_ssn(struct sctp_chunk *); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index baff49dfcdbd..ef892e00c833 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <linux/skbuff.h> /* We need sk_buff_head. */ | 64 | #include <linux/skbuff.h> /* We need sk_buff_head. */ |
65 | #include <linux/workqueue.h> /* We need tq_struct. */ | 65 | #include <linux/workqueue.h> /* We need tq_struct. */ |
66 | #include <linux/sctp.h> /* We need sctp* header structs. */ | 66 | #include <linux/sctp.h> /* We need sctp* header structs. */ |
67 | #include <net/sctp/auth.h> /* We need auth specific structs */ | ||
67 | 68 | ||
68 | /* A convenience structure for handling sockaddr structures. | 69 | /* A convenience structure for handling sockaddr structures. |
69 | * We should wean ourselves off this. | 70 | * We should wean ourselves off this. |
@@ -196,8 +197,6 @@ extern struct sctp_globals { | |||
196 | 197 | ||
197 | /* This is the sctp port control hash. */ | 198 | /* This is the sctp port control hash. */ |
198 | int port_hashsize; | 199 | int port_hashsize; |
199 | int port_rover; | ||
200 | spinlock_t port_alloc_lock; /* Protects port_rover. */ | ||
201 | struct sctp_bind_hashbucket *port_hashtable; | 200 | struct sctp_bind_hashbucket *port_hashtable; |
202 | 201 | ||
203 | /* This is the global local address list. | 202 | /* This is the global local address list. |
@@ -216,6 +215,9 @@ extern struct sctp_globals { | |||
216 | 215 | ||
217 | /* Flag to indicate if PR-SCTP is enabled. */ | 216 | /* Flag to indicate if PR-SCTP is enabled. */ |
218 | int prsctp_enable; | 217 | int prsctp_enable; |
218 | |||
219 | /* Flag to idicate if SCTP-AUTH is enabled */ | ||
220 | int auth_enable; | ||
219 | } sctp_globals; | 221 | } sctp_globals; |
220 | 222 | ||
221 | #define sctp_rto_initial (sctp_globals.rto_initial) | 223 | #define sctp_rto_initial (sctp_globals.rto_initial) |
@@ -248,6 +250,7 @@ extern struct sctp_globals { | |||
248 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | 250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) |
249 | #define sctp_addip_enable (sctp_globals.addip_enable) | 251 | #define sctp_addip_enable (sctp_globals.addip_enable) |
250 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 252 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
253 | #define sctp_auth_enable (sctp_globals.auth_enable) | ||
251 | 254 | ||
252 | /* SCTP Socket type: UDP or TCP style. */ | 255 | /* SCTP Socket type: UDP or TCP style. */ |
253 | typedef enum { | 256 | typedef enum { |
@@ -397,6 +400,9 @@ struct sctp_cookie { | |||
397 | 400 | ||
398 | __u32 adaptation_ind; | 401 | __u32 adaptation_ind; |
399 | 402 | ||
403 | __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; | ||
404 | __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2]; | ||
405 | __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; | ||
400 | 406 | ||
401 | /* This is a shim for my peer's INIT packet, followed by | 407 | /* This is a shim for my peer's INIT packet, followed by |
402 | * a copy of the raw address list of the association. | 408 | * a copy of the raw address list of the association. |
@@ -440,6 +446,10 @@ union sctp_params { | |||
440 | struct sctp_ipv6addr_param *v6; | 446 | struct sctp_ipv6addr_param *v6; |
441 | union sctp_addr_param *addr; | 447 | union sctp_addr_param *addr; |
442 | struct sctp_adaptation_ind_param *aind; | 448 | struct sctp_adaptation_ind_param *aind; |
449 | struct sctp_supported_ext_param *ext; | ||
450 | struct sctp_random_param *random; | ||
451 | struct sctp_chunks_param *chunks; | ||
452 | struct sctp_hmac_algo_param *hmac_algo; | ||
443 | }; | 453 | }; |
444 | 454 | ||
445 | /* RFC 2960. Section 3.3.5 Heartbeat. | 455 | /* RFC 2960. Section 3.3.5 Heartbeat. |
@@ -678,6 +688,7 @@ struct sctp_chunk { | |||
678 | struct sctp_errhdr *err_hdr; | 688 | struct sctp_errhdr *err_hdr; |
679 | struct sctp_addiphdr *addip_hdr; | 689 | struct sctp_addiphdr *addip_hdr; |
680 | struct sctp_fwdtsn_hdr *fwdtsn_hdr; | 690 | struct sctp_fwdtsn_hdr *fwdtsn_hdr; |
691 | struct sctp_authhdr *auth_hdr; | ||
681 | } subh; | 692 | } subh; |
682 | 693 | ||
683 | __u8 *chunk_end; | 694 | __u8 *chunk_end; |
@@ -711,6 +722,13 @@ struct sctp_chunk { | |||
711 | */ | 722 | */ |
712 | struct sctp_transport *transport; | 723 | struct sctp_transport *transport; |
713 | 724 | ||
725 | /* SCTP-AUTH: For the special case inbound processing of COOKIE-ECHO | ||
726 | * we need save a pointer to the AUTH chunk, since the SCTP-AUTH | ||
727 | * spec violates the principle premis that all chunks are processed | ||
728 | * in order. | ||
729 | */ | ||
730 | struct sk_buff *auth_chunk; | ||
731 | |||
714 | __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ | 732 | __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ |
715 | __u8 resent; /* Has this chunk ever been retransmitted. */ | 733 | __u8 resent; /* Has this chunk ever been retransmitted. */ |
716 | __u8 has_tsn; /* Does this chunk have a TSN yet? */ | 734 | __u8 has_tsn; /* Does this chunk have a TSN yet? */ |
@@ -723,6 +741,7 @@ struct sctp_chunk { | |||
723 | __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ | 741 | __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ |
724 | __u8 tsn_missing_report; /* Data chunk missing counter. */ | 742 | __u8 tsn_missing_report; /* Data chunk missing counter. */ |
725 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ | 743 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ |
744 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ | ||
726 | }; | 745 | }; |
727 | 746 | ||
728 | void sctp_chunk_hold(struct sctp_chunk *); | 747 | void sctp_chunk_hold(struct sctp_chunk *); |
@@ -731,7 +750,6 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, | |||
731 | struct iovec *data); | 750 | struct iovec *data); |
732 | void sctp_chunk_free(struct sctp_chunk *); | 751 | void sctp_chunk_free(struct sctp_chunk *); |
733 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); | 752 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); |
734 | void *sctp_addto_param(struct sctp_chunk *, int len, const void *data); | ||
735 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, | 753 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, |
736 | const struct sctp_association *, | 754 | const struct sctp_association *, |
737 | struct sock *); | 755 | struct sock *); |
@@ -773,16 +791,25 @@ struct sctp_packet { | |||
773 | */ | 791 | */ |
774 | struct sctp_transport *transport; | 792 | struct sctp_transport *transport; |
775 | 793 | ||
794 | /* pointer to the auth chunk for this packet */ | ||
795 | struct sctp_chunk *auth; | ||
796 | |||
776 | /* This packet contains a COOKIE-ECHO chunk. */ | 797 | /* This packet contains a COOKIE-ECHO chunk. */ |
777 | char has_cookie_echo; | 798 | __u8 has_cookie_echo; |
799 | |||
800 | /* This packet contains a SACK chunk. */ | ||
801 | __u8 has_sack; | ||
802 | |||
803 | /* This packet contains an AUTH chunk */ | ||
804 | __u8 has_auth; | ||
778 | 805 | ||
779 | /* This packet containsa SACK chunk. */ | 806 | /* This packet contains at least 1 DATA chunk */ |
780 | char has_sack; | 807 | __u8 has_data; |
781 | 808 | ||
782 | /* SCTP cannot fragment this packet. So let ip fragment it. */ | 809 | /* SCTP cannot fragment this packet. So let ip fragment it. */ |
783 | char ipfragok; | 810 | __u8 ipfragok; |
784 | 811 | ||
785 | int malloced; | 812 | __u8 malloced; |
786 | }; | 813 | }; |
787 | 814 | ||
788 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, | 815 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, |
@@ -1045,6 +1072,7 @@ void sctp_inq_init(struct sctp_inq *); | |||
1045 | void sctp_inq_free(struct sctp_inq *); | 1072 | void sctp_inq_free(struct sctp_inq *); |
1046 | void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); | 1073 | void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); |
1047 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); | 1074 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); |
1075 | struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *); | ||
1048 | void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t); | 1076 | void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t); |
1049 | 1077 | ||
1050 | /* This is the structure we use to hold outbound chunks. You push | 1078 | /* This is the structure we use to hold outbound chunks. You push |
@@ -1291,6 +1319,21 @@ struct sctp_endpoint { | |||
1291 | 1319 | ||
1292 | /* rcvbuf acct. policy. */ | 1320 | /* rcvbuf acct. policy. */ |
1293 | __u32 rcvbuf_policy; | 1321 | __u32 rcvbuf_policy; |
1322 | |||
1323 | /* SCTP AUTH: array of the HMACs that will be allocated | ||
1324 | * we need this per association so that we don't serialize | ||
1325 | */ | ||
1326 | struct crypto_hash **auth_hmacs; | ||
1327 | |||
1328 | /* SCTP-AUTH: hmacs for the endpoint encoded into parameter */ | ||
1329 | struct sctp_hmac_algo_param *auth_hmacs_list; | ||
1330 | |||
1331 | /* SCTP-AUTH: chunks to authenticate encoded into parameter */ | ||
1332 | struct sctp_chunks_param *auth_chunk_list; | ||
1333 | |||
1334 | /* SCTP-AUTH: endpoint shared keys */ | ||
1335 | struct list_head endpoint_shared_keys; | ||
1336 | __u16 active_key_id; | ||
1294 | }; | 1337 | }; |
1295 | 1338 | ||
1296 | /* Recover the outter endpoint structure. */ | 1339 | /* Recover the outter endpoint structure. */ |
@@ -1497,6 +1540,8 @@ struct sctp_association { | |||
1497 | __u8 hostname_address;/* Peer understands DNS addresses? */ | 1540 | __u8 hostname_address;/* Peer understands DNS addresses? */ |
1498 | __u8 asconf_capable; /* Does peer support ADDIP? */ | 1541 | __u8 asconf_capable; /* Does peer support ADDIP? */ |
1499 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ | 1542 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ |
1543 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ | ||
1544 | __u8 addip_capable; /* Can peer do ADD-IP */ | ||
1500 | 1545 | ||
1501 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1546 | __u32 adaptation_ind; /* Adaptation Code point. */ |
1502 | 1547 | ||
@@ -1514,6 +1559,14 @@ struct sctp_association { | |||
1514 | * Initial TSN Value minus 1 | 1559 | * Initial TSN Value minus 1 |
1515 | */ | 1560 | */ |
1516 | __u32 addip_serial; | 1561 | __u32 addip_serial; |
1562 | |||
1563 | /* SCTP-AUTH: We need to know pears random number, hmac list | ||
1564 | * and authenticated chunk list. All that is part of the | ||
1565 | * cookie and these are just pointers to those locations | ||
1566 | */ | ||
1567 | sctp_random_param_t *peer_random; | ||
1568 | sctp_chunks_param_t *peer_chunks; | ||
1569 | sctp_hmac_algo_param_t *peer_hmacs; | ||
1517 | } peer; | 1570 | } peer; |
1518 | 1571 | ||
1519 | /* State : A state variable indicating what state the | 1572 | /* State : A state variable indicating what state the |
@@ -1797,6 +1850,24 @@ struct sctp_association { | |||
1797 | */ | 1850 | */ |
1798 | __u32 addip_serial; | 1851 | __u32 addip_serial; |
1799 | 1852 | ||
1853 | /* SCTP AUTH: list of the endpoint shared keys. These | ||
1854 | * keys are provided out of band by the user applicaton | ||
1855 | * and can't change during the lifetime of the association | ||
1856 | */ | ||
1857 | struct list_head endpoint_shared_keys; | ||
1858 | |||
1859 | /* SCTP AUTH: | ||
1860 | * The current generated assocaition shared key (secret) | ||
1861 | */ | ||
1862 | struct sctp_auth_bytes *asoc_shared_key; | ||
1863 | |||
1864 | /* SCTP AUTH: hmac id of the first peer requested algorithm | ||
1865 | * that we support. | ||
1866 | */ | ||
1867 | __u16 default_hmac_id; | ||
1868 | |||
1869 | __u16 active_key_id; | ||
1870 | |||
1800 | /* Need to send an ECNE Chunk? */ | 1871 | /* Need to send an ECNE Chunk? */ |
1801 | char need_ecne; | 1872 | char need_ecne; |
1802 | 1873 | ||
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index de88ed5b0ba6..922a151eb93c 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -128,6 +128,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, | |||
128 | struct sctp_chunk *chunk, | 128 | struct sctp_chunk *chunk, |
129 | gfp_t gfp); | 129 | gfp_t gfp); |
130 | 130 | ||
131 | struct sctp_ulpevent *sctp_ulpevent_make_authkey( | ||
132 | const struct sctp_association *asoc, __u16 key_id, | ||
133 | __u32 indication, gfp_t gfp); | ||
134 | |||
131 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | 135 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, |
132 | struct msghdr *); | 136 | struct msghdr *); |
133 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); | 137 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 6d2b57758cca..00848b641f59 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -103,6 +103,21 @@ enum sctp_optname { | |||
103 | #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT | 103 | #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT |
104 | SCTP_MAX_BURST, /* Set/Get max burst */ | 104 | SCTP_MAX_BURST, /* Set/Get max burst */ |
105 | #define SCTP_MAX_BURST SCTP_MAX_BURST | 105 | #define SCTP_MAX_BURST SCTP_MAX_BURST |
106 | SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */ | ||
107 | #define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK | ||
108 | SCTP_HMAC_IDENT, | ||
109 | #define SCTP_HMAC_IDENT SCTP_HMAC_IDENT | ||
110 | SCTP_AUTH_KEY, | ||
111 | #define SCTP_AUTH_KEY SCTP_AUTH_KEY | ||
112 | SCTP_AUTH_ACTIVE_KEY, | ||
113 | #define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY | ||
114 | SCTP_AUTH_DELETE_KEY, | ||
115 | #define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY | ||
116 | SCTP_PEER_AUTH_CHUNKS, /* Read only */ | ||
117 | #define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS | ||
118 | SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ | ||
119 | #define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS | ||
120 | |||
106 | 121 | ||
107 | /* Internal Socket Options. Some of the sctp library functions are | 122 | /* Internal Socket Options. Some of the sctp library functions are |
108 | * implemented using these socket options. | 123 | * implemented using these socket options. |
@@ -370,6 +385,19 @@ struct sctp_pdapi_event { | |||
370 | 385 | ||
371 | enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; | 386 | enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; |
372 | 387 | ||
388 | struct sctp_authkey_event { | ||
389 | __u16 auth_type; | ||
390 | __u16 auth_flags; | ||
391 | __u32 auth_length; | ||
392 | __u16 auth_keynumber; | ||
393 | __u16 auth_altkeynumber; | ||
394 | __u32 auth_indication; | ||
395 | sctp_assoc_t auth_assoc_id; | ||
396 | }; | ||
397 | |||
398 | enum { SCTP_AUTH_NEWKEY = 0, }; | ||
399 | |||
400 | |||
373 | /* | 401 | /* |
374 | * Described in Section 7.3 | 402 | * Described in Section 7.3 |
375 | * Ancillary Data and Notification Interest Options | 403 | * Ancillary Data and Notification Interest Options |
@@ -405,6 +433,7 @@ union sctp_notification { | |||
405 | struct sctp_shutdown_event sn_shutdown_event; | 433 | struct sctp_shutdown_event sn_shutdown_event; |
406 | struct sctp_adaptation_event sn_adaptation_event; | 434 | struct sctp_adaptation_event sn_adaptation_event; |
407 | struct sctp_pdapi_event sn_pdapi_event; | 435 | struct sctp_pdapi_event sn_pdapi_event; |
436 | struct sctp_authkey_event sn_authkey_event; | ||
408 | }; | 437 | }; |
409 | 438 | ||
410 | /* Section 5.3.1 | 439 | /* Section 5.3.1 |
@@ -421,6 +450,7 @@ enum sctp_sn_type { | |||
421 | SCTP_SHUTDOWN_EVENT, | 450 | SCTP_SHUTDOWN_EVENT, |
422 | SCTP_PARTIAL_DELIVERY_EVENT, | 451 | SCTP_PARTIAL_DELIVERY_EVENT, |
423 | SCTP_ADAPTATION_INDICATION, | 452 | SCTP_ADAPTATION_INDICATION, |
453 | SCTP_AUTHENTICATION_EVENT, | ||
424 | }; | 454 | }; |
425 | 455 | ||
426 | /* Notification error codes used to fill up the error fields in some | 456 | /* Notification error codes used to fill up the error fields in some |
@@ -539,6 +569,54 @@ struct sctp_paddrparams { | |||
539 | __u32 spp_flags; | 569 | __u32 spp_flags; |
540 | } __attribute__((packed, aligned(4))); | 570 | } __attribute__((packed, aligned(4))); |
541 | 571 | ||
572 | /* | ||
573 | * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) | ||
574 | * | ||
575 | * This set option adds a chunk type that the user is requesting to be | ||
576 | * received only in an authenticated way. Changes to the list of chunks | ||
577 | * will only effect future associations on the socket. | ||
578 | */ | ||
579 | struct sctp_authchunk { | ||
580 | __u8 sauth_chunk; | ||
581 | }; | ||
582 | |||
583 | /* | ||
584 | * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) | ||
585 | * | ||
586 | * This option gets or sets the list of HMAC algorithms that the local | ||
587 | * endpoint requires the peer to use. | ||
588 | */ | ||
589 | struct sctp_hmacalgo { | ||
590 | __u16 shmac_num_idents; | ||
591 | __u16 shmac_idents[]; | ||
592 | }; | ||
593 | |||
594 | /* | ||
595 | * 7.1.20. Set a shared key (SCTP_AUTH_KEY) | ||
596 | * | ||
597 | * This option will set a shared secret key which is used to build an | ||
598 | * association shared key. | ||
599 | */ | ||
600 | struct sctp_authkey { | ||
601 | sctp_assoc_t sca_assoc_id; | ||
602 | __u16 sca_keynumber; | ||
603 | __u16 sca_keylen; | ||
604 | __u8 sca_key[]; | ||
605 | }; | ||
606 | |||
607 | /* | ||
608 | * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) | ||
609 | * | ||
610 | * This option will get or set the active shared key to be used to build | ||
611 | * the association shared key. | ||
612 | */ | ||
613 | |||
614 | struct sctp_authkeyid { | ||
615 | sctp_assoc_t scact_assoc_id; | ||
616 | __u16 scact_keynumber; | ||
617 | }; | ||
618 | |||
619 | |||
542 | /* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) | 620 | /* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) |
543 | * | 621 | * |
544 | * This options will get or set the delayed ack timer. The time is set | 622 | * This options will get or set the delayed ack timer. The time is set |
@@ -608,6 +686,18 @@ struct sctp_status { | |||
608 | }; | 686 | }; |
609 | 687 | ||
610 | /* | 688 | /* |
689 | * 7.2.3. Get the list of chunks the peer requires to be authenticated | ||
690 | * (SCTP_PEER_AUTH_CHUNKS) | ||
691 | * | ||
692 | * This option gets a list of chunks for a specified association that | ||
693 | * the peer requires to be received authenticated only. | ||
694 | */ | ||
695 | struct sctp_authchunks { | ||
696 | sctp_assoc_t gauth_assoc_id; | ||
697 | uint8_t gauth_chunks[]; | ||
698 | }; | ||
699 | |||
700 | /* | ||
611 | * 8.3, 8.5 get all peer/local addresses in an association. | 701 | * 8.3, 8.5 get all peer/local addresses in an association. |
612 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and | 702 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and |
613 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement | 703 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 464970e39ec0..ea206bff0dc4 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -82,12 +82,23 @@ struct icmp_mib { | |||
82 | unsigned long mibs[ICMP_MIB_MAX]; | 82 | unsigned long mibs[ICMP_MIB_MAX]; |
83 | } __SNMP_MIB_ALIGN__; | 83 | } __SNMP_MIB_ALIGN__; |
84 | 84 | ||
85 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX | ||
86 | struct icmpmsg_mib { | ||
87 | unsigned long mibs[ICMPMSG_MIB_MAX]; | ||
88 | } __SNMP_MIB_ALIGN__; | ||
89 | |||
85 | /* ICMP6 (IPv6-ICMP) */ | 90 | /* ICMP6 (IPv6-ICMP) */ |
86 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX | 91 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX |
87 | struct icmpv6_mib { | 92 | struct icmpv6_mib { |
88 | unsigned long mibs[ICMP6_MIB_MAX]; | 93 | unsigned long mibs[ICMP6_MIB_MAX]; |
89 | } __SNMP_MIB_ALIGN__; | 94 | } __SNMP_MIB_ALIGN__; |
90 | 95 | ||
96 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX | ||
97 | struct icmpv6msg_mib { | ||
98 | unsigned long mibs[ICMP6MSG_MIB_MAX]; | ||
99 | } __SNMP_MIB_ALIGN__; | ||
100 | |||
101 | |||
91 | /* TCP */ | 102 | /* TCP */ |
92 | #define TCP_MIB_MAX __TCP_MIB_MAX | 103 | #define TCP_MIB_MAX __TCP_MIB_MAX |
93 | struct tcp_mib { | 104 | struct tcp_mib { |
diff --git a/include/net/sock.h b/include/net/sock.h index dfeb8b13024f..453c79d0915b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef _SOCK_H | 40 | #ifndef _SOCK_H |
41 | #define _SOCK_H | 41 | #define _SOCK_H |
42 | 42 | ||
43 | #include <linux/kernel.h> | ||
43 | #include <linux/list.h> | 44 | #include <linux/list.h> |
44 | #include <linux/timer.h> | 45 | #include <linux/timer.h> |
45 | #include <linux/cache.h> | 46 | #include <linux/cache.h> |
@@ -55,6 +56,7 @@ | |||
55 | #include <asm/atomic.h> | 56 | #include <asm/atomic.h> |
56 | #include <net/dst.h> | 57 | #include <net/dst.h> |
57 | #include <net/checksum.h> | 58 | #include <net/checksum.h> |
59 | #include <net/net_namespace.h> | ||
58 | 60 | ||
59 | /* | 61 | /* |
60 | * This structure really needs to be cleaned up. | 62 | * This structure really needs to be cleaned up. |
@@ -75,10 +77,9 @@ | |||
75 | * between user contexts and software interrupt processing, whereas the | 77 | * between user contexts and software interrupt processing, whereas the |
76 | * mini-semaphore synchronizes multiple users amongst themselves. | 78 | * mini-semaphore synchronizes multiple users amongst themselves. |
77 | */ | 79 | */ |
78 | struct sock_iocb; | ||
79 | typedef struct { | 80 | typedef struct { |
80 | spinlock_t slock; | 81 | spinlock_t slock; |
81 | struct sock_iocb *owner; | 82 | int owned; |
82 | wait_queue_head_t wq; | 83 | wait_queue_head_t wq; |
83 | /* | 84 | /* |
84 | * We express the mutex-alike socket_lock semantics | 85 | * We express the mutex-alike socket_lock semantics |
@@ -105,6 +106,7 @@ struct proto; | |||
105 | * @skc_refcnt: reference count | 106 | * @skc_refcnt: reference count |
106 | * @skc_hash: hash value used with various protocol lookup tables | 107 | * @skc_hash: hash value used with various protocol lookup tables |
107 | * @skc_prot: protocol handlers inside a network family | 108 | * @skc_prot: protocol handlers inside a network family |
109 | * @skc_net: reference to the network namespace of this socket | ||
108 | * | 110 | * |
109 | * This is the minimal network layer representation of sockets, the header | 111 | * This is the minimal network layer representation of sockets, the header |
110 | * for struct sock and struct inet_timewait_sock. | 112 | * for struct sock and struct inet_timewait_sock. |
@@ -119,6 +121,7 @@ struct sock_common { | |||
119 | atomic_t skc_refcnt; | 121 | atomic_t skc_refcnt; |
120 | unsigned int skc_hash; | 122 | unsigned int skc_hash; |
121 | struct proto *skc_prot; | 123 | struct proto *skc_prot; |
124 | struct net *skc_net; | ||
122 | }; | 125 | }; |
123 | 126 | ||
124 | /** | 127 | /** |
@@ -195,6 +198,7 @@ struct sock { | |||
195 | #define sk_refcnt __sk_common.skc_refcnt | 198 | #define sk_refcnt __sk_common.skc_refcnt |
196 | #define sk_hash __sk_common.skc_hash | 199 | #define sk_hash __sk_common.skc_hash |
197 | #define sk_prot __sk_common.skc_prot | 200 | #define sk_prot __sk_common.skc_prot |
201 | #define sk_net __sk_common.skc_net | ||
198 | unsigned char sk_shutdown : 2, | 202 | unsigned char sk_shutdown : 2, |
199 | sk_no_check : 2, | 203 | sk_no_check : 2, |
200 | sk_userlocks : 4; | 204 | sk_userlocks : 4; |
@@ -481,17 +485,17 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) | |||
481 | skb->next = NULL; | 485 | skb->next = NULL; |
482 | } | 486 | } |
483 | 487 | ||
484 | #define sk_wait_event(__sk, __timeo, __condition) \ | 488 | #define sk_wait_event(__sk, __timeo, __condition) \ |
485 | ({ int rc; \ | 489 | ({ int __rc; \ |
486 | release_sock(__sk); \ | 490 | release_sock(__sk); \ |
487 | rc = __condition; \ | 491 | __rc = __condition; \ |
488 | if (!rc) { \ | 492 | if (!__rc) { \ |
489 | *(__timeo) = schedule_timeout(*(__timeo)); \ | 493 | *(__timeo) = schedule_timeout(*(__timeo)); \ |
490 | } \ | 494 | } \ |
491 | lock_sock(__sk); \ | 495 | lock_sock(__sk); \ |
492 | rc = __condition; \ | 496 | __rc = __condition; \ |
493 | rc; \ | 497 | __rc; \ |
494 | }) | 498 | }) |
495 | 499 | ||
496 | extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); | 500 | extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); |
497 | extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); | 501 | extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); |
@@ -702,7 +706,7 @@ extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind); | |||
702 | 706 | ||
703 | static inline int sk_stream_pages(int amt) | 707 | static inline int sk_stream_pages(int amt) |
704 | { | 708 | { |
705 | return (amt + SK_STREAM_MEM_QUANTUM - 1) / SK_STREAM_MEM_QUANTUM; | 709 | return DIV_ROUND_UP(amt, SK_STREAM_MEM_QUANTUM); |
706 | } | 710 | } |
707 | 711 | ||
708 | static inline void sk_stream_mem_reclaim(struct sock *sk) | 712 | static inline void sk_stream_mem_reclaim(struct sock *sk) |
@@ -736,7 +740,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | |||
736 | * Since ~2.3.5 it is also exclusive sleep lock serializing | 740 | * Since ~2.3.5 it is also exclusive sleep lock serializing |
737 | * accesses from user process context. | 741 | * accesses from user process context. |
738 | */ | 742 | */ |
739 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owner) | 743 | #define sock_owned_by_user(sk) ((sk)->sk_lock.owned) |
740 | 744 | ||
741 | /* | 745 | /* |
742 | * Macro so as to not evaluate some arguments when | 746 | * Macro so as to not evaluate some arguments when |
@@ -747,7 +751,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | |||
747 | */ | 751 | */ |
748 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ | 752 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ |
749 | do { \ | 753 | do { \ |
750 | sk->sk_lock.owner = NULL; \ | 754 | sk->sk_lock.owned = 0; \ |
751 | init_waitqueue_head(&sk->sk_lock.wq); \ | 755 | init_waitqueue_head(&sk->sk_lock.wq); \ |
752 | spin_lock_init(&(sk)->sk_lock.slock); \ | 756 | spin_lock_init(&(sk)->sk_lock.slock); \ |
753 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ | 757 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ |
@@ -773,7 +777,7 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
773 | SINGLE_DEPTH_NESTING) | 777 | SINGLE_DEPTH_NESTING) |
774 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 778 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
775 | 779 | ||
776 | extern struct sock *sk_alloc(int family, | 780 | extern struct sock *sk_alloc(struct net *net, int family, |
777 | gfp_t priority, | 781 | gfp_t priority, |
778 | struct proto *prot, int zero_it); | 782 | struct proto *prot, int zero_it); |
779 | extern void sk_free(struct sock *sk); | 783 | extern void sk_free(struct sock *sk); |
@@ -1002,6 +1006,7 @@ static inline void sock_copy(struct sock *nsk, const struct sock *osk) | |||
1002 | #endif | 1006 | #endif |
1003 | 1007 | ||
1004 | memcpy(nsk, osk, osk->sk_prot->obj_size); | 1008 | memcpy(nsk, osk, osk->sk_prot->obj_size); |
1009 | get_net(nsk->sk_net); | ||
1005 | #ifdef CONFIG_SECURITY_NETWORK | 1010 | #ifdef CONFIG_SECURITY_NETWORK |
1006 | nsk->sk_security = sptr; | 1011 | nsk->sk_security = sptr; |
1007 | security_sk_clone(osk, nsk); | 1012 | security_sk_clone(osk, nsk); |
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h new file mode 100644 index 000000000000..4a691f34d703 --- /dev/null +++ b/include/net/tc_act/tc_nat.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __NET_TC_NAT_H | ||
2 | #define __NET_TC_NAT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <net/act_api.h> | ||
6 | |||
7 | struct tcf_nat { | ||
8 | struct tcf_common common; | ||
9 | |||
10 | __be32 old_addr; | ||
11 | __be32 new_addr; | ||
12 | __be32 mask; | ||
13 | u32 flags; | ||
14 | }; | ||
15 | |||
16 | static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc) | ||
17 | { | ||
18 | return container_of(pc, struct tcf_nat, common); | ||
19 | } | ||
20 | |||
21 | #endif /* __NET_TC_NAT_H */ | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index 54053de0bdd7..92049e681258 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <net/snmp.h> | 39 | #include <net/snmp.h> |
40 | #include <net/ip.h> | 40 | #include <net/ip.h> |
41 | #include <net/tcp_states.h> | 41 | #include <net/tcp_states.h> |
42 | #include <net/inet_ecn.h> | ||
42 | 43 | ||
43 | #include <linux/seq_file.h> | 44 | #include <linux/seq_file.h> |
44 | 45 | ||
@@ -330,6 +331,17 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) | |||
330 | rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale = 0; | 331 | rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale = 0; |
331 | } | 332 | } |
332 | 333 | ||
334 | #define TCP_ECN_OK 1 | ||
335 | #define TCP_ECN_QUEUE_CWR 2 | ||
336 | #define TCP_ECN_DEMAND_CWR 4 | ||
337 | |||
338 | static __inline__ void | ||
339 | TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th) | ||
340 | { | ||
341 | if (sysctl_tcp_ecn && th->ece && th->cwr) | ||
342 | inet_rsk(req)->ecn_ok = 1; | ||
343 | } | ||
344 | |||
333 | enum tcp_tw_status | 345 | enum tcp_tw_status |
334 | { | 346 | { |
335 | TCP_TW_SUCCESS = 0, | 347 | TCP_TW_SUCCESS = 0, |
@@ -573,8 +585,6 @@ struct tcp_skb_cb { | |||
573 | 585 | ||
574 | #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) | 586 | #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) |
575 | 587 | ||
576 | #include <net/tcp_ecn.h> | ||
577 | |||
578 | /* Due to TSO, an SKB can be composed of multiple actual | 588 | /* Due to TSO, an SKB can be composed of multiple actual |
579 | * packets. To keep these tracked properly, we use this. | 589 | * packets. To keep these tracked properly, we use this. |
580 | */ | 590 | */ |
@@ -589,32 +599,19 @@ static inline int tcp_skb_mss(const struct sk_buff *skb) | |||
589 | return skb_shinfo(skb)->gso_size; | 599 | return skb_shinfo(skb)->gso_size; |
590 | } | 600 | } |
591 | 601 | ||
592 | static inline void tcp_dec_pcount_approx(__u32 *count, | 602 | static inline void tcp_dec_pcount_approx_int(__u32 *count, const int decr) |
593 | const struct sk_buff *skb) | ||
594 | { | 603 | { |
595 | if (*count) { | 604 | if (*count) { |
596 | *count -= tcp_skb_pcount(skb); | 605 | *count -= decr; |
597 | if ((int)*count < 0) | 606 | if ((int)*count < 0) |
598 | *count = 0; | 607 | *count = 0; |
599 | } | 608 | } |
600 | } | 609 | } |
601 | 610 | ||
602 | static inline void tcp_packets_out_inc(struct sock *sk, | 611 | static inline void tcp_dec_pcount_approx(__u32 *count, |
603 | const struct sk_buff *skb) | 612 | const struct sk_buff *skb) |
604 | { | ||
605 | struct tcp_sock *tp = tcp_sk(sk); | ||
606 | int orig = tp->packets_out; | ||
607 | |||
608 | tp->packets_out += tcp_skb_pcount(skb); | ||
609 | if (!orig) | ||
610 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | ||
611 | inet_csk(sk)->icsk_rto, TCP_RTO_MAX); | ||
612 | } | ||
613 | |||
614 | static inline void tcp_packets_out_dec(struct tcp_sock *tp, | ||
615 | const struct sk_buff *skb) | ||
616 | { | 613 | { |
617 | tp->packets_out -= tcp_skb_pcount(skb); | 614 | tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb)); |
618 | } | 615 | } |
619 | 616 | ||
620 | /* Events passed to congestion control interface */ | 617 | /* Events passed to congestion control interface */ |
@@ -704,6 +701,39 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event) | |||
704 | icsk->icsk_ca_ops->cwnd_event(sk, event); | 701 | icsk->icsk_ca_ops->cwnd_event(sk, event); |
705 | } | 702 | } |
706 | 703 | ||
704 | /* These functions determine how the current flow behaves in respect of SACK | ||
705 | * handling. SACK is negotiated with the peer, and therefore it can vary | ||
706 | * between different flows. | ||
707 | * | ||
708 | * tcp_is_sack - SACK enabled | ||
709 | * tcp_is_reno - No SACK | ||
710 | * tcp_is_fack - FACK enabled, implies SACK enabled | ||
711 | */ | ||
712 | static inline int tcp_is_sack(const struct tcp_sock *tp) | ||
713 | { | ||
714 | return tp->rx_opt.sack_ok; | ||
715 | } | ||
716 | |||
717 | static inline int tcp_is_reno(const struct tcp_sock *tp) | ||
718 | { | ||
719 | return !tcp_is_sack(tp); | ||
720 | } | ||
721 | |||
722 | static inline int tcp_is_fack(const struct tcp_sock *tp) | ||
723 | { | ||
724 | return tp->rx_opt.sack_ok & 2; | ||
725 | } | ||
726 | |||
727 | static inline void tcp_enable_fack(struct tcp_sock *tp) | ||
728 | { | ||
729 | tp->rx_opt.sack_ok |= 2; | ||
730 | } | ||
731 | |||
732 | static inline unsigned int tcp_left_out(const struct tcp_sock *tp) | ||
733 | { | ||
734 | return tp->sacked_out + tp->lost_out; | ||
735 | } | ||
736 | |||
707 | /* This determines how many packets are "in the network" to the best | 737 | /* This determines how many packets are "in the network" to the best |
708 | * of our knowledge. In many cases it is conservative, but where | 738 | * of our knowledge. In many cases it is conservative, but where |
709 | * detailed information is available from the receiver (via SACK | 739 | * detailed information is available from the receiver (via SACK |
@@ -720,7 +750,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event) | |||
720 | */ | 750 | */ |
721 | static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) | 751 | static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) |
722 | { | 752 | { |
723 | return (tp->packets_out - tp->left_out + tp->retrans_out); | 753 | return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; |
724 | } | 754 | } |
725 | 755 | ||
726 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. | 756 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. |
@@ -738,12 +768,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
738 | (tp->snd_cwnd >> 2))); | 768 | (tp->snd_cwnd >> 2))); |
739 | } | 769 | } |
740 | 770 | ||
741 | static inline void tcp_sync_left_out(struct tcp_sock *tp) | 771 | /* Use define here intentionally to get WARN_ON location shown at the caller */ |
742 | { | 772 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) |
743 | BUG_ON(tp->rx_opt.sack_ok && | ||
744 | (tp->sacked_out + tp->lost_out > tp->packets_out)); | ||
745 | tp->left_out = tp->sacked_out + tp->lost_out; | ||
746 | } | ||
747 | 773 | ||
748 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 774 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
749 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 775 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
@@ -1040,12 +1066,18 @@ static inline void tcp_mib_init(void) | |||
1040 | TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); | 1066 | TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); |
1041 | } | 1067 | } |
1042 | 1068 | ||
1043 | /*from STCP */ | 1069 | /* from STCP */ |
1044 | static inline void clear_all_retrans_hints(struct tcp_sock *tp){ | 1070 | static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) |
1071 | { | ||
1045 | tp->lost_skb_hint = NULL; | 1072 | tp->lost_skb_hint = NULL; |
1046 | tp->scoreboard_skb_hint = NULL; | 1073 | tp->scoreboard_skb_hint = NULL; |
1047 | tp->retransmit_skb_hint = NULL; | 1074 | tp->retransmit_skb_hint = NULL; |
1048 | tp->forward_skb_hint = NULL; | 1075 | tp->forward_skb_hint = NULL; |
1076 | } | ||
1077 | |||
1078 | static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) | ||
1079 | { | ||
1080 | tcp_clear_retrans_hints_partial(tp); | ||
1049 | tp->fastpath_skb_hint = NULL; | 1081 | tp->fastpath_skb_hint = NULL; |
1050 | } | 1082 | } |
1051 | 1083 | ||
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h deleted file mode 100644 index 89eb3e05116d..000000000000 --- a/include/net/tcp_ecn.h +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | #ifndef _NET_TCP_ECN_H_ | ||
2 | #define _NET_TCP_ECN_H_ 1 | ||
3 | |||
4 | #include <net/inet_ecn.h> | ||
5 | #include <net/request_sock.h> | ||
6 | |||
7 | #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) | ||
8 | |||
9 | #define TCP_ECN_OK 1 | ||
10 | #define TCP_ECN_QUEUE_CWR 2 | ||
11 | #define TCP_ECN_DEMAND_CWR 4 | ||
12 | |||
13 | static inline void TCP_ECN_queue_cwr(struct tcp_sock *tp) | ||
14 | { | ||
15 | if (tp->ecn_flags&TCP_ECN_OK) | ||
16 | tp->ecn_flags |= TCP_ECN_QUEUE_CWR; | ||
17 | } | ||
18 | |||
19 | |||
20 | /* Output functions */ | ||
21 | |||
22 | static inline void TCP_ECN_send_synack(struct tcp_sock *tp, | ||
23 | struct sk_buff *skb) | ||
24 | { | ||
25 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_CWR; | ||
26 | if (!(tp->ecn_flags&TCP_ECN_OK)) | ||
27 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; | ||
28 | } | ||
29 | |||
30 | static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb) | ||
31 | { | ||
32 | struct tcp_sock *tp = tcp_sk(sk); | ||
33 | |||
34 | tp->ecn_flags = 0; | ||
35 | if (sysctl_tcp_ecn) { | ||
36 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; | ||
37 | tp->ecn_flags = TCP_ECN_OK; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | static __inline__ void | ||
42 | TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th) | ||
43 | { | ||
44 | if (inet_rsk(req)->ecn_ok) | ||
45 | th->ece = 1; | ||
46 | } | ||
47 | |||
48 | static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb, | ||
49 | int tcp_header_len) | ||
50 | { | ||
51 | struct tcp_sock *tp = tcp_sk(sk); | ||
52 | |||
53 | if (tp->ecn_flags & TCP_ECN_OK) { | ||
54 | /* Not-retransmitted data segment: set ECT and inject CWR. */ | ||
55 | if (skb->len != tcp_header_len && | ||
56 | !before(TCP_SKB_CB(skb)->seq, tp->snd_nxt)) { | ||
57 | INET_ECN_xmit(sk); | ||
58 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | ||
59 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | ||
60 | tcp_hdr(skb)->cwr = 1; | ||
61 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | ||
62 | } | ||
63 | } else { | ||
64 | /* ACK or retransmitted segment: clear ECT|CE */ | ||
65 | INET_ECN_dontxmit(sk); | ||
66 | } | ||
67 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) | ||
68 | tcp_hdr(skb)->ece = 1; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | /* Input functions */ | ||
73 | |||
74 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) | ||
75 | { | ||
76 | if (tcp_hdr(skb)->cwr) | ||
77 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | ||
78 | } | ||
79 | |||
80 | static inline void TCP_ECN_withdraw_cwr(struct tcp_sock *tp) | ||
81 | { | ||
82 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | ||
83 | } | ||
84 | |||
85 | static inline void TCP_ECN_check_ce(struct tcp_sock *tp, struct sk_buff *skb) | ||
86 | { | ||
87 | if (tp->ecn_flags&TCP_ECN_OK) { | ||
88 | if (INET_ECN_is_ce(TCP_SKB_CB(skb)->flags)) | ||
89 | tp->ecn_flags |= TCP_ECN_DEMAND_CWR; | ||
90 | /* Funny extension: if ECT is not set on a segment, | ||
91 | * it is surely retransmit. It is not in ECN RFC, | ||
92 | * but Linux follows this rule. */ | ||
93 | else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags))) | ||
94 | tcp_enter_quickack_mode((struct sock *)tp); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | static inline void TCP_ECN_rcv_synack(struct tcp_sock *tp, struct tcphdr *th) | ||
99 | { | ||
100 | if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || th->cwr)) | ||
101 | tp->ecn_flags &= ~TCP_ECN_OK; | ||
102 | } | ||
103 | |||
104 | static inline void TCP_ECN_rcv_syn(struct tcp_sock *tp, struct tcphdr *th) | ||
105 | { | ||
106 | if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || !th->cwr)) | ||
107 | tp->ecn_flags &= ~TCP_ECN_OK; | ||
108 | } | ||
109 | |||
110 | static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th) | ||
111 | { | ||
112 | if (th->ece && !th->syn && (tp->ecn_flags&TCP_ECN_OK)) | ||
113 | return 1; | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static inline void TCP_ECN_openreq_child(struct tcp_sock *tp, | ||
118 | struct request_sock *req) | ||
119 | { | ||
120 | tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0; | ||
121 | } | ||
122 | |||
123 | static __inline__ void | ||
124 | TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th) | ||
125 | { | ||
126 | if (sysctl_tcp_ecn && th->ece && th->cwr) | ||
127 | inet_rsk(req)->ecn_ok = 1; | ||
128 | } | ||
129 | |||
130 | #endif | ||
diff --git a/include/net/veth.h b/include/net/veth.h new file mode 100644 index 000000000000..3354c1eb424e --- /dev/null +++ b/include/net/veth.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __NET_VETH_H_ | ||
2 | #define __NET_VETH_H_ | ||
3 | |||
4 | enum { | ||
5 | VETH_INFO_UNSPEC, | ||
6 | VETH_INFO_PEER, | ||
7 | |||
8 | __VETH_INFO_MAX | ||
9 | #define VETH_INFO_MAX (__VETH_INFO_MAX - 1) | ||
10 | }; | ||
11 | |||
12 | #endif | ||
diff --git a/include/net/wext.h b/include/net/wext.h index c02b8decf3af..80b31d826b7a 100644 --- a/include/net/wext.h +++ b/include/net/wext.h | |||
@@ -5,16 +5,23 @@ | |||
5 | * wireless extensions interface to the core code | 5 | * wireless extensions interface to the core code |
6 | */ | 6 | */ |
7 | 7 | ||
8 | struct net; | ||
9 | |||
8 | #ifdef CONFIG_WIRELESS_EXT | 10 | #ifdef CONFIG_WIRELESS_EXT |
9 | extern int wext_proc_init(void); | 11 | extern int wext_proc_init(struct net *net); |
10 | extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | 12 | extern void wext_proc_exit(struct net *net); |
13 | extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | ||
11 | void __user *arg); | 14 | void __user *arg); |
12 | #else | 15 | #else |
13 | static inline int wext_proc_init(void) | 16 | static inline int wext_proc_init(struct net *net) |
14 | { | 17 | { |
15 | return 0; | 18 | return 0; |
16 | } | 19 | } |
17 | static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | 20 | static inline void wext_proc_exit(struct net *net) |
21 | { | ||
22 | return; | ||
23 | } | ||
24 | static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | ||
18 | void __user *arg) | 25 | void __user *arg) |
19 | { | 26 | { |
20 | return -EINVAL; | 27 | return -EINVAL; |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index a5f80bfbaaa4..77be396ca633 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _NET_XFRM_H | 2 | #define _NET_XFRM_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/in.h> | ||
6 | #include <linux/xfrm.h> | 5 | #include <linux/xfrm.h> |
7 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
8 | #include <linux/list.h> | 7 | #include <linux/list.h> |
@@ -12,9 +11,11 @@ | |||
12 | #include <linux/ipsec.h> | 11 | #include <linux/ipsec.h> |
13 | #include <linux/in6.h> | 12 | #include <linux/in6.h> |
14 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
14 | #include <linux/audit.h> | ||
15 | 15 | ||
16 | #include <net/sock.h> | 16 | #include <net/sock.h> |
17 | #include <net/dst.h> | 17 | #include <net/dst.h> |
18 | #include <net/ip.h> | ||
18 | #include <net/route.h> | 19 | #include <net/route.h> |
19 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
20 | #include <net/ip6_fib.h> | 21 | #include <net/ip6_fib.h> |
@@ -278,6 +279,7 @@ struct xfrm_type | |||
278 | __u8 proto; | 279 | __u8 proto; |
279 | __u8 flags; | 280 | __u8 flags; |
280 | #define XFRM_TYPE_NON_FRAGMENT 1 | 281 | #define XFRM_TYPE_NON_FRAGMENT 1 |
282 | #define XFRM_TYPE_REPLAY_PROT 2 | ||
281 | 283 | ||
282 | int (*init_state)(struct xfrm_state *x); | 284 | int (*init_state)(struct xfrm_state *x); |
283 | void (*destructor)(struct xfrm_state *); | 285 | void (*destructor)(struct xfrm_state *); |
@@ -298,6 +300,18 @@ extern void xfrm_put_type(struct xfrm_type *type); | |||
298 | 300 | ||
299 | struct xfrm_mode { | 301 | struct xfrm_mode { |
300 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | 302 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); |
303 | |||
304 | /* | ||
305 | * Add encapsulation header. | ||
306 | * | ||
307 | * On exit, the transport header will be set to the start of the | ||
308 | * encapsulation header to be filled in by x->type->output and | ||
309 | * the mac header will be set to the nextheader (protocol for | ||
310 | * IPv4) field of the extension header directly preceding the | ||
311 | * encapsulation header, or in its absence, that of the top IP | ||
312 | * header. The value of the network header will always point | ||
313 | * to the top IP header while skb->data will point to the payload. | ||
314 | */ | ||
301 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); | 315 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); |
302 | 316 | ||
303 | struct module *owner; | 317 | struct module *owner; |
@@ -418,18 +432,66 @@ extern int xfrm_unregister_km(struct xfrm_mgr *km); | |||
418 | 432 | ||
419 | extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; | 433 | extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; |
420 | 434 | ||
435 | /* | ||
436 | * This structure is used for the duration where packets are being | ||
437 | * transformed by IPsec. As soon as the packet leaves IPsec the | ||
438 | * area beyond the generic IP part may be overwritten. | ||
439 | */ | ||
440 | struct xfrm_skb_cb { | ||
441 | union { | ||
442 | struct inet_skb_parm h4; | ||
443 | struct inet6_skb_parm h6; | ||
444 | } header; | ||
445 | |||
446 | /* Sequence number for replay protection. */ | ||
447 | u64 seq; | ||
448 | }; | ||
449 | |||
450 | #define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0])) | ||
451 | |||
421 | /* Audit Information */ | 452 | /* Audit Information */ |
422 | struct xfrm_audit | 453 | struct xfrm_audit |
423 | { | 454 | { |
424 | uid_t loginuid; | 455 | u32 loginuid; |
425 | u32 secid; | 456 | u32 secid; |
426 | }; | 457 | }; |
427 | 458 | ||
428 | #ifdef CONFIG_AUDITSYSCALL | 459 | #ifdef CONFIG_AUDITSYSCALL |
429 | extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, | 460 | static inline struct audit_buffer *xfrm_audit_start(u32 auid, u32 sid) |
430 | struct xfrm_policy *xp, struct xfrm_state *x); | 461 | { |
462 | struct audit_buffer *audit_buf = NULL; | ||
463 | char *secctx; | ||
464 | u32 secctx_len; | ||
465 | |||
466 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, | ||
467 | AUDIT_MAC_IPSEC_EVENT); | ||
468 | if (audit_buf == NULL) | ||
469 | return NULL; | ||
470 | |||
471 | audit_log_format(audit_buf, "auid=%u", auid); | ||
472 | |||
473 | if (sid != 0 && | ||
474 | security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) { | ||
475 | audit_log_format(audit_buf, " subj=%s", secctx); | ||
476 | security_release_secctx(secctx, secctx_len); | ||
477 | } else | ||
478 | audit_log_task_context(audit_buf); | ||
479 | return audit_buf; | ||
480 | } | ||
481 | |||
482 | extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | ||
483 | u32 auid, u32 sid); | ||
484 | extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, | ||
485 | u32 auid, u32 sid); | ||
486 | extern void xfrm_audit_state_add(struct xfrm_state *x, int result, | ||
487 | u32 auid, u32 sid); | ||
488 | extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, | ||
489 | u32 auid, u32 sid); | ||
431 | #else | 490 | #else |
432 | #define xfrm_audit_log(a,s,t,r,p,x) do { ; } while (0) | 491 | #define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) |
492 | #define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) | ||
493 | #define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) | ||
494 | #define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) | ||
433 | #endif /* CONFIG_AUDITSYSCALL */ | 495 | #endif /* CONFIG_AUDITSYSCALL */ |
434 | 496 | ||
435 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 497 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
@@ -981,9 +1043,9 @@ extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | |||
981 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 1043 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
982 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 1044 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
983 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 1045 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
984 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); | ||
985 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 1046 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
986 | extern int xfrm_init_state(struct xfrm_state *x); | 1047 | extern int xfrm_init_state(struct xfrm_state *x); |
1048 | extern int xfrm_output(struct sk_buff *skb); | ||
987 | extern int xfrm4_rcv(struct sk_buff *skb); | 1049 | extern int xfrm4_rcv(struct sk_buff *skb); |
988 | extern int xfrm4_output(struct sk_buff *skb); | 1050 | extern int xfrm4_output(struct sk_buff *skb); |
989 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); | 1051 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); |
@@ -1034,7 +1096,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | |||
1034 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); | 1096 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); |
1035 | int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); | 1097 | int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); |
1036 | u32 xfrm_get_acqseq(void); | 1098 | u32 xfrm_get_acqseq(void); |
1037 | void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); | 1099 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
1038 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 1100 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
1039 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1101 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
1040 | int create, unsigned short family); | 1102 | int create, unsigned short family); |
@@ -1113,12 +1175,6 @@ static inline int xfrm_aevent_is_on(void) | |||
1113 | return ret; | 1175 | return ret; |
1114 | } | 1176 | } |
1115 | 1177 | ||
1116 | static inline void xfrm_aevent_doreplay(struct xfrm_state *x) | ||
1117 | { | ||
1118 | if (xfrm_aevent_is_on()) | ||
1119 | xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); | ||
1120 | } | ||
1121 | |||
1122 | #ifdef CONFIG_XFRM_MIGRATE | 1178 | #ifdef CONFIG_XFRM_MIGRATE |
1123 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1179 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
1124 | { | 1180 | { |