aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-04-27 14:16:19 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-04-27 14:16:19 -0400
commitd1da4e50e5d09f02c340927a4fcb7f54202fa033 (patch)
tree7f98317bdd45dbdb7644e9179891c5af6a3a8ef1 /include
parent78ab67da1002d954ea4c3e2b441e2483c41f94e8 (diff)
parenta205752d1ad2d37d6597aaae5a56fc396a770868 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/mtd/Kconfig Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-alpha/sockios.h3
-rw-r--r--include/asm-alpha/string.h2
-rw-r--r--include/asm-arm/div64.h3
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-arm/sockios.h3
-rw-r--r--include/asm-arm26/socket.h2
-rw-r--r--include/asm-arm26/sockios.h3
-rw-r--r--include/asm-avr32/arch-at32ap/io.h39
-rw-r--r--include/asm-avr32/arch-at32ap/smc.h22
-rw-r--r--include/asm-avr32/arch-at32ap/time.h112
-rw-r--r--include/asm-avr32/atomic.h2
-rw-r--r--include/asm-avr32/bug.h50
-rw-r--r--include/asm-avr32/io.h326
-rw-r--r--include/asm-avr32/processor.h15
-rw-r--r--include/asm-avr32/setup.h13
-rw-r--r--include/asm-avr32/socket.h2
-rw-r--r--include/asm-avr32/sockios.h3
-rw-r--r--include/asm-avr32/sysreg.h543
-rw-r--r--include/asm-avr32/system.h13
-rw-r--r--include/asm-avr32/thread_info.h2
-rw-r--r--include/asm-avr32/uaccess.h13
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-cris/sockios.h3
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-frv/sockios.h3
-rw-r--r--include/asm-generic/div64.h7
-rw-r--r--include/asm-generic/pgtable.h11
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-h8300/sockios.h3
-rw-r--r--include/asm-i386/div64.h4
-rw-r--r--include/asm-i386/socket.h2
-rw-r--r--include/asm-i386/sockios.h3
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-ia64/sockios.h3
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m32r/sockios.h3
-rw-r--r--include/asm-m68k/div64.h3
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68k/sockios.h3
-rw-r--r--include/asm-mips/cacheflush.h2
-rw-r--r--include/asm-mips/div64.h11
-rw-r--r--include/asm-mips/jmr3927/irq.h57
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h130
-rw-r--r--include/asm-mips/jmr3927/tx3927.h8
-rw-r--r--include/asm-mips/jmr3927/txx927.h5
-rw-r--r--include/asm-mips/paccess.h2
-rw-r--r--include/asm-mips/sgi/hpc3.h2
-rw-r--r--include/asm-mips/sgi/ip22.h2
-rw-r--r--include/asm-mips/sgi/mc.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_int.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_mc.h32
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h20
-rw-r--r--include/asm-mips/sibyte/bcm1480_scd.h94
-rw-r--r--include/asm-mips/sibyte/board.h14
-rw-r--r--include/asm-mips/sibyte/carmel.h1
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h5
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h46
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h30
-rw-r--r--include/asm-mips/sibyte/swarm.h12
-rw-r--r--include/asm-mips/socket.h2
-rw-r--r--include/asm-mips/sockios.h3
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-parisc/sockios.h3
-rw-r--r--include/asm-powerpc/socket.h2
-rw-r--r--include/asm-powerpc/sockios.h3
-rw-r--r--include/asm-powerpc/string.h2
-rw-r--r--include/asm-s390/bug.h69
-rw-r--r--include/asm-s390/ccwgroup.h1
-rw-r--r--include/asm-s390/chpid.h53
-rw-r--r--include/asm-s390/cio.h8
-rw-r--r--include/asm-s390/ipl.h35
-rw-r--r--include/asm-s390/lowcore.h46
-rw-r--r--include/asm-s390/pgtable.h15
-rw-r--r--include/asm-s390/processor.h2
-rw-r--r--include/asm-s390/sclp.h14
-rw-r--r--include/asm-s390/setup.h2
-rw-r--r--include/asm-s390/smp.h6
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-s390/sockios.h3
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sh/sockios.h3
-rw-r--r--include/asm-sh/string.h3
-rw-r--r--include/asm-sh64/sockios.h3
-rw-r--r--include/asm-sparc/prom.h14
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc/sockios.h3
-rw-r--r--include/asm-sparc64/cpudata.h4
-rw-r--r--include/asm-sparc64/device.h18
-rw-r--r--include/asm-sparc64/ebus.h2
-rw-r--r--include/asm-sparc64/floppy.h4
-rw-r--r--include/asm-sparc64/io.h8
-rw-r--r--include/asm-sparc64/iommu.h51
-rw-r--r--include/asm-sparc64/isa.h2
-rw-r--r--include/asm-sparc64/parport.h2
-rw-r--r--include/asm-sparc64/pbm.h132
-rw-r--r--include/asm-sparc64/pci.h2
-rw-r--r--include/asm-sparc64/pgtable.h16
-rw-r--r--include/asm-sparc64/prom.h12
-rw-r--r--include/asm-sparc64/smp.h4
-rw-r--r--include/asm-sparc64/socket.h2
-rw-r--r--include/asm-sparc64/sockios.h3
-rw-r--r--include/asm-sparc64/sparsemem.h2
-rw-r--r--include/asm-sparc64/timer.h17
-rw-r--r--include/asm-sparc64/ttable.h27
-rw-r--r--include/asm-um/div64.h1
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-v850/sockios.h3
-rw-r--r--include/asm-x86_64/socket.h2
-rw-r--r--include/asm-x86_64/sockios.h3
-rw-r--r--include/asm-xtensa/div64.h6
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/asm-xtensa/sockios.h3
-rw-r--r--include/keys/rxrpc-type.h22
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/atalk.h4
-rw-r--r--include/linux/dccp.h46
-rw-r--r--include/linux/fib_rules.h15
-rw-r--r--include/linux/fs.h9
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/icmp.h9
-rw-r--r--include/linux/icmpv6.h9
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h9
-rw-r--r--include/linux/if_bridge.h3
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_pppox.h10
-rw-r--r--include/linux/if_tr.h2
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe_common.h58
-rw-r--r--include/linux/igmp.h21
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h3
-rw-r--r--include/linux/ip.h14
-rw-r--r--include/linux/ipv6.h14
-rw-r--r--include/linux/jhash.h2
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/ktime.h6
-rw-r--r--include/linux/mtd/ubi.h202
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/netfilter.h12
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h19
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter_bridge.h11
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild14
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h402
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_amanda.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h61
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h44
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h89
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h46
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_icmp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_irc.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h326
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h114
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h98
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sctp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h146
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h79
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h18
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h33
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h74
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h28
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h2
-rw-r--r--include/linux/netlink.h33
-rw-r--r--include/linux/nl80211.h38
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/rtnetlink.h13
-rw-r--r--include/linux/rxrpc.h62
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/sctp.h9
-rw-r--r--include/linux/sdla_fr.h638
-rw-r--r--include/linux/seqlock.h8
-rw-r--r--include/linux/skbuff.h392
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/string.h6
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/udp.h9
-rw-r--r--include/linux/workqueue.h7
-rw-r--r--include/linux/xfrm.h25
-rw-r--r--include/mtd/Kbuild2
-rw-r--r--include/mtd/mtd-abi.h1
-rw-r--r--include/mtd/ubi-header.h360
-rw-r--r--include/mtd/ubi-user.h161
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/af_rxrpc.h57
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/bluetooth/hci.h18
-rw-r--r--include/net/cfg80211.h40
-rw-r--r--include/net/cipso_ipv4.h2
-rw-r--r--include/net/compat.h1
-rw-r--r--include/net/dn_fib.h9
-rw-r--r--include/net/dn_route.h1
-rw-r--r--include/net/esp.h2
-rw-r--r--include/net/fib_rules.h20
-rw-r--r--include/net/inet6_hashtables.h12
-rw-r--r--include/net/inet_ecn.h8
-rw-r--r--include/net/inet_sock.h11
-rw-r--r--include/net/ip.h11
-rw-r--r--include/net/ip6_fib.h2
-rw-r--r--include/net/ip6_route.h5
-rw-r--r--include/net/ip_fib.h6
-rw-r--r--include/net/ipv6.h19
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/iw_handler.h21
-rw-r--r--include/net/llc_pdu.h15
-rw-r--r--include/net/neighbour.h10
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h145
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h30
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h1
-rw-r--r--include/net/netfilter/nf_nat_rule.h10
-rw-r--r--include/net/netlink.h18
-rw-r--r--include/net/pkt_cls.h10
-rw-r--r--include/net/pkt_sched.h182
-rw-r--r--include/net/red.h10
-rw-r--r--include/net/rtnetlink.h25
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/structs.h5
-rw-r--r--include/net/sctp/ulpevent.h1
-rw-r--r--include/net/sctp/ulpqueue.h2
-rw-r--r--include/net/sctp/user.h25
-rw-r--r--include/net/sock.h89
-rw-r--r--include/net/tcp.h190
-rw-r--r--include/net/tcp_ecn.h17
-rw-r--r--include/net/udp.h11
-rw-r--r--include/net/udplite.h45
-rw-r--r--include/net/wext.h24
-rw-r--r--include/net/wireless.h139
-rw-r--r--include/net/x25device.h2
-rw-r--r--include/net/xfrm.h10
-rw-r--r--include/rxrpc/call.h212
-rw-r--r--include/rxrpc/connection.h83
-rw-r--r--include/rxrpc/krxiod.h27
-rw-r--r--include/rxrpc/krxsecd.h22
-rw-r--r--include/rxrpc/krxtimod.h45
-rw-r--r--include/rxrpc/message.h71
-rw-r--r--include/rxrpc/packet.h119
-rw-r--r--include/rxrpc/peer.h82
-rw-r--r--include/rxrpc/rxrpc.h36
-rw-r--r--include/rxrpc/transport.h106
257 files changed, 3520 insertions, 5008 deletions
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index d22ab97ea72e..1fede7f92860 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -52,6 +52,8 @@
52 52
53#define SO_PEERSEC 30 53#define SO_PEERSEC 30
54#define SO_PASSSEC 34 54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
55 57
56/* Security levels - as per NRL IPv6 - don't actually do anything */ 58/* Security levels - as per NRL IPv6 - don't actually do anything */
57#define SO_SECURITY_AUTHENTICATION 19 59#define SO_SECURITY_AUTHENTICATION 19
diff --git a/include/asm-alpha/sockios.h b/include/asm-alpha/sockios.h
index e4961a740e5f..7932c7ab4a4d 100644
--- a/include/asm-alpha/sockios.h
+++ b/include/asm-alpha/sockios.h
@@ -10,6 +10,7 @@
10#define SIOCSPGRP _IOW('s', 8, pid_t) 10#define SIOCSPGRP _IOW('s', 8, pid_t)
11#define SIOCGPGRP _IOR('s', 9, pid_t) 11#define SIOCGPGRP _IOR('s', 9, pid_t)
12 12
13#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 13#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
14#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
14 15
15#endif /* _ASM_ALPHA_SOCKIOS_H */ 16#endif /* _ASM_ALPHA_SOCKIOS_H */
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h
index 9e44fea669bf..b02b8a282940 100644
--- a/include/asm-alpha/string.h
+++ b/include/asm-alpha/string.h
@@ -61,8 +61,6 @@ extern void * __memsetw(void *dest, unsigned short, size_t count);
61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ 61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
62 : __memsetw((s),(c),(n))) 62 : __memsetw((s),(c),(n)))
63 63
64extern int strcasecmp(const char *, const char *);
65
66#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
67 65
68#endif /* __ALPHA_STRING_H__ */ 66#endif /* __ALPHA_STRING_H__ */
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h
index 37e0a96e8789..0b5f881c3d85 100644
--- a/include/asm-arm/div64.h
+++ b/include/asm-arm/div64.h
@@ -2,6 +2,7 @@
2#define __ASM_ARM_DIV64 2#define __ASM_ARM_DIV64
3 3
4#include <asm/system.h> 4#include <asm/system.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * The semantics of do_div() are: 8 * The semantics of do_div() are:
@@ -223,4 +224,6 @@
223 224
224#endif 225#endif
225 226
227extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
228
226#endif 229#endif
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 19f7df702b06..65a1a64bf934 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/sockios.h b/include/asm-arm/sockios.h
index 77c34087d513..a2588a2512df 100644
--- a/include/asm-arm/sockios.h
+++ b/include/asm-arm/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
index 19f7df702b06..65a1a64bf934 100644
--- a/include/asm-arm26/socket.h
+++ b/include/asm-arm26/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm26/sockios.h b/include/asm-arm26/sockios.h
index 77c34087d513..a2588a2512df 100644
--- a/include/asm-arm26/sockios.h
+++ b/include/asm-arm26/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-avr32/arch-at32ap/io.h b/include/asm-avr32/arch-at32ap/io.h
new file mode 100644
index 000000000000..ee59e401f041
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/io.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_AVR32_ARCH_AT32AP_IO_H
2#define __ASM_AVR32_ARCH_AT32AP_IO_H
3
4/* For "bizarre" halfword swapping */
5#include <linux/byteorder/swabb.h>
6
7#if defined(CONFIG_AP7000_32_BIT_SMC)
8# define __swizzle_addr_b(addr) (addr ^ 3UL)
9# define __swizzle_addr_w(addr) (addr ^ 2UL)
10# define __swizzle_addr_l(addr) (addr)
11# define ioswabb(a, x) (x)
12# define ioswabw(a, x) (x)
13# define ioswabl(a, x) (x)
14# define __mem_ioswabb(a, x) (x)
15# define __mem_ioswabw(a, x) swab16(x)
16# define __mem_ioswabl(a, x) swab32(x)
17#elif defined(CONFIG_AP7000_16_BIT_SMC)
18# define __swizzle_addr_b(addr) (addr ^ 1UL)
19# define __swizzle_addr_w(addr) (addr)
20# define __swizzle_addr_l(addr) (addr)
21# define ioswabb(a, x) (x)
22# define ioswabw(a, x) (x)
23# define ioswabl(a, x) swahw32(x)
24# define __mem_ioswabb(a, x) (x)
25# define __mem_ioswabw(a, x) swab16(x)
26# define __mem_ioswabl(a, x) swahb32(x)
27#else
28# define __swizzle_addr_b(addr) (addr)
29# define __swizzle_addr_w(addr) (addr)
30# define __swizzle_addr_l(addr) (addr)
31# define ioswabb(a, x) (x)
32# define ioswabw(a, x) swab16(x)
33# define ioswabl(a, x) swab32(x)
34# define __mem_ioswabb(a, x) (x)
35# define __mem_ioswabw(a, x) (x)
36# define __mem_ioswabl(a, x) (x)
37#endif
38
39#endif /* __ASM_AVR32_ARCH_AT32AP_IO_H */
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h
index 3732b328303d..07152b7fd9c9 100644
--- a/include/asm-avr32/arch-at32ap/smc.h
+++ b/include/asm-avr32/arch-at32ap/smc.h
@@ -48,10 +48,32 @@ struct smc_config {
48 unsigned int nwe_controlled:1; 48 unsigned int nwe_controlled:1;
49 49
50 /* 50 /*
51 * 0: NWAIT is disabled
52 * 1: Reserved
53 * 2: NWAIT is frozen mode
54 * 3: NWAIT in ready mode
55 */
56 unsigned int nwait_mode:2;
57
58 /*
51 * 0: Byte select access type 59 * 0: Byte select access type
52 * 1: Byte write access type 60 * 1: Byte write access type
53 */ 61 */
54 unsigned int byte_write:1; 62 unsigned int byte_write:1;
63
64 /*
65 * Number of clock cycles before data is released after
66 * the rising edge of the read controlling signal
67 *
68 * Total cycles from SMC is tdf_cycles + 1
69 */
70 unsigned int tdf_cycles:4;
71
72 /*
73 * 0: TDF optimization disabled
74 * 1: TDF optimization enabled
75 */
76 unsigned int tdf_mode:1;
55}; 77};
56 78
57extern int smc_set_configuration(int cs, const struct smc_config *config); 79extern int smc_set_configuration(int cs, const struct smc_config *config);
diff --git a/include/asm-avr32/arch-at32ap/time.h b/include/asm-avr32/arch-at32ap/time.h
new file mode 100644
index 000000000000..cc8a43418a4d
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/time.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H
10#define _ASM_AVR32_ARCH_AT32AP_TIME_H
11
12#include <linux/platform_device.h>
13
14extern struct irqaction timer_irqaction;
15extern struct platform_device at32_systc0_device;
16extern void local_timer_interrupt(int irq, void *dev_id);
17
18#define TIMER_BCR 0x000000c0
19#define TIMER_BCR_SYNC 0
20#define TIMER_BMR 0x000000c4
21#define TIMER_BMR_TC0XC0S 0
22#define TIMER_BMR_TC1XC1S 2
23#define TIMER_BMR_TC2XC2S 4
24#define TIMER_CCR 0x00000000
25#define TIMER_CCR_CLKDIS 1
26#define TIMER_CCR_CLKEN 0
27#define TIMER_CCR_SWTRG 2
28#define TIMER_CMR 0x00000004
29#define TIMER_CMR_ABETRG 10
30#define TIMER_CMR_ACPA 16
31#define TIMER_CMR_ACPC 18
32#define TIMER_CMR_AEEVT 20
33#define TIMER_CMR_ASWTRG 22
34#define TIMER_CMR_BCPB 24
35#define TIMER_CMR_BCPC 26
36#define TIMER_CMR_BEEVT 28
37#define TIMER_CMR_BSWTRG 30
38#define TIMER_CMR_BURST 4
39#define TIMER_CMR_CLKI 3
40#define TIMER_CMR_CPCDIS 7
41#define TIMER_CMR_CPCSTOP 6
42#define TIMER_CMR_CPCTRG 14
43#define TIMER_CMR_EEVT 10
44#define TIMER_CMR_EEVTEDG 8
45#define TIMER_CMR_ENETRG 12
46#define TIMER_CMR_ETRGEDG 8
47#define TIMER_CMR_LDBDIS 7
48#define TIMER_CMR_LDBSTOP 6
49#define TIMER_CMR_LDRA 16
50#define TIMER_CMR_LDRB 18
51#define TIMER_CMR_TCCLKS 0
52#define TIMER_CMR_WAVE 15
53#define TIMER_CMR_WAVSEL 13
54#define TIMER_CV 0x00000010
55#define TIMER_CV_CV 0
56#define TIMER_IDR 0x00000028
57#define TIMER_IDR_COVFS 0
58#define TIMER_IDR_CPAS 2
59#define TIMER_IDR_CPBS 3
60#define TIMER_IDR_CPCS 4
61#define TIMER_IDR_ETRGS 7
62#define TIMER_IDR_LDRAS 5
63#define TIMER_IDR_LDRBS 6
64#define TIMER_IDR_LOVRS 1
65#define TIMER_IER 0x00000024
66#define TIMER_IER_COVFS 0
67#define TIMER_IER_CPAS 2
68#define TIMER_IER_CPBS 3
69#define TIMER_IER_CPCS 4
70#define TIMER_IER_ETRGS 7
71#define TIMER_IER_LDRAS 5
72#define TIMER_IER_LDRBS 6
73#define TIMER_IER_LOVRS 1
74#define TIMER_IMR 0x0000002c
75#define TIMER_IMR_COVFS 0
76#define TIMER_IMR_CPAS 2
77#define TIMER_IMR_CPBS 3
78#define TIMER_IMR_CPCS 4
79#define TIMER_IMR_ETRGS 7
80#define TIMER_IMR_LDRAS 5
81#define TIMER_IMR_LDRBS 6
82#define TIMER_IMR_LOVRS 1
83#define TIMER_RA 0x00000014
84#define TIMER_RA_RA 0
85#define TIMER_RB 0x00000018
86#define TIMER_RB_RB 0
87#define TIMER_RC 0x0000001c
88#define TIMER_RC_RC 0
89#define TIMER_SR 0x00000020
90#define TIMER_SR_CLKSTA 16
91#define TIMER_SR_COVFS 0
92#define TIMER_SR_CPAS 2
93#define TIMER_SR_CPBS 3
94#define TIMER_SR_CPCS 4
95#define TIMER_SR_ETRGS 7
96#define TIMER_SR_LDRAS 5
97#define TIMER_SR_LDRBS 6
98#define TIMER_SR_LOVRS 1
99#define TIMER_SR_MTIOA 17
100#define TIMER_SR_MTIOB 18
101
102/* Bit manipulation macros */
103#define TIMER_BIT(name) (1 << TIMER_##name)
104#define TIMER_BF(name,value) ((value) << TIMER_##name)
105
106/* Register access macros */
107#define timer_read(port,instance,reg) \
108 __raw_readl(port + (0x40 * instance) + TIMER_##reg)
109#define timer_write(port,instance,reg,value) \
110 __raw_writel((value), port + (0x40 * instance) + TIMER_##reg)
111
112#endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index c40b6032c480..b9c2548a52f3 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -173,7 +173,7 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
173} 173}
174 174
175#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 175#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
176#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 176#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
177 177
178#define atomic_sub(i, v) (void)atomic_sub_return(i, v) 178#define atomic_sub(i, v) (void)atomic_sub_return(i, v)
179#define atomic_add(i, v) (void)atomic_add_return(i, v) 179#define atomic_add(i, v) (void)atomic_add_return(i, v)
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h
index 521766bc9366..afdcd79a2966 100644
--- a/include/asm-avr32/bug.h
+++ b/include/asm-avr32/bug.h
@@ -18,27 +18,53 @@
18 18
19#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
20 20
21#define BUG() \ 21#define _BUG_OR_WARN(flags) \
22 do { \ 22 asm volatile( \
23 asm volatile(".hword %0\n\t" \ 23 "1: .hword %0\n" \
24 ".hword %1\n\t" \ 24 " .section __bug_table,\"a\",@progbits\n" \
25 ".long %2" \ 25 "2: .long 1b\n" \
26 : \ 26 " .long %1\n" \
27 : "n"(AVR32_BUG_OPCODE), \ 27 " .short %2\n" \
28 "i"(__LINE__), "X"(__FILE__)); \ 28 " .short %3\n" \
29 } while (0) 29 " .org 2b + %4\n" \
30 " .previous" \
31 : \
32 : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \
33 "i"(__LINE__), "i"(flags), \
34 "i"(sizeof(struct bug_entry)))
30 35
31#else 36#else
32 37
38#define _BUG_OR_WARN(flags) \
39 asm volatile( \
40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \
42 "2: .long 1b\n" \
43 " .short %1\n" \
44 " .org 2b + %2\n" \
45 " .previous" \
46 : \
47 : "i"(AVR32_BUG_OPCODE), "i"(flags), \
48 "i"(sizeof(struct bug_entry)))
49
50#endif /* CONFIG_DEBUG_BUGVERBOSE */
51
33#define BUG() \ 52#define BUG() \
34 do { \ 53 do { \
35 asm volatile(".hword %0\n\t" \ 54 _BUG_OR_WARN(0); \
36 : : "n"(AVR32_BUG_OPCODE)); \ 55 for (;;); \
37 } while (0) 56 } while (0)
38 57
39#endif /* CONFIG_DEBUG_BUGVERBOSE */ 58#define WARN_ON(condition) \
59 ({ \
60 typeof(condition) __ret_warn_on = (condition); \
61 if (unlikely(__ret_warn_on)) \
62 _BUG_OR_WARN(BUGFLAG_WARNING); \
63 unlikely(__ret_warn_on); \
64 })
40 65
41#define HAVE_ARCH_BUG 66#define HAVE_ARCH_BUG
67#define HAVE_ARCH_WARN_ON
42 68
43#endif /* CONFIG_BUG */ 69#endif /* CONFIG_BUG */
44 70
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index c08e81048393..e30d4b3bd836 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -1,13 +1,15 @@
1#ifndef __ASM_AVR32_IO_H 1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H 2#define __ASM_AVR32_IO_H
3 3
4#include <linux/kernel.h>
4#include <linux/string.h> 5#include <linux/string.h>
5 6#include <linux/types.h>
6#ifdef __KERNEL__
7 7
8#include <asm/addrspace.h> 8#include <asm/addrspace.h>
9#include <asm/byteorder.h> 9#include <asm/byteorder.h>
10 10
11#include <asm/arch/io.h>
12
11/* virt_to_phys will only work when address is in P1 or P2 */ 13/* virt_to_phys will only work when address is in P1 or P2 */
12static __inline__ unsigned long virt_to_phys(volatile void *address) 14static __inline__ unsigned long virt_to_phys(volatile void *address)
13{ 15{
@@ -36,104 +38,215 @@ extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
36extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 38extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
37extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 39extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
38 40
39static inline void writeb(unsigned char b, volatile void __iomem *addr) 41static inline void __raw_writeb(u8 v, volatile void __iomem *addr)
40{ 42{
41 *(volatile unsigned char __force *)addr = b; 43 *(volatile u8 __force *)addr = v;
42} 44}
43static inline void writew(unsigned short b, volatile void __iomem *addr) 45static inline void __raw_writew(u16 v, volatile void __iomem *addr)
44{ 46{
45 *(volatile unsigned short __force *)addr = b; 47 *(volatile u16 __force *)addr = v;
46} 48}
47static inline void writel(unsigned int b, volatile void __iomem *addr) 49static inline void __raw_writel(u32 v, volatile void __iomem *addr)
48{ 50{
49 *(volatile unsigned int __force *)addr = b; 51 *(volatile u32 __force *)addr = v;
50} 52}
51#define __raw_writeb writeb
52#define __raw_writew writew
53#define __raw_writel writel
54 53
55static inline unsigned char readb(const volatile void __iomem *addr) 54static inline u8 __raw_readb(const volatile void __iomem *addr)
56{ 55{
57 return *(const volatile unsigned char __force *)addr; 56 return *(const volatile u8 __force *)addr;
58} 57}
59static inline unsigned short readw(const volatile void __iomem *addr) 58static inline u16 __raw_readw(const volatile void __iomem *addr)
60{ 59{
61 return *(const volatile unsigned short __force *)addr; 60 return *(const volatile u16 __force *)addr;
62} 61}
63static inline unsigned int readl(const volatile void __iomem *addr) 62static inline u32 __raw_readl(const volatile void __iomem *addr)
64{ 63{
65 return *(const volatile unsigned int __force *)addr; 64 return *(const volatile u32 __force *)addr;
65}
66
67/* Convert I/O port address to virtual address */
68#ifndef __io
69# define __io(p) ((void *)phys_to_uncached(p))
70#endif
71
72/*
73 * Not really sure about the best way to slow down I/O on
74 * AVR32. Defining it as a no-op until we have an actual test case.
75 */
76#define SLOW_DOWN_IO do { } while (0)
77
78#define __BUILD_MEMORY_SINGLE(pfx, bwl, type) \
79static inline void \
80pfx##write##bwl(type val, volatile void __iomem *addr) \
81{ \
82 volatile type *__addr; \
83 type __val; \
84 \
85 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
86 __val = pfx##ioswab##bwl(__addr, val); \
87 \
88 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
89 \
90 *__addr = __val; \
91} \
92 \
93static inline type pfx##read##bwl(const volatile void __iomem *addr) \
94{ \
95 volatile type *__addr; \
96 type __val; \
97 \
98 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
99 \
100 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
101 \
102 __val = *__addr; \
103 return pfx##ioswab##bwl(__addr, __val); \
104}
105
106#define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow) \
107static inline void pfx##out##bwl##p(type val, unsigned long port) \
108{ \
109 volatile type *__addr; \
110 type __val; \
111 \
112 __addr = __io(__swizzle_addr_##bwl(port)); \
113 __val = pfx##ioswab##bwl(__addr, val); \
114 \
115 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
116 \
117 *__addr = __val; \
118 slow; \
119} \
120 \
121static inline type pfx##in##bwl##p(unsigned long port) \
122{ \
123 volatile type *__addr; \
124 type __val; \
125 \
126 __addr = __io(__swizzle_addr_##bwl(port)); \
127 \
128 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
129 \
130 __val = *__addr; \
131 slow; \
132 \
133 return pfx##ioswab##bwl(__addr, __val); \
134}
135
136#define __BUILD_MEMORY_PFX(bus, bwl, type) \
137 __BUILD_MEMORY_SINGLE(bus, bwl, type)
138
139#define BUILDIO_MEM(bwl, type) \
140 __BUILD_MEMORY_PFX(, bwl, type) \
141 __BUILD_MEMORY_PFX(__mem_, bwl, type)
142
143#define __BUILD_IOPORT_PFX(bus, bwl, type) \
144 __BUILD_IOPORT_SINGLE(bus, bwl, type, ,) \
145 __BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO)
146
147#define BUILDIO_IOPORT(bwl, type) \
148 __BUILD_IOPORT_PFX(, bwl, type) \
149 __BUILD_IOPORT_PFX(__mem_, bwl, type)
150
151BUILDIO_MEM(b, u8)
152BUILDIO_MEM(w, u16)
153BUILDIO_MEM(l, u32)
154
155BUILDIO_IOPORT(b, u8)
156BUILDIO_IOPORT(w, u16)
157BUILDIO_IOPORT(l, u32)
158
159#define readb_relaxed readb
160#define readw_relaxed readw
161#define readl_relaxed readl
162
163#define __BUILD_MEMORY_STRING(bwl, type) \
164static inline void writes##bwl(volatile void __iomem *addr, \
165 const void *data, unsigned int count) \
166{ \
167 const type *__data = data; \
168 \
169 while (count--) \
170 __mem_write##bwl(*__data++, addr); \
171} \
172 \
173static inline void reads##bwl(const volatile void __iomem *addr, \
174 void *data, unsigned int count) \
175{ \
176 type *__data = data; \
177 \
178 while (count--) \
179 *__data++ = __mem_read##bwl(addr); \
66} 180}
67#define __raw_readb readb
68#define __raw_readw readw
69#define __raw_readl readl
70 181
71#define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l) 182#define __BUILD_IOPORT_STRING(bwl, type) \
72#define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l) 183static inline void outs##bwl(unsigned long port, const void *data, \
73#define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l) 184 unsigned int count) \
185{ \
186 const type *__data = data; \
187 \
188 while (count--) \
189 __mem_out##bwl(*__data++, port); \
190} \
191 \
192static inline void ins##bwl(unsigned long port, void *data, \
193 unsigned int count) \
194{ \
195 type *__data = data; \
196 \
197 while (count--) \
198 *__data++ = __mem_in##bwl(port); \
199}
74 200
75#define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l) 201#define BUILDSTRING(bwl, type) \
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) 202 __BUILD_MEMORY_STRING(bwl, type) \
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) 203 __BUILD_IOPORT_STRING(bwl, type)
78 204
205BUILDSTRING(b, u8)
206BUILDSTRING(w, u16)
207BUILDSTRING(l, u32)
79 208
80/* 209/*
81 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be 210 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
82 */ 211 */
83#ifndef ioread8 212#ifndef ioread8
84 213
85#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) 214#define ioread8(p) ((unsigned int)readb(p))
86 215
87#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) 216#define ioread16(p) ((unsigned int)readw(p))
88#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; }) 217#define ioread16be(p) ((unsigned int)__raw_readw(p))
89 218
90#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) 219#define ioread32(p) ((unsigned int)readl(p))
91#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; }) 220#define ioread32be(p) ((unsigned int)__raw_readl(p))
92 221
93#define iowrite8(v,p) __raw_writeb(v, p) 222#define iowrite8(v,p) writeb(v, p)
94 223
95#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) 224#define iowrite16(v,p) writew(v, p)
96#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p) 225#define iowrite16be(v,p) __raw_writew(v, p)
97 226
98#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) 227#define iowrite32(v,p) writel(v, p)
99#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p) 228#define iowrite32be(v,p) __raw_writel(v, p)
100 229
101#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 230#define ioread8_rep(p,d,c) readsb(p,d,c)
102#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 231#define ioread16_rep(p,d,c) readsw(p,d,c)
103#define ioread32_rep(p,d,c) __raw_readsl(p,d,c) 232#define ioread32_rep(p,d,c) readsl(p,d,c)
104 233
105#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c) 234#define iowrite8_rep(p,s,c) writesb(p,s,c)
106#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c) 235#define iowrite16_rep(p,s,c) writesw(p,s,c)
107#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c) 236#define iowrite32_rep(p,s,c) writesl(p,s,c)
108 237
109#endif 238#endif
110 239
111
112/*
113 * These two are only here because ALSA _thinks_ it needs them...
114 */
115static inline void memcpy_fromio(void * to, const volatile void __iomem *from, 240static inline void memcpy_fromio(void * to, const volatile void __iomem *from,
116 unsigned long count) 241 unsigned long count)
117{ 242{
118 char *p = to; 243 memcpy(to, (const void __force *)from, count);
119 while (count) {
120 count--;
121 *p = readb(from);
122 p++;
123 from++;
124 }
125} 244}
126 245
127static inline void memcpy_toio(volatile void __iomem *to, const void * from, 246static inline void memcpy_toio(volatile void __iomem *to, const void * from,
128 unsigned long count) 247 unsigned long count)
129{ 248{
130 const char *p = from; 249 memcpy((void __force *)to, from, count);
131 while (count) {
132 count--;
133 writeb(*p, to);
134 p++;
135 to++;
136 }
137} 250}
138 251
139static inline void memset_io(volatile void __iomem *addr, unsigned char val, 252static inline void memset_io(volatile void __iomem *addr, unsigned char val,
@@ -142,99 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val,
142 memset((void __force *)addr, val, count); 255 memset((void __force *)addr, val, count);
143} 256}
144 257
145/*
146 * Bad read/write accesses...
147 */
148extern void __readwrite_bug(const char *fn);
149
150#define IO_SPACE_LIMIT 0xffffffff 258#define IO_SPACE_LIMIT 0xffffffff
151 259
152/* Convert I/O port address to virtual address */
153#define __io(p) ((void __iomem *)phys_to_uncached(p))
154
155/*
156 * IO port access primitives
157 * -------------------------
158 *
159 * The AVR32 doesn't have special IO access instructions; all IO is memory
160 * mapped. Note that these are defined to perform little endian accesses
161 * only. Their primary purpose is to access PCI and ISA peripherals.
162 *
163 * Note that for a big endian machine, this implies that the following
164 * big endian mode connectivity is in place.
165 *
166 * The machine specific io.h include defines __io to translate an "IO"
167 * address to a memory address.
168 *
169 * Note that we prevent GCC re-ordering or caching values in expressions
170 * by introducing sequence points into the in*() definitions. Note that
171 * __raw_* do not guarantee this behaviour.
172 *
173 * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
174 */
175#define outb(v, p) __raw_writeb(v, __io(p))
176#define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p))
177#define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p))
178
179#define inb(p) __raw_readb(__io(p))
180#define inw(p) le16_to_cpu(__raw_readw(__io(p)))
181#define inl(p) le32_to_cpu(__raw_readl(__io(p)))
182
183static inline void __outsb(unsigned long port, void *addr, unsigned int count)
184{
185 while (count--) {
186 outb(*(u8 *)addr, port);
187 addr++;
188 }
189}
190
191static inline void __insb(unsigned long port, void *addr, unsigned int count)
192{
193 while (count--) {
194 *(u8 *)addr = inb(port);
195 addr++;
196 }
197}
198
199static inline void __outsw(unsigned long port, void *addr, unsigned int count)
200{
201 while (count--) {
202 outw(*(u16 *)addr, port);
203 addr += 2;
204 }
205}
206
207static inline void __insw(unsigned long port, void *addr, unsigned int count)
208{
209 while (count--) {
210 *(u16 *)addr = inw(port);
211 addr += 2;
212 }
213}
214
215static inline void __outsl(unsigned long port, void *addr, unsigned int count)
216{
217 while (count--) {
218 outl(*(u32 *)addr, port);
219 addr += 4;
220 }
221}
222
223static inline void __insl(unsigned long port, void *addr, unsigned int count)
224{
225 while (count--) {
226 *(u32 *)addr = inl(port);
227 addr += 4;
228 }
229}
230
231#define outsb(port, addr, count) __outsb(port, addr, count)
232#define insb(port, addr, count) __insb(port, addr, count)
233#define outsw(port, addr, count) __outsw(port, addr, count)
234#define insw(port, addr, count) __insw(port, addr, count)
235#define outsl(port, addr, count) __outsl(port, addr, count)
236#define insl(port, addr, count) __insl(port, addr, count)
237
238extern void __iomem *__ioremap(unsigned long offset, size_t size, 260extern void __iomem *__ioremap(unsigned long offset, size_t size,
239 unsigned long flags); 261 unsigned long flags);
240extern void __iounmap(void __iomem *addr); 262extern void __iounmap(void __iomem *addr);
@@ -292,6 +314,4 @@ extern void __iounmap(void __iomem *addr);
292 */ 314 */
293#define xlate_dev_kmem_ptr(p) p 315#define xlate_dev_kmem_ptr(p) p
294 316
295#endif /* __KERNEL__ */
296
297#endif /* __ASM_AVR32_IO_H */ 317#endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h
index f6913778a45f..6a64833756a6 100644
--- a/include/asm-avr32/processor.h
+++ b/include/asm-avr32/processor.h
@@ -40,6 +40,14 @@ enum tlb_config {
40 TLB_INVALID 40 TLB_INVALID
41}; 41};
42 42
43#define AVR32_FEATURE_RMW (1 << 0)
44#define AVR32_FEATURE_DSP (1 << 1)
45#define AVR32_FEATURE_SIMD (1 << 2)
46#define AVR32_FEATURE_OCD (1 << 3)
47#define AVR32_FEATURE_PCTR (1 << 4)
48#define AVR32_FEATURE_JAVA (1 << 5)
49#define AVR32_FEATURE_FPU (1 << 6)
50
43struct avr32_cpuinfo { 51struct avr32_cpuinfo {
44 struct clk *clk; 52 struct clk *clk;
45 unsigned long loops_per_jiffy; 53 unsigned long loops_per_jiffy;
@@ -48,6 +56,7 @@ struct avr32_cpuinfo {
48 unsigned short arch_revision; 56 unsigned short arch_revision;
49 unsigned short cpu_revision; 57 unsigned short cpu_revision;
50 enum tlb_config tlb_config; 58 enum tlb_config tlb_config;
59 unsigned long features;
51 60
52 struct cache_info icache; 61 struct cache_info icache;
53 struct cache_info dcache; 62 struct cache_info dcache;
@@ -125,10 +134,10 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
125#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) 134#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
126 135
127struct pt_regs; 136struct pt_regs;
128void show_trace(struct task_struct *task, unsigned long *stack,
129 struct pt_regs *regs);
130
131extern unsigned long get_wchan(struct task_struct *p); 137extern unsigned long get_wchan(struct task_struct *p);
138extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl);
139extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp,
140 struct pt_regs *regs, const char *log_lvl);
132 141
133#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) 142#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
134#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) 143#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index 0a5224245e44..1ff1a217015d 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -124,19 +124,12 @@ struct tagtable {
124#define for_each_tag(t,base) \ 124#define for_each_tag(t,base) \
125 for (t = base; t->hdr.size; t = tag_next(t)) 125 for (t = base; t->hdr.size; t = tag_next(t))
126 126
127extern struct tag_mem_range *mem_phys;
128extern struct tag_mem_range *mem_reserved;
129extern struct tag_mem_range *mem_ramdisk;
130
131extern struct tag *bootloader_tags; 127extern struct tag *bootloader_tags;
132 128
133extern void setup_bootmem(void); 129extern resource_size_t fbmem_start;
134extern void setup_processor(void); 130extern resource_size_t fbmem_size;
135extern void board_setup_fbmem(unsigned long fbmem_start,
136 unsigned long fbmem_size);
137 131
138/* Chip-specific hook to enable the use of SDRAM */ 132void setup_processor(void);
139void chip_enable_sdram(void);
140 133
141#endif /* !__ASSEMBLY__ */ 134#endif /* !__ASSEMBLY__ */
142 135
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index 543229de8173..a0d0507a5034 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_AVR32_SOCKET_H */ 55#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h
index 84f3d65b3b3b..0802d742f97d 100644
--- a/include/asm-avr32/sockios.h
+++ b/include/asm-avr32/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ASM_AVR32_SOCKIOS_H */ 13#endif /* __ASM_AVR32_SOCKIOS_H */
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index f91975f330f6..c02bc8304b13 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -7,326 +7,281 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#ifndef __ASM_AVR32_SYSREG_H__ 10#ifndef __ASM_AVR32_SYSREG_H
11#define __ASM_AVR32_SYSREG_H__ 11#define __ASM_AVR32_SYSREG_H
12 12
13/* sysreg register offsets */ 13/* sysreg register offsets */
14#define SYSREG_SR 0x0000 14#define SYSREG_SR 0x0000
15#define SYSREG_EVBA 0x0004 15#define SYSREG_EVBA 0x0004
16#define SYSREG_ACBA 0x0008 16#define SYSREG_ACBA 0x0008
17#define SYSREG_CPUCR 0x000c 17#define SYSREG_CPUCR 0x000c
18#define SYSREG_ECR 0x0010 18#define SYSREG_ECR 0x0010
19#define SYSREG_RSR_SUP 0x0014 19#define SYSREG_RSR_SUP 0x0014
20#define SYSREG_RSR_INT0 0x0018 20#define SYSREG_RSR_INT0 0x0018
21#define SYSREG_RSR_INT1 0x001c 21#define SYSREG_RSR_INT1 0x001c
22#define SYSREG_RSR_INT2 0x0020 22#define SYSREG_RSR_INT2 0x0020
23#define SYSREG_RSR_INT3 0x0024 23#define SYSREG_RSR_INT3 0x0024
24#define SYSREG_RSR_EX 0x0028 24#define SYSREG_RSR_EX 0x0028
25#define SYSREG_RSR_NMI 0x002c 25#define SYSREG_RSR_NMI 0x002c
26#define SYSREG_RSR_DBG 0x0030 26#define SYSREG_RSR_DBG 0x0030
27#define SYSREG_RAR_SUP 0x0034 27#define SYSREG_RAR_SUP 0x0034
28#define SYSREG_RAR_INT0 0x0038 28#define SYSREG_RAR_INT0 0x0038
29#define SYSREG_RAR_INT1 0x003c 29#define SYSREG_RAR_INT1 0x003c
30#define SYSREG_RAR_INT2 0x0040 30#define SYSREG_RAR_INT2 0x0040
31#define SYSREG_RAR_INT3 0x0044 31#define SYSREG_RAR_INT3 0x0044
32#define SYSREG_RAR_EX 0x0048 32#define SYSREG_RAR_EX 0x0048
33#define SYSREG_RAR_NMI 0x004c 33#define SYSREG_RAR_NMI 0x004c
34#define SYSREG_RAR_DBG 0x0050 34#define SYSREG_RAR_DBG 0x0050
35#define SYSREG_JECR 0x0054 35#define SYSREG_JECR 0x0054
36#define SYSREG_JOSP 0x0058 36#define SYSREG_JOSP 0x0058
37#define SYSREG_JAVA_LV0 0x005c 37#define SYSREG_JAVA_LV0 0x005c
38#define SYSREG_JAVA_LV1 0x0060 38#define SYSREG_JAVA_LV1 0x0060
39#define SYSREG_JAVA_LV2 0x0064 39#define SYSREG_JAVA_LV2 0x0064
40#define SYSREG_JAVA_LV3 0x0068 40#define SYSREG_JAVA_LV3 0x0068
41#define SYSREG_JAVA_LV4 0x006c 41#define SYSREG_JAVA_LV4 0x006c
42#define SYSREG_JAVA_LV5 0x0070 42#define SYSREG_JAVA_LV5 0x0070
43#define SYSREG_JAVA_LV6 0x0074 43#define SYSREG_JAVA_LV6 0x0074
44#define SYSREG_JAVA_LV7 0x0078 44#define SYSREG_JAVA_LV7 0x0078
45#define SYSREG_JTBA 0x007c 45#define SYSREG_JTBA 0x007c
46#define SYSREG_JBCR 0x0080 46#define SYSREG_JBCR 0x0080
47#define SYSREG_CONFIG0 0x0100 47#define SYSREG_CONFIG0 0x0100
48#define SYSREG_CONFIG1 0x0104 48#define SYSREG_CONFIG1 0x0104
49#define SYSREG_COUNT 0x0108 49#define SYSREG_COUNT 0x0108
50#define SYSREG_COMPARE 0x010c 50#define SYSREG_COMPARE 0x010c
51#define SYSREG_TLBEHI 0x0110 51#define SYSREG_TLBEHI 0x0110
52#define SYSREG_TLBELO 0x0114 52#define SYSREG_TLBELO 0x0114
53#define SYSREG_PTBR 0x0118 53#define SYSREG_PTBR 0x0118
54#define SYSREG_TLBEAR 0x011c 54#define SYSREG_TLBEAR 0x011c
55#define SYSREG_MMUCR 0x0120 55#define SYSREG_MMUCR 0x0120
56#define SYSREG_TLBARLO 0x0124 56#define SYSREG_TLBARLO 0x0124
57#define SYSREG_TLBARHI 0x0128 57#define SYSREG_TLBARHI 0x0128
58#define SYSREG_PCCNT 0x012c 58#define SYSREG_PCCNT 0x012c
59#define SYSREG_PCNT0 0x0130 59#define SYSREG_PCNT0 0x0130
60#define SYSREG_PCNT1 0x0134 60#define SYSREG_PCNT1 0x0134
61#define SYSREG_PCCR 0x0138 61#define SYSREG_PCCR 0x0138
62#define SYSREG_BEAR 0x013c 62#define SYSREG_BEAR 0x013c
63#define SYSREG_SABAL 0x0300
64#define SYSREG_SABAH 0x0304
65#define SYSREG_SABD 0x0308
63 66
64/* Bitfields in SR */ 67/* Bitfields in SR */
65#define SYSREG_SR_C_OFFSET 0 68#define SYSREG_SR_C_OFFSET 0
66#define SYSREG_SR_C_SIZE 1 69#define SYSREG_SR_C_SIZE 1
67#define SYSREG_Z_OFFSET 1 70#define SYSREG_Z_OFFSET 1
68#define SYSREG_Z_SIZE 1 71#define SYSREG_Z_SIZE 1
69#define SYSREG_SR_N_OFFSET 2 72#define SYSREG_SR_N_OFFSET 2
70#define SYSREG_SR_N_SIZE 1 73#define SYSREG_SR_N_SIZE 1
71#define SYSREG_SR_V_OFFSET 3 74#define SYSREG_SR_V_OFFSET 3
72#define SYSREG_SR_V_SIZE 1 75#define SYSREG_SR_V_SIZE 1
73#define SYSREG_Q_OFFSET 4 76#define SYSREG_Q_OFFSET 4
74#define SYSREG_Q_SIZE 1 77#define SYSREG_Q_SIZE 1
75#define SYSREG_GM_OFFSET 16 78#define SYSREG_L_OFFSET 5
76#define SYSREG_GM_SIZE 1 79#define SYSREG_L_SIZE 1
77#define SYSREG_I0M_OFFSET 17 80#define SYSREG_T_OFFSET 14
78#define SYSREG_I0M_SIZE 1 81#define SYSREG_T_SIZE 1
79#define SYSREG_I1M_OFFSET 18 82#define SYSREG_SR_R_OFFSET 15
80#define SYSREG_I1M_SIZE 1 83#define SYSREG_SR_R_SIZE 1
81#define SYSREG_I2M_OFFSET 19 84#define SYSREG_GM_OFFSET 16
82#define SYSREG_I2M_SIZE 1 85#define SYSREG_GM_SIZE 1
83#define SYSREG_I3M_OFFSET 20 86#define SYSREG_I0M_OFFSET 17
84#define SYSREG_I3M_SIZE 1 87#define SYSREG_I0M_SIZE 1
85#define SYSREG_EM_OFFSET 21 88#define SYSREG_I1M_OFFSET 18
86#define SYSREG_EM_SIZE 1 89#define SYSREG_I1M_SIZE 1
87#define SYSREG_M0_OFFSET 22 90#define SYSREG_I2M_OFFSET 19
88#define SYSREG_M0_SIZE 1 91#define SYSREG_I2M_SIZE 1
89#define SYSREG_M1_OFFSET 23 92#define SYSREG_I3M_OFFSET 20
90#define SYSREG_M1_SIZE 1 93#define SYSREG_I3M_SIZE 1
91#define SYSREG_M2_OFFSET 24 94#define SYSREG_EM_OFFSET 21
92#define SYSREG_M2_SIZE 1 95#define SYSREG_EM_SIZE 1
93#define SYSREG_SR_D_OFFSET 26 96#define SYSREG_M0_OFFSET 22
94#define SYSREG_SR_D_SIZE 1 97#define SYSREG_M0_SIZE 1
95#define SYSREG_DM_OFFSET 27 98#define SYSREG_M1_OFFSET 23
96#define SYSREG_DM_SIZE 1 99#define SYSREG_M1_SIZE 1
97#define SYSREG_SR_J_OFFSET 28 100#define SYSREG_M2_OFFSET 24
98#define SYSREG_SR_J_SIZE 1 101#define SYSREG_M2_SIZE 1
99#define SYSREG_R_OFFSET 29 102#define SYSREG_SR_D_OFFSET 26
100#define SYSREG_R_SIZE 1 103#define SYSREG_SR_D_SIZE 1
101#define SYSREG_H_OFFSET 30 104#define SYSREG_DM_OFFSET 27
102#define SYSREG_H_SIZE 1 105#define SYSREG_DM_SIZE 1
103 106#define SYSREG_SR_J_OFFSET 28
104/* Bitfields in EVBA */ 107#define SYSREG_SR_J_SIZE 1
105 108#define SYSREG_H_OFFSET 29
106/* Bitfields in ACBA */ 109#define SYSREG_H_SIZE 1
107 110
108/* Bitfields in CPUCR */ 111/* Bitfields in CPUCR */
109#define SYSREG_BI_OFFSET 0 112#define SYSREG_BI_OFFSET 0
110#define SYSREG_BI_SIZE 1 113#define SYSREG_BI_SIZE 1
111#define SYSREG_BE_OFFSET 1 114#define SYSREG_BE_OFFSET 1
112#define SYSREG_BE_SIZE 1 115#define SYSREG_BE_SIZE 1
113#define SYSREG_FE_OFFSET 2 116#define SYSREG_FE_OFFSET 2
114#define SYSREG_FE_SIZE 1 117#define SYSREG_FE_SIZE 1
115#define SYSREG_RE_OFFSET 3 118#define SYSREG_RE_OFFSET 3
116#define SYSREG_RE_SIZE 1 119#define SYSREG_RE_SIZE 1
117#define SYSREG_IBE_OFFSET 4 120#define SYSREG_IBE_OFFSET 4
118#define SYSREG_IBE_SIZE 1 121#define SYSREG_IBE_SIZE 1
119#define SYSREG_IEE_OFFSET 5 122#define SYSREG_IEE_OFFSET 5
120#define SYSREG_IEE_SIZE 1 123#define SYSREG_IEE_SIZE 1
121
122/* Bitfields in ECR */
123#define SYSREG_ECR_OFFSET 0
124#define SYSREG_ECR_SIZE 32
125
126/* Bitfields in RSR_SUP */
127
128/* Bitfields in RSR_INT0 */
129
130/* Bitfields in RSR_INT1 */
131
132/* Bitfields in RSR_INT2 */
133
134/* Bitfields in RSR_INT3 */
135
136/* Bitfields in RSR_EX */
137
138/* Bitfields in RSR_NMI */
139
140/* Bitfields in RSR_DBG */
141
142/* Bitfields in RAR_SUP */
143
144/* Bitfields in RAR_INT0 */
145
146/* Bitfields in RAR_INT1 */
147
148/* Bitfields in RAR_INT2 */
149
150/* Bitfields in RAR_INT3 */
151
152/* Bitfields in RAR_EX */
153
154/* Bitfields in RAR_NMI */
155
156/* Bitfields in RAR_DBG */
157
158/* Bitfields in JECR */
159
160/* Bitfields in JOSP */
161
162/* Bitfields in JAVA_LV0 */
163
164/* Bitfields in JAVA_LV1 */
165
166/* Bitfields in JAVA_LV2 */
167
168/* Bitfields in JAVA_LV3 */
169
170/* Bitfields in JAVA_LV4 */
171
172/* Bitfields in JAVA_LV5 */
173
174/* Bitfields in JAVA_LV6 */
175
176/* Bitfields in JAVA_LV7 */
177
178/* Bitfields in JTBA */
179
180/* Bitfields in JBCR */
181 124
182/* Bitfields in CONFIG0 */ 125/* Bitfields in CONFIG0 */
183#define SYSREG_CONFIG0_D_OFFSET 1 126#define SYSREG_CONFIG0_R_OFFSET 0
184#define SYSREG_CONFIG0_D_SIZE 1 127#define SYSREG_CONFIG0_R_SIZE 1
185#define SYSREG_CONFIG0_S_OFFSET 2 128#define SYSREG_CONFIG0_D_OFFSET 1
186#define SYSREG_CONFIG0_S_SIZE 1 129#define SYSREG_CONFIG0_D_SIZE 1
187#define SYSREG_O_OFFSET 3 130#define SYSREG_CONFIG0_S_OFFSET 2
188#define SYSREG_O_SIZE 1 131#define SYSREG_CONFIG0_S_SIZE 1
189#define SYSREG_P_OFFSET 4 132#define SYSREG_CONFIG0_O_OFFSET 3
190#define SYSREG_P_SIZE 1 133#define SYSREG_CONFIG0_O_SIZE 1
191#define SYSREG_CONFIG0_J_OFFSET 5 134#define SYSREG_CONFIG0_P_OFFSET 4
192#define SYSREG_CONFIG0_J_SIZE 1 135#define SYSREG_CONFIG0_P_SIZE 1
193#define SYSREG_F_OFFSET 6 136#define SYSREG_CONFIG0_J_OFFSET 5
194#define SYSREG_F_SIZE 1 137#define SYSREG_CONFIG0_J_SIZE 1
195#define SYSREG_MMUT_OFFSET 7 138#define SYSREG_CONFIG0_F_OFFSET 6
196#define SYSREG_MMUT_SIZE 3 139#define SYSREG_CONFIG0_F_SIZE 1
197#define SYSREG_AR_OFFSET 10 140#define SYSREG_MMUT_OFFSET 7
198#define SYSREG_AR_SIZE 3 141#define SYSREG_MMUT_SIZE 3
199#define SYSREG_AT_OFFSET 13 142#define SYSREG_AR_OFFSET 10
200#define SYSREG_AT_SIZE 3 143#define SYSREG_AR_SIZE 3
201#define SYSREG_PROCESSORREVISION_OFFSET 16 144#define SYSREG_AT_OFFSET 13
202#define SYSREG_PROCESSORREVISION_SIZE 8 145#define SYSREG_AT_SIZE 3
203#define SYSREG_PROCESSORID_OFFSET 24 146#define SYSREG_PROCESSORREVISION_OFFSET 16
204#define SYSREG_PROCESSORID_SIZE 8 147#define SYSREG_PROCESSORREVISION_SIZE 8
148#define SYSREG_PROCESSORID_OFFSET 24
149#define SYSREG_PROCESSORID_SIZE 8
205 150
206/* Bitfields in CONFIG1 */ 151/* Bitfields in CONFIG1 */
207#define SYSREG_DASS_OFFSET 0 152#define SYSREG_DASS_OFFSET 0
208#define SYSREG_DASS_SIZE 3 153#define SYSREG_DASS_SIZE 3
209#define SYSREG_DLSZ_OFFSET 3 154#define SYSREG_DLSZ_OFFSET 3
210#define SYSREG_DLSZ_SIZE 3 155#define SYSREG_DLSZ_SIZE 3
211#define SYSREG_DSET_OFFSET 6 156#define SYSREG_DSET_OFFSET 6
212#define SYSREG_DSET_SIZE 4 157#define SYSREG_DSET_SIZE 4
213#define SYSREG_IASS_OFFSET 10 158#define SYSREG_IASS_OFFSET 10
214#define SYSREG_IASS_SIZE 2 159#define SYSREG_IASS_SIZE 3
215#define SYSREG_ILSZ_OFFSET 13 160#define SYSREG_ILSZ_OFFSET 13
216#define SYSREG_ILSZ_SIZE 3 161#define SYSREG_ILSZ_SIZE 3
217#define SYSREG_ISET_OFFSET 16 162#define SYSREG_ISET_OFFSET 16
218#define SYSREG_ISET_SIZE 4 163#define SYSREG_ISET_SIZE 4
219#define SYSREG_DMMUSZ_OFFSET 20 164#define SYSREG_DMMUSZ_OFFSET 20
220#define SYSREG_DMMUSZ_SIZE 6 165#define SYSREG_DMMUSZ_SIZE 6
221#define SYSREG_IMMUSZ_OFFSET 26 166#define SYSREG_IMMUSZ_OFFSET 26
222#define SYSREG_IMMUSZ_SIZE 6 167#define SYSREG_IMMUSZ_SIZE 6
223
224/* Bitfields in COUNT */
225
226/* Bitfields in COMPARE */
227 168
228/* Bitfields in TLBEHI */ 169/* Bitfields in TLBEHI */
229#define SYSREG_ASID_OFFSET 0 170#define SYSREG_ASID_OFFSET 0
230#define SYSREG_ASID_SIZE 8 171#define SYSREG_ASID_SIZE 8
231#define SYSREG_TLBEHI_I_OFFSET 8 172#define SYSREG_TLBEHI_I_OFFSET 8
232#define SYSREG_TLBEHI_I_SIZE 1 173#define SYSREG_TLBEHI_I_SIZE 1
233#define SYSREG_TLBEHI_V_OFFSET 9 174#define SYSREG_TLBEHI_V_OFFSET 9
234#define SYSREG_TLBEHI_V_SIZE 1 175#define SYSREG_TLBEHI_V_SIZE 1
235#define SYSREG_VPN_OFFSET 10 176#define SYSREG_VPN_OFFSET 10
236#define SYSREG_VPN_SIZE 22 177#define SYSREG_VPN_SIZE 22
237 178
238/* Bitfields in TLBELO */ 179/* Bitfields in TLBELO */
239#define SYSREG_W_OFFSET 0 180#define SYSREG_W_OFFSET 0
240#define SYSREG_W_SIZE 1 181#define SYSREG_W_SIZE 1
241#define SYSREG_TLBELO_D_OFFSET 1 182#define SYSREG_TLBELO_D_OFFSET 1
242#define SYSREG_TLBELO_D_SIZE 1 183#define SYSREG_TLBELO_D_SIZE 1
243#define SYSREG_SZ_OFFSET 2 184#define SYSREG_SZ_OFFSET 2
244#define SYSREG_SZ_SIZE 2 185#define SYSREG_SZ_SIZE 2
245#define SYSREG_AP_OFFSET 4 186#define SYSREG_AP_OFFSET 4
246#define SYSREG_AP_SIZE 3 187#define SYSREG_AP_SIZE 3
247#define SYSREG_B_OFFSET 7 188#define SYSREG_B_OFFSET 7
248#define SYSREG_B_SIZE 1 189#define SYSREG_B_SIZE 1
249#define SYSREG_G_OFFSET 8 190#define SYSREG_G_OFFSET 8
250#define SYSREG_G_SIZE 1 191#define SYSREG_G_SIZE 1
251#define SYSREG_TLBELO_C_OFFSET 9 192#define SYSREG_TLBELO_C_OFFSET 9
252#define SYSREG_TLBELO_C_SIZE 1 193#define SYSREG_TLBELO_C_SIZE 1
253#define SYSREG_PFN_OFFSET 10 194#define SYSREG_PFN_OFFSET 10
254#define SYSREG_PFN_SIZE 22 195#define SYSREG_PFN_SIZE 22
255
256/* Bitfields in PTBR */
257
258/* Bitfields in TLBEAR */
259 196
260/* Bitfields in MMUCR */ 197/* Bitfields in MMUCR */
261#define SYSREG_E_OFFSET 0 198#define SYSREG_E_OFFSET 0
262#define SYSREG_E_SIZE 1 199#define SYSREG_E_SIZE 1
263#define SYSREG_M_OFFSET 1 200#define SYSREG_M_OFFSET 1
264#define SYSREG_M_SIZE 1 201#define SYSREG_M_SIZE 1
265#define SYSREG_MMUCR_I_OFFSET 2 202#define SYSREG_MMUCR_I_OFFSET 2
266#define SYSREG_MMUCR_I_SIZE 1 203#define SYSREG_MMUCR_I_SIZE 1
267#define SYSREG_MMUCR_N_OFFSET 3 204#define SYSREG_MMUCR_N_OFFSET 3
268#define SYSREG_MMUCR_N_SIZE 1 205#define SYSREG_MMUCR_N_SIZE 1
269#define SYSREG_MMUCR_S_OFFSET 4 206#define SYSREG_MMUCR_S_OFFSET 4
270#define SYSREG_MMUCR_S_SIZE 1 207#define SYSREG_MMUCR_S_SIZE 1
271#define SYSREG_DLA_OFFSET 8 208#define SYSREG_DLA_OFFSET 8
272#define SYSREG_DLA_SIZE 6 209#define SYSREG_DLA_SIZE 6
273#define SYSREG_DRP_OFFSET 14 210#define SYSREG_DRP_OFFSET 14
274#define SYSREG_DRP_SIZE 6 211#define SYSREG_DRP_SIZE 6
275#define SYSREG_ILA_OFFSET 20 212#define SYSREG_ILA_OFFSET 20
276#define SYSREG_ILA_SIZE 6 213#define SYSREG_ILA_SIZE 6
277#define SYSREG_IRP_OFFSET 26 214#define SYSREG_IRP_OFFSET 26
278#define SYSREG_IRP_SIZE 6 215#define SYSREG_IRP_SIZE 6
279
280/* Bitfields in TLBARLO */
281
282/* Bitfields in TLBARHI */
283
284/* Bitfields in PCCNT */
285
286/* Bitfields in PCNT0 */
287
288/* Bitfields in PCNT1 */
289 216
290/* Bitfields in PCCR */ 217/* Bitfields in PCCR */
291 218#define SYSREG_PCCR_R_OFFSET 1
292/* Bitfields in BEAR */ 219#define SYSREG_PCCR_R_SIZE 1
220#define SYSREG_PCCR_C_OFFSET 2
221#define SYSREG_PCCR_C_SIZE 1
222#define SYSREG_PCCR_S_OFFSET 3
223#define SYSREG_PCCR_S_SIZE 1
224#define SYSREG_IEC_OFFSET 4
225#define SYSREG_IEC_SIZE 1
226#define SYSREG_IE0_OFFSET 5
227#define SYSREG_IE0_SIZE 1
228#define SYSREG_IE1_OFFSET 6
229#define SYSREG_IE1_SIZE 1
230#define SYSREG_FC_OFFSET 8
231#define SYSREG_FC_SIZE 1
232#define SYSREG_F0_OFFSET 9
233#define SYSREG_F0_SIZE 1
234#define SYSREG_F1_OFFSET 10
235#define SYSREG_F1_SIZE 1
236#define SYSREG_CONF0_OFFSET 12
237#define SYSREG_CONF0_SIZE 6
238#define SYSREG_CONF1_OFFSET 18
239#define SYSREG_CONF1_SIZE 6
293 240
294/* Constants for ECR */ 241/* Constants for ECR */
295#define ECR_UNRECOVERABLE 0 242#define ECR_UNRECOVERABLE 0
296#define ECR_TLB_MULTIPLE 1 243#define ECR_TLB_MULTIPLE 1
297#define ECR_BUS_ERROR_WRITE 2 244#define ECR_BUS_ERROR_WRITE 2
298#define ECR_BUS_ERROR_READ 3 245#define ECR_BUS_ERROR_READ 3
299#define ECR_NMI 4 246#define ECR_NMI 4
300#define ECR_ADDR_ALIGN_X 5 247#define ECR_ADDR_ALIGN_X 5
301#define ECR_PROTECTION_X 6 248#define ECR_PROTECTION_X 6
302#define ECR_DEBUG 7 249#define ECR_DEBUG 7
303#define ECR_ILLEGAL_OPCODE 8 250#define ECR_ILLEGAL_OPCODE 8
304#define ECR_UNIMPL_INSTRUCTION 9 251#define ECR_UNIMPL_INSTRUCTION 9
305#define ECR_PRIVILEGE_VIOLATION 10 252#define ECR_PRIVILEGE_VIOLATION 10
306#define ECR_FPE 11 253#define ECR_FPE 11
307#define ECR_COPROC_ABSENT 12 254#define ECR_COPROC_ABSENT 12
308#define ECR_ADDR_ALIGN_R 13 255#define ECR_ADDR_ALIGN_R 13
309#define ECR_ADDR_ALIGN_W 14 256#define ECR_ADDR_ALIGN_W 14
310#define ECR_PROTECTION_R 15 257#define ECR_PROTECTION_R 15
311#define ECR_PROTECTION_W 16 258#define ECR_PROTECTION_W 16
312#define ECR_DTLB_MODIFIED 17 259#define ECR_DTLB_MODIFIED 17
313#define ECR_TLB_MISS_X 20 260#define ECR_TLB_MISS_X 20
314#define ECR_TLB_MISS_R 24 261#define ECR_TLB_MISS_R 24
315#define ECR_TLB_MISS_W 28 262#define ECR_TLB_MISS_W 28
316 263
317/* Bit manipulation macros */ 264/* Bit manipulation macros */
318#define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET) 265#define SYSREG_BIT(name) \
319#define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET) 266 (1 << SYSREG_##name##_OFFSET)
320#define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1)) 267#define SYSREG_BF(name,value) \
321#define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value)) 268 (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) \
269 << SYSREG_##name##_OFFSET)
270#define SYSREG_BFEXT(name,value)\
271 (((value) >> SYSREG_##name##_OFFSET) \
272 & ((1 << SYSREG_##name##_SIZE) - 1))
273#define SYSREG_BFINS(name,value,old) \
274 (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) \
275 << SYSREG_##name##_OFFSET)) \
276 | SYSREG_BF(name,value))
322 277
278/* Register access macros */
323#ifdef __CHECKER__ 279#ifdef __CHECKER__
324extern unsigned long __builtin_mfsr(unsigned long reg); 280extern unsigned long __builtin_mfsr(unsigned long reg);
325extern void __builtin_mtsr(unsigned long reg, unsigned long value); 281extern void __builtin_mtsr(unsigned long reg, unsigned long value);
326#endif 282#endif
327 283
328/* Register access macros */ 284#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg)
329#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) 285#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
330#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
331 286
332#endif /* __ASM_AVR32_SYSREG_H__ */ 287#endif /* __ASM_AVR32_SYSREG_H */
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index ac596058697d..a8236bacc878 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -9,6 +9,7 @@
9#define __ASM_AVR32_SYSTEM_H 9#define __ASM_AVR32_SYSTEM_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/linkage.h>
12#include <linux/types.h> 13#include <linux/types.h>
13 14
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
@@ -140,15 +141,9 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
140 sizeof(*(ptr)))) 141 sizeof(*(ptr))))
141 142
142struct pt_regs; 143struct pt_regs;
143extern void __die(const char *, struct pt_regs *, unsigned long, 144void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
144 const char *, const char *, unsigned long); 145void _exception(long signr, struct pt_regs *regs, int code,
145extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long, 146 unsigned long addr);
146 const char *, const char *, unsigned long);
147
148#define die(msg, regs, err) \
149 __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
150#define die_if_kernel(msg, regs, err) \
151 __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
152 147
153#define arch_align_stack(x) (x) 148#define arch_align_stack(x) (x)
154 149
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
index d1f5b35ebd54..a2e606dd4f4a 100644
--- a/include/asm-avr32/thread_info.h
+++ b/include/asm-avr32/thread_info.h
@@ -83,6 +83,7 @@ static inline struct thread_info *current_thread_info(void)
83#define TIF_SINGLE_STEP 6 /* single step after next break */ 83#define TIF_SINGLE_STEP 6 /* single step after next break */
84#define TIF_MEMDIE 7 84#define TIF_MEMDIE 7
85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ 85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */
86#define TIF_CPU_GOING_TO_SLEEP 9 /* CPU is entering sleep 0 mode */
86#define TIF_USERSPACE 31 /* true if FS sets userspace */ 87#define TIF_USERSPACE 31 /* true if FS sets userspace */
87 88
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 89#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
@@ -94,6 +95,7 @@ static inline struct thread_info *current_thread_info(void)
94#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) 95#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
95#define _TIF_MEMDIE (1 << TIF_MEMDIE) 96#define _TIF_MEMDIE (1 << TIF_MEMDIE)
96#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 97#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
98#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
97 99
98/* XXX: These two masks must never span more than 16 bits! */ 100/* XXX: These two masks must never span more than 16 bits! */
99/* work to do on interrupt/exception return */ 101/* work to do on interrupt/exception return */
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h
index 74a679e9098c..ed092395215e 100644
--- a/include/asm-avr32/uaccess.h
+++ b/include/asm-avr32/uaccess.h
@@ -181,24 +181,23 @@ extern int __put_user_bad(void);
181 181
182#define __get_user_nocheck(x, ptr, size) \ 182#define __get_user_nocheck(x, ptr, size) \
183({ \ 183({ \
184 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 184 unsigned long __gu_val = 0; \
185 int __gu_err = 0; \ 185 int __gu_err = 0; \
186 \ 186 \
187 switch (size) { \ 187 switch (size) { \
188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ 188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \
189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ 189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \
190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ 190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \
191 case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \
192 default: __gu_err = __get_user_bad(); break; \ 191 default: __gu_err = __get_user_bad(); break; \
193 } \ 192 } \
194 \ 193 \
195 x = __gu_val; \ 194 x = (typeof(*(ptr)))__gu_val; \
196 __gu_err; \ 195 __gu_err; \
197}) 196})
198 197
199#define __get_user_check(x, ptr, size) \ 198#define __get_user_check(x, ptr, size) \
200({ \ 199({ \
201 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 200 unsigned long __gu_val = 0; \
202 const typeof(*(ptr)) __user * __gu_addr = (ptr); \ 201 const typeof(*(ptr)) __user * __gu_addr = (ptr); \
203 int __gu_err = 0; \ 202 int __gu_err = 0; \
204 \ 203 \
@@ -216,10 +215,6 @@ extern int __put_user_bad(void);
216 __get_user_asm("w", __gu_val, __gu_addr, \ 215 __get_user_asm("w", __gu_val, __gu_addr, \
217 __gu_err); \ 216 __gu_err); \
218 break; \ 217 break; \
219 case 8: \
220 __get_user_asm("d", __gu_val, __gu_addr, \
221 __gu_err); \
222 break; \
223 default: \ 218 default: \
224 __gu_err = __get_user_bad(); \ 219 __gu_err = __get_user_bad(); \
225 break; \ 220 break; \
@@ -227,7 +222,7 @@ extern int __put_user_bad(void);
227 } else { \ 222 } else { \
228 __gu_err = -EFAULT; \ 223 __gu_err = -EFAULT; \
229 } \ 224 } \
230 x = __gu_val; \ 225 x = (typeof(*(ptr)))__gu_val; \
231 __gu_err; \ 226 __gu_err; \
232}) 227})
233 228
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 01cfdf1d6d33..5b18dfdf1748 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -51,6 +51,8 @@
51 51
52#define SO_PEERSEC 31 52#define SO_PEERSEC 31
53#define SO_PASSSEC 34 53#define SO_PASSSEC 34
54#define SO_TIMESTAMPNS 35
55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
56 58
diff --git a/include/asm-cris/sockios.h b/include/asm-cris/sockios.h
index 6c4012f0b29f..cfe7bfecf599 100644
--- a/include/asm-cris/sockios.h
+++ b/include/asm-cris/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index 31db18fc871f..a823befd11dd 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
54 56
diff --git a/include/asm-frv/sockios.h b/include/asm-frv/sockios.h
index 8a6e4b2074b7..5dbdd13e6de3 100644
--- a/include/asm-frv/sockios.h
+++ b/include/asm-frv/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* _ASM_SOCKIOS__ */ 13#endif /* _ASM_SOCKIOS__ */
13 14
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h
index 8f4e3193342e..a4a49370793c 100644
--- a/include/asm-generic/div64.h
+++ b/include/asm-generic/div64.h
@@ -30,6 +30,11 @@
30 __rem; \ 30 __rem; \
31 }) 31 })
32 32
33static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
34{
35 return dividend / divisor;
36}
37
33#elif BITS_PER_LONG == 32 38#elif BITS_PER_LONG == 32
34 39
35extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); 40extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
@@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
49 __rem; \ 54 __rem; \
50 }) 55 })
51 56
57extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
58
52#else /* BITS_PER_LONG == ?? */ 59#else /* BITS_PER_LONG == ?? */
53 60
54# error do_div() does not yet support the C64 61# error do_div() does not yet support the C64
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 6d7e279b1490..dc8f99ee305f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -139,8 +139,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
139#define pte_same(A,B) (pte_val(A) == pte_val(B)) 139#define pte_same(A,B) (pte_val(A) == pte_val(B))
140#endif 140#endif
141 141
142#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 142#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
143#define page_test_and_clear_dirty(page) (0) 143#define page_test_dirty(page) (0)
144#endif
145
146#ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY
147#define page_clear_dirty(page) do { } while (0)
148#endif
149
150#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
144#define pte_maybe_dirty(pte) pte_dirty(pte) 151#define pte_maybe_dirty(pte) pte_dirty(pte)
145#else 152#else
146#define pte_maybe_dirty(pte) (1) 153#define pte_maybe_dirty(pte) (1)
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index ebc830fee0d0..39911d8c9684 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-h8300/sockios.h b/include/asm-h8300/sockios.h
index d005d9594cc6..e9c7ec810c23 100644
--- a/include/asm-h8300/sockios.h
+++ b/include/asm-h8300/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_H8300_SOCKIOS__ */ 13#endif /* __ARCH_H8300_SOCKIOS__ */
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h
index 75c67c785bb8..438e980068bd 100644
--- a/include/asm-i386/div64.h
+++ b/include/asm-i386/div64.h
@@ -1,6 +1,8 @@
1#ifndef __I386_DIV64 1#ifndef __I386_DIV64
2#define __I386_DIV64 2#define __I386_DIV64
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * do_div() is NOT a C function. It wants to return 7 * do_div() is NOT a C function. It wants to return
6 * two values (the quotient and the remainder), but 8 * two values (the quotient and the remainder), but
@@ -45,4 +47,6 @@ div_ll_X_l_rem(long long divs, long div, long *rem)
45 return dum2; 47 return dum2;
46 48
47} 49}
50
51extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
48#endif 52#endif
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 5755d57c4e95..99ca648b94c5 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-i386/sockios.h b/include/asm-i386/sockios.h
index 6b747f8e228b..ff528c7d255c 100644
--- a/include/asm-i386/sockios.h
+++ b/include/asm-i386/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index d638ef3d50c3..9e42ce43cfbe 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -58,5 +58,7 @@
58 58
59#define SO_PEERSEC 31 59#define SO_PEERSEC 31
60#define SO_PASSSEC 34 60#define SO_PASSSEC 34
61#define SO_TIMESTAMPNS 35
62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61 63
62#endif /* _ASM_IA64_SOCKET_H */ 64#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-ia64/sockios.h b/include/asm-ia64/sockios.h
index cf94857c8a54..15c92468ad38 100644
--- a/include/asm-ia64/sockios.h
+++ b/include/asm-ia64/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_IA64_SOCKIOS_H */ 20#endif /* _ASM_IA64_SOCKIOS_H */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index acdf748fcdc8..793d5d30c850 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_M32R_SOCKET_H */ 55#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h
index f89962e231fe..6c1fb9b43bdb 100644
--- a/include/asm-m32r/sockios.h
+++ b/include/asm-m32r/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* _ASM_M32R_SOCKIOS_H */ 13#endif /* _ASM_M32R_SOCKIOS_H */
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h
index 9f65de1a2480..33caad1628d4 100644
--- a/include/asm-m68k/div64.h
+++ b/include/asm-m68k/div64.h
@@ -1,6 +1,8 @@
1#ifndef _M68K_DIV64_H 1#ifndef _M68K_DIV64_H
2#define _M68K_DIV64_H 2#define _M68K_DIV64_H
3 3
4#include <linux/types.h>
5
4/* n = n / base; return rem; */ 6/* n = n / base; return rem; */
5 7
6#define do_div(n, base) ({ \ 8#define do_div(n, base) ({ \
@@ -23,4 +25,5 @@
23 __rem; \ 25 __rem; \
24}) 26})
25 27
28extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
26#endif /* _M68K_DIV64_H */ 29#endif /* _M68K_DIV64_H */
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index a5966ec005ae..6d21b90863ad 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h
index 9b9ed973c24e..c04a23943cb7 100644
--- a/include/asm-m68k/sockios.h
+++ b/include/asm-m68k/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_M68K_SOCKIOS__ */ 13#endif /* __ARCH_M68K_SOCKIOS__ */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 28d907d4347a..4933b4947ed0 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -96,6 +96,6 @@ extern void (*flush_data_cache_page)(unsigned long addr);
96unsigned long __init run_uncached(void *func); 96unsigned long __init run_uncached(void *func);
97 97
98extern void *kmap_coherent(struct page *page, unsigned long addr); 98extern void *kmap_coherent(struct page *page, unsigned long addr);
99extern void kunmap_coherent(struct page *page); 99extern void kunmap_coherent(void);
100 100
101#endif /* _ASM_CACHEFLUSH_H */ 101#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
index d107832de1b6..66189f5f6399 100644
--- a/include/asm-mips/div64.h
+++ b/include/asm-mips/div64.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2000, 2004 Maciej W. Rozycki 2 * Copyright (C) 2000, 2004 Maciej W. Rozycki
3 * Copyright (C) 2003 Ralf Baechle 3 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
4 * 4 *
5 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,8 @@
9#ifndef _ASM_DIV64_H 9#ifndef _ASM_DIV64_H
10#define _ASM_DIV64_H 10#define _ASM_DIV64_H
11 11
12#include <linux/types.h>
13
12#if (_MIPS_SZLONG == 32) 14#if (_MIPS_SZLONG == 32)
13 15
14#include <asm/compiler.h> 16#include <asm/compiler.h>
@@ -78,6 +80,8 @@
78 __quot = __quot << 32 | __low; \ 80 __quot = __quot << 32 | __low; \
79 (n) = __quot; \ 81 (n) = __quot; \
80 __mod; }) 82 __mod; })
83
84extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
81#endif /* (_MIPS_SZLONG == 32) */ 85#endif /* (_MIPS_SZLONG == 32) */
82 86
83#if (_MIPS_SZLONG == 64) 87#if (_MIPS_SZLONG == 64)
@@ -101,6 +105,11 @@
101 (n) = __quot; \ 105 (n) = __quot; \
102 __mod; }) 106 __mod; })
103 107
108static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
109{
110 return dividend / divisor;
111}
112
104#endif /* (_MIPS_SZLONG == 64) */ 113#endif /* (_MIPS_SZLONG == 64) */
105 114
106#endif /* _ASM_DIV64_H */ 115#endif /* _ASM_DIV64_H */
diff --git a/include/asm-mips/jmr3927/irq.h b/include/asm-mips/jmr3927/irq.h
deleted file mode 100644
index e3e7ed38da6c..000000000000
--- a/include/asm-mips/jmr3927/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/include/asm-mips/tx3927/irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Toshiba Corporation
9 */
10#ifndef __ASM_TX3927_IRQ_H
11#define __ASM_TX3927_IRQ_H
12
13#ifndef __ASSEMBLY__
14
15#include <asm/irq.h>
16
17struct tb_irq_space {
18 struct tb_irq_space* next;
19 int start_irqno;
20 int nr_irqs;
21 void (*mask_func)(int irq_nr, int space_id);
22 void (*unmask_func)(int irq_no, int space_id);
23 const char *name;
24 int space_id;
25 int can_share;
26};
27extern struct tb_irq_space* tb_irq_spaces;
28
29static __inline__ void add_tb_irq_space(struct tb_irq_space* sp)
30{
31 sp->next = tb_irq_spaces;
32 tb_irq_spaces = sp;
33}
34
35
36struct pt_regs;
37extern void
38toshibaboards_spurious(struct pt_regs *regs, int irq);
39extern void
40toshibaboards_irqdispatch(struct pt_regs *regs, int irq);
41
42extern struct irqaction *
43toshibaboards_get_irq_action(int irq);
44extern int
45toshibaboards_setup_irq(int irq, struct irqaction * new);
46
47
48extern int (*toshibaboards_gen_iack)(void);
49
50#endif /* !__ASSEMBLY__ */
51
52#define NR_ISA_IRQS 16
53#define TB_IRQ_IS_ISA(irq) \
54 (0 <= (irq) && (irq) < NR_ISA_IRQS)
55#define TB_IRQ_TO_ISA_IRQ(irq) (irq)
56
57#endif /* __ASM_TX3927_IRQ_H */
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
index c50e68ffa3af..958e29706e2d 100644
--- a/include/asm-mips/jmr3927/jmr3927.h
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Defines for the TJSYS JMR-TX3927/JMI-3927IO2/JMY-1394IF. 2 * Defines for the TJSYS JMR-TX3927
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
@@ -12,10 +12,7 @@
12 12
13#include <asm/jmr3927/tx3927.h> 13#include <asm/jmr3927/tx3927.h>
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/jmr3927/irq.h>
16#ifndef __ASSEMBLY__
17#include <asm/system.h> 15#include <asm/system.h>
18#endif
19 16
20/* CS */ 17/* CS */
21#define JMR3927_ROMCE0 0x1fc00000 /* 4M */ 18#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
@@ -35,28 +32,10 @@
35#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */ 32#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
36#define JMR3927_PORT_BASE KSEG1 33#define JMR3927_PORT_BASE KSEG1
37 34
38/* select indirect initiator access per errata */
39#define JMR3927_INIT_INDIRECT_PCI
40#define PCI_ISTAT_IDICC 0x1000
41#define PCI_IPCIBE_IBE_LONG 0
42#define PCI_IPCIBE_ICMD_IOREAD 2
43#define PCI_IPCIBE_ICMD_IOWRITE 3
44#define PCI_IPCIBE_ICMD_MEMREAD 6
45#define PCI_IPCIBE_ICMD_MEMWRITE 7
46#define PCI_IPCIBE_ICMD_SHIFT 4
47
48/* Address map (virtual address) */ 35/* Address map (virtual address) */
49#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0) 36#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
50#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1) 37#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
51#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2) 38#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
52#define JMR3927_IOB_BASE (KSEG1 + JMR3927_ROMCE3)
53#define JMR3927_ISAMEM_BASE (JMR3927_IOB_BASE)
54#define JMR3927_ISAIO_BASE (JMR3927_IOB_BASE + 0x01000000)
55#define JMR3927_ISAC_BASE (JMR3927_IOB_BASE + 0x02000000)
56#define JMR3927_LCDVGA_REG_BASE (JMR3927_IOB_BASE + 0x03000000)
57#define JMR3927_LCDVGA_MEM_BASE (JMR3927_IOB_BASE + 0x03800000)
58#define JMR3927_JMY1394_BASE (KSEG1 + JMR3927_ROMCE5)
59#define JMR3927_PREMIER3_BASE (JMR3927_JMY1394_BASE + 0x00100000)
60#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM) 39#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
61#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO) 40#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
62 41
@@ -72,25 +51,14 @@
72#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000) 51#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
73#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000) 52#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
74 53
75#define JMR3927_ISAC_REV_ADDR (JMR3927_ISAC_BASE + 0x00000000)
76#define JMR3927_ISAC_EINTS_ADDR (JMR3927_ISAC_BASE + 0x00200000)
77#define JMR3927_ISAC_EINTM_ADDR (JMR3927_ISAC_BASE + 0x00300000)
78#define JMR3927_ISAC_NMI_ADDR (JMR3927_ISAC_BASE + 0x00400000)
79#define JMR3927_ISAC_LED_ADDR (JMR3927_ISAC_BASE + 0x00500000)
80#define JMR3927_ISAC_INTP_ADDR (JMR3927_ISAC_BASE + 0x00800000)
81#define JMR3927_ISAC_INTS1_ADDR (JMR3927_ISAC_BASE + 0x00900000)
82#define JMR3927_ISAC_INTS2_ADDR (JMR3927_ISAC_BASE + 0x00a00000)
83#define JMR3927_ISAC_INTM_ADDR (JMR3927_ISAC_BASE + 0x00b00000)
84
85/* Flash ROM */ 54/* Flash ROM */
86#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE) 55#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
87#define JMR3927_FLASH_SIZE 0x00400000 56#define JMR3927_FLASH_SIZE 0x00400000
88 57
89/* bits for IOC_REV/IOC_BREV/ISAC_REV (high byte) */ 58/* bits for IOC_REV/IOC_BREV (high byte) */
90#define JMR3927_IDT_MASK 0xfc 59#define JMR3927_IDT_MASK 0xfc
91#define JMR3927_REV_MASK 0x03 60#define JMR3927_REV_MASK 0x03
92#define JMR3927_IOC_IDT 0xe0 61#define JMR3927_IOC_IDT 0xe0
93#define JMR3927_ISAC_IDT 0x20
94 62
95/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */ 63/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
96#define JMR3927_IOC_INTB_PCIA 0 64#define JMR3927_IOC_INTB_PCIA 0
@@ -114,40 +82,6 @@
114#define JMR3927_IOC_RESET_CPU 1 82#define JMR3927_IOC_RESET_CPU 1
115#define JMR3927_IOC_RESET_PCI 2 83#define JMR3927_IOC_RESET_PCI 2
116 84
117/* bits for ISAC_EINTS/ISAC_EINTM (high byte) */
118#define JMR3927_ISAC_EINTB_IOCHK 2
119#define JMR3927_ISAC_EINTB_BWTH 4
120#define JMR3927_ISAC_EINTF_IOCHK (1 << JMR3927_ISAC_EINTB_IOCHK)
121#define JMR3927_ISAC_EINTF_BWTH (1 << JMR3927_ISAC_EINTB_BWTH)
122
123/* bits for ISAC_LED (high byte) */
124#define JMR3927_ISAC_LED_ISALED 0x01
125#define JMR3927_ISAC_LED_USRLED 0x02
126
127/* bits for ISAC_INTS/ISAC_INTM/ISAC_INTP (high byte) */
128#define JMR3927_ISAC_INTB_IRQ5 0
129#define JMR3927_ISAC_INTB_IRQKB 1
130#define JMR3927_ISAC_INTB_IRQMOUSE 2
131#define JMR3927_ISAC_INTB_IRQ4 3
132#define JMR3927_ISAC_INTB_IRQ12 4
133#define JMR3927_ISAC_INTB_IRQ3 5
134#define JMR3927_ISAC_INTB_IRQ10 6
135#define JMR3927_ISAC_INTB_ISAER 7
136#define JMR3927_ISAC_INTF_IRQ5 (1 << JMR3927_ISAC_INTB_IRQ5)
137#define JMR3927_ISAC_INTF_IRQKB (1 << JMR3927_ISAC_INTB_IRQKB)
138#define JMR3927_ISAC_INTF_IRQMOUSE (1 << JMR3927_ISAC_INTB_IRQMOUSE)
139#define JMR3927_ISAC_INTF_IRQ4 (1 << JMR3927_ISAC_INTB_IRQ4)
140#define JMR3927_ISAC_INTF_IRQ12 (1 << JMR3927_ISAC_INTB_IRQ12)
141#define JMR3927_ISAC_INTF_IRQ3 (1 << JMR3927_ISAC_INTB_IRQ3)
142#define JMR3927_ISAC_INTF_IRQ10 (1 << JMR3927_ISAC_INTB_IRQ10)
143#define JMR3927_ISAC_INTF_ISAER (1 << JMR3927_ISAC_INTB_ISAER)
144
145#ifndef __ASSEMBLY__
146
147#if 0
148#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned short *)(a)) = (d) << 8)
149#define jmr3927_ioc_reg_in(a) (((*(volatile unsigned short *)(a)) >> 8) & 0xff)
150#else
151#if defined(__BIG_ENDIAN) 85#if defined(__BIG_ENDIAN)
152#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) 86#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
153#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a)) 87#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
@@ -157,31 +91,9 @@
157#else 91#else
158#error "No Endian" 92#error "No Endian"
159#endif 93#endif
160#endif
161#define jmr3927_isac_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
162#define jmr3927_isac_reg_in(a) (*(volatile unsigned char *)(a))
163
164static inline int jmr3927_have_isac(void)
165{
166 unsigned char idt;
167 unsigned long flags;
168 unsigned long romcr3;
169
170 local_irq_save(flags);
171 romcr3 = tx3927_romcptr->cr[3];
172 tx3927_romcptr->cr[3] &= 0xffffefff; /* do not wait infinitely */
173 idt = jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_IDT_MASK;
174 tx3927_romcptr->cr[3] = romcr3;
175 local_irq_restore(flags);
176
177 return idt == JMR3927_ISAC_IDT;
178}
179#define jmr3927_have_nvram() \
180 ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT)
181 94
182/* LED macro */ 95/* LED macro */
183#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) 96#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
184#define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR)
185 97
186#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR) 98#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR)
187 99
@@ -190,10 +102,6 @@ static inline int jmr3927_have_isac(void)
190#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0) 102#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0)
191#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0) 103#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
192#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0) 104#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
193#define jmr3927_io_dipsw() (jmr3927_isac_reg_in(JMR3927_ISAC_LED_ADDR) >> 4)
194
195
196#endif /* !__ASSEMBLY__ */
197 105
198/* 106/*
199 * IRQ mappings 107 * IRQ mappings
@@ -206,16 +114,10 @@ static inline int jmr3927_have_isac(void)
206 */ 114 */
207#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */ 115#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
208#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */ 116#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
209#define JMR3927_NR_IRQ_ISAC 8 /* ISA */
210 117
211 118#define JMR3927_IRQ_IRC 16
212#define JMR3927_IRQ_IRC NR_ISA_IRQS
213#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC) 119#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
214#define JMR3927_IRQ_ISAC (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC) 120#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
215#define JMR3927_IRQ_END (JMR3927_IRQ_ISAC + JMR3927_NR_IRQ_ISAC)
216#define JMR3927_IRQ_IS_IRC(irq) (JMR3927_IRQ_IRC <= (irq) && (irq) < JMR3927_IRQ_IOC)
217#define JMR3927_IRQ_IS_IOC(irq) (JMR3927_IRQ_IOC <= (irq) && (irq) < JMR3927_IRQ_ISAC)
218#define JMR3927_IRQ_IS_ISAC(irq) (JMR3927_IRQ_ISAC <= (irq) && (irq) < JMR3927_IRQ_END)
219 121
220#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0) 122#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
221#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1) 123#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
@@ -240,37 +142,13 @@ static inline int jmr3927_have_isac(void)
240#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6) 142#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
241#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7) 143#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
242#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT) 144#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
243#define JMR3927_IRQ_ISAC_IRQ5 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ5)
244#define JMR3927_IRQ_ISAC_IRQKB (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQKB)
245#define JMR3927_IRQ_ISAC_IRQMOUSE (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQMOUSE)
246#define JMR3927_IRQ_ISAC_IRQ4 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ4)
247#define JMR3927_IRQ_ISAC_IRQ12 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ12)
248#define JMR3927_IRQ_ISAC_IRQ3 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ3)
249#define JMR3927_IRQ_ISAC_IRQ10 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ10)
250#define JMR3927_IRQ_ISAC_ISAER (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_ISAER)
251 145
252#if 0 /* auto detect */
253/* RTL8019AS 10M Ether (JMI-3927IO2:JPW2:1-2 Short) */
254#define JMR3927_IRQ_ETHER1 JMR3927_IRQ_IRC_INT0
255#endif
256/* IOC (PCI, MODEM) */ 146/* IOC (PCI, MODEM) */
257#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 147#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
258/* ISAC (ISA, PCMCIA, KEYBOARD, MOUSE) */
259#define JMR3927_IRQ_ISACINT JMR3927_IRQ_IRC_INT2
260/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ 148/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
261#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 149#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
262/* Clock Tick (10ms) */ 150/* Clock Tick (10ms) */
263#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0 151#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0
264#define JMR3927_IRQ_IDE JMR3927_IRQ_ISAC_IRQ12
265
266/* IEEE1394 (Note that this may conflicts with RTL8019AS 10M Ether...) */
267#define JMR3927_IRQ_PREMIER3 JMR3927_IRQ_IRC_INT0
268
269/* I/O Ports */
270/* RTL8019AS 10M Ether */
271#define JMR3927_ETHER1_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x280)
272#define JMR3927_KBD_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x00800060)
273#define JMR3927_IDE_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x001001f0)
274 152
275/* Clocks */ 153/* Clocks */
276#define JMR3927_CORECLK 132710400 /* 132.7MHz */ 154#define JMR3927_CORECLK 132710400 /* 132.7MHz */
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h
index b3d67c75d9ac..0b9073bfb759 100644
--- a/include/asm-mips/jmr3927/tx3927.h
+++ b/include/asm-mips/jmr3927/tx3927.h
@@ -22,8 +22,6 @@
22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100) 22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100)
23#define TX3927_PIO_REG 0xfffef500 23#define TX3927_PIO_REG 0xfffef500
24 24
25#ifndef __ASSEMBLY__
26
27struct tx3927_sdramc_reg { 25struct tx3927_sdramc_reg {
28 volatile unsigned long cr[8]; 26 volatile unsigned long cr[8];
29 volatile unsigned long tr[3]; 27 volatile unsigned long tr[3];
@@ -164,8 +162,6 @@ struct tx3927_ccfg_reg {
164 volatile unsigned long pdcr; 162 volatile unsigned long pdcr;
165}; 163};
166 164
167#endif /* !__ASSEMBLY__ */
168
169/* 165/*
170 * SDRAMC 166 * SDRAMC
171 */ 167 */
@@ -348,8 +344,6 @@ struct tx3927_ccfg_reg {
348#define TX3927_PCFG_SELDMA_ALL 0x0000000f 344#define TX3927_PCFG_SELDMA_ALL 0x0000000f
349#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch)) 345#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
350 346
351#ifndef __ASSEMBLY__
352
353#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG) 347#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
354#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG) 348#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
355#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) 349#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
@@ -360,6 +354,4 @@ struct tx3927_ccfg_reg {
360#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) 354#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
361#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG) 355#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG)
362 356
363#endif /* !__ASSEMBLY__ */
364
365#endif /* __ASM_TX3927_H */ 357#endif /* __ASM_TX3927_H */
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h
index 9d5792eab452..58a8ff6be815 100644
--- a/include/asm-mips/jmr3927/txx927.h
+++ b/include/asm-mips/jmr3927/txx927.h
@@ -10,8 +10,6 @@
10#ifndef __ASM_TXX927_H 10#ifndef __ASM_TXX927_H
11#define __ASM_TXX927_H 11#define __ASM_TXX927_H
12 12
13#ifndef __ASSEMBLY__
14
15struct txx927_tmr_reg { 13struct txx927_tmr_reg {
16 volatile unsigned long tcr; 14 volatile unsigned long tcr;
17 volatile unsigned long tisr; 15 volatile unsigned long tisr;
@@ -52,9 +50,6 @@ struct txx927_pio_reg {
52 volatile unsigned long maskext; 50 volatile unsigned long maskext;
53}; 51};
54 52
55#endif /* !__ASSEMBLY__ */
56
57
58/* 53/*
59 * TMR 54 * TMR
60 */ 55 */
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
index 147844ef103b..8c08fa904b2c 100644
--- a/include/asm-mips/paccess.h
+++ b/include/asm-mips/paccess.h
@@ -34,7 +34,7 @@ struct __large_pstruct { unsigned long buf[100]; };
34#define __get_dbe(x,ptr,size) \ 34#define __get_dbe(x,ptr,size) \
35({ \ 35({ \
36 long __gu_err; \ 36 long __gu_err; \
37 __typeof(*(ptr)) __gu_val; \ 37 __typeof__(*(ptr)) __gu_val; \
38 unsigned long __gu_addr; \ 38 unsigned long __gu_addr; \
39 __asm__("":"=r" (__gu_val)); \ 39 __asm__("":"=r" (__gu_val)); \
40 __gu_addr = (unsigned long) (ptr); \ 40 __gu_addr = (unsigned long) (ptr); \
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
index fcec52bafb25..c4729f531919 100644
--- a/include/asm-mips/sgi/hpc3.h
+++ b/include/asm-mips/sgi/hpc3.h
@@ -206,7 +206,7 @@ struct hpc3_regs {
206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */ 206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */
207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */ 207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */
208 208
209 volatile u32 eeprom; /* EEPROM data reg. */ 209 u32 eeprom; /* EEPROM data reg. */
210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */ 210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */
211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */ 211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */
212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */ 212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
index 6592f3bd1999..f4981c4f16bb 100644
--- a/include/asm-mips/sgi/ip22.h
+++ b/include/asm-mips/sgi/ip22.h
@@ -72,7 +72,7 @@
72 72
73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) 73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
74 74
75extern unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg); 75extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg);
76extern unsigned short ip22_nvram_read(int reg); 76extern unsigned short ip22_nvram_read(int reg);
77 77
78#endif 78#endif
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
index c52f7834c7c8..1576c2394de8 100644
--- a/include/asm-mips/sgi/mc.h
+++ b/include/asm-mips/sgi/mc.h
@@ -57,7 +57,7 @@ struct sgimc_regs {
57 volatile u32 divider; /* Divider reg for RPSS */ 57 volatile u32 divider; /* Divider reg for RPSS */
58 58
59 u32 _unused5; 59 u32 _unused5;
60 volatile u32 eeprom; /* EEPROM byte reg for r4k */ 60 u32 eeprom; /* EEPROM byte reg for r4k */
61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ 61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */
62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ 62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */
63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ 63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h
index 42d4cf00efd3..c0d5206020fd 100644
--- a/include/asm-mips/sibyte/bcm1480_int.h
+++ b/include/asm-mips/sibyte/bcm1480_int.h
@@ -157,6 +157,7 @@
157 * Mask values for each interrupt 157 * Mask values for each interrupt
158 */ 158 */
159 159
160#define _BCM1480_INT_MASK(w,n) _SB_MAKEMASK(w,((n) & 0x3F))
160#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F)) 161#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
161#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6) 162#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
162 163
@@ -195,6 +196,7 @@
195#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH) 196#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
196#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW) 197#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
197#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH) 198#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
199#define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8,K_BCM1480_INT_MBOX_0_0)
198#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0) 200#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
199#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1) 201#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
200#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2) 202#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
index 6bdc941afc91..a6a437451da4 100644
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -382,6 +382,10 @@
382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10) 382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11) 383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
384 384
385#define M_BCM1480_MC_CS _SB_MAKEMASK(8,S_BCM1480_MC_CS0)
386#define V_BCM1480_MC_CS(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0)
387#define G_BCM1480_MC_CS(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0,M_BCM1480_MC_CS0)
388
385#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16) 389#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
386 390
387/* 391/*
@@ -412,6 +416,8 @@
412#define K_BCM1480_MC_DRAM_TYPE_DDR2 2 416#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
413#endif 417#endif
414 418
419#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0
420
415#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC) 421#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
416#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM) 422#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
417 423
@@ -511,6 +517,22 @@
511#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31) 517#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
512 518
513#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32) 519#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32)
520
521#define S_BCM1480_MC_ODT0 0
522#define M_BCM1480_MC_ODT0 _SB_MAKEMASK(8,S_BCM1480_MC_ODT0)
523#define V_BCM1480_MC_ODT0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0)
524
525#define S_BCM1480_MC_ODT2 8
526#define M_BCM1480_MC_ODT2 _SB_MAKEMASK(8,S_BCM1480_MC_ODT2)
527#define V_BCM1480_MC_ODT2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2)
528
529#define S_BCM1480_MC_ODT4 16
530#define M_BCM1480_MC_ODT4 _SB_MAKEMASK(8,S_BCM1480_MC_ODT4)
531#define V_BCM1480_MC_ODT4(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4)
532
533#define S_BCM1480_MC_ODT6 24
534#define M_BCM1480_MC_ODT6 _SB_MAKEMASK(8,S_BCM1480_MC_ODT6)
535#define V_BCM1480_MC_ODT6(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6)
514#endif 536#endif
515 537
516/* 538/*
@@ -588,11 +610,11 @@
588#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47) 610#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
589#endif 611#endif
590 612
591#define S_BCM1480_MC_DLL_DEFAULT 48 613#define S_BCM1480_MC_DLL_DEFAULT 48
592#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT) 614#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT)
593#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT) 615#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT)
594#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT) 616#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT)
595#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10) 617#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
596 618
597#if SIBYTE_HDR_FEATURE(1480, PASS2) 619#if SIBYTE_HDR_FEATURE(1480, PASS2)
598#define S_BCM1480_MC_DLL_REGCTRL 54 620#define S_BCM1480_MC_DLL_REGCTRL 54
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
index c2dd2fe3047c..bda391d3af85 100644
--- a/include/asm-mips/sibyte/bcm1480_regs.h
+++ b/include/asm-mips/sibyte/bcm1480_regs.h
@@ -230,6 +230,7 @@
230 230
231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) 231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan))
232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) 232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan))
233#define A_BCM1480_DUART_IN_PORT(chan) (A_BCM1480_DUART(chan) + R_DUART_INP_ORT)
233 234
234/* 235/*
235 * These constants are the absolute addresses. 236 * These constants are the absolute addresses.
@@ -404,6 +405,21 @@
404#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */ 405#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */
405#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */ 406#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */
406 407
408/*
409 * these macros work together to build the address of a mailbox
410 * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2)
411 * for mbox_0_set_cpu2 returns 0x00100240C8
412 */
413#define R_BCM1480_IMR_MAILBOX_CPU 0x00
414#define R_BCM1480_IMR_MAILBOX_SET 0x08
415#define R_BCM1480_IMR_MAILBOX_CLR 0x10
416#define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20
417#define A_BCM1480_MAILBOX_REGISTER(num,reg,cpu) \
418 (A_BCM1480_IMR_CPU0_BASE + \
419 (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \
420 (cpu * BCM1480_IMR_REGISTER_SPACING) + \
421 (R_BCM1480_IMR_MAILBOX_0_CPU + reg))
422
407/* ********************************************************************* 423/* *********************************************************************
408 * System Performance Counter Registers (Section 4.7) 424 * System Performance Counter Registers (Section 4.7)
409 ********************************************************************* */ 425 ********************************************************************* */
@@ -428,6 +444,10 @@
428#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500 444#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
429#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508 445#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
430 446
447#define BCM1480_SCD_NUM_PERF_CNT 8
448#define BCM1480_SCD_PERF_CNT_SPACING 8
449#define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING))
450
431/* ********************************************************************* 451/* *********************************************************************
432 * System Bus Watcher Registers (Section 4.8) 452 * System Bus Watcher Registers (Section 4.8)
433 ********************************************************************* */ 453 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h
index 648bed96780f..6111d6dcf117 100644
--- a/include/asm-mips/sibyte/bcm1480_scd.h
+++ b/include/asm-mips/sibyte/bcm1480_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@
78#define K_SYS_PART_BCM1280 0x1206 78#define K_SYS_PART_BCM1280 0x1206
79#define K_SYS_PART_BCM1455 0x1407 79#define K_SYS_PART_BCM1455 0x1407
80#define K_SYS_PART_BCM1255 0x1257 80#define K_SYS_PART_BCM1255 0x1257
81#define K_SYS_PART_BCM1158 0x1156
81 82
82/* 83/*
83 * Manufacturing Information Register (Table 14) 84 * Manufacturing Information Register (Table 14)
@@ -237,58 +238,42 @@
237 * System Performance Counter Configuration Register (Table 31) 238 * System Performance Counter Configuration Register (Table 31)
238 * Register: PERF_CNT_CFG_0 239 * Register: PERF_CNT_CFG_0
239 * 240 *
240 * Since the clear/enable bits are moved compared to the 241 * SPC_CFG_SRC[0-3] is the same as the 1250.
241 * 1250 and there are more fields, this register will be BCM1480 specific. 242 * SPC_CFG_SRC[4-7] only exist on the 1480
243 * The clear/enable bits are in different locations on the 1250 and 1480.
242 */ 244 */
243 245
244#define S_BCM1480_SPC_CFG_SRC0 0 246#define S_SPC_CFG_SRC4 32
245#define M_BCM1480_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC0) 247#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_SPC_CFG_SRC4)
246#define V_BCM1480_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC0) 248#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC4)
247#define G_BCM1480_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC0,M_BCM1480_SPC_CFG_SRC0) 249#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_SPC_CFG_SRC4,M_SPC_CFG_SRC4)
248 250
249#define S_BCM1480_SPC_CFG_SRC1 8 251#define S_SPC_CFG_SRC5 40
250#define M_BCM1480_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC1) 252#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_SPC_CFG_SRC5)
251#define V_BCM1480_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC1) 253#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC5)
252#define G_BCM1480_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC1,M_BCM1480_SPC_CFG_SRC1) 254#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_SPC_CFG_SRC5,M_SPC_CFG_SRC5)
253 255
254#define S_BCM1480_SPC_CFG_SRC2 16 256#define S_SPC_CFG_SRC6 48
255#define M_BCM1480_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC2) 257#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_SPC_CFG_SRC6)
256#define V_BCM1480_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC2) 258#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC6)
257#define G_BCM1480_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC2,M_BCM1480_SPC_CFG_SRC2) 259#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_SPC_CFG_SRC6,M_SPC_CFG_SRC6)
258 260
259#define S_BCM1480_SPC_CFG_SRC3 24 261#define S_SPC_CFG_SRC7 56
260#define M_BCM1480_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC3) 262#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_SPC_CFG_SRC7)
261#define V_BCM1480_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC3) 263#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC7)
262#define G_BCM1480_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC3,M_BCM1480_SPC_CFG_SRC3) 264#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_SPC_CFG_SRC7,M_SPC_CFG_SRC7)
263
264#define S_BCM1480_SPC_CFG_SRC4 32
265#define M_BCM1480_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC4)
266#define V_BCM1480_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC4)
267#define G_BCM1480_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC4,M_BCM1480_SPC_CFG_SRC4)
268
269#define S_BCM1480_SPC_CFG_SRC5 40
270#define M_BCM1480_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC5)
271#define V_BCM1480_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC5)
272#define G_BCM1480_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC5,M_BCM1480_SPC_CFG_SRC5)
273
274#define S_BCM1480_SPC_CFG_SRC6 48
275#define M_BCM1480_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC6)
276#define V_BCM1480_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC6)
277#define G_BCM1480_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC6,M_BCM1480_SPC_CFG_SRC6)
278
279#define S_BCM1480_SPC_CFG_SRC7 56
280#define M_BCM1480_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC7)
281#define V_BCM1480_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC7)
282#define G_BCM1480_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC7,M_BCM1480_SPC_CFG_SRC7)
283 265
284/* 266/*
285 * System Performance Counter Control Register (Table 32) 267 * System Performance Counter Control Register (Table 32)
286 * Register: PERF_CNT_CFG_1 268 * Register: PERF_CNT_CFG_1
287 * BCM1480 specific 269 * BCM1480 specific
288 */ 270 */
289 271#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
290#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0) 272#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
291#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1) 273#if SIBYTE_HDR_FEATURE_CHIP(1480)
274#define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR
275#define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE
276#endif
292 277
293/* 278/*
294 * System Performance Counters (Table 33) 279 * System Performance Counters (Table 33)
@@ -405,20 +390,10 @@
405 * Trace Control Register (Table 49) 390 * Trace Control Register (Table 49)
406 * Register: TRACE_CFG 391 * Register: TRACE_CFG
407 * 392 *
408 * Bits 0..8 are the same as the BCM1250, rest are different. 393 * BCM1480 changes to this register (other than location of the CUR_ADDR field)
409 * Entire register is redefined below. 394 * are defined below.
410 */ 395 */
411 396
412#define M_BCM1480_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
413#define M_BCM1480_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
414#define M_BCM1480_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
415#define M_BCM1480_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
416#define M_BCM1480_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
417#define M_BCM1480_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
418#define M_BCM1480_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
419#define M_BCM1480_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
420#define M_BCM1480_SCD_TRACE_CFG_FORCE_CNT _SB_MAKEMASK1(8)
421
422#define S_BCM1480_SCD_TRACE_CFG_MODE 16 397#define S_BCM1480_SCD_TRACE_CFG_MODE 16
423#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE) 398#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE)
424#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE) 399#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE)
@@ -428,9 +403,4 @@
428#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1 403#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
429#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2 404#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
430 405
431#define S_BCM1480_SCD_TRACE_CFG_CUR_ADDR 24
432#define M_BCM1480_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
433#define V_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
434#define G_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR,M_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
435
436#endif /* _BCM1480_SCD_H */ 406#endif /* _BCM1480_SCD_H */
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
index 3dfe29ed42a8..73bce901a378 100644
--- a/include/asm-mips/sibyte/board.h
+++ b/include/asm-mips/sibyte/board.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation 2 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -19,8 +19,8 @@
19#ifndef _SIBYTE_BOARD_H 19#ifndef _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H 20#define _SIBYTE_BOARD_H
21 21
22
23#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ 22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \
23 defined(CONFIG_SIBYTE_PT1120) || defined(CONFIG_SIBYTE_PT1125) || \
24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ 24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
25 defined(CONFIG_SIBYTE_LITTLESUR) 25 defined(CONFIG_SIBYTE_LITTLESUR)
26#include <asm/sibyte/swarm.h> 26#include <asm/sibyte/swarm.h>
@@ -55,6 +55,16 @@
55#define setleds(t0,t1,c0,c1,c2,c3) 55#define setleds(t0,t1,c0,c1,c2,c3)
56#endif /* LEDS_PHYS */ 56#endif /* LEDS_PHYS */
57 57
58#else
59
60void swarm_setup(void);
61
62#ifdef LEDS_PHYS
63extern void setleds(char *str);
64#else
65#define setleds(s) do { } while (0)
66#endif /* LEDS_PHYS */
67
58#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
59 69
60#endif /* _SIBYTE_BOARD_H */ 70#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
index 57c53e62a37a..11cad71323e8 100644
--- a/include/asm-mips/sibyte/carmel.h
+++ b/include/asm-mips/sibyte/carmel.h
@@ -18,7 +18,6 @@
18#ifndef __ASM_SIBYTE_CARMEL_H 18#ifndef __ASM_SIBYTE_CARMEL_H
19#define __ASM_SIBYTE_CARMEL_H 19#define __ASM_SIBYTE_CARMEL_H
20 20
21
22#include <asm/sibyte/sb1250.h> 21#include <asm/sibyte/sb1250.h>
23#include <asm/sibyte/sb1250_int.h> 22#include <asm/sibyte/sb1250_int.h>
24 23
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
index 05c7b39f1b02..94e8299b0a2a 100644
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -45,8 +45,6 @@
45 * First, the interrupt numbers. 45 * First, the interrupt numbers.
46 */ 46 */
47 47
48#if SIBYTE_HDR_FEATURE_1250_112x
49
50#define K_INT_SOURCES 64 48#define K_INT_SOURCES 64
51 49
52#define K_INT_WATCHDOG_TIMER_0 0 50#define K_INT_WATCHDOG_TIMER_0 0
@@ -152,6 +150,7 @@
152#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) 150#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
153#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) 151#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
154#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) 152#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
153#define M_INT_MBOX_ALL _SB_MAKEMASK(4,K_INT_MBOX_0)
155#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
156#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT) 155#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
157#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT) 156#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
@@ -247,5 +246,3 @@
247 246
248 247
249#endif /* 1250/112x */ 248#endif /* 1250/112x */
250
251#endif
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index adfc688fa559..833c8b59d687 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -129,9 +129,9 @@
129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) 129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) 130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
131 131
132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) 133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
134#endif /* 1250 PASS2 || 112x PASS1 */ 134#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
135 135
136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) 137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
@@ -223,9 +223,9 @@
223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */ 224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
225#endif /* up to 1250 PASS1 */ 225#endif /* up to 1250 PASS1 */
226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH) 227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
228#endif /* 1250 PASS2 || 112x PASS1 */ 228#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) 229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) 230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
231 231
@@ -234,9 +234,9 @@
234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */ 235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
236#endif /* up to 1250 PASS1 */ 236#endif /* up to 1250 PASS1 */
237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH) 238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
239#endif /* 1250 PASS2 || 112x PASS1 */ 239#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) 240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) 241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
242 242
@@ -260,12 +260,12 @@
260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) 260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) 261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
262 262
263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) 264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56)
265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH) 265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH) 266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH) 267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
268#endif /* 1250 PASS2 || 112x PASS1 */ 268#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
269 269
270/* 270/*
271 * MAC Frame Configuration Registers (Table 9-15) 271 * MAC Frame Configuration Registers (Table 9-15)
@@ -462,9 +462,9 @@
462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) 462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44)
463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) 463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45)
464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) 464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46)
465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ 466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */
467#endif /* 1250 PASS2 || 112x PASS1 */ 467#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
468 468
469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47) 469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47)
470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) 470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
@@ -598,9 +598,9 @@
598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4) 598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4)
599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5) 599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5)
600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) 600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6)
601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) 602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7)
603#endif /* 1250 PASS2 || 112x PASS1 */ 603#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
604 604
605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) 605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8)
606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) 606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
index 26e421498c97..4fe848ffbc31 100644
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -295,7 +295,7 @@
295 295
296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36) 297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(38) 298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37)
299#endif /* 1250 PASS3 || 112x PASS1 */ 299#endif /* 1250 PASS3 || 112x PASS1 */
300 300
301 301
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index bab3a4580a36..da7c188993c9 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -131,6 +131,7 @@
131 131
132#endif 132#endif
133 133
134
134/* ********************************************************************* 135/* *********************************************************************
135 * PCI Interface Registers 136 * PCI Interface Registers
136 ********************************************************************* */ 137 ********************************************************************* */
@@ -239,14 +240,14 @@
239#define R_MAC_VLANTAG 0x00000110 240#define R_MAC_VLANTAG 0x00000110
240#define R_MAC_FRAMECFG 0x00000118 241#define R_MAC_FRAMECFG 0x00000118
241#define R_MAC_EOPCNT 0x00000120 242#define R_MAC_EOPCNT 0x00000120
242#define R_MAC_FIFO_PTRS 0x00000130 243#define R_MAC_FIFO_PTRS 0x00000128
243#define R_MAC_ADFILTER_CFG 0x00000200 244#define R_MAC_ADFILTER_CFG 0x00000200
244#define R_MAC_ETHERNET_ADDR 0x00000208 245#define R_MAC_ETHERNET_ADDR 0x00000208
245#define R_MAC_PKT_TYPE 0x00000210 246#define R_MAC_PKT_TYPE 0x00000210
246#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 247#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
247#define R_MAC_ADMASK0 0x00000218 248#define R_MAC_ADMASK0 0x00000218
248#define R_MAC_ADMASK1 0x00000220 249#define R_MAC_ADMASK1 0x00000220
249#endif /* 1250 PASS3 || 112x PASS1 */ 250#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
250#define R_MAC_HASH_BASE 0x00000240 251#define R_MAC_HASH_BASE 0x00000240
251#define R_MAC_ADDR_BASE 0x00000280 252#define R_MAC_ADDR_BASE 0x00000280
252#define R_MAC_CHLO0_BASE 0x00000300 253#define R_MAC_CHLO0_BASE 0x00000300
@@ -256,9 +257,9 @@
256#define R_MAC_INT_MASK 0x00000410 257#define R_MAC_INT_MASK 0x00000410
257#define R_MAC_TXD_CTL 0x00000420 258#define R_MAC_TXD_CTL 0x00000420
258#define R_MAC_MDIO 0x00000428 259#define R_MAC_MDIO 0x00000428
259#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 260#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
260#define R_MAC_STATUS1 0x00000430 261#define R_MAC_STATUS1 0x00000430
261#endif /* 1250 PASS2 || 112x PASS1 */ 262#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
262#define R_MAC_DEBUG_STATUS 0x00000448 263#define R_MAC_DEBUG_STATUS 0x00000448
263 264
264#define MAC_HASH_COUNT 8 265#define MAC_HASH_COUNT 8
@@ -289,11 +290,11 @@
289#define R_DUART_RX_HOLD 0x160 290#define R_DUART_RX_HOLD 0x160
290#define R_DUART_TX_HOLD 0x170 291#define R_DUART_TX_HOLD 0x170
291 292
292#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 293#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
293#define R_DUART_FULL_CTL 0x140 294#define R_DUART_FULL_CTL 0x140
294#define R_DUART_OPCR_X 0x180 295#define R_DUART_OPCR_X 0x180
295#define R_DUART_AUXCTL_X 0x190 296#define R_DUART_AUXCTL_X 0x190
296#endif /* 1250 PASS2 || 112x PASS1 */ 297#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
297 298
298 299
299/* 300/*
@@ -308,6 +309,7 @@
308#define R_DUART_IMR_B 0x350 309#define R_DUART_IMR_B 0x350
309#define R_DUART_OUT_PORT 0x360 310#define R_DUART_OUT_PORT 0x360
310#define R_DUART_OPCR 0x370 311#define R_DUART_OPCR 0x370
312#define R_DUART_IN_PORT 0x380
311 313
312#define R_DUART_SET_OPR 0x3B0 314#define R_DUART_SET_OPR 0x3B0
313#define R_DUART_CLEAR_OPR 0x3C0 315#define R_DUART_CLEAR_OPR 0x3C0
@@ -685,12 +687,17 @@
685#define A_ADDR_TRAP_REG_DEBUG 0x0010020460 687#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
686#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 688#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
687 689
690#define ADDR_TRAP_SPACING 8
691#define NUM_ADDR_TRAP 4
692#define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING))
693#define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING))
694#define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING))
695
688 696
689/* ********************************************************************* 697/* *********************************************************************
690 * System Interrupt Mapper Registers 698 * System Interrupt Mapper Registers
691 ********************************************************************* */ 699 ********************************************************************* */
692 700
693#if SIBYTE_HDR_FEATURE_1250_112x
694#define A_IMR_CPU0_BASE 0x0010020000 701#define A_IMR_CPU0_BASE 0x0010020000
695#define A_IMR_CPU1_BASE 0x0010022000 702#define A_IMR_CPU1_BASE 0x0010022000
696#define IMR_REGISTER_SPACING 0x2000 703#define IMR_REGISTER_SPACING 0x2000
@@ -700,6 +707,7 @@
700#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) 707#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg))
701 708
702#define R_IMR_INTERRUPT_DIAG 0x0010 709#define R_IMR_INTERRUPT_DIAG 0x0010
710#define R_IMR_INTERRUPT_LDT 0x0018
703#define R_IMR_INTERRUPT_MASK 0x0028 711#define R_IMR_INTERRUPT_MASK 0x0028
704#define R_IMR_INTERRUPT_TRACE 0x0038 712#define R_IMR_INTERRUPT_TRACE 0x0038
705#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 713#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
@@ -715,7 +723,14 @@
715#define R_IMR_INTERRUPT_STATUS_COUNT 7 723#define R_IMR_INTERRUPT_STATUS_COUNT 7
716#define R_IMR_INTERRUPT_MAP_BASE 0x0200 724#define R_IMR_INTERRUPT_MAP_BASE 0x0200
717#define R_IMR_INTERRUPT_MAP_COUNT 64 725#define R_IMR_INTERRUPT_MAP_COUNT 64
718#endif /* 1250/112x */ 726
727/*
728 * these macros work together to build the address of a mailbox
729 * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1)
730 * for mbox_0_set_cpu2 returns 0x00100240C8
731 */
732#define A_MAILBOX_REGISTER(reg,cpu) \
733 (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg)
719 734
720/* ********************************************************************* 735/* *********************************************************************
721 * System Performance Counter Registers 736 * System Performance Counter Registers
@@ -727,6 +742,10 @@
727#define A_SCD_PERF_CNT_2 0x00100204E0 742#define A_SCD_PERF_CNT_2 0x00100204E0
728#define A_SCD_PERF_CNT_3 0x00100204E8 743#define A_SCD_PERF_CNT_3 0x00100204E8
729 744
745#define SCD_NUM_PERF_CNT 4
746#define SCD_PERF_CNT_SPACING 8
747#define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING))
748
730/* ********************************************************************* 749/* *********************************************************************
731 * System Bus Watcher Registers 750 * System Bus Watcher Registers
732 ********************************************************************* */ 751 ********************************************************************* */
@@ -772,6 +791,15 @@
772#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 791#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
773#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 792#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
774 793
794#define TRACE_REGISTER_SPACING 8
795#define TRACE_NUM_REGISTERS 8
796#define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \
797 (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
798 (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING)))
799#define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \
800 (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
801 (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING)))
802
775/* ********************************************************************* 803/* *********************************************************************
776 * System Generic DMA Registers 804 * System Generic DMA Registers
777 ********************************************************************* */ 805 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index b6a7d8f6ced5..9ea3da367ab6 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -150,7 +150,7 @@
150 * (For the assembler version, sysrev and dest may be the same register. 150 * (For the assembler version, sysrev and dest may be the same register.
151 * Also, it clobbers AT.) 151 * Also, it clobbers AT.)
152 */ 152 */
153#ifdef __ASSEMBLY__ 153#ifdef __ASSEMBLER__
154#define SYS_SOC_TYPE(dest, sysrev) \ 154#define SYS_SOC_TYPE(dest, sysrev) \
155 .set push ; \ 155 .set push ; \
156 .set reorder ; \ 156 .set reorder ; \
@@ -214,6 +214,7 @@
214#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) 214#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
215#endif 215#endif
216 216
217
217/* 218/*
218 * System Config Register (Table 4-2) 219 * System Config Register (Table 4-2)
219 * Register: SCD_SYSTEM_CFG 220 * Register: SCD_SYSTEM_CFG
@@ -360,13 +361,13 @@
360 */ 361 */
361 362
362#define V_SCD_TIMER_FREQ 1000000 363#define V_SCD_TIMER_FREQ 1000000
363#define V_SCD_TIMER_WIDTH 23
364 364
365#define S_SCD_TIMER_INIT 0 365#define S_SCD_TIMER_INIT 0
366#define M_SCD_TIMER_INIT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_INIT) 366#define M_SCD_TIMER_INIT _SB_MAKEMASK(23,S_SCD_TIMER_INIT)
367#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) 367#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT)
368#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) 368#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT)
369 369
370#define V_SCD_TIMER_WIDTH 23
370#define S_SCD_TIMER_CNT 0 371#define S_SCD_TIMER_CNT 0
371#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT) 372#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT)
372#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) 373#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT)
@@ -380,7 +381,6 @@
380 * System Performance Counters 381 * System Performance Counters
381 */ 382 */
382 383
383#if SIBYTE_HDR_FEATURE_1250_112x
384#define S_SPC_CFG_SRC0 0 384#define S_SPC_CFG_SRC0 0
385#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) 385#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0)
386#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) 386#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0)
@@ -401,6 +401,7 @@
401#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) 401#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3)
402#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) 402#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3)
403 403
404#if SIBYTE_HDR_FEATURE_1250_112x
404#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) 405#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
405#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) 406#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
406#endif 407#endif
@@ -516,8 +517,6 @@
516 * Trace Buffer Config register 517 * Trace Buffer Config register
517 */ 518 */
518 519
519#if SIBYTE_HDR_FEATURE_1250_112x
520
521#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) 520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
522#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) 521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
523#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) 522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
@@ -526,17 +525,26 @@
526#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) 525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
527#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) 526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
528#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) 527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
529#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 528#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
530#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8) 529#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
531#endif /* 1250 PASS2 || 112x PASS1 */ 530#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
532 531
532/*
533 * This field is the same on the 1250/112x and 1480, just located in
534 * a slightly different place in the register.
535 */
536#if SIBYTE_HDR_FEATURE_1250_112x
533#define S_SCD_TRACE_CFG_CUR_ADDR 10 537#define S_SCD_TRACE_CFG_CUR_ADDR 10
538#else
539#if SIBYTE_HDR_FEATURE_CHIP(1480)
540#define S_SCD_TRACE_CFG_CUR_ADDR 24
541#endif /* 1480 */
542#endif /* 1250/112x */
543
534#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) 544#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR)
535#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) 545#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR)
536#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) 546#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR)
537 547
538#endif /* 1250/112x */
539
540/* 548/*
541 * Trace Event registers 549 * Trace Event registers
542 */ 550 */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
index 86db37e5ad85..540865fa7ec3 100644
--- a/include/asm-mips/sibyte/swarm.h
+++ b/include/asm-mips/sibyte/swarm.h
@@ -32,6 +32,18 @@
32#define SIBYTE_HAVE_IDE 1 32#define SIBYTE_HAVE_IDE 1
33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" 33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
34#endif 34#endif
35#ifdef CONFIG_SIBYTE_PT1120
36#define SIBYTE_BOARD_NAME "PT1120"
37#define SIBYTE_HAVE_PCMCIA 1
38#define SIBYTE_HAVE_IDE 1
39#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
40#endif
41#ifdef CONFIG_SIBYTE_PT1125
42#define SIBYTE_BOARD_NAME "PT1125"
43#define SIBYTE_HAVE_PCMCIA 1
44#define SIBYTE_HAVE_IDE 1
45#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
46#endif
35#ifdef CONFIG_SIBYTE_LITTLESUR 47#ifdef CONFIG_SIBYTE_LITTLESUR
36#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" 48#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
37#define SIBYTE_HAVE_PCMCIA 0 49#define SIBYTE_HAVE_PCMCIA 0
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 36ebe4e186a7..95945689b1c6 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -70,6 +70,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
70#define SO_SNDBUFFORCE 31 70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33 71#define SO_RCVBUFFORCE 33
72#define SO_PASSSEC 34 72#define SO_PASSSEC 34
73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
73 75
74#ifdef __KERNEL__ 76#ifdef __KERNEL__
75 77
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h
index 87a50bf039ed..ed1a5f78d22f 100644
--- a/include/asm-mips/sockios.h
+++ b/include/asm-mips/sockios.h
@@ -20,6 +20,7 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 23#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
24#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
24 25
25#endif /* _ASM_SOCKIOS_H */ 26#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index ce2eae1708b5..99e868f6a8f5 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -33,6 +33,8 @@
33#define SO_PEERCRED 0x4011 33#define SO_PEERCRED 0x4011
34#define SO_TIMESTAMP 0x4012 34#define SO_TIMESTAMP 0x4012
35#define SCM_TIMESTAMP SO_TIMESTAMP 35#define SCM_TIMESTAMP SO_TIMESTAMP
36#define SO_TIMESTAMPNS 0x4013
37#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
36 38
37/* Security levels - as per NRL IPv6 - don't actually do anything */ 39/* Security levels - as per NRL IPv6 - don't actually do anything */
38#define SO_SECURITY_AUTHENTICATION 0x4016 40#define SO_SECURITY_AUTHENTICATION 0x4016
diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h
index aace49629949..dabfbc7483f6 100644
--- a/include/asm-parisc/sockios.h
+++ b/include/asm-parisc/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index c8b1da50e72d..403e9fde2eb5 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -56,5 +56,7 @@
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58#define SO_PASSSEC 34 58#define SO_PASSSEC 34
59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
59 61
60#endif /* _ASM_POWERPC_SOCKET_H */ 62#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
index 590078d8ed28..55cef7675a31 100644
--- a/include/asm-powerpc/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_POWERPC_SOCKIOS_H */ 20#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index faa407f33c6b..aa40f92c298d 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -14,8 +14,6 @@
14#define __HAVE_ARCH_MEMCMP 14#define __HAVE_ARCH_MEMCMP
15#define __HAVE_ARCH_MEMCHR 15#define __HAVE_ARCH_MEMCHR
16 16
17extern int strcasecmp(const char *, const char *);
18extern int strncasecmp(const char *, const char *, __kernel_size_t);
19extern char * strcpy(char *,const char *); 17extern char * strcpy(char *,const char *);
20extern char * strncpy(char *,const char *, __kernel_size_t); 18extern char * strncpy(char *,const char *, __kernel_size_t);
21extern __kernel_size_t strlen(const char *); 19extern __kernel_size_t strlen(const char *);
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index 876898363944..838684dc6d35 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -1,27 +1,70 @@
1#ifndef _S390_BUG_H 1#ifndef _ASM_S390_BUG_H
2#define _S390_BUG_H 2#define _ASM_S390_BUG_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7 7
8static inline __attribute__((noreturn)) void __do_illegal_op(void) 8#ifdef CONFIG_64BIT
9{ 9#define S390_LONG ".quad"
10#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
11 __builtin_trap();
12#else 10#else
13 asm volatile(".long 0"); 11#define S390_LONG ".long"
14#endif 12#endif
15}
16 13
17#define BUG() do { \ 14#ifdef CONFIG_DEBUG_BUGVERBOSE
18 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 15
19 __do_illegal_op(); \ 16#define __EMIT_BUG(x) do { \
17 asm volatile( \
18 "0: j 0b+2\n" \
19 "1:\n" \
20 ".section .rodata.str,\"aMS\",@progbits,1\n" \
21 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \
25 " .short %0,%1\n" \
26 " .org 3b+%2\n" \
27 ".previous\n" \
28 : : "i" (__LINE__), \
29 "i" (x), \
30 "i" (sizeof(struct bug_entry))); \
20} while (0) 31} while (0)
21 32
33#else /* CONFIG_DEBUG_BUGVERBOSE */
34
35#define __EMIT_BUG(x) do { \
36 asm volatile( \
37 "0: j 0b+2\n" \
38 "1:\n" \
39 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \
41 " .short %0\n" \
42 " .org 2b+%1\n" \
43 ".previous\n" \
44 : : "i" (x), \
45 "i" (sizeof(struct bug_entry))); \
46} while (0)
47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49
50#define BUG() __EMIT_BUG(0)
51
52#define WARN_ON(x) ({ \
53 typeof(x) __ret_warn_on = (x); \
54 if (__builtin_constant_p(__ret_warn_on)) { \
55 if (__ret_warn_on) \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57 } else { \
58 if (unlikely(__ret_warn_on)) \
59 __EMIT_BUG(BUGFLAG_WARNING); \
60 } \
61 unlikely(__ret_warn_on); \
62})
63
22#define HAVE_ARCH_BUG 64#define HAVE_ARCH_BUG
23#endif 65#define HAVE_ARCH_WARN_ON
66#endif /* CONFIG_BUG */
24 67
25#include <asm-generic/bug.h> 68#include <asm-generic/bug.h>
26 69
27#endif 70#endif /* _ASM_S390_BUG_H */
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index d2f9c0d53a97..925b3ddfa141 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -11,6 +11,7 @@ struct ccwgroup_device {
11 CCWGROUP_ONLINE, 11 CCWGROUP_ONLINE,
12 } state; 12 } state;
13 atomic_t onoff; 13 atomic_t onoff;
14 struct mutex reg_mutex;
14 unsigned int count; /* number of attached slave devices */ 15 unsigned int count; /* number of attached slave devices */
15 struct device dev; /* master device */ 16 struct device dev; /* master device */
16 struct ccw_device *cdev[0]; /* variable number, allocate as needed */ 17 struct ccw_device *cdev[0]; /* variable number, allocate as needed */
diff --git a/include/asm-s390/chpid.h b/include/asm-s390/chpid.h
new file mode 100644
index 000000000000..b203336fd892
--- /dev/null
+++ b/include/asm-s390/chpid.h
@@ -0,0 +1,53 @@
1/*
2 * drivers/s390/cio/chpid.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CHPID_H
9#define _ASM_S390_CHPID_H _ASM_S390_CHPID_H
10
11#include <linux/string.h>
12#include <asm/types.h>
13#include <asm/cio.h>
14
15#define __MAX_CHPID 255
16
17struct chp_id {
18 u8 reserved1;
19 u8 cssid;
20 u8 reserved2;
21 u8 id;
22} __attribute__((packed));
23
24static inline void chp_id_init(struct chp_id *chpid)
25{
26 memset(chpid, 0, sizeof(struct chp_id));
27}
28
29static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
30{
31 return (a->id == b->id) && (a->cssid == b->cssid);
32}
33
34static inline void chp_id_next(struct chp_id *chpid)
35{
36 if (chpid->id < __MAX_CHPID)
37 chpid->id++;
38 else {
39 chpid->id = 0;
40 chpid->cssid++;
41 }
42}
43
44static inline int chp_id_is_valid(struct chp_id *chpid)
45{
46 return (chpid->cssid <= __MAX_CSSID);
47}
48
49
50#define chp_id_for_each(c) \
51 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
52
53#endif /* _ASM_S390_CHPID_H */
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index d92785030980..f738d2827582 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -13,6 +13,7 @@
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#define LPM_ANYPATH 0xff 15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0
16 17
17/* 18/*
18 * subchannel status word 19 * subchannel status word
@@ -292,6 +293,13 @@ extern void css_schedule_reprobe(void);
292 293
293extern void reipl_ccw_dev(struct ccw_dev_id *id); 294extern void reipl_ccw_dev(struct ccw_dev_id *id);
294 295
296struct cio_iplinfo {
297 u16 devno;
298 int is_qdio;
299};
300
301extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
302
295#endif 303#endif
296 304
297#endif 305#endif
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h
index 0eb64083480a..bdcd448d43fb 100644
--- a/include/asm-s390/ipl.h
+++ b/include/asm-s390/ipl.h
@@ -8,6 +8,8 @@
8#define _ASM_S390_IPL_H 8#define _ASM_S390_IPL_H
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <asm/cio.h>
12#include <asm/setup.h>
11 13
12#define IPL_PARMBLOCK_ORIGIN 0x2000 14#define IPL_PARMBLOCK_ORIGIN 0x2000
13 15
@@ -74,12 +76,12 @@ struct ipl_parameter_block {
74} __attribute__((packed)); 76} __attribute__((packed));
75 77
76/* 78/*
77 * IPL validity flags and parameters as detected in head.S 79 * IPL validity flags
78 */ 80 */
79extern u32 ipl_flags; 81extern u32 ipl_flags;
80extern u16 ipl_devno;
81 82
82extern u32 dump_prefix_page; 83extern u32 dump_prefix_page;
84
83extern void do_reipl(void); 85extern void do_reipl(void);
84extern void ipl_save_parameters(void); 86extern void ipl_save_parameters(void);
85 87
@@ -89,6 +91,35 @@ enum {
89 IPL_NSS_VALID = 4, 91 IPL_NSS_VALID = 4,
90}; 92};
91 93
94enum ipl_type {
95 IPL_TYPE_UNKNOWN = 1,
96 IPL_TYPE_CCW = 2,
97 IPL_TYPE_FCP = 4,
98 IPL_TYPE_FCP_DUMP = 8,
99 IPL_TYPE_NSS = 16,
100};
101
102struct ipl_info
103{
104 enum ipl_type type;
105 union {
106 struct {
107 struct ccw_dev_id dev_id;
108 } ccw;
109 struct {
110 struct ccw_dev_id dev_id;
111 u64 wwpn;
112 u64 lun;
113 } fcp;
114 struct {
115 char name[NSS_NAME_SIZE + 1];
116 } nss;
117 } data;
118};
119
120extern struct ipl_info ipl_info;
121extern void setup_ipl_info(void);
122
92/* 123/*
93 * DIAG 308 support 124 * DIAG 308 support
94 */ 125 */
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 4a31d0a7ee83..ffc9788a21a7 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -147,6 +147,52 @@ void pgm_check_handler(void);
147void mcck_int_handler(void); 147void mcck_int_handler(void);
148void io_int_handler(void); 148void io_int_handler(void);
149 149
150struct save_area_s390 {
151 u32 ext_save;
152 u64 timer;
153 u64 clk_cmp;
154 u8 pad1[24];
155 u8 psw[8];
156 u32 pref_reg;
157 u8 pad2[20];
158 u32 acc_regs[16];
159 u64 fp_regs[4];
160 u32 gp_regs[16];
161 u32 ctrl_regs[16];
162} __attribute__((packed));
163
164struct save_area_s390x {
165 u64 fp_regs[16];
166 u64 gp_regs[16];
167 u8 psw[16];
168 u8 pad1[8];
169 u32 pref_reg;
170 u32 fp_ctrl_reg;
171 u8 pad2[4];
172 u32 tod_reg;
173 u64 timer;
174 u64 clk_cmp;
175 u8 pad3[8];
176 u32 acc_regs[16];
177 u64 ctrl_regs[16];
178} __attribute__((packed));
179
180union save_area {
181 struct save_area_s390 s390;
182 struct save_area_s390x s390x;
183};
184
185#define SAVE_AREA_BASE_S390 0xd4
186#define SAVE_AREA_BASE_S390X 0x1200
187
188#ifndef __s390x__
189#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
191#else
192#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
193#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
194#endif
195
150struct _lowcore 196struct _lowcore
151{ 197{
152#ifndef __s390x__ 198#ifndef __s390x__
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 13c16546eff5..8fe8d42e64c3 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -753,14 +753,14 @@ ptep_establish(struct vm_area_struct *vma,
753 * should therefore only be called if it is not mapped in any 753 * should therefore only be called if it is not mapped in any
754 * address space. 754 * address space.
755 */ 755 */
756static inline int page_test_and_clear_dirty(struct page *page) 756static inline int page_test_dirty(struct page *page)
757{ 757{
758 unsigned long physpage = page_to_phys(page); 758 return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0;
759 int skey = page_get_storage_key(physpage); 759}
760 760
761 if (skey & _PAGE_CHANGED) 761static inline void page_clear_dirty(struct page *page)
762 page_set_storage_key(physpage, skey & ~_PAGE_CHANGED); 762{
763 return skey & _PAGE_CHANGED; 763 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY);
764} 764}
765 765
766/* 766/*
@@ -953,7 +953,8 @@ extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
953#define __HAVE_ARCH_PTEP_CLEAR_FLUSH 953#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
954#define __HAVE_ARCH_PTEP_SET_WRPROTECT 954#define __HAVE_ARCH_PTEP_SET_WRPROTECT
955#define __HAVE_ARCH_PTE_SAME 955#define __HAVE_ARCH_PTE_SAME
956#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 956#define __HAVE_ARCH_PAGE_TEST_DIRTY
957#define __HAVE_ARCH_PAGE_CLEAR_DIRTY
957#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 958#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
958#include <asm-generic/pgtable.h> 959#include <asm-generic/pgtable.h>
959 960
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 33b80ced4bc1..e0fcea8c64c3 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -57,6 +57,7 @@ struct cpuinfo_S390
57 57
58extern void s390_adjust_jiffies(void); 58extern void s390_adjust_jiffies(void);
59extern void print_cpu_info(struct cpuinfo_S390 *); 59extern void print_cpu_info(struct cpuinfo_S390 *);
60extern int get_cpu_capability(unsigned int *);
60 61
61/* Lazy FPU handling on uni-processor */ 62/* Lazy FPU handling on uni-processor */
62extern struct task_struct *last_task_used_math; 63extern struct task_struct *last_task_used_math;
@@ -196,6 +197,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
196extern char *task_show_regs(struct task_struct *task, char *buffer); 197extern char *task_show_regs(struct task_struct *task, char *buffer);
197 198
198extern void show_registers(struct pt_regs *regs); 199extern void show_registers(struct pt_regs *regs);
200extern void show_code(struct pt_regs *regs);
199extern void show_trace(struct task_struct *task, unsigned long *sp); 201extern void show_trace(struct task_struct *task, unsigned long *sp);
200 202
201unsigned long get_wchan(struct task_struct *p); 203unsigned long get_wchan(struct task_struct *p);
diff --git a/include/asm-s390/sclp.h b/include/asm-s390/sclp.h
index 468b97018405..21ed64773210 100644
--- a/include/asm-s390/sclp.h
+++ b/include/asm-s390/sclp.h
@@ -9,6 +9,7 @@
9#define _ASM_S390_SCLP_H 9#define _ASM_S390_SCLP_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/chpid.h>
12 13
13struct sccb_header { 14struct sccb_header {
14 u16 length; 15 u16 length;
@@ -33,7 +34,20 @@ struct sclp_readinfo_sccb {
33 u8 _reserved3[4096 - 112]; /* 112-4095 */ 34 u8 _reserved3[4096 - 112]; /* 112-4095 */
34} __attribute__((packed, aligned(4096))); 35} __attribute__((packed, aligned(4096)));
35 36
37#define SCLP_CHP_INFO_MASK_SIZE 32
38
39struct sclp_chp_info {
40 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
41 u8 standby[SCLP_CHP_INFO_MASK_SIZE];
42 u8 configured[SCLP_CHP_INFO_MASK_SIZE];
43};
44
36extern struct sclp_readinfo_sccb s390_readinfo_sccb; 45extern struct sclp_readinfo_sccb s390_readinfo_sccb;
37extern void sclp_readinfo_early(void); 46extern void sclp_readinfo_early(void);
47extern int sclp_sdias_blk_count(void);
48extern int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
49extern int sclp_chp_configure(struct chp_id chpid);
50extern int sclp_chp_deconfigure(struct chp_id chpid);
51extern int sclp_chp_read_info(struct sclp_chp_info *info);
38 52
39#endif /* _ASM_S390_SCLP_H */ 53#endif /* _ASM_S390_SCLP_H */
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 44c7aee2bd34..a76a6b8fd887 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -40,6 +40,7 @@ struct mem_chunk {
40}; 40};
41 41
42extern struct mem_chunk memory_chunk[]; 42extern struct mem_chunk memory_chunk[];
43extern unsigned long real_memory_size;
43 44
44#ifdef CONFIG_S390_SWITCH_AMODE 45#ifdef CONFIG_S390_SWITCH_AMODE
45extern unsigned int switch_amode; 46extern unsigned int switch_amode;
@@ -77,6 +78,7 @@ extern unsigned long machine_flags;
77#endif /* __s390x__ */ 78#endif /* __s390x__ */
78 79
79#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) 80#define MACHINE_HAS_SCLP (!MACHINE_IS_P390)
81#define ZFCPDUMP_HSA_SIZE (32UL<<20)
80 82
81/* 83/*
82 * Console mode. Override with conmode= 84 * Console mode. Override with conmode=
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index b957e4cda464..0a28e6d6ef40 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -54,9 +54,6 @@ extern int smp_call_function_on(void (*func) (void *info), void *info,
54 54
55#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) 55#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
56 56
57extern int smp_get_cpu(cpumask_t cpu_map);
58extern void smp_put_cpu(int cpu);
59
60static inline __u16 hard_smp_processor_id(void) 57static inline __u16 hard_smp_processor_id(void)
61{ 58{
62 __u16 cpu_address; 59 __u16 cpu_address;
@@ -114,9 +111,8 @@ static inline void smp_send_stop(void)
114} 111}
115 112
116#define smp_cpu_not_running(cpu) 1 113#define smp_cpu_not_running(cpu) 1
117#define smp_get_cpu(cpu) ({ 0; })
118#define smp_put_cpu(cpu) ({ 0; })
119#define smp_setup_cpu_possible_map() do { } while (0) 114#define smp_setup_cpu_possible_map() do { } while (0)
120#endif 115#endif
121 116
117extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
122#endif 118#endif
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 1778a49a74c5..1161ebe3dec9 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -57,5 +57,7 @@
57 57
58#define SO_PEERSEC 31 58#define SO_PEERSEC 31
59#define SO_PASSSEC 34 59#define SO_PASSSEC 34
60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
60 62
61#endif /* _ASM_SOCKET_H */ 63#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/sockios.h b/include/asm-s390/sockios.h
index 412aeb4dd6ce..f4fc16c7da59 100644
--- a/include/asm-s390/sockios.h
+++ b/include/asm-s390/sockios.h
@@ -15,6 +15,7 @@
15#define FIOGETOWN 0x8903 15#define FIOGETOWN 0x8903
16#define SIOCGPGRP 0x8904 16#define SIOCGPGRP 0x8904
17#define SIOCATMARK 0x8905 17#define SIOCATMARK 0x8905
18#define SIOCGSTAMP 0x8906 /* Get stamp */ 18#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
19#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19 20
20#endif 21#endif
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index ca70362eb563..c48d6fc9da38 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_SH_SOCKET_H */ 55#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/sockios.h b/include/asm-sh/sockios.h
index 08a71df8a8be..cf8b96b1f9ab 100644
--- a/include/asm-sh/sockios.h
+++ b/include/asm-sh/sockios.h
@@ -9,5 +9,6 @@
9#define SIOCSPGRP _IOW('s', 8, pid_t) 9#define SIOCSPGRP _IOW('s', 8, pid_t)
10#define SIOCGPGRP _IOR('s', 9, pid_t) 10#define SIOCGPGRP _IOR('s', 9, pid_t)
11 11
12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
13#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
13#endif /* __ASM_SH_SOCKIOS_H */ 14#endif /* __ASM_SH_SOCKIOS_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index 95bc7db006b0..55f8db6bc1d7 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -126,9 +126,6 @@ extern void *memchr(const void *__s, int __c, size_t __n);
126#define __HAVE_ARCH_STRLEN 126#define __HAVE_ARCH_STRLEN
127extern size_t strlen(const char *); 127extern size_t strlen(const char *);
128 128
129/* arch/sh/lib/strcasecmp.c */
130extern int strcasecmp(const char *, const char *);
131
132#endif /* __KERNEL__ */ 129#endif /* __KERNEL__ */
133 130
134#endif /* __ASM_SH_STRING_H */ 131#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh64/sockios.h b/include/asm-sh64/sockios.h
index 1ae23ae82977..419e76f12f41 100644
--- a/include/asm-sh64/sockios.h
+++ b/include/asm-sh64/sockios.h
@@ -20,5 +20,6 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
24#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
24#endif /* __ASM_SH64_SOCKIOS_H */ 25#endif /* __ASM_SH64_SOCKIOS_H */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 274868d8598d..9ea105ebe2ff 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -35,8 +35,8 @@ struct property {
35}; 35};
36 36
37struct device_node { 37struct device_node {
38 char *name; 38 const char *name;
39 char *type; 39 const char *type;
40 phandle node; 40 phandle node;
41 char *path_component_name; 41 char *path_component_name;
42 char *full_name; 42 char *full_name;
@@ -85,12 +85,14 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node); 85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node, 86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev); 87 struct device_node *prev);
88extern struct property *of_find_property(struct device_node *np, 88extern struct property *of_find_property(const struct device_node *np,
89 const char *name, 89 const char *name,
90 int *lenp); 90 int *lenp);
91extern int of_device_is_compatible(struct device_node *device, const char *); 91extern int of_device_is_compatible(const struct device_node *device,
92extern void *of_get_property(struct device_node *node, const char *name, 92 const char *);
93 int *lenp); 93extern const void *of_get_property(const struct device_node *node,
94 const char *name,
95 int *lenp);
94#define get_property(node,name,lenp) of_get_property(node,name,lenp) 96#define get_property(node,name,lenp) of_get_property(node,name,lenp)
95extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 97extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
96extern int of_getintprop_default(struct device_node *np, 98extern int of_getintprop_default(struct device_node *np,
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index f6c4e5baf3f7..7c1423997cf0 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/sockios.h b/include/asm-sparc/sockios.h
index 0c01b597b06f..990ea746486b 100644
--- a/include/asm-sparc/sockios.h
+++ b/include/asm-sparc/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index f2cc9411b4c7..e89922d6718c 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -17,8 +17,8 @@
17typedef struct { 17typedef struct {
18 /* Dcache line 1 */ 18 /* Dcache line 1 */
19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
20 unsigned int multiplier; 20 unsigned int __pad0_1;
21 unsigned int counter; 21 unsigned int __pad0_2;
22 unsigned int __pad1; 22 unsigned int __pad1;
23 unsigned long clock_tick; /* %tick's per second */ 23 unsigned long clock_tick; /* %tick's per second */
24 unsigned long udelay_val; 24 unsigned long udelay_val;
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
index d8f9872b0e2d..d5a4559b9555 100644
--- a/include/asm-sparc64/device.h
+++ b/include/asm-sparc64/device.h
@@ -3,5 +3,21 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef _ASM_SPARC64_DEVICE_H
7#define _ASM_SPARC64_DEVICE_H
7 8
9struct device_node;
10struct of_device;
11
12struct dev_archdata {
13 void *iommu;
14 void *stc;
15 void *host_controller;
16
17 struct device_node *prom_node;
18 struct of_device *op;
19
20 unsigned int msi_num;
21};
22
23#endif /* _ASM_SPARC64_DEVICE_H */
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index a4afe9d5703a..9c1c6db2a790 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -8,7 +8,6 @@
8#ifndef __SPARC64_EBUS_H 8#ifndef __SPARC64_EBUS_H
9#define __SPARC64_EBUS_H 9#define __SPARC64_EBUS_H
10 10
11#include <asm/pbm.h>
12#include <asm/oplib.h> 11#include <asm/oplib.h>
13#include <asm/prom.h> 12#include <asm/prom.h>
14#include <asm/of_device.h> 13#include <asm/of_device.h>
@@ -41,7 +40,6 @@ struct linux_ebus {
41 struct of_device ofdev; 40 struct of_device ofdev;
42 struct linux_ebus *next; 41 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 42 struct linux_ebus_device *devices;
44 struct pci_pbm_info *parent;
45 struct pci_dev *self; 43 struct pci_dev *self;
46 int index; 44 int index;
47 int is_rio; 45 int is_rio;
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 331013a0053e..4aa0925e1b1b 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -549,7 +549,7 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
549 if (!strcmp(edev->prom_node->name, "fdthree")) 549 if (!strcmp(edev->prom_node->name, "fdthree"))
550 return 1; 550 return 1;
551 if (!strcmp(edev->prom_node->name, "floppy")) { 551 if (!strcmp(edev->prom_node->name, "floppy")) {
552 char *compat; 552 const char *compat;
553 553
554 compat = of_get_property(edev->prom_node, 554 compat = of_get_property(edev->prom_node,
555 "compatible", NULL); 555 "compatible", NULL);
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 struct linux_ebus_device *edev = NULL; 661 struct linux_ebus_device *edev = NULL;
662 unsigned long config = 0; 662 unsigned long config = 0;
663 void __iomem *auxio_reg; 663 void __iomem *auxio_reg;
664 char *state_prop; 664 const char *state_prop;
665 665
666 for_each_ebus(ebus) { 666 for_each_ebus(ebus) {
667 for_each_ebusdev(edev, ebus) { 667 for_each_ebusdev(edev, ebus) {
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 30b912d8e8bc..ad595b679842 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -24,14 +24,6 @@ extern unsigned long kern_base, kern_size;
24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
25#define BIO_VMERGE_BOUNDARY 8192 25#define BIO_VMERGE_BOUNDARY 8192
26 26
27/* Different PCI controllers we support have their PCI MEM space
28 * mapped to an either 2GB (Psycho) or 4GB (Sabre) aligned area,
29 * so need to chop off the top 33 or 32 bits.
30 */
31extern unsigned long pci_memspace_mask;
32
33#define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask)
34
35static __inline__ u8 _inb(unsigned long addr) 27static __inline__ u8 _inb(unsigned long addr)
36{ 28{
37 u8 ret; 29 u8 ret;
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index 0de7a3da79cd..e199594a1e9b 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -7,15 +7,50 @@
7#define _SPARC64_IOMMU_H 7#define _SPARC64_IOMMU_H
8 8
9/* The format of an iopte in the page tables. */ 9/* The format of an iopte in the page tables. */
10#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ 10#define IOPTE_VALID 0x8000000000000000UL
11#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ 11#define IOPTE_64K 0x2000000000000000UL
12#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ 12#define IOPTE_STBUF 0x1000000000000000UL
13#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ 13#define IOPTE_INTRA 0x0800000000000000UL
14#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ 14#define IOPTE_CONTEXT 0x07ff800000000000UL
15#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ 15#define IOPTE_PAGE 0x00007fffffffe000UL
16#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ 16#define IOPTE_CACHE 0x0000000000000010UL
17#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ 17#define IOPTE_WRITE 0x0000000000000002UL
18 18
19#define IOMMU_NUM_CTXS 4096 19#define IOMMU_NUM_CTXS 4096
20 20
21struct iommu_arena {
22 unsigned long *map;
23 unsigned int hint;
24 unsigned int limit;
25};
26
27struct iommu {
28 spinlock_t lock;
29 struct iommu_arena arena;
30 iopte_t *page_table;
31 u32 page_table_map_base;
32 unsigned long iommu_control;
33 unsigned long iommu_tsbbase;
34 unsigned long iommu_flush;
35 unsigned long iommu_ctxflush;
36 unsigned long write_complete_reg;
37 unsigned long dummy_page;
38 unsigned long dummy_page_pa;
39 unsigned long ctx_lowest_free;
40 DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS);
41 u32 dma_addr_mask;
42};
43
44struct strbuf {
45 int strbuf_enabled;
46 unsigned long strbuf_control;
47 unsigned long strbuf_pflush;
48 unsigned long strbuf_fsync;
49 unsigned long strbuf_ctxflush;
50 unsigned long strbuf_ctxmatch_base;
51 unsigned long strbuf_flushflag_pa;
52 volatile unsigned long *strbuf_flushflag;
53 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)];
54};
55
21#endif /* !(_SPARC_IOMMU_H) */ 56#endif /* !(_SPARC_IOMMU_H) */
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index d9728b9031fc..ecd9290f78d4 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -7,7 +7,6 @@
7#ifndef __SPARC64_ISA_H 7#ifndef __SPARC64_ISA_H
8#define __SPARC64_ISA_H 8#define __SPARC64_ISA_H
9 9
10#include <asm/pbm.h>
11#include <asm/oplib.h> 10#include <asm/oplib.h>
12#include <asm/prom.h> 11#include <asm/prom.h>
13#include <asm/of_device.h> 12#include <asm/of_device.h>
@@ -29,7 +28,6 @@ struct sparc_isa_bridge {
29 struct of_device ofdev; 28 struct of_device ofdev;
30 struct sparc_isa_bridge *next; 29 struct sparc_isa_bridge *next;
31 struct sparc_isa_device *devices; 30 struct sparc_isa_device *devices;
32 struct pci_pbm_info *parent;
33 struct pci_dev *self; 31 struct pci_dev *self;
34 int index; 32 int index;
35 struct device_node *prom_node; 33 struct device_node *prom_node;
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 284dfd01a33d..6340a5253a34 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -103,7 +103,7 @@ static int ebus_ecpp_p(struct linux_ebus_device *edev)
103 if (!strcmp(edev->prom_node->name, "ecpp")) 103 if (!strcmp(edev->prom_node->name, "ecpp"))
104 return 1; 104 return 1;
105 if (!strcmp(edev->prom_node->name, "parallel")) { 105 if (!strcmp(edev->prom_node->name, "parallel")) {
106 char *compat; 106 const char *compat;
107 107
108 compat = of_get_property(edev->prom_node, 108 compat = of_get_property(edev->prom_node,
109 "compatible", NULL); 109 "compatible", NULL);
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 7a246d8a1828..c008cecca149 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -1,7 +1,6 @@
1/* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ 1/* pbm.h: UltraSparc PCI controller software state.
2 * pbm.h: UltraSparc PCI controller software state.
3 * 2 *
4 * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef __SPARC64_PBM_H 6#ifndef __SPARC64_PBM_H
@@ -30,90 +29,7 @@
30 * PCI bus. 29 * PCI bus.
31 */ 30 */
32 31
33struct pci_controller_info; 32extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
34
35/* This contains the software state necessary to drive a PCI
36 * controller's IOMMU.
37 */
38struct pci_iommu_arena {
39 unsigned long *map;
40 unsigned int hint;
41 unsigned int limit;
42};
43
44struct pci_iommu {
45 /* This protects the controller's IOMMU and all
46 * streaming buffers underneath.
47 */
48 spinlock_t lock;
49
50 struct pci_iommu_arena arena;
51
52 /* IOMMU page table, a linear array of ioptes. */
53 iopte_t *page_table; /* The page table itself. */
54
55 /* Base PCI memory space address where IOMMU mappings
56 * begin.
57 */
58 u32 page_table_map_base;
59
60 /* IOMMU Controller Registers */
61 unsigned long iommu_control; /* IOMMU control register */
62 unsigned long iommu_tsbbase; /* IOMMU page table base register */
63 unsigned long iommu_flush; /* IOMMU page flush register */
64 unsigned long iommu_ctxflush; /* IOMMU context flush register */
65
66 /* This is a register in the PCI controller, which if
67 * read will have no side-effects but will guarantee
68 * completion of all previous writes into IOMMU/STC.
69 */
70 unsigned long write_complete_reg;
71
72 /* In order to deal with some buggy third-party PCI bridges that
73 * do wrong prefetching, we never mark valid mappings as invalid.
74 * Instead we point them at this dummy page.
75 */
76 unsigned long dummy_page;
77 unsigned long dummy_page_pa;
78
79 /* CTX allocation. */
80 unsigned long ctx_lowest_free;
81 unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)];
82
83 /* Here a PCI controller driver describes the areas of
84 * PCI memory space where DMA to/from physical memory
85 * are addressed. Drivers interrogate the PCI layer
86 * if their device has addressing limitations. They
87 * do so via pci_dma_supported, and pass in a mask of
88 * DMA address bits their device can actually drive.
89 *
90 * The test for being usable is:
91 * (device_mask & dma_addr_mask) == dma_addr_mask
92 */
93 u32 dma_addr_mask;
94};
95
96extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
97
98/* This describes a PCI bus module's streaming buffer. */
99struct pci_strbuf {
100 int strbuf_enabled; /* Present and using it? */
101
102 /* Streaming Buffer Control Registers */
103 unsigned long strbuf_control; /* STC control register */
104 unsigned long strbuf_pflush; /* STC page flush register */
105 unsigned long strbuf_fsync; /* STC flush synchronization reg */
106 unsigned long strbuf_ctxflush; /* STC context flush register */
107 unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */
108 unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */
109 volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
110
111 /* And this is the actual flush flag area.
112 * We allocate extra because the chips require
113 * a 64-byte aligned area.
114 */
115 volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
116};
117 33
118#define PCI_STC_FLUSHFLAG_INIT(STC) \ 34#define PCI_STC_FLUSHFLAG_INIT(STC) \
119 (*((STC)->strbuf_flushflag) = 0UL) 35 (*((STC)->strbuf_flushflag) = 0UL)
@@ -126,6 +42,8 @@ struct pci_strbuf {
126#define PROM_PCIRNG_MAX 64 42#define PROM_PCIRNG_MAX 64
127#define PROM_PCIIMAP_MAX 64 43#define PROM_PCIIMAP_MAX 64
128 44
45struct pci_controller_info;
46
129struct pci_pbm_info { 47struct pci_pbm_info {
130 /* PCI controller we sit under. */ 48 /* PCI controller we sit under. */
131 struct pci_controller_info *parent; 49 struct pci_controller_info *parent;
@@ -160,11 +78,6 @@ struct pci_pbm_info {
160 78
161 /* OBP specific information. */ 79 /* OBP specific information. */
162 struct device_node *prom_node; 80 struct device_node *prom_node;
163 struct linux_prom_pci_ranges *pbm_ranges;
164 int num_pbm_ranges;
165 struct linux_prom_pci_intmap *pbm_intmap;
166 int num_pbm_intmap;
167 struct linux_prom_pci_intmask *pbm_intmask;
168 u64 ino_bitmap; 81 u64 ino_bitmap;
169 82
170 /* PBM I/O and Memory space resources. */ 83 /* PBM I/O and Memory space resources. */
@@ -197,13 +110,10 @@ struct pci_pbm_info {
197#endif /* !(CONFIG_PCI_MSI) */ 110#endif /* !(CONFIG_PCI_MSI) */
198 111
199 /* This PBM's streaming buffer. */ 112 /* This PBM's streaming buffer. */
200 struct pci_strbuf stc; 113 struct strbuf stc;
201 114
202 /* IOMMU state, potentially shared by both PBM segments. */ 115 /* IOMMU state, potentially shared by both PBM segments. */
203 struct pci_iommu *iommu; 116 struct iommu *iommu;
204
205 /* PCI slot mapping. */
206 unsigned int pci_first_slot;
207 117
208 /* Now things for the actual PCI bus probes. */ 118 /* Now things for the actual PCI bus probes. */
209 unsigned int pci_first_busno; 119 unsigned int pci_first_busno;
@@ -220,17 +130,12 @@ struct pci_controller_info {
220 */ 130 */
221 int index; 131 int index;
222 132
223 /* Do the PBMs both exist in the same PCI domain? */
224 int pbms_same_domain;
225
226 /* The PCI bus modules controlled by us. */ 133 /* The PCI bus modules controlled by us. */
227 struct pci_pbm_info pbm_A; 134 struct pci_pbm_info pbm_A;
228 struct pci_pbm_info pbm_B; 135 struct pci_pbm_info pbm_B;
229 136
230 /* Operations which are controller specific. */ 137 /* Operations which are controller specific. */
231 void (*scan_bus)(struct pci_controller_info *); 138 void (*scan_bus)(struct pci_controller_info *);
232 void (*base_address_update)(struct pci_dev *, int);
233 void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *);
234 139
235#ifdef CONFIG_PCI_MSI 140#ifdef CONFIG_PCI_MSI
236 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, 141 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev,
@@ -244,27 +149,4 @@ struct pci_controller_info {
244 unsigned int pci_last_busno; 149 unsigned int pci_last_busno;
245}; 150};
246 151
247/* PCI devices which are not bridges have this placed in their pci_dev
248 * sysdata member. This makes OBP aware PCI device drivers easier to
249 * code.
250 */
251struct pcidev_cookie {
252 struct pci_pbm_info *pbm;
253 struct device_node *prom_node;
254 struct of_device *op;
255 struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
256 int num_prom_regs;
257 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
258 int num_prom_assignments;
259#ifdef CONFIG_PCI_MSI
260 unsigned int msi_num;
261#endif
262};
263
264/* Currently these are the same across all PCI controllers
265 * we support. Someday they may not be...
266 */
267#define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */
268#define PCI_IRQ_INO 0x0000003f /* Interrupt Number */
269
270#endif /* !(__SPARC64_PBM_H) */ 152#endif /* !(__SPARC64_PBM_H) */
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index b14a725b430d..47cea16e1bad 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -54,7 +54,7 @@ struct pci_iommu_ops {
54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); 54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int);
55}; 55};
56 56
57extern struct pci_iommu_ops *pci_iommu_ops; 57extern const struct pci_iommu_ops *pci_iommu_ops;
58 58
59/* Allocate and map kernel buffer using consistent mode DMA for a device. 59/* Allocate and map kernel buffer using consistent mode DMA for a device.
60 * hwdev should be valid struct pci_dev pointer for PCI devices. 60 * hwdev should be valid struct pci_dev pointer for PCI devices.
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index b12be7a869f6..46705ef47d27 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -737,20 +737,6 @@ extern unsigned long pte_file(pte_t);
737extern pte_t pgoff_to_pte(unsigned long); 737extern pte_t pgoff_to_pte(unsigned long);
738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
739 739
740extern unsigned long prom_virt_to_phys(unsigned long, int *);
741
742extern unsigned long sun4u_get_pte(unsigned long);
743
744static inline unsigned long __get_phys(unsigned long addr)
745{
746 return sun4u_get_pte(addr);
747}
748
749static inline int __get_iospace(unsigned long addr)
750{
751 return ((sun4u_get_pte(addr) & 0xf0000000) >> 28);
752}
753
754extern unsigned long *sparc64_valid_addr_bitmap; 740extern unsigned long *sparc64_valid_addr_bitmap;
755 741
756/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 742/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
@@ -791,6 +777,8 @@ extern void pgtable_cache_init(void);
791extern void sun4v_register_fault_status(void); 777extern void sun4v_register_fault_status(void);
792extern void sun4v_ktsb_register(void); 778extern void sun4v_ktsb_register(void);
793 779
780extern unsigned long cmdline_memory_size;
781
794#endif /* !(__ASSEMBLY__) */ 782#endif /* !(__ASSEMBLY__) */
795 783
796#endif /* !(_SPARC64_PGTABLE_H) */ 784#endif /* !(_SPARC64_PGTABLE_H) */
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 0eca2d98627f..ddad5f99ac7f 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -36,8 +36,8 @@ struct property {
36 36
37struct of_irq_controller; 37struct of_irq_controller;
38struct device_node { 38struct device_node {
39 char *name; 39 const char *name;
40 char *type; 40 const char *type;
41 phandle node; 41 phandle node;
42 char *path_component_name; 42 char *path_component_name;
43 char *full_name; 43 char *full_name;
@@ -93,11 +93,13 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_get_parent(const struct device_node *node); 93extern struct device_node *of_get_parent(const struct device_node *node);
94extern struct device_node *of_get_next_child(const struct device_node *node, 94extern struct device_node *of_get_next_child(const struct device_node *node,
95 struct device_node *prev); 95 struct device_node *prev);
96extern struct property *of_find_property(struct device_node *np, 96extern struct property *of_find_property(const struct device_node *np,
97 const char *name, 97 const char *name,
98 int *lenp); 98 int *lenp);
99extern int of_device_is_compatible(struct device_node *device, const char *); 99extern int of_device_is_compatible(const struct device_node *device,
100extern void *of_get_property(struct device_node *node, const char *name, 100 const char *);
101extern const void *of_get_property(const struct device_node *node,
102 const char *name,
101 int *lenp); 103 int *lenp);
102#define get_property(node,name,lenp) of_get_property(node,name,lenp) 104#define get_property(node,name,lenp) of_get_property(node,name,lenp)
103extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 105extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 388249b751c3..cca54804b722 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -42,15 +42,15 @@ extern int hard_smp_processor_id(void);
42#define raw_smp_processor_id() (current_thread_info()->cpu) 42#define raw_smp_processor_id() (current_thread_info()->cpu)
43 43
44extern void smp_setup_cpu_possible_map(void); 44extern void smp_setup_cpu_possible_map(void);
45extern unsigned char boot_cpu_id;
45 46
46#endif /* !(__ASSEMBLY__) */ 47#endif /* !(__ASSEMBLY__) */
47 48
48#else 49#else
49 50
50#define smp_setup_cpu_possible_map() do { } while (0) 51#define smp_setup_cpu_possible_map() do { } while (0)
52#define boot_cpu_id (0)
51 53
52#endif /* !(CONFIG_SMP) */ 54#endif /* !(CONFIG_SMP) */
53 55
54#define NO_PROC_ID 0xFF
55
56#endif /* !(_SPARC64_SMP_H) */ 56#endif /* !(_SPARC64_SMP_H) */
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 754d46a50af3..986441dcb8f0 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc64/sockios.h b/include/asm-sparc64/sockios.h
index 6735bab4f39d..c7d9900638d0 100644
--- a/include/asm-sparc64/sockios.h
+++ b/include/asm-sparc64/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC64_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC64_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h
index ed5c9d8541e2..77bcd2bfa53c 100644
--- a/include/asm-sparc64/sparsemem.h
+++ b/include/asm-sparc64/sparsemem.h
@@ -3,7 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#define SECTION_SIZE_BITS 26 6#define SECTION_SIZE_BITS 31
7#define MAX_PHYSADDR_BITS 42 7#define MAX_PHYSADDR_BITS 42
8#define MAX_PHYSMEM_BITS 42 8#define MAX_PHYSMEM_BITS 42
9 9
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h
index d435594df786..ccbd69448866 100644
--- a/include/asm-sparc64/timer.h
+++ b/include/asm-sparc64/timer.h
@@ -11,22 +11,19 @@
11 11
12 12
13struct sparc64_tick_ops { 13struct sparc64_tick_ops {
14 void (*init_tick)(unsigned long);
15 unsigned long (*get_tick)(void); 14 unsigned long (*get_tick)(void);
16 unsigned long (*get_compare)(void); 15 int (*add_compare)(unsigned long);
17 unsigned long (*add_tick)(unsigned long, unsigned long);
18 unsigned long (*add_compare)(unsigned long);
19 unsigned long softint_mask; 16 unsigned long softint_mask;
17 void (*disable_irq)(void);
18
19 void (*init_tick)(void);
20 unsigned long (*add_tick)(unsigned long);
21
22 char *name;
20}; 23};
21 24
22extern struct sparc64_tick_ops *tick_ops; 25extern struct sparc64_tick_ops *tick_ops;
23 26
24#ifdef CONFIG_SMP
25extern unsigned long timer_tick_offset;
26struct pt_regs;
27extern void timer_tick_interrupt(struct pt_regs *);
28#endif
29
30extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 27extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
31 28
32#endif /* _SPARC64_TIMER_H */ 29#endif /* _SPARC64_TIMER_H */
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index c2a16e188499..bbb9c8f13d61 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -157,23 +157,6 @@
157 ba,a,pt %xcc, rtrap_irq; \ 157 ba,a,pt %xcc, rtrap_irq; \
158 .previous; 158 .previous;
159 159
160#define TICK_SMP_IRQ \
161 rdpr %pil, %g2; \
162 wrpr %g0, 15, %pil; \
163 sethi %hi(1f-4), %g7; \
164 ba,pt %xcc, etrap_irq; \
165 or %g7, %lo(1f-4), %g7; \
166 nop; \
167 nop; \
168 nop; \
169 .subsection 2; \
1701: call trace_hardirqs_off; \
171 nop; \
172 call smp_percpu_timer_interrupt; \
173 add %sp, PTREGS_OFF, %o0; \
174 ba,a,pt %xcc, rtrap_irq; \
175 .previous;
176
177#else 160#else
178 161
179#define TRAP_IRQ(routine, level) \ 162#define TRAP_IRQ(routine, level) \
@@ -186,16 +169,6 @@
186 add %sp, PTREGS_OFF, %o1; \ 169 add %sp, PTREGS_OFF, %o1; \
187 ba,a,pt %xcc, rtrap_irq; 170 ba,a,pt %xcc, rtrap_irq;
188 171
189#define TICK_SMP_IRQ \
190 rdpr %pil, %g2; \
191 wrpr %g0, 15, %pil; \
192 sethi %hi(109f), %g7; \
193 ba,pt %xcc, etrap_irq; \
194109: or %g7, %lo(109b), %g7; \
195 call smp_percpu_timer_interrupt; \
196 add %sp, PTREGS_OFF, %o0; \
197 ba,a,pt %xcc, rtrap_irq;
198
199#endif 172#endif
200 173
201#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 174#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h
index 1e17f7409cab..7b73b2cd5b34 100644
--- a/include/asm-um/div64.h
+++ b/include/asm-um/div64.h
@@ -3,4 +3,5 @@
3 3
4#include "asm/arch/div64.h" 4#include "asm/arch/div64.h"
5 5
6extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
6#endif 7#endif
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index 0dfe55ac2ef2..a4c2493b025f 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __V850_SOCKET_H__ */ 55#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-v850/sockios.h b/include/asm-v850/sockios.h
index cf4874c2fd8a..823e106e6cd0 100644
--- a/include/asm-v850/sockios.h
+++ b/include/asm-v850/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __V850_SOCKIOS_H__ */ 13#endif /* __V850_SOCKIOS_H__ */
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index b46702607933..90af60cf3c0e 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86_64/sockios.h b/include/asm-x86_64/sockios.h
index 2eefd10d4f48..d726ba2513e3 100644
--- a/include/asm-x86_64/sockios.h
+++ b/include/asm-x86_64/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h
index c4a105776383..20965e3af1dd 100644
--- a/include/asm-xtensa/div64.h
+++ b/include/asm-xtensa/div64.h
@@ -11,9 +11,15 @@
11#ifndef _XTENSA_DIV64_H 11#ifndef _XTENSA_DIV64_H
12#define _XTENSA_DIV64_H 12#define _XTENSA_DIV64_H
13 13
14#include <linux/types.h>
15
14#define do_div(n,base) ({ \ 16#define do_div(n,base) ({ \
15 int __res = n % ((unsigned int) base); \ 17 int __res = n % ((unsigned int) base); \
16 n /= (unsigned int) base; \ 18 n /= (unsigned int) base; \
17 __res; }) 19 __res; })
18 20
21static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
22{
23 return dividend / divisor;
24}
19#endif 25#endif
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 971d231be60e..1f5aeacb9da2 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -60,5 +60,7 @@
60#define SO_ACCEPTCONN 30 60#define SO_ACCEPTCONN 30
61#define SO_PEERSEC 31 61#define SO_PEERSEC 31
62#define SO_PASSSEC 34 62#define SO_PASSSEC 34
63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
63 65
64#endif /* _XTENSA_SOCKET_H */ 66#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h
index 20d2ba10ecd1..efe0af379f01 100644
--- a/include/asm-xtensa/sockios.h
+++ b/include/asm-xtensa/sockios.h
@@ -25,6 +25,7 @@
25#define SIOCSPGRP _IOW('s', 8, pid_t) 25#define SIOCSPGRP _IOW('s', 8, pid_t)
26#define SIOCGPGRP _IOR('s', 9, pid_t) 26#define SIOCGPGRP _IOR('s', 9, pid_t)
27 27
28#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 28#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
29#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
29 30
30#endif /* _XTENSA_SOCKIOS_H */ 31#endif /* _XTENSA_SOCKIOS_H */
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
new file mode 100644
index 000000000000..e2ee73aef0ee
--- /dev/null
+++ b/include/keys/rxrpc-type.h
@@ -0,0 +1,22 @@
1/* RxRPC key type
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_RXRPC_TYPE_H
13#define _KEYS_RXRPC_TYPE_H
14
15#include <linux/key.h>
16
17/*
18 * key type for AF_RXRPC keys
19 */
20extern struct key_type key_type_rxrpc;
21
22#endif /* _KEYS_USER_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e81e301a4d71..4ff0f57d0add 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -69,9 +69,7 @@ header-y += hdsmart.h
69header-y += hysdn_if.h 69header-y += hysdn_if.h
70header-y += i2c-dev.h 70header-y += i2c-dev.h
71header-y += i8k.h 71header-y += i8k.h
72header-y += icmp.h
73header-y += if_arcnet.h 72header-y += if_arcnet.h
74header-y += if_arp.h
75header-y += if_bonding.h 73header-y += if_bonding.h
76header-y += if_cablemodem.h 74header-y += if_cablemodem.h
77header-y += if_fc.h 75header-y += if_fc.h
@@ -88,7 +86,6 @@ header-y += if_tunnel.h
88header-y += in6.h 86header-y += in6.h
89header-y += in_route.h 87header-y += in_route.h
90header-y += ioctl.h 88header-y += ioctl.h
91header-y += ip.h
92header-y += ipmi_msgdefs.h 89header-y += ipmi_msgdefs.h
93header-y += ip_mp_alg.h 90header-y += ip_mp_alg.h
94header-y += ipsec.h 91header-y += ipsec.h
@@ -116,6 +113,7 @@ header-y += netrom.h
116header-y += nfs2.h 113header-y += nfs2.h
117header-y += nfs4_mount.h 114header-y += nfs4_mount.h
118header-y += nfs_mount.h 115header-y += nfs_mount.h
116header-y += nl80211.h
119header-y += oom.h 117header-y += oom.h
120header-y += param.h 118header-y += param.h
121header-y += pci_regs.h 119header-y += pci_regs.h
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h
210unifdef-y += hpet.h 208unifdef-y += hpet.h
211unifdef-y += i2c.h 209unifdef-y += i2c.h
212unifdef-y += i2o-dev.h 210unifdef-y += i2o-dev.h
211unifdef-y += icmp.h
213unifdef-y += icmpv6.h 212unifdef-y += icmpv6.h
214unifdef-y += if_addr.h 213unifdef-y += if_addr.h
214unifdef-y += if_arp.h
215unifdef-y += if_bridge.h 215unifdef-y += if_bridge.h
216unifdef-y += if_ec.h 216unifdef-y += if_ec.h
217unifdef-y += if_eql.h 217unifdef-y += if_eql.h
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h
231unifdef-y += in.h 231unifdef-y += in.h
232unifdef-y += inotify.h 232unifdef-y += inotify.h
233unifdef-y += input.h 233unifdef-y += input.h
234unifdef-y += ip.h
234unifdef-y += ipc.h 235unifdef-y += ipc.h
235unifdef-y += ipmi.h 236unifdef-y += ipmi.h
236unifdef-y += ipv6.h 237unifdef-y += ipv6.h
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d12984ddaa9f..ced8a1ed080c 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -101,7 +101,7 @@ struct ddpehdr {
101 101
102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) 102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
103{ 103{
104 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb_transport_header(skb);
105} 105}
106 106
107/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
@@ -129,7 +129,7 @@ struct elapaarp {
129 129
130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
131{ 131{
132 return (struct elapaarp *)skb->h.raw; 132 return (struct elapaarp *)skb_transport_header(skb);
133} 133}
134 134
135/* Not specified - how long till we drop a resolved entry */ 135/* Not specified - how long till we drop a resolved entry */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 1cb054bd93f2..fda2148d8c85 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -260,19 +260,20 @@ enum {
260 260
261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
262{ 262{
263 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb_transport_header(skb);
264} 264}
265 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) 266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{ 267{
268 skb->h.raw = skb_push(skb, headlen); 268 skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen); 269 skb_reset_transport_header(skb);
270 return dccp_hdr(skb); 270 return memset(skb_transport_header(skb), 0, headlen);
271} 271}
272 272
273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
274{ 274{
275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
276 sizeof(struct dccp_hdr));
276} 277}
277 278
278static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) 279static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
301 302
302static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) 303static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
303{ 304{
304 return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); 305 return (struct dccp_hdr_request *)(skb_transport_header(skb) +
306 dccp_basic_hdr_len(skb));
305} 307}
306 308
307static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) 309static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
308{ 310{
309 return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); 311 return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
312 dccp_basic_hdr_len(skb));
310} 313}
311 314
312static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 315static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
317 320
318static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 321static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
319{ 322{
320 return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); 323 return (struct dccp_hdr_response *)(skb_transport_header(skb) +
324 dccp_basic_hdr_len(skb));
321} 325}
322 326
323static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) 327static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
324{ 328{
325 return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); 329 return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
330 dccp_basic_hdr_len(skb));
326} 331}
327 332
328static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) 333static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
@@ -460,26 +465,27 @@ struct dccp_ackvec;
460 * @dccps_service_list - second .. last service code on passive socket 465 * @dccps_service_list - second .. last service code on passive socket
461 * @dccps_timestamp_time - time of latest TIMESTAMP option 466 * @dccps_timestamp_time - time of latest TIMESTAMP option
462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 467 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
463 * @dccps_l_ack_ratio - 468 * @dccps_l_ack_ratio - feature-local Ack Ratio
464 * @dccps_r_ack_ratio - 469 * @dccps_r_ack_ratio - feature-remote Ack Ratio
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 470 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 471 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
467 * @dccps_ndp_count - number of Non Data Packets since last data packet 472 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache - 473 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
469 * @dccps_minisock - 474 * @dccps_minisock - associated minisock (accessed via dccp_msk)
470 * @dccps_hc_rx_ackvec - rx half connection ack vector 475 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid - 476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
472 * @dccps_hc_tx_ccid - 477 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
473 * @dccps_options_received - 478 * @dccps_options_received - parsed set of retrieved options
474 * @dccps_epoch - 479 * @dccps_role - role of this sock, one of %dccp_role
475 * @dccps_role - Role of this sock, one of %dccp_role 480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
476 * @dccps_hc_rx_insert_options - 481 * @dccps_hc_tx_insert_options - sender wants to add options when sending
477 * @dccps_hc_tx_insert_options -
478 * @dccps_xmit_timer - timer for when CCID is not ready to send 482 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
479 */ 484 */
480struct dccp_sock { 485struct dccp_sock {
481 /* inet_connection_sock has to be the first member of dccp_sock */ 486 /* inet_connection_sock has to be the first member of dccp_sock */
482 struct inet_connection_sock dccps_inet_connection; 487 struct inet_connection_sock dccps_inet_connection;
488#define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
483 __u64 dccps_swl; 489 __u64 dccps_swl;
484 __u64 dccps_swh; 490 __u64 dccps_swh;
485 __u64 dccps_awl; 491 __u64 dccps_awl;
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 8270aac2aa5d..87b606b63f1e 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,8 +5,13 @@
5#include <linux/rtnetlink.h> 5#include <linux/rtnetlink.h>
6 6
7/* rule is permanent, and cannot be deleted */ 7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1 8#define FIB_RULE_PERMANENT 0x00000001
9#define FIB_RULE_INVERT 2 9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004
11#define FIB_RULE_DEV_DETACHED 0x00000008
12
13/* try to find source address in routing lookups */
14#define FIB_RULE_FIND_SADDR 0x00010000
10 15
11struct fib_rule_hdr 16struct fib_rule_hdr
12{ 17{
@@ -29,7 +34,7 @@ enum
29 FRA_DST, /* destination address */ 34 FRA_DST, /* destination address */
30 FRA_SRC, /* source address */ 35 FRA_SRC, /* source address */
31 FRA_IFNAME, /* interface name */ 36 FRA_IFNAME, /* interface name */
32 FRA_UNUSED1, 37 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
33 FRA_UNUSED2, 38 FRA_UNUSED2,
34 FRA_PRIORITY, /* priority/preference */ 39 FRA_PRIORITY, /* priority/preference */
35 FRA_UNUSED3, 40 FRA_UNUSED3,
@@ -51,8 +56,8 @@ enum
51{ 56{
52 FR_ACT_UNSPEC, 57 FR_ACT_UNSPEC,
53 FR_ACT_TO_TBL, /* Pass to fixed table */ 58 FR_ACT_TO_TBL, /* Pass to fixed table */
54 FR_ACT_RES1, 59 FR_ACT_GOTO, /* Jump to another rule */
55 FR_ACT_RES2, 60 FR_ACT_NOP, /* No operation */
56 FR_ACT_RES3, 61 FR_ACT_RES3,
57 FR_ACT_RES4, 62 FR_ACT_RES4,
58 FR_ACT_BLACKHOLE, /* Drop without notification */ 63 FR_ACT_BLACKHOLE, /* Drop without notification */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 86ec3f4a7da6..095a9c9a64fb 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -843,8 +843,13 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
843extern int fcntl_getlease(struct file *filp); 843extern int fcntl_getlease(struct file *filp);
844 844
845/* fs/sync.c */ 845/* fs/sync.c */
846extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, 846extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
847 unsigned int flags); 847 loff_t endbyte, unsigned int flags);
848static inline int do_sync_file_range(struct file *file, loff_t offset,
849 loff_t endbyte, unsigned int flags)
850{
851 return do_sync_mapping_range(file->f_mapping, offset, endbyte, flags);
852}
848 853
849/* fs/locks.c */ 854/* fs/locks.c */
850extern void locks_init_lock(struct file_lock *); 855extern void locks_init_lock(struct file_lock *);
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d4b333938f73..0fe562af9c8c 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -132,8 +132,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
132{ 132{
133 hdlc_device *hdlc = dev_to_hdlc(dev); 133 hdlc_device *hdlc = dev_to_hdlc(dev);
134 134
135 skb->mac.raw = skb->data; 135 skb->dev = dev;
136 skb->dev = dev; 136 skb_reset_mac_header(skb);
137 137
138 if (hdlc->proto->type_trans) 138 if (hdlc->proto->type_trans)
139 return hdlc->proto->type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 24da4fbc1a2f..474f2a51cf0a 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -82,6 +82,15 @@ struct icmphdr {
82 } un; 82 } un;
83}; 83};
84 84
85#ifdef __KERNEL__
86#include <linux/skbuff.h>
87
88static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
89{
90 return (struct icmphdr *)skb_transport_header(skb);
91}
92#endif
93
85/* 94/*
86 * constants for (set|get)sockopt 95 * constants for (set|get)sockopt
87 */ 96 */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 68d3526c3a05..7c5e9817e998 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -75,6 +75,15 @@ struct icmp6hdr {
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref 75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
76}; 76};
77 77
78#ifdef __KERNEL__
79#include <linux/skbuff.h>
80
81static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
82{
83 return (struct icmp6hdr *)skb_transport_header(skb);
84}
85#endif
86
78#define ICMPV6_ROUTER_PREF_LOW 0x3 87#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 88#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1 89#define ICMPV6_ROUTER_PREF_HIGH 0x1
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index d557e4ce9b6b..43f3bedaafd3 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -39,6 +39,7 @@ enum
39#define IFA_F_TEMPORARY IFA_F_SECONDARY 39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40 40
41#define IFA_F_NODAD 0x02 41#define IFA_F_NODAD 0x02
42#define IFA_F_OPTIMISTIC 0x04
42#define IFA_F_HOMEADDRESS 0x10 43#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20 44#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40 45#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 7f5714214ee3..ed7b93c3083a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -148,4 +148,13 @@ struct arphdr
148 148
149}; 149};
150 150
151#ifdef __KERNEL__
152#include <linux/skbuff.h>
153
154static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
155{
156 return (struct arphdr *)skb_network_header(skb);
157}
158#endif
159
151#endif /* _LINUX_IF_ARP_H */ 160#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd1b6eb94a5f..4ff211d98769 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -105,7 +105,8 @@ struct __fdb_entry
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)(unsigned int, void __user *));
108extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb);
109extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff **pskb);
110 111
111#endif 112#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index ab08f35cbc35..1db774cf9dc2 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 65#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 66#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
66 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 67 * defined in draft-wilson-wrec-wccp-v2-00.txt */
@@ -112,7 +113,7 @@ struct ethhdr {
112 113
113static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 114static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
114{ 115{
115 return (struct ethhdr *)skb->mac.raw; 116 return (struct ethhdr *)skb_mac_header(skb);
116} 117}
117 118
118#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5467f3..604c2434f71c 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
126 IFLA_INET6_STATS, /* statistics */ 126 IFLA_INET6_STATS, /* statistics */
127 IFLA_INET6_MCAST, /* MC things. What of them? */ 127 IFLA_INET6_MCAST, /* MC things. What of them? */
128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
129 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
129 __IFLA_INET6_MAX 130 __IFLA_INET6_MAX
130}; 131};
131 132
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index f3de05c30678..ad09609227ff 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -42,6 +42,7 @@ struct sockaddr_ll
42#define PACKET_STATISTICS 6 42#define PACKET_STATISTICS 6
43#define PACKET_COPY_THRESH 7 43#define PACKET_COPY_THRESH 7
44#define PACKET_AUXDATA 8 44#define PACKET_AUXDATA 8
45#define PACKET_ORIGDEV 9
45 46
46struct tpacket_stats 47struct tpacket_stats
47{ 48{
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e33ee763c052..6f987be60fe2 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -111,7 +111,17 @@ struct pppoe_hdr {
111 struct pppoe_tag tag[0]; 111 struct pppoe_tag tag[0];
112} __attribute__ ((packed)); 112} __attribute__ ((packed));
113 113
114/* Length of entire PPPoE + PPP header */
115#define PPPOE_SES_HLEN 8
116
114#ifdef __KERNEL__ 117#ifdef __KERNEL__
118#include <linux/skbuff.h>
119
120static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
121{
122 return (struct pppoe_hdr *)skb_network_header(skb);
123}
124
115struct pppoe_opt { 125struct pppoe_opt {
116 struct net_device *dev; /* device associated with socket*/ 126 struct net_device *dev; /* device associated with socket*/
117 int ifindex; /* ifindex of device associated with socket */ 127 int ifindex; /* ifindex of device associated with socket */
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 2f94cf2c7abb..046e9d95ba9a 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -47,7 +47,7 @@ struct trh_hdr {
47 47
48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) 48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb->mac.raw; 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL 52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[]; 53extern struct ctl_table tr_table[];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d103580c72d2..81e9bc93569b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -51,7 +51,7 @@ struct vlan_ethhdr {
51 51
52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) 52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
53{ 53{
54 return (struct vlan_ethhdr *)skb->mac.raw; 54 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 55}
56 56
57struct vlan_hdr { 57struct vlan_hdr {
@@ -275,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
275 veth->h_vlan_TCI = htons(tag); 275 veth->h_vlan_TCI = htons(tag);
276 276
277 skb->protocol = __constant_htons(ETH_P_8021Q); 277 skb->protocol = __constant_htons(ETH_P_8021Q);
278 skb->mac.raw -= VLAN_HLEN; 278 skb->mac_header -= VLAN_HLEN;
279 skb->nh.raw -= VLAN_HLEN; 279 skb->network_header -= VLAN_HLEN;
280 280
281 return skb; 281 return skb;
282} 282}
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h
deleted file mode 100644
index 6e5461d69fdd..000000000000
--- a/include/linux/if_wanpipe_common.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*****************************************************************************
2* if_wanipe_common.h Sangoma Driver/Socket common area definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Jan 13, 2000 Nenad Corbic Initial version
14*****************************************************************************/
15
16
17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
18#define _WANPIPE_SOCK_DRIVER_COMMON_H
19
20typedef struct {
21 struct net_device *slave;
22 atomic_t packet_sent;
23 atomic_t receive_block;
24 atomic_t command;
25 atomic_t disconnect;
26 atomic_t driver_busy;
27 long common_critical;
28 struct timer_list *tx_timer;
29 struct sock *sk; /* Wanpipe Sock bind's here */
30 int (*func)(struct sk_buff *skb, struct net_device *dev,
31 struct sock *sk);
32
33 struct work_struct wanpipe_work; /* deferred keventd work */
34 unsigned char rw_bind; /* Sock bind state */
35 unsigned char usedby;
36 unsigned char state;
37 unsigned char svc;
38 unsigned short lcn;
39 void *mbox;
40} wanpipe_common_t;
41
42
43enum {
44 WANSOCK_UNCONFIGURED, /* link/channel is not configured */
45 WANSOCK_DISCONNECTED, /* link/channel is disconnected */
46 WANSOCK_CONNECTING, /* connection is in progress */
47 WANSOCK_CONNECTED, /* link/channel is operational */
48 WANSOCK_LIMIT, /* for verification only */
49 WANSOCK_DUALPORT, /* for Dual Port cards */
50 WANSOCK_DISCONNECTING,
51 WANSOCK_BINDED,
52 WANSOCK_BIND_LISTEN,
53 WANSOCK_LISTEN
54};
55
56#endif
57
58
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index a113fe68d8a1..f510e7e382a8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,6 +80,27 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */ 106#define IGMP_DVMRP 0x13 /* DVMRP routing */
diff --git a/include/linux/in.h b/include/linux/in.h
index 1912e7c0bc26..3975cbf52f20 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -83,6 +83,7 @@ struct in_addr {
83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
84#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 84#define IP_PMTUDISC_WANT 1 /* Use per route hints */
85#define IP_PMTUDISC_DO 2 /* Always DF */ 85#define IP_PMTUDISC_DO 2 /* Always DF */
86#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
86 87
87#define IP_MULTICAST_IF 32 88#define IP_MULTICAST_IF 32
88#define IP_MULTICAST_TTL 33 89#define IP_MULTICAST_TTL 33
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 4e8350ae8869..2a61c82af115 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined 44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
45 * in network byte order, not in host byte order as are the IPv4 equivalents 45 * in network byte order, not in host byte order as are the IPv4 equivalents
46 */ 46 */
47#if 0
48extern const struct in6_addr in6addr_any; 47extern const struct in6_addr in6addr_any;
49#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
50#endif
51extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
52#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
53 51
@@ -179,6 +177,7 @@ struct in6_flowlabel_req
179#define IPV6_PMTUDISC_DONT 0 177#define IPV6_PMTUDISC_DONT 0
180#define IPV6_PMTUDISC_WANT 1 178#define IPV6_PMTUDISC_WANT 1
181#define IPV6_PMTUDISC_DO 2 179#define IPV6_PMTUDISC_DO 2
180#define IPV6_PMTUDISC_PROBE 3
182 181
183/* Flowlabel */ 182/* Flowlabel */
184#define IPV6_FLOWLABEL_MGR 32 183#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 1d36b971a8b5..bd0a2a8631c6 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -104,6 +104,20 @@ struct iphdr {
104 /*The options start here. */ 104 /*The options start here. */
105}; 105};
106 106
107#ifdef __KERNEL__
108#include <linux/skbuff.h>
109
110static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
111{
112 return (struct iphdr *)skb_network_header(skb);
113}
114
115static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
116{
117 return (struct iphdr *)skb_transport_header(skb);
118}
119#endif
120
107struct ip_auth_hdr { 121struct ip_auth_hdr {
108 __u8 nexthdr; 122 __u8 nexthdr;
109 __u8 hdrlen; /* This one is measured in 32 bit units! */ 123 __u8 hdrlen; /* This one is measured in 32 bit units! */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 713eb5eaa81f..09ea01a8a99c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -178,6 +178,9 @@ struct ipv6_devconf {
178#endif 178#endif
179 __s32 proxy_ndp; 179 __s32 proxy_ndp;
180 __s32 accept_source_route; 180 __s32 accept_source_route;
181#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
182 __s32 optimistic_dad;
183#endif
181 void *sysctl; 184 void *sysctl;
182}; 185};
183 186
@@ -208,6 +211,7 @@ enum {
208 DEVCONF_PROXY_NDP, 211 DEVCONF_PROXY_NDP,
209 __DEVCONF_OPTIMISTIC_DAD, 212 __DEVCONF_OPTIMISTIC_DAD,
210 DEVCONF_ACCEPT_SOURCE_ROUTE, 213 DEVCONF_ACCEPT_SOURCE_ROUTE,
214 DEVCONF_OPTIMISTIC_DAD,
211 DEVCONF_MAX 215 DEVCONF_MAX
212}; 216};
213 217
@@ -219,6 +223,16 @@ enum {
219#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ 223#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
220#include <net/inet_sock.h> 224#include <net/inet_sock.h>
221 225
226static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
227{
228 return (struct ipv6hdr *)skb_network_header(skb);
229}
230
231static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
232{
233 return (struct ipv6hdr *)skb_transport_header(skb);
234}
235
222/* 236/*
223 This structure contains results of exthdrs parsing 237 This structure contains results of exthdrs parsing
224 as offsets from skb->nh. 238 as offsets from skb->nh.
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 82c7ae412eec..2a2f99fbcb16 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
84/* A special optimized version that handles 1 or more of u32s. 84/* A special optimized version that handles 1 or more of u32s.
85 * The length parameter here is the number of u32s in the key. 85 * The length parameter here is the number of u32s in the key.
86 */ 86 */
87static inline u32 jhash2(u32 *k, u32 length, u32 initval) 87static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
88{ 88{
89 u32 a, b, c, len; 89 u32 a, b, c, len;
90 90
diff --git a/include/linux/key.h b/include/linux/key.h
index 169f05e4863e..a9220e75782e 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -160,6 +160,8 @@ struct key {
160 */ 160 */
161 union { 161 union {
162 struct list_head link; 162 struct list_head link;
163 unsigned long x[2];
164 void *p[2];
163 } type_data; 165 } type_data;
164 166
165 /* key data 167 /* key data
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305bb9a18..81bb9c7a4eb3 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
259 259
260#endif 260#endif
261 261
262static inline s64 ktime_to_us(const ktime_t kt)
263{
264 struct timeval tv = ktime_to_timeval(kt);
265 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
266}
267
262/* 268/*
263 * The resolution of the clocks. The resolution value is returned in 269 * The resolution of the clocks. The resolution value is returned in
264 * the clock_getres() system call to give application programmers an 270 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
new file mode 100644
index 000000000000..3d967b6b120a
--- /dev/null
+++ b/include/linux/mtd/ubi.h
@@ -0,0 +1,202 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __LINUX_UBI_H__
22#define __LINUX_UBI_H__
23
24#include <asm/ioctl.h>
25#include <linux/types.h>
26#include <mtd/ubi-user.h>
27
28/*
29 * UBI data type hint constants.
30 *
31 * UBI_LONGTERM: long-term data
32 * UBI_SHORTTERM: short-term data
33 * UBI_UNKNOWN: data persistence is unknown
34 *
35 * These constants are used when data is written to UBI volumes in order to
36 * help the UBI wear-leveling unit to find more appropriate physical
37 * eraseblocks.
38 */
39enum {
40 UBI_LONGTERM = 1,
41 UBI_SHORTTERM,
42 UBI_UNKNOWN
43};
44
45/*
46 * enum ubi_open_mode - UBI volume open mode constants.
47 *
48 * UBI_READONLY: read-only mode
49 * UBI_READWRITE: read-write mode
50 * UBI_EXCLUSIVE: exclusive mode
51 */
52enum {
53 UBI_READONLY = 1,
54 UBI_READWRITE,
55 UBI_EXCLUSIVE
56};
57
58/**
59 * struct ubi_volume_info - UBI volume description data structure.
60 * @vol_id: volume ID
61 * @ubi_num: UBI device number this volume belongs to
62 * @size: how many physical eraseblocks are reserved for this volume
63 * @used_bytes: how many bytes of data this volume contains
64 * @used_ebs: how many physical eraseblocks of this volume actually contain any
65 * data
66 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
67 * @corrupted: non-zero if the volume is corrupted (static volumes only)
68 * @upd_marker: non-zero if the volume has update marker set
69 * @alignment: volume alignment
70 * @usable_leb_size: how many bytes are available in logical eraseblocks of
71 * this volume
72 * @name_len: volume name length
73 * @name: volume name
74 * @cdev: UBI volume character device major and minor numbers
75 *
76 * The @corrupted flag is only relevant to static volumes and is always zero
77 * for dynamic ones. This is because UBI does not care about dynamic volume
78 * data protection and only cares about protecting static volume data.
79 *
80 * The @upd_marker flag is set if the volume update operation was interrupted.
81 * Before touching the volume data during the update operation, UBI first sets
82 * the update marker flag for this volume. If the volume update operation was
83 * further interrupted, the update marker indicates this. If the update marker
84 * is set, the contents of the volume is certainly damaged and a new volume
85 * update operation has to be started.
86 *
87 * To put it differently, @corrupted and @upd_marker fields have different
88 * semantics:
89 * o the @corrupted flag means that this static volume is corrupted for some
90 * reasons, but not because an interrupted volume update
91 * o the @upd_marker field means that the volume is damaged because of an
92 * interrupted update operation.
93 *
94 * I.e., the @corrupted flag is never set if the @upd_marker flag is set.
95 *
96 * The @used_bytes and @used_ebs fields are only really needed for static
97 * volumes and contain the number of bytes stored in this static volume and how
98 * many eraseblock this data occupies. In case of dynamic volumes, the
99 * @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs
100 * field is equivalent to @size.
101 *
102 * In general, logical eraseblock size is a property of the UBI device, not
103 * of the UBI volume. Indeed, the logical eraseblock size depends on the
104 * physical eraseblock size and on how much bytes UBI headers consume. But
105 * because of the volume alignment (@alignment), the usable size of logical
106 * eraseblocks if a volume may be less. The following equation is true:
107 * @usable_leb_size = LEB size - (LEB size mod @alignment),
108 * where LEB size is the logical eraseblock size defined by the UBI device.
109 *
110 * The alignment is multiple to the minimal flash input/output unit size or %1
111 * if all the available space is used.
112 *
113 * To put this differently, alignment may be considered is a way to change
114 * volume logical eraseblock sizes.
115 */
116struct ubi_volume_info {
117 int ubi_num;
118 int vol_id;
119 int size;
120 long long used_bytes;
121 int used_ebs;
122 int vol_type;
123 int corrupted;
124 int upd_marker;
125 int alignment;
126 int usable_leb_size;
127 int name_len;
128 const char *name;
129 dev_t cdev;
130};
131
132/**
133 * struct ubi_device_info - UBI device description data structure.
134 * @ubi_num: ubi device number
135 * @leb_size: logical eraseblock size on this UBI device
136 * @min_io_size: minimal I/O unit size
137 * @ro_mode: if this device is in read-only mode
138 * @cdev: UBI character device major and minor numbers
139 *
140 * Note, @leb_size is the logical eraseblock size offered by the UBI device.
141 * Volumes of this UBI device may have smaller logical eraseblock size if their
142 * alignment is not equivalent to %1.
143 */
144struct ubi_device_info {
145 int ubi_num;
146 int leb_size;
147 int min_io_size;
148 int ro_mode;
149 dev_t cdev;
150};
151
152/* UBI descriptor given to users when they open UBI volumes */
153struct ubi_volume_desc;
154
155int ubi_get_device_info(int ubi_num, struct ubi_device_info *di);
156void ubi_get_volume_info(struct ubi_volume_desc *desc,
157 struct ubi_volume_info *vi);
158struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
159struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
160 int mode);
161void ubi_close_volume(struct ubi_volume_desc *desc);
162int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
163 int len, int check);
164int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
165 int offset, int len, int dtype);
166int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
167 int len, int dtype);
168int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
169int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
170int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
171
172/*
173 * This function is the same as the 'ubi_leb_read()' function, but it does not
174 * provide the checking capability.
175 */
176static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
177 int offset, int len)
178{
179 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
180}
181
182/*
183 * This function is the same as the 'ubi_leb_write()' functions, but it does
184 * not have the data type argument.
185 */
186static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
187 const void *buf, int offset, int len)
188{
189 return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
190}
191
192/*
193 * This function is the same as the 'ubi_leb_change()' functions, but it does
194 * not have the data type argument.
195 */
196static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
197 const void *buf, int len)
198{
199 return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
200}
201
202#endif /* !__LINUX_UBI_H__ */
diff --git a/include/linux/net.h b/include/linux/net.h
index 4db21e63d8d2..efc45177b503 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -24,7 +24,7 @@
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26 26
27#define NPROTO 33 /* should be enough for now.. */ 27#define NPROTO 34 /* should be enough for now.. */
28 28
29#define SYS_SOCKET 1 /* sys_socket(2) */ 29#define SYS_SOCKET 1 /* sys_socket(2) */
30#define SYS_BIND 2 /* sys_bind(2) */ 30#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1a528548cd1d..e027a3750a77 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,8 @@
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
45/* 802.11 specific */
46struct wireless_dev;
45 /* source back-compat hooks */ 47 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 48#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 49 ( (netdev)->ethtool_ops = (ops) )
@@ -323,6 +325,7 @@ struct net_device
323#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ 325#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
324#define NETIF_F_GSO 2048 /* Enable software GSO. */ 326#define NETIF_F_GSO 2048 /* Enable software GSO. */
325#define NETIF_F_LLTX 4096 /* LockLess TX */ 327#define NETIF_F_LLTX 4096 /* LockLess TX */
328#define NETIF_F_INTERNAL_STATS 8192 /* Use stats structure in net_device */
326 329
327 /* Segmentation offload features */ 330 /* Segmentation offload features */
328#define NETIF_F_GSO_SHIFT 16 331#define NETIF_F_GSO_SHIFT 16
@@ -347,13 +350,15 @@ struct net_device
347 350
348 351
349 struct net_device_stats* (*get_stats)(struct net_device *dev); 352 struct net_device_stats* (*get_stats)(struct net_device *dev);
353 struct net_device_stats stats;
350 354
355#ifdef CONFIG_WIRELESS_EXT
351 /* List of functions to handle Wireless Extensions (instead of ioctl). 356 /* List of functions to handle Wireless Extensions (instead of ioctl).
352 * See <net/iw_handler.h> for details. Jean II */ 357 * See <net/iw_handler.h> for details. Jean II */
353 const struct iw_handler_def * wireless_handlers; 358 const struct iw_handler_def * wireless_handlers;
354 /* Instance data managed by the core of Wireless Extensions. */ 359 /* Instance data managed by the core of Wireless Extensions. */
355 struct iw_public_data * wireless_data; 360 struct iw_public_data * wireless_data;
356 361#endif
357 const struct ethtool_ops *ethtool_ops; 362 const struct ethtool_ops *ethtool_ops;
358 363
359 /* 364 /*
@@ -398,6 +403,8 @@ struct net_device
398 void *ip6_ptr; /* IPv6 specific data */ 403 void *ip6_ptr; /* IPv6 specific data */
399 void *ec_ptr; /* Econet specific data */ 404 void *ec_ptr; /* Econet specific data */
400 void *ax25_ptr; /* AX.25 specific data */ 405 void *ax25_ptr; /* AX.25 specific data */
406 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
407 assign before registering */
401 408
402/* 409/*
403 * Cache line mostly used on receive path (including eth_type_trans()) 410 * Cache line mostly used on receive path (including eth_type_trans())
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 70d3b4f1e48d..10b5c6275706 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info, 281 struct nf_info *info,
282 unsigned int verdict); 282 unsigned int verdict);
283 283
284extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
285extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
286
287/* FIXME: Before cache is ever used, this must be implemented for real. */ 284/* FIXME: Before cache is ever used, this must be implemented for real. */
288extern void nf_invalidate_cache(int pf); 285extern void nf_invalidate_cache(int pf);
289 286
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
388{ 385{
389 return 1; 386 return 1;
390} 387}
391static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
392struct flowi; 388struct flowi;
393static inline void 389static inline void
394nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 390nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
395#endif /*CONFIG_NETFILTER*/ 391#endif /*CONFIG_NETFILTER*/
396 392
393#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
394extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
395extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
396extern void (*nf_ct_destroy)(struct nf_conntrack *);
397#else
398static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
399#endif
400
397#endif /*__KERNEL__*/ 401#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 402#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 007af4c2770b..22ce29995f13 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -30,6 +30,11 @@ enum tcp_conntrack {
30/* Be liberal in window checking */ 30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32 32
33struct nf_ct_tcp_flags {
34 u_int8_t flags;
35 u_int8_t mask;
36};
37
33#ifdef __KERNEL__ 38#ifdef __KERNEL__
34 39
35struct ip_ct_tcp_state { 40struct ip_ct_tcp_state {
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1e9c821f152d..0f9311df1559 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -62,11 +62,11 @@ struct nfattr
62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) 62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) 63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
64#define NFA_NEST(skb, type) \ 64#define NFA_NEST(skb, type) \
65({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ 65({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ 66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
67 __start; }) 67 __start; })
68#define NFA_NEST_END(skb, start) \ 68#define NFA_NEST_END(skb, start) \
69({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ 69({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
70 (skb)->len; }) 70 (skb)->len; })
71#define NFA_NEST_CANCEL(skb, start) \ 71#define NFA_NEST_CANCEL(skb, start) \
72({ if (start) \ 72({ if (start) \
@@ -111,7 +111,7 @@ struct nfgenmsg {
111struct nfnl_callback 111struct nfnl_callback
112{ 112{
113 int (*call)(struct sock *nl, struct sk_buff *skb, 113 int (*call)(struct sock *nl, struct sk_buff *skb,
114 struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); 114 struct nlmsghdr *nlh, struct nfattr *cda[]);
115 u_int16_t attr_count; /* number of nfattr's */ 115 u_int16_t attr_count; /* number of nfattr's */
116}; 116};
117 117
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ 129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); }) 130 __nfa_fill(skb, attrtype, attrlen, data); })
131 131
132extern struct semaphore nfnl_sem;
133
134#define nfnl_shlock() down(&nfnl_sem)
135#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
136
137#define nfnl_shunlock() do { up(&nfnl_sem); \
138 if(nfnl && nfnl->sk_receive_queue.qlen) \
139 nfnl->sk_data_ready(nfnl, 0); \
140 } while(0)
141
142extern void nfnl_lock(void);
143extern void nfnl_unlock(void);
144
145extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
146extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
147 134
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index b5883ccee295..d7c35039721e 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -83,6 +83,10 @@ enum ctattr_protoinfo {
83enum ctattr_protoinfo_tcp { 83enum ctattr_protoinfo_tcp {
84 CTA_PROTOINFO_TCP_UNSPEC, 84 CTA_PROTOINFO_TCP_UNSPEC,
85 CTA_PROTOINFO_TCP_STATE, 85 CTA_PROTOINFO_TCP_STATE,
86 CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
87 CTA_PROTOINFO_TCP_WSCALE_REPLY,
88 CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
89 CTA_PROTOINFO_TCP_FLAGS_REPLY,
86 __CTA_PROTOINFO_TCP_MAX 90 __CTA_PROTOINFO_TCP_MAX
87}; 91};
88#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 92#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 55689f39f77a..19060030bac9 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -7,6 +7,7 @@
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#include <linux/if_ether.h> 8#include <linux/if_ether.h>
9#include <linux/if_vlan.h> 9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
10 11
11/* Bridge Hooks */ 12/* Bridge Hooks */
12/* After promisc drops, checksum checks. */ 13/* After promisc drops, checksum checks. */
@@ -58,8 +59,14 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
58 * enough room for the encapsulating header (if there is one). */ 59 * enough room for the encapsulating header (if there is one). */
59static inline int nf_bridge_pad(const struct sk_buff *skb) 60static inline int nf_bridge_pad(const struct sk_buff *skb)
60{ 61{
61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) 62 int padding = 0;
62 ? VLAN_HLEN : 0; 63
64 if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
65 padding = VLAN_HLEN;
66 else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES))
67 padding = PPPOE_SES_HLEN;
68
69 return padding;
63} 70}
64 71
65struct bridge_skb_cb { 72struct bridge_skb_cb {
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index 07f044ff1a6b..a11b0c2017fd 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr {
54 54
55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) 55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
56{ 56{
57 return (struct ebt_802_3_hdr *)skb->mac.raw; 57 return (struct ebt_802_3_hdr *)skb_mac_header(skb);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 97e4dbde1f89..cbf4843b6b0f 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -8,8 +8,10 @@
8#define EBT_ARP_DST_IP 0x10 8#define EBT_ARP_DST_IP 0x10
9#define EBT_ARP_SRC_MAC 0x20 9#define EBT_ARP_SRC_MAC 0x20
10#define EBT_ARP_DST_MAC 0x40 10#define EBT_ARP_DST_MAC 0x40
11#define EBT_ARP_GRAT 0x80
11#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ 12#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
12 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) 13 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
14 EBT_ARP_GRAT)
13#define EBT_ARP_MATCH "arp" 15#define EBT_ARP_MATCH "arp"
14 16
15struct ebt_arp_info 17struct ebt_arp_info
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 180337801a86..7185792b900f 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,9 +1,3 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_protocol.h
3header-y += ip_conntrack_sctp.h
4header-y += ip_conntrack_tcp.h
5header-y += ip_conntrack_tftp.h
6header-y += ip_nat_pptp.h
7header-y += ipt_addrtype.h 1header-y += ipt_addrtype.h
8header-y += ipt_ah.h 2header-y += ipt_ah.h
9header-y += ipt_CLASSIFY.h 3header-y += ipt_CLASSIFY.h
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h
49header-y += ipt_TTL.h 43header-y += ipt_TTL.h
50header-y += ipt_ULOG.h 44header-y += ipt_ULOG.h
51 45
52unifdef-y += ip_conntrack.h
53unifdef-y += ip_conntrack_h323.h
54unifdef-y += ip_conntrack_irc.h
55unifdef-y += ip_conntrack_pptp.h
56unifdef-y += ip_conntrack_proto_gre.h
57unifdef-y += ip_conntrack_tuple.h
58unifdef-y += ip_nat.h
59unifdef-y += ip_nat_rule.h
60unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
61unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 100644
index da9274e6bf12..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1,402 +0,0 @@
1#ifndef _IP_CONNTRACK_H
2#define _IP_CONNTRACK_H
3
4#include <linux/netfilter/nf_conntrack_common.h>
5
6#ifdef __KERNEL__
7#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
8#include <linux/bitops.h>
9#include <linux/compiler.h>
10#include <asm/atomic.h>
11
12#include <linux/timer.h>
13#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
14#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
15#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
16#include <linux/netfilter_ipv4/ip_conntrack_sctp.h>
17
18/* per conntrack: protocol private data */
19union ip_conntrack_proto {
20 /* insert conntrack proto private data here */
21 struct ip_ct_gre gre;
22 struct ip_ct_sctp sctp;
23 struct ip_ct_tcp tcp;
24 struct ip_ct_icmp icmp;
25};
26
27union ip_conntrack_expect_proto {
28 /* insert expect proto private data here */
29};
30
31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
36#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
37
38/* per conntrack: application helper private data */
39union ip_conntrack_help {
40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
42 struct ip_ct_pptp_master ct_pptp_info;
43 struct ip_ct_ftp_master ct_ftp_info;
44 struct ip_ct_irc_master ct_irc_info;
45};
46
47#ifdef CONFIG_IP_NF_NAT_NEEDED
48#include <linux/netfilter_ipv4/ip_nat.h>
49#include <linux/netfilter_ipv4/ip_nat_pptp.h>
50
51/* per conntrack: nat application helper private data */
52union ip_conntrack_nat_help {
53 /* insert nat helper private data here */
54 struct ip_nat_pptp nat_pptp_info;
55};
56#endif
57
58#include <linux/types.h>
59#include <linux/skbuff.h>
60
61#ifdef CONFIG_NETFILTER_DEBUG
62#define IP_NF_ASSERT(x) \
63do { \
64 if (!(x)) \
65 /* Wooah! I'm tripping my conntrack in a frenzy of \
66 netplay... */ \
67 printk("NF_IP_ASSERT: %s:%i(%s)\n", \
68 __FILE__, __LINE__, __FUNCTION__); \
69} while(0)
70#else
71#define IP_NF_ASSERT(x)
72#endif
73
74struct ip_conntrack_helper;
75
76struct ip_conntrack
77{
78 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
79 plus 1 for any connection(s) we are `master' for */
80 struct nf_conntrack ct_general;
81
82 /* Have we seen traffic both ways yet? (bitset) */
83 unsigned long status;
84
85 /* Timer function; drops refcnt when it goes off. */
86 struct timer_list timeout;
87
88#ifdef CONFIG_IP_NF_CT_ACCT
89 /* Accounting Information (same cache line as other written members) */
90 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
91#endif
92 /* If we were expected by an expectation, this will be it */
93 struct ip_conntrack *master;
94
95 /* Current number of expected connections */
96 unsigned int expecting;
97
98 /* Unique ID that identifies this conntrack*/
99 unsigned int id;
100
101 /* Helper, if any. */
102 struct ip_conntrack_helper *helper;
103
104 /* Storage reserved for other modules: */
105 union ip_conntrack_proto proto;
106
107 union ip_conntrack_help help;
108
109#ifdef CONFIG_IP_NF_NAT_NEEDED
110 struct {
111 struct ip_nat_info info;
112 union ip_conntrack_nat_help help;
113#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
114 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
115 int masq_index;
116#endif
117 } nat;
118#endif /* CONFIG_IP_NF_NAT_NEEDED */
119
120#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
121 u_int32_t mark;
122#endif
123
124#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
125 u_int32_t secmark;
126#endif
127
128 /* Traversed often, so hopefully in different cacheline to top */
129 /* These are my tuples; original and reply */
130 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
131};
132
133struct ip_conntrack_expect
134{
135 /* Internal linked list (global expectation list) */
136 struct list_head list;
137
138 /* We expect this tuple, with the following mask */
139 struct ip_conntrack_tuple tuple, mask;
140
141 /* Function to call after setup and insertion */
142 void (*expectfn)(struct ip_conntrack *new,
143 struct ip_conntrack_expect *this);
144
145 /* The conntrack of the master connection */
146 struct ip_conntrack *master;
147
148 /* Timer function; deletes the expectation. */
149 struct timer_list timeout;
150
151 /* Usage count. */
152 atomic_t use;
153
154 /* Unique ID */
155 unsigned int id;
156
157 /* Flags */
158 unsigned int flags;
159
160#ifdef CONFIG_IP_NF_NAT_NEEDED
161 __be32 saved_ip;
162 /* This is the original per-proto part, used to map the
163 * expected connection the way the recipient expects. */
164 union ip_conntrack_manip_proto saved_proto;
165 /* Direction relative to the master connection. */
166 enum ip_conntrack_dir dir;
167#endif
168};
169
170#define IP_CT_EXPECT_PERMANENT 0x1
171
172static inline struct ip_conntrack *
173tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
174{
175 return container_of(hash, struct ip_conntrack,
176 tuplehash[hash->tuple.dst.dir]);
177}
178
179/* get master conntrack via master expectation */
180#define master_ct(conntr) (conntr->master)
181
182/* Alter reply tuple (maybe alter helper). */
183extern void
184ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
185 const struct ip_conntrack_tuple *newreply);
186
187/* Is this tuple taken? (ignoring any belonging to the given
188 conntrack). */
189extern int
190ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
191 const struct ip_conntrack *ignored_conntrack);
192
193/* Return conntrack_info and tuple hash for given skb. */
194static inline struct ip_conntrack *
195ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
196{
197 *ctinfo = skb->nfctinfo;
198 return (struct ip_conntrack *)skb->nfct;
199}
200
201/* decrement reference count on a conntrack */
202static inline void
203ip_conntrack_put(struct ip_conntrack *ct)
204{
205 IP_NF_ASSERT(ct);
206 nf_conntrack_put(&ct->ct_general);
207}
208
209extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
210 const struct ip_conntrack_tuple *orig);
211
212extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
213 enum ip_conntrack_info ctinfo,
214 const struct sk_buff *skb,
215 unsigned long extra_jiffies,
216 int do_acct);
217
218/* Refresh conntrack for this many jiffies and do accounting */
219static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
220 enum ip_conntrack_info ctinfo,
221 const struct sk_buff *skb,
222 unsigned long extra_jiffies)
223{
224 __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
225}
226
227/* Refresh conntrack for this many jiffies */
228static inline void ip_ct_refresh(struct ip_conntrack *ct,
229 const struct sk_buff *skb,
230 unsigned long extra_jiffies)
231{
232 __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
233}
234
235/* These are for NAT. Icky. */
236/* Update TCP window tracking data when NAT mangles the packet */
237extern void ip_conntrack_tcp_update(struct sk_buff *skb,
238 struct ip_conntrack *conntrack,
239 enum ip_conntrack_dir dir);
240
241/* Call me when a conntrack is destroyed. */
242extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
243
244/* Fake conntrack entry for untracked connections */
245extern struct ip_conntrack ip_conntrack_untracked;
246
247/* Returns new sk_buff, or NULL */
248struct sk_buff *
249ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
250
251/* Iterate over all conntracks: if iter returns true, it's deleted. */
252extern void
253ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
254 void *data);
255
256extern struct ip_conntrack_helper *
257__ip_conntrack_helper_find_byname(const char *);
258extern struct ip_conntrack_helper *
259ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
260extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
261
262extern struct ip_conntrack_protocol *
263__ip_conntrack_proto_find(u_int8_t protocol);
264extern struct ip_conntrack_protocol *
265ip_conntrack_proto_find_get(u_int8_t protocol);
266extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
267
268extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
269
270extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
271 struct ip_conntrack_tuple *);
272
273extern void ip_conntrack_free(struct ip_conntrack *ct);
274
275extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
276
277extern struct ip_conntrack_expect *
278__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
279
280extern struct ip_conntrack_expect *
281ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
282
283extern struct ip_conntrack_tuple_hash *
284__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
285 const struct ip_conntrack *ignored_conntrack);
286
287extern void ip_conntrack_flush(void);
288
289/* It's confirmed if it is, or has been in the hash table. */
290static inline int is_confirmed(struct ip_conntrack *ct)
291{
292 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
293}
294
295static inline int is_dying(struct ip_conntrack *ct)
296{
297 return test_bit(IPS_DYING_BIT, &ct->status);
298}
299
300extern unsigned int ip_conntrack_htable_size;
301extern int ip_conntrack_checksum;
302
303#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
304#define CONNTRACK_STAT_INC_ATOMIC(count) \
305do { \
306 local_bh_disable(); \
307 __get_cpu_var(ip_conntrack_stat).count++; \
308 local_bh_enable(); \
309} while (0)
310
311#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
312#include <linux/notifier.h>
313#include <linux/interrupt.h>
314
315struct ip_conntrack_ecache {
316 struct ip_conntrack *ct;
317 unsigned int events;
318};
319DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
320
321#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
322
323extern struct atomic_notifier_head ip_conntrack_chain;
324extern struct atomic_notifier_head ip_conntrack_expect_chain;
325
326static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
327{
328 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
329}
330
331static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
332{
333 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
334}
335
336static inline int
337ip_conntrack_expect_register_notifier(struct notifier_block *nb)
338{
339 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
340}
341
342static inline int
343ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
344{
345 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
346 nb);
347}
348
349extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
350extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
351
352static inline void
353ip_conntrack_event_cache(enum ip_conntrack_events event,
354 const struct sk_buff *skb)
355{
356 struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
357 struct ip_conntrack_ecache *ecache;
358
359 local_bh_disable();
360 ecache = &__get_cpu_var(ip_conntrack_ecache);
361 if (ct != ecache->ct)
362 __ip_ct_event_cache_init(ct);
363 ecache->events |= event;
364 local_bh_enable();
365}
366
367static inline void ip_conntrack_event(enum ip_conntrack_events event,
368 struct ip_conntrack *ct)
369{
370 if (is_confirmed(ct) && !is_dying(ct))
371 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
372}
373
374static inline void
375ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
376 struct ip_conntrack_expect *exp)
377{
378 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
379}
380#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
381static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
382 const struct sk_buff *skb) {}
383static inline void ip_conntrack_event(enum ip_conntrack_events event,
384 struct ip_conntrack *ct) {}
385static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
386static inline void
387ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
388 struct ip_conntrack_expect *exp) {}
389#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
390
391#ifdef CONFIG_IP_NF_NAT_NEEDED
392static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
393 enum ip_nat_manip_type manip)
394{
395 if (manip == IP_NAT_MANIP_SRC)
396 return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status);
397 return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status);
398}
399#endif /* CONFIG_IP_NF_NAT_NEEDED */
400
401#endif /* __KERNEL__ */
402#endif /* _IP_CONNTRACK_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
deleted file mode 100644
index de3e41f51aec..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _IP_CONNTRACK_AMANDA_H
2#define _IP_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5struct ip_conntrack_expect;
6extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
7 enum ip_conntrack_info ctinfo,
8 unsigned int matchoff,
9 unsigned int matchlen,
10 struct ip_conntrack_expect *exp);
11#endif /* _IP_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
deleted file mode 100644
index e3a6df07aa4b..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h>
4
5#define MAX_IP_CT_PROTO 256
6extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
7
8/* This header is used to share core functionality between the
9 standalone connection tracking module, and the compatibility layer's use
10 of connection tracking. */
11extern unsigned int ip_conntrack_in(unsigned int hooknum,
12 struct sk_buff **pskb,
13 const struct net_device *in,
14 const struct net_device *out,
15 int (*okfn)(struct sk_buff *));
16
17extern int ip_conntrack_init(void);
18extern void ip_conntrack_cleanup(void);
19
20struct ip_conntrack_protocol;
21
22extern int
23ip_ct_get_tuple(const struct iphdr *iph,
24 const struct sk_buff *skb,
25 unsigned int dataoff,
26 struct ip_conntrack_tuple *tuple,
27 const struct ip_conntrack_protocol *protocol);
28
29extern int
30ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
31 const struct ip_conntrack_tuple *orig,
32 const struct ip_conntrack_protocol *protocol);
33
34/* Find a connection corresponding to a tuple. */
35struct ip_conntrack_tuple_hash *
36ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
37 const struct ip_conntrack *ignored_conntrack);
38
39extern int __ip_conntrack_confirm(struct sk_buff **pskb);
40
41/* Confirm a connection: returns NF_DROP if packet must be dropped. */
42static inline int ip_conntrack_confirm(struct sk_buff **pskb)
43{
44 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
45 int ret = NF_ACCEPT;
46
47 if (ct) {
48 if (!is_confirmed(ct) && !is_dying(ct))
49 ret = __ip_conntrack_confirm(pskb);
50 ip_ct_deliver_cached_events(ct);
51 }
52 return ret;
53}
54
55extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
56
57extern struct list_head *ip_conntrack_hash;
58extern struct list_head ip_conntrack_expect_list;
59extern rwlock_t ip_conntrack_lock;
60#endif /* _IP_CONNTRACK_CORE_H */
61
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
deleted file mode 100644
index 2129fc3972ac..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
4
5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type
7{
8 /* PORT command from client */
9 IP_CT_FTP_PORT,
10 /* PASV response from server */
11 IP_CT_FTP_PASV,
12 /* EPRT command from client */
13 IP_CT_FTP_EPRT,
14 /* EPSV response from server */
15 IP_CT_FTP_EPSV,
16};
17
18#ifdef __KERNEL__
19
20#define FTP_PORT 21
21
22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */
24struct ip_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29};
30
31struct ip_conntrack_expect;
32
33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type,
38 unsigned int matchoff,
39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp,
41 u32 *seq);
42#endif /* __KERNEL__ */
43
44#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
deleted file mode 100644
index 18f769818f4e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7
8#define RAS_PORT 1719
9#define Q931_PORT 1720
10#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
11
12/* This structure exists only once per master */
13struct ip_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 u_int16_t sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
20
21 union {
22 /* RAS connection timeout */
23 u_int32_t timeout;
24
25 /* Next TPKT length (for separate TPKT header and data) */
26 u_int16_t tpkt_len[IP_CT_DIR_MAX];
27 };
28};
29
30struct ip_conntrack_expect;
31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
37 struct ip_conntrack_expect *this);
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr,
41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff,
44 TransportAddress * addr,
45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned char **data,
50 TransportAddress * addr, int count);
51extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
52 struct ip_conntrack * ct,
53 enum ip_conntrack_info ctinfo,
54 unsigned char **data,
55 TransportAddress * addr, int count);
56extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
57 struct ip_conntrack * ct,
58 enum ip_conntrack_info ctinfo,
59 unsigned char **data, int dataoff,
60 H245_TransportAddress * addr,
61 u_int16_t port, u_int16_t rtp_port,
62 struct ip_conntrack_expect * rtp_exp,
63 struct ip_conntrack_expect * rtcp_exp);
64extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
65 enum ip_conntrack_info ctinfo,
66 unsigned char **data, int dataoff,
67 H245_TransportAddress * addr, u_int16_t port,
68 struct ip_conntrack_expect * exp);
69extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
82 enum ip_conntrack_info ctinfo,
83 unsigned char **data, TransportAddress * addr,
84 int idx, u_int16_t port,
85 struct ip_conntrack_expect * exp);
86
87#endif
88
89#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
deleted file mode 100644
index 77fe868d36ff..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* IP connection tracking helpers. */
2#ifndef _IP_CONNTRACK_HELPER_H
3#define _IP_CONNTRACK_HELPER_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6struct module;
7
8struct ip_conntrack_helper
9{
10 struct list_head list; /* Internal use. */
11
12 const char *name; /* name of the module */
13 struct module *me; /* pointer to self */
14 unsigned int max_expected; /* Maximum number of concurrent
15 * expected connections */
16 unsigned int timeout; /* timeout for expecteds */
17
18 /* Mask of things we will help (compared against server response) */
19 struct ip_conntrack_tuple tuple;
20 struct ip_conntrack_tuple mask;
21
22 /* Function to call when data passes; return verdict, or -1 to
23 invalidate. */
24 int (*help)(struct sk_buff **pskb,
25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo);
27
28 void (*destroy)(struct ip_conntrack *ct);
29
30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
31};
32
33extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
34extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
35
36/* Allocate space for an expectation: this is mandatory before calling
37 ip_conntrack_expect_related. You will have to call put afterwards. */
38extern struct ip_conntrack_expect *
39ip_conntrack_expect_alloc(struct ip_conntrack *master);
40extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
41
42/* Add an expected connection: can have more than one per connection */
43extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
44extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
45
46#endif /*_IP_CONNTRACK_HELPER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
deleted file mode 100644
index eed5ee3e4744..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_ICMP_H
2#define _IP_CONNTRACK_ICMP_H
3
4#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
5
6#endif /* _IP_CONNTRACK_ICMP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_irc.h b/include/linux/netfilter_ipv4/ip_conntrack_irc.h
deleted file mode 100644
index 16601e0d5626..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_irc.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* IRC extension for IP connection tracking.
2 * (C) 2000 by Harald Welte <laforge@gnumonks.org>
3 * based on RR's ip_conntrack_ftp.h
4 *
5 * ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 *
13 */
14#ifndef _IP_CONNTRACK_IRC_H
15#define _IP_CONNTRACK_IRC_H
16
17/* This structure exists only once per master */
18struct ip_ct_irc_master {
19};
20
21#ifdef __KERNEL__
22extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 unsigned int matchoff,
25 unsigned int matchlen,
26 struct ip_conntrack_expect *exp);
27
28#define IRC_PORT 6667
29
30#endif /* __KERNEL__ */
31
32#endif /* _IP_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
deleted file mode 100644
index 2644b1faddd6..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ /dev/null
@@ -1,326 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _CONNTRACK_PPTP_H
3#define _CONNTRACK_PPTP_H
4
5/* state of the control session */
6enum pptp_ctrlsess_state {
7 PPTP_SESSION_NONE, /* no session present */
8 PPTP_SESSION_ERROR, /* some session error */
9 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
10 PPTP_SESSION_REQUESTED, /* start_sess request seen */
11 PPTP_SESSION_CONFIRMED, /* session established */
12};
13
14/* state of the call inside the control session */
15enum pptp_ctrlcall_state {
16 PPTP_CALL_NONE,
17 PPTP_CALL_ERROR,
18 PPTP_CALL_OUT_REQ,
19 PPTP_CALL_OUT_CONF,
20 PPTP_CALL_IN_REQ,
21 PPTP_CALL_IN_REP,
22 PPTP_CALL_IN_CONF,
23 PPTP_CALL_CLEAR_REQ,
24};
25
26
27/* conntrack private data */
28struct ip_ct_pptp_master {
29 enum pptp_ctrlsess_state sstate; /* session state */
30
31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */
34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 __be16 pns_call_id; /* call id of PNS, host byte order */
36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */
39 struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
40};
41
42/* conntrack_expect private member */
43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */
45 __be16 pac_call_id; /* call id of PAC */
46 __be16 pns_call_id; /* call id of PNS */
47};
48
49
50#ifdef __KERNEL__
51
52#define IP_CONNTR_PPTP PPTP_CONTROL_PORT
53
54#define PPTP_CONTROL_PORT 1723
55
56#define PPTP_PACKET_CONTROL 1
57#define PPTP_PACKET_MGMT 2
58
59#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
60
61struct pptp_pkt_hdr {
62 __u16 packetLength;
63 __be16 packetType;
64 __be32 magicCookie;
65};
66
67/* PptpControlMessageType values */
68#define PPTP_START_SESSION_REQUEST 1
69#define PPTP_START_SESSION_REPLY 2
70#define PPTP_STOP_SESSION_REQUEST 3
71#define PPTP_STOP_SESSION_REPLY 4
72#define PPTP_ECHO_REQUEST 5
73#define PPTP_ECHO_REPLY 6
74#define PPTP_OUT_CALL_REQUEST 7
75#define PPTP_OUT_CALL_REPLY 8
76#define PPTP_IN_CALL_REQUEST 9
77#define PPTP_IN_CALL_REPLY 10
78#define PPTP_IN_CALL_CONNECT 11
79#define PPTP_CALL_CLEAR_REQUEST 12
80#define PPTP_CALL_DISCONNECT_NOTIFY 13
81#define PPTP_WAN_ERROR_NOTIFY 14
82#define PPTP_SET_LINK_INFO 15
83
84#define PPTP_MSG_MAX 15
85
86/* PptpGeneralError values */
87#define PPTP_ERROR_CODE_NONE 0
88#define PPTP_NOT_CONNECTED 1
89#define PPTP_BAD_FORMAT 2
90#define PPTP_BAD_VALUE 3
91#define PPTP_NO_RESOURCE 4
92#define PPTP_BAD_CALLID 5
93#define PPTP_REMOVE_DEVICE_ERROR 6
94
95struct PptpControlHeader {
96 __be16 messageType;
97 __u16 reserved;
98};
99
100/* FramingCapability Bitmap Values */
101#define PPTP_FRAME_CAP_ASYNC 0x1
102#define PPTP_FRAME_CAP_SYNC 0x2
103
104/* BearerCapability Bitmap Values */
105#define PPTP_BEARER_CAP_ANALOG 0x1
106#define PPTP_BEARER_CAP_DIGITAL 0x2
107
108struct PptpStartSessionRequest {
109 __be16 protocolVersion;
110 __u16 reserved1;
111 __be32 framingCapability;
112 __be32 bearerCapability;
113 __be16 maxChannels;
114 __be16 firmwareRevision;
115 __u8 hostName[64];
116 __u8 vendorString[64];
117};
118
119/* PptpStartSessionResultCode Values */
120#define PPTP_START_OK 1
121#define PPTP_START_GENERAL_ERROR 2
122#define PPTP_START_ALREADY_CONNECTED 3
123#define PPTP_START_NOT_AUTHORIZED 4
124#define PPTP_START_UNKNOWN_PROTOCOL 5
125
126struct PptpStartSessionReply {
127 __be16 protocolVersion;
128 __u8 resultCode;
129 __u8 generalErrorCode;
130 __be32 framingCapability;
131 __be32 bearerCapability;
132 __be16 maxChannels;
133 __be16 firmwareRevision;
134 __u8 hostName[64];
135 __u8 vendorString[64];
136};
137
138/* PptpStopReasons */
139#define PPTP_STOP_NONE 1
140#define PPTP_STOP_PROTOCOL 2
141#define PPTP_STOP_LOCAL_SHUTDOWN 3
142
143struct PptpStopSessionRequest {
144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
147};
148
149/* PptpStopSessionResultCode */
150#define PPTP_STOP_OK 1
151#define PPTP_STOP_GENERAL_ERROR 2
152
153struct PptpStopSessionReply {
154 __u8 resultCode;
155 __u8 generalErrorCode;
156 __u16 reserved1;
157};
158
159struct PptpEchoRequest {
160 __be32 identNumber;
161};
162
163/* PptpEchoReplyResultCode */
164#define PPTP_ECHO_OK 1
165#define PPTP_ECHO_GENERAL_ERROR 2
166
167struct PptpEchoReply {
168 __be32 identNumber;
169 __u8 resultCode;
170 __u8 generalErrorCode;
171 __u16 reserved;
172};
173
174/* PptpFramingType */
175#define PPTP_ASYNC_FRAMING 1
176#define PPTP_SYNC_FRAMING 2
177#define PPTP_DONT_CARE_FRAMING 3
178
179/* PptpCallBearerType */
180#define PPTP_ANALOG_TYPE 1
181#define PPTP_DIGITAL_TYPE 2
182#define PPTP_DONT_CARE_BEARER_TYPE 3
183
184struct PptpOutCallRequest {
185 __be16 callID;
186 __be16 callSerialNumber;
187 __be32 minBPS;
188 __be32 maxBPS;
189 __be32 bearerType;
190 __be32 framingType;
191 __be16 packetWindow;
192 __be16 packetProcDelay;
193 __be16 phoneNumberLength;
194 __u16 reserved1;
195 __u8 phoneNumber[64];
196 __u8 subAddress[64];
197};
198
199/* PptpCallResultCode */
200#define PPTP_OUTCALL_CONNECT 1
201#define PPTP_OUTCALL_GENERAL_ERROR 2
202#define PPTP_OUTCALL_NO_CARRIER 3
203#define PPTP_OUTCALL_BUSY 4
204#define PPTP_OUTCALL_NO_DIAL_TONE 5
205#define PPTP_OUTCALL_TIMEOUT 6
206#define PPTP_OUTCALL_DONT_ACCEPT 7
207
208struct PptpOutCallReply {
209 __be16 callID;
210 __be16 peersCallID;
211 __u8 resultCode;
212 __u8 generalErrorCode;
213 __be16 causeCode;
214 __be32 connectSpeed;
215 __be16 packetWindow;
216 __be16 packetProcDelay;
217 __be32 physChannelID;
218};
219
220struct PptpInCallRequest {
221 __be16 callID;
222 __be16 callSerialNumber;
223 __be32 callBearerType;
224 __be32 physChannelID;
225 __be16 dialedNumberLength;
226 __be16 dialingNumberLength;
227 __u8 dialedNumber[64];
228 __u8 dialingNumber[64];
229 __u8 subAddress[64];
230};
231
232/* PptpInCallResultCode */
233#define PPTP_INCALL_ACCEPT 1
234#define PPTP_INCALL_GENERAL_ERROR 2
235#define PPTP_INCALL_DONT_ACCEPT 3
236
237struct PptpInCallReply {
238 __be16 callID;
239 __be16 peersCallID;
240 __u8 resultCode;
241 __u8 generalErrorCode;
242 __be16 packetWindow;
243 __be16 packetProcDelay;
244 __u16 reserved;
245};
246
247struct PptpInCallConnected {
248 __be16 peersCallID;
249 __u16 reserved;
250 __be32 connectSpeed;
251 __be16 packetWindow;
252 __be16 packetProcDelay;
253 __be32 callFramingType;
254};
255
256struct PptpClearCallRequest {
257 __be16 callID;
258 __u16 reserved;
259};
260
261struct PptpCallDisconnectNotify {
262 __be16 callID;
263 __u8 resultCode;
264 __u8 generalErrorCode;
265 __be16 causeCode;
266 __u16 reserved;
267 __u8 callStatistics[128];
268};
269
270struct PptpWanErrorNotify {
271 __be16 peersCallID;
272 __u16 reserved;
273 __be32 crcErrors;
274 __be32 framingErrors;
275 __be32 hardwareOverRuns;
276 __be32 bufferOverRuns;
277 __be32 timeoutErrors;
278 __be32 alignmentErrors;
279};
280
281struct PptpSetLinkInfo {
282 __be16 peersCallID;
283 __u16 reserved;
284 __be32 sendAccm;
285 __be32 recvAccm;
286};
287
288union pptp_ctrl_union {
289 struct PptpStartSessionRequest sreq;
290 struct PptpStartSessionReply srep;
291 struct PptpStopSessionRequest streq;
292 struct PptpStopSessionReply strep;
293 struct PptpOutCallRequest ocreq;
294 struct PptpOutCallReply ocack;
295 struct PptpInCallRequest icreq;
296 struct PptpInCallReply icack;
297 struct PptpInCallConnected iccon;
298 struct PptpClearCallRequest clrreq;
299 struct PptpCallDisconnectNotify disc;
300 struct PptpWanErrorNotify wanerr;
301 struct PptpSetLinkInfo setlink;
302};
303
304extern int
305(*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
306 struct ip_conntrack *ct,
307 enum ip_conntrack_info ctinfo,
308 struct PptpControlHeader *ctlh,
309 union pptp_ctrl_union *pptpReq);
310
311extern int
312(*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
313 struct ip_conntrack *ct,
314 enum ip_conntrack_info ctinfo,
315 struct PptpControlHeader *ctlh,
316 union pptp_ctrl_union *pptpReq);
317
318extern void
319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
320 struct ip_conntrack_expect *exp_reply);
321
322extern void
323(*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
324 struct ip_conntrack_expect *exp);
325#endif /* __KERNEL__ */
326#endif /* _CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
deleted file mode 100644
index e371e0fc1672..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _CONNTRACK_PROTO_GRE_H
2#define _CONNTRACK_PROTO_GRE_H
3#include <asm/byteorder.h>
4
5/* GRE PROTOCOL HEADER */
6
7/* GRE Version field */
8#define GRE_VERSION_1701 0x0
9#define GRE_VERSION_PPTP 0x1
10
11/* GRE Protocol field */
12#define GRE_PROTOCOL_PPTP 0x880B
13
14/* GRE Flags */
15#define GRE_FLAG_C 0x80
16#define GRE_FLAG_R 0x40
17#define GRE_FLAG_K 0x20
18#define GRE_FLAG_S 0x10
19#define GRE_FLAG_A 0x80
20
21#define GRE_IS_C(f) ((f)&GRE_FLAG_C)
22#define GRE_IS_R(f) ((f)&GRE_FLAG_R)
23#define GRE_IS_K(f) ((f)&GRE_FLAG_K)
24#define GRE_IS_S(f) ((f)&GRE_FLAG_S)
25#define GRE_IS_A(f) ((f)&GRE_FLAG_A)
26
27/* GRE is a mess: Four different standards */
28struct gre_hdr {
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 rec:3,
31 srr:1,
32 seq:1,
33 key:1,
34 routing:1,
35 csum:1,
36 version:3,
37 reserved:4,
38 ack:1;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u16 csum:1,
41 routing:1,
42 key:1,
43 seq:1,
44 srr:1,
45 rec:3,
46 ack:1,
47 reserved:4,
48 version:3;
49#else
50#error "Adjust your <asm/byteorder.h> defines"
51#endif
52 __be16 protocol;
53};
54
55/* modified GRE header for PPTP */
56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __be16 call_id; /* peer's call_id for this session */
62 __be32 seq; /* sequence number. Present if S==1 */
63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */
65};
66
67
68/* this is part of ip_conntrack */
69struct ip_ct_gre {
70 unsigned int stream_timeout;
71 unsigned int timeout;
72};
73
74#ifdef __KERNEL__
75struct ip_conntrack_expect;
76struct ip_conntrack;
77
78/* structure for original <-> reply keymap */
79struct ip_ct_gre_keymap {
80 struct list_head list;
81
82 struct ip_conntrack_tuple tuple;
83};
84
85/* add new tuple->key_reply pair to keymap */
86int ip_ct_gre_keymap_add(struct ip_conntrack *ct,
87 struct ip_conntrack_tuple *t,
88 int reply);
89
90/* delete keymap entries */
91void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92
93
94/* get pointer to gre key, if present */
95static inline __be32 *gre_key(struct gre_hdr *greh)
96{
97 if (!greh->key)
98 return NULL;
99 if (greh->csum || greh->routing)
100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (__be32 *) (greh+sizeof(*greh));
102}
103
104/* get pointer ot gre csum, if present */
105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{
107 if (!greh->csum)
108 return NULL;
109 return (__sum16 *) (greh+sizeof(*greh));
110}
111
112#endif /* __KERNEL__ */
113
114#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
deleted file mode 100644
index 2c76b879e3dc..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* Header for use in defining a given protocol for connection tracking. */
2#ifndef _IP_CONNTRACK_PROTOCOL_H
3#define _IP_CONNTRACK_PROTOCOL_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct seq_file;
8
9struct ip_conntrack_protocol
10{
11 /* Protocol number. */
12 u_int8_t proto;
13
14 /* Protocol name */
15 const char *name;
16
17 /* Try to fill in the third arg: dataoff is offset past IP
18 hdr. Return true if possible. */
19 int (*pkt_to_tuple)(const struct sk_buff *skb,
20 unsigned int dataoff,
21 struct ip_conntrack_tuple *tuple);
22
23 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
24 * Some packets can't be inverted: return 0 in that case.
25 */
26 int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
27 const struct ip_conntrack_tuple *orig);
28
29 /* Print out the per-protocol part of the tuple. Return like seq_* */
30 int (*print_tuple)(struct seq_file *,
31 const struct ip_conntrack_tuple *);
32
33 /* Print out the private part of the conntrack. */
34 int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
35
36 /* Returns verdict for packet, or -1 for invalid. */
37 int (*packet)(struct ip_conntrack *conntrack,
38 const struct sk_buff *skb,
39 enum ip_conntrack_info ctinfo);
40
41 /* Called when a new connection for this protocol found;
42 * returns TRUE if it's OK. If so, packet() called next. */
43 int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
44
45 /* Called when a conntrack entry is destroyed */
46 void (*destroy)(struct ip_conntrack *conntrack);
47
48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
49 unsigned int hooknum);
50
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
54
55 /* convert nfnetlink attributes to protoinfo */
56 int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
57
58 int (*tuple_to_nfattr)(struct sk_buff *skb,
59 const struct ip_conntrack_tuple *t);
60 int (*nfattr_to_tuple)(struct nfattr *tb[],
61 struct ip_conntrack_tuple *t);
62
63 /* Module (if any) which this is connected to. */
64 struct module *me;
65};
66
67/* Protocol registration. */
68extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
69extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
70/* Existing built-in protocols */
71extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
72extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
73extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
74extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
75extern int ip_conntrack_protocol_tcp_init(void);
76
77/* Log invalid packets */
78extern unsigned int ip_ct_log_invalid;
79
80extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
81 const struct ip_conntrack_tuple *);
82extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
83 struct ip_conntrack_tuple *);
84
85#ifdef CONFIG_SYSCTL
86#ifdef DEBUG_INVALID_PACKETS
87#define LOG_INVALID(proto) \
88 (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
89#else
90#define LOG_INVALID(proto) \
91 ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
92 && net_ratelimit())
93#endif
94#else
95#define LOG_INVALID(proto) 0
96#endif /* CONFIG_SYSCTL */
97
98#endif /*_IP_CONNTRACK_PROTOCOL_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
deleted file mode 100644
index 4099a041a32a..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_SCTP_H
2#define _IP_CONNTRACK_SCTP_H
3
4#include <linux/netfilter/nf_conntrack_sctp.h>
5
6#endif /* _IP_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
deleted file mode 100644
index bef6c646defa..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8enum sip_header_pos {
9 POS_REG_REQ_URI,
10 POS_REQ_URI,
11 POS_FROM,
12 POS_TO,
13 POS_VIA,
14 POS_CONTACT,
15 POS_CONTENT,
16 POS_MEDIA,
17 POS_OWNER,
18 POS_CONNECTION,
19 POS_SDP_HEADER,
20};
21
22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 struct ip_conntrack *ct,
25 const char **dptr);
26extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
27 enum ip_conntrack_info ctinfo,
28 struct ip_conntrack_expect *exp,
29 const char *dptr);
30
31extern int ct_sip_get_info(const char *dptr, size_t dlen,
32 unsigned int *matchoff,
33 unsigned int *matchlen,
34 enum sip_header_pos pos);
35extern int ct_sip_lnlen(const char *line, const char *limit);
36extern const char *ct_sip_search(const char *needle, const char *haystack,
37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
39#endif /* __KERNEL__ */
40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
deleted file mode 100644
index 876b8fb17e68..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_TCP_H
2#define _IP_CONNTRACK_TCP_H
3
4#include <linux/netfilter/nf_conntrack_tcp.h>
5
6#endif /* _IP_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
deleted file mode 100644
index a404fc0abf0e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IP_CT_TFTP
2#define _IP_CT_TFTP
3
4#define TFTP_PORT 69
5
6struct tftphdr {
7 __be16 opcode;
8};
9
10#define TFTP_OPCODE_READ 1
11#define TFTP_OPCODE_WRITE 2
12#define TFTP_OPCODE_DATA 3
13#define TFTP_OPCODE_ACK 4
14#define TFTP_OPCODE_ERROR 5
15
16extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct ip_conntrack_expect *exp);
19
20#endif /* _IP_CT_TFTP */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 100644
index c228bde74c33..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1,146 +0,0 @@
1#ifndef _IP_CONNTRACK_TUPLE_H
2#define _IP_CONNTRACK_TUPLE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7/* A `tuple' is a structure containing the information to uniquely
8 identify a connection. ie. if two packets have the same tuple, they
9 are in the same connection; if not, they are not.
10
11 We divide the structure along "manipulatable" and
12 "non-manipulatable" lines, for the benefit of the NAT code.
13*/
14
15/* The protocol-specific manipulable parts of the tuple: always in
16 network order! */
17union ip_conntrack_manip_proto
18{
19 /* Add other protocols here. */
20 u_int16_t all;
21
22 struct {
23 __be16 port;
24 } tcp;
25 struct {
26 __be16 port;
27 } udp;
28 struct {
29 __be16 id;
30 } icmp;
31 struct {
32 __be16 port;
33 } sctp;
34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */
36 } gre;
37};
38
39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip
41{
42 __be32 ip;
43 union ip_conntrack_manip_proto u;
44};
45
46/* This contains the information to distinguish a connection. */
47struct ip_conntrack_tuple
48{
49 struct ip_conntrack_manip src;
50
51 /* These are the parts of the tuple which are fixed. */
52 struct {
53 __be32 ip;
54 union {
55 /* Add other protocols here. */
56 u_int16_t all;
57
58 struct {
59 __be16 port;
60 } tcp;
61 struct {
62 __be16 port;
63 } udp;
64 struct {
65 u_int8_t type, code;
66 } icmp;
67 struct {
68 __be16 port;
69 } sctp;
70 struct {
71 __be16 key; /* key is 32bit,
72 * pptp only uses 16 */
73 } gre;
74 } u;
75
76 /* The protocol. */
77 u_int8_t protonum;
78
79 /* The direction (for tuplehash) */
80 u_int8_t dir;
81 } dst;
82};
83
84/* This is optimized opposed to a memset of the whole structure. Everything we
85 * really care about is the source/destination unions */
86#define IP_CT_TUPLE_U_BLANK(tuple) \
87 do { \
88 (tuple)->src.u.all = 0; \
89 (tuple)->dst.u.all = 0; \
90 } while (0)
91
92#ifdef __KERNEL__
93
94#define DUMP_TUPLE(tp) \
95DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
96 (tp), (tp)->dst.protonum, \
97 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
98 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
99
100/* If we're the first tuple, it's the original dir. */
101#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
102
103/* Connections have two entries in the hash table: one for each way */
104struct ip_conntrack_tuple_hash
105{
106 struct list_head list;
107
108 struct ip_conntrack_tuple tuple;
109};
110
111#endif /* __KERNEL__ */
112
113static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1,
114 const struct ip_conntrack_tuple *t2)
115{
116 return t1->src.ip == t2->src.ip
117 && t1->src.u.all == t2->src.u.all;
118}
119
120static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1,
121 const struct ip_conntrack_tuple *t2)
122{
123 return t1->dst.ip == t2->dst.ip
124 && t1->dst.u.all == t2->dst.u.all
125 && t1->dst.protonum == t2->dst.protonum;
126}
127
128static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1,
129 const struct ip_conntrack_tuple *t2)
130{
131 return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2);
132}
133
134static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t,
135 const struct ip_conntrack_tuple *tuple,
136 const struct ip_conntrack_tuple *mask)
137{
138 return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip)
139 || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip)
140 || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all)
141 || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all)
142 || ((t->dst.protonum ^ tuple->dst.protonum)
143 & mask->dst.protonum));
144}
145
146#endif /* _IP_CONNTRACK_TUPLE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 100644
index bbca89aab813..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _IP_NAT_H
2#define _IP_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
5
6#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum ip_nat_manip_type
9{
10 IP_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST
12};
13
14/* SRC manip occurs POST_ROUTING or LOCAL_IN */
15#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
16
17#define IP_NAT_RANGE_MAP_IPS 1
18#define IP_NAT_RANGE_PROTO_SPECIFIED 2
19#define IP_NAT_RANGE_PROTO_RANDOM 4 /* add randomness to "port" selection */
20
21/* NAT sequence number modifications */
22struct ip_nat_seq {
23 /* position of the last TCP sequence number
24 * modification (if any) */
25 u_int32_t correction_pos;
26 /* sequence number offset before and after last modification */
27 int16_t offset_before, offset_after;
28};
29
30/* Single range specification. */
31struct ip_nat_range
32{
33 /* Set to OR of flags above. */
34 unsigned int flags;
35
36 /* Inclusive: network order. */
37 __be32 min_ip, max_ip;
38
39 /* Inclusive: network order */
40 union ip_conntrack_manip_proto min, max;
41};
42
43/* For backwards compat: don't use in modern code. */
44struct ip_nat_multi_range_compat
45{
46 unsigned int rangesize; /* Must be 1. */
47
48 /* hangs off end. */
49 struct ip_nat_range range[1];
50};
51
52#ifdef __KERNEL__
53#include <linux/list.h>
54
55/* Protects NAT hash tables, and NAT-private part of conntracks. */
56extern rwlock_t ip_nat_lock;
57
58/* The structure embedded in the conntrack structure. */
59struct ip_nat_info
60{
61 struct list_head bysource;
62 struct ip_nat_seq seq[IP_CT_DIR_MAX];
63};
64
65struct ip_conntrack;
66
67/* Set up the info structure to map into this range. */
68extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
69 const struct ip_nat_range *range,
70 unsigned int hooknum);
71
72/* Is this tuple already taken? (not by us)*/
73extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
74 const struct ip_conntrack *ignored_conntrack);
75
76#else /* !__KERNEL__: iptables wants this to compile. */
77#define ip_nat_multi_range ip_nat_multi_range_compat
78#endif /*__KERNEL__*/
79#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
deleted file mode 100644
index 60566f9fd7b3..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP_NAT_CORE_H
2#define _IP_NAT_CORE_H
3#include <linux/list.h>
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6/* This header used to share core functionality between the standalone
7 NAT module, and the compatibility layer's use of NAT for masquerading. */
8
9extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
10 enum ip_conntrack_info conntrackinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
deleted file mode 100644
index bf9cb105c885..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_helper.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _IP_NAT_HELPER_H
2#define _IP_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <linux/netfilter_ipv4/ip_conntrack.h>
6#include <linux/module.h>
7
8struct sk_buff;
9
10/* These return true or false. */
11extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
12 struct ip_conntrack *ct,
13 enum ip_conntrack_info ctinfo,
14 unsigned int match_offset,
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len);
18extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
19 struct ip_conntrack *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len);
25extern int ip_nat_seq_adjust(struct sk_buff **pskb,
26 struct ip_conntrack *ct,
27 enum ip_conntrack_info ctinfo);
28
29/* Setup NAT on this expected conntrack so it follows master, but goes
30 * to port ct->master->saved_proto. */
31extern void ip_nat_follow_master(struct ip_conntrack *ct,
32 struct ip_conntrack_expect *this);
33#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
deleted file mode 100644
index 36668bf0f373..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _NAT_PPTP_H
3#define _NAT_PPTP_H
4
5/* conntrack private data */
6struct ip_nat_pptp {
7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 __be16 pac_call_id; /* NAT'ed PAC call id */
9};
10
11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
deleted file mode 100644
index 612a43614e7b..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _IP_NAT_PROTOCOL_H
3#define _IP_NAT_PROTOCOL_H
4#include <linux/init.h>
5#include <linux/list.h>
6
7#include <linux/netfilter_ipv4/ip_nat.h>
8#include <linux/netfilter/nfnetlink_conntrack.h>
9
10struct iphdr;
11struct ip_nat_range;
12
13struct ip_nat_protocol
14{
15 /* Protocol name */
16 const char *name;
17
18 /* Protocol number. */
19 unsigned int protonum;
20
21 struct module *me;
22
23 /* Translate a packet to the target according to manip type.
24 Return true if succeeded. */
25 int (*manip_pkt)(struct sk_buff **pskb,
26 unsigned int iphdroff,
27 const struct ip_conntrack_tuple *tuple,
28 enum ip_nat_manip_type maniptype);
29
30 /* Is the manipable part of the tuple between min and max incl? */
31 int (*in_range)(const struct ip_conntrack_tuple *tuple,
32 enum ip_nat_manip_type maniptype,
33 const union ip_conntrack_manip_proto *min,
34 const union ip_conntrack_manip_proto *max);
35
36 /* Alter the per-proto part of the tuple (depending on
37 maniptype), to give a unique tuple in the given range if
38 possible; return false if not. Per-protocol part of tuple
39 is initialized to the incoming packet. */
40 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
41 const struct ip_nat_range *range,
42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack);
44
45 int (*range_to_nfattr)(struct sk_buff *skb,
46 const struct ip_nat_range *range);
47
48 int (*nfattr_to_range)(struct nfattr *tb[],
49 struct ip_nat_range *range);
50};
51
52/* Protocol registration. */
53extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
54extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
55
56extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
57extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
58
59/* Built-in protocols. */
60extern struct ip_nat_protocol ip_nat_protocol_tcp;
61extern struct ip_nat_protocol ip_nat_protocol_udp;
62extern struct ip_nat_protocol ip_nat_protocol_icmp;
63extern struct ip_nat_protocol ip_nat_unknown_protocol;
64
65extern int init_protocols(void) __init;
66extern void cleanup_protocols(void);
67extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
68
69extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
70 const struct ip_nat_range *range);
71extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
72 struct ip_nat_range *range);
73
74#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 100644
index 73b9552e6a89..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _IP_NAT_RULE_H
2#define _IP_NAT_RULE_H
3#include <linux/netfilter_ipv4/ip_conntrack.h>
4#include <linux/netfilter_ipv4/ip_tables.h>
5#include <linux/netfilter_ipv4/ip_nat.h>
6
7#ifdef __KERNEL__
8
9extern int ip_nat_rule_init(void) __init;
10extern void ip_nat_rule_cleanup(void);
11extern int ip_nat_rule_find(struct sk_buff **pskb,
12 unsigned int hooknum,
13 const struct net_device *in,
14 const struct net_device *out,
15 struct ip_conntrack *ct,
16 struct ip_nat_info *info);
17
18extern unsigned int
19alloc_null_binding(struct ip_conntrack *conntrack,
20 struct ip_nat_info *info,
21 unsigned int hooknum);
22
23extern unsigned int
24alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
25 struct ip_nat_info *info,
26 unsigned int hooknum);
27#endif
28#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index cc4c0b2269af..be6e682a85ec 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -13,7 +13,7 @@ struct ipt_same_info
13 u_int32_t *iparray; 13 u_int32_t *iparray;
14 14
15 /* hangs off end. */ 15 /* hangs off end. */
16 struct ip_nat_range range[IPT_SAME_MAX_RANGE]; 16 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
17}; 17};
18 18
19#endif /*_IPT_SAME_H*/ 19#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2a20f488ac1b..f41688f56632 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -138,6 +138,11 @@ struct nlattr
138#include <linux/capability.h> 138#include <linux/capability.h>
139#include <linux/skbuff.h> 139#include <linux/skbuff.h>
140 140
141static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
142{
143 return (struct nlmsghdr *)skb->data;
144}
145
141struct netlink_skb_parms 146struct netlink_skb_parms
142{ 147{
143 struct ucred creds; /* Skb credentials */ 148 struct ucred creds; /* Skb credentials */
@@ -152,7 +157,10 @@ struct netlink_skb_parms
152#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 157#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
153 158
154 159
155extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 160extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex,
163 struct module *module);
156extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
157extern int netlink_has_listeners(struct sock *sk, unsigned int group); 165extern int netlink_has_listeners(struct sock *sk, unsigned int group);
158extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
@@ -171,9 +179,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
171 179
172/* 180/*
173 * skb should fit one page. This choice is good for headerless malloc. 181 * skb should fit one page. This choice is good for headerless malloc.
182 * But we should limit to 8K so that userspace does not have to
183 * use enormous buffer sizes on recvmsg() calls just to avoid
184 * MSG_TRUNC when PAGE_SIZE is very large.
174 */ 185 */
175#define NLMSG_GOODORDER 0 186#if PAGE_SIZE < 8192UL
176#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 187#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
188#else
189#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
190#endif
191
177#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) 192#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
178 193
179 194
@@ -217,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
217#define NLMSG_PUT(skb, pid, seq, type, len) \ 232#define NLMSG_PUT(skb, pid, seq, type, len) \
218 NLMSG_NEW(skb, pid, seq, type, len, 0) 233 NLMSG_NEW(skb, pid, seq, type, len, 0)
219 234
220#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
221 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
222 (cb)->nlh->nlmsg_seq, type, len, flags)
223
224#define NLMSG_END(skb, nlh) \
225({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
226 (skb)->len; })
227
228#define NLMSG_CANCEL(skb, nlh) \
229({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
230 -1; })
231
232extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 235extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
233 struct nlmsghdr *nlh, 236 struct nlmsghdr *nlh,
234 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 237 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
new file mode 100644
index 000000000000..9a30ba2ca75e
--- /dev/null
+++ b/include/linux/nl80211.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_NL80211_H
2#define __LINUX_NL80211_H
3/*
4 * 802.11 netlink interface public header
5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
7 */
8
9/**
10 * enum nl80211_iftype - (virtual) interface types
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member
14 * @NL80211_IFTYPE_AP: access point
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 *
20 * These values are used with the NL80211_ATTR_IFTYPE
21 * to set the type of an interface.
22 *
23 */
24enum nl80211_iftype {
25 NL80211_IFTYPE_UNSPECIFIED,
26 NL80211_IFTYPE_ADHOC,
27 NL80211_IFTYPE_STATION,
28 NL80211_IFTYPE_AP,
29 NL80211_IFTYPE_AP_VLAN,
30 NL80211_IFTYPE_WDS,
31 NL80211_IFTYPE_MONITOR,
32
33 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST
35};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37
38#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9cd0d0eaf523..96326594e55d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -133,7 +133,7 @@
133static inline void SetPageUptodate(struct page *page) 133static inline void SetPageUptodate(struct page *page)
134{ 134{
135 if (!test_and_set_bit(PG_uptodate, &page->flags)) 135 if (!test_and_set_bit(PG_uptodate, &page->flags))
136 page_test_and_clear_dirty(page); 136 page_clear_dirty(page);
137} 137}
138#else 138#else
139#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 139#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4a629ea70cc4..1fae30af91f3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
574#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
576 576
577struct rtnetlink_link
578{
579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
580 int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
581};
582
583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 577extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 578extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 579extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
@@ -605,7 +598,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
605 598
606#define RTA_PUT_NOHDR(skb, attrlen, data) \ 599#define RTA_PUT_NOHDR(skb, attrlen, data) \
607({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ 600({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
608 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ 601 memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
609 RTA_ALIGN(attrlen) - attrlen); }) 602 RTA_ALIGN(attrlen) - attrlen); })
610 603
611#define RTA_PUT_U8(skb, attrtype, value) \ 604#define RTA_PUT_U8(skb, attrtype, value) \
@@ -637,12 +630,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
637 RTA_PUT(skb, attrtype, 0, NULL); 630 RTA_PUT(skb, attrtype, 0, NULL);
638 631
639#define RTA_NEST(skb, type) \ 632#define RTA_NEST(skb, type) \
640({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ 633({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
641 RTA_PUT(skb, type, 0, NULL); \ 634 RTA_PUT(skb, type, 0, NULL); \
642 __start; }) 635 __start; })
643 636
644#define RTA_NEST_END(skb, start) \ 637#define RTA_NEST_END(skb, start) \
645({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ 638({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
646 (skb)->len; }) 639 (skb)->len; })
647 640
648#define RTA_NEST_CANCEL(skb, start) \ 641#define RTA_NEST_CANCEL(skb, start) \
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
new file mode 100644
index 000000000000..f7b826b565c7
--- /dev/null
+++ b/include/linux/rxrpc.h
@@ -0,0 +1,62 @@
1/* AF_RXRPC parameters
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_H
13#define _LINUX_RXRPC_H
14
15#include <linux/in.h>
16#include <linux/in6.h>
17
18/*
19 * RxRPC socket address
20 */
21struct sockaddr_rxrpc {
22 sa_family_t srx_family; /* address family */
23 u16 srx_service; /* service desired */
24 u16 transport_type; /* type of transport socket (SOCK_DGRAM) */
25 u16 transport_len; /* length of transport address */
26 union {
27 sa_family_t family; /* transport address family */
28 struct sockaddr_in sin; /* IPv4 transport address */
29 struct sockaddr_in6 sin6; /* IPv6 transport address */
30 } transport;
31};
32
33/*
34 * RxRPC socket options
35 */
36#define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */
37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */
39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
40
41/*
42 * RxRPC control messages
43 * - terminal messages mean that a user call ID tag can be recycled
44 */
45#define RXRPC_USER_CALL_ID 1 /* user call ID specifier */
46#define RXRPC_ABORT 2 /* abort request / notification [terminal] */
47#define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */
48#define RXRPC_NET_ERROR 5 /* network error received [terminal] */
49#define RXRPC_BUSY 6 /* server busy received [terminal] */
50#define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */
51#define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */
52#define RXRPC_ACCEPT 9 /* [Server] accept request */
53
54/*
55 * RxRPC security levels
56 */
57#define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60
61
62#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 49fe2997a016..a1707583de49 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -196,13 +196,13 @@ extern void init_idle(struct task_struct *idle, int cpu);
196extern cpumask_t nohz_cpu_mask; 196extern cpumask_t nohz_cpu_mask;
197 197
198/* 198/*
199 * Only dump TASK_* tasks. (-1 for all tasks) 199 * Only dump TASK_* tasks. (0 for all tasks)
200 */ 200 */
201extern void show_state_filter(unsigned long state_filter); 201extern void show_state_filter(unsigned long state_filter);
202 202
203static inline void show_state(void) 203static inline void show_state(void)
204{ 204{
205 show_state_filter(-1); 205 show_state_filter(0);
206} 206}
207 207
208extern void show_regs(struct pt_regs *); 208extern void show_regs(struct pt_regs *);
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d4f86560bfff..d70df61a029f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -63,6 +63,15 @@ typedef struct sctphdr {
63 __be32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__
67#include <linux/skbuff.h>
68
69static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70{
71 return (struct sctphdr *)skb_transport_header(skb);
72}
73#endif
74
66/* Section 3.2. Chunk Field Descriptions. */ 75/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 76typedef struct sctp_chunkhdr {
68 __u8 type; 77 __u8 type;
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h
deleted file mode 100644
index cdfa77fcb06b..000000000000
--- a/include/linux/sdla_fr.h
+++ /dev/null
@@ -1,638 +0,0 @@
1/*****************************************************************************
2* sdla_fr.h Sangoma frame relay firmware API definitions.
3*
4* Author: Gideon Hack
5* Nenad Corbic <ncorbic@sangoma.com>
6*
7* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Oct 04, 1999 Gideon Hack Updated API structures
15* Jun 02, 1999 Gideon Hack Modifications for S514 support
16* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
17* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
18* 0x05 and 0x06 respectively.
19* Dec 23, 1996 Gene Kozin v2.0
20* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
21* Sep 26, 1995 Gene Kozin Initial version.
22*****************************************************************************/
23#ifndef _SDLA_FR_H
24#define _SDLA_FR_H
25
26/*----------------------------------------------------------------------------
27 * Notes:
28 * ------
29 * 1. All structures defined in this file are byte-alined.
30 *
31 * Compiler Platform
32 * -------- --------
33 * GNU C Linux
34 */
35
36#ifndef PACKED
37# define PACKED __attribute__((packed))
38#endif /* PACKED */
39
40/* Adapter memory layout */
41#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
42#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
43#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
44#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
45#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
46#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
47#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
48#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
49#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
50
51/* Important constants */
52#define FR502_MAX_DATA 4096 /* maximum data buffer length */
53#define FR508_MAX_DATA 4080 /* maximum data buffer length */
54#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
55(for configuration purposes) */
56#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
57
58#define HIGHEST_VALID_DLCI 991
59
60/****** Data Structures *****************************************************/
61
62/*----------------------------------------------------------------------------
63 * Frame relay command block.
64 */
65typedef struct fr_cmd
66{
67 unsigned char command PACKED; /* command code */
68 unsigned short length PACKED; /* length of data buffer */
69 unsigned char result PACKED; /* return code */
70 unsigned short dlci PACKED; /* DLCI number */
71 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
72 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
73 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
74 unsigned char rsrv[2] PACKED; /* reserved for future use */
75} fr_cmd_t;
76
77/* 'command' field defines */
78#define FR_WRITE 0x01
79#define FR_READ 0x02
80#define FR_ISSUE_IS_FRAME 0x03
81#define FR_SET_CONFIG 0x10
82#define FR_READ_CONFIG 0x11
83#define FR_COMM_DISABLE 0x12
84#define FR_COMM_ENABLE 0x13
85#define FR_READ_STATUS 0x14
86#define FR_READ_STATISTICS 0x15
87#define FR_FLUSH_STATISTICS 0x16
88#define FR_LIST_ACTIVE_DLCI 0x17
89#define FR_FLUSH_DATA_BUFFERS 0x18
90#define FR_READ_ADD_DLC_STATS 0x19
91#define FR_ADD_DLCI 0x20
92#define FR_DELETE_DLCI 0x21
93#define FR_ACTIVATE_DLCI 0x22
94#define FR_DEACTIVATE_DLCI 0x22
95#define FR_READ_MODEM_STATUS 0x30
96#define FR_SET_MODEM_STATUS 0x31
97#define FR_READ_ERROR_STATS 0x32
98#define FR_FLUSH_ERROR_STATS 0x33
99#define FR_READ_DLCI_IB_MAPPING 0x34
100#define FR_READ_CODE_VERSION 0x40
101#define FR_SET_INTR_MODE 0x50
102#define FR_READ_INTR_MODE 0x51
103#define FR_SET_TRACE_CONFIG 0x60
104#define FR_FT1_STATUS_CTRL 0x80
105#define FR_SET_FT1_MODE 0x81
106
107/* Special UDP drivers management commands */
108#define FPIPE_ENABLE_TRACING 0x41
109#define FPIPE_DISABLE_TRACING 0x42
110#define FPIPE_GET_TRACE_INFO 0x43
111#define FPIPE_FT1_READ_STATUS 0x44
112#define FPIPE_DRIVER_STAT_IFSEND 0x45
113#define FPIPE_DRIVER_STAT_INTR 0x46
114#define FPIPE_DRIVER_STAT_GEN 0x47
115#define FPIPE_FLUSH_DRIVER_STATS 0x48
116#define FPIPE_ROUTER_UP_TIME 0x49
117
118/* 'result' field defines */
119#define FRRES_OK 0x00 /* command executed successfully */
120#define FRRES_DISABLED 0x01 /* communications not enabled */
121#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
122#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
123#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
124#define FRRES_TOO_LONG 0x05
125#define FRRES_TOO_MANY 0x06
126#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
127#define FRRES_BUFFER_OVERFLOW 0x08
128#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
129#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
130#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
131#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
132#define FRRES_DLCI_MISMATCH 0x14
133#define FRRES_INVALID_CMD 0x1F /* invalid command */
134
135/* 'attr' field defines */
136#define FRATTR_
137
138/*----------------------------------------------------------------------------
139 * Frame relay mailbox.
140 * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
141 * For S502 it is also located at offset FR502_RXMB_OFFS into
142 * FR502_RX_VECTOR.
143 */
144typedef struct fr_mbox
145{
146 unsigned char opflag PACKED; /* 00h: execution flag */
147 fr_cmd_t cmd PACKED; /* 01h: command block */
148 unsigned char data[1] PACKED; /* 10h: variable length data buffer */
149} fr_mbox_t;
150
151/*----------------------------------------------------------------------------
152 * S502 frame relay status flags.
153 * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
154 */
155typedef struct fr502_flags
156{
157 unsigned char rsrv1[1] PACKED; /* 00h: */
158 unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
159 unsigned char rx_ready PACKED; /* 02h: Rx frame available */
160 unsigned char event PACKED; /* 03h: asynchronous event */
161 unsigned char mstatus PACKED; /* 04h: modem status */
162 unsigned char rsrv2[8] PACKED; /* 05h: */
163 unsigned char iflag PACKED; /* 0Dh: interrupt flag */
164 unsigned char imask PACKED; /* 0Eh: interrupt mask */
165} fr502_flags_t;
166
167/*----------------------------------------------------------------------------
168 * S508 frame relay status flags.
169 * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
170 */
171typedef struct fr508_flags
172{
173 unsigned char rsrv1[3] PACKED; /* 00h: reserved */
174 unsigned char event PACKED; /* 03h: asynchronous event */
175 unsigned char mstatus PACKED; /* 04h: modem status */
176 unsigned char rsrv2[11] PACKED; /* 05h: reserved */
177 unsigned char iflag PACKED; /* 10h: interrupt flag */
178 unsigned char imask PACKED; /* 11h: interrupt mask */
179 unsigned long tse_offs PACKED; /* 12h: Tx status element */
180 unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
181} fr508_flags_t;
182
183/* 'event' field defines */
184#define FR_EVENT_STATUS 0x01 /* channel status change */
185#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
186#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
187#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
188
189/* 'mstatus' field defines */
190#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
191#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
192
193/* 'iflag' & 'imask' fields defines */
194#define FR_INTR_RXRDY 0x01 /* Rx ready */
195#define FR_INTR_TXRDY 0x02 /* Tx ready */
196#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
197#define FR_INTR_READY 0x08 /* interface command completed */
198#define FR_INTR_DLC 0x10 /* DLC status change */
199#define FR_INTR_TIMER 0x20 /* millisecond timer */
200#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
201
202
203/*----------------------------------------------------------------------------
204 * Receive Buffer Configuration Info. S508 only!
205 * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
206 */
207typedef struct fr_buf_info
208{
209 unsigned short rse_num PACKED; /* 00h: number of status elements */
210 unsigned long rse_base PACKED; /* 02h: receive status array base */
211 unsigned long rse_next PACKED; /* 06h: next status element */
212 unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */
213 unsigned short reserved PACKED; /* 0Eh: */
214 unsigned long buf_top PACKED; /* 10h: rotational buffer top */
215} fr_buf_info_t;
216
217/*----------------------------------------------------------------------------
218 * Buffer Status Element. S508 only!
219 * Array of structures of this type is located at offset defined by the
220 * 'rse_base' field of the frBufInfo_t structure into absolute adapter
221 * memory address space.
222 */
223typedef struct fr_rx_buf_ctl
224{
225 unsigned char flag PACKED; /* 00h: ready flag */
226 unsigned short length PACKED; /* 01h: frame length */
227 unsigned short dlci PACKED; /* 03h: DLCI */
228 unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
229 unsigned short tmstamp PACKED; /* 06h: time stamp */
230 unsigned short rsrv[2] PACKED; /* 08h: */
231 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
232} fr_rx_buf_ctl_t;
233
234typedef struct fr_tx_buf_ctl
235{
236 unsigned char flag PACKED; /* 00h: ready flag */
237 unsigned short rsrv0[2] PACKED; /* 01h: */
238 unsigned short length PACKED; /* 05h: frame length */
239 unsigned short dlci PACKED; /* 07h: DLCI */
240 unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
241 unsigned short rsrv1 PACKED; /* 0Ah: */
242 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
243} fr_tx_buf_ctl_t;
244
245/*----------------------------------------------------------------------------
246 * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
247 */
248typedef struct fr_conf
249{
250 unsigned short station PACKED; /* 00h: CPE/Node */
251 unsigned short options PACKED; /* 02h: configuration options */
252 unsigned short kbps PACKED; /* 04h: baud rate in kbps */
253 unsigned short port PACKED; /* 06h: RS-232/V.35 */
254 unsigned short mtu PACKED; /* 08h: max. transmit length */
255 unsigned short t391 PACKED; /* 0Ah: */
256 unsigned short t392 PACKED; /* 0Ch: */
257 unsigned short n391 PACKED; /* 0Eh: */
258 unsigned short n392 PACKED; /* 10h: */
259 unsigned short n393 PACKED; /* 12h: */
260 unsigned short cir_fwd PACKED; /* 14h: */
261 unsigned short bc_fwd PACKED; /* 16h: */
262 unsigned short be_fwd PACKED; /* 18h: */
263 unsigned short cir_bwd PACKED; /* 1Ah: */
264 unsigned short bc_bwd PACKED; /* 1Ch: */
265 unsigned short be_bwd PACKED; /* 1Eh: */
266 unsigned short dlci[0] PACKED; /* 20h: */
267} fr_conf_t;
268
269/* 'station_type' defines */
270#define FRCFG_STATION_CPE 0
271#define FRCFG_STATION_NODE 1
272
273/* 'conf_flags' defines */
274#define FRCFG_IGNORE_TX_CIR 0x0001
275#define FRCFG_IGNORE_RX_CIR 0x0002
276#define FRCFG_DONT_RETRANSMIT 0x0004
277#define FRCFG_IGNORE_CBS 0x0008
278#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
279#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
280#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
281
282/* 'baud_rate' defines */
283#define FRCFG_BAUD_1200 12
284#define FRCFG_BAUD_2400 24
285#define FRCFG_BAUD_4800 48
286#define FRCFG_BAUD_9600 96
287#define FRCFG_BAUD_19200 19
288#define FRCFG_BAUD_38400 38
289#define FRCFG_BAUD_56000 56
290#define FRCFG_BAUD_64000 64
291#define FRCFG_BAUD_128000 128
292
293/* 'port_mode' defines */
294#define FRCFG_MODE_EXT_CLK 0x0000
295#define FRCFG_MODE_INT_CLK 0x0001
296#define FRCFG_MODE_V35 0x0000 /* S508 only */
297#define FRCFG_MODE_RS232 0x0002 /* S508 only */
298
299/* defines for line tracing */
300
301/* the line trace status element presented by the frame relay code */
302typedef struct {
303 unsigned char flag PACKED; /* ready flag */
304 unsigned short length PACKED; /* trace length */
305 unsigned char rsrv0[2] PACKED; /* reserved */
306 unsigned char attr PACKED; /* trace attributes */
307 unsigned short tmstamp PACKED; /* time stamp */
308 unsigned char rsrv1[4] PACKED; /* reserved */
309 unsigned long offset PACKED; /* buffer absolute address */
310} fr_trc_el_t;
311
312typedef struct {
313 unsigned char status PACKED; /* status flag */
314 unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
315 /* data passed */
316 unsigned short length PACKED; /* frame length */
317 unsigned short tmstamp PACKED; /* time stamp */
318} fpipemon_trc_hdr_t;
319
320typedef struct {
321 fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
322 unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
323} fpipemon_trc_t;
324
325/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
326/* for returning the number of frames being passed to fpipemon */
327#define TRC_OUTGOING_FRM 0x01
328#define TRC_ABORT_ERROR 0x10
329#define TRC_CRC_ERROR 0x20
330#define TRC_OVERRUN_ERROR 0x40
331#define MORE_TRC_DATA 0x80
332
333#define MAX_FRMS_TRACED 0x07
334
335#define NO_TRC_ELEMENTS_OFF 0x9000
336#define BASE_TRC_ELEMENTS_OFF 0x9002
337#define TRC_ACTIVE 0x01
338#define FLUSH_TRC_BUFFERS 0x02
339#define FLUSH_TRC_STATISTICS 0x04
340#define TRC_SIGNALLING_FRMS 0x10
341#define TRC_INFO_FRMS 0x20
342#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
343#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
344
345/*----------------------------------------------------------------------------
346 * Channel configuration.
347 * This structure is passed to the FR_SET_CONFIG command when dlci != 0.
348 */
349typedef struct fr_dlc_conf
350{
351 unsigned short conf_flags PACKED; /* 00h: configuration bits */
352 unsigned short cir_fwd PACKED; /* 02h: */
353 unsigned short bc_fwd PACKED; /* 04h: */
354 unsigned short be_fwd PACKED; /* 06h: */
355 unsigned short cir_bwd PACKED; /* 08h: */
356 unsigned short bc_bwd PACKED; /* 0Ah: */
357 unsigned short be_bwd PACKED; /* 0Ch: */
358} fr_dlc_conf_t;
359
360/*----------------------------------------------------------------------------
361 * S502 interrupt mode control block.
362 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
363 * FR_READ_INTR_FLAGS commands.
364 */
365typedef struct fr502_intr_ctl
366{
367 unsigned char mode PACKED; /* 00h: interrupt enable flags */
368 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
369} fr502_intr_ctl_t;
370
371/*----------------------------------------------------------------------------
372 * S508 interrupt mode control block.
373 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
374 * FR_READ_INTR_FLAGS commands.
375 */
376typedef struct fr508_intr_ctl
377{
378 unsigned char mode PACKED; /* 00h: interrupt enable flags */
379 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
380 unsigned char irq PACKED; /* 03h: IRQ level to activate */
381 unsigned char flags PACKED; /* 04h: ?? */
382 unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
383} fr508_intr_ctl_t;
384
385/*----------------------------------------------------------------------------
386 * Channel status.
387 * This structure is returned by the FR_READ_STATUS command.
388 */
389typedef struct fr_dlc_Status
390{
391 unsigned char status PACKED; /* 00h: link/DLCI status */
392 struct
393 {
394 unsigned short dlci PACKED; /* 01h: DLCI number */
395 unsigned char status PACKED; /* 03h: DLCI status */
396 } circuit[1] PACKED;
397} fr_dlc_status_t;
398
399/* 'status' defines */
400#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
401#define FR_LINK_OPER 0x01
402#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
403#define FR_DLCI_ACTIVE 0x02
404#define FR_DLCI_WAITING 0x04
405#define FR_DLCI_NEW 0x08
406#define FR_DLCI_REPORT 0x40
407
408/*----------------------------------------------------------------------------
409 * Global Statistics Block.
410 * This structure is returned by the FR_READ_STATISTICS command when
411 * dcli == 0.
412 */
413typedef struct fr_link_stat
414{
415 unsigned short rx_too_long PACKED; /* 00h: */
416 unsigned short rx_dropped PACKED; /* 02h: */
417 unsigned short rx_dropped2 PACKED; /* 04h: */
418 unsigned short rx_bad_dlci PACKED; /* 06h: */
419 unsigned short rx_bad_format PACKED; /* 08h: */
420 unsigned short retransmitted PACKED; /* 0Ah: */
421 unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
422 unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
423 unsigned short cpe_rx_FSR PACKED; /* 10h: */
424 unsigned short cpe_rx_LIV PACKED; /* 12h: */
425 unsigned short node_rx_FSE PACKED; /* 14h: */
426 unsigned short node_rx_LIV PACKED; /* 16h: */
427 unsigned short node_tx_FSR PACKED; /* 18h: */
428 unsigned short node_tx_LIV PACKED; /* 1Ah: */
429 unsigned short rx_ISF_err PACKED; /* 1Ch: */
430 unsigned short rx_unsolicited PACKED; /* 1Eh: */
431 unsigned short rx_SSN_err PACKED; /* 20h: */
432 unsigned short rx_RSN_err PACKED; /* 22h: */
433 unsigned short T391_timeouts PACKED; /* 24h: */
434 unsigned short T392_timeouts PACKED; /* 26h: */
435 unsigned short N392_reached PACKED; /* 28h: */
436 unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
437 unsigned short current_SSN PACKED; /* 2Ch: */
438 unsigned short current_RSN PACKED; /* 2Eh: */
439 unsigned short curreny_T391 PACKED; /* 30h: */
440 unsigned short current_T392 PACKED; /* 32h: */
441 unsigned short current_N392 PACKED; /* 34h: */
442 unsigned short current_N393 PACKED; /* 36h: */
443} fr_link_stat_t;
444
445/*----------------------------------------------------------------------------
446 * DLCI statistics.
447 * This structure is returned by the FR_READ_STATISTICS command when
448 * dlci != 0.
449 */
450typedef struct fr_dlci_stat
451{
452 unsigned long tx_frames PACKED; /* 00h: */
453 unsigned long tx_bytes PACKED; /* 04h: */
454 unsigned long rx_frames PACKED; /* 08h: */
455 unsigned long rx_bytes PACKED; /* 0Ch: */
456 unsigned long rx_dropped PACKED; /* 10h: */
457 unsigned long rx_inactive PACKED; /* 14h: */
458 unsigned long rx_exceed_CIR PACKED; /* 18h: */
459 unsigned long rx_DE_set PACKED; /* 1Ch: */
460 unsigned long tx_throughput PACKED; /* 20h: */
461 unsigned long tx_calc_timer PACKED; /* 24h: */
462 unsigned long rx_throughput PACKED; /* 28h: */
463 unsigned long rx_calc_timer PACKED; /* 2Ch: */
464} fr_dlci_stat_t;
465
466/*----------------------------------------------------------------------------
467 * Communications error statistics.
468 * This structure is returned by the FR_READ_ERROR_STATS command.
469 */
470typedef struct fr_comm_stat
471{
472 unsigned char rx_overruns PACKED; /* 00h: */
473 unsigned char rx_bad_crc PACKED; /* 01h: */
474 unsigned char rx_aborts PACKED; /* 02h: */
475 unsigned char rx_too_long PACKED; /* 03h: */
476 unsigned char tx_aborts PACKED; /* 04h: */
477 unsigned char tx_underruns PACKED; /* 05h: */
478 unsigned char tx_missed_undr PACKED; /* 06h: */
479 unsigned char dcd_dropped PACKED; /* 07h: */
480 unsigned char cts_dropped PACKED; /* 08h: */
481} fr_comm_stat_t;
482
483/*----------------------------------------------------------------------------
484 * Defines for the FR_ISSUE_IS_FRAME command.
485 */
486#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
487#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
488
489/*----------------------------------------------------------------------------
490 * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
491 */
492
493typedef struct arphdr_fr
494 {
495 unsigned short ar_hrd PACKED; /* format of hardware addr */
496 unsigned short ar_pro PACKED; /* format of protocol addr */
497 unsigned char ar_hln PACKED; /* length of hardware addr */
498 unsigned char ar_pln PACKED; /* length of protocol addr */
499 unsigned short ar_op PACKED; /* ARP opcode */
500 unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
501 unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
502 unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
503 unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
504 } arphdr_fr_t;
505
506/*----------------------------------------------------------------------------
507 * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
508 */
509typedef struct arphdr_1490
510 {
511 unsigned char control PACKED; /* UI, etc... */
512 unsigned char pad PACKED; /* Pad */
513 unsigned char NLPID PACKED; /* SNAP */
514 unsigned char OUI[3] PACKED; /* Ethertype, etc... */
515 unsigned short PID PACKED; /* ARP, IP, etc... */
516 } arphdr_1490_t;
517
518/* UDP/IP packet (for UDP management) layout */
519
520/* The embedded control block for UDP mgmt
521 This is essentially a mailbox structure, without the large data field */
522
523typedef struct {
524 unsigned char opp_flag PACKED; /* the opp flag */
525 unsigned char command PACKED; /* command code */
526 unsigned short length PACKED; /* length of data buffer */
527 unsigned char result PACKED; /* return code */
528 unsigned short dlci PACKED; /* DLCI number */
529 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
530 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
531 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
532 unsigned char rsrv[2] PACKED; /* reserved for future use */
533} cblock_t;
534
535
536/* UDP management packet layout (data area of ip packet) */
537
538typedef struct {
539 unsigned char control PACKED;
540 unsigned char NLPID PACKED;
541} fr_encap_hdr_t;
542
543typedef struct {
544// fr_encap_hdr_t fr_encap_hdr PACKED;
545 ip_pkt_t ip_pkt PACKED;
546 udp_pkt_t udp_pkt PACKED;
547 wp_mgmt_t wp_mgmt PACKED;
548 cblock_t cblock PACKED;
549 unsigned char data[4080] PACKED;
550} fr_udp_pkt_t;
551
552
553/* valid ip_protocol for UDP management */
554#define UDPMGMT_UDP_PROTOCOL 0x11
555
556#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
557#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
558
559/* values for request/reply byte */
560#define UDPMGMT_REQUEST 0x01
561#define UDPMGMT_REPLY 0x02
562#define UDP_OFFSET 12
563
564typedef struct {
565 unsigned long if_send_entry;
566 unsigned long if_send_skb_null;
567 unsigned long if_send_broadcast;
568 unsigned long if_send_multicast;
569 unsigned long if_send_critical_ISR;
570 unsigned long if_send_critical_non_ISR;
571 unsigned long if_send_busy;
572 unsigned long if_send_busy_timeout;
573 unsigned long if_send_DRVSTATS_request;
574 unsigned long if_send_FPIPE_request;
575 unsigned long if_send_wan_disconnected;
576 unsigned long if_send_dlci_disconnected;
577 unsigned long if_send_no_bfrs;
578 unsigned long if_send_adptr_bfrs_full;
579 unsigned long if_send_bfrs_passed_to_adptr;
580 unsigned long if_send_consec_send_fail;
581} drvstats_if_send_t;
582
583typedef struct {
584 unsigned long rx_intr_no_socket;
585 unsigned long rx_intr_dev_not_started;
586 unsigned long rx_intr_DRVSTATS_request;
587 unsigned long rx_intr_FPIPE_request;
588 unsigned long rx_intr_bfr_not_passed_to_stack;
589 unsigned long rx_intr_bfr_passed_to_stack;
590 } drvstats_rx_intr_t;
591
592typedef struct {
593 unsigned long UDP_FPIPE_mgmt_kmalloc_err;
594 unsigned long UDP_FPIPE_mgmt_direction_err;
595 unsigned long UDP_FPIPE_mgmt_adptr_type_err;
596 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
597 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
598 unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
599 unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
600 unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
601 unsigned long UDP_FPIPE_mgmt_passed_to_stack;
602 unsigned long UDP_FPIPE_mgmt_no_socket;
603 unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
604 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
605 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
606 unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
607 unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
608 unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
609 unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
610 unsigned long UDP_DRVSTATS_mgmt_no_socket;
611} drvstats_gen_t;
612
613typedef struct {
614 unsigned char attr PACKED;
615 unsigned short time_stamp PACKED;
616 unsigned char reserved[13] PACKED;
617} api_rx_hdr_t;
618
619typedef struct {
620 api_rx_hdr_t api_rx_hdr PACKED;
621 void * data PACKED;
622} api_rx_element_t;
623
624typedef struct {
625 unsigned char attr PACKED;
626 unsigned char reserved[15] PACKED;
627} api_tx_hdr_t;
628
629typedef struct {
630 api_tx_hdr_t api_tx_hdr PACKED;
631 void * data PACKED;
632} api_tx_element_t;
633
634#ifdef _MSC_
635# pragma pack()
636#endif
637#endif /* _SDLA_FR_H */
638
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 52c9eb9b6df2..26e4925bc35b 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -61,10 +61,10 @@ static inline void write_seqlock(seqlock_t *sl)
61{ 61{
62 spin_lock(&sl->lock); 62 spin_lock(&sl->lock);
63 ++sl->sequence; 63 ++sl->sequence;
64 smp_wmb(); 64 smp_wmb();
65} 65}
66 66
67static inline void write_sequnlock(seqlock_t *sl) 67static inline void write_sequnlock(seqlock_t *sl)
68{ 68{
69 smp_wmb(); 69 smp_wmb();
70 sl->sequence++; 70 sl->sequence++;
@@ -77,7 +77,7 @@ static inline int write_tryseqlock(seqlock_t *sl)
77 77
78 if (ret) { 78 if (ret) {
79 ++sl->sequence; 79 ++sl->sequence;
80 smp_wmb(); 80 smp_wmb();
81 } 81 }
82 return ret; 82 return ret;
83} 83}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5992f65b4184..2694cb3ca763 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,20 +27,24 @@
27#include <net/checksum.h> 27#include <net/checksum.h>
28#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h>
30 31
31#define HAVE_ALLOC_SKB /* For the drivers to know */ 32#define HAVE_ALLOC_SKB /* For the drivers to know */
32#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
33 34
35/* Don't change this without changing skb_csum_unnecessary! */
34#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
35#define CHECKSUM_PARTIAL 1 37#define CHECKSUM_UNNECESSARY 1
36#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_COMPLETE 2
37#define CHECKSUM_COMPLETE 3 39#define CHECKSUM_PARTIAL 3
38 40
39#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
40 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
41#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \ 43#define SKB_WITH_OVERHEAD(X) \
42 sizeof(struct skb_shared_info)) & \ 44 (((X) - sizeof(struct skb_shared_info)) & \
43 ~(SMP_CACHE_BYTES - 1)) 45 ~(SMP_CACHE_BYTES - 1))
46#define SKB_MAX_ORDER(X, ORDER) \
47 SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
44#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) 48#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
45#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) 49#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
46 50
@@ -66,8 +70,8 @@
66 * NONE: skb is checksummed by protocol or csum is not required. 70 * NONE: skb is checksummed by protocol or csum is not required.
67 * 71 *
68 * PARTIAL: device is required to csum packet as seen by hard_start_xmit 72 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
69 * from skb->h.raw to the end and to record the checksum 73 * from skb->transport_header to the end and to record the checksum
70 * at skb->h.raw+skb->csum. 74 * at skb->transport_header + skb->csum.
71 * 75 *
72 * Device must show its capabilities in dev->features, set 76 * Device must show its capabilities in dev->features, set
73 * at device setup time. 77 * at device setup time.
@@ -83,12 +87,13 @@
83 */ 87 */
84 88
85struct net_device; 89struct net_device;
90struct scatterlist;
86 91
87#ifdef CONFIG_NETFILTER 92#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
88struct nf_conntrack { 93struct nf_conntrack {
89 atomic_t use; 94 atomic_t use;
90 void (*destroy)(struct nf_conntrack *);
91}; 95};
96#endif
92 97
93#ifdef CONFIG_BRIDGE_NETFILTER 98#ifdef CONFIG_BRIDGE_NETFILTER
94struct nf_bridge_info { 99struct nf_bridge_info {
@@ -103,8 +108,6 @@ struct nf_bridge_info {
103}; 108};
104#endif 109#endif
105 110
106#endif
107
108struct sk_buff_head { 111struct sk_buff_head {
109 /* These two members must be first. */ 112 /* These two members must be first. */
110 struct sk_buff *next; 113 struct sk_buff *next;
@@ -156,11 +159,6 @@ struct skb_shared_info {
156#define SKB_DATAREF_SHIFT 16 159#define SKB_DATAREF_SHIFT 16
157#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 160#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
158 161
159struct skb_timeval {
160 u32 off_sec;
161 u32 off_usec;
162};
163
164 162
165enum { 163enum {
166 SKB_FCLONE_UNAVAILABLE, 164 SKB_FCLONE_UNAVAILABLE,
@@ -181,6 +179,16 @@ enum {
181 SKB_GSO_TCPV6 = 1 << 4, 179 SKB_GSO_TCPV6 = 1 << 4,
182}; 180};
183 181
182#if BITS_PER_LONG > 32
183#define NET_SKBUFF_DATA_USES_OFFSET 1
184#endif
185
186#ifdef NET_SKBUFF_DATA_USES_OFFSET
187typedef unsigned int sk_buff_data_t;
188#else
189typedef unsigned char *sk_buff_data_t;
190#endif
191
184/** 192/**
185 * struct sk_buff - socket buffer 193 * struct sk_buff - socket buffer
186 * @next: Next buffer in list 194 * @next: Next buffer in list
@@ -190,15 +198,17 @@ enum {
190 * @dev: Device we arrived on/are leaving by 198 * @dev: Device we arrived on/are leaving by
191 * @iif: ifindex of device we arrived on 199 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 200 * @h: Transport layer header
193 * @nh: Network layer header 201 * @network_header: Network layer header
194 * @mac: Link layer header 202 * @mac_header: Link layer header
195 * @dst: destination entry 203 * @dst: destination entry
196 * @sp: the security path, used for xfrm 204 * @sp: the security path, used for xfrm
197 * @cb: Control buffer. Free for use by every layer. Put private vars here 205 * @cb: Control buffer. Free for use by every layer. Put private vars here
198 * @len: Length of actual data 206 * @len: Length of actual data
199 * @data_len: Data length 207 * @data_len: Data length
200 * @mac_len: Length of link layer header 208 * @mac_len: Length of link layer header
201 * @csum: Checksum 209 * @csum: Checksum (must include start/offset pair)
210 * @csum_start: Offset from skb->head where checksumming should start
211 * @csum_offset: Offset from csum_start where checksum should be stored
202 * @local_df: allow local fragmentation 212 * @local_df: allow local fragmentation
203 * @cloned: Head may be cloned (check refcnt to be sure) 213 * @cloned: Head may be cloned (check refcnt to be sure)
204 * @nohdr: Payload reference only, must not modify header 214 * @nohdr: Payload reference only, must not modify header
@@ -233,32 +243,11 @@ struct sk_buff {
233 struct sk_buff *prev; 243 struct sk_buff *prev;
234 244
235 struct sock *sk; 245 struct sock *sk;
236 struct skb_timeval tstamp; 246 ktime_t tstamp;
237 struct net_device *dev; 247 struct net_device *dev;
238 int iif; 248 int iif;
239 /* 4 byte hole on 64 bit*/ 249 /* 4 byte hole on 64 bit*/
240 250
241 union {
242 struct tcphdr *th;
243 struct udphdr *uh;
244 struct icmphdr *icmph;
245 struct igmphdr *igmph;
246 struct iphdr *ipiph;
247 struct ipv6hdr *ipv6h;
248 unsigned char *raw;
249 } h;
250
251 union {
252 struct iphdr *iph;
253 struct ipv6hdr *ipv6h;
254 struct arphdr *arph;
255 unsigned char *raw;
256 } nh;
257
258 union {
259 unsigned char *raw;
260 } mac;
261
262 struct dst_entry *dst; 251 struct dst_entry *dst;
263 struct sec_path *sp; 252 struct sec_path *sp;
264 253
@@ -275,7 +264,10 @@ struct sk_buff {
275 mac_len; 264 mac_len;
276 union { 265 union {
277 __wsum csum; 266 __wsum csum;
278 __u32 csum_offset; 267 struct {
268 __u16 csum_start;
269 __u16 csum_offset;
270 };
279 }; 271 };
280 __u32 priority; 272 __u32 priority;
281 __u8 local_df:1, 273 __u8 local_df:1,
@@ -289,15 +281,13 @@ struct sk_buff {
289 __be16 protocol; 281 __be16 protocol;
290 282
291 void (*destructor)(struct sk_buff *skb); 283 void (*destructor)(struct sk_buff *skb);
292#ifdef CONFIG_NETFILTER
293 struct nf_conntrack *nfct;
294#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 284#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
285 struct nf_conntrack *nfct;
295 struct sk_buff *nfct_reasm; 286 struct sk_buff *nfct_reasm;
296#endif 287#endif
297#ifdef CONFIG_BRIDGE_NETFILTER 288#ifdef CONFIG_BRIDGE_NETFILTER
298 struct nf_bridge_info *nf_bridge; 289 struct nf_bridge_info *nf_bridge;
299#endif 290#endif
300#endif /* CONFIG_NETFILTER */
301#ifdef CONFIG_NET_SCHED 291#ifdef CONFIG_NET_SCHED
302 __u16 tc_index; /* traffic control index */ 292 __u16 tc_index; /* traffic control index */
303#ifdef CONFIG_NET_CLS_ACT 293#ifdef CONFIG_NET_CLS_ACT
@@ -313,13 +303,16 @@ struct sk_buff {
313 303
314 __u32 mark; 304 __u32 mark;
315 305
306 sk_buff_data_t transport_header;
307 sk_buff_data_t network_header;
308 sk_buff_data_t mac_header;
316 /* These elements must be at the end, see alloc_skb() for details. */ 309 /* These elements must be at the end, see alloc_skb() for details. */
310 sk_buff_data_t tail;
311 sk_buff_data_t end;
312 unsigned char *head,
313 *data;
317 unsigned int truesize; 314 unsigned int truesize;
318 atomic_t users; 315 atomic_t users;
319 unsigned char *head,
320 *data,
321 *tail,
322 *end;
323}; 316};
324 317
325#ifdef __KERNEL__ 318#ifdef __KERNEL__
@@ -361,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
361extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 354extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
362 int newheadroom, int newtailroom, 355 int newheadroom, int newtailroom,
363 gfp_t priority); 356 gfp_t priority);
357extern int skb_to_sgvec(struct sk_buff *skb,
358 struct scatterlist *sg, int offset,
359 int len);
360extern int skb_cow_data(struct sk_buff *skb, int tailbits,
361 struct sk_buff **trailer);
364extern int skb_pad(struct sk_buff *skb, int pad); 362extern int skb_pad(struct sk_buff *skb, int pad);
365#define dev_kfree_skb(a) kfree_skb(a) 363#define dev_kfree_skb(a) kfree_skb(a)
366extern void skb_over_panic(struct sk_buff *skb, int len, 364extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -402,8 +400,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
402 unsigned int to, struct ts_config *config, 400 unsigned int to, struct ts_config *config,
403 struct ts_state *state); 401 struct ts_state *state);
404 402
403#ifdef NET_SKBUFF_DATA_USES_OFFSET
404static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
405{
406 return skb->head + skb->end;
407}
408#else
409static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
410{
411 return skb->end;
412}
413#endif
414
405/* Internal */ 415/* Internal */
406#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 416#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
407 417
408/** 418/**
409 * skb_queue_empty - check if a queue is empty 419 * skb_queue_empty - check if a queue is empty
@@ -822,12 +832,46 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
822#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 832#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
823#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 833#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
824 834
835#ifdef NET_SKBUFF_DATA_USES_OFFSET
836static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
837{
838 return skb->head + skb->tail;
839}
840
841static inline void skb_reset_tail_pointer(struct sk_buff *skb)
842{
843 skb->tail = skb->data - skb->head;
844}
845
846static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
847{
848 skb_reset_tail_pointer(skb);
849 skb->tail += offset;
850}
851#else /* NET_SKBUFF_DATA_USES_OFFSET */
852static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
853{
854 return skb->tail;
855}
856
857static inline void skb_reset_tail_pointer(struct sk_buff *skb)
858{
859 skb->tail = skb->data;
860}
861
862static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
863{
864 skb->tail = skb->data + offset;
865}
866
867#endif /* NET_SKBUFF_DATA_USES_OFFSET */
868
825/* 869/*
826 * Add data to an sk_buff 870 * Add data to an sk_buff
827 */ 871 */
828static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 872static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
829{ 873{
830 unsigned char *tmp = skb->tail; 874 unsigned char *tmp = skb_tail_pointer(skb);
831 SKB_LINEAR_ASSERT(skb); 875 SKB_LINEAR_ASSERT(skb);
832 skb->tail += len; 876 skb->tail += len;
833 skb->len += len; 877 skb->len += len;
@@ -845,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
845 */ 889 */
846static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) 890static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
847{ 891{
848 unsigned char *tmp = skb->tail; 892 unsigned char *tmp = skb_tail_pointer(skb);
849 SKB_LINEAR_ASSERT(skb); 893 SKB_LINEAR_ASSERT(skb);
850 skb->tail += len; 894 skb->tail += len;
851 skb->len += len; 895 skb->len += len;
852 if (unlikely(skb->tail>skb->end)) 896 if (unlikely(skb->tail > skb->end))
853 skb_over_panic(skb, len, current_text_addr()); 897 skb_over_panic(skb, len, current_text_addr());
854 return tmp; 898 return tmp;
855} 899}
@@ -962,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
962 skb->tail += len; 1006 skb->tail += len;
963} 1007}
964 1008
1009#ifdef NET_SKBUFF_DATA_USES_OFFSET
1010static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1011{
1012 return skb->head + skb->transport_header;
1013}
1014
1015static inline void skb_reset_transport_header(struct sk_buff *skb)
1016{
1017 skb->transport_header = skb->data - skb->head;
1018}
1019
1020static inline void skb_set_transport_header(struct sk_buff *skb,
1021 const int offset)
1022{
1023 skb_reset_transport_header(skb);
1024 skb->transport_header += offset;
1025}
1026
1027static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1028{
1029 return skb->head + skb->network_header;
1030}
1031
1032static inline void skb_reset_network_header(struct sk_buff *skb)
1033{
1034 skb->network_header = skb->data - skb->head;
1035}
1036
1037static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1038{
1039 skb_reset_network_header(skb);
1040 skb->network_header += offset;
1041}
1042
1043static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1044{
1045 return skb->head + skb->mac_header;
1046}
1047
1048static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1049{
1050 return skb->mac_header != ~0U;
1051}
1052
1053static inline void skb_reset_mac_header(struct sk_buff *skb)
1054{
1055 skb->mac_header = skb->data - skb->head;
1056}
1057
1058static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1059{
1060 skb_reset_mac_header(skb);
1061 skb->mac_header += offset;
1062}
1063
1064#else /* NET_SKBUFF_DATA_USES_OFFSET */
1065
1066static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1067{
1068 return skb->transport_header;
1069}
1070
1071static inline void skb_reset_transport_header(struct sk_buff *skb)
1072{
1073 skb->transport_header = skb->data;
1074}
1075
1076static inline void skb_set_transport_header(struct sk_buff *skb,
1077 const int offset)
1078{
1079 skb->transport_header = skb->data + offset;
1080}
1081
1082static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1083{
1084 return skb->network_header;
1085}
1086
1087static inline void skb_reset_network_header(struct sk_buff *skb)
1088{
1089 skb->network_header = skb->data;
1090}
1091
1092static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1093{
1094 skb->network_header = skb->data + offset;
1095}
1096
1097static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1098{
1099 return skb->mac_header;
1100}
1101
1102static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1103{
1104 return skb->mac_header != NULL;
1105}
1106
1107static inline void skb_reset_mac_header(struct sk_buff *skb)
1108{
1109 skb->mac_header = skb->data;
1110}
1111
1112static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1113{
1114 skb->mac_header = skb->data + offset;
1115}
1116#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1117
1118static inline int skb_transport_offset(const struct sk_buff *skb)
1119{
1120 return skb_transport_header(skb) - skb->data;
1121}
1122
1123static inline u32 skb_network_header_len(const struct sk_buff *skb)
1124{
1125 return skb->transport_header - skb->network_header;
1126}
1127
1128static inline int skb_network_offset(const struct sk_buff *skb)
1129{
1130 return skb_network_header(skb) - skb->data;
1131}
1132
965/* 1133/*
966 * CPUs often take a performance hit when accessing unaligned memory 1134 * CPUs often take a performance hit when accessing unaligned memory
967 * locations. The actual performance hit varies, it can be small if the 1135 * locations. The actual performance hit varies, it can be small if the
@@ -1013,8 +1181,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1013 WARN_ON(1); 1181 WARN_ON(1);
1014 return; 1182 return;
1015 } 1183 }
1016 skb->len = len; 1184 skb->len = len;
1017 skb->tail = skb->data + len; 1185 skb_set_tail_pointer(skb, len);
1018} 1186}
1019 1187
1020/** 1188/**
@@ -1326,8 +1494,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1326 int len, __wsum csum); 1494 int len, __wsum csum);
1327extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1495extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1328 void *to, int len); 1496 void *to, int len);
1329extern int skb_store_bits(const struct sk_buff *skb, int offset, 1497extern int skb_store_bits(struct sk_buff *skb, int offset,
1330 void *from, int len); 1498 const void *from, int len);
1331extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1499extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1332 int offset, u8 *to, int len, 1500 int offset, u8 *to, int len,
1333 __wsum csum); 1501 __wsum csum);
@@ -1351,8 +1519,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1351 return buffer; 1519 return buffer;
1352} 1520}
1353 1521
1522static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
1523 void *to,
1524 const unsigned int len)
1525{
1526 memcpy(to, skb->data, len);
1527}
1528
1529static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
1530 const int offset, void *to,
1531 const unsigned int len)
1532{
1533 memcpy(to, skb->data + offset, len);
1534}
1535
1536static inline void skb_copy_to_linear_data(struct sk_buff *skb,
1537 const void *from,
1538 const unsigned int len)
1539{
1540 memcpy(skb->data, from, len);
1541}
1542
1543static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1544 const int offset,
1545 const void *from,
1546 const unsigned int len)
1547{
1548 memcpy(skb->data + offset, from, len);
1549}
1550
1354extern void skb_init(void); 1551extern void skb_init(void);
1355extern void skb_add_mtu(int mtu);
1356 1552
1357/** 1553/**
1358 * skb_get_timestamp - get timestamp from a skb 1554 * skb_get_timestamp - get timestamp from a skb
@@ -1365,29 +1561,28 @@ extern void skb_add_mtu(int mtu);
1365 */ 1561 */
1366static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1562static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
1367{ 1563{
1368 stamp->tv_sec = skb->tstamp.off_sec; 1564 *stamp = ktime_to_timeval(skb->tstamp);
1369 stamp->tv_usec = skb->tstamp.off_usec;
1370} 1565}
1371 1566
1372/** 1567static inline void __net_timestamp(struct sk_buff *skb)
1373 * skb_set_timestamp - set timestamp of a skb 1568{
1374 * @skb: skb to set stamp of 1569 skb->tstamp = ktime_get_real();
1375 * @stamp: pointer to struct timeval to get stamp from 1570}
1376 * 1571
1377 * Timestamps are stored in the skb as offsets to a base timestamp. 1572static inline ktime_t net_timedelta(ktime_t t)
1378 * This function converts a struct timeval to an offset and stores
1379 * it in the skb.
1380 */
1381static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1382{ 1573{
1383 skb->tstamp.off_sec = stamp->tv_sec; 1574 return ktime_sub(ktime_get_real(), t);
1384 skb->tstamp.off_usec = stamp->tv_usec;
1385} 1575}
1386 1576
1387extern void __net_timestamp(struct sk_buff *skb);
1388 1577
1578extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1389extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1579extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1390 1580
1581static inline int skb_csum_unnecessary(const struct sk_buff *skb)
1582{
1583 return skb->ip_summed & CHECKSUM_UNNECESSARY;
1584}
1585
1391/** 1586/**
1392 * skb_checksum_complete - Calculate checksum of an entire packet 1587 * skb_checksum_complete - Calculate checksum of an entire packet
1393 * @skb: packet to process 1588 * @skb: packet to process
@@ -1406,22 +1601,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1406 */ 1601 */
1407static inline unsigned int skb_checksum_complete(struct sk_buff *skb) 1602static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
1408{ 1603{
1409 return skb->ip_summed != CHECKSUM_UNNECESSARY && 1604 return skb_csum_unnecessary(skb) ?
1410 __skb_checksum_complete(skb); 1605 0 : __skb_checksum_complete(skb);
1411} 1606}
1412 1607
1413#ifdef CONFIG_NETFILTER 1608#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1609extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
1414static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1610static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1415{ 1611{
1416 if (nfct && atomic_dec_and_test(&nfct->use)) 1612 if (nfct && atomic_dec_and_test(&nfct->use))
1417 nfct->destroy(nfct); 1613 nf_conntrack_destroy(nfct);
1418} 1614}
1419static inline void nf_conntrack_get(struct nf_conntrack *nfct) 1615static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1420{ 1616{
1421 if (nfct) 1617 if (nfct)
1422 atomic_inc(&nfct->use); 1618 atomic_inc(&nfct->use);
1423} 1619}
1424#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1425static inline void nf_conntrack_get_reasm(struct sk_buff *skb) 1620static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1426{ 1621{
1427 if (skb) 1622 if (skb)
@@ -1447,9 +1642,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1447#endif /* CONFIG_BRIDGE_NETFILTER */ 1642#endif /* CONFIG_BRIDGE_NETFILTER */
1448static inline void nf_reset(struct sk_buff *skb) 1643static inline void nf_reset(struct sk_buff *skb)
1449{ 1644{
1645#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1450 nf_conntrack_put(skb->nfct); 1646 nf_conntrack_put(skb->nfct);
1451 skb->nfct = NULL; 1647 skb->nfct = NULL;
1452#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1453 nf_conntrack_put_reasm(skb->nfct_reasm); 1648 nf_conntrack_put_reasm(skb->nfct_reasm);
1454 skb->nfct_reasm = NULL; 1649 skb->nfct_reasm = NULL;
1455#endif 1650#endif
@@ -1459,9 +1654,33 @@ static inline void nf_reset(struct sk_buff *skb)
1459#endif 1654#endif
1460} 1655}
1461 1656
1462#else /* CONFIG_NETFILTER */ 1657/* Note: This doesn't put any conntrack and bridge info in dst. */
1463static inline void nf_reset(struct sk_buff *skb) {} 1658static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1464#endif /* CONFIG_NETFILTER */ 1659{
1660#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1661 dst->nfct = src->nfct;
1662 nf_conntrack_get(src->nfct);
1663 dst->nfctinfo = src->nfctinfo;
1664 dst->nfct_reasm = src->nfct_reasm;
1665 nf_conntrack_get_reasm(src->nfct_reasm);
1666#endif
1667#ifdef CONFIG_BRIDGE_NETFILTER
1668 dst->nf_bridge = src->nf_bridge;
1669 nf_bridge_get(src->nf_bridge);
1670#endif
1671}
1672
1673static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1674{
1675#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1676 nf_conntrack_put(dst->nfct);
1677 nf_conntrack_put_reasm(dst->nfct_reasm);
1678#endif
1679#ifdef CONFIG_BRIDGE_NETFILTER
1680 nf_bridge_put(dst->nf_bridge);
1681#endif
1682 __nf_copy(dst, src);
1683}
1465 1684
1466#ifdef CONFIG_NETWORK_SECMARK 1685#ifdef CONFIG_NETWORK_SECMARK
1467static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) 1686static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
@@ -1486,5 +1705,12 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1486 return skb_shinfo(skb)->gso_size; 1705 return skb_shinfo(skb)->gso_size;
1487} 1706}
1488 1707
1708static inline void skb_forward_csum(struct sk_buff *skb)
1709{
1710 /* Unfortunately we don't support this one. Any brave souls? */
1711 if (skb->ip_summed == CHECKSUM_COMPLETE)
1712 skb->ip_summed = CHECKSUM_NONE;
1713}
1714
1489#endif /* __KERNEL__ */ 1715#endif /* __KERNEL__ */
1490#endif /* _LINUX_SKBUFF_H */ 1716#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index fcd35a210e7f..6e7c9483a6a6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -188,7 +188,8 @@ struct ucred {
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_MAX 33 /* For now.. */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */
192 193
193/* Protocol families, same as address families. */ 194/* Protocol families, same as address families. */
194#define PF_UNSPEC AF_UNSPEC 195#define PF_UNSPEC AF_UNSPEC
@@ -222,6 +223,7 @@ struct ucred {
222#define PF_TIPC AF_TIPC 223#define PF_TIPC AF_TIPC
223#define PF_BLUETOOTH AF_BLUETOOTH 224#define PF_BLUETOOTH AF_BLUETOOTH
224#define PF_IUCV AF_IUCV 225#define PF_IUCV AF_IUCV
226#define PF_RXRPC AF_RXRPC
225#define PF_MAX AF_MAX 227#define PF_MAX AF_MAX
226 228
227/* Maximum queue length specifiable by listen. */ 229/* Maximum queue length specifiable by listen. */
@@ -284,6 +286,7 @@ struct ucred {
284#define SOL_DCCP 269 286#define SOL_DCCP 269
285#define SOL_NETLINK 270 287#define SOL_NETLINK 270
286#define SOL_TIPC 271 288#define SOL_TIPC 271
289#define SOL_RXRPC 272
287 290
288/* IPX options */ 291/* IPX options */
289#define IPX_TYPE 1 292#define IPX_TYPE 1
diff --git a/include/linux/string.h b/include/linux/string.h
index 4f69ef9e6eb5..7f2eb6a477f9 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t);
47#ifndef __HAVE_ARCH_STRNICMP 47#ifndef __HAVE_ARCH_STRNICMP
48extern int strnicmp(const char *, const char *, __kernel_size_t); 48extern int strnicmp(const char *, const char *, __kernel_size_t);
49#endif 49#endif
50#ifndef __HAVE_ARCH_STRCASECMP
51extern int strcasecmp(const char *s1, const char *s2);
52#endif
53#ifndef __HAVE_ARCH_STRNCASECMP
54extern int strncasecmp(const char *s1, const char *s2, size_t n);
55#endif
50#ifndef __HAVE_ARCH_STRCHR 56#ifndef __HAVE_ARCH_STRCHR
51extern char * strchr(const char *,int); 57extern char * strchr(const char *,int);
52#endif 58#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 9a8970bf99a6..47f1c53332ce 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -290,6 +290,7 @@ enum
290 NET_CORE_BUDGET=19, 290 NET_CORE_BUDGET=19,
291 NET_CORE_AEVENT_ETIME=20, 291 NET_CORE_AEVENT_ETIME=20,
292 NET_CORE_AEVENT_RSEQTH=21, 292 NET_CORE_AEVENT_RSEQTH=21,
293 NET_CORE_WARNINGS=22,
293}; 294};
294 295
295/* /proc/sys/net/ethernet */ 296/* /proc/sys/net/ethernet */
@@ -438,6 +439,8 @@ enum
438 NET_CIPSOV4_RBM_STRICTVALID=121, 439 NET_CIPSOV4_RBM_STRICTVALID=121,
439 NET_TCP_AVAIL_CONG_CONTROL=122, 440 NET_TCP_AVAIL_CONG_CONTROL=122,
440 NET_TCP_ALLOWED_CONG_CONTROL=123, 441 NET_TCP_ALLOWED_CONG_CONTROL=123,
442 NET_TCP_MAX_SSTHRESH=124,
443 NET_TCP_FRTO_RESPONSE=125,
441}; 444};
442 445
443enum { 446enum {
@@ -789,6 +792,7 @@ enum {
789 NET_BRIDGE_NF_CALL_IPTABLES = 2, 792 NET_BRIDGE_NF_CALL_IPTABLES = 2,
790 NET_BRIDGE_NF_CALL_IP6TABLES = 3, 793 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
791 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 794 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
795 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
792}; 796};
793 797
794/* CTL_FS names: */ 798/* CTL_FS names: */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 29d3089038ab..c6b9f92e8289 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -178,6 +178,21 @@ struct tcp_md5sig {
178#include <net/inet_connection_sock.h> 178#include <net/inet_connection_sock.h>
179#include <net/inet_timewait_sock.h> 179#include <net/inet_timewait_sock.h>
180 180
181static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
182{
183 return (struct tcphdr *)skb_transport_header(skb);
184}
185
186static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
187{
188 return tcp_hdr(skb)->doff * 4;
189}
190
191static inline unsigned int tcp_optlen(const struct sk_buff *skb)
192{
193 return (tcp_hdr(skb)->doff - 5) * 4;
194}
195
181/* This defines a selective acknowledgement block. */ 196/* This defines a selective acknowledgement block. */
182struct tcp_sack_block_wire { 197struct tcp_sack_block_wire {
183 __be32 start_seq; 198 __be32 start_seq;
@@ -242,6 +257,8 @@ struct tcp_sock {
242 * See RFC793 and RFC1122. The RFC writes these in capitals. 257 * See RFC793 and RFC1122. The RFC writes these in capitals.
243 */ 258 */
244 u32 rcv_nxt; /* What we want to receive next */ 259 u32 rcv_nxt; /* What we want to receive next */
260 u32 copied_seq; /* Head of yet unread data */
261 u32 rcv_wup; /* rcv_nxt on last window update sent */
245 u32 snd_nxt; /* Next sequence we send */ 262 u32 snd_nxt; /* Next sequence we send */
246 263
247 u32 snd_una; /* First byte we want an ack for */ 264 u32 snd_una; /* First byte we want an ack for */
@@ -300,17 +317,15 @@ struct tcp_sock {
300 u32 snd_ssthresh; /* Slow start size threshold */ 317 u32 snd_ssthresh; /* Slow start size threshold */
301 u32 snd_cwnd; /* Sending congestion window */ 318 u32 snd_cwnd; /* Sending congestion window */
302 u16 snd_cwnd_cnt; /* Linear increase counter */ 319 u16 snd_cwnd_cnt; /* Linear increase counter */
303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 320 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
304 u32 snd_cwnd_used; 321 u32 snd_cwnd_used;
305 u32 snd_cwnd_stamp; 322 u32 snd_cwnd_stamp;
306 323
307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 324 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
308 325
309 u32 rcv_wnd; /* Current receiver window */ 326 u32 rcv_wnd; /* Current receiver window */
310 u32 rcv_wup; /* rcv_nxt on last window update sent */
311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 327 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 328 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
313 u32 copied_seq; /* Head of yet unread data */
314 329
315/* SACKs data */ 330/* SACKs data */
316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 331 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 7e08c07efe0f..6de445c31a64 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,6 +26,15 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
29/* UDP socket options */ 38/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 39#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2a7b38d87018..b8abfc74d038 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *);
191 191
192/* 192/*
193 * Kill off a pending schedule_delayed_work(). Note that the work callback 193 * Kill off a pending schedule_delayed_work(). Note that the work callback
194 * function may still be running on return from cancel_delayed_work(). Run 194 * function may still be running on return from cancel_delayed_work(), unless
195 * flush_scheduled_work() to wait on it. 195 * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
196 * cancel_work_sync() to wait on it.
196 */ 197 */
197static inline int cancel_delayed_work(struct delayed_work *work) 198static inline int cancel_delayed_work(struct delayed_work *work)
198{ 199{
199 int ret; 200 int ret;
200 201
201 ret = del_timer_sync(&work->timer); 202 ret = del_timer(&work->timer);
202 if (ret) 203 if (ret)
203 work_release(&work->work); 204 work_release(&work->work);
204 return ret; 205 return ret;
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 15ca89e9961b..9c656a5cf842 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -181,6 +181,10 @@ enum {
181 XFRM_MSG_MIGRATE, 181 XFRM_MSG_MIGRATE,
182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE 182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
183 183
184 XFRM_MSG_NEWSADINFO,
185#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
186 XFRM_MSG_GETSADINFO,
187#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
184 __XFRM_MSG_MAX 188 __XFRM_MSG_MAX
185}; 189};
186#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 190#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -234,6 +238,17 @@ enum xfrm_ae_ftype_t {
234#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 238#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
235}; 239};
236 240
241/* SAD Table filter flags */
242enum xfrm_sad_ftype_t {
243 XFRM_SAD_UNSPEC,
244 XFRM_SAD_HMASK=1,
245 XFRM_SAD_HMAX=2,
246 XFRM_SAD_CNT=4,
247 __XFRM_SAD_MAX
248
249#define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1)
250};
251
237struct xfrm_userpolicy_type { 252struct xfrm_userpolicy_type {
238 __u8 type; 253 __u8 type;
239 __u16 reserved1; 254 __u16 reserved1;
@@ -265,6 +280,16 @@ enum xfrm_attr_type_t {
265#define XFRMA_MAX (__XFRMA_MAX - 1) 280#define XFRMA_MAX (__XFRMA_MAX - 1)
266}; 281};
267 282
283enum xfrm_sadattr_type_t {
284 XFRMA_SAD_UNSPEC,
285 XFRMA_SADHMASK,
286 XFRMA_SADHMAX,
287 XFRMA_SADCNT,
288 __XFRMA_SAD_MAX
289
290#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
291};
292
268struct xfrm_usersa_info { 293struct xfrm_usersa_info {
269 struct xfrm_selector sel; 294 struct xfrm_selector sel;
270 struct xfrm_id id; 295 struct xfrm_id id;
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index e0fe92b03a4e..4d46b3bdebd8 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -3,3 +3,5 @@ header-y += jffs2-user.h
3header-y += mtd-abi.h 3header-y += mtd-abi.h
4header-y += mtd-user.h 4header-y += mtd-user.h
5header-y += nftl-user.h 5header-y += nftl-user.h
6header-y += ubi-header.h
7header-y += ubi-user.h
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 8e501a75a764..f71dac420394 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -24,6 +24,7 @@ struct mtd_oob_buf {
24#define MTD_NORFLASH 3 24#define MTD_NORFLASH 3
25#define MTD_NANDFLASH 4 25#define MTD_NANDFLASH 4
26#define MTD_DATAFLASH 6 26#define MTD_DATAFLASH 6
27#define MTD_UBIVOLUME 7
27 28
28#define MTD_WRITEABLE 0x400 /* Device is writeable */ 29#define MTD_WRITEABLE 0x400 /* Device is writeable */
29#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 30#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h
new file mode 100644
index 000000000000..fa479c71aa34
--- /dev/null
+++ b/include/mtd/ubi-header.h
@@ -0,0 +1,360 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Artem Bityutskiy (Битюцкий Артём)
19 * Thomas Gleixner
20 * Frank Haverkamp
21 * Oliver Lohmann
22 * Andreas Arnez
23 */
24
25/*
26 * This file defines the layout of UBI headers and all the other UBI on-flash
27 * data structures. May be included by user-space.
28 */
29
30#ifndef __UBI_HEADER_H__
31#define __UBI_HEADER_H__
32
33#include <asm/byteorder.h>
34
35/* The version of UBI images supported by this implementation */
36#define UBI_VERSION 1
37
38/* The highest erase counter value supported by this implementation */
39#define UBI_MAX_ERASECOUNTER 0x7FFFFFFF
40
41/* The initial CRC32 value used when calculating CRC checksums */
42#define UBI_CRC32_INIT 0xFFFFFFFFU
43
44/* Erase counter header magic number (ASCII "UBI#") */
45#define UBI_EC_HDR_MAGIC 0x55424923
46/* Volume identifier header magic number (ASCII "UBI!") */
47#define UBI_VID_HDR_MAGIC 0x55424921
48
49/*
50 * Volume type constants used in the volume identifier header.
51 *
52 * @UBI_VID_DYNAMIC: dynamic volume
53 * @UBI_VID_STATIC: static volume
54 */
55enum {
56 UBI_VID_DYNAMIC = 1,
57 UBI_VID_STATIC = 2
58};
59
60/*
61 * Compatibility constants used by internal volumes.
62 *
63 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
64 * to the flash
65 * @UBI_COMPAT_RO: attach this device in read-only mode
66 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
67 * physical eraseblocks, don't allow the wear-leveling unit to move them
68 * @UBI_COMPAT_REJECT: reject this UBI image
69 */
70enum {
71 UBI_COMPAT_DELETE = 1,
72 UBI_COMPAT_RO = 2,
73 UBI_COMPAT_PRESERVE = 4,
74 UBI_COMPAT_REJECT = 5
75};
76
77/*
78 * ubi16_t/ubi32_t/ubi64_t - 16, 32, and 64-bit integers used in UBI on-flash
79 * data structures.
80 */
81typedef struct {
82 uint16_t int16;
83} __attribute__ ((packed)) ubi16_t;
84
85typedef struct {
86 uint32_t int32;
87} __attribute__ ((packed)) ubi32_t;
88
89typedef struct {
90 uint64_t int64;
91} __attribute__ ((packed)) ubi64_t;
92
93/*
94 * In this implementation of UBI uses the big-endian format for on-flash
95 * integers. The below are the corresponding conversion macros.
96 */
97#define cpu_to_ubi16(x) ((ubi16_t){__cpu_to_be16(x)})
98#define ubi16_to_cpu(x) ((uint16_t)__be16_to_cpu((x).int16))
99
100#define cpu_to_ubi32(x) ((ubi32_t){__cpu_to_be32(x)})
101#define ubi32_to_cpu(x) ((uint32_t)__be32_to_cpu((x).int32))
102
103#define cpu_to_ubi64(x) ((ubi64_t){__cpu_to_be64(x)})
104#define ubi64_to_cpu(x) ((uint64_t)__be64_to_cpu((x).int64))
105
106/* Sizes of UBI headers */
107#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
108#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
109
110/* Sizes of UBI headers without the ending CRC */
111#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(ubi32_t))
112#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(ubi32_t))
113
114/**
115 * struct ubi_ec_hdr - UBI erase counter header.
116 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
117 * @version: version of UBI implementation which is supposed to accept this
118 * UBI image
119 * @padding1: reserved for future, zeroes
120 * @ec: the erase counter
121 * @vid_hdr_offset: where the VID header starts
122 * @data_offset: where the user data start
123 * @padding2: reserved for future, zeroes
124 * @hdr_crc: erase counter header CRC checksum
125 *
126 * The erase counter header takes 64 bytes and has a plenty of unused space for
127 * future usage. The unused fields are zeroed. The @version field is used to
128 * indicate the version of UBI implementation which is supposed to be able to
129 * work with this UBI image. If @version is greater then the current UBI
130 * version, the image is rejected. This may be useful in future if something
131 * is changed radically. This field is duplicated in the volume identifier
132 * header.
133 *
134 * The @vid_hdr_offset and @data_offset fields contain the offset of the the
135 * volume identifier header and user data, relative to the beginning of the
136 * physical eraseblock. These values have to be the same for all physical
137 * eraseblocks.
138 */
139struct ubi_ec_hdr {
140 ubi32_t magic;
141 uint8_t version;
142 uint8_t padding1[3];
143 ubi64_t ec; /* Warning: the current limit is 31-bit anyway! */
144 ubi32_t vid_hdr_offset;
145 ubi32_t data_offset;
146 uint8_t padding2[36];
147 ubi32_t hdr_crc;
148} __attribute__ ((packed));
149
150/**
151 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
152 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
153 * @version: UBI implementation version which is supposed to accept this UBI
154 * image (%UBI_VERSION)
155 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
156 * @copy_flag: if this logical eraseblock was copied from another physical
157 * eraseblock (for wear-leveling reasons)
158 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
159 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
160 * @vol_id: ID of this volume
161 * @lnum: logical eraseblock number
162 * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be
163 * removed, kept only for not breaking older UBI users)
164 * @data_size: how many bytes of data this logical eraseblock contains
165 * @used_ebs: total number of used logical eraseblocks in this volume
166 * @data_pad: how many bytes at the end of this physical eraseblock are not
167 * used
168 * @data_crc: CRC checksum of the data stored in this logical eraseblock
169 * @padding1: reserved for future, zeroes
170 * @sqnum: sequence number
171 * @padding2: reserved for future, zeroes
172 * @hdr_crc: volume identifier header CRC checksum
173 *
174 * The @sqnum is the value of the global sequence counter at the time when this
175 * VID header was created. The global sequence counter is incremented each time
176 * UBI writes a new VID header to the flash, i.e. when it maps a logical
177 * eraseblock to a new physical eraseblock. The global sequence counter is an
178 * unsigned 64-bit integer and we assume it never overflows. The @sqnum
179 * (sequence number) is used to distinguish between older and newer versions of
180 * logical eraseblocks.
181 *
182 * There are 2 situations when there may be more then one physical eraseblock
183 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
184 * and @lnum values in the volume identifier header. Suppose we have a logical
185 * eraseblock L and it is mapped to the physical eraseblock P.
186 *
187 * 1. Because UBI may erase physical eraseblocks asynchronously, the following
188 * situation is possible: L is asynchronously erased, so P is scheduled for
189 * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
190 * so P1 is written to, then an unclean reboot happens. Result - there are 2
191 * physical eraseblocks P and P1 corresponding to the same logical eraseblock
192 * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the
193 * flash.
194 *
195 * 2. From time to time UBI moves logical eraseblocks to other physical
196 * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
197 * to P1, and an unclean reboot happens before P is physically erased, there
198 * are two physical eraseblocks P and P1 corresponding to L and UBI has to
199 * select one of them when the flash is attached. The @sqnum field says which
200 * PEB is the original (obviously P will have lower @sqnum) and the copy. But
201 * it is not enough to select the physical eraseblock with the higher sequence
202 * number, because the unclean reboot could have happen in the middle of the
203 * copying process, so the data in P is corrupted. It is also not enough to
204 * just select the physical eraseblock with lower sequence number, because the
205 * data there may be old (consider a case if more data was added to P1 after
206 * the copying). Moreover, the unclean reboot may happen when the erasure of P
207 * was just started, so it result in unstable P, which is "mostly" OK, but
208 * still has unstable bits.
209 *
210 * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
211 * copy. UBI also calculates data CRC when the data is moved and stores it at
212 * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
213 * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
214 * examined. If it is cleared, the situation* is simple and the newer one is
215 * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC
216 * checksum is correct, this physical eraseblock is selected (P1). Otherwise
217 * the older one (P) is selected.
218 *
219 * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
220 * in the past. But it is not used anymore and we keep it in order to be able
221 * to deal with old UBI images. It will be removed at some point.
222 *
223 * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
224 * Internal volumes are not seen from outside and are used for various internal
225 * UBI purposes. In this implementation there is only one internal volume - the
226 * layout volume. Internal volumes are the main mechanism of UBI extensions.
227 * For example, in future one may introduce a journal internal volume. Internal
228 * volumes have their own reserved range of IDs.
229 *
230 * The @compat field is only used for internal volumes and contains the "degree
231 * of their compatibility". It is always zero for user volumes. This field
232 * provides a mechanism to introduce UBI extensions and to be still compatible
233 * with older UBI binaries. For example, if someone introduced a journal in
234 * future, he would probably use %UBI_COMPAT_DELETE compatibility for the
235 * journal volume. And in this case, older UBI binaries, which know nothing
236 * about the journal volume, would just delete this volume and work perfectly
237 * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
238 * - it just ignores the Ext3fs journal.
239 *
240 * The @data_crc field contains the CRC checksum of the contents of the logical
241 * eraseblock if this is a static volume. In case of dynamic volumes, it does
242 * not contain the CRC checksum as a rule. The only exception is when the
243 * data of the physical eraseblock was moved by the wear-leveling unit, then
244 * the wear-leveling unit calculates the data CRC and stores it in the
245 * @data_crc field. And of course, the @copy_flag is %in this case.
246 *
247 * The @data_size field is used only for static volumes because UBI has to know
248 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
249 * this field usually contains zero. The only exception is when the data of the
250 * physical eraseblock was moved to another physical eraseblock for
251 * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
252 * contents and uses both @data_crc and @data_size fields. In this case, the
253 * @data_size field contains data size.
254 *
255 * The @used_ebs field is used only for static volumes and indicates how many
256 * eraseblocks the data of the volume takes. For dynamic volumes this field is
257 * not used and always contains zero.
258 *
259 * The @data_pad is calculated when volumes are created using the alignment
260 * parameter. So, effectively, the @data_pad field reduces the size of logical
261 * eraseblocks of this volume. This is very handy when one uses block-oriented
262 * software (say, cramfs) on top of the UBI volume.
263 */
264struct ubi_vid_hdr {
265 ubi32_t magic;
266 uint8_t version;
267 uint8_t vol_type;
268 uint8_t copy_flag;
269 uint8_t compat;
270 ubi32_t vol_id;
271 ubi32_t lnum;
272 ubi32_t leb_ver; /* obsolete, to be removed, don't use */
273 ubi32_t data_size;
274 ubi32_t used_ebs;
275 ubi32_t data_pad;
276 ubi32_t data_crc;
277 uint8_t padding1[4];
278 ubi64_t sqnum;
279 uint8_t padding2[12];
280 ubi32_t hdr_crc;
281} __attribute__ ((packed));
282
283/* Internal UBI volumes count */
284#define UBI_INT_VOL_COUNT 1
285
286/*
287 * Starting ID of internal volumes. There is reserved room for 4096 internal
288 * volumes.
289 */
290#define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
291
292/* The layout volume contains the volume table */
293
294#define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START
295#define UBI_LAYOUT_VOLUME_EBS 2
296#define UBI_LAYOUT_VOLUME_NAME "layout volume"
297#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
298
299/* The maximum number of volumes per one UBI device */
300#define UBI_MAX_VOLUMES 128
301
302/* The maximum volume name length */
303#define UBI_VOL_NAME_MAX 127
304
305/* Size of the volume table record */
306#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
307
308/* Size of the volume table record without the ending CRC */
309#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(ubi32_t))
310
311/**
312 * struct ubi_vtbl_record - a record in the volume table.
313 * @reserved_pebs: how many physical eraseblocks are reserved for this volume
314 * @alignment: volume alignment
315 * @data_pad: how many bytes are unused at the end of the each physical
316 * eraseblock to satisfy the requested alignment
317 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
318 * @upd_marker: if volume update was started but not finished
319 * @name_len: volume name length
320 * @name: the volume name
321 * @padding2: reserved, zeroes
322 * @crc: a CRC32 checksum of the record
323 *
324 * The volume table records are stored in the volume table, which is stored in
325 * the layout volume. The layout volume consists of 2 logical eraseblock, each
326 * of which contains a copy of the volume table (i.e., the volume table is
327 * duplicated). The volume table is an array of &struct ubi_vtbl_record
328 * objects indexed by the volume ID.
329 *
330 * If the size of the logical eraseblock is large enough to fit
331 * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES
332 * records. Otherwise, it contains as many records as it can fit (i.e., size of
333 * logical eraseblock divided by sizeof(struct ubi_vtbl_record)).
334 *
335 * The @upd_marker flag is used to implement volume update. It is set to %1
336 * before update and set to %0 after the update. So if the update operation was
337 * interrupted, UBI knows that the volume is corrupted.
338 *
339 * The @alignment field is specified when the volume is created and cannot be
340 * later changed. It may be useful, for example, when a block-oriented file
341 * system works on top of UBI. The @data_pad field is calculated using the
342 * logical eraseblock size and @alignment. The alignment must be multiple to the
343 * minimal flash I/O unit. If @alignment is 1, all the available space of
344 * the physical eraseblocks is used.
345 *
346 * Empty records contain all zeroes and the CRC checksum of those zeroes.
347 */
348struct ubi_vtbl_record {
349 ubi32_t reserved_pebs;
350 ubi32_t alignment;
351 ubi32_t data_pad;
352 uint8_t vol_type;
353 uint8_t upd_marker;
354 ubi16_t name_len;
355 uint8_t name[UBI_VOL_NAME_MAX+1];
356 uint8_t padding2[24];
357 ubi32_t crc;
358} __attribute__ ((packed));
359
360#endif /* !__UBI_HEADER_H__ */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
new file mode 100644
index 000000000000..fe06ded0e6b8
--- /dev/null
+++ b/include/mtd/ubi-user.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __UBI_USER_H__
22#define __UBI_USER_H__
23
24/*
25 * UBI volume creation
26 * ~~~~~~~~~~~~~~~~~~~
27 *
28 * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
29 * device. A &struct ubi_mkvol_req object has to be properly filled and a
30 * pointer to it has to be passed to the IOCTL.
31 *
32 * UBI volume deletion
33 * ~~~~~~~~~~~~~~~~~~~
34 *
35 * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
36 * device should be used. A pointer to the 32-bit volume ID hast to be passed
37 * to the IOCTL.
38 *
39 * UBI volume re-size
40 * ~~~~~~~~~~~~~~~~~~
41 *
42 * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
43 * device should be used. A &struct ubi_rsvol_req object has to be properly
44 * filled and a pointer to it has to be passed to the IOCTL.
45 *
46 * UBI volume update
47 * ~~~~~~~~~~~~~~~~~
48 *
49 * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
50 * corresponding UBI volume character device. A pointer to a 64-bit update
51 * size should be passed to the IOCTL. After then, UBI expects user to write
52 * this number of bytes to the volume character device. The update is finished
53 * when the claimed number of bytes is passed. So, the volume update sequence
54 * is something like:
55 *
56 * fd = open("/dev/my_volume");
57 * ioctl(fd, UBI_IOCVOLUP, &image_size);
58 * write(fd, buf, image_size);
59 * close(fd);
60 */
61
62/*
63 * When a new volume is created, users may either specify the volume number they
64 * want to create or to let UBI automatically assign a volume number using this
65 * constant.
66 */
67#define UBI_VOL_NUM_AUTO (-1)
68
69/* Maximum volume name length */
70#define UBI_MAX_VOLUME_NAME 127
71
72/* IOCTL commands of UBI character devices */
73
74#define UBI_IOC_MAGIC 'o'
75
76/* Create an UBI volume */
77#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
78/* Remove an UBI volume */
79#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t)
80/* Re-size an UBI volume */
81#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
82
83/* IOCTL commands of UBI volume character devices */
84
85#define UBI_VOL_IOC_MAGIC 'O'
86
87/* Start UBI volume update */
88#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
89/* An eraseblock erasure command, used for debugging, disabled by default */
90#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
91
92/*
93 * UBI volume type constants.
94 *
95 * @UBI_DYNAMIC_VOLUME: dynamic volume
96 * @UBI_STATIC_VOLUME: static volume
97 */
98enum {
99 UBI_DYNAMIC_VOLUME = 3,
100 UBI_STATIC_VOLUME = 4
101};
102
103/**
104 * struct ubi_mkvol_req - volume description data structure used in
105 * volume creation requests.
106 * @vol_id: volume number
107 * @alignment: volume alignment
108 * @bytes: volume size in bytes
109 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
110 * @padding1: reserved for future, not used
111 * @name_len: volume name length
112 * @padding2: reserved for future, not used
113 * @name: volume name
114 *
115 * This structure is used by userspace programs when creating new volumes. The
116 * @used_bytes field is only necessary when creating static volumes.
117 *
118 * The @alignment field specifies the required alignment of the volume logical
119 * eraseblock. This means, that the size of logical eraseblocks will be aligned
120 * to this number, i.e.,
121 * (UBI device logical eraseblock size) mod (@alignment) = 0.
122 *
123 * To put it differently, the logical eraseblock of this volume may be slightly
124 * shortened in order to make it properly aligned. The alignment has to be
125 * multiple of the flash minimal input/output unit, or %1 to utilize the entire
126 * available space of logical eraseblocks.
127 *
128 * The @alignment field may be useful, for example, when one wants to maintain
129 * a block device on top of an UBI volume. In this case, it is desirable to fit
130 * an integer number of blocks in logical eraseblocks of this UBI volume. With
131 * alignment it is possible to update this volume using plane UBI volume image
132 * BLOBs, without caring about how to properly align them.
133 */
134struct ubi_mkvol_req {
135 int32_t vol_id;
136 int32_t alignment;
137 int64_t bytes;
138 int8_t vol_type;
139 int8_t padding1;
140 int16_t name_len;
141 int8_t padding2[4];
142 char name[UBI_MAX_VOLUME_NAME+1];
143} __attribute__ ((packed));
144
145/**
146 * struct ubi_rsvol_req - a data structure used in volume re-size requests.
147 * @vol_id: ID of the volume to re-size
148 * @bytes: new size of the volume in bytes
149 *
150 * Re-sizing is possible for both dynamic and static volumes. But while dynamic
151 * volumes may be re-sized arbitrarily, static volumes cannot be made to be
152 * smaller then the number of bytes they bear. To arbitrarily shrink a static
153 * volume, it must be wiped out first (by means of volume update operation with
154 * zero number of bytes).
155 */
156struct ubi_rsvol_req {
157 int64_t bytes;
158 int32_t vol_id;
159} __attribute__ ((packed));
160
161#endif /* __UBI_USER_H__ */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 88df8fc814e4..f3531d0bcd05 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -73,7 +73,9 @@ extern int ipv6_get_saddr(struct dst_entry *dst,
73extern int ipv6_dev_get_saddr(struct net_device *dev, 73extern int ipv6_dev_get_saddr(struct net_device *dev,
74 struct in6_addr *daddr, 74 struct in6_addr *daddr,
75 struct in6_addr *saddr); 75 struct in6_addr *saddr);
76extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); 76extern int ipv6_get_lladdr(struct net_device *dev,
77 struct in6_addr *addr,
78 unsigned char banned_flags);
77extern int ipv6_rcv_saddr_equal(const struct sock *sk, 79extern int ipv6_rcv_saddr_equal(const struct sock *sk,
78 const struct sock *sk2); 80 const struct sock *sk2);
79extern void addrconf_join_solict(struct net_device *dev, 81extern void addrconf_join_solict(struct net_device *dev,
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
new file mode 100644
index 000000000000..00c2eaa07c25
--- /dev/null
+++ b/include/net/af_rxrpc.h
@@ -0,0 +1,57 @@
1/* RxRPC kernel service interface definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _NET_RXRPC_H
13#define _NET_RXRPC_H
14
15#ifdef __KERNEL__
16
17#include <linux/rxrpc.h>
18
19struct rxrpc_call;
20
21/*
22 * the mark applied to socket buffers that may be intercepted
23 */
24enum {
25 RXRPC_SKB_MARK_DATA, /* data message */
26 RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */
27 RXRPC_SKB_MARK_BUSY, /* server busy message */
28 RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */
29 RXRPC_SKB_MARK_NET_ERROR, /* network error message */
30 RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */
31 RXRPC_SKB_MARK_NEW_CALL, /* local error message */
32};
33
34typedef void (*rxrpc_interceptor_t)(struct sock *, unsigned long,
35 struct sk_buff *);
36extern void rxrpc_kernel_intercept_rx_messages(struct socket *,
37 rxrpc_interceptor_t);
38extern struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
39 struct sockaddr_rxrpc *,
40 struct key *,
41 unsigned long,
42 gfp_t);
43extern int rxrpc_kernel_send_data(struct rxrpc_call *, struct msghdr *,
44 size_t);
45extern void rxrpc_kernel_abort_call(struct rxrpc_call *, u32);
46extern void rxrpc_kernel_end_call(struct rxrpc_call *);
47extern bool rxrpc_kernel_is_data_last(struct sk_buff *);
48extern u32 rxrpc_kernel_get_abort_code(struct sk_buff *);
49extern int rxrpc_kernel_get_error_number(struct sk_buff *);
50extern void rxrpc_kernel_data_delivered(struct sk_buff *);
51extern void rxrpc_kernel_free_skb(struct sk_buff *);
52extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *,
53 unsigned long);
54extern int rxrpc_kernel_reject_call(struct socket *);
55
56#endif /* __KERNEL__ */
57#endif /* _NET_RXRPC_H */
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 47ff2f46e908..99a4e364c74a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -263,8 +263,8 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25)
263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) 263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
264{ 264{
265 skb->dev = dev; 265 skb->dev = dev;
266 skb_reset_mac_header(skb);
266 skb->pkt_type = PACKET_HOST; 267 skb->pkt_type = PACKET_HOST;
267 skb->mac.raw = skb->data;
268 return htons(ETH_P_AX25); 268 return htons(ETH_P_AX25);
269} 269}
270 270
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 41456c148842..93ce272a5d27 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -709,6 +709,24 @@ struct hci_sco_hdr {
709 __u8 dlen; 709 __u8 dlen;
710} __attribute__ ((packed)); 710} __attribute__ ((packed));
711 711
712#ifdef __KERNEL__
713#include <linux/skbuff.h>
714static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
715{
716 return (struct hci_event_hdr *)skb->data;
717}
718
719static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
720{
721 return (struct hci_acl_hdr *)skb->data;
722}
723
724static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
725{
726 return (struct hci_sco_hdr *)skb->data;
727}
728#endif
729
712/* Command opcode pack/unpack */ 730/* Command opcode pack/unpack */
713#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 731#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
714#define hci_opcode_ogf(op) (op >> 10) 732#define hci_opcode_ogf(op) (op >> 10)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
new file mode 100644
index 000000000000..88171f8ce58a
--- /dev/null
+++ b/include/net/cfg80211.h
@@ -0,0 +1,40 @@
1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
3
4#include <linux/netlink.h>
5#include <linux/skbuff.h>
6#include <net/genetlink.h>
7
8/*
9 * 802.11 configuration in-kernel interface
10 *
11 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
12 */
13
14/* from net/wireless.h */
15struct wiphy;
16
17/**
18 * struct cfg80211_ops - backend description for wireless configuration
19 *
20 * This struct is registered by fullmac card drivers and/or wireless stacks
21 * in order to handle configuration requests on their interfaces.
22 *
23 * All callbacks except where otherwise noted should return 0
24 * on success or a negative error code.
25 *
26 * All operations are currently invoked under rtnl for consistency with the
27 * wireless extensions but this is subject to reevaluation as soon as this
28 * code is used more widely and we have a first user without wext.
29 *
30 * @add_virtual_intf: create a new virtual interface with the given name
31 *
32 * @del_virtual_intf: remove the virtual interface determined by ifindex.
33 */
34struct cfg80211_ops {
35 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
36 unsigned int type);
37 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
38};
39
40#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 4c9522c5178f..4f90f5554fac 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -120,7 +120,7 @@ extern int cipso_v4_rbm_strictvalid;
120 */ 120 */
121 121
122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) 122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0)
123#define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) 123#define CIPSO_V4_OPTPTR(x) (skb_network_header(x) + IPCB(x)->opt.cipso)
124 124
125/* 125/*
126 * DOI List Functions 126 * DOI List Functions
diff --git a/include/net/compat.h b/include/net/compat.h
index 9859b60280d5..406db242f73a 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -25,6 +25,7 @@ struct compat_cmsghdr {
25}; 25};
26 26
27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
28extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
28 29
29#else /* defined(CONFIG_COMPAT) */ 30#else /* defined(CONFIG_COMPAT) */
30#define compat_msghdr msghdr /* to avoid compiler warnings */ 31#define compat_msghdr msghdr /* to avoid compiler warnings */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index f01626cbbed6..30125119c950 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void);
148extern unsigned dnet_addr_type(__le16 addr); 148extern unsigned dnet_addr_type(__le16 addr);
149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); 149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
150 150
151/*
152 * rtnetlink interface
153 */
154extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
155extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
156extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 151extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
157 152
158extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
159extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
160extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
161
162extern void dn_fib_free_info(struct dn_fib_info *fi); 153extern void dn_fib_free_info(struct dn_fib_info *fi);
163 154
164static inline void dn_fib_info_put(struct dn_fib_info *fi) 155static inline void dn_fib_info_put(struct dn_fib_info *fi)
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index a566944c4962..c10e8e7e59a7 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -18,7 +18,6 @@
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
22extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
23 22
24/* Masks for flags field */ 23/* Masks for flags field */
diff --git a/include/net/esp.h b/include/net/esp.h
index 713d039f4af7..d05d8d2c78f4 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -40,8 +40,6 @@ struct esp_data
40 } auth; 40 } auth;
41}; 41};
42 42
43extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len);
44extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
45extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 43extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
46 44
47static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, 45static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index d585ea9fa97d..ed3a8872c6ca 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -5,7 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 6#include <linux/fib_rules.h>
7#include <net/flow.h> 7#include <net/flow.h>
8#include <net/netlink.h> 8#include <net/rtnetlink.h>
9 9
10struct fib_rule 10struct fib_rule
11{ 11{
@@ -19,6 +19,8 @@ struct fib_rule
19 u32 flags; 19 u32 flags;
20 u32 table; 20 u32 table;
21 u8 action; 21 u8 action;
22 u32 target;
23 struct fib_rule * ctarget;
22 struct rcu_head rcu; 24 struct rcu_head rcu;
23}; 25};
24 26
@@ -35,6 +37,8 @@ struct fib_rules_ops
35 struct list_head list; 37 struct list_head list;
36 int rule_size; 38 int rule_size;
37 int addr_size; 39 int addr_size;
40 int unresolved_rules;
41 int nr_goto_rules;
38 42
39 int (*action)(struct fib_rule *, 43 int (*action)(struct fib_rule *,
40 struct flowi *, int, 44 struct flowi *, int,
@@ -55,6 +59,10 @@ struct fib_rules_ops
55 u32 (*default_pref)(void); 59 u32 (*default_pref)(void);
56 size_t (*nlmsg_payload)(struct fib_rule *); 60 size_t (*nlmsg_payload)(struct fib_rule *);
57 61
62 /* Called after modifications to the rules set, must flush
63 * the route cache if one exists. */
64 void (*flush_cache)(void);
65
58 int nlgroup; 66 int nlgroup;
59 struct nla_policy *policy; 67 struct nla_policy *policy;
60 struct list_head *rules_list; 68 struct list_head *rules_list;
@@ -66,7 +74,8 @@ struct fib_rules_ops
66 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 74 [FRA_PRIORITY] = { .type = NLA_U32 }, \
67 [FRA_FWMARK] = { .type = NLA_U32 }, \ 75 [FRA_FWMARK] = { .type = NLA_U32 }, \
68 [FRA_FWMASK] = { .type = NLA_U32 }, \ 76 [FRA_FWMASK] = { .type = NLA_U32 }, \
69 [FRA_TABLE] = { .type = NLA_U32 } 77 [FRA_TABLE] = { .type = NLA_U32 }, \
78 [FRA_GOTO] = { .type = NLA_U32 }
70 79
71static inline void fib_rule_get(struct fib_rule *rule) 80static inline void fib_rule_get(struct fib_rule *rule)
72{ 81{
@@ -98,11 +107,4 @@ extern int fib_rules_unregister(struct fib_rules_ops *);
98extern int fib_rules_lookup(struct fib_rules_ops *, 107extern int fib_rules_lookup(struct fib_rules_ops *,
99 struct flowi *, int flags, 108 struct flowi *, int flags,
100 struct fib_lookup_arg *); 109 struct fib_lookup_arg *);
101
102extern int fib_nl_newrule(struct sk_buff *,
103 struct nlmsghdr *, void *);
104extern int fib_nl_delrule(struct sk_buff *,
105 struct nlmsghdr *, void *);
106extern int fib_rules_dump(struct sk_buff *,
107 struct netlink_callback *, int);
108#endif 110#endif
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index c28e424f53d9..668056b4bb0b 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -19,6 +19,9 @@
19#include <linux/in6.h> 19#include <linux/in6.h>
20#include <linux/ipv6.h> 20#include <linux/ipv6.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
23
24#include <net/inet_sock.h>
22 25
23#include <net/ipv6.h> 26#include <net/ipv6.h>
24 27
@@ -28,12 +31,11 @@ struct inet_hashinfo;
28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 31static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
29 const struct in6_addr *faddr, const __be16 fport) 32 const struct in6_addr *faddr, const __be16 fport)
30{ 33{
31 unsigned int hashent = (lport ^ (__force u16)fport); 34 u32 ports = (lport ^ (__force u16)fport);
32 35
33 hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 36 return jhash_3words((__force u32)laddr->s6_addr32[3],
34 hashent ^= hashent >> 16; 37 (__force u32)faddr->s6_addr32[3],
35 hashent ^= hashent >> 8; 38 ports, inet_ehash_secret);
36 return hashent;
37} 39}
38 40
39static inline int inet6_sk_ehashfn(const struct sock *sk) 41static inline int inet6_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 10117c8503e8..de8399a79774 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case __constant_htons(ETH_P_IP):
117 if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(skb->nh.iph); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case __constant_htons(ETH_P_IPV6):
122 if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(skb->nh.ipv6h); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
125 } 125 }
126 126
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index ce6da97bc848..62daf214931f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
22 23
23#include <net/flow.h> 24#include <net/flow.h>
24#include <net/sock.h> 25#include <net/sock.h>
@@ -167,13 +168,15 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
167 168
168extern int inet_sk_rebuild_header(struct sock *sk); 169extern int inet_sk_rebuild_header(struct sock *sk);
169 170
171extern u32 inet_ehash_secret;
172extern void build_ehash_secret(void);
173
170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, 174static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
171 const __be32 faddr, const __be16 fport) 175 const __be32 faddr, const __be16 fport)
172{ 176{
173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); 177 return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
174 h ^= h >> 16; 178 ((__u32) lport) << 16 | (__force __u32)fport,
175 h ^= h >> 8; 179 inet_ehash_secret);
176 return h;
177} 180}
178 181
179static inline int inet_sk_ehashfn(const struct sock *sk) 182static inline int inet_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/ip.h b/include/net/ip.h
index e79c3e3aa4f6..bb207db03675 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/ip.h> 26#include <linux/ip.h>
27#include <linux/in.h> 27#include <linux/in.h>
28#include <linux/skbuff.h>
28 29
29#include <net/inet_sock.h> 30#include <net/inet_sock.h>
30#include <net/snmp.h> 31#include <net/snmp.h>
@@ -43,6 +44,11 @@ struct inet_skb_parm
43#define IPSKB_REROUTED 16 44#define IPSKB_REROUTED 16
44}; 45};
45 46
47static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
48{
49 return ip_hdr(skb)->ihl * 4;
50}
51
46struct ipcm_cookie 52struct ipcm_cookie
47{ 53{
48 __be32 addr; 54 __be32 addr;
@@ -74,7 +80,6 @@ struct msghdr;
74struct net_device; 80struct net_device;
75struct packet_type; 81struct packet_type;
76struct rtable; 82struct rtable;
77struct sk_buff;
78struct sockaddr; 83struct sockaddr;
79 84
80extern void ip_mc_dropsocket(struct sock *); 85extern void ip_mc_dropsocket(struct sock *);
@@ -161,6 +166,10 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
161#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) 166#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd)
162#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) 167#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd)
163 168
169extern unsigned long snmp_fold_field(void *mib[], int offt);
170extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
171extern void snmp_mib_free(void *ptr[2]);
172
164extern int sysctl_local_port_range[2]; 173extern int sysctl_local_port_range[2];
165extern int sysctl_ip_default_ttl; 174extern int sysctl_ip_default_ttl;
166extern int sysctl_ip_nonlocal_bind; 175extern int sysctl_ip_nonlocal_bind;
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index cf355a3c2ad5..c48ea873f1e0 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -219,8 +219,6 @@ extern void fib6_init(void);
219 219
220extern void fib6_rules_init(void); 220extern void fib6_rules_init(void);
221extern void fib6_rules_cleanup(void); 221extern void fib6_rules_cleanup(void);
222extern int fib6_rules_dump(struct sk_buff *,
223 struct netlink_callback *);
224 222
225#endif 223#endif
226#endif 224#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4e927ebd1cb3..5456fdd6d047 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr,
116 struct net_device *dev, 116 struct net_device *dev,
117 u32 pmtu); 117 u32 pmtu);
118 118
119struct nlmsghdr;
120struct netlink_callback; 119struct netlink_callback;
121extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
122extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
123extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
124extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
125 120
126struct rt6_rtnl_dump_arg 121struct rt6_rtnl_dump_arg
127{ 122{
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 36c635ca1aa6..5a4a0366c24f 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
215/* Exported by fib_frontend.c */ 215/* Exported by fib_frontend.c */
216extern struct nla_policy rtm_ipv4_policy[]; 216extern struct nla_policy rtm_ipv4_policy[];
217extern void ip_fib_init(void); 217extern void ip_fib_init(void);
218extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
219extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
220extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
221extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
222extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
223 struct net_device *dev, __be32 *spec_dst, u32 *itag); 219 struct net_device *dev, __be32 *spec_dst, u32 *itag);
224extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 220extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
235extern struct fib_table *fib_hash_init(u32 id); 231extern struct fib_table *fib_hash_init(u32 id);
236 232
237#ifdef CONFIG_IP_MULTIPLE_TABLES 233#ifdef CONFIG_IP_MULTIPLE_TABLES
238extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
239
240extern void __init fib4_rules_init(void); 234extern void __init fib4_rules_init(void);
241 235
242#ifdef CONFIG_NET_CLS_ROUTE 236#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 00328b71a08c..f70afef9c3cc 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -166,13 +166,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ 166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \
167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) 167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0)
168 168
169int snmp6_register_dev(struct inet6_dev *idev);
170int snmp6_unregister_dev(struct inet6_dev *idev);
171int snmp6_alloc_dev(struct inet6_dev *idev);
172int snmp6_free_dev(struct inet6_dev *idev);
173int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
174void snmp6_mib_free(void *ptr[2]);
175
176struct ip6_ra_chain 169struct ip6_ra_chain
177{ 170{
178 struct ip6_ra_chain *next; 171 struct ip6_ra_chain *next;
@@ -605,8 +598,20 @@ extern int udplite6_proc_init(void);
605extern void udplite6_proc_exit(void); 598extern void udplite6_proc_exit(void);
606extern int ipv6_misc_proc_init(void); 599extern int ipv6_misc_proc_init(void);
607extern void ipv6_misc_proc_exit(void); 600extern void ipv6_misc_proc_exit(void);
601extern int snmp6_register_dev(struct inet6_dev *idev);
602extern int snmp6_unregister_dev(struct inet6_dev *idev);
608 603
609extern struct rt6_statistics rt6_stats; 604extern struct rt6_statistics rt6_stats;
605#else
606static inline int snmp6_register_dev(struct inet6_dev *idev)
607{
608 return 0;
609}
610
611static inline int snmp6_unregister_dev(struct inet6_dev *idev)
612{
613 return 0;
614}
610#endif 615#endif
611 616
612#ifdef CONFIG_SYSCTL 617#ifdef CONFIG_SYSCTL
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c6b2ee610866..4cc0b4eca948 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -43,7 +43,7 @@ struct ipxhdr {
43 43
44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
45{ 45{
46 return (struct ipxhdr *)skb->h.raw; 46 return (struct ipxhdr *)skb_transport_header(skb);
47} 47}
48 48
49struct ipx_interface { 49struct ipx_interface {
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 8a830188354d..f23d07ca7c59 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -431,26 +431,7 @@ struct iw_public_data {
431 * Those may be called only within the kernel. 431 * Those may be called only within the kernel.
432 */ 432 */
433 433
434/* First : function strictly used inside the kernel */ 434/* functions that may be called by driver modules */
435
436/* Handle /proc/net/wireless, called in net/code/dev.c */
437extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
438 int length);
439
440/* Handle IOCTLs, called in net/core/dev.c */
441extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);
442
443/* Handle RtNetlink requests, called in net/core/rtnetlink.c */
444extern int wireless_rtnetlink_set(struct net_device * dev,
445 char * data,
446 int len);
447extern int wireless_rtnetlink_get(struct net_device * dev,
448 char * data,
449 int len,
450 char ** p_buf,
451 int * p_len);
452
453/* Second : functions that may be called by driver modules */
454 435
455/* Send a single event to user space */ 436/* Send a single event to user space */
456extern void wireless_send_event(struct net_device * dev, 437extern void wireless_send_event(struct net_device * dev,
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index aa33a477c3fb..4a8f58b17e43 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -203,7 +203,7 @@ struct llc_pdu_sn {
203 203
204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) 204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
205{ 205{
206 return (struct llc_pdu_sn *)skb->nh.raw; 206 return (struct llc_pdu_sn *)skb_network_header(skb);
207} 207}
208 208
209/* Un-numbered PDU format (3 bytes in length) */ 209/* Un-numbered PDU format (3 bytes in length) */
@@ -215,12 +215,7 @@ struct llc_pdu_un {
215 215
216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) 216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
217{ 217{
218 return (struct llc_pdu_un *)skb->nh.raw; 218 return (struct llc_pdu_un *)skb_network_header(skb);
219}
220
221static inline void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr)
222{
223 return skb->nh.raw = ptr;
224} 219}
225 220
226/** 221/**
@@ -237,7 +232,11 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
237 u8 ssap, u8 dsap, u8 cr) 232 u8 ssap, u8 dsap, u8 cr)
238{ 233{
239 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; 234 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4;
240 struct llc_pdu_un *pdu = llc_set_pdu_hdr(skb, skb_push(skb, hlen)); 235 struct llc_pdu_un *pdu;
236
237 skb_push(skb, hlen);
238 skb_reset_network_header(skb);
239 pdu = llc_pdu_un_hdr(skb);
241 pdu->dsap = dsap; 240 pdu->dsap = dsap;
242 pdu->ssap = ssap; 241 pdu->ssap = ssap;
243 pdu->ssap |= cr; 242 pdu->ssap |= cr;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index ad7fe1121412..a4f26187fc1a 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <net/rtnetlink.h>
27 28
28#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) 29#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE)
29#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) 30#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
213extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); 214extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat);
214extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); 215extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev);
215 216
216struct netlink_callback;
217struct nlmsghdr;
218extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
219extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
220extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
221extern void neigh_app_ns(struct neighbour *n); 217extern void neigh_app_ns(struct neighbour *n);
222
223extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
224extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
225
226extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 218extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
227extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 219extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
228extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); 220extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0e690e34c00b..1c6b8bd09b9a 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -250,6 +250,11 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
250 return test_bit(IPS_DYING_BIT, &ct->status); 250 return test_bit(IPS_DYING_BIT, &ct->status);
251} 251}
252 252
253static inline int nf_ct_is_untracked(const struct sk_buff *skb)
254{
255 return (skb->nfct == &nf_conntrack_untracked.ct_general);
256}
257
253extern unsigned int nf_conntrack_htable_size; 258extern unsigned int nf_conntrack_htable_size;
254extern int nf_conntrack_checksum; 259extern int nf_conntrack_checksum;
255extern atomic_t nf_conntrack_count; 260extern atomic_t nf_conntrack_count;
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
deleted file mode 100644
index 6f84c1f7fcd4..000000000000
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ /dev/null
@@ -1,145 +0,0 @@
1#ifndef _NF_CONNTRACK_COMPAT_H
2#define _NF_CONNTRACK_COMPAT_H
3
4#ifdef __KERNEL__
5
6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7
8#include <linux/netfilter_ipv4/ip_conntrack.h>
9#include <linux/socket.h>
10
11#ifdef CONFIG_IP_NF_CONNTRACK_MARK
12static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
13 u_int32_t *ctinfo)
14{
15 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
16
17 if (ct)
18 return &ct->mark;
19 else
20 return NULL;
21}
22#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
23
24#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
25static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
26 u_int32_t *ctinfo)
27{
28 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
29
30 if (ct)
31 return &ct->secmark;
32 else
33 return NULL;
34}
35#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
36
37#ifdef CONFIG_IP_NF_CT_ACCT
38static inline struct ip_conntrack_counter *
39nf_ct_get_counters(const struct sk_buff *skb)
40{
41 enum ip_conntrack_info ctinfo;
42 struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo);
43
44 if (ct)
45 return ct->counters;
46 else
47 return NULL;
48}
49#endif /* CONFIG_IP_NF_CT_ACCT */
50
51static inline int nf_ct_is_untracked(const struct sk_buff *skb)
52{
53 return (skb->nfct == &ip_conntrack_untracked.ct_general);
54}
55
56static inline void nf_ct_untrack(struct sk_buff *skb)
57{
58 skb->nfct = &ip_conntrack_untracked.ct_general;
59}
60
61static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
62 enum ip_conntrack_info *ctinfo)
63{
64 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
65 return (ct != NULL);
66}
67
68static inline int nf_ct_l3proto_try_module_get(unsigned short l3proto)
69{
70 need_conntrack();
71 return l3proto == PF_INET ? 0 : -1;
72}
73
74static inline void nf_ct_l3proto_module_put(unsigned short l3proto)
75{
76}
77
78#else /* CONFIG_IP_NF_CONNTRACK */
79
80#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
81#include <net/netfilter/nf_conntrack.h>
82
83#ifdef CONFIG_NF_CONNTRACK_MARK
84
85static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
86 u_int32_t *ctinfo)
87{
88 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
89
90 if (ct)
91 return &ct->mark;
92 else
93 return NULL;
94}
95#endif /* CONFIG_NF_CONNTRACK_MARK */
96
97#ifdef CONFIG_NF_CONNTRACK_SECMARK
98static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
99 u_int32_t *ctinfo)
100{
101 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
102
103 if (ct)
104 return &ct->secmark;
105 else
106 return NULL;
107}
108#endif /* CONFIG_NF_CONNTRACK_MARK */
109
110#ifdef CONFIG_NF_CT_ACCT
111static inline struct ip_conntrack_counter *
112nf_ct_get_counters(const struct sk_buff *skb)
113{
114 enum ip_conntrack_info ctinfo;
115 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
116
117 if (ct)
118 return ct->counters;
119 else
120 return NULL;
121}
122#endif /* CONFIG_NF_CT_ACCT */
123
124static inline int nf_ct_is_untracked(const struct sk_buff *skb)
125{
126 return (skb->nfct == &nf_conntrack_untracked.ct_general);
127}
128
129static inline void nf_ct_untrack(struct sk_buff *skb)
130{
131 skb->nfct = &nf_conntrack_untracked.ct_general;
132}
133
134static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
135 enum ip_conntrack_info *ctinfo)
136{
137 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
138 return (ct != NULL);
139}
140
141#endif /* CONFIG_IP_NF_CONNTRACK */
142
143#endif /* __KERNEL__ */
144
145#endif /* _NF_CONNTRACK_COMPAT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 85634e1865c3..9fb906688ffa 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -27,6 +27,9 @@ extern unsigned int nf_conntrack_in(int pf,
27extern int nf_conntrack_init(void); 27extern int nf_conntrack_init(void);
28extern void nf_conntrack_cleanup(void); 28extern void nf_conntrack_cleanup(void);
29 29
30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void);
32
30struct nf_conntrack_l3proto; 33struct nf_conntrack_l3proto;
31extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); 34extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
32/* Like above, but you already have conntrack read lock. */ 35/* Like above, but you already have conntrack read lock. */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index b62a8a9ec9d8..811c9073c532 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -20,30 +20,8 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) 20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21 21
22extern struct atomic_notifier_head nf_conntrack_chain; 22extern struct atomic_notifier_head nf_conntrack_chain;
23extern struct atomic_notifier_head nf_conntrack_expect_chain; 23extern int nf_conntrack_register_notifier(struct notifier_block *nb);
24 24extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
25static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
26{
27 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
28}
29
30static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
31{
32 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
33}
34
35static inline int
36nf_conntrack_expect_register_notifier(struct notifier_block *nb)
37{
38 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
39}
40
41static inline int
42nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
43{
44 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
45 nb);
46}
47 25
48extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 26extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
49extern void __nf_ct_event_cache_init(struct nf_conn *ct); 27extern void __nf_ct_event_cache_init(struct nf_conn *ct);
@@ -71,6 +49,10 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event,
71 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 49 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
72} 50}
73 51
52extern struct atomic_notifier_head nf_conntrack_expect_chain;
53extern int nf_conntrack_expect_register_notifier(struct notifier_block *nb);
54extern int nf_conntrack_expect_unregister_notifier(struct notifier_block *nb);
55
74static inline void 56static inline void
75nf_conntrack_expect_event(enum ip_conntrack_expect_events event, 57nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
76 struct nf_conntrack_expect *exp) 58 struct nf_conntrack_expect *exp)
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index eb575cbd4c95..f32f714e5d92 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -90,10 +90,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
90/* Protocol registration. */ 90/* Protocol registration. */
91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
92extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 92extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
93 93extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
94extern struct nf_conntrack_l3proto *
95nf_ct_l3proto_find_get(u_int16_t l3proto);
96
97extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 94extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
98 95
99/* Existing built-in protocols */ 96/* Existing built-in protocols */
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 8415182ec126..f46cb930414c 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -97,7 +97,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 98
99#define MAX_NF_CT_PROTO 256 99#define MAX_NF_CT_PROTO 256
100extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
101 100
102extern struct nf_conntrack_l4proto * 101extern struct nf_conntrack_l4proto *
103__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index f191c672bcc6..e76565459ad9 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -4,16 +4,6 @@
4#include <net/netfilter/nf_nat.h> 4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h> 5#include <linux/netfilter_ipv4/ip_tables.h>
6 6
7/* Compatibility definitions for ipt_FOO modules */
8#define ip_nat_range nf_nat_range
9#define ip_conntrack_tuple nf_conntrack_tuple
10#define ip_conntrack_get nf_ct_get
11#define ip_conntrack nf_conn
12#define ip_nat_setup_info nf_nat_setup_info
13#define ip_nat_multi_range_compat nf_nat_multi_range_compat
14#define ip_ct_iterate_cleanup nf_ct_iterate_cleanup
15#define IP_NF_ASSERT NF_CT_ASSERT
16
17extern int nf_nat_rule_init(void) __init; 7extern int nf_nat_rule_init(void) __init;
18extern void nf_nat_rule_cleanup(void); 8extern void nf_nat_rule_cleanup(void);
19extern int nf_nat_rule_find(struct sk_buff **pskb, 9extern int nf_nat_rule_find(struct sk_buff **pskb,
diff --git a/include/net/netlink.h b/include/net/netlink.h
index bcaf67b7a19d..0bf325c29aff 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -171,6 +171,7 @@ enum {
171 NLA_MSECS, 171 NLA_MSECS,
172 NLA_NESTED, 172 NLA_NESTED,
173 NLA_NUL_STRING, 173 NLA_NUL_STRING,
174 NLA_BINARY,
174 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
175}; 176};
176 177
@@ -188,12 +189,13 @@ enum {
188 * NLA_STRING Maximum length of string 189 * NLA_STRING Maximum length of string
189 * NLA_NUL_STRING Maximum length of string (excluding NUL) 190 * NLA_NUL_STRING Maximum length of string (excluding NUL)
190 * NLA_FLAG Unused 191 * NLA_FLAG Unused
192 * NLA_BINARY Maximum length of attribute payload
191 * All other Exact length of attribute payload 193 * All other Exact length of attribute payload
192 * 194 *
193 * Example: 195 * Example:
194 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 196 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
195 * [ATTR_FOO] = { .type = NLA_U16 }, 197 * [ATTR_FOO] = { .type = NLA_U16 },
196 * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, 198 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
197 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 199 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
198 * }; 200 * };
199 */ 201 */
@@ -214,9 +216,7 @@ struct nl_info {
214 216
215extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 217extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
216 int (*cb)(struct sk_buff *, 218 int (*cb)(struct sk_buff *,
217 struct nlmsghdr *, int *)); 219 struct nlmsghdr *));
218extern void netlink_queue_skip(struct nlmsghdr *nlh,
219 struct sk_buff *skb);
220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
221 u32 pid, unsigned int group, int report, 221 u32 pid, unsigned int group, int report,
222 gfp_t flags); 222 gfp_t flags);
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
525 */ 525 */
526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) 526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
527{ 527{
528 nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; 528 nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh;
529 529
530 return skb->len; 530 return skb->len;
531} 531}
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
538 */ 538 */
539static inline void *nlmsg_get_pos(struct sk_buff *skb) 539static inline void *nlmsg_get_pos(struct sk_buff *skb)
540{ 540{
541 return skb->tail; 541 return skb_tail_pointer(skb);
542} 542}
543 543
544/** 544/**
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
548 * 548 *
549 * Trims the message to the provided mark. Returns -1. 549 * Trims the message to the provided mark. Returns -1.
550 */ 550 */
551static inline int nlmsg_trim(struct sk_buff *skb, void *mark) 551static inline int nlmsg_trim(struct sk_buff *skb, const void *mark)
552{ 552{
553 if (mark) 553 if (mark)
554 skb_trim(skb, (unsigned char *) mark - skb->data); 554 skb_trim(skb, (unsigned char *) mark - skb->data);
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla)
940 */ 940 */
941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) 941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
942{ 942{
943 struct nlattr *start = (struct nlattr *) skb->tail; 943 struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
944 944
945 if (nla_put(skb, attrtype, 0, NULL) < 0) 945 if (nla_put(skb, attrtype, 0, NULL) < 0)
946 return NULL; 946 return NULL;
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
960 */ 960 */
961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) 961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
962{ 962{
963 start->nla_len = skb->tail - (unsigned char *) start; 963 start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
964 return skb->len; 964 return skb->len;
965} 965}
966 966
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 02647fe3d74b..4129df708079 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -326,18 +326,18 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
326 case TCF_LAYER_LINK: 326 case TCF_LAYER_LINK:
327 return skb->data; 327 return skb->data;
328 case TCF_LAYER_NETWORK: 328 case TCF_LAYER_NETWORK:
329 return skb->nh.raw; 329 return skb_network_header(skb);
330 case TCF_LAYER_TRANSPORT: 330 case TCF_LAYER_TRANSPORT:
331 return skb->h.raw; 331 return skb_transport_header(skb);
332 } 332 }
333 333
334 return NULL; 334 return NULL;
335} 335}
336 336
337static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr, 337static inline int tcf_valid_offset(const struct sk_buff *skb,
338 int len) 338 const unsigned char *ptr, const int len)
339{ 339{
340 return unlikely((ptr + len) < skb->tail && ptr > skb->head); 340 return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head);
341} 341}
342 342
343#ifdef CONFIG_NET_CLS_IND 343#ifdef CONFIG_NET_CLS_IND
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index f6afee73235d..5754d53d9efc 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -2,6 +2,7 @@
2#define __NET_PKT_SCHED_H 2#define __NET_PKT_SCHED_H
3 3
4#include <linux/jiffies.h> 4#include <linux/jiffies.h>
5#include <linux/ktime.h>
5#include <net/sch_generic.h> 6#include <net/sch_generic.h>
6 7
7struct qdisc_walker 8struct qdisc_walker
@@ -12,8 +13,6 @@ struct qdisc_walker
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 13 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 14};
14 15
15extern rwlock_t qdisc_tree_lock;
16
17#define QDISC_ALIGNTO 32 16#define QDISC_ALIGNTO 32
18#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 17#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
19 18
@@ -37,175 +36,38 @@ static inline void *qdisc_priv(struct Qdisc *q)
37 The things are not so bad, because we may use artifical 36 The things are not so bad, because we may use artifical
38 clock evaluated by integration of network data flow 37 clock evaluated by integration of network data flow
39 in the most critical places. 38 in the most critical places.
40
41 Note: we do not use fastgettimeofday.
42 The reason is that, when it is not the same thing as
43 gettimeofday, it returns invalid timestamp, which is
44 not updated, when net_bh is active.
45 */
46
47/* General note about internal clock.
48
49 Any clock source returns time intervals, measured in units
50 close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely
51 microseconds, otherwise something close but different chosen to minimize
52 arithmetic cost. Ratio usec/internal untis in form nominator/denominator
53 may be read from /proc/net/psched.
54 */ 39 */
55 40
56
57#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
58
59typedef struct timeval psched_time_t;
60typedef long psched_tdiff_t;
61
62#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
63#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)
64#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)
65
66#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
67
68typedef u64 psched_time_t; 41typedef u64 psched_time_t;
69typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
70 43
71#ifdef CONFIG_NET_SCH_CLK_JIFFIES 44/* Avoid doing 64 bit divide by 1000 */
72 45#define PSCHED_US2NS(x) ((s64)(x) << 10)
73#if HZ < 96 46#define PSCHED_NS2US(x) ((x) >> 10)
74#define PSCHED_JSCALE 14
75#elif HZ >= 96 && HZ < 192
76#define PSCHED_JSCALE 13
77#elif HZ >= 192 && HZ < 384
78#define PSCHED_JSCALE 12
79#elif HZ >= 384 && HZ < 768
80#define PSCHED_JSCALE 11
81#elif HZ >= 768
82#define PSCHED_JSCALE 10
83#endif
84 47
85#define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<<PSCHED_JSCALE)) 48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC)
86#define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) 49#define PSCHED_PASTPERFECT 0
87#define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) 50
88 51static inline psched_time_t psched_get_time(void)
89#endif /* CONFIG_NET_SCH_CLK_JIFFIES */
90#ifdef CONFIG_NET_SCH_CLK_CPU
91#include <asm/timex.h>
92
93extern psched_tdiff_t psched_clock_per_hz;
94extern int psched_clock_scale;
95extern psched_time_t psched_time_base;
96extern cycles_t psched_time_mark;
97
98#define PSCHED_GET_TIME(stamp) \
99do { \
100 cycles_t cur = get_cycles(); \
101 if (sizeof(cycles_t) == sizeof(u32)) { \
102 if (cur <= psched_time_mark) \
103 psched_time_base += 0x100000000ULL; \
104 psched_time_mark = cur; \
105 (stamp) = (psched_time_base + cur)>>psched_clock_scale; \
106 } else { \
107 (stamp) = cur>>psched_clock_scale; \
108 } \
109} while (0)
110#define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
111#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
112
113#endif /* CONFIG_NET_SCH_CLK_CPU */
114
115#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
116
117#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
118#define PSCHED_TDIFF(tv1, tv2) \
119({ \
120 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \
121 int __delta = (tv1).tv_usec - (tv2).tv_usec; \
122 if (__delta_sec) { \
123 switch (__delta_sec) { \
124 default: \
125 __delta = 0; \
126 case 2: \
127 __delta += USEC_PER_SEC; \
128 case 1: \
129 __delta += USEC_PER_SEC; \
130 } \
131 } \
132 __delta; \
133})
134
135static inline int
136psched_tod_diff(int delta_sec, int bound)
137{ 52{
138 int delta; 53 return PSCHED_NS2US(ktime_to_ns(ktime_get()));
139
140 if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)
141 return bound;
142 delta = delta_sec * USEC_PER_SEC;
143 if (delta > bound || delta < 0)
144 delta = bound;
145 return delta;
146} 54}
147 55
148#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ 56static inline psched_tdiff_t
149({ \ 57psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
150 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ 58{
151 int __delta = (tv1).tv_usec - (tv2).tv_usec; \ 59 return min(tv1 - tv2, bound);
152 switch (__delta_sec) { \ 60}
153 default: \
154 __delta = psched_tod_diff(__delta_sec, bound); break; \
155 case 2: \
156 __delta += USEC_PER_SEC; \
157 case 1: \
158 __delta += USEC_PER_SEC; \
159 case 0: \
160 if (__delta > bound || __delta < 0) \
161 __delta = bound; \
162 } \
163 __delta; \
164})
165
166#define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \
167 (tv1).tv_sec <= (tv2).tv_sec) || \
168 (tv1).tv_sec < (tv2).tv_sec)
169
170#define PSCHED_TADD2(tv, delta, tv_res) \
171({ \
172 int __delta = (tv).tv_usec + (delta); \
173 (tv_res).tv_sec = (tv).tv_sec; \
174 while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
175 (tv_res).tv_usec = __delta; \
176})
177
178#define PSCHED_TADD(tv, delta) \
179({ \
180 (tv).tv_usec += (delta); \
181 while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \
182 (tv).tv_usec -= USEC_PER_SEC; } \
183})
184
185/* Set/check that time is in the "past perfect";
186 it depends on concrete representation of system time
187 */
188
189#define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0)
190#define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0)
191
192#define PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; })
193
194#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
195
196#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
197#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
198 min_t(long long, (tv1) - (tv2), bound)
199
200 61
201#define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2)) 62struct qdisc_watchdog {
202#define PSCHED_TADD2(tv, delta, tv_res) ((tv_res) = (tv) + (delta)) 63 struct hrtimer timer;
203#define PSCHED_TADD(tv, delta) ((tv) += (delta)) 64 struct Qdisc *qdisc;
204#define PSCHED_SET_PASTPERFECT(t) ((t) = 0) 65};
205#define PSCHED_IS_PASTPERFECT(t) ((t) == 0)
206#define PSCHED_AUDIT_TDIFF(t)
207 66
208#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 67extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
68extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
69 psched_time_t expires);
70extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
209 71
210extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
211extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
diff --git a/include/net/red.h b/include/net/red.h
index a4eb37946f2c..3cf31d466a81 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -151,17 +151,17 @@ static inline void red_set_parms(struct red_parms *p,
151 151
152static inline int red_is_idling(struct red_parms *p) 152static inline int red_is_idling(struct red_parms *p)
153{ 153{
154 return !PSCHED_IS_PASTPERFECT(p->qidlestart); 154 return p->qidlestart != PSCHED_PASTPERFECT;
155} 155}
156 156
157static inline void red_start_of_idle_period(struct red_parms *p) 157static inline void red_start_of_idle_period(struct red_parms *p)
158{ 158{
159 PSCHED_GET_TIME(p->qidlestart); 159 p->qidlestart = psched_get_time();
160} 160}
161 161
162static inline void red_end_of_idle_period(struct red_parms *p) 162static inline void red_end_of_idle_period(struct red_parms *p)
163{ 163{
164 PSCHED_SET_PASTPERFECT(p->qidlestart); 164 p->qidlestart = PSCHED_PASTPERFECT;
165} 165}
166 166
167static inline void red_restart(struct red_parms *p) 167static inline void red_restart(struct red_parms *p)
@@ -177,8 +177,8 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
177 long us_idle; 177 long us_idle;
178 int shift; 178 int shift;
179 179
180 PSCHED_GET_TIME(now); 180 now = psched_get_time();
181 us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); 181 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
182 182
183 /* 183 /*
184 * The problem: ideally, average length queue recalcultion should 184 * The problem: ideally, average length queue recalcultion should
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
new file mode 100644
index 000000000000..3b3d4745618d
--- /dev/null
+++ b/include/net/rtnetlink.h
@@ -0,0 +1,25 @@
1#ifndef __NET_RTNETLINK_H
2#define __NET_RTNETLINK_H
3
4#include <linux/rtnetlink.h>
5#include <net/netlink.h>
6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9
10extern int __rtnl_register(int protocol, int msgtype,
11 rtnl_doit_func, rtnl_dumpit_func);
12extern void rtnl_register(int protocol, int msgtype,
13 rtnl_doit_func, rtnl_dumpit_func);
14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol);
16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh)
18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
21 else
22 return AF_UNSPEC;
23}
24
25#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 82086392735a..1b8e35197ebe 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -5,10 +5,10 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/rtnetlink.h>
9#include <linux/pkt_sched.h> 8#include <linux/pkt_sched.h>
10#include <linux/pkt_cls.h> 9#include <linux/pkt_cls.h>
11#include <net/gen_stats.h> 10#include <net/gen_stats.h>
11#include <net/rtnetlink.h>
12 12
13struct Qdisc_ops; 13struct Qdisc_ops;
14struct qdisc_walker; 14struct qdisc_walker;
@@ -177,14 +177,8 @@ extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
177extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); 177extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops);
178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
179 struct Qdisc_ops *ops, u32 parentid); 179 struct Qdisc_ops *ops, u32 parentid);
180 180extern void tcf_destroy(struct tcf_proto *tp);
181static inline void 181extern void tcf_destroy_chain(struct tcf_proto *fl);
182tcf_destroy(struct tcf_proto *tp)
183{
184 tp->ops->destroy(tp);
185 module_put(tp->ops->owner);
186 kfree(tp);
187}
188 182
189static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 183static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
190 struct sk_buff_head *list) 184 struct sk_buff_head *list)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 5ddb85599863..bb37724495a5 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -283,7 +283,7 @@ enum { SCTP_MAX_GABS = 16 };
283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ 283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */
284 284
285/* Maximum number of new data packets that can be sent in a burst. */ 285/* Maximum number of new data packets that can be sent in a burst. */
286#define SCTP_MAX_BURST 4 286#define SCTP_DEFAULT_MAX_BURST 4
287 287
288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ 288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */
289 289
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f431acf3dcea..7b4fff93ba7f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -276,6 +276,7 @@ struct sctp_sock {
276 __u32 default_context; 276 __u32 default_context;
277 __u32 default_timetolive; 277 __u32 default_timetolive;
278 __u32 default_rcv_context; 278 __u32 default_rcv_context;
279 int max_burst;
279 280
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 281 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value 282 * the destination address every heartbeat interval. This value
@@ -304,10 +305,12 @@ struct sctp_sock {
304 __u32 autoclose; 305 __u32 autoclose;
305 __u8 nodelay; 306 __u8 nodelay;
306 __u8 disable_fragments; 307 __u8 disable_fragments;
307 __u8 pd_mode;
308 __u8 v4mapped; 308 __u8 v4mapped;
309 __u8 frag_interleave;
309 __u32 adaptation_ind; 310 __u32 adaptation_ind;
311 __u32 pd_point;
310 312
313 atomic_t pd_mode;
311 /* Receive to here while partial delivery is in effect. */ 314 /* Receive to here while partial delivery is in effect. */
312 struct sk_buff_head pd_lobby; 315 struct sk_buff_head pd_lobby;
313}; 316};
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 2923e3d31a08..de88ed5b0ba6 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -89,6 +89,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
89 __u16 error, 89 __u16 error,
90 __u16 outbound, 90 __u16 outbound,
91 __u16 inbound, 91 __u16 inbound,
92 struct sctp_chunk *chunk,
92 gfp_t gfp); 93 gfp_t gfp);
93 94
94struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 95struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index ab26ab3adae1..39ea3f442b47 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -78,7 +78,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); 78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
79 79
80/* Clear the partial data delivery condition on this socket. */ 80/* Clear the partial data delivery condition on this socket. */
81int sctp_clear_pd(struct sock *sk); 81int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc);
82 82
83/* Skip over an SSN. */ 83/* Skip over an SSN. */
84void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); 84void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 67a30eb2b3a4..6d2b57758cca 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -97,6 +97,12 @@ enum sctp_optname {
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME 97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
98 SCTP_CONTEXT, /* Receive Context */ 98 SCTP_CONTEXT, /* Receive Context */
99#define SCTP_CONTEXT SCTP_CONTEXT 99#define SCTP_CONTEXT SCTP_CONTEXT
100 SCTP_FRAGMENT_INTERLEAVE,
101#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE
102 SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */
103#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
104 SCTP_MAX_BURST, /* Set/Get max burst */
105#define SCTP_MAX_BURST SCTP_MAX_BURST
100 106
101 /* Internal Socket Options. Some of the sctp library functions are 107 /* Internal Socket Options. Some of the sctp library functions are
102 * implemented using these socket options. 108 * implemented using these socket options.
@@ -213,6 +219,7 @@ struct sctp_assoc_change {
213 __u16 sac_outbound_streams; 219 __u16 sac_outbound_streams;
214 __u16 sac_inbound_streams; 220 __u16 sac_inbound_streams;
215 sctp_assoc_t sac_assoc_id; 221 sctp_assoc_t sac_assoc_id;
222 __u8 sac_info[0];
216}; 223};
217 224
218/* 225/*
@@ -261,6 +268,7 @@ enum sctp_spc_state {
261 SCTP_ADDR_REMOVED, 268 SCTP_ADDR_REMOVED,
262 SCTP_ADDR_ADDED, 269 SCTP_ADDR_ADDED,
263 SCTP_ADDR_MADE_PRIM, 270 SCTP_ADDR_MADE_PRIM,
271 SCTP_ADDR_CONFIRMED,
264}; 272};
265 273
266 274
@@ -508,16 +516,17 @@ struct sctp_setadaptation {
508 * address's parameters: 516 * address's parameters:
509 */ 517 */
510enum sctp_spp_flags { 518enum sctp_spp_flags {
511 SPP_HB_ENABLE = 1, /*Enable heartbeats*/ 519 SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
512 SPP_HB_DISABLE = 2, /*Disable heartbeats*/ 520 SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
513 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, 521 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
514 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ 522 SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
515 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ 523 SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
516 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ 524 SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
517 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, 525 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
518 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ 526 SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
519 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ 527 SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
520 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, 528 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
529 SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
521}; 530};
522 531
523struct sctp_paddrparams { 532struct sctp_paddrparams {
@@ -530,7 +539,7 @@ struct sctp_paddrparams {
530 __u32 spp_flags; 539 __u32 spp_flags;
531} __attribute__((packed, aligned(4))); 540} __attribute__((packed, aligned(4)));
532 541
533/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) 542/* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
534 * 543 *
535 * This options will get or set the delayed ack timer. The time is set 544 * This options will get or set the delayed ack timer. The time is set
536 * in milliseconds. If the assoc_id is 0, then this sets or gets the 545 * in milliseconds. If the assoc_id is 0, then this sets or gets the
diff --git a/include/net/sock.h b/include/net/sock.h
index 2c7d60ca3548..25c37e34bfdc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -202,6 +202,15 @@ struct sock {
202 unsigned short sk_type; 202 unsigned short sk_type;
203 int sk_rcvbuf; 203 int sk_rcvbuf;
204 socket_lock_t sk_lock; 204 socket_lock_t sk_lock;
205 /*
206 * The backlog queue is special, it is always used with
207 * the per-socket spinlock held and requires low latency
208 * access. Therefore we special case it's implementation.
209 */
210 struct {
211 struct sk_buff *head;
212 struct sk_buff *tail;
213 } sk_backlog;
205 wait_queue_head_t *sk_sleep; 214 wait_queue_head_t *sk_sleep;
206 struct dst_entry *sk_dst_cache; 215 struct dst_entry *sk_dst_cache;
207 struct xfrm_policy *sk_policy[2]; 216 struct xfrm_policy *sk_policy[2];
@@ -221,15 +230,6 @@ struct sock {
221 int sk_rcvlowat; 230 int sk_rcvlowat;
222 unsigned long sk_flags; 231 unsigned long sk_flags;
223 unsigned long sk_lingertime; 232 unsigned long sk_lingertime;
224 /*
225 * The backlog queue is special, it is always used with
226 * the per-socket spinlock held and requires low latency
227 * access. Therefore we special case it's implementation.
228 */
229 struct {
230 struct sk_buff *head;
231 struct sk_buff *tail;
232 } sk_backlog;
233 struct sk_buff_head sk_error_queue; 233 struct sk_buff_head sk_error_queue;
234 struct proto *sk_prot_creator; 234 struct proto *sk_prot_creator;
235 rwlock_t sk_callback_lock; 235 rwlock_t sk_callback_lock;
@@ -244,7 +244,7 @@ struct sock {
244 struct sk_filter *sk_filter; 244 struct sk_filter *sk_filter;
245 void *sk_protinfo; 245 void *sk_protinfo;
246 struct timer_list sk_timer; 246 struct timer_list sk_timer;
247 struct timeval sk_stamp; 247 ktime_t sk_stamp;
248 struct socket *sk_socket; 248 struct socket *sk_socket;
249 void *sk_user_data; 249 void *sk_user_data;
250 struct page *sk_sndmsg_page; 250 struct page *sk_sndmsg_page;
@@ -390,6 +390,7 @@ enum sock_flags {
390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ 390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
391 SOCK_DBG, /* %SO_DEBUG setting */ 391 SOCK_DBG, /* %SO_DEBUG setting */
392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ 392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
393 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
393 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 394 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
394 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 395 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
395}; 396};
@@ -710,15 +711,6 @@ static inline void sk_stream_mem_reclaim(struct sock *sk)
710 __sk_stream_mem_reclaim(sk); 711 __sk_stream_mem_reclaim(sk);
711} 712}
712 713
713static inline void sk_stream_writequeue_purge(struct sock *sk)
714{
715 struct sk_buff *skb;
716
717 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
718 sk_stream_free_skb(sk, skb);
719 sk_stream_mem_reclaim(sk);
720}
721
722static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) 714static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
723{ 715{
724 return (int)skb->truesize <= sk->sk_forward_alloc || 716 return (int)skb->truesize <= sk->sk_forward_alloc ||
@@ -1083,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk)
1083 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1075 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1084} 1076}
1085 1077
1086static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1078extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1087{
1088 __sk_dst_set(sk, dst);
1089 sk->sk_route_caps = dst->dev->features;
1090 if (sk->sk_route_caps & NETIF_F_GSO)
1091 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1092 if (sk_can_gso(sk)) {
1093 if (dst->header_len)
1094 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1095 else
1096 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1097 }
1098}
1099 1079
1100static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1080static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
1101{ 1081{
@@ -1256,18 +1236,6 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1256 return page; 1236 return page;
1257} 1237}
1258 1238
1259#define sk_stream_for_retrans_queue(skb, sk) \
1260 for (skb = (sk)->sk_write_queue.next; \
1261 (skb != (sk)->sk_send_head) && \
1262 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1263 skb = skb->next)
1264
1265/*from STCP for fast SACK Process*/
1266#define sk_stream_for_retrans_queue_from(skb, sk) \
1267 for (; (skb != (sk)->sk_send_head) && \
1268 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1269 skb = skb->next)
1270
1271/* 1239/*
1272 * Default write policy as shown to user space via poll/select/SIGIO 1240 * Default write policy as shown to user space via poll/select/SIGIO
1273 */ 1241 */
@@ -1304,22 +1272,18 @@ static inline int sock_intr_errno(long timeo)
1304 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 1272 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
1305} 1273}
1306 1274
1275extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
1276 struct sk_buff *skb);
1277
1307static __inline__ void 1278static __inline__ void
1308sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1279sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1309{ 1280{
1310 struct timeval stamp; 1281 ktime_t kt = skb->tstamp;
1311 1282
1312 skb_get_timestamp(skb, &stamp); 1283 if (sock_flag(sk, SOCK_RCVTSTAMP))
1313 if (sock_flag(sk, SOCK_RCVTSTAMP)) { 1284 __sock_recv_timestamp(msg, sk, skb);
1314 /* Race occurred between timestamp enabling and packet 1285 else
1315 receiving. Fill in the current time for now. */ 1286 sk->sk_stamp = kt;
1316 if (stamp.tv_sec == 0)
1317 do_gettimeofday(&stamp);
1318 skb_set_timestamp(skb, &stamp);
1319 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval),
1320 &stamp);
1321 } else
1322 sk->sk_stamp = stamp;
1323} 1287}
1324 1288
1325/** 1289/**
@@ -1350,18 +1314,17 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1350 1314
1351extern void sock_enable_timestamp(struct sock *sk); 1315extern void sock_enable_timestamp(struct sock *sk);
1352extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1316extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1317extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1353 1318
1354/* 1319/*
1355 * Enable debug/info messages 1320 * Enable debug/info messages
1356 */ 1321 */
1322extern int net_msg_warn;
1323#define NETDEBUG(fmt, args...) \
1324 do { if (net_msg_warn) printk(fmt,##args); } while (0)
1357 1325
1358#ifdef CONFIG_NETDEBUG 1326#define LIMIT_NETDEBUG(fmt, args...) \
1359#define NETDEBUG(fmt, args...) printk(fmt,##args) 1327 do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
1360#define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0)
1361#else
1362#define NETDEBUG(fmt, args...) do { } while (0)
1363#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
1364#endif
1365 1328
1366/* 1329/*
1367 * Macros for sleeping on a socket. Use them like this: 1330 * Macros for sleeping on a socket. Use them like this:
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5c472f255b77..a385797f160a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -220,6 +220,7 @@ extern int sysctl_tcp_app_win;
220extern int sysctl_tcp_adv_win_scale; 220extern int sysctl_tcp_adv_win_scale;
221extern int sysctl_tcp_tw_reuse; 221extern int sysctl_tcp_tw_reuse;
222extern int sysctl_tcp_frto; 222extern int sysctl_tcp_frto;
223extern int sysctl_tcp_frto_response;
223extern int sysctl_tcp_low_latency; 224extern int sysctl_tcp_low_latency;
224extern int sysctl_tcp_dma_copybreak; 225extern int sysctl_tcp_dma_copybreak;
225extern int sysctl_tcp_nometrics_save; 226extern int sysctl_tcp_nometrics_save;
@@ -230,6 +231,7 @@ extern int sysctl_tcp_mtu_probing;
230extern int sysctl_tcp_base_mss; 231extern int sysctl_tcp_base_mss;
231extern int sysctl_tcp_workaround_signed_windows; 232extern int sysctl_tcp_workaround_signed_windows;
232extern int sysctl_tcp_slow_start_after_idle; 233extern int sysctl_tcp_slow_start_after_idle;
234extern int sysctl_tcp_max_ssthresh;
233 235
234extern atomic_t tcp_memory_allocated; 236extern atomic_t tcp_memory_allocated;
235extern atomic_t tcp_sockets_allocated; 237extern atomic_t tcp_sockets_allocated;
@@ -341,6 +343,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
341extern int tcp_child_process(struct sock *parent, 343extern int tcp_child_process(struct sock *parent,
342 struct sock *child, 344 struct sock *child,
343 struct sk_buff *skb); 345 struct sk_buff *skb);
346extern int tcp_use_frto(struct sock *sk);
344extern void tcp_enter_frto(struct sock *sk); 347extern void tcp_enter_frto(struct sock *sk);
345extern void tcp_enter_loss(struct sock *sk, int how); 348extern void tcp_enter_loss(struct sock *sk, int how);
346extern void tcp_clear_retrans(struct tcp_sock *tp); 349extern void tcp_clear_retrans(struct tcp_sock *tp);
@@ -417,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
417 420
418/* tcp_output.c */ 421/* tcp_output.c */
419 422
420extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, 423extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
421 unsigned int cur_mss, int nonagle); 424 int nonagle);
422extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); 425extern int tcp_may_send_now(struct sock *sk);
423extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 426extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
424extern void tcp_xmit_retransmit_queue(struct sock *); 427extern void tcp_xmit_retransmit_queue(struct sock *);
425extern void tcp_simple_retransmit(struct sock *); 428extern void tcp_simple_retransmit(struct sock *);
@@ -476,8 +479,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp)
476 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 479 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
477} 480}
478 481
479static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) 482static inline void tcp_fast_path_check(struct sock *sk)
480{ 483{
484 struct tcp_sock *tp = tcp_sk(sk);
485
481 if (skb_queue_empty(&tp->out_of_order_queue) && 486 if (skb_queue_empty(&tp->out_of_order_queue) &&
482 tp->rcv_wnd && 487 tp->rcv_wnd &&
483 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && 488 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
@@ -588,10 +593,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count,
588 } 593 }
589} 594}
590 595
591static inline void tcp_packets_out_inc(struct sock *sk, 596static inline void tcp_packets_out_inc(struct sock *sk,
592 struct tcp_sock *tp,
593 const struct sk_buff *skb) 597 const struct sk_buff *skb)
594{ 598{
599 struct tcp_sock *tp = tcp_sk(sk);
595 int orig = tp->packets_out; 600 int orig = tp->packets_out;
596 601
597 tp->packets_out += tcp_skb_pcount(skb); 602 tp->packets_out += tcp_skb_pcount(skb);
@@ -624,9 +629,12 @@ enum tcp_ca_event {
624#define TCP_CA_MAX 128 629#define TCP_CA_MAX 128
625#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 630#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
626 631
632#define TCP_CONG_NON_RESTRICTED 0x1
633#define TCP_CONG_RTT_STAMP 0x2
634
627struct tcp_congestion_ops { 635struct tcp_congestion_ops {
628 struct list_head list; 636 struct list_head list;
629 int non_restricted; 637 unsigned long flags;
630 638
631 /* initialize private data (optional) */ 639 /* initialize private data (optional) */
632 void (*init)(struct sock *sk); 640 void (*init)(struct sock *sk);
@@ -640,8 +648,6 @@ struct tcp_congestion_ops {
640 /* do new cwnd calculation (required) */ 648 /* do new cwnd calculation (required) */
641 void (*cong_avoid)(struct sock *sk, u32 ack, 649 void (*cong_avoid)(struct sock *sk, u32 ack,
642 u32 rtt, u32 in_flight, int good_ack); 650 u32 rtt, u32 in_flight, int good_ack);
643 /* round trip time sample per acked packet (optional) */
644 void (*rtt_sample)(struct sock *sk, u32 usrtt);
645 /* call before changing ca_state (optional) */ 651 /* call before changing ca_state (optional) */
646 void (*set_state)(struct sock *sk, u8 new_state); 652 void (*set_state)(struct sock *sk, u8 new_state);
647 /* call when cwnd event occurs (optional) */ 653 /* call when cwnd event occurs (optional) */
@@ -649,7 +655,7 @@ struct tcp_congestion_ops {
649 /* new value of cwnd after loss (optional) */ 655 /* new value of cwnd after loss (optional) */
650 u32 (*undo_cwnd)(struct sock *sk); 656 u32 (*undo_cwnd)(struct sock *sk);
651 /* hook for packet ack accounting (optional) */ 657 /* hook for packet ack accounting (optional) */
652 void (*pkts_acked)(struct sock *sk, u32 num_acked); 658 void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last);
653 /* get info for inet_diag (optional) */ 659 /* get info for inet_diag (optional) */
654 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 660 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
655 661
@@ -736,7 +742,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
736 tp->left_out = tp->sacked_out + tp->lost_out; 742 tp->left_out = tp->sacked_out + tp->lost_out;
737} 743}
738 744
739extern void tcp_enter_cwr(struct sock *sk); 745extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
740extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 746extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
741 747
742/* Slow start with delack produces 3 packets of burst, so that 748/* Slow start with delack produces 3 packets of burst, so that
@@ -775,18 +781,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
775 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 781 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
776} 782}
777 783
778static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 784static inline void tcp_check_probe_timer(struct sock *sk)
779{ 785{
786 struct tcp_sock *tp = tcp_sk(sk);
780 const struct inet_connection_sock *icsk = inet_csk(sk); 787 const struct inet_connection_sock *icsk = inet_csk(sk);
788
781 if (!tp->packets_out && !icsk->icsk_pending) 789 if (!tp->packets_out && !icsk->icsk_pending)
782 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, 790 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
783 icsk->icsk_rto, TCP_RTO_MAX); 791 icsk->icsk_rto, TCP_RTO_MAX);
784} 792}
785 793
786static inline void tcp_push_pending_frames(struct sock *sk, 794static inline void tcp_push_pending_frames(struct sock *sk)
787 struct tcp_sock *tp)
788{ 795{
789 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 796 struct tcp_sock *tp = tcp_sk(sk);
797
798 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle);
790} 799}
791 800
792static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 801static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
@@ -815,7 +824,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
815 824
816static inline int tcp_checksum_complete(struct sk_buff *skb) 825static inline int tcp_checksum_complete(struct sk_buff *skb)
817{ 826{
818 return skb->ip_summed != CHECKSUM_UNNECESSARY && 827 return !skb_csum_unnecessary(skb) &&
819 __tcp_checksum_complete(skb); 828 __tcp_checksum_complete(skb);
820} 829}
821 830
@@ -918,21 +927,7 @@ static inline void tcp_set_state(struct sock *sk, int state)
918#endif 927#endif
919} 928}
920 929
921static inline void tcp_done(struct sock *sk) 930extern void tcp_done(struct sock *sk);
922{
923 if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
924 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
925
926 tcp_set_state(sk, TCP_CLOSE);
927 tcp_clear_xmit_timers(sk);
928
929 sk->sk_shutdown = SHUTDOWN_MASK;
930
931 if (!sock_flag(sk, SOCK_DEAD))
932 sk->sk_state_change(sk);
933 else
934 inet_csk_destroy_sock(sk);
935}
936 931
937static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 932static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
938{ 933{
@@ -981,7 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
981 ireq->wscale_ok = rx_opt->wscale_ok; 976 ireq->wscale_ok = rx_opt->wscale_ok;
982 ireq->acked = 0; 977 ireq->acked = 0;
983 ireq->ecn_ok = 0; 978 ireq->ecn_ok = 0;
984 ireq->rmt_port = skb->h.th->source; 979 ireq->rmt_port = tcp_hdr(skb)->source;
985} 980}
986 981
987extern void tcp_enter_memory_pressure(void); 982extern void tcp_enter_memory_pressure(void);
@@ -1011,7 +1006,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1011{ 1006{
1012 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1007 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
1013 return 0; 1008 return 0;
1014 if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1009 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
1015 return 0; 1010 return 0;
1016 1011
1017 /* RST segments are not recommended to carry timestamp, 1012 /* RST segments are not recommended to carry timestamp,
@@ -1026,26 +1021,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1026 1021
1027 However, we can relax time bounds for RST segments to MSL. 1022 However, we can relax time bounds for RST segments to MSL.
1028 */ 1023 */
1029 if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1024 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1030 return 0; 1025 return 0;
1031 return 1; 1026 return 1;
1032} 1027}
1033 1028
1034#define TCP_CHECK_TIMER(sk) do { } while (0) 1029#define TCP_CHECK_TIMER(sk) do { } while (0)
1035 1030
1036static inline int tcp_use_frto(const struct sock *sk)
1037{
1038 const struct tcp_sock *tp = tcp_sk(sk);
1039
1040 /* F-RTO must be activated in sysctl and there must be some
1041 * unsent new data, and the advertised window should allow
1042 * sending it.
1043 */
1044 return (sysctl_tcp_frto && sk->sk_send_head &&
1045 !after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
1046 tp->snd_una + tp->snd_wnd));
1047}
1048
1049static inline void tcp_mib_init(void) 1031static inline void tcp_mib_init(void)
1050{ 1032{
1051 /* See RFC 2012 */ 1033 /* See RFC 2012 */
@@ -1172,6 +1154,120 @@ static inline void tcp_put_md5sig_pool(void)
1172 put_cpu(); 1154 put_cpu();
1173} 1155}
1174 1156
1157/* write queue abstraction */
1158static inline void tcp_write_queue_purge(struct sock *sk)
1159{
1160 struct sk_buff *skb;
1161
1162 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
1163 sk_stream_free_skb(sk, skb);
1164 sk_stream_mem_reclaim(sk);
1165}
1166
1167static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
1168{
1169 struct sk_buff *skb = sk->sk_write_queue.next;
1170 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1171 return NULL;
1172 return skb;
1173}
1174
1175static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk)
1176{
1177 struct sk_buff *skb = sk->sk_write_queue.prev;
1178 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1179 return NULL;
1180 return skb;
1181}
1182
1183static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb)
1184{
1185 return skb->next;
1186}
1187
1188#define tcp_for_write_queue(skb, sk) \
1189 for (skb = (sk)->sk_write_queue.next; \
1190 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1191 skb = skb->next)
1192
1193#define tcp_for_write_queue_from(skb, sk) \
1194 for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\
1195 skb = skb->next)
1196
1197static inline struct sk_buff *tcp_send_head(struct sock *sk)
1198{
1199 return sk->sk_send_head;
1200}
1201
1202static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
1203{
1204 sk->sk_send_head = skb->next;
1205 if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
1206 sk->sk_send_head = NULL;
1207}
1208
1209static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
1210{
1211 if (sk->sk_send_head == skb_unlinked)
1212 sk->sk_send_head = NULL;
1213}
1214
1215static inline void tcp_init_send_head(struct sock *sk)
1216{
1217 sk->sk_send_head = NULL;
1218}
1219
1220static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1221{
1222 __skb_queue_tail(&sk->sk_write_queue, skb);
1223}
1224
1225static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1226{
1227 __tcp_add_write_queue_tail(sk, skb);
1228
1229 /* Queue it, remembering where we must start sending. */
1230 if (sk->sk_send_head == NULL)
1231 sk->sk_send_head = skb;
1232}
1233
1234static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb)
1235{
1236 __skb_queue_head(&sk->sk_write_queue, skb);
1237}
1238
1239/* Insert buff after skb on the write queue of sk. */
1240static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1241 struct sk_buff *buff,
1242 struct sock *sk)
1243{
1244 __skb_append(skb, buff, &sk->sk_write_queue);
1245}
1246
1247/* Insert skb between prev and next on the write queue of sk. */
1248static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1249 struct sk_buff *skb,
1250 struct sock *sk)
1251{
1252 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
1253}
1254
1255static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1256{
1257 __skb_unlink(skb, &sk->sk_write_queue);
1258}
1259
1260static inline int tcp_skb_is_last(const struct sock *sk,
1261 const struct sk_buff *skb)
1262{
1263 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1264}
1265
1266static inline int tcp_write_queue_empty(struct sock *sk)
1267{
1268 return skb_queue_empty(&sk->sk_write_queue);
1269}
1270
1175/* /proc */ 1271/* /proc */
1176enum tcp_seq_states { 1272enum tcp_seq_states {
1177 TCP_SEQ_STATE_LISTENING, 1273 TCP_SEQ_STATE_LISTENING,
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index 4629d77173f2..89eb3e05116d 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(struct tcp_sock *tp,
27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; 27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE;
28} 28}
29 29
30static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, 30static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb)
31 struct sk_buff *skb)
32{ 31{
32 struct tcp_sock *tp = tcp_sk(sk);
33
33 tp->ecn_flags = 0; 34 tp->ecn_flags = 0;
34 if (sysctl_tcp_ecn) { 35 if (sysctl_tcp_ecn) {
35 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; 36 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
@@ -44,9 +45,11 @@ TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th)
44 th->ece = 1; 45 th->ece = 1;
45} 46}
46 47
47static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, 48static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb,
48 struct sk_buff *skb, int tcp_header_len) 49 int tcp_header_len)
49{ 50{
51 struct tcp_sock *tp = tcp_sk(sk);
52
50 if (tp->ecn_flags & TCP_ECN_OK) { 53 if (tp->ecn_flags & TCP_ECN_OK) {
51 /* Not-retransmitted data segment: set ECT and inject CWR. */ 54 /* Not-retransmitted data segment: set ECT and inject CWR. */
52 if (skb->len != tcp_header_len && 55 if (skb->len != tcp_header_len &&
@@ -54,7 +57,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
54 INET_ECN_xmit(sk); 57 INET_ECN_xmit(sk);
55 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { 58 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) {
56 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; 59 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
57 skb->h.th->cwr = 1; 60 tcp_hdr(skb)->cwr = 1;
58 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; 61 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
59 } 62 }
60 } else { 63 } else {
@@ -62,7 +65,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
62 INET_ECN_dontxmit(sk); 65 INET_ECN_dontxmit(sk);
63 } 66 }
64 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) 67 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR)
65 skb->h.th->ece = 1; 68 tcp_hdr(skb)->ece = 1;
66 } 69 }
67} 70}
68 71
@@ -70,7 +73,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
70 73
71static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) 74static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb)
72{ 75{
73 if (skb->h.th->cwr) 76 if (tcp_hdr(skb)->cwr)
74 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; 77 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
75} 78}
76 79
diff --git a/include/net/udp.h b/include/net/udp.h
index 1b921fa81474..98755ebaf163 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -72,15 +72,12 @@ struct sk_buff;
72 */ 72 */
73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) 73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
74{ 74{
75 if (! UDP_SKB_CB(skb)->partial_cov) 75 return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov);
76 return __skb_checksum_complete(skb);
77 return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
78 skb->csum));
79} 76}
80 77
81static inline int udp_lib_checksum_complete(struct sk_buff *skb) 78static inline int udp_lib_checksum_complete(struct sk_buff *skb)
82{ 79{
83 return skb->ip_summed != CHECKSUM_UNNECESSARY && 80 return !skb_csum_unnecessary(skb) &&
84 __udp_lib_checksum_complete(skb); 81 __udp_lib_checksum_complete(skb);
85} 82}
86 83
@@ -92,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb)
92 */ 89 */
93static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) 90static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
94{ 91{
95 __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); 92 __wsum csum = csum_partial(skb_transport_header(skb),
96 93 sizeof(struct udphdr), 0);
97 skb_queue_walk(&sk->sk_write_queue, skb) { 94 skb_queue_walk(&sk->sk_write_queue, skb) {
98 csum = csum_add(csum, skb->csum); 95 csum = csum_add(csum, skb->csum);
99 } 96 }
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 67ac51424307..635b0eafca95 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
47 return 1; 47 return 1;
48 } 48 }
49 49
50 UDP_SKB_CB(skb)->partial_cov = 0;
51 cscov = ntohs(uh->len); 50 cscov = ntohs(uh->len);
52 51
53 if (cscov == 0) /* Indicates that full coverage is required. */ 52 if (cscov == 0) /* Indicates that full coverage is required. */
54 cscov = skb->len; 53 ;
55 else if (cscov < 8 || cscov > skb->len) { 54 else if (cscov < 8 || cscov > skb->len) {
56 /* 55 /*
57 * Coverage length violates RFC 3828: log and discard silently. 56 * Coverage length violates RFC 3828: log and discard silently.
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
60 cscov, skb->len); 59 cscov, skb->len);
61 return 1; 60 return 1;
62 61
63 } else if (cscov < skb->len) 62 } else if (cscov < skb->len) {
64 UDP_SKB_CB(skb)->partial_cov = 1; 63 UDP_SKB_CB(skb)->partial_cov = 1;
65 64 UDP_SKB_CB(skb)->cscov = cscov;
66 UDP_SKB_CB(skb)->cscov = cscov; 65 if (skb->ip_summed == CHECKSUM_COMPLETE)
67 66 skb->ip_summed = CHECKSUM_NONE;
68 /* 67 }
69 * There is no known NIC manufacturer supporting UDP-Lite yet,
70 * hence ip_summed is always (re-)set to CHECKSUM_NONE.
71 */
72 skb->ip_summed = CHECKSUM_NONE;
73 68
74 return 0; 69 return 0;
75} 70}
76 71
77static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh)
78{
79 int rc = udplite_checksum_init(skb, uh);
80
81 if (!rc)
82 skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr,
83 skb->nh.iph->daddr,
84 skb->len, IPPROTO_UDPLITE, 0);
85 return rc;
86}
87
88static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh)
89{
90 int rc = udplite_checksum_init(skb, uh);
91
92 if (!rc)
93 skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
94 &skb->nh.ipv6h->daddr,
95 skb->len, IPPROTO_UDPLITE, 0));
96 return rc;
97}
98
99static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) 72static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
100{ 73{
101 int cscov = up->len; 74 int cscov = up->len;
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
128 101
129static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
130{ 103{
131 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
132 __wsum csum = 0; 105 __wsum csum = 0;
133 106
134 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
135 108
136 skb_queue_walk(&sk->sk_write_queue, skb) { 109 skb_queue_walk(&sk->sk_write_queue, skb) {
137 off = skb->h.raw - skb->data; 110 const int off = skb_transport_offset(skb);
138 len = skb->len - off; 111 const int len = skb->len - off;
139 112
140 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); 113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
141 114
diff --git a/include/net/wext.h b/include/net/wext.h
new file mode 100644
index 000000000000..55741836a675
--- /dev/null
+++ b/include/net/wext.h
@@ -0,0 +1,24 @@
1#ifndef __NET_WEXT_H
2#define __NET_WEXT_H
3
4/*
5 * wireless extensions interface to the core code
6 */
7
8#ifdef CONFIG_WIRELESS_EXT
9extern int wext_proc_init(void);
10extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
11 void __user *arg);
12#else
13static inline int wext_proc_init()
14{
15 return 0;
16}
17static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
18 void __user *arg)
19{
20 return -EINVAL;
21}
22#endif
23
24#endif /* __NET_WEXT_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
new file mode 100644
index 000000000000..d30c4ba8fd99
--- /dev/null
+++ b/include/net/wireless.h
@@ -0,0 +1,139 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <net/cfg80211.h>
14
15/**
16 * struct wiphy - wireless hardware description
17 * @idx: the wiphy index assigned to this item
18 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
19 */
20struct wiphy {
21 /* assign these fields before you register the wiphy */
22
23 /* permanent MAC address */
24 u8 perm_addr[ETH_ALEN];
25
26 /* If multiple wiphys are registered and you're handed e.g.
27 * a regular netdev with assigned ieee80211_ptr, you won't
28 * know whether it points to a wiphy your driver has registered
29 * or not. Assign this to something global to your driver to
30 * help determine whether you own this wiphy or not. */
31 void *privid;
32
33 /* fields below are read-only, assigned by cfg80211 */
34
35 /* the item in /sys/class/ieee80211/ points to this,
36 * you need use set_wiphy_dev() (see below) */
37 struct device dev;
38
39 /* dir in debugfs: ieee80211/<wiphyname> */
40 struct dentry *debugfsdir;
41
42 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
43};
44
45/** struct wireless_dev - wireless per-netdev state
46 *
47 * This structure must be allocated by the driver/stack
48 * that uses the ieee80211_ptr field in struct net_device
49 * (this is intentional so it can be allocated along with
50 * the netdev.)
51 *
52 * @wiphy: pointer to hardware description
53 */
54struct wireless_dev {
55 struct wiphy *wiphy;
56
57 /* private to the generic wireless code */
58 struct list_head list;
59 struct net_device *netdev;
60};
61
62/**
63 * wiphy_priv - return priv from wiphy
64 */
65static inline void *wiphy_priv(struct wiphy *wiphy)
66{
67 BUG_ON(!wiphy);
68 return &wiphy->priv;
69}
70
71/**
72 * set_wiphy_dev - set device pointer for wiphy
73 */
74static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
75{
76 wiphy->dev.parent = dev;
77}
78
79/**
80 * wiphy_dev - get wiphy dev pointer
81 */
82static inline struct device *wiphy_dev(struct wiphy *wiphy)
83{
84 return wiphy->dev.parent;
85}
86
87/**
88 * wiphy_name - get wiphy name
89 */
90static inline char *wiphy_name(struct wiphy *wiphy)
91{
92 return wiphy->dev.bus_id;
93}
94
95/**
96 * wdev_priv - return wiphy priv from wireless_dev
97 */
98static inline void *wdev_priv(struct wireless_dev *wdev)
99{
100 BUG_ON(!wdev);
101 return wiphy_priv(wdev->wiphy);
102}
103
104/**
105 * wiphy_new - create a new wiphy for use with cfg80211
106 *
107 * create a new wiphy and associate the given operations with it.
108 * @sizeof_priv bytes are allocated for private use.
109 *
110 * the returned pointer must be assigned to each netdev's
111 * ieee80211_ptr for proper operation.
112 */
113struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
114
115/**
116 * wiphy_register - register a wiphy with cfg80211
117 *
118 * register the given wiphy
119 *
120 * Returns a non-negative wiphy index or a negative error code.
121 */
122extern int wiphy_register(struct wiphy *wiphy);
123
124/**
125 * wiphy_unregister - deregister a wiphy from cfg80211
126 *
127 * unregister a device with the given priv pointer.
128 * After this call, no more requests can be made with this priv
129 * pointer, but the call may sleep to wait for an outstanding
130 * request that is being handled.
131 */
132extern void wiphy_unregister(struct wiphy *wiphy);
133
134/**
135 * wiphy_free - free wiphy
136 */
137extern void wiphy_free(struct wiphy *wiphy);
138
139#endif /* __NET_WIRELESS_H */
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1d10c879f7e2..1415bcf93980 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -7,8 +7,8 @@
7 7
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9{ 9{
10 skb->mac.raw = skb->data;
11 skb->dev = dev; 10 skb->dev = dev;
11 skb_reset_mac_header(skb);
12 skb->pkt_type = PACKET_HOST; 12 skb->pkt_type = PACKET_HOST;
13 13
14 return htons(ETH_P_X25); 14 return htons(ETH_P_X25);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5a00aa85b756..8287081d77f2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -279,7 +279,7 @@ struct xfrm_type
279 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); 279 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *);
280 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); 280 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *);
281 /* Estimate maximal size of result of transformation of a dgram */ 281 /* Estimate maximal size of result of transformation of a dgram */
282 u32 (*get_max_size)(struct xfrm_state *, int size); 282 u32 (*get_mtu)(struct xfrm_state *, int size);
283}; 283};
284 284
285extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 285extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
@@ -416,6 +416,13 @@ struct xfrm_audit
416 u32 secid; 416 u32 secid;
417}; 417};
418 418
419/* SAD metadata, add more later */
420struct xfrm_sadinfo
421{
422 u32 sadhcnt; /* current hash bkts */
423 u32 sadhmcnt; /* max allowed hash bkts */
424 u32 sadcnt; /* current running count */
425};
419#ifdef CONFIG_AUDITSYSCALL 426#ifdef CONFIG_AUDITSYSCALL
420extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, 427extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
421 struct xfrm_policy *xp, struct xfrm_state *x); 428 struct xfrm_policy *xp, struct xfrm_state *x);
@@ -938,6 +945,7 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
938extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 945extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
939extern int xfrm_state_delete(struct xfrm_state *x); 946extern int xfrm_state_delete(struct xfrm_state *x);
940extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 947extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
948extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si);
941extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 949extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
942extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 950extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
943extern void xfrm_replay_notify(struct xfrm_state *x, int event); 951extern void xfrm_replay_notify(struct xfrm_state *x, int event);
diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h
deleted file mode 100644
index b86f83743510..000000000000
--- a/include/rxrpc/call.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/* call.h: Rx call record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CALL_H
13#define _LINUX_RXRPC_CALL_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/rxrpc.h>
17#include <rxrpc/packet.h>
18#include <linux/timer.h>
19
20#define RXRPC_CALL_ACK_WINDOW_SIZE 16
21
22extern unsigned rxrpc_call_rcv_timeout; /* receive activity timeout (secs) */
23
24/* application call state
25 * - only state 0 and ffff are reserved, the state is set to 1 after an opid is received
26 */
27enum rxrpc_app_cstate {
28 RXRPC_CSTATE_COMPLETE = 0, /* operation complete */
29 RXRPC_CSTATE_ERROR, /* operation ICMP error or aborted */
30 RXRPC_CSTATE_SRVR_RCV_OPID, /* [SERVER] receiving operation ID */
31 RXRPC_CSTATE_SRVR_RCV_ARGS, /* [SERVER] receiving operation data */
32 RXRPC_CSTATE_SRVR_GOT_ARGS, /* [SERVER] completely received operation data */
33 RXRPC_CSTATE_SRVR_SND_REPLY, /* [SERVER] sending operation reply */
34 RXRPC_CSTATE_SRVR_RCV_FINAL_ACK, /* [SERVER] receiving final ACK */
35 RXRPC_CSTATE_CLNT_SND_ARGS, /* [CLIENT] sending operation args */
36 RXRPC_CSTATE_CLNT_RCV_REPLY, /* [CLIENT] receiving operation reply */
37 RXRPC_CSTATE_CLNT_GOT_REPLY, /* [CLIENT] completely received operation reply */
38} __attribute__((packed));
39
40extern const char *rxrpc_call_states[];
41
42enum rxrpc_app_estate {
43 RXRPC_ESTATE_NO_ERROR = 0, /* no error */
44 RXRPC_ESTATE_LOCAL_ABORT, /* aborted locally by application layer */
45 RXRPC_ESTATE_PEER_ABORT, /* aborted remotely by peer */
46 RXRPC_ESTATE_LOCAL_ERROR, /* local ICMP network error */
47 RXRPC_ESTATE_REMOTE_ERROR, /* remote ICMP network error */
48} __attribute__((packed));
49
50extern const char *rxrpc_call_error_states[];
51
52/*****************************************************************************/
53/*
54 * Rx call record and application scratch buffer
55 * - the call record occupies the bottom of a complete page
56 * - the application scratch buffer occupies the rest
57 */
58struct rxrpc_call
59{
60 atomic_t usage;
61 struct rxrpc_connection *conn; /* connection upon which active */
62 spinlock_t lock; /* access lock */
63 struct module *owner; /* owner module */
64 wait_queue_head_t waitq; /* wait queue for events to happen */
65 struct list_head link; /* general internal list link */
66 struct list_head call_link; /* master call list link */
67 __be32 chan_ix; /* connection channel index */
68 __be32 call_id; /* call ID on connection */
69 unsigned long cjif; /* jiffies at call creation */
70 unsigned long flags; /* control flags */
71#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
72#define RXRPC_CALL_ACKR_TIMO 0x00000002 /* ACKR timeout reached */
73#define RXRPC_CALL_RCV_TIMO 0x00000004 /* RCV timeout reached */
74#define RXRPC_CALL_RCV_PKT 0x00000008 /* received packet */
75
76 /* transmission */
77 rxrpc_seq_t snd_seq_count; /* outgoing packet sequence number counter */
78 struct rxrpc_message *snd_nextmsg; /* next message being constructed for sending */
79 struct rxrpc_message *snd_ping; /* last ping message sent */
80 unsigned short snd_resend_cnt; /* count of resends since last ACK */
81
82 /* transmission ACK tracking */
83 struct list_head acks_pendq; /* messages pending ACK (ordered by seq) */
84 unsigned acks_pend_cnt; /* number of un-ACK'd packets */
85 rxrpc_seq_t acks_dftv_seq; /* highest definitively ACK'd msg seq */
86 struct timer_list acks_timeout; /* timeout on expected ACK */
87
88 /* reception */
89 struct list_head rcv_receiveq; /* messages pending reception (ordered by seq) */
90 struct list_head rcv_krxiodq_lk; /* krxiod queue for new inbound packets */
91 struct timer_list rcv_timeout; /* call receive activity timeout */
92
93 /* reception ACK'ing */
94 rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */
95 rxrpc_seq_t ackr_win_top; /* top of ACK window */
96 rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */
97 rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */
98 unsigned ackr_pend_cnt; /* number of pending ACKs */
99 struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */
100 char ackr_dfr_perm; /* request for deferred ACKs permitted */
101 rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */
102 struct rxrpc_ackpacket ackr; /* pending normal ACK packet */
103 uint8_t ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */
104
105 /* presentation layer */
106 char app_last_rcv; /* T if received last packet from remote end */
107 enum rxrpc_app_cstate app_call_state; /* call state */
108 enum rxrpc_app_estate app_err_state; /* abort/error state */
109 struct list_head app_readyq; /* ordered ready received packet queue */
110 struct list_head app_unreadyq; /* ordered post-hole recv'd packet queue */
111 rxrpc_seq_t app_ready_seq; /* last seq number dropped into readyq */
112 size_t app_ready_qty; /* amount of data ready in readyq */
113 unsigned app_opcode; /* operation ID */
114 unsigned app_abort_code; /* abort code (when aborted) */
115 int app_errno; /* error number (when ICMP error received) */
116
117 /* statisics */
118 unsigned pkt_rcv_count; /* count of received packets on this call */
119 unsigned pkt_snd_count; /* count of sent packets on this call */
120 unsigned app_read_count; /* number of reads issued */
121
122 /* bits for the application to use */
123 rxrpc_call_attn_func_t app_attn_func; /* callback when attention required */
124 rxrpc_call_error_func_t app_error_func; /* callback when abort sent (cleanup and put) */
125 rxrpc_call_aemap_func_t app_aemap_func; /* callback to map abort code to/from errno */
126 void *app_user; /* application data */
127 struct list_head app_link; /* application list linkage */
128 struct list_head app_attn_link; /* application attention list linkage */
129 size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */
130 char app_async_read; /* T if in async-read mode */
131 uint8_t *app_read_buf; /* application async read buffer (app_mark size) */
132 uint8_t *app_scr_alloc; /* application scratch allocation pointer */
133 void *app_scr_ptr; /* application pointer into scratch buffer */
134
135#define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */
136
137 /* application scratch buffer */
138 uint8_t app_scratch[0] __attribute__((aligned(sizeof(long))));
139};
140
141#define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call))
142
143#define rxrpc_call_reset_scratch(CALL) \
144do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0)
145
146#define rxrpc_call_alloc_scratch(CALL,SIZE) \
147({ \
148 void *ptr; \
149 ptr = (CALL)->app_scr_alloc; \
150 (CALL)->app_scr_alloc += (SIZE); \
151 if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \
152 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
153 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE)); \
154 BUG(); \
155 } \
156 ptr; \
157})
158
159#define rxrpc_call_alloc_scratch_s(CALL,TYPE) \
160({ \
161 size_t size = sizeof(TYPE); \
162 TYPE *ptr; \
163 ptr = (TYPE*)(CALL)->app_scr_alloc; \
164 (CALL)->app_scr_alloc += size; \
165 if (size>RXRPC_CALL_SCRATCH_SIZE || \
166 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
167 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size); \
168 BUG(); \
169 } \
170 ptr; \
171})
172
173#define rxrpc_call_is_ack_pending(CALL) ((CALL)->ackr.reason != 0)
174
175extern int rxrpc_create_call(struct rxrpc_connection *conn,
176 rxrpc_call_attn_func_t attn,
177 rxrpc_call_error_func_t error,
178 rxrpc_call_aemap_func_t aemap,
179 struct rxrpc_call **_call);
180
181extern int rxrpc_incoming_call(struct rxrpc_connection *conn,
182 struct rxrpc_message *msg,
183 struct rxrpc_call **_call);
184
185static inline void rxrpc_get_call(struct rxrpc_call *call)
186{
187 BUG_ON(atomic_read(&call->usage)<=0);
188 atomic_inc(&call->usage);
189 /*printk("rxrpc_get_call(%p{u=%d})\n",(C),atomic_read(&(C)->usage));*/
190}
191
192extern void rxrpc_put_call(struct rxrpc_call *call);
193
194extern void rxrpc_call_do_stuff(struct rxrpc_call *call);
195
196extern int rxrpc_call_abort(struct rxrpc_call *call, int error);
197
198#define RXRPC_CALL_READ_BLOCK 0x0001 /* block if not enough data and not yet EOF */
199#define RXRPC_CALL_READ_ALL 0x0002 /* error if insufficient data received */
200extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int flags);
201
202extern int rxrpc_call_write_data(struct rxrpc_call *call,
203 size_t sioc,
204 struct kvec *siov,
205 uint8_t rxhdr_flags,
206 gfp_t alloc_flags,
207 int dup_data,
208 size_t *size_sent);
209
210extern void rxrpc_call_handle_error(struct rxrpc_call *conn, int local, int errno);
211
212#endif /* _LINUX_RXRPC_CALL_H */
diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h
deleted file mode 100644
index 41e6781ad067..000000000000
--- a/include/rxrpc/connection.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* connection.h: Rx connection record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CONNECTION_H
13#define _LINUX_RXRPC_CONNECTION_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxtimod.h>
17
18struct sk_buff;
19
20/*****************************************************************************/
21/*
22 * Rx connection
23 * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag)
24 * - connections only retain a refcount on the peer when they are active
25 * - connections with refcount==0 are inactive and reside in the peer's graveyard
26 */
27struct rxrpc_connection
28{
29 atomic_t usage;
30 struct rxrpc_transport *trans; /* transport endpoint */
31 struct rxrpc_peer *peer; /* peer from/to which connected */
32 struct rxrpc_service *service; /* responsible service (inbound conns) */
33 struct rxrpc_timer timeout; /* decaching timer */
34 struct list_head link; /* link in peer's list */
35 struct list_head proc_link; /* link in proc list */
36 struct list_head err_link; /* link in ICMP error processing list */
37 struct list_head id_link; /* link in ID grant list */
38 struct sockaddr_in addr; /* remote address */
39 struct rxrpc_call *channels[4]; /* channels (active calls) */
40 wait_queue_head_t chanwait; /* wait for channel to become available */
41 spinlock_t lock; /* access lock */
42 struct timeval atime; /* last access time */
43 size_t mtu_size; /* MTU size for outbound messages */
44 unsigned call_counter; /* call ID counter */
45 rxrpc_serial_t serial_counter; /* packet serial number counter */
46
47 /* the following should all be in net order */
48 __be32 in_epoch; /* peer's epoch */
49 __be32 out_epoch; /* my epoch */
50 __be32 conn_id; /* connection ID, appropriately shifted */
51 __be16 service_id; /* service ID */
52 uint8_t security_ix; /* security ID */
53 uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
54 uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
55};
56
57extern int rxrpc_create_connection(struct rxrpc_transport *trans,
58 __be16 port,
59 __be32 addr,
60 uint16_t service_id,
61 void *security,
62 struct rxrpc_connection **_conn);
63
64extern int rxrpc_connection_lookup(struct rxrpc_peer *peer,
65 struct rxrpc_message *msg,
66 struct rxrpc_connection **_conn);
67
68static inline void rxrpc_get_connection(struct rxrpc_connection *conn)
69{
70 BUG_ON(atomic_read(&conn->usage)<0);
71 atomic_inc(&conn->usage);
72 //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage));
73}
74
75extern void rxrpc_put_connection(struct rxrpc_connection *conn);
76
77extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
78 struct rxrpc_call *call,
79 struct rxrpc_message *msg);
80
81extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno);
82
83#endif /* _LINUX_RXRPC_CONNECTION_H */
diff --git a/include/rxrpc/krxiod.h b/include/rxrpc/krxiod.h
deleted file mode 100644
index c0e0e82e4df2..000000000000
--- a/include/rxrpc/krxiod.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* krxiod.h: Rx RPC I/O kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXIOD_H
13#define _LINUX_RXRPC_KRXIOD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxiod_init(void);
18extern void rxrpc_krxiod_kill(void);
19extern void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans);
21extern void rxrpc_krxiod_queue_peer(struct rxrpc_peer *peer);
22extern void rxrpc_krxiod_dequeue_peer(struct rxrpc_peer *peer);
23extern void rxrpc_krxiod_clear_peers(struct rxrpc_transport *trans);
24extern void rxrpc_krxiod_queue_call(struct rxrpc_call *call);
25extern void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call);
26
27#endif /* _LINUX_RXRPC_KRXIOD_H */
diff --git a/include/rxrpc/krxsecd.h b/include/rxrpc/krxsecd.h
deleted file mode 100644
index 55ce43a25b38..000000000000
--- a/include/rxrpc/krxsecd.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* krxsecd.h: Rx RPC security kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXSECD_H
13#define _LINUX_RXRPC_KRXSECD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxsecd_init(void);
18extern void rxrpc_krxsecd_kill(void);
19extern void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg);
21
22#endif /* _LINUX_RXRPC_KRXSECD_H */
diff --git a/include/rxrpc/krxtimod.h b/include/rxrpc/krxtimod.h
deleted file mode 100644
index b3d298b612f2..000000000000
--- a/include/rxrpc/krxtimod.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* krxtimod.h: RxRPC timeout daemon
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXTIMOD_H
13#define _LINUX_RXRPC_KRXTIMOD_H
14
15#include <rxrpc/types.h>
16
17struct rxrpc_timer_ops {
18 /* called when the front of the timer queue has timed out */
19 void (*timed_out)(struct rxrpc_timer *timer);
20};
21
22/*****************************************************************************/
23/*
24 * RXRPC timer/timeout record
25 */
26struct rxrpc_timer
27{
28 struct list_head link; /* link in timer queue */
29 unsigned long timo_jif; /* timeout time */
30 const struct rxrpc_timer_ops *ops; /* timeout expiry function */
31};
32
33static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops)
34{
35 INIT_LIST_HEAD(&timer->link);
36 timer->ops = ops;
37}
38
39extern int rxrpc_krxtimod_start(void);
40extern void rxrpc_krxtimod_kill(void);
41
42extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout);
43extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer);
44
45#endif /* _LINUX_RXRPC_KRXTIMOD_H */
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h
deleted file mode 100644
index b318f273d4f2..000000000000
--- a/include/rxrpc/message.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* message.h: Rx message caching
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_MESSAGE_H
13#define _LINUX_RXRPC_MESSAGE_H
14
15#include <rxrpc/packet.h>
16
17/*****************************************************************************/
18/*
19 * Rx message record
20 */
21struct rxrpc_message
22{
23 atomic_t usage;
24 struct list_head link; /* list link */
25 struct timeval stamp; /* time received or last sent */
26 rxrpc_seq_t seq; /* message sequence number */
27
28 int state; /* the state the message is currently in */
29#define RXRPC_MSG_PREPARED 0
30#define RXRPC_MSG_SENT 1
31#define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */
32#define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */
33#define RXRPC_MSG_RECEIVED 4
34#define RXRPC_MSG_ERROR -1
35 char rttdone; /* used for RTT */
36
37 struct rxrpc_transport *trans; /* transport received through */
38 struct rxrpc_connection *conn; /* connection received over */
39 struct sk_buff *pkt; /* received packet */
40 off_t offset; /* offset into pkt of next byte of data */
41
42 struct rxrpc_header hdr; /* message header */
43
44 int dcount; /* data part count */
45 size_t dsize; /* data size */
46#define RXRPC_MSG_MAX_IOCS 8
47 struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */
48 unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */
49};
50
51#define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0)
52
53extern void __rxrpc_put_message(struct rxrpc_message *msg);
54static inline void rxrpc_put_message(struct rxrpc_message *msg)
55{
56 BUG_ON(atomic_read(&msg->usage)<=0);
57 if (atomic_dec_and_test(&msg->usage))
58 __rxrpc_put_message(msg);
59}
60
61extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
62 struct rxrpc_call *call,
63 uint8_t type,
64 int count,
65 struct kvec *diov,
66 gfp_t alloc_flags,
67 struct rxrpc_message **_msg);
68
69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
70
71#endif /* _LINUX_RXRPC_MESSAGE_H */
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index 1447f0aaa0eb..b69e6e173ea1 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -1,6 +1,6 @@
1/* packet.h: Rx packet layout and definitions 1/* packet.h: Rx packet layout and definitions
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,28 +12,25 @@
12#ifndef _LINUX_RXRPC_PACKET_H 12#ifndef _LINUX_RXRPC_PACKET_H
13#define _LINUX_RXRPC_PACKET_H 13#define _LINUX_RXRPC_PACKET_H
14 14
15#include <rxrpc/types.h> 15typedef u32 rxrpc_seq_t; /* Rx message sequence number */
16 16typedef u32 rxrpc_serial_t; /* Rx message serial number */
17#define RXRPC_IPUDP_SIZE 28 17typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
18extern size_t RXRPC_MAX_PACKET_SIZE; 18typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
19#define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header))
20#define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE
21#define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE)
22 19
23/*****************************************************************************/ 20/*****************************************************************************/
24/* 21/*
25 * on-the-wire Rx packet header 22 * on-the-wire Rx packet header
26 * - all multibyte fields should be in network byte order 23 * - all multibyte fields should be in network byte order
27 */ 24 */
28struct rxrpc_header 25struct rxrpc_header {
29{
30 __be32 epoch; /* client boot timestamp */ 26 __be32 epoch; /* client boot timestamp */
31 27
32 __be32 cid; /* connection and channel ID */ 28 __be32 cid; /* connection and channel ID */
33#define RXRPC_MAXCALLS 4 /* max active calls per conn */ 29#define RXRPC_MAXCALLS 4 /* max active calls per conn */
34#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ 30#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
35#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ 31#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
36#define RXRPC_CIDSHIFT 2 /* shift for connection ID */ 32#define RXRPC_CIDSHIFT ilog2(RXRPC_MAXCALLS) /* shift for connection ID */
33#define RXRPC_CID_INC (1 << RXRPC_CIDSHIFT) /* connection ID increment */
37 34
38 __be32 callNumber; /* call ID (0 for connection-level packets) */ 35 __be32 callNumber; /* call ID (0 for connection-level packets) */
39#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ 36#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
@@ -62,7 +59,10 @@ struct rxrpc_header
62 59
63 uint8_t userStatus; /* app-layer defined status */ 60 uint8_t userStatus; /* app-layer defined status */
64 uint8_t securityIndex; /* security protocol ID */ 61 uint8_t securityIndex; /* security protocol ID */
65 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 62 union {
63 __be16 _rsvd; /* reserved */
64 __be16 cksum; /* kerberos security checksum */
65 };
66 __be16 serviceId; /* service ID */ 66 __be16 serviceId; /* service ID */
67 67
68} __attribute__((packed)); 68} __attribute__((packed));
@@ -81,8 +81,7 @@ extern const char *rxrpc_pkts[];
81 * - new__rsvd = j__rsvd 81 * - new__rsvd = j__rsvd
82 * - duplicating all other fields 82 * - duplicating all other fields
83 */ 83 */
84struct rxrpc_jumbo_header 84struct rxrpc_jumbo_header {
85{
86 uint8_t flags; /* packet flags (as per rxrpc_header) */ 85 uint8_t flags; /* packet flags (as per rxrpc_header) */
87 uint8_t pad; 86 uint8_t pad;
88 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 87 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */
@@ -95,8 +94,7 @@ struct rxrpc_jumbo_header
95 * on-the-wire Rx ACK packet data payload 94 * on-the-wire Rx ACK packet data payload
96 * - all multibyte fields should be in network byte order 95 * - all multibyte fields should be in network byte order
97 */ 96 */
98struct rxrpc_ackpacket 97struct rxrpc_ackpacket {
99{
100 __be16 bufferSpace; /* number of packet buffers available */ 98 __be16 bufferSpace; /* number of packet buffers available */
101 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no 99 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no
102 * received */ 100 * received */
@@ -124,4 +122,93 @@ struct rxrpc_ackpacket
124 122
125} __attribute__((packed)); 123} __attribute__((packed));
126 124
125/*
126 * ACK packets can have a further piece of information tagged on the end
127 */
128struct rxrpc_ackinfo {
129 __be32 rxMTU; /* maximum Rx MTU size (bytes) [AFS 3.3] */
130 __be32 maxMTU; /* maximum interface MTU size (bytes) [AFS 3.3] */
131 __be32 rwind; /* Rx window size (packets) [AFS 3.4] */
132 __be32 jumbo_max; /* max packets to stick into a jumbo packet [AFS 3.5] */
133};
134
135/*****************************************************************************/
136/*
137 * Kerberos security type-2 challenge packet
138 */
139struct rxkad_challenge {
140 __be32 version; /* version of this challenge type */
141 __be32 nonce; /* encrypted random number */
142 __be32 min_level; /* minimum security level */
143 __be32 __padding; /* padding to 8-byte boundary */
144} __attribute__((packed));
145
146/*****************************************************************************/
147/*
148 * Kerberos security type-2 response packet
149 */
150struct rxkad_response {
151 __be32 version; /* version of this reponse type */
152 __be32 __pad;
153
154 /* encrypted bit of the response */
155 struct {
156 __be32 epoch; /* current epoch */
157 __be32 cid; /* parent connection ID */
158 __be32 checksum; /* checksum */
159 __be32 securityIndex; /* security type */
160 __be32 call_id[4]; /* encrypted call IDs */
161 __be32 inc_nonce; /* challenge nonce + 1 */
162 __be32 level; /* desired level */
163 } encrypted;
164
165 __be32 kvno; /* Kerberos key version number */
166 __be32 ticket_len; /* Kerberos ticket length */
167} __attribute__((packed));
168
169/*****************************************************************************/
170/*
171 * RxRPC-level abort codes
172 */
173#define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */
174#define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */
175#define RX_CALL_TIMEOUT -3 /* call timeout exceeded */
176#define RX_EOF -4 /* unexpected end of data on read op */
177#define RX_PROTOCOL_ERROR -5 /* low-level protocol error */
178#define RX_USER_ABORT -6 /* generic user abort */
179#define RX_ADDRINUSE -7 /* UDP port in use */
180#define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */
181
182/*
183 * (un)marshalling abort codes (rxgen)
184 */
185#define RXGEN_CC_MARSHAL -450
186#define RXGEN_CC_UNMARSHAL -451
187#define RXGEN_SS_MARSHAL -452
188#define RXGEN_SS_UNMARSHAL -453
189#define RXGEN_DECODE -454
190#define RXGEN_OPCODE -455
191#define RXGEN_SS_XDRFREE -456
192#define RXGEN_CC_XDRFREE -457
193
194/*
195 * Rx kerberos security abort codes
196 * - unfortunately we have no generalised security abort codes to say things
197 * like "unsupported security", so we have to use these instead and hope the
198 * other side understands
199 */
200#define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */
201#define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */
202#define RXKADLEVELFAIL 19270402 /* security level negotiation failed */
203#define RXKADTICKETLEN 19270403 /* ticket length too short or too long */
204#define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */
205#define RXKADNOAUTH 19270405 /* caller not authorised */
206#define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */
207#define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */
208#define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */
209#define RXKADEXPIRED 19270409 /* authentication expired */
210#define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */
211#define RXKADDATALEN 19270411 /* user data too long */
212#define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */
213
127#endif /* _LINUX_RXRPC_PACKET_H */ 214#endif /* _LINUX_RXRPC_PACKET_H */
diff --git a/include/rxrpc/peer.h b/include/rxrpc/peer.h
deleted file mode 100644
index 8b8fe97cbbcc..000000000000
--- a/include/rxrpc/peer.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* peer.h: Rx RPC per-transport peer record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_PEER_H
13#define _LINUX_RXRPC_PEER_H
14
15#include <linux/wait.h>
16#include <rxrpc/types.h>
17#include <rxrpc/krxtimod.h>
18
19struct rxrpc_peer_ops
20{
21 /* peer record being added */
22 int (*adding)(struct rxrpc_peer *peer);
23
24 /* peer record being discarded from graveyard */
25 void (*discarding)(struct rxrpc_peer *peer);
26
27 /* change of epoch detected on connection */
28 void (*change_of_epoch)(struct rxrpc_connection *conn);
29};
30
31/*****************************************************************************/
32/*
33 * Rx RPC per-transport peer record
34 * - peers only retain a refcount on the transport when they are active
35 * - peers with refcount==0 are inactive and reside in the transport's graveyard
36 */
37struct rxrpc_peer
38{
39 atomic_t usage;
40 struct rxrpc_peer_ops *ops; /* operations on this peer */
41 struct rxrpc_transport *trans; /* owner transport */
42 struct rxrpc_timer timeout; /* timeout for grave destruction */
43 struct list_head link; /* link in transport's peer list */
44 struct list_head proc_link; /* link in /proc list */
45 rwlock_t conn_idlock; /* lock for connection IDs */
46 struct list_head conn_idlist; /* list of connections granted IDs */
47 uint32_t conn_idcounter; /* connection ID counter */
48 rwlock_t conn_lock; /* lock for active/dead connections */
49 struct list_head conn_active; /* active connections to/from this peer */
50 struct list_head conn_graveyard; /* graveyard for inactive connections */
51 spinlock_t conn_gylock; /* lock for conn_graveyard */
52 wait_queue_head_t conn_gy_waitq; /* wait queue hit when graveyard is empty */
53 atomic_t conn_count; /* number of attached connections */
54 struct in_addr addr; /* remote address */
55 size_t if_mtu; /* interface MTU for this peer */
56 spinlock_t lock; /* access lock */
57
58 void *user; /* application layer data */
59
60 /* calculated RTT cache */
61#define RXRPC_RTT_CACHE_SIZE 32
62 suseconds_t rtt; /* current RTT estimate (in uS) */
63 unsigned rtt_point; /* next entry at which to insert */
64 unsigned rtt_usage; /* amount of cache actually used */
65 suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */
66};
67
68
69extern int rxrpc_peer_lookup(struct rxrpc_transport *trans,
70 __be32 addr,
71 struct rxrpc_peer **_peer);
72
73static inline void rxrpc_get_peer(struct rxrpc_peer *peer)
74{
75 BUG_ON(atomic_read(&peer->usage)<0);
76 atomic_inc(&peer->usage);
77 //printk("rxrpc_get_peer(%p{u=%d})\n",peer,atomic_read(&peer->usage));
78}
79
80extern void rxrpc_put_peer(struct rxrpc_peer *peer);
81
82#endif /* _LINUX_RXRPC_PEER_H */
diff --git a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h
deleted file mode 100644
index 8d9874cef991..000000000000
--- a/include/rxrpc/rxrpc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* rx.h: Rx RPC interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_RXRPC_H
13#define _LINUX_RXRPC_RXRPC_H
14
15#ifdef __KERNEL__
16
17extern __be32 rxrpc_epoch;
18
19#ifdef CONFIG_SYSCTL
20extern int rxrpc_ktrace;
21extern int rxrpc_kdebug;
22extern int rxrpc_kproto;
23extern int rxrpc_knet;
24#else
25#define rxrpc_ktrace 0
26#define rxrpc_kdebug 0
27#define rxrpc_kproto 0
28#define rxrpc_knet 0
29#endif
30
31extern int rxrpc_sysctl_init(void);
32extern void rxrpc_sysctl_cleanup(void);
33
34#endif /* __KERNEL__ */
35
36#endif /* _LINUX_RXRPC_RXRPC_H */
diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h
deleted file mode 100644
index 7c7b9683fa39..000000000000
--- a/include/rxrpc/transport.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/* transport.h: Rx transport management
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_TRANSPORT_H
13#define _LINUX_RXRPC_TRANSPORT_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxiod.h>
17#include <rxrpc/rxrpc.h>
18#include <linux/skbuff.h>
19#include <linux/rwsem.h>
20
21typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call);
22
23extern wait_queue_head_t rxrpc_krxiod_wq;
24
25/*****************************************************************************/
26/*
27 * Rx operation specification
28 * - tables of these must be sorted by op ID so that they can be binary-chop searched
29 */
30struct rxrpc_operation
31{
32 unsigned id; /* operation ID */
33 size_t asize; /* minimum size of argument block */
34 const char *name; /* name of operation */
35 void *user; /* initial user data */
36};
37
38/*****************************************************************************/
39/*
40 * Rx transport service record
41 */
42struct rxrpc_service
43{
44 struct list_head link; /* link in services list on transport */
45 struct module *owner; /* owner module */
46 rxrpc_newcall_fnx_t new_call; /* new call handler function */
47 const char *name; /* name of service */
48 unsigned short service_id; /* Rx service ID */
49 rxrpc_call_attn_func_t attn_func; /* call requires attention callback */
50 rxrpc_call_error_func_t error_func; /* call error callback */
51 rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */
52
53 const struct rxrpc_operation *ops_begin; /* beginning of operations table */
54 const struct rxrpc_operation *ops_end; /* end of operations table */
55};
56
57/*****************************************************************************/
58/*
59 * Rx transport endpoint record
60 */
61struct rxrpc_transport
62{
63 atomic_t usage;
64 struct socket *socket; /* my UDP socket */
65 struct list_head services; /* services listening on this socket */
66 struct list_head link; /* link in transport list */
67 struct list_head proc_link; /* link in transport proc list */
68 struct list_head krxiodq_link; /* krxiod attention queue link */
69 spinlock_t lock; /* access lock */
70 struct list_head peer_active; /* active peers connected to over this socket */
71 struct list_head peer_graveyard; /* inactive peer list */
72 spinlock_t peer_gylock; /* peer graveyard lock */
73 wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */
74 rwlock_t peer_lock; /* peer list access lock */
75 atomic_t peer_count; /* number of peers */
76 struct rxrpc_peer_ops *peer_ops; /* default peer operations */
77 unsigned short port; /* port upon which listening */
78 volatile char error_rcvd; /* T if received ICMP error outstanding */
79};
80
81extern int rxrpc_create_transport(unsigned short port,
82 struct rxrpc_transport **_trans);
83
84static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
85{
86 BUG_ON(atomic_read(&trans->usage) <= 0);
87 atomic_inc(&trans->usage);
88 //printk("rxrpc_get_transport(%p{u=%d})\n",
89 // trans, atomic_read(&trans->usage));
90}
91
92extern void rxrpc_put_transport(struct rxrpc_transport *trans);
93
94extern int rxrpc_add_service(struct rxrpc_transport *trans,
95 struct rxrpc_service *srv);
96
97extern void rxrpc_del_service(struct rxrpc_transport *trans,
98 struct rxrpc_service *srv);
99
100extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
101
102extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
103 struct rxrpc_message *msg,
104 int error);
105
106#endif /* _LINUX_RXRPC_TRANSPORT_H */