aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
commit038a5008b2f395c85e6e71d6ddf3c684e7c405b0 (patch)
tree4735eab577e97e5a22c3141e3f60071c8065585e /include/linux
parentdd6d1844af33acb4edd0a40b1770d091a22c94be (diff)
parent266918303226cceac7eca38ced30f15f277bd89c (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/linux')
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/audit.h9
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/crypto.h214
-rw-r--r--include/linux/dccp.h22
-rw-r--r--include/linux/eeprom_93cx6.h3
-rw-r--r--include/linux/etherdevice.h20
-rw-r--r--include/linux/ethtool.h36
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/ieee80211.h61
-rw-r--r--include/linux/if_arcnet.h2
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/if_eql.h1
-rw-r--r--include/linux/if_ether.h10
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_pppox.h14
-rw-r--r--include/linux/if_shaper.h12
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_vlan.h2
-rw-r--r--include/linux/inet_lro.h177
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/input.h1
-rw-r--r--include/linux/ipv6.h21
-rw-r--r--include/linux/isdn.h9
-rw-r--r--include/linux/ktime.h21
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/mdio-bitbang.h42
-rw-r--r--include/linux/mod_devicetable.h15
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h500
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nfnetlink.h98
-rw-r--r--include/linux/netfilter/nfnetlink_compat.h61
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter/xt_time.h25
-rw-r--r--include/linux/netlink.h24
-rw-r--r--include/linux/netpoll.h56
-rw-r--r--include/linux/nl80211.h97
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/pci_ids.h11
-rw-r--r--include/linux/pci_regs.h13
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/phy_fixed.h38
-rw-r--r--include/linux/pkt_sched.h4
-rw-r--r--include/linux/proc_fs.h41
-rw-r--r--include/linux/rfkill.h40
-rw-r--r--include/linux/rtnetlink.h29
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sctp.h109
-rw-r--r--include/linux/seq_file.h2
-rw-r--r--include/linux/snmp.h33
-rw-r--r--include/linux/ssb/ssb.h424
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h396
-rw-r--r--include/linux/ssb/ssb_driver_extif.h204
-rw-r--r--include/linux/ssb/ssb_driver_mips.h46
-rw-r--r--include/linux/ssb/ssb_driver_pci.h106
-rw-r--r--include/linux/ssb/ssb_regs.h292
-rw-r--r--include/linux/tc_act/tc_nat.h29
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/zlib.h6
61 files changed, 3055 insertions, 374 deletions
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 */
215struct Incoming { 215struct 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 @@
91struct scatterlist; 92struct scatterlist;
92struct crypto_ablkcipher; 93struct crypto_ablkcipher;
93struct crypto_async_request; 94struct crypto_async_request;
95struct crypto_aead;
94struct crypto_blkcipher; 96struct crypto_blkcipher;
95struct crypto_hash; 97struct crypto_hash;
96struct crypto_queue;
97struct crypto_tfm; 98struct crypto_tfm;
98struct crypto_type; 99struct 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 */
136struct 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
124struct blkcipher_desc { 151struct 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
185struct 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
160struct blkcipher_alg { 195struct 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
324struct 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
287struct blkcipher_tfm { 334struct 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
401struct crypto_aead {
402 struct crypto_tfm base;
403};
404
352struct crypto_blkcipher { 405struct 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
377struct crypto_attr_alg { 434struct 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
443struct 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
566static inline int crypto_ablkcipher_reqsize(struct crypto_ablkcipher *tfm) 627static 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
684static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
685{
686 return (struct crypto_aead *)tfm;
687}
688
689static 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
699static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
700{
701 return &tfm->base;
702}
703
704static inline void crypto_free_aead(struct crypto_aead *tfm)
705{
706 crypto_free_tfm(crypto_aead_tfm(tfm));
707}
708
709static inline struct aead_tfm *crypto_aead_crt(struct crypto_aead *tfm)
710{
711 return &crypto_aead_tfm(tfm)->crt_aead;
712}
713
714static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm)
715{
716 return crypto_aead_crt(tfm)->ivsize;
717}
718
719static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm)
720{
721 return crypto_aead_crt(tfm)->authsize;
722}
723
724static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm)
725{
726 return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm));
727}
728
729static inline unsigned int crypto_aead_alignmask(struct crypto_aead *tfm)
730{
731 return crypto_tfm_alg_alignmask(crypto_aead_tfm(tfm));
732}
733
734static inline u32 crypto_aead_get_flags(struct crypto_aead *tfm)
735{
736 return crypto_tfm_get_flags(crypto_aead_tfm(tfm));
737}
738
739static 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
744static 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
749static 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
755static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
756{
757 return __crypto_aead_cast(req->base.tfm);
758}
759
760static inline int crypto_aead_encrypt(struct aead_request *req)
761{
762 return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req);
763}
764
765static inline int crypto_aead_decrypt(struct aead_request *req)
766{
767 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
768}
769
770static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
771{
772 return crypto_aead_crt(tfm)->reqsize;
773}
774
775static 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
781static 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
794static inline void aead_request_free(struct aead_request *req)
795{
796 kfree(req);
797}
798
799static 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
809static 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
820static 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
622static inline struct crypto_blkcipher *__crypto_blkcipher_cast( 828static 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 */
64struct dccp_hdr_request { 63struct 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 */
86struct dccp_hdr_response { 83struct 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 */
97struct dccp_hdr_reset { 95struct 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
394extern void __dccp_minisock_init(struct dccp_minisock *dmsk);
395extern void dccp_minisock_init(struct dccp_minisock *dmsk); 394extern void dccp_minisock_init(struct dccp_minisock *dmsk);
396 395
397extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 396extern 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__
32extern int eth_header(struct sk_buff *skb, struct net_device *dev,
33 unsigned short type, void *daddr,
34 void *saddr, unsigned len);
35extern int eth_rebuild_header(struct sk_buff *skb);
36extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
37extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, 33extern const struct header_ops eth_header_ops;
38 unsigned char * haddr); 34
39extern int eth_header_cache(struct neighbour *neigh, 35extern 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);
38extern int eth_rebuild_header(struct sk_buff *skb);
39extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
40extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev,
43 const unsigned char *haddr);
44
41 45
42extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 46extern 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 {
219enum ethtool_stringset { 220enum 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 */
270enum ethtool_flags {
271 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
272};
273
259#ifdef __KERNEL__ 274#ifdef __KERNEL__
260 275
261struct net_device; 276struct net_device;
@@ -272,6 +287,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
272int ethtool_op_set_tso(struct net_device *dev, u32 data); 287int ethtool_op_set_tso(struct net_device *dev, u32 data);
273u32 ethtool_op_get_ufo(struct net_device *dev); 288u32 ethtool_op_get_ufo(struct net_device *dev);
274int ethtool_op_set_ufo(struct net_device *dev, u32 data); 289int ethtool_op_set_ufo(struct net_device *dev, u32 data);
290u32 ethtool_op_get_flags(struct net_device *dev);
291int ethtool_op_set_flags(struct net_device *dev, u32 data);
275 292
276/** 293/**
277 * &ethtool_ops - Alter and report network device settings 294 * &ethtool_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 */
365static 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 */
390static 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 */
408static 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
107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb); 109 struct sk_buff *skb);
110extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern 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
120int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
121
120#ifdef CONFIG_SYSCTL 122#ifdef CONFIG_SYSCTL
121extern struct ctl_table ether_table[]; 123extern 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"
130extern 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 */
43typedef __u16 sid_t; 43typedef __be16 sid_t;
44struct pppoe_addr{ 44struct 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
92struct pppoe_tag { 92struct 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)
172struct module; 172struct module;
173 173
174struct pppox_proto { 174struct 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 */
65extern void vlan_ioctl_set(int (*hook)(void __user *)); 65extern 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
38struct 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 */
47struct 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
76struct 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
128void 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
136void 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
157void 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
161void 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
172void lro_flush_all(struct net_lro_mgr *lro_mgr);
173
174void 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
99struct 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
108struct 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
114struct 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: */
106static inline ktime_t timespec_to_ktime(struct timespec ts) 113static 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)
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); 207extern 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 */
216extern 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
308static 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
7struct mdiobb_ctrl;
8
9struct 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
32struct mdiobb_ctrl {
33 const struct mdiobb_ops *ops;
34};
35
36/* The returned bus is not yet registered with the phy layer. */
37struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl);
38
39/* The bus must already have been unregistered. */
40void 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/ */
355struct 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
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26struct 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
170struct net_proto_family { 171struct 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
42struct vlan_group; 46struct vlan_group;
43struct ethtool_ops; 47struct 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
253struct 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 {
278extern int __init netdev_boot_setup(char *str); 294extern int __init netdev_boot_setup(char *str);
279 295
280/* 296/*
297 * Structure for NAPI scheduling similar to tasklet but with weighting
298 */
299struct 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
319enum
320{
321 NAPI_STATE_SCHED, /* Poll is scheduled */
322};
323
324extern 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 */
334static 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 */
346static 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(). */
353static 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 */
368static 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
376static 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 */
390static 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 */
403static 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 */
585static inline void *netdev_priv(const struct net_device *dev) 712static 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
722static 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
596struct packet_type { 739struct 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
613extern struct net_device loopback_dev; /* The loopback */
614extern struct list_head dev_base_head; /* All devices */
615extern rwlock_t dev_base_lock; /* Device list lock */ 756extern 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
625static inline struct net_device *next_net_device(struct net_device *dev) 767static 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
633static inline struct net_device *first_net_device(void) 777static 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
639extern int netdev_boot_setup_check(struct net_device *dev); 783extern int netdev_boot_setup_check(struct net_device *dev);
640extern unsigned long netdev_boot_base(const char *prefix, int unit); 784extern unsigned long netdev_boot_base(const char *prefix, int unit);
641extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); 785extern struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr);
642extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 786extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
643extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); 787extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
644extern void dev_add_pack(struct packet_type *pt); 788extern void dev_add_pack(struct packet_type *pt);
645extern void dev_remove_pack(struct packet_type *pt); 789extern void dev_remove_pack(struct packet_type *pt);
646extern void __dev_remove_pack(struct packet_type *pt); 790extern void __dev_remove_pack(struct packet_type *pt);
647 791
648extern struct net_device *dev_get_by_flags(unsigned short flags, 792extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags,
649 unsigned short mask); 793 unsigned short mask);
650extern struct net_device *dev_get_by_name(const char *name); 794extern struct net_device *dev_get_by_name(struct net *net, const char *name);
651extern struct net_device *__dev_get_by_name(const char *name); 795extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
652extern int dev_alloc_name(struct net_device *dev, const char *name); 796extern int dev_alloc_name(struct net_device *dev, const char *name);
653extern int dev_open(struct net_device *dev); 797extern int dev_open(struct net_device *dev);
654extern int dev_close(struct net_device *dev); 798extern int dev_close(struct net_device *dev);
@@ -659,14 +803,35 @@ extern void free_netdev(struct net_device *dev);
659extern void synchronize_net(void); 803extern void synchronize_net(void);
660extern int register_netdevice_notifier(struct notifier_block *nb); 804extern int register_netdevice_notifier(struct notifier_block *nb);
661extern int unregister_netdevice_notifier(struct notifier_block *nb); 805extern int unregister_netdevice_notifier(struct notifier_block *nb);
662extern int call_netdevice_notifiers(unsigned long val, void *v); 806extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
663extern struct net_device *dev_get_by_index(int ifindex); 807extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
664extern struct net_device *__dev_get_by_index(int ifindex); 808extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
665extern int dev_restart(struct net_device *dev); 809extern int dev_restart(struct net_device *dev);
666#ifdef CONFIG_NETPOLL_TRAP 810#ifdef CONFIG_NETPOLL_TRAP
667extern int netpoll_trap(void); 811extern int netpoll_trap(void);
668#endif 812#endif
669 813
814static 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
825static 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
670typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 835typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
671extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); 836extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
672static inline int unregister_gifconf(unsigned int family) 837static 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
682struct softnet_data 846struct 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 */
707static inline void netif_start_queue(struct net_device *dev) 877static 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 */
712static inline void netif_wake_queue(struct net_device *dev) 889static 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 */
724static inline void netif_stop_queue(struct net_device *dev) 908static 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 */
729static inline int netif_queue_stopped(const struct net_device *dev) 919static 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 */
734static inline int netif_running(const struct net_device *dev) 930static 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 */
745static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 949static 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 */
752static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 963static 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 */
763static inline int netif_subqueue_stopped(const struct net_device *dev, 981static 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 */
774static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 1000static 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 */
787static inline int netif_is_multiqueue(const struct net_device *dev) 1020static 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 */
799static inline void dev_kfree_skb_irq(struct sk_buff *skb) 1032extern 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
823extern int netif_receive_skb(struct sk_buff *skb); 1043extern int netif_receive_skb(struct sk_buff *skb);
824extern int dev_valid_name(const char *name); 1044extern int dev_valid_name(const char *name);
825extern int dev_ioctl(unsigned int cmd, void __user *); 1045extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
826extern int dev_ethtool(struct ifreq *); 1046extern int dev_ethtool(struct net *net, struct ifreq *);
827extern unsigned dev_get_flags(const struct net_device *); 1047extern unsigned dev_get_flags(const struct net_device *);
828extern int dev_change_flags(struct net_device *, unsigned); 1048extern int dev_change_flags(struct net_device *, unsigned);
829extern int dev_change_name(struct net_device *, char *); 1049extern int dev_change_name(struct net_device *, char *);
1050extern int dev_change_net_namespace(struct net_device *,
1051 struct net *, const char *);
830extern int dev_set_mtu(struct net_device *, int); 1052extern int dev_set_mtu(struct net_device *, int);
831extern int dev_set_mac_address(struct net_device *, 1053extern int dev_set_mac_address(struct net_device *,
832 struct sockaddr *); 1054 struct sockaddr *);
833extern int dev_hard_start_xmit(struct sk_buff *skb, 1055extern int dev_hard_start_xmit(struct sk_buff *skb,
834 struct net_device *dev); 1056 struct net_device *dev);
835 1057
836extern void dev_init(void);
837
838extern int netdev_budget; 1058extern int netdev_budget;
839 1059
840/* Called by rtnetlink.c:rtnl_unlock() */ 1060/* Called by rtnetlink.c:rtnl_unlock() */
841extern void netdev_run_todo(void); 1061extern 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 */
843static inline void dev_put(struct net_device *dev) 1069static 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 */
848static inline void dev_hold(struct net_device *dev) 1080static 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
862extern void linkwatch_fire_event(struct net_device *dev); 1094extern 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 */
864static inline int netif_carrier_ok(const struct net_device *dev) 1102static 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
873extern void netif_carrier_off(struct net_device *dev); 1111extern 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 */
875static inline void netif_dormant_on(struct net_device *dev) 1126static 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 */
881static inline void netif_dormant_off(struct net_device *dev) 1138static 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 */
887static inline int netif_dormant(const struct net_device *dev) 1150static 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 */
893static inline int netif_oper_up(const struct net_device *dev) { 1162static 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 */
899static inline int netif_device_present(struct net_device *dev) 1173static 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 */
959static 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 */
965static inline int netif_rx_schedule_prep(struct net_device *dev) 1233static 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 1242static inline void __netif_rx_schedule(struct net_device *dev,
974extern 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
978static inline void netif_rx_schedule(struct net_device *dev) 1251static 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? 1259static inline int netif_rx_reschedule(struct net_device *dev,
986 */ 1260 struct napi_struct *napi)
987static 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 */
1006static inline void __netif_rx_complete(struct net_device *dev) 1272static 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 */
1019static inline void netif_rx_complete(struct net_device *dev) 1284static 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
1028static 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 1300static inline void __netif_tx_lock(struct net_device *dev, int cpu)
1035static 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
1041static inline void netif_tx_lock(struct net_device *dev) 1306static 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
1047static inline void netif_tx_lock_bh(struct net_device *dev) 1311static 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
1073static inline void netif_tx_disable(struct net_device *dev) 1349static 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);
1105extern void netdev_state_change(struct net_device *dev); 1381extern void netdev_state_change(struct net_device *dev);
1106extern void netdev_features_change(struct net_device *dev); 1382extern void netdev_features_change(struct net_device *dev);
1107/* Load a device via the kmod */ 1383/* Load a device via the kmod */
1108extern void dev_load(const char *name); 1384extern void dev_load(struct net *net, const char *name);
1109extern void dev_mcast_init(void); 1385extern void dev_mcast_init(void);
1110extern int netdev_max_backlog; 1386extern int netdev_max_backlog;
1111extern int weight_p; 1387extern 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
40unifdef-y += nf_conntrack_ftp.h 40unifdef-y += nf_conntrack_ftp.h
41unifdef-y += nf_conntrack_tcp.h 41unifdef-y += nf_conntrack_tcp.h
42unifdef-y += nfnetlink.h 42unifdef-y += nfnetlink.h
43unifdef-y += nfnetlink_compat.h
43unifdef-y += x_tables.h 44unifdef-y += x_tables.h
44unifdef-y += xt_physdev.h 45unifdef-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
15enum nfnetlink_groups { 6enum 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
41struct 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 */
78struct nfgenmsg { 27struct 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
111struct nfnl_callback 57struct 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
118struct nfnetlink_subsystem 65struct 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
126extern void __nfa_fill(struct sk_buff *skb, int attrtype, 73extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
127 int attrlen, const void *data); 74extern 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
132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
134
135extern 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
154extern int nfnetlink_has_listeners(unsigned int group); 76extern int nfnetlink_has_listeners(unsigned int group);
155extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 77extern 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
21struct 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
4struct 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
14enum {
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
30struct net;
31
30struct sockaddr_nl 32struct 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
160extern struct sock *netlink_kernel_create(int unit, unsigned int groups, 176extern 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);
164extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
@@ -177,7 +194,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp);
177int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
178 long timeo, struct sock *ssk); 195 long timeo, struct sock *ssk);
179void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 196void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
180int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); 197int 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
207struct netlink_notify 224struct 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
26struct netpoll_info { 26struct 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
38void netpoll_poll(struct netpoll *np); 36void netpoll_poll(struct netpoll *np);
39void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 37void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
38void netpoll_print_options(struct netpoll *np);
40int netpoll_parse_options(struct netpoll *np, char *opt); 39int netpoll_parse_options(struct netpoll *np, char *opt);
41int netpoll_setup(struct netpoll *np); 40int netpoll_setup(struct netpoll *np);
42int netpoll_trap(void); 41int 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
67static inline void *netpoll_poll_lock(struct net_device *dev) 66static 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
73static 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
78static inline void netpoll_poll_unlock(void *have) 86static 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
97static 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 103static 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}
107static inline int netpoll_receive_skb(struct sk_buff *skb)
108{
109 return 0;
110}
111static inline void *netpoll_poll_lock(struct napi_struct *napi)
112{
113 return NULL;
114}
115static inline void netpoll_poll_unlock(void *have)
116{
117}
118static 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 */
43enum 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 */
81enum 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};
33extern struct nsproxy init_nsproxy; 34extern 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
14struct fixed_phy_status {
15 u8 link;
16 u16 speed;
17 u8 duplex;
18};
19
20/*-----------------------------------------------------------------------------
21 * Private information hoder for mii_bus
22 *-----------------------------------------------------------------------------*/
23struct 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
34int fixed_mdio_set_link_update(struct phy_device *,
35 int (*link_update) (struct net_device *, struct fixed_phy_status *));
36struct 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
10struct net;
10struct completion; 11struct completion;
11 12
12/* 13/*
@@ -97,8 +98,6 @@ struct vmcore {
97 98
98extern struct proc_dir_entry proc_root; 99extern struct proc_dir_entry proc_root;
99extern struct proc_dir_entry *proc_root_fs; 100extern struct proc_dir_entry *proc_root_fs;
100extern struct proc_dir_entry *proc_net;
101extern struct proc_dir_entry *proc_net_stat;
102extern struct proc_dir_entry *proc_bus; 101extern struct proc_dir_entry *proc_bus;
103extern struct proc_dir_entry *proc_root_driver; 102extern struct proc_dir_entry *proc_root_driver;
104extern struct proc_dir_entry *proc_root_kcore; 103extern 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
196static 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
202static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 195extern 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{ 197extern 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) 199extern void proc_net_remove(struct net *net, const char *name);
207 res->proc_fops = fops;
208 return res;
209}
210
211static 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; })
224static inline void proc_net_remove(const char *name) {} 208static inline void proc_net_remove(struct net *net, const char *name) {}
225 209
226static inline void proc_flush_task(struct task_struct *task) { } 210static 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
268static inline struct net *PDE_NET(struct proc_dir_entry *pde)
269{
270 return pde->parent->data;
271}
272
273struct net *get_proc_net(const struct inode *inode);
274
284struct proc_maps_private { 275struct 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 */
36enum rfkill_type { 37enum 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
43enum rfkill_state { 44enum 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);
84int rfkill_register(struct rfkill *rfkill); 93int rfkill_register(struct rfkill *rfkill);
85void rfkill_unregister(struct rfkill *rfkill); 94void rfkill_unregister(struct rfkill *rfkill);
86 95
87void 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 */
102static 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
489struct 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
500enum
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 */
311typedef 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 */
317typedef 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 */
323typedef 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 */
329typedef 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 */
699typedef struct sctp_authhdr {
700 __be16 shkey_id;
701 __be16 hmac_id;
702 __u8 hmac[0];
703} __attribute__((packed)) sctp_authhdr_t;
704
705typedef 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
47int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 47int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
48int single_release(struct inode *, struct file *); 48int single_release(struct inode *, struct file *);
49void *__seq_open_private(struct file *, const struct seq_operations *, int);
50int seq_open_private(struct file *, const struct seq_operations *, int);
49int seq_release_private(struct inode *, struct file *); 51int 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
14struct pcmcia_device;
15struct ssb_bus;
16struct ssb_driver;
17
18
19struct 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
54struct 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
68struct 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
81struct ssb_sprom_r4 {
82 /* TODO */
83};
84
85struct 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. */
102struct ssb_boardinfo {
103 u16 vendor;
104 u16 type;
105 u16 rev;
106};
107
108
109struct ssb_device;
110/* Lowlevel read/write operations on the device MMIO.
111 * Internal, don't use that outside of ssb. */
112struct 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 */
159struct __ssb_dev_wrapper {
160 struct device dev;
161 struct ssb_device *sdev;
162};
163
164struct 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. */
182static inline
183struct 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 */
191static inline
192void ssb_set_drvdata(struct ssb_device *dev, void *data)
193{
194 dev->drvdata = data;
195}
196static inline
197void * 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) */
203void ssb_set_devtypedata(struct ssb_device *dev, void *data);
204static inline
205void * ssb_get_devtypedata(struct ssb_device *dev)
206{
207 return dev->devtypedata;
208}
209
210
211struct 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
225extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner);
226static inline int ssb_driver_register(struct ssb_driver *drv)
227{
228 return __ssb_driver_register(drv, THIS_MODULE);
229}
230extern void ssb_driver_unregister(struct ssb_driver *drv);
231
232
233
234
235enum 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
263struct 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. */
332struct ssb_init_invariants {
333 struct ssb_boardinfo boardinfo;
334 struct ssb_sprom sprom;
335};
336/* Type of function to fetch the invariants. */
337typedef 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. */
344extern 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
348extern 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
352extern 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
357extern void ssb_bus_unregister(struct ssb_bus *bus);
358
359extern u32 ssb_clockspeed(struct ssb_bus *bus);
360
361/* Is the device enabled in hardware? */
362int 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. */
365void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags);
366/* Disable a device in hardware and pass SSB_TMSLOW flags (if any). */
367void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
368
369
370/* Device MMIO register read/write functions. */
371static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
372{
373 return dev->ops->read16(dev, offset);
374}
375static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
376{
377 return dev->ops->read32(dev, offset);
378}
379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
380{
381 dev->ops->write16(dev, offset, value);
382}
383static 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. */
391extern u32 ssb_dma_translation(struct ssb_device *dev);
392#define SSB_DMA_TRANSLATION_MASK 0xC0000000
393#define SSB_DMA_TRANSLATION_SHIFT 30
394
395extern int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask);
396
397
398#ifdef CONFIG_SSB_PCIHOST
399/* PCI-host wrapper driver */
400extern int ssb_pcihost_register(struct pci_driver *driver);
401static 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. */
412extern 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. */
416extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
417
418
419/* Various helper functions */
420extern u32 ssb_admatch_base(u32 adm);
421extern 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
350struct ssb_device;
351struct ssb_serial_port;
352
353struct ssb_chipcommon {
354 struct ssb_device *dev;
355 u32 capabilities;
356 /* Fast Powerup Delay constant */
357 u16 fast_pwrup_delay;
358};
359
360extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
361
362#include <linux/pm.h>
363extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
364extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
365
366extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
367 u32 *plltype, u32 *n, u32 *m);
368extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
369 u32 *plltype, u32 *n, u32 *m);
370extern void ssb_chipco_timing_init(struct ssb_chipcommon *cc,
371 unsigned long ns_per_cycle);
372
373enum ssb_clkmode {
374 SSB_CLKMODE_SLOW,
375 SSB_CLKMODE_FAST,
376 SSB_CLKMODE_DYNAMIC,
377};
378
379extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
380 enum ssb_clkmode mode);
381
382extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
383 u32 ticks);
384
385u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
386
387void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
388
389void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
390
391#ifdef CONFIG_SSB_SERIAL
392extern 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
159struct ssb_extif {
160 struct ssb_device *dev;
161};
162
163static inline bool ssb_extif_available(struct ssb_extif *extif)
164{
165 return (extif->dev != NULL);
166}
167
168extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
169 u32 *plltype, u32 *n, u32 *m);
170
171extern void ssb_extif_timing_init(struct ssb_extif *extif,
172 unsigned long ns);
173
174u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
175
176void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
177
178void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
179
180#ifdef CONFIG_SSB_SERIAL
181extern 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
189struct ssb_extif {
190};
191
192static inline bool ssb_extif_available(struct ssb_extif *extif)
193{
194 return 0;
195}
196
197static inline
198void 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
6struct ssb_device;
7
8struct 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
17struct 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
28extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
29extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore);
30
31extern unsigned int ssb_mips_irq(struct ssb_device *dev);
32
33
34#else /* CONFIG_SSB_DRIVER_MIPS */
35
36struct ssb_mipscore {
37};
38
39static inline
40void 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
73struct ssb_pcicore {
74 struct ssb_device *dev;
75 u8 setup_done:1;
76 u8 hostmode:1;
77 u8 cardbusmode:1;
78};
79
80extern void ssb_pcicore_init(struct ssb_pcicore *pc);
81
82/* Enable IRQ routing for a specific device */
83extern 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
90struct ssb_pcicore {
91};
92
93static inline
94void ssb_pcicore_init(struct ssb_pcicore *pc)
95{
96}
97
98static inline
99int 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 */
255enum {
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
9enum
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
20struct 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 @@
82struct internal_state; 82struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef 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. */
704extern int zlib_inflate_blob(void *dst, unsigned dst_sz, const void *src, unsigned src_sz);
705
702#endif /* _ZLIB_H */ 706#endif /* _ZLIB_H */