aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-05 09:37:56 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-05 09:37:56 -0500
commit4c1ac1b49122b805adfa4efc620592f68dccf5db (patch)
tree87557f4bc2fd4fe65b7570489c2f610c45c0adcd /include
parentc4028958b6ecad064b1a6303a6a5906d4fe48d73 (diff)
parentd916faace3efc0bf19fe9a615a1ab8fa1a24cd93 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/infiniband/core/iwcm.c drivers/net/chelsio/cxgb2.c drivers/net/wireless/bcm43xx/bcm43xx_main.c drivers/net/wireless/prism54/islpci_eth.c drivers/usb/core/hub.h drivers/usb/input/hid-core.c net/core/netpoll.c Fix up merge failures with Linus's head and fix new compilation failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/asm-alpha/checksum.h34
-rw-r--r--include/asm-alpha/device.h7
-rw-r--r--include/asm-arm/arch-ebsa110/io.h16
-rw-r--r--include/asm-arm/arch-pxa/udc.h17
-rw-r--r--include/asm-arm/checksum.h83
-rw-r--r--include/asm-arm/device.h7
-rw-r--r--include/asm-arm/dma-mapping.h4
-rw-r--r--include/asm-arm/mach/udc_pxa2xx.h26
-rw-r--r--include/asm-arm26/checksum.h63
-rw-r--r--include/asm-arm26/device.h7
-rw-r--r--include/asm-avr32/checksum.h40
-rw-r--r--include/asm-avr32/device.h7
-rw-r--r--include/asm-cris/arch-v10/checksum.h10
-rw-r--r--include/asm-cris/arch-v32/checksum.h10
-rw-r--r--include/asm-cris/checksum.h34
-rw-r--r--include/asm-cris/device.h7
-rw-r--r--include/asm-frv/checksum.h41
-rw-r--r--include/asm-frv/device.h7
-rw-r--r--include/asm-generic/device.h12
-rw-r--r--include/asm-h8300/checksum.h31
-rw-r--r--include/asm-h8300/device.h7
-rw-r--r--include/asm-i386/checksum.h65
-rw-r--r--include/asm-i386/device.h15
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h4
-rw-r--r--include/asm-ia64/checksum.h31
-rw-r--r--include/asm-ia64/device.h15
-rw-r--r--include/asm-ia64/io.h2
-rw-r--r--include/asm-ia64/machvec.h12
-rw-r--r--include/asm-ia64/machvec_sn2.h2
-rw-r--r--include/asm-ia64/pci.h21
-rw-r--r--include/asm-ia64/sn/acpi.h16
-rw-r--r--include/asm-ia64/sn/pcidev.h22
-rw-r--r--include/asm-ia64/sn/sn_feature_sets.h6
-rw-r--r--include/asm-ia64/sn/sn_sal.h1
-rw-r--r--include/asm-m32r/checksum.h52
-rw-r--r--include/asm-m32r/device.h7
-rw-r--r--include/asm-m68k/checksum.h46
-rw-r--r--include/asm-m68k/device.h7
-rw-r--r--include/asm-m68knommu/checksum.h46
-rw-r--r--include/asm-m68knommu/device.h7
-rw-r--r--include/asm-m68knommu/mcfmbus.h2
-rw-r--r--include/asm-mips/addrspace.h40
-rw-r--r--include/asm-mips/atomic.h10
-rw-r--r--include/asm-mips/bitops.h65
-rw-r--r--include/asm-mips/bug.h12
-rw-r--r--include/asm-mips/checksum.h55
-rw-r--r--include/asm-mips/cpu-info.h10
-rw-r--r--include/asm-mips/dec/kn02.h2
-rw-r--r--include/asm-mips/device.h7
-rw-r--r--include/asm-mips/dma.h2
-rw-r--r--include/asm-mips/gt64120.h14
-rw-r--r--include/asm-mips/io.h2
-rw-r--r--include/asm-mips/irq.h8
-rw-r--r--include/asm-mips/kexec.h32
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h6
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h29
-rw-r--r--include/asm-mips/mach-cobalt/mach-gt64120.h28
-rw-r--r--include/asm-mips/mipsregs.h56
-rw-r--r--include/asm-mips/page.h16
-rw-r--r--include/asm-mips/pgtable-64.h13
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/ptrace.h2
-rw-r--r--include/asm-mips/time.h9
-rw-r--r--include/asm-parisc/checksum.h55
-rw-r--r--include/asm-parisc/device.h7
-rw-r--r--include/asm-parisc/dma.h6
-rw-r--r--include/asm-parisc/pci.h2
-rw-r--r--include/asm-parisc/ropes.h2
-rw-r--r--include/asm-parisc/semaphore.h6
-rw-r--r--include/asm-powerpc/checksum.h59
-rw-r--r--include/asm-powerpc/device.h7
-rw-r--r--include/asm-powerpc/pci.h20
-rw-r--r--include/asm-ppc/device.h7
-rw-r--r--include/asm-s390/checksum.h45
-rw-r--r--include/asm-s390/device.h7
-rw-r--r--include/asm-sh/checksum.h59
-rw-r--r--include/asm-sh/device.h7
-rw-r--r--include/asm-sh64/checksum.h41
-rw-r--r--include/asm-sh64/device.h7
-rw-r--r--include/asm-sparc/checksum.h103
-rw-r--r--include/asm-sparc/device.h7
-rw-r--r--include/asm-sparc64/checksum.h77
-rw-r--r--include/asm-sparc64/device.h7
-rw-r--r--include/asm-sparc64/pci.h6
-rw-r--r--include/asm-um/device.h7
-rw-r--r--include/asm-v850/checksum.h38
-rw-r--r--include/asm-v850/device.h7
-rw-r--r--include/asm-x86_64/checksum.h54
-rw-r--r--include/asm-x86_64/device.h15
-rw-r--r--include/asm-xtensa/checksum.h64
-rw-r--r--include/asm-xtensa/device.h7
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/atmarp.h2
-rw-r--r--include/linux/atmbr2684.h4
-rw-r--r--include/linux/atmmpc.h16
-rw-r--r--include/linux/blkdev.h7
-rw-r--r--include/linux/blktrace_api.h12
-rw-r--r--include/linux/dccp.h63
-rw-r--r--include/linux/device.h35
-rw-r--r--include/linux/divert.h132
-rw-r--r--include/linux/elevator.h4
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/fib_rules.h3
-rw-r--r--include/linux/ftape-header-segment.h122
-rw-r--r--include/linux/ftape-vendors.h137
-rw-r--r--include/linux/ftape.h201
-rw-r--r--include/linux/icmp.h2
-rw-r--r--include/linux/icmpv6.h12
-rw-r--r--include/linux/if_packet.h6
-rw-r--r--include/linux/if_tunnel.h8
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h4
-rw-r--r--include/linux/inet.h4
-rw-r--r--include/linux/inetdevice.h14
-rw-r--r--include/linux/ioport.h1
-rw-r--r--include/linux/ip.h2
-rw-r--r--include/linux/ip6_tunnel.h2
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/ixjuser.h2
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/kobject.h8
-rw-r--r--include/linux/miscdevice.h5
-rw-r--r--include/linux/mmc/card.h13
-rw-r--r--include/linux/mmc/host.h8
-rw-r--r--include/linux/mmc/protocol.h74
-rw-r--r--include/linux/module.h1
-rw-r--r--include/linux/mqueue.h2
-rw-r--r--include/linux/mv643xx.h4
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h18
-rw-r--r--include/linux/netfilter.h44
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/nf_conntrack_amanda.h10
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h20
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h92
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_asn1.h (renamed from include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h)10
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h (renamed from include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h)12
-rw-r--r--include/linux/netfilter/nf_conntrack_irc.h15
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h321
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h112
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h41
-rw-r--r--include/linux/netfilter/nf_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/nfnetlink_log.h12
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h19
-rw-r--r--include/linux/netfilter/xt_NFLOG.h18
-rw-r--r--include/linux/netfilter/xt_conntrack.h4
-rw-r--r--include/linux/netfilter/xt_hashlimit.h40
-rw-r--r--include/linux/netfilter/xt_policy.h2
-rw-r--r--include/linux/netfilter_bridge.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h14
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h8
-rw-r--r--include/linux/netfilter_bridge/ebt_nat.h1
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h25
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/Kbuild2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h4
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h34
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_hashlimit.h42
-rw-r--r--include/linux/netfilter_ipv6.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h15
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nsproxy.h4
-rw-r--r--include/linux/pci.h3
-rw-r--r--include/linux/pci_ids.h12
-rw-r--r--include/linux/pci_regs.h6
-rw-r--r--include/linux/pfkeyv2.h4
-rw-r--r--include/linux/phy.h30
-rw-r--r--include/linux/platform_device.h6
-rw-r--r--include/linux/random.h20
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sctp.h72
-rw-r--r--include/linux/security.h56
-rw-r--r--include/linux/skbuff.h26
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/spinlock.h14
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--include/linux/sysctl.h12
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/tcp.h190
-rw-r--r--include/linux/textsearch.h4
-rw-r--r--include/linux/tfrc.h20
-rw-r--r--include/linux/tipc_config.h32
-rw-r--r--include/linux/tty.h5
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/udp.h14
-rw-r--r--include/linux/usb.h181
-rw-r--r--include/linux/wireless.h2
-rw-r--r--include/linux/xfrm.h6
-rw-r--r--include/linux/zftape.h87
-rw-r--r--include/net/addrconf.h8
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/atmclip.h2
-rw-r--r--include/net/bluetooth/rfcomm.h4
-rw-r--r--include/net/checksum.h43
-rw-r--r--include/net/cipso_ipv4.h4
-rw-r--r--include/net/dsfield.h10
-rw-r--r--include/net/fib_rules.h10
-rw-r--r--include/net/flow.h9
-rw-r--r--include/net/genetlink.h54
-rw-r--r--include/net/ieee80211.h6
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet6_connection_sock.h4
-rw-r--r--include/net/inet6_hashtables.h16
-rw-r--r--include/net/inet_connection_sock.h7
-rw-r--r--include/net/inet_ecn.h10
-rw-r--r--include/net/ip.h21
-rw-r--r--include/net/ip6_checksum.h76
-rw-r--r--include/net/ip6_fib.h5
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_mp_alg.h4
-rw-r--r--include/net/ip_vs.h16
-rw-r--r--include/net/ipconfig.h8
-rw-r--r--include/net/ipip.h6
-rw-r--r--include/net/ipv6.h62
-rw-r--r--include/net/irda/irlap_frame.h16
-rw-r--r--include/net/llc_pdu.h10
-rw-r--r--include/net/ndisc.h4
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h29
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h25
-rw-r--r--include/net/netfilter/nf_conntrack.h171
-rw-r--r--include/net/netfilter/nf_conntrack_core.h16
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h95
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h80
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h22
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h15
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h (renamed from include/net/netfilter/nf_conntrack_protocol.h)49
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h34
-rw-r--r--include/net/netfilter/nf_nat.h77
-rw-r--r--include/net/netfilter/nf_nat_core.h27
-rw-r--r--include/net/netfilter/nf_nat_helper.h32
-rw-r--r--include/net/netfilter/nf_nat_protocol.h70
-rw-r--r--include/net/netfilter/nf_nat_rule.h35
-rw-r--r--include/net/netlabel.h123
-rw-r--r--include/net/netlink.h21
-rw-r--r--include/net/protocol.h4
-rw-r--r--include/net/rawv6.h2
-rw-r--r--include/net/request_sock.h12
-rw-r--r--include/net/sch_generic.h6
-rw-r--r--include/net/sctp/command.h4
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/sctp/structs.h21
-rw-r--r--include/net/sctp/tsnmap.h4
-rw-r--r--include/net/sock.h28
-rw-r--r--include/net/tcp.h159
-rw-r--r--include/net/timewait_sock.h3
-rw-r--r--include/net/tipc/tipc_bearer.h2
-rw-r--r--include/net/tipc/tipc_msg.h2
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h96
-rw-r--r--include/net/udplite.h151
-rw-r--r--include/net/xfrm.h66
-rw-r--r--include/rdma/ib_cm.h16
-rw-r--r--include/rdma/ib_user_cm.h7
-rw-r--r--include/scsi/libsas.h1
-rw-r--r--include/sound/core.h8
-rw-r--r--include/sound/version.h2
278 files changed, 4186 insertions, 2574 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f338e40bd544..fdd10953b2b6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -357,7 +357,7 @@ struct device *acpi_get_physical_device(acpi_handle);
357/* helper */ 357/* helper */
358acpi_handle acpi_get_child(acpi_handle, acpi_integer); 358acpi_handle acpi_get_child(acpi_handle, acpi_integer);
359acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 359acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
360#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) 360#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
361 361
362#endif /* CONFIG_ACPI */ 362#endif /* CONFIG_ACPI */
363 363
diff --git a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h
index a5c9f08447fb..d3854bbf0a9e 100644
--- a/include/asm-alpha/checksum.h
+++ b/include/asm-alpha/checksum.h
@@ -7,21 +7,20 @@
7 * This is a version of ip_compute_csum() optimized for IP headers, 7 * This is a version of ip_compute_csum() optimized for IP headers,
8 * which always checksum on 4 octet boundaries. 8 * which always checksum on 4 octet boundaries.
9 */ 9 */
10extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 10extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
11 11
12/* 12/*
13 * computes the checksum of the TCP/UDP pseudo-header 13 * computes the checksum of the TCP/UDP pseudo-header
14 * returns a 16-bit checksum, already complemented 14 * returns a 16-bit checksum, already complemented
15 */ 15 */
16extern unsigned short int csum_tcpudp_magic(unsigned long saddr, 16extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
17 unsigned long daddr,
18 unsigned short len, 17 unsigned short len,
19 unsigned short proto, 18 unsigned short proto,
20 unsigned int sum); 19 __wsum sum);
21 20
22unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 21__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
23 unsigned short len, unsigned short proto, 22 unsigned short len, unsigned short proto,
24 unsigned int sum); 23 __wsum sum);
25 24
26/* 25/*
27 * computes the checksum of a memory block at buff, length len, 26 * computes the checksum of a memory block at buff, length len,
@@ -35,7 +34,7 @@ unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
35 * 34 *
36 * it's best to have buff aligned on a 32-bit boundary 35 * it's best to have buff aligned on a 32-bit boundary
37 */ 36 */
38extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 37extern __wsum csum_partial(const void *buff, int len, __wsum sum);
39 38
40/* 39/*
41 * the same as csum_partial, but copies from src while it 40 * the same as csum_partial, but copies from src while it
@@ -44,9 +43,9 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
44 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
45 * better 64-bit) boundary 44 * better 64-bit) boundary
46 */ 45 */
47unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp); 46__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *errp);
48 47
49unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum); 48__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
50 49
51 50
52/* 51/*
@@ -54,24 +53,23 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsi
54 * in icmp.c 53 * in icmp.c
55 */ 54 */
56 55
57extern unsigned short ip_compute_csum(unsigned char * buff, int len); 56extern __sum16 ip_compute_csum(const void *buff, int len);
58 57
59/* 58/*
60 * Fold a partial checksum without adding pseudo headers 59 * Fold a partial checksum without adding pseudo headers
61 */ 60 */
62 61
63static inline unsigned short csum_fold(unsigned int sum) 62static inline __sum16 csum_fold(__wsum csum)
64{ 63{
64 u32 sum = (__force u32)csum;
65 sum = (sum & 0xffff) + (sum >> 16); 65 sum = (sum & 0xffff) + (sum >> 16);
66 sum = (sum & 0xffff) + (sum >> 16); 66 sum = (sum & 0xffff) + (sum >> 16);
67 return ~sum; 67 return (__force __sum16)~sum;
68} 68}
69 69
70#define _HAVE_ARCH_IPV6_CSUM 70#define _HAVE_ARCH_IPV6_CSUM
71extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 71extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
72 struct in6_addr *daddr, 72 const struct in6_addr *daddr,
73 __u32 len, 73 __u32 len, unsigned short proto,
74 unsigned short proto, 74 __wsum sum);
75 unsigned int sum);
76
77#endif 75#endif
diff --git a/include/asm-alpha/device.h b/include/asm-alpha/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-alpha/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h
index ae048441c9ed..722c5e086285 100644
--- a/include/asm-arm/arch-ebsa110/io.h
+++ b/include/asm-arm/arch-ebsa110/io.h
@@ -27,9 +27,9 @@ void __outw(u16 val, unsigned int port);
27u32 __inl(unsigned int port); 27u32 __inl(unsigned int port);
28void __outl(u32 val, unsigned int port); 28void __outl(u32 val, unsigned int port);
29 29
30u8 __readb(void __iomem *addr); 30u8 __readb(const volatile void __iomem *addr);
31u16 __readw(void __iomem *addr); 31u16 __readw(const volatile void __iomem *addr);
32u32 __readl(void __iomem *addr); 32u32 __readl(const volatile void __iomem *addr);
33 33
34void __writeb(u8 val, void __iomem *addr); 34void __writeb(u8 val, void __iomem *addr);
35void __writew(u16 val, void __iomem *addr); 35void __writew(u16 val, void __iomem *addr);
@@ -64,8 +64,14 @@ void __writel(u32 val, void __iomem *addr);
64#define writew(v,b) __writew(v,b) 64#define writew(v,b) __writew(v,b)
65#define writel(v,b) __writel(v,b) 65#define writel(v,b) __writel(v,b)
66 66
67#define __arch_ioremap(cookie,sz,c) ((void __iomem *)(cookie)) 67static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size,
68#define __arch_iounmap(cookie) do { } while (0) 68 unsigned int flags)
69{
70 return (void __iomem *)cookie;
71}
72
73#define __arch_ioremap __arch_ioremap
74#define __arch_iounmap(cookie) do { } while (0)
69 75
70extern void insb(unsigned int port, void *buf, int sz); 76extern void insb(unsigned int port, void *buf, int sz);
71extern void insw(unsigned int port, void *buf, int sz); 77extern void insw(unsigned int port, void *buf, int sz);
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h
index 121cd241115d..646480d37256 100644
--- a/include/asm-arm/arch-pxa/udc.h
+++ b/include/asm-arm/arch-pxa/udc.h
@@ -4,23 +4,8 @@
4 * This supports machine-specific differences in how the PXA2xx 4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired. 5 * USB Device Controller (UDC) is wired.
6 * 6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c and used in
8 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
9 */ 7 */
10struct pxa2xx_udc_mach_info { 8#include <asm/mach/udc_pxa2xx.h>
11 int (*udc_is_connected)(void); /* do we see host? */
12 void (*udc_command)(int cmd);
13#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
14#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
15
16 /* Boards following the design guidelines in the developer's manual,
17 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane
18 * VBUS IRQ and omit the methods above. Store the GPIO number
19 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
20 */
21 u16 gpio_vbus; /* high == vbus present */
22 u16 gpio_pullup; /* high == pullup activated */
23};
24 9
25extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 10extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
26 11
diff --git a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h
index 747bdd31a74b..8c0bb5bb14ee 100644
--- a/include/asm-arm/checksum.h
+++ b/include/asm-arm/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26__wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,26 +33,18 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36unsigned int 36__wsum
37csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum); 37csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
38 38
39unsigned int 39__wsum
40csum_partial_copy_from_user(const char __user *src, char *dst, int len, int sum, int *err_ptr); 40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41
42/*
43 * This is the old (and unsafe) way of doing checksums, a warning message will
44 * be printed if it is used and an exception occurs.
45 *
46 * this functions should go away after some time.
47 */
48#define csum_partial_copy(src,dst,len,sum) csum_partial_copy_nocheck(src,dst,len,sum)
49 41
50/* 42/*
51 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
52 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
53 */ 45 */
54static inline unsigned short 46static inline __sum16
55ip_fast_csum(unsigned char * iph, unsigned int ihl) 47ip_fast_csum(const void *iph, unsigned int ihl)
56{ 48{
57 unsigned int sum, tmp1; 49 unsigned int sum, tmp1;
58 50
@@ -78,14 +70,13 @@ ip_fast_csum(unsigned char * iph, unsigned int ihl)
78 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1) 70 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
79 : "1" (iph), "2" (ihl) 71 : "1" (iph), "2" (ihl)
80 : "cc", "memory"); 72 : "cc", "memory");
81 return sum; 73 return (__force __sum16)sum;
82} 74}
83 75
84/* 76/*
85 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
86 */ 78 */
87static inline unsigned int 79static inline __sum16 csum_fold(__wsum sum)
88csum_fold(unsigned int sum)
89{ 80{
90 __asm__( 81 __asm__(
91 "adds %0, %1, %1, lsl #16 @ csum_fold \n\ 82 "adds %0, %1, %1, lsl #16 @ csum_fold \n\
@@ -93,21 +84,25 @@ csum_fold(unsigned int sum)
93 : "=r" (sum) 84 : "=r" (sum)
94 : "r" (sum) 85 : "r" (sum)
95 : "cc"); 86 : "cc");
96 return (~sum) >> 16; 87 return (__force __sum16)(~(__force u32)sum >> 16);
97} 88}
98 89
99static inline unsigned int 90static inline __wsum
100csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 91csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
101 unsigned int proto, unsigned int sum) 92 unsigned short proto, __wsum sum)
102{ 93{
103 __asm__( 94 __asm__(
104 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 95 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\
105 adcs %0, %0, %3 \n\ 96 adcs %0, %0, %3 \n"
106 adcs %0, %0, %4 \n\ 97#ifdef __ARMEB__
107 adcs %0, %0, %5 \n\ 98 "adcs %0, %0, %4 \n"
99#else
100 "adcs %0, %0, %4, lsl #8 \n"
101#endif
102 "adcs %0, %0, %5 \n\
108 adc %0, %0, #0" 103 adc %0, %0, #0"
109 : "=&r"(sum) 104 : "=&r"(sum)
110 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 105 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
111 : "cc"); 106 : "cc");
112 return sum; 107 return sum;
113} 108}
@@ -115,23 +110,27 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
115 * computes the checksum of the TCP/UDP pseudo-header 110 * computes the checksum of the TCP/UDP pseudo-header
116 * returns a 16-bit checksum, already complemented 111 * returns a 16-bit checksum, already complemented
117 */ 112 */
118static inline unsigned short int 113static inline __sum16
119csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 114csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
120 unsigned int proto, unsigned int sum) 115 unsigned short proto, __wsum sum)
121{ 116{
122 __asm__( 117 __asm__(
123 "adds %0, %1, %2 @ csum_tcpudp_magic \n\ 118 "adds %0, %1, %2 @ csum_tcpudp_magic \n\
124 adcs %0, %0, %3 \n\ 119 adcs %0, %0, %3 \n"
125 adcs %0, %0, %4 \n\ 120#ifdef __ARMEB__
126 adcs %0, %0, %5 \n\ 121 "adcs %0, %0, %4 \n"
122#else
123 "adcs %0, %0, %4, lsl #8 \n"
124#endif
125 "adcs %0, %0, %5 \n\
127 adc %0, %0, #0 \n\ 126 adc %0, %0, #0 \n\
128 adds %0, %0, %0, lsl #16 \n\ 127 adds %0, %0, %0, lsl #16 \n\
129 addcs %0, %0, #0x10000 \n\ 128 addcs %0, %0, #0x10000 \n\
130 mvn %0, %0" 129 mvn %0, %0"
131 : "=&r"(sum) 130 : "=&r"(sum)
132 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 131 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
133 : "cc"); 132 : "cc");
134 return sum >> 16; 133 return (__force __sum16)((__force u32)sum >> 16);
135} 134}
136 135
137 136
@@ -139,20 +138,20 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
139 * this routine is used for miscellaneous IP-like checksums, mainly 138 * this routine is used for miscellaneous IP-like checksums, mainly
140 * in icmp.c 139 * in icmp.c
141 */ 140 */
142static inline unsigned short 141static inline __sum16
143ip_compute_csum(unsigned char * buff, int len) 142ip_compute_csum(const void *buff, int len)
144{ 143{
145 return csum_fold(csum_partial(buff, len, 0)); 144 return csum_fold(csum_partial(buff, len, 0));
146} 145}
147 146
148#define _HAVE_ARCH_IPV6_CSUM 147#define _HAVE_ARCH_IPV6_CSUM
149extern unsigned long 148extern __wsum
150__csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 149__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
151 __u32 proto, unsigned int sum); 150 __be32 proto, __wsum sum);
152 151
153static inline unsigned short int 152static inline __sum16
154csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 153csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
155 unsigned short proto, unsigned int sum) 154 unsigned short proto, __wsum sum)
156{ 155{
157 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len), 156 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
158 htonl(proto), sum)); 157 htonl(proto), sum));
diff --git a/include/asm-arm/device.h b/include/asm-arm/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-arm/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 55eb4dc3253d..666617711c81 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -12,6 +12,10 @@
12 * uncached, unwrite-buffered mapped memory space for use with DMA 12 * uncached, unwrite-buffered mapped memory space for use with DMA
13 * devices. This is the "generic" version. The PCI specific version 13 * devices. This is the "generic" version. The PCI specific version
14 * is in pci.h 14 * is in pci.h
15 *
16 * Note: Drivers should NOT use this function directly, as it will break
17 * platforms with CONFIG_DMABOUNCE.
18 * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
15 */ 19 */
16extern void consistent_sync(void *kaddr, size_t size, int rw); 20extern void consistent_sync(void *kaddr, size_t size, int rw);
17 21
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h
new file mode 100644
index 000000000000..ff0a95715a07
--- /dev/null
+++ b/include/asm-arm/mach/udc_pxa2xx.h
@@ -0,0 +1,26 @@
1/*
2 * linux/include/asm-arm/mach/udc_pxa2xx.h
3 *
4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired.
6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
8 * linux/arch/mach-ixp4xx/<machine>.c and used in
9 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
10 */
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
22 */
23 u16 gpio_vbus; /* high == vbus present */
24 u16 gpio_pullup; /* high == pullup activated */
25};
26
diff --git a/include/asm-arm26/checksum.h b/include/asm-arm26/checksum.h
index d4256d5f3a7c..f2b4b0a403bd 100644
--- a/include/asm-arm26/checksum.h
+++ b/include/asm-arm26/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26__wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,26 +33,18 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36unsigned int 36__wsum
37csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum); 37csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
38 38
39unsigned int 39__wsum
40csum_partial_copy_from_user(const char __user *src, char *dst, int len, int sum, int *err_ptr); 40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41
42/*
43 * This is the old (and unsafe) way of doing checksums, a warning message will
44 * be printed if it is used and an exception occurs.
45 *
46 * this functions should go away after some time.
47 */
48#define csum_partial_copy(src,dst,len,sum) csum_partial_copy_nocheck(src,dst,len,sum)
49 41
50/* 42/*
51 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
52 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
53 */ 45 */
54static inline unsigned short 46static inline __sum16
55ip_fast_csum(unsigned char * iph, unsigned int ihl) 47ip_fast_csum(const void *iph, unsigned int ihl)
56{ 48{
57 unsigned int sum, tmp1; 49 unsigned int sum, tmp1;
58 50
@@ -78,14 +70,13 @@ ip_fast_csum(unsigned char * iph, unsigned int ihl)
78 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1) 70 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
79 : "1" (iph), "2" (ihl) 71 : "1" (iph), "2" (ihl)
80 : "cc"); 72 : "cc");
81 return sum; 73 return (__force __sum16)sum;
82} 74}
83 75
84/* 76/*
85 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
86 */ 78 */
87static inline unsigned int 79static inline __sum16 csum_fold(__wsum sum)
88csum_fold(unsigned int sum)
89{ 80{
90 __asm__( 81 __asm__(
91 "adds %0, %1, %1, lsl #16 @ csum_fold \n\ 82 "adds %0, %1, %1, lsl #16 @ csum_fold \n\
@@ -93,12 +84,12 @@ csum_fold(unsigned int sum)
93 : "=r" (sum) 84 : "=r" (sum)
94 : "r" (sum) 85 : "r" (sum)
95 : "cc"); 86 : "cc");
96 return (~sum) >> 16; 87 return (__force __sum16)(~(__force u32)sum >> 16);
97} 88}
98 89
99static inline unsigned int 90static inline __wsum
100csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 91csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
101 unsigned int proto, unsigned int sum) 92 unsigned short proto, __wsum sum)
102{ 93{
103 __asm__( 94 __asm__(
104 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 95 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\
@@ -107,7 +98,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
107 adcs %0, %0, %5 \n\ 98 adcs %0, %0, %5 \n\
108 adc %0, %0, #0" 99 adc %0, %0, #0"
109 : "=&r"(sum) 100 : "=&r"(sum)
110 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
111 : "cc"); 102 : "cc");
112 return sum; 103 return sum;
113} 104}
@@ -115,9 +106,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
115 * computes the checksum of the TCP/UDP pseudo-header 106 * computes the checksum of the TCP/UDP pseudo-header
116 * returns a 16-bit checksum, already complemented 107 * returns a 16-bit checksum, already complemented
117 */ 108 */
118static inline unsigned short int 109static inline __sum16
119csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 110csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
120 unsigned int proto, unsigned int sum) 111 unsigned short proto, __wsum sum)
121{ 112{
122 __asm__( 113 __asm__(
123 "adds %0, %1, %2 @ csum_tcpudp_magic \n\ 114 "adds %0, %1, %2 @ csum_tcpudp_magic \n\
@@ -129,9 +120,9 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
129 addcs %0, %0, #0x10000 \n\ 120 addcs %0, %0, #0x10000 \n\
130 mvn %0, %0" 121 mvn %0, %0"
131 : "=&r"(sum) 122 : "=&r"(sum)
132 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 123 : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
133 : "cc"); 124 : "cc");
134 return sum >> 16; 125 return (__force __sum16)((__force u32)sum >> 16);
135} 126}
136 127
137 128
@@ -139,20 +130,20 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
139 * this routine is used for miscellaneous IP-like checksums, mainly 130 * this routine is used for miscellaneous IP-like checksums, mainly
140 * in icmp.c 131 * in icmp.c
141 */ 132 */
142static inline unsigned short 133static inline __sum16
143ip_compute_csum(unsigned char * buff, int len) 134ip_compute_csum(const void *buff, int len)
144{ 135{
145 return csum_fold(csum_partial(buff, len, 0)); 136 return csum_fold(csum_partial(buff, len, 0));
146} 137}
147 138
148#define _HAVE_ARCH_IPV6_CSUM 139#define _HAVE_ARCH_IPV6_CSUM
149extern unsigned long 140extern __wsum
150__csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 141__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
151 __u32 proto, unsigned int sum); 142 __be32 proto, __wsum sum);
152 143
153static inline unsigned short int 144static inline __sum16
154csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 145csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
155 unsigned short proto, unsigned int sum) 146 unsigned short proto, __wsum sum)
156{ 147{
157 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len), 148 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
158 htonl(proto), sum)); 149 htonl(proto), sum));
diff --git a/include/asm-arm26/device.h b/include/asm-arm26/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-arm26/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-avr32/checksum.h b/include/asm-avr32/checksum.h
index 41b7af09edc4..af9d53f0f5d2 100644
--- a/include/asm-avr32/checksum.h
+++ b/include/asm-avr32/checksum.h
@@ -20,8 +20,7 @@
20 * 20 *
21 * it's best to have buff aligned on a 32-bit boundary 21 * it's best to have buff aligned on a 32-bit boundary
22 */ 22 */
23unsigned int csum_partial(const unsigned char * buff, int len, 23__wsum csum_partial(const void *buff, int len, __wsum sum);
24 unsigned int sum);
25 24
26/* 25/*
27 * the same as csum_partial, but copies from src while it 26 * the same as csum_partial, but copies from src while it
@@ -30,8 +29,8 @@ unsigned int csum_partial(const unsigned char * buff, int len,
30 * here even more important to align src and dst on a 32-bit (or even 29 * here even more important to align src and dst on a 32-bit (or even
31 * better 64-bit) boundary 30 * better 64-bit) boundary
32 */ 31 */
33unsigned int csum_partial_copy_generic(const char *src, char *dst, int len, 32__wsum csum_partial_copy_generic(const void *src, void *dst, int len,
34 int sum, int *src_err_ptr, 33 __wsum sum, int *src_err_ptr,
35 int *dst_err_ptr); 34 int *dst_err_ptr);
36 35
37/* 36/*
@@ -42,17 +41,17 @@ unsigned int csum_partial_copy_generic(const char *src, char *dst, int len,
42 * verify_area(). 41 * verify_area().
43 */ 42 */
44static inline 43static inline
45unsigned int csum_partial_copy_nocheck(const char *src, char *dst, 44__wsum csum_partial_copy_nocheck(const void *src, void *dst,
46 int len, int sum) 45 int len, __wsum sum)
47{ 46{
48 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); 47 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
49} 48}
50 49
51static inline 50static inline
52unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, 51__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
53 int len, int sum, int *err_ptr) 52 int len, __wsum sum, int *err_ptr)
54{ 53{
55 return csum_partial_copy_generic((const char __force *)src, dst, len, 54 return csum_partial_copy_generic((const void __force *)src, dst, len,
56 sum, err_ptr, NULL); 55 sum, err_ptr, NULL);
57} 56}
58 57
@@ -60,8 +59,7 @@ unsigned int csum_partial_copy_from_user (const char __user *src, char *dst,
60 * This is a version of ip_compute_csum() optimized for IP headers, 59 * This is a version of ip_compute_csum() optimized for IP headers,
61 * which always checksum on 4 octet boundaries. 60 * which always checksum on 4 octet boundaries.
62 */ 61 */
63static inline unsigned short ip_fast_csum(unsigned char *iph, 62static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
64 unsigned int ihl)
65{ 63{
66 unsigned int sum, tmp; 64 unsigned int sum, tmp;
67 65
@@ -90,14 +88,14 @@ static inline unsigned short ip_fast_csum(unsigned char *iph,
90 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp) 88 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp)
91 : "1"(iph), "2"(ihl) 89 : "1"(iph), "2"(ihl)
92 : "memory", "cc"); 90 : "memory", "cc");
93 return sum; 91 return (__force __sum16)sum;
94} 92}
95 93
96/* 94/*
97 * Fold a partial checksum 95 * Fold a partial checksum
98 */ 96 */
99 97
100static inline unsigned int csum_fold(unsigned int sum) 98static inline __sum16 csum_fold(__wsum sum)
101{ 99{
102 unsigned int tmp; 100 unsigned int tmp;
103 101
@@ -109,21 +107,20 @@ static inline unsigned int csum_fold(unsigned int sum)
109 : "=&r"(sum), "=&r"(tmp) 107 : "=&r"(sum), "=&r"(tmp)
110 : "0"(sum)); 108 : "0"(sum));
111 109
112 return ~sum; 110 return (__force __sum16)~sum;
113} 111}
114 112
115static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 113static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 unsigned long daddr,
117 unsigned short len, 114 unsigned short len,
118 unsigned short proto, 115 unsigned short proto,
119 unsigned int sum) 116 __wsum sum)
120{ 117{
121 asm(" add %0, %1\n" 118 asm(" add %0, %1\n"
122 " adc %0, %0, %2\n" 119 " adc %0, %0, %2\n"
123 " adc %0, %0, %3\n" 120 " adc %0, %0, %3\n"
124 " acr %0" 121 " acr %0"
125 : "=r"(sum) 122 : "=r"(sum)
126 : "r"(daddr), "r"(saddr), "r"(ntohs(len) | (proto << 16)), 123 : "r"(daddr), "r"(saddr), "r"(len + proto),
127 "0"(sum) 124 "0"(sum)
128 : "cc"); 125 : "cc");
129 126
@@ -134,11 +131,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
134 * computes the checksum of the TCP/UDP pseudo-header 131 * computes the checksum of the TCP/UDP pseudo-header
135 * returns a 16-bit checksum, already complemented 132 * returns a 16-bit checksum, already complemented
136 */ 133 */
137static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 134static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
138 unsigned long daddr,
139 unsigned short len, 135 unsigned short len,
140 unsigned short proto, 136 unsigned short proto,
141 unsigned int sum) 137 __wsum sum)
142{ 138{
143 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 139 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
144} 140}
@@ -148,7 +144,7 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
148 * in icmp.c 144 * in icmp.c
149 */ 145 */
150 146
151static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 147static inline __sum16 ip_compute_csum(const void *buff, int len)
152{ 148{
153 return csum_fold(csum_partial(buff, len, 0)); 149 return csum_fold(csum_partial(buff, len, 0));
154} 150}
diff --git a/include/asm-avr32/device.h b/include/asm-avr32/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-avr32/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-cris/arch-v10/checksum.h b/include/asm-cris/arch-v10/checksum.h
index 633f234f336b..b8000c5d7fe1 100644
--- a/include/asm-cris/arch-v10/checksum.h
+++ b/include/asm-cris/arch-v10/checksum.h
@@ -8,11 +8,11 @@
8 * to split all of those into 16-bit components, then add. 8 * to split all of those into 16-bit components, then add.
9 */ 9 */
10 10
11static inline unsigned int 11static inline __wsum
12csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 12csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
13 unsigned short proto, unsigned int sum) 13 unsigned short proto, __wsum sum)
14{ 14{
15 int res; 15 __wsum res;
16 __asm__ ("add.d %2, %0\n\t" 16 __asm__ ("add.d %2, %0\n\t"
17 "ax\n\t" 17 "ax\n\t"
18 "add.d %3, %0\n\t" 18 "add.d %3, %0\n\t"
@@ -21,7 +21,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
21 "ax\n\t" 21 "ax\n\t"
22 "addq 0, %0\n" 22 "addq 0, %0\n"
23 : "=r" (res) 23 : "=r" (res)
24 : "0" (sum), "r" (daddr), "r" (saddr), "r" ((ntohs(len) << 16) + (proto << 8))); 24 : "0" (sum), "r" (daddr), "r" (saddr), "r" ((len + proto) << 8));
25 25
26 return res; 26 return res;
27} 27}
diff --git a/include/asm-cris/arch-v32/checksum.h b/include/asm-cris/arch-v32/checksum.h
index 97ef89efea62..e5dcfce6e0dc 100644
--- a/include/asm-cris/arch-v32/checksum.h
+++ b/include/asm-cris/arch-v32/checksum.h
@@ -9,11 +9,11 @@
9 * checksum. Which means it would be necessary to split all those into 9 * checksum. Which means it would be necessary to split all those into
10 * 16-bit components and then add. 10 * 16-bit components and then add.
11 */ 11 */
12static inline unsigned int 12static inline __wsum
13csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 13csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
14 unsigned short len, unsigned short proto, unsigned int sum) 14 unsigned short len, unsigned short proto, __wsum sum)
15{ 15{
16 int res; 16 __wsum res;
17 17
18 __asm__ __volatile__ ("add.d %2, %0\n\t" 18 __asm__ __volatile__ ("add.d %2, %0\n\t"
19 "addc %3, %0\n\t" 19 "addc %3, %0\n\t"
@@ -21,7 +21,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
21 "addc 0, %0\n\t" 21 "addc 0, %0\n\t"
22 : "=r" (res) 22 : "=r" (res)
23 : "0" (sum), "r" (daddr), "r" (saddr), \ 23 : "0" (sum), "r" (daddr), "r" (saddr), \
24 "r" ((ntohs(len) << 16) + (proto << 8))); 24 "r" ((len + proto) << 8));
25 25
26 return res; 26 return res;
27} 27}
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h
index 26a7719bbb84..180dbf2757b0 100644
--- a/include/asm-cris/checksum.h
+++ b/include/asm-cris/checksum.h
@@ -17,7 +17,7 @@
17 * 17 *
18 * it's best to have buff aligned on a 32-bit boundary 18 * it's best to have buff aligned on a 32-bit boundary
19 */ 19 */
20unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 20__wsum csum_partial(const void *buff, int len, __wsum sum);
21 21
22/* 22/*
23 * the same as csum_partial, but copies from src while it 23 * the same as csum_partial, but copies from src while it
@@ -27,26 +27,23 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
27 * better 64-bit) boundary 27 * better 64-bit) boundary
28 */ 28 */
29 29
30unsigned int csum_partial_copy_nocheck(const char *src, char *dst, 30__wsum csum_partial_copy_nocheck(const void *src, void *dst,
31 int len, unsigned int sum); 31 int len, __wsum sum);
32 32
33/* 33/*
34 * Fold a partial checksum into a word 34 * Fold a partial checksum into a word
35 */ 35 */
36 36
37static inline unsigned int csum_fold(unsigned int sum) 37static inline __sum16 csum_fold(__wsum csum)
38{ 38{
39 /* the while loop is unnecessary really, it's always enough with two 39 u32 sum = (__force u32)csum;
40 iterations */ 40 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
41 41 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
42 while(sum >> 16) 42 return (__force __sum16)~sum;
43 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
44
45 return ~sum;
46} 43}
47 44
48extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 45extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
49 int len, unsigned int sum, 46 int len, __wsum sum,
50 int *errptr); 47 int *errptr);
51 48
52/* 49/*
@@ -55,8 +52,7 @@ extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
55 * 52 *
56 */ 53 */
57 54
58static inline unsigned short ip_fast_csum(unsigned char * iph, 55static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
59 unsigned int ihl)
60{ 56{
61 return csum_fold(csum_partial(iph, ihl * 4, 0)); 57 return csum_fold(csum_partial(iph, ihl * 4, 0));
62} 58}
@@ -66,11 +62,10 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
66 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
67 */ 63 */
68 64
69static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 65static inline __sum16 int csum_tcpudp_magic(__be32 saddr, __be32 daddr,
70 unsigned long daddr,
71 unsigned short len, 66 unsigned short len,
72 unsigned short proto, 67 unsigned short proto,
73 unsigned int sum) 68 __wsum sum)
74{ 69{
75 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 70 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
76} 71}
@@ -80,7 +75,8 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
80 * in icmp.c 75 * in icmp.c
81 */ 76 */
82 77
83static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { 78static inline __sum16 ip_compute_csum(const void *buff, int len)
79{
84 return csum_fold (csum_partial(buff, len, 0)); 80 return csum_fold (csum_partial(buff, len, 0));
85} 81}
86 82
diff --git a/include/asm-cris/device.h b/include/asm-cris/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-cris/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
index 42bf0db2287a..9b1689850187 100644
--- a/include/asm-frv/checksum.h
+++ b/include/asm-frv/checksum.h
@@ -26,7 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 29__wsum csum_partial(const void *buff, int len, __wsum sum);
30 30
31/* 31/*
32 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -35,7 +35,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
35 * here even more important to align src and dst on a 32-bit (or even 35 * here even more important to align src and dst on a 32-bit (or even
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); 38__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
39 39
40/* 40/*
41 * the same as csum_partial_copy, but copies from user space. 41 * the same as csum_partial_copy, but copies from user space.
@@ -43,11 +43,8 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
43 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
44 * better 64-bit) boundary 44 * better 64-bit) boundary
45 */ 45 */
46extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, 46extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
47 int len, int sum, int *csum_err); 47 int len, __wsum sum, int *csum_err);
48
49#define csum_partial_copy_nocheck(src, dst, len, sum) \
50 csum_partial_copy((src), (dst), (len), (sum))
51 48
52/* 49/*
53 * This is a version of ip_compute_csum() optimized for IP headers, 50 * This is a version of ip_compute_csum() optimized for IP headers,
@@ -55,7 +52,7 @@ extern unsigned int csum_partial_copy_from_user(const char __user *src, char *ds
55 * 52 *
56 */ 53 */
57static inline 54static inline
58unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 55__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
59{ 56{
60 unsigned int tmp, inc, sum = 0; 57 unsigned int tmp, inc, sum = 0;
61 58
@@ -81,13 +78,13 @@ unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
81 : "icc0", "icc1" 78 : "icc0", "icc1"
82 ); 79 );
83 80
84 return ~sum; 81 return (__force __sum16)~sum;
85} 82}
86 83
87/* 84/*
88 * Fold a partial checksum 85 * Fold a partial checksum
89 */ 86 */
90static inline unsigned int csum_fold(unsigned int sum) 87static inline __sum16 csum_fold(__wsum sum)
91{ 88{
92 unsigned int tmp; 89 unsigned int tmp;
93 90
@@ -100,16 +97,16 @@ static inline unsigned int csum_fold(unsigned int sum)
100 : "0"(sum) 97 : "0"(sum)
101 ); 98 );
102 99
103 return ~sum; 100 return (__force __sum16)~sum;
104} 101}
105 102
106/* 103/*
107 * computes the checksum of the TCP/UDP pseudo-header 104 * computes the checksum of the TCP/UDP pseudo-header
108 * returns a 16-bit checksum, already complemented 105 * returns a 16-bit checksum, already complemented
109 */ 106 */
110static inline unsigned int 107static inline __wsum
111csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 108csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
112 unsigned short proto, unsigned int sum) 109 unsigned short proto, __wsum sum)
113{ 110{
114 asm(" addcc %1,%0,%0,icc0 \n" 111 asm(" addcc %1,%0,%0,icc0 \n"
115 " addxcc %2,%0,%0,icc0 \n" 112 " addxcc %2,%0,%0,icc0 \n"
@@ -122,9 +119,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
122 return sum; 119 return sum;
123} 120}
124 121
125static inline unsigned short int 122static inline __sum16
126csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 123csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
127 unsigned short proto, unsigned int sum) 124 unsigned short proto, __wsum sum)
128{ 125{
129 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
130} 127}
@@ -133,12 +130,12 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
133 * this routine is used for miscellaneous IP-like checksums, mainly 130 * this routine is used for miscellaneous IP-like checksums, mainly
134 * in icmp.c 131 * in icmp.c
135 */ 132 */
136extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 133extern __sum16 ip_compute_csum(const void *buff, int len);
137 134
138#define _HAVE_ARCH_IPV6_CSUM 135#define _HAVE_ARCH_IPV6_CSUM
139static inline unsigned short int 136static inline __sum16
140csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 137csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
141 __u32 len, unsigned short proto, unsigned int sum) 138 __u32 len, unsigned short proto, __wsum sum)
142{ 139{
143 unsigned long tmp, tmp2; 140 unsigned long tmp, tmp2;
144 141
@@ -177,7 +174,7 @@ csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr,
177 : "icc0" 174 : "icc0"
178 ); 175 );
179 176
180 return ~sum; 177 return (__force __sum16)~sum;
181} 178}
182 179
183#endif /* _ASM_CHECKSUM_H */ 180#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-frv/device.h b/include/asm-frv/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-frv/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-generic/device.h b/include/asm-generic/device.h
new file mode 100644
index 000000000000..c17c9600f220
--- /dev/null
+++ b/include/asm-generic/device.h
@@ -0,0 +1,12 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_GENERIC_DEVICE_H
7#define _ASM_GENERIC_DEVICE_H
8
9struct dev_archdata {
10};
11
12#endif /* _ASM_GENERIC_DEVICE_H */
diff --git a/include/asm-h8300/checksum.h b/include/asm-h8300/checksum.h
index 3051931dd301..98724e12508c 100644
--- a/include/asm-h8300/checksum.h
+++ b/include/asm-h8300/checksum.h
@@ -13,7 +13,7 @@
13 * 13 *
14 * it's best to have buff aligned on a 32-bit boundary 14 * it's best to have buff aligned on a 32-bit boundary
15 */ 15 */
16unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 16__wsum csum_partial(const void *buff, int len, __wsum sum);
17 17
18/* 18/*
19 * the same as csum_partial, but copies from src while it 19 * the same as csum_partial, but copies from src while it
@@ -23,7 +23,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
23 * better 64-bit) boundary 23 * better 64-bit) boundary
24 */ 24 */
25 25
26unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); 26__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
27 27
28 28
29/* 29/*
@@ -33,20 +33,17 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 36extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
37 int len, int sum, int *csum_err); 37 int len, __wsum sum, int *csum_err);
38 38
39#define csum_partial_copy_nocheck(src, dst, len, sum) \ 39__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
40 csum_partial_copy((src), (dst), (len), (sum))
41
42unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
43 40
44 41
45/* 42/*
46 * Fold a partial checksum 43 * Fold a partial checksum
47 */ 44 */
48 45
49static inline unsigned int csum_fold(unsigned int sum) 46static inline __sum16 csum_fold(__wsum sum)
50{ 47{
51 __asm__("mov.l %0,er0\n\t" 48 __asm__("mov.l %0,er0\n\t"
52 "add.w e0,r0\n\t" 49 "add.w e0,r0\n\t"
@@ -58,7 +55,7 @@ static inline unsigned int csum_fold(unsigned int sum)
58 : "=r"(sum) 55 : "=r"(sum)
59 : "0"(sum) 56 : "0"(sum)
60 : "er0"); 57 : "er0");
61 return ~sum; 58 return (__force __sum16)~sum;
62} 59}
63 60
64 61
@@ -67,9 +64,9 @@ static inline unsigned int csum_fold(unsigned int sum)
67 * returns a 16-bit checksum, already complemented 64 * returns a 16-bit checksum, already complemented
68 */ 65 */
69 66
70static inline unsigned int 67static inline __wsum
71csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
72 unsigned short proto, unsigned int sum) 69 unsigned short proto, __wsum sum)
73{ 70{
74 __asm__ ("sub.l er0,er0\n\t" 71 __asm__ ("sub.l er0,er0\n\t"
75 "add.l %2,%0\n\t" 72 "add.l %2,%0\n\t"
@@ -88,9 +85,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
88 return sum; 85 return sum;
89} 86}
90 87
91static inline unsigned short int 88static inline __sum16
92csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 89csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
93 unsigned short proto, unsigned int sum) 90 unsigned short proto, __wsum sum)
94{ 91{
95 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 92 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
96} 93}
@@ -100,6 +97,6 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
100 * in icmp.c 97 * in icmp.c
101 */ 98 */
102 99
103extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 100extern __sum16 ip_compute_csum(const void *buff, int len);
104 101
105#endif /* _H8300_CHECKSUM_H */ 102#endif /* _H8300_CHECKSUM_H */
diff --git a/include/asm-h8300/device.h b/include/asm-h8300/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-h8300/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h
index 67d3630c4e89..75194abbe8ee 100644
--- a/include/asm-i386/checksum.h
+++ b/include/asm-i386/checksum.h
@@ -17,7 +17,7 @@
17 * 17 *
18 * it's best to have buff aligned on a 32-bit boundary 18 * it's best to have buff aligned on a 32-bit boundary
19 */ 19 */
20asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 20asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
21 21
22/* 22/*
23 * the same as csum_partial, but copies from src while it 23 * the same as csum_partial, but copies from src while it
@@ -27,8 +27,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
27 * better 64-bit) boundary 27 * better 64-bit) boundary
28 */ 28 */
29 29
30asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst, 30asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
31 int len, int sum, int *src_err_ptr, int *dst_err_ptr); 31 int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr);
32 32
33/* 33/*
34 * Note: when you get a NULL pointer exception here this means someone 34 * Note: when you get a NULL pointer exception here this means someone
@@ -38,18 +38,18 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi
38 * access_ok(). 38 * access_ok().
39 */ 39 */
40static __inline__ 40static __inline__
41unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, 41__wsum csum_partial_copy_nocheck (const void *src, void *dst,
42 int len, int sum) 42 int len, __wsum sum)
43{ 43{
44 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 44 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
45} 45}
46 46
47static __inline__ 47static __inline__
48unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, 48__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
49 int len, int sum, int *err_ptr) 49 int len, __wsum sum, int *err_ptr)
50{ 50{
51 might_sleep(); 51 might_sleep();
52 return csum_partial_copy_generic((__force unsigned char *)src, dst, 52 return csum_partial_copy_generic((__force void *)src, dst,
53 len, sum, err_ptr, NULL); 53 len, sum, err_ptr, NULL);
54} 54}
55 55
@@ -60,8 +60,7 @@ unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsign
60 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by 60 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
61 * Arnt Gulbrandsen. 61 * Arnt Gulbrandsen.
62 */ 62 */
63static inline unsigned short ip_fast_csum(unsigned char * iph, 63static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
64 unsigned int ihl)
65{ 64{
66 unsigned int sum; 65 unsigned int sum;
67 66
@@ -89,29 +88,29 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
89 : "=r" (sum), "=r" (iph), "=r" (ihl) 88 : "=r" (sum), "=r" (iph), "=r" (ihl)
90 : "1" (iph), "2" (ihl) 89 : "1" (iph), "2" (ihl)
91 : "memory"); 90 : "memory");
92 return(sum); 91 return (__force __sum16)sum;
93} 92}
94 93
95/* 94/*
96 * Fold a partial checksum 95 * Fold a partial checksum
97 */ 96 */
98 97
99static inline unsigned int csum_fold(unsigned int sum) 98static inline __sum16 csum_fold(__wsum sum)
100{ 99{
101 __asm__( 100 __asm__(
102 "addl %1, %0 ;\n" 101 "addl %1, %0 ;\n"
103 "adcl $0xffff, %0 ;\n" 102 "adcl $0xffff, %0 ;\n"
104 : "=r" (sum) 103 : "=r" (sum)
105 : "r" (sum << 16), "0" (sum & 0xffff0000) 104 : "r" ((__force u32)sum << 16),
105 "0" ((__force u32)sum & 0xffff0000)
106 ); 106 );
107 return (~sum) >> 16; 107 return (__force __sum16)(~(__force u32)sum >> 16);
108} 108}
109 109
110static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 110static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
111 unsigned long daddr, 111 unsigned short len,
112 unsigned short len, 112 unsigned short proto,
113 unsigned short proto, 113 __wsum sum)
114 unsigned int sum)
115{ 114{
116 __asm__( 115 __asm__(
117 "addl %1, %0 ;\n" 116 "addl %1, %0 ;\n"
@@ -119,7 +118,7 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
119 "adcl %3, %0 ;\n" 118 "adcl %3, %0 ;\n"
120 "adcl $0, %0 ;\n" 119 "adcl $0, %0 ;\n"
121 : "=r" (sum) 120 : "=r" (sum)
122 : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum)); 121 : "g" (daddr), "g"(saddr), "g"((len + proto) << 8), "0"(sum));
123 return sum; 122 return sum;
124} 123}
125 124
@@ -127,11 +126,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
127 * computes the checksum of the TCP/UDP pseudo-header 126 * computes the checksum of the TCP/UDP pseudo-header
128 * returns a 16-bit checksum, already complemented 127 * returns a 16-bit checksum, already complemented
129 */ 128 */
130static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 129static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
131 unsigned long daddr,
132 unsigned short len, 130 unsigned short len,
133 unsigned short proto, 131 unsigned short proto,
134 unsigned int sum) 132 __wsum sum)
135{ 133{
136 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 134 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
137} 135}
@@ -141,17 +139,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
141 * in icmp.c 139 * in icmp.c
142 */ 140 */
143 141
144static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 142static inline __sum16 ip_compute_csum(const void *buff, int len)
145{ 143{
146 return csum_fold (csum_partial(buff, len, 0)); 144 return csum_fold (csum_partial(buff, len, 0));
147} 145}
148 146
149#define _HAVE_ARCH_IPV6_CSUM 147#define _HAVE_ARCH_IPV6_CSUM
150static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 148static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
151 struct in6_addr *daddr, 149 const struct in6_addr *daddr,
152 __u32 len, 150 __u32 len, unsigned short proto,
153 unsigned short proto, 151 __wsum sum)
154 unsigned int sum)
155{ 152{
156 __asm__( 153 __asm__(
157 "addl 0(%1), %0 ;\n" 154 "addl 0(%1), %0 ;\n"
@@ -176,19 +173,19 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
176 * Copy and checksum to user 173 * Copy and checksum to user
177 */ 174 */
178#define HAVE_CSUM_COPY_USER 175#define HAVE_CSUM_COPY_USER
179static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src, 176static __inline__ __wsum csum_and_copy_to_user(const void *src,
180 unsigned char __user *dst, 177 void __user *dst,
181 int len, int sum, 178 int len, __wsum sum,
182 int *err_ptr) 179 int *err_ptr)
183{ 180{
184 might_sleep(); 181 might_sleep();
185 if (access_ok(VERIFY_WRITE, dst, len)) 182 if (access_ok(VERIFY_WRITE, dst, len))
186 return csum_partial_copy_generic(src, (__force unsigned char *)dst, len, sum, NULL, err_ptr); 183 return csum_partial_copy_generic(src, (__force void *)dst, len, sum, NULL, err_ptr);
187 184
188 if (len) 185 if (len)
189 *err_ptr = -EFAULT; 186 *err_ptr = -EFAULT;
190 187
191 return -1; /* invalid checksum */ 188 return (__force __wsum)-1; /* invalid checksum */
192} 189}
193 190
194#endif 191#endif
diff --git a/include/asm-i386/device.h b/include/asm-i386/device.h
new file mode 100644
index 000000000000..849604c70e6b
--- /dev/null
+++ b/include/asm-i386/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_I386_DEVICE_H
7#define _ASM_I386_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_I386_DEVICE_H */
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index ef0671e5d5c5..43e5bd8f4a19 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -88,7 +88,11 @@ static inline void clustered_apic_check(void)
88 88
89static inline int apicid_to_node(int logical_apicid) 89static inline int apicid_to_node(int logical_apicid)
90{ 90{
91#ifdef CONFIG_SMP
91 return apicid_2_node[hard_smp_processor_id()]; 92 return apicid_2_node[hard_smp_processor_id()];
93#else
94 return 0;
95#endif
92} 96}
93 97
94/* Mapping from cpu number to logical apicid */ 98/* Mapping from cpu number to logical apicid */
diff --git a/include/asm-ia64/checksum.h b/include/asm-ia64/checksum.h
index 1f230ff8ea81..bd40f4756ce1 100644
--- a/include/asm-ia64/checksum.h
+++ b/include/asm-ia64/checksum.h
@@ -10,23 +10,21 @@
10 * This is a version of ip_compute_csum() optimized for IP headers, 10 * This is a version of ip_compute_csum() optimized for IP headers,
11 * which always checksum on 4 octet boundaries. 11 * which always checksum on 4 octet boundaries.
12 */ 12 */
13extern unsigned short ip_fast_csum (unsigned char * iph, unsigned int ihl); 13extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
14 14
15/* 15/*
16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit 16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit
17 * checksum, already complemented 17 * checksum, already complemented
18 */ 18 */
19extern unsigned short int csum_tcpudp_magic (unsigned long saddr, 19extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr,
20 unsigned long daddr,
21 unsigned short len, 20 unsigned short len,
22 unsigned short proto, 21 unsigned short proto,
23 unsigned int sum); 22 __wsum sum);
24 23
25extern unsigned int csum_tcpudp_nofold (unsigned long saddr, 24extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
26 unsigned long daddr,
27 unsigned short len, 25 unsigned short len,
28 unsigned short proto, 26 unsigned short proto,
29 unsigned int sum); 27 __wsum sum);
30 28
31/* 29/*
32 * Computes the checksum of a memory block at buff, length len, 30 * Computes the checksum of a memory block at buff, length len,
@@ -40,8 +38,7 @@ extern unsigned int csum_tcpudp_nofold (unsigned long saddr,
40 * 38 *
41 * it's best to have buff aligned on a 32-bit boundary 39 * it's best to have buff aligned on a 32-bit boundary
42 */ 40 */
43extern unsigned int csum_partial (const unsigned char * buff, int len, 41extern __wsum csum_partial(const void *buff, int len, __wsum sum);
44 unsigned int sum);
45 42
46/* 43/*
47 * Same as csum_partial, but copies from src while it checksums. 44 * Same as csum_partial, but copies from src while it checksums.
@@ -49,28 +46,28 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
49 * Here it is even more important to align src and dst on a 32-bit (or 46 * Here it is even more important to align src and dst on a 32-bit (or
50 * even better 64-bit) boundary. 47 * even better 64-bit) boundary.
51 */ 48 */
52extern unsigned int csum_partial_copy_from_user (const char *src, char *dst, 49extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
53 int len, unsigned int sum, 50 int len, __wsum sum,
54 int *errp); 51 int *errp);
55 52
56extern unsigned int csum_partial_copy_nocheck (const char *src, char *dst, 53extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
57 int len, unsigned int sum); 54 int len, __wsum sum);
58 55
59/* 56/*
60 * This routine is used for miscellaneous IP-like checksums, mainly in 57 * This routine is used for miscellaneous IP-like checksums, mainly in
61 * icmp.c 58 * icmp.c
62 */ 59 */
63extern unsigned short ip_compute_csum (unsigned char *buff, int len); 60extern __sum16 ip_compute_csum(const void *buff, int len);
64 61
65/* 62/*
66 * Fold a partial checksum without adding pseudo headers. 63 * Fold a partial checksum without adding pseudo headers.
67 */ 64 */
68static inline unsigned short 65static inline __sum16 csum_fold(__wsum csum)
69csum_fold (unsigned int sum)
70{ 66{
67 u32 sum = (__force u32)csum;
71 sum = (sum & 0xffff) + (sum >> 16); 68 sum = (sum & 0xffff) + (sum >> 16);
72 sum = (sum & 0xffff) + (sum >> 16); 69 sum = (sum & 0xffff) + (sum >> 16);
73 return ~sum; 70 return (__force __sum16)~sum;
74} 71}
75 72
76#endif /* _ASM_IA64_CHECKSUM_H */ 73#endif /* _ASM_IA64_CHECKSUM_H */
diff --git a/include/asm-ia64/device.h b/include/asm-ia64/device.h
new file mode 100644
index 000000000000..3db6daf7f251
--- /dev/null
+++ b/include/asm-ia64/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_IA64_DEVICE_H
7#define _ASM_IA64_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_IA64_DEVICE_H */
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 855c30af72a9..6311e168cd34 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -32,7 +32,7 @@
32 */ 32 */
33#define IO_SPACE_LIMIT 0xffffffffffffffffUL 33#define IO_SPACE_LIMIT 0xffffffffffffffffUL
34 34
35#define MAX_IO_SPACES_BITS 4 35#define MAX_IO_SPACES_BITS 8
36#define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS) 36#define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS)
37#define IO_SPACE_BITS 24 37#define IO_SPACE_BITS 24
38#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS) 38#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 7ffbddf5306f..8f784f8e45b0 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -36,6 +36,7 @@ typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val,
36typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val, 36typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val,
37 u8 size); 37 u8 size);
38typedef void ia64_mv_migrate_t(struct task_struct * task); 38typedef void ia64_mv_migrate_t(struct task_struct * task);
39typedef void ia64_mv_pci_fixup_bus_t (struct pci_bus *);
39 40
40/* DMA-mapping interface: */ 41/* DMA-mapping interface: */
41typedef void ia64_mv_dma_init (void); 42typedef void ia64_mv_dma_init (void);
@@ -95,6 +96,11 @@ machvec_noop_task (struct task_struct *task)
95{ 96{
96} 97}
97 98
99static inline void
100machvec_noop_bus (struct pci_bus *bus)
101{
102}
103
98extern void machvec_setup (char **); 104extern void machvec_setup (char **);
99extern void machvec_timer_interrupt (int, void *); 105extern void machvec_timer_interrupt (int, void *);
100extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int); 106extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int);
@@ -159,6 +165,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
159# define platform_migrate ia64_mv.migrate 165# define platform_migrate ia64_mv.migrate
160# define platform_setup_msi_irq ia64_mv.setup_msi_irq 166# define platform_setup_msi_irq ia64_mv.setup_msi_irq
161# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq 167# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
168# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus
162# endif 169# endif
163 170
164/* __attribute__((__aligned__(16))) is required to make size of the 171/* __attribute__((__aligned__(16))) is required to make size of the
@@ -210,6 +217,7 @@ struct ia64_machine_vector {
210 ia64_mv_migrate_t *migrate; 217 ia64_mv_migrate_t *migrate;
211 ia64_mv_setup_msi_irq_t *setup_msi_irq; 218 ia64_mv_setup_msi_irq_t *setup_msi_irq;
212 ia64_mv_teardown_msi_irq_t *teardown_msi_irq; 219 ia64_mv_teardown_msi_irq_t *teardown_msi_irq;
220 ia64_mv_pci_fixup_bus_t *pci_fixup_bus;
213} __attribute__((__aligned__(16))); /* align attrib? see above comment */ 221} __attribute__((__aligned__(16))); /* align attrib? see above comment */
214 222
215#define MACHVEC_INIT(name) \ 223#define MACHVEC_INIT(name) \
@@ -257,6 +265,7 @@ struct ia64_machine_vector {
257 platform_migrate, \ 265 platform_migrate, \
258 platform_setup_msi_irq, \ 266 platform_setup_msi_irq, \
259 platform_teardown_msi_irq, \ 267 platform_teardown_msi_irq, \
268 platform_pci_fixup_bus, \
260} 269}
261 270
262extern struct ia64_machine_vector ia64_mv; 271extern struct ia64_machine_vector ia64_mv;
@@ -416,5 +425,8 @@ extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size
416#ifndef platform_teardown_msi_irq 425#ifndef platform_teardown_msi_irq
417# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) 426# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
418#endif 427#endif
428#ifndef platform_pci_fixup_bus
429# define platform_pci_fixup_bus machvec_noop_bus
430#endif
419 431
420#endif /* _ASM_IA64_MACHVEC_H */ 432#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index c54b165b1c17..83325f6db03e 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -69,6 +69,7 @@ extern ia64_mv_dma_supported sn_dma_supported;
69extern ia64_mv_migrate_t sn_migrate; 69extern ia64_mv_migrate_t sn_migrate;
70extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq; 70extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq;
71extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq; 71extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
72extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
72 73
73 74
74/* 75/*
@@ -127,6 +128,7 @@ extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
127#define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL) 128#define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL)
128#define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) 129#define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
129#endif 130#endif
131#define platform_pci_fixup_bus sn_pci_fixup_bus
130 132
131#include <asm/sn/io.h> 133#include <asm/sn/io.h>
132 134
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index ef616fd4cb1b..825eb7d882e6 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -26,16 +26,18 @@ void pcibios_config_init(void);
26struct pci_dev; 26struct pci_dev;
27 27
28/* 28/*
29 * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct correspondence 29 * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
30 * between device bus addresses and CPU physical addresses. Platforms with a hardware I/O 30 * correspondence between device bus addresses and CPU physical addresses.
31 * MMU _must_ turn this off to suppress the bounce buffer handling code in the block and 31 * Platforms with a hardware I/O MMU _must_ turn this off to suppress the
32 * network device layers. Platforms with separate bus address spaces _must_ turn this off 32 * bounce buffer handling code in the block and network device layers.
33 * and provide a device DMA mapping implementation that takes care of the necessary 33 * Platforms with separate bus address spaces _must_ turn this off and provide
34 * a device DMA mapping implementation that takes care of the necessary
34 * address translation. 35 * address translation.
35 * 36 *
36 * For now, the ia64 platforms which may have separate/multiple bus address spaces all 37 * For now, the ia64 platforms which may have separate/multiple bus address
37 * have I/O MMUs which support the merging of physically discontiguous buffers, so we can 38 * spaces all have I/O MMUs which support the merging of physically
38 * use that as the sole factor to determine the setting of PCI_DMA_BUS_IS_PHYS. 39 * discontiguous buffers, so we can use that as the sole factor to determine
40 * the setting of PCI_DMA_BUS_IS_PHYS.
39 */ 41 */
40extern unsigned long ia64_max_iommu_merge_mask; 42extern unsigned long ia64_max_iommu_merge_mask;
41#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) 43#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
@@ -52,9 +54,6 @@ pcibios_penalize_isa_irq (int irq, int active)
52 /* We don't do dynamic PCI IRQ allocation */ 54 /* We don't do dynamic PCI IRQ allocation */
53} 55}
54 56
55#define HAVE_ARCH_PCI_MWI 1
56extern int pcibios_prep_mwi (struct pci_dev *);
57
58#include <asm-generic/pci-dma-compat.h> 57#include <asm-generic/pci-dma-compat.h>
59 58
60/* pci_unmap_{single,page} is not a nop, thus... */ 59/* pci_unmap_{single,page} is not a nop, thus... */
diff --git a/include/asm-ia64/sn/acpi.h b/include/asm-ia64/sn/acpi.h
new file mode 100644
index 000000000000..2850a7ef5e71
--- /dev/null
+++ b/include/asm-ia64/sn/acpi.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_ACPI_H
10#define _ASM_IA64_SN_ACPI_H
11
12#include "acpi/acglobal.h"
13
14#define SN_ACPI_BASE_SUPPORT() (acpi_gbl_DSDT->oem_revision >= 0x20101)
15
16#endif /* _ASM_IA64_SN_ACPI_H */
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index eac3561574be..9fe89a93d880 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2006 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H 8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H
9#define _ASM_IA64_SN_PCI_PCIDEV_H 9#define _ASM_IA64_SN_PCI_PCIDEV_H
@@ -12,31 +12,29 @@
12 12
13/* 13/*
14 * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to 14 * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to
15 * the pcidev_info structs for all devices under a controller, we extend the 15 * the pcidev_info structs for all devices under a controller, we keep a
16 * definition of pci_controller, via sn_pci_controller, to include a list 16 * list of pcidev_info under pci_controller->platform_data.
17 * of pcidev_info.
18 */ 17 */
19struct sn_pci_controller { 18struct sn_platform_data {
20 struct pci_controller pci_controller; 19 void *provider_soft;
21 struct list_head pcidev_info; 20 struct list_head pcidev_info;
22}; 21};
23 22
24#define SN_PCI_CONTROLLER(dev) ((struct sn_pci_controller *) dev->sysdata) 23#define SN_PLATFORM_DATA(busdev) \
24 ((struct sn_platform_data *)(PCI_CONTROLLER(busdev)->platform_data))
25 25
26#define SN_PCIDEV_INFO(dev) sn_pcidev_info_get(dev) 26#define SN_PCIDEV_INFO(dev) sn_pcidev_info_get(dev)
27 27
28#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
29 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
30/* 28/*
31 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that 29 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that
32 * this only works for root busses, not for busses represented by PPB's. 30 * this only works for root busses, not for busses represented by PPB's.
33 */ 31 */
34 32
35#define SN_PCIBUS_BUSSOFT(pci_bus) \ 33#define SN_PCIBUS_BUSSOFT(pci_bus) \
36 ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 34 ((struct pcibus_bussoft *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))
37 35
38#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \ 36#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
39 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 37 ((struct pcibus_info *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))
40/* 38/*
41 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note 39 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note
42 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due 40 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due
@@ -72,8 +70,6 @@ extern void sn_irq_fixup(struct pci_dev *pci_dev,
72 struct sn_irq_info *sn_irq_info); 70 struct sn_irq_info *sn_irq_info);
73extern void sn_irq_unfixup(struct pci_dev *pci_dev); 71extern void sn_irq_unfixup(struct pci_dev *pci_dev);
74extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *); 72extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *);
75extern void sn_pci_controller_fixup(int segment, int busnum,
76 struct pci_bus *bus);
77extern void sn_bus_store_sysdata(struct pci_dev *dev); 73extern void sn_bus_store_sysdata(struct pci_dev *dev);
78extern void sn_bus_free_sysdata(void); 74extern void sn_bus_free_sysdata(void);
79extern void sn_generate_path(struct pci_bus *pci_bus, char *address); 75extern void sn_generate_path(struct pci_bus *pci_bus, char *address);
diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h
index 30dcfa442e53..bfdc36273ed4 100644
--- a/include/asm-ia64/sn/sn_feature_sets.h
+++ b/include/asm-ia64/sn/sn_feature_sets.h
@@ -44,8 +44,14 @@ extern int sn_prom_feature_available(int id);
44 * Once enabled, a feature cannot be disabled. 44 * Once enabled, a feature cannot be disabled.
45 * 45 *
46 * By default, features are disabled unless explicitly enabled. 46 * By default, features are disabled unless explicitly enabled.
47 *
48 * These defines must be kept in sync with the corresponding
49 * PROM definitions in feature_sets.h.
47 */ 50 */
48#define OSF_MCA_SLV_TO_OS_INIT_SLV 0 51#define OSF_MCA_SLV_TO_OS_INIT_SLV 0
49#define OSF_FEAT_LOG_SBES 1 52#define OSF_FEAT_LOG_SBES 1
53#define OSF_ACPI_ENABLE 2
54#define OSF_PCISEGMENT_ENABLE 3
55
50 56
51#endif /* _ASM_IA64_SN_FEATURE_SETS_H */ 57#endif /* _ASM_IA64_SN_FEATURE_SETS_H */
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index ba826b3f75bb..be5d83ad7cb1 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -77,6 +77,7 @@
77#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated 77#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated
78#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a 78#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a
79 79
80#define SN_SAL_IOIF_INIT 0x0200005f
80#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 81#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
81#define SN_SAL_BTE_RECOVER 0x02000061 82#define SN_SAL_BTE_RECOVER 0x02000061
82#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062 83#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062
diff --git a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h
index 877ebf46e9ff..a7a7c4f44abe 100644
--- a/include/asm-m32r/checksum.h
+++ b/include/asm-m32r/checksum.h
@@ -31,8 +31,7 @@
31 * 31 *
32 * it's best to have buff aligned on a 32-bit boundary 32 * it's best to have buff aligned on a 32-bit boundary
33 */ 33 */
34asmlinkage unsigned int csum_partial(const unsigned char *buff, 34asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
35 int len, unsigned int sum);
36 35
37/* 36/*
38 * The same as csum_partial, but copies from src while it checksums. 37 * The same as csum_partial, but copies from src while it checksums.
@@ -40,24 +39,22 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff,
40 * Here even more important to align src and dst on a 32-bit (or even 39 * Here even more important to align src and dst on a 32-bit (or even
41 * better 64-bit) boundary 40 * better 64-bit) boundary
42 */ 41 */
43extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 42extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
44 unsigned char *dst, 43 int len, __wsum sum);
45 int len, unsigned int sum);
46 44
47/* 45/*
48 * This is a new version of the above that records errors it finds in *errp, 46 * This is a new version of the above that records errors it finds in *errp,
49 * but continues and zeros thre rest of the buffer. 47 * but continues and zeros thre rest of the buffer.
50 */ 48 */
51extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 49extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
52 unsigned char *dst, 50 int len, __wsum sum,
53 int len, unsigned int sum,
54 int *err_ptr); 51 int *err_ptr);
55 52
56/* 53/*
57 * Fold a partial checksum 54 * Fold a partial checksum
58 */ 55 */
59 56
60static inline unsigned int csum_fold(unsigned int sum) 57static inline __sum16 csum_fold(__wsum sum)
61{ 58{
62 unsigned long tmpreg; 59 unsigned long tmpreg;
63 __asm__( 60 __asm__(
@@ -72,16 +69,17 @@ static inline unsigned int csum_fold(unsigned int sum)
72 : "0" (sum) 69 : "0" (sum)
73 : "cbit" 70 : "cbit"
74 ); 71 );
75 return sum; 72 return (__force __sum16)sum;
76} 73}
77 74
78/* 75/*
79 * This is a version of ip_compute_csum() optimized for IP headers, 76 * This is a version of ip_compute_csum() optimized for IP headers,
80 * which always checksum on 4 octet boundaries. 77 * which always checksum on 4 octet boundaries.
81 */ 78 */
82static inline unsigned short ip_fast_csum(unsigned char * iph, 79static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
83 unsigned int ihl) { 80{
84 unsigned long sum, tmpreg0, tmpreg1; 81 unsigned long tmpreg0, tmpreg1;
82 __wsum sum;
85 83
86 __asm__ __volatile__( 84 __asm__ __volatile__(
87 " ld %0, @%1+ \n" 85 " ld %0, @%1+ \n"
@@ -115,16 +113,15 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
115 return csum_fold(sum); 113 return csum_fold(sum);
116} 114}
117 115
118static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 116static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
119 unsigned long daddr,
120 unsigned short len, 117 unsigned short len,
121 unsigned short proto, 118 unsigned short proto,
122 unsigned int sum) 119 __wsum sum)
123{ 120{
124#if defined(__LITTLE_ENDIAN) 121#if defined(__LITTLE_ENDIAN)
125 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 122 unsigned long len_proto = (proto + len) << 8;
126#else 123#else
127 unsigned long len_proto = (proto<<16)+len; 124 unsigned long len_proto = proto + len;
128#endif 125#endif
129 unsigned long tmpreg; 126 unsigned long tmpreg;
130 127
@@ -147,11 +144,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
147 * computes the checksum of the TCP/UDP pseudo-header 144 * computes the checksum of the TCP/UDP pseudo-header
148 * returns a 16-bit checksum, already complemented 145 * returns a 16-bit checksum, already complemented
149 */ 146 */
150static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 147static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
151 unsigned long daddr,
152 unsigned short len, 148 unsigned short len,
153 unsigned short proto, 149 unsigned short proto,
154 unsigned int sum) 150 __wsum sum)
155{ 151{
156 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 152 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
157} 153}
@@ -161,16 +157,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
161 * in icmp.c 157 * in icmp.c
162 */ 158 */
163 159
164static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { 160static inline __sum16 ip_compute_csum(const void *buff, int len)
161{
165 return csum_fold (csum_partial(buff, len, 0)); 162 return csum_fold (csum_partial(buff, len, 0));
166} 163}
167 164
168#define _HAVE_ARCH_IPV6_CSUM 165#define _HAVE_ARCH_IPV6_CSUM
169static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 166static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
170 struct in6_addr *daddr, 167 const struct in6_addr *daddr,
171 __u16 len, 168 __u32 len, unsigned short proto,
172 unsigned short proto, 169 __wsum sum)
173 unsigned int sum)
174{ 170{
175 unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3; 171 unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3;
176 __asm__( 172 __asm__(
@@ -197,7 +193,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
197 : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1), 193 : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1),
198 "=&r" (tmpreg2), "=&r" (tmpreg3) 194 "=&r" (tmpreg2), "=&r" (tmpreg3)
199 : "r" (saddr), "r" (daddr), 195 : "r" (saddr), "r" (daddr),
200 "r" (htonl((__u32) (len))), "r" (htonl(proto)), "0" (sum) 196 "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
201 : "cbit" 197 : "cbit"
202 ); 198 );
203 199
diff --git a/include/asm-m32r/device.h b/include/asm-m32r/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m32r/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
index 17280ef719f5..494f9aec37ea 100644
--- a/include/asm-m68k/checksum.h
+++ b/include/asm-m68k/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,22 +25,21 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 28extern __wsum csum_partial_copy_from_user(const void __user *src,
29 unsigned char *dst, 29 void *dst,
30 int len, int sum, 30 int len, __wsum sum,
31 int *csum_err); 31 int *csum_err);
32 32
33extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 33extern __wsum csum_partial_copy_nocheck(const void *src,
34 unsigned char *dst, int len, 34 void *dst, int len,
35 int sum); 35 __wsum sum);
36 36
37/* 37/*
38 * This is a version of ip_compute_csum() optimized for IP headers, 38 * This is a version of ip_compute_csum() optimized for IP headers,
39 * which always checksum on 4 octet boundaries. 39 * which always checksum on 4 octet boundaries.
40 * 40 *
41 */ 41 */
42static inline unsigned short 42static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
43ip_fast_csum(unsigned char *iph, unsigned int ihl)
44{ 43{
45 unsigned int sum = 0; 44 unsigned int sum = 0;
46 unsigned long tmp; 45 unsigned long tmp;
@@ -58,29 +57,29 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl)
58 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp) 57 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp)
59 : "0" (sum), "1" (iph), "2" (ihl) 58 : "0" (sum), "1" (iph), "2" (ihl)
60 : "memory"); 59 : "memory");
61 return ~sum; 60 return (__force __sum16)~sum;
62} 61}
63 62
64/* 63/*
65 * Fold a partial checksum 64 * Fold a partial checksum
66 */ 65 */
67 66
68static inline unsigned int csum_fold(unsigned int sum) 67static inline __sum16 csum_fold(__wsum sum)
69{ 68{
70 unsigned int tmp = sum; 69 unsigned int tmp = (__force u32)sum;
71 __asm__("swap %1\n\t" 70 __asm__("swap %1\n\t"
72 "addw %1, %0\n\t" 71 "addw %1, %0\n\t"
73 "clrw %1\n\t" 72 "clrw %1\n\t"
74 "addxw %1, %0" 73 "addxw %1, %0"
75 : "=&d" (sum), "=&d" (tmp) 74 : "=&d" (sum), "=&d" (tmp)
76 : "0" (sum), "1" (tmp)); 75 : "0" (sum), "1" (tmp));
77 return ~sum; 76 return (__force __sum16)~sum;
78} 77}
79 78
80 79
81static inline unsigned int 80static inline __wsum
82csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 81csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
83 unsigned short proto, unsigned int sum) 82 unsigned short proto, __wsum sum)
84{ 83{
85 __asm__ ("addl %2,%0\n\t" 84 __asm__ ("addl %2,%0\n\t"
86 "addxl %3,%0\n\t" 85 "addxl %3,%0\n\t"
@@ -98,9 +97,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
98 * computes the checksum of the TCP/UDP pseudo-header 97 * computes the checksum of the TCP/UDP pseudo-header
99 * returns a 16-bit checksum, already complemented 98 * returns a 16-bit checksum, already complemented
100 */ 99 */
101static inline unsigned short int 100static inline __sum16
102csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 101csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
103 unsigned short proto, unsigned int sum) 102 unsigned short proto, __wsum sum)
104{ 103{
105 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 104 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
106} 105}
@@ -110,16 +109,15 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
110 * in icmp.c 109 * in icmp.c
111 */ 110 */
112 111
113static inline unsigned short 112static inline __sum16 ip_compute_csum(const void *buff, int len)
114ip_compute_csum(unsigned char * buff, int len)
115{ 113{
116 return csum_fold (csum_partial(buff, len, 0)); 114 return csum_fold (csum_partial(buff, len, 0));
117} 115}
118 116
119#define _HAVE_ARCH_IPV6_CSUM 117#define _HAVE_ARCH_IPV6_CSUM
120static __inline__ unsigned short int 118static __inline__ __sum16
121csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 119csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
122 __u32 len, unsigned short proto, unsigned int sum) 120 __u32 len, unsigned short proto, __wsum sum)
123{ 121{
124 register unsigned long tmp; 122 register unsigned long tmp;
125 __asm__("addl %2@,%0\n\t" 123 __asm__("addl %2@,%0\n\t"
diff --git a/include/asm-m68k/device.h b/include/asm-m68k/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m68k/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m68knommu/checksum.h b/include/asm-m68knommu/checksum.h
index 294ec7583ac9..81883482ffb1 100644
--- a/include/asm-m68knommu/checksum.h
+++ b/include/asm-m68knommu/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,8 +25,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, 28__wsum csum_partial_copy_nocheck(const void *src, void *dst,
29 int len, int sum); 29 int len, __wsum sum);
30 30
31 31
32/* 32/*
@@ -36,33 +36,31 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38 38
39extern unsigned int csum_partial_copy_from_user(const unsigned char *src, 39extern __wsum csum_partial_copy_from_user(const void __user *src,
40 unsigned char *dst, int len, int sum, int *csum_err); 40 void *dst, int len, __wsum sum, int *csum_err);
41 41
42#define csum_partial_copy_nocheck(src, dst, len, sum) \ 42__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
43 csum_partial_copy((src), (dst), (len), (sum))
44
45unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
46 43
47/* 44/*
48 * Fold a partial checksum 45 * Fold a partial checksum
49 */ 46 */
50 47
51static inline unsigned int csum_fold(unsigned int sum) 48static inline __sum16 csum_fold(__wsum sum)
52{ 49{
50 unsigned int tmp = (__force u32)sum;
53#ifdef CONFIG_COLDFIRE 51#ifdef CONFIG_COLDFIRE
54 sum = (sum & 0xffff) + (sum >> 16); 52 tmp = (tmp & 0xffff) + (tmp >> 16);
55 sum = (sum & 0xffff) + (sum >> 16); 53 tmp = (tmp & 0xffff) + (tmp >> 16);
54 return (__force __sum16)~tmp;
56#else 55#else
57 unsigned int tmp = sum;
58 __asm__("swap %1\n\t" 56 __asm__("swap %1\n\t"
59 "addw %1, %0\n\t" 57 "addw %1, %0\n\t"
60 "clrw %1\n\t" 58 "clrw %1\n\t"
61 "addxw %1, %0" 59 "addxw %1, %0"
62 : "=&d" (sum), "=&d" (tmp) 60 : "=&d" (sum), "=&d" (tmp)
63 : "0" (sum), "1" (sum)); 61 : "0" (sum), "1" (sum));
62 return (__force __sum16)~sum;
64#endif 63#endif
65 return ~sum;
66} 64}
67 65
68 66
@@ -71,9 +69,9 @@ static inline unsigned int csum_fold(unsigned int sum)
71 * returns a 16-bit checksum, already complemented 69 * returns a 16-bit checksum, already complemented
72 */ 70 */
73 71
74static inline unsigned int 72static inline __wsum
75csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 73csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
76 unsigned short proto, unsigned int sum) 74 unsigned short proto, __wsum sum)
77{ 75{
78 __asm__ ("addl %1,%0\n\t" 76 __asm__ ("addl %1,%0\n\t"
79 "addxl %4,%0\n\t" 77 "addxl %4,%0\n\t"
@@ -86,9 +84,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
86 return sum; 84 return sum;
87} 85}
88 86
89static inline unsigned short int 87static inline __sum16
90csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 88csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
91 unsigned short proto, unsigned int sum) 89 unsigned short proto, __wsum sum)
92{ 90{
93 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 91 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
94} 92}
@@ -98,12 +96,12 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
98 * in icmp.c 96 * in icmp.c
99 */ 97 */
100 98
101extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 99extern __sum16 ip_compute_csum(const void *buff, int len);
102 100
103#define _HAVE_ARCH_IPV6_CSUM 101#define _HAVE_ARCH_IPV6_CSUM
104static __inline__ unsigned short int 102static __inline__ __sum16
105csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 103csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
106 __u32 len, unsigned short proto, unsigned int sum) 104 __u32 len, unsigned short proto, __wsum sum)
107{ 105{
108 register unsigned long tmp; 106 register unsigned long tmp;
109 __asm__("addl %2@,%0\n\t" 107 __asm__("addl %2@,%0\n\t"
diff --git a/include/asm-m68knommu/device.h b/include/asm-m68knommu/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m68knommu/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m68knommu/mcfmbus.h b/include/asm-m68knommu/mcfmbus.h
index 13df9d41bd1a..319899c47a2c 100644
--- a/include/asm-m68knommu/mcfmbus.h
+++ b/include/asm-m68knommu/mcfmbus.h
@@ -37,7 +37,7 @@
37#define MCFMBUS_MFDR_MBC(a) ((a)&0x3F) /*M-Bus Clock*/ 37#define MCFMBUS_MFDR_MBC(a) ((a)&0x3F) /*M-Bus Clock*/
38 38
39/* 39/*
40* Define bit flags in Controll Register 40* Define bit flags in Control Register
41*/ 41*/
42 42
43#define MCFMBUS_MBCR_MEN (0x80) /* M-Bus Enable */ 43#define MCFMBUS_MBCR_MEN (0x80) /* M-Bus Enable */
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 45c706e34df1..c6275088cf65 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -19,12 +19,16 @@
19#define _ATYPE_ 19#define _ATYPE_
20#define _ATYPE32_ 20#define _ATYPE32_
21#define _ATYPE64_ 21#define _ATYPE64_
22#define _LLCONST_(x) x 22#define _CONST64_(x) x
23#else 23#else
24#define _ATYPE_ __PTRDIFF_TYPE__ 24#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int 25#define _ATYPE32_ int
26#define _ATYPE64_ long long 26#define _ATYPE64_ __s64
27#define _LLCONST_(x) x ## LL 27#ifdef CONFIG_64BIT
28#define _CONST64_(x) x ## L
29#else
30#define _CONST64_(x) x ## LL
31#endif
28#endif 32#endif
29 33
30/* 34/*
@@ -48,7 +52,7 @@
48 */ 52 */
49#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) 53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
50#define XPHYSADDR(a) ((_ACAST64_(a)) & \ 54#define XPHYSADDR(a) ((_ACAST64_(a)) & \
51 _LLCONST_(0x000000ffffffffff)) 55 _CONST64_(0x000000ffffffffff))
52 56
53#ifdef CONFIG_64BIT 57#ifdef CONFIG_64BIT
54 58
@@ -57,14 +61,14 @@
57 * The compatibility segments use the full 64-bit sign extended value. Note 61 * The compatibility segments use the full 64-bit sign extended value. Note
58 * the R8000 doesn't have them so don't reference these in generic MIPS code. 62 * the R8000 doesn't have them so don't reference these in generic MIPS code.
59 */ 63 */
60#define XKUSEG _LLCONST_(0x0000000000000000) 64#define XKUSEG _CONST64_(0x0000000000000000)
61#define XKSSEG _LLCONST_(0x4000000000000000) 65#define XKSSEG _CONST64_(0x4000000000000000)
62#define XKPHYS _LLCONST_(0x8000000000000000) 66#define XKPHYS _CONST64_(0x8000000000000000)
63#define XKSEG _LLCONST_(0xc000000000000000) 67#define XKSEG _CONST64_(0xc000000000000000)
64#define CKSEG0 _LLCONST_(0xffffffff80000000) 68#define CKSEG0 _CONST64_(0xffffffff80000000)
65#define CKSEG1 _LLCONST_(0xffffffffa0000000) 69#define CKSEG1 _CONST64_(0xffffffffa0000000)
66#define CKSSEG _LLCONST_(0xffffffffc0000000) 70#define CKSSEG _CONST64_(0xffffffffc0000000)
67#define CKSEG3 _LLCONST_(0xffffffffe0000000) 71#define CKSEG3 _CONST64_(0xffffffffe0000000)
68 72
69#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) 73#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
70#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1) 74#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
@@ -122,7 +126,7 @@
122#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p)) 126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p))
123#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p)) 127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p))
124#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) 128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
125#define PHYS_TO_XKPHYS(cm,a) (_LLCONST_(0x8000000000000000) | \ 129#define PHYS_TO_XKPHYS(cm,a) (_CONST64_(0x8000000000000000) | \
126 ((cm)<<59) | (a)) 130 ((cm)<<59) | (a))
127 131
128#if defined (CONFIG_CPU_R4300) \ 132#if defined (CONFIG_CPU_R4300) \
@@ -132,20 +136,20 @@
132 || defined (CONFIG_CPU_NEVADA) \ 136 || defined (CONFIG_CPU_NEVADA) \
133 || defined (CONFIG_CPU_TX49XX) \ 137 || defined (CONFIG_CPU_TX49XX) \
134 || defined (CONFIG_CPU_MIPS64) 138 || defined (CONFIG_CPU_MIPS64)
135#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */ 139#define TO_PHYS_MASK _CONST64_(0x0000000fffffffff) /* 2^^36 - 1 */
136#endif 140#endif
137 141
138#if defined (CONFIG_CPU_R8000) 142#if defined (CONFIG_CPU_R8000)
139/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */ 143/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
140#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 144#define TO_PHYS_MASK _CONST64_(0x000000ffffffffff) /* 2^^40 - 1 */
141#endif 145#endif
142 146
143#if defined (CONFIG_CPU_R10000) 147#if defined (CONFIG_CPU_R10000)
144#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 148#define TO_PHYS_MASK _CONST64_(0x000000ffffffffff) /* 2^^40 - 1 */
145#endif 149#endif
146 150
147#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A) 151#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A)
148#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */ 152#define TO_PHYS_MASK _CONST64_(0x00000fffffffffff) /* 2^^44 - 1 */
149#endif 153#endif
150 154
151#ifndef CONFIG_CPU_R8000 155#ifndef CONFIG_CPU_R8000
@@ -155,7 +159,7 @@
155 * in order to catch bugs in the source code. 159 * in order to catch bugs in the source code.
156 */ 160 */
157 161
158#define COMPAT_K1BASE32 _LLCONST_(0xffffffffa0000000) 162#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
159#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */ 163#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
160 164
161#endif 165#endif
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index e64abc0d8221..7978d8e11647 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -9,16 +9,8 @@
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 * 11 *
12 * Copyright (C) 1996, 97, 99, 2000, 03, 04 by Ralf Baechle 12 * Copyright (C) 1996, 97, 99, 2000, 03, 04, 06 by Ralf Baechle
13 */ 13 */
14
15/*
16 * As workaround for the ATOMIC_DEC_AND_LOCK / atomic_dec_and_lock mess in
17 * <linux/spinlock.h> we have to include <linux/spinlock.h> outside the
18 * main big wrapper ...
19 */
20#include <linux/spinlock.h>
21
22#ifndef _ASM_ATOMIC_H 14#ifndef _ASM_ATOMIC_H
23#define _ASM_ATOMIC_H 15#define _ASM_ATOMIC_H
24 16
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 1bb89c5a10ee..b9007411b60f 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -10,31 +10,26 @@
10#define _ASM_BITOPS_H 10#define _ASM_BITOPS_H
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/irqflags.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <asm/bug.h> 15#include <asm/bug.h>
15#include <asm/byteorder.h> /* sigh ... */ 16#include <asm/byteorder.h> /* sigh ... */
16#include <asm/cpu-features.h> 17#include <asm/cpu-features.h>
18#include <asm/sgidefs.h>
19#include <asm/war.h>
17 20
18#if (_MIPS_SZLONG == 32) 21#if (_MIPS_SZLONG == 32)
19#define SZLONG_LOG 5 22#define SZLONG_LOG 5
20#define SZLONG_MASK 31UL 23#define SZLONG_MASK 31UL
21#define __LL "ll " 24#define __LL "ll "
22#define __SC "sc " 25#define __SC "sc "
23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x))
24#elif (_MIPS_SZLONG == 64) 26#elif (_MIPS_SZLONG == 64)
25#define SZLONG_LOG 6 27#define SZLONG_LOG 6
26#define SZLONG_MASK 63UL 28#define SZLONG_MASK 63UL
27#define __LL "lld " 29#define __LL "lld "
28#define __SC "scd " 30#define __SC "scd "
29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x))
30#endif 31#endif
31 32
32#ifdef __KERNEL__
33
34#include <linux/irqflags.h>
35#include <asm/sgidefs.h>
36#include <asm/war.h>
37
38/* 33/*
39 * clear_bit() doesn't provide any barrier for the compiler. 34 * clear_bit() doesn't provide any barrier for the compiler.
40 */ 35 */
@@ -42,20 +37,6 @@
42#define smp_mb__after_clear_bit() smp_mb() 37#define smp_mb__after_clear_bit() smp_mb()
43 38
44/* 39/*
45 * Only disable interrupt for kernel mode stuff to keep usermode stuff
46 * that dares to use kernel include files alive.
47 */
48
49#define __bi_flags unsigned long flags
50#define __bi_local_irq_save(x) local_irq_save(x)
51#define __bi_local_irq_restore(x) local_irq_restore(x)
52#else
53#define __bi_flags
54#define __bi_local_irq_save(x)
55#define __bi_local_irq_restore(x)
56#endif /* __KERNEL__ */
57
58/*
59 * set_bit - Atomically set a bit in memory 40 * set_bit - Atomically set a bit in memory
60 * @nr: the bit to set 41 * @nr: the bit to set
61 * @addr: the address to start counting from 42 * @addr: the address to start counting from
@@ -93,13 +74,13 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
93 } else { 74 } else {
94 volatile unsigned long *a = addr; 75 volatile unsigned long *a = addr;
95 unsigned long mask; 76 unsigned long mask;
96 __bi_flags; 77 unsigned long flags;
97 78
98 a += nr >> SZLONG_LOG; 79 a += nr >> SZLONG_LOG;
99 mask = 1UL << (nr & SZLONG_MASK); 80 mask = 1UL << (nr & SZLONG_MASK);
100 __bi_local_irq_save(flags); 81 local_irq_save(flags);
101 *a |= mask; 82 *a |= mask;
102 __bi_local_irq_restore(flags); 83 local_irq_restore(flags);
103 } 84 }
104} 85}
105 86
@@ -141,13 +122,13 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
141 } else { 122 } else {
142 volatile unsigned long *a = addr; 123 volatile unsigned long *a = addr;
143 unsigned long mask; 124 unsigned long mask;
144 __bi_flags; 125 unsigned long flags;
145 126
146 a += nr >> SZLONG_LOG; 127 a += nr >> SZLONG_LOG;
147 mask = 1UL << (nr & SZLONG_MASK); 128 mask = 1UL << (nr & SZLONG_MASK);
148 __bi_local_irq_save(flags); 129 local_irq_save(flags);
149 *a &= ~mask; 130 *a &= ~mask;
150 __bi_local_irq_restore(flags); 131 local_irq_restore(flags);
151 } 132 }
152} 133}
153 134
@@ -191,13 +172,13 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
191 } else { 172 } else {
192 volatile unsigned long *a = addr; 173 volatile unsigned long *a = addr;
193 unsigned long mask; 174 unsigned long mask;
194 __bi_flags; 175 unsigned long flags;
195 176
196 a += nr >> SZLONG_LOG; 177 a += nr >> SZLONG_LOG;
197 mask = 1UL << (nr & SZLONG_MASK); 178 mask = 1UL << (nr & SZLONG_MASK);
198 __bi_local_irq_save(flags); 179 local_irq_save(flags);
199 *a ^= mask; 180 *a ^= mask;
200 __bi_local_irq_restore(flags); 181 local_irq_restore(flags);
201 } 182 }
202} 183}
203 184
@@ -258,14 +239,14 @@ static inline int test_and_set_bit(unsigned long nr,
258 volatile unsigned long *a = addr; 239 volatile unsigned long *a = addr;
259 unsigned long mask; 240 unsigned long mask;
260 int retval; 241 int retval;
261 __bi_flags; 242 unsigned long flags;
262 243
263 a += nr >> SZLONG_LOG; 244 a += nr >> SZLONG_LOG;
264 mask = 1UL << (nr & SZLONG_MASK); 245 mask = 1UL << (nr & SZLONG_MASK);
265 __bi_local_irq_save(flags); 246 local_irq_save(flags);
266 retval = (mask & *a) != 0; 247 retval = (mask & *a) != 0;
267 *a |= mask; 248 *a |= mask;
268 __bi_local_irq_restore(flags); 249 local_irq_restore(flags);
269 250
270 return retval; 251 return retval;
271 } 252 }
@@ -330,14 +311,14 @@ static inline int test_and_clear_bit(unsigned long nr,
330 volatile unsigned long *a = addr; 311 volatile unsigned long *a = addr;
331 unsigned long mask; 312 unsigned long mask;
332 int retval; 313 int retval;
333 __bi_flags; 314 unsigned long flags;
334 315
335 a += nr >> SZLONG_LOG; 316 a += nr >> SZLONG_LOG;
336 mask = 1UL << (nr & SZLONG_MASK); 317 mask = 1UL << (nr & SZLONG_MASK);
337 __bi_local_irq_save(flags); 318 local_irq_save(flags);
338 retval = (mask & *a) != 0; 319 retval = (mask & *a) != 0;
339 *a &= ~mask; 320 *a &= ~mask;
340 __bi_local_irq_restore(flags); 321 local_irq_restore(flags);
341 322
342 return retval; 323 return retval;
343 } 324 }
@@ -399,23 +380,19 @@ static inline int test_and_change_bit(unsigned long nr,
399 } else { 380 } else {
400 volatile unsigned long *a = addr; 381 volatile unsigned long *a = addr;
401 unsigned long mask, retval; 382 unsigned long mask, retval;
402 __bi_flags; 383 unsigned long flags;
403 384
404 a += nr >> SZLONG_LOG; 385 a += nr >> SZLONG_LOG;
405 mask = 1UL << (nr & SZLONG_MASK); 386 mask = 1UL << (nr & SZLONG_MASK);
406 __bi_local_irq_save(flags); 387 local_irq_save(flags);
407 retval = (mask & *a) != 0; 388 retval = (mask & *a) != 0;
408 *a ^= mask; 389 *a ^= mask;
409 __bi_local_irq_restore(flags); 390 local_irq_restore(flags);
410 391
411 return retval; 392 return retval;
412 } 393 }
413} 394}
414 395
415#undef __bi_flags
416#undef __bi_local_irq_save
417#undef __bi_local_irq_restore
418
419#include <asm-generic/bitops/non-atomic.h> 396#include <asm-generic/bitops/non-atomic.h>
420 397
421/* 398/*
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 7b4739dc8f3f..4d560a533940 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_BUG_H 1#ifndef __ASM_BUG_H
2#define __ASM_BUG_H 2#define __ASM_BUG_H
3 3
4#include <asm/sgidefs.h>
4 5
5#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
6 7
@@ -13,6 +14,17 @@ do { \
13 14
14#define HAVE_ARCH_BUG 15#define HAVE_ARCH_BUG
15 16
17#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
18
19#define BUG_ON(condition) \
20do { \
21 __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \
22} while (0)
23
24#define HAVE_ARCH_BUG_ON
25
26#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
27
16#endif 28#endif
17 29
18#include <asm-generic/bug.h> 30#include <asm-generic/bug.h>
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index a5e6050ec0f3..9b768c3b96b3 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -27,23 +27,22 @@
27 * 27 *
28 * it's best to have buff aligned on a 32-bit boundary 28 * it's best to have buff aligned on a 32-bit boundary
29 */ 29 */
30unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); 30__wsum csum_partial(const void *buff, int len, __wsum sum);
31 31
32/* 32/*
33 * this is a new version of the above that records errors it finds in *errp, 33 * this is a new version of the above that records errors it finds in *errp,
34 * but continues and zeros the rest of the buffer. 34 * but continues and zeros the rest of the buffer.
35 */ 35 */
36unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 36__wsum csum_partial_copy_from_user(const void __user *src,
37 unsigned char *dst, int len, 37 void *dst, int len,
38 unsigned int sum, int *errp); 38 __wsum sum, int *errp);
39 39
40/* 40/*
41 * Copy and checksum to user 41 * Copy and checksum to user
42 */ 42 */
43#define HAVE_CSUM_COPY_USER 43#define HAVE_CSUM_COPY_USER
44static inline unsigned int csum_and_copy_to_user (const unsigned char *src, 44static inline __wsum csum_and_copy_to_user (const void *src, void __user *dst,
45 unsigned char __user *dst, 45 int len, __wsum sum,
46 int len, int sum,
47 int *err_ptr) 46 int *err_ptr)
48{ 47{
49 might_sleep(); 48 might_sleep();
@@ -51,7 +50,7 @@ static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
51 50
52 if (copy_to_user(dst, src, len)) { 51 if (copy_to_user(dst, src, len)) {
53 *err_ptr = -EFAULT; 52 *err_ptr = -EFAULT;
54 return -1; 53 return (__force __wsum)-1;
55 } 54 }
56 55
57 return sum; 56 return sum;
@@ -61,13 +60,13 @@ static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
61 * the same as csum_partial, but copies from user space (but on MIPS 60 * the same as csum_partial, but copies from user space (but on MIPS
62 * we have just one address space, so this is identical to the above) 61 * we have just one address space, so this is identical to the above)
63 */ 62 */
64unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, 63__wsum csum_partial_copy_nocheck(const void *src, void *dst,
65 int len, unsigned int sum); 64 int len, __wsum sum);
66 65
67/* 66/*
68 * Fold a partial checksum without adding pseudo headers 67 * Fold a partial checksum without adding pseudo headers
69 */ 68 */
70static inline unsigned short int csum_fold(unsigned int sum) 69static inline __sum16 csum_fold(__wsum sum)
71{ 70{
72 __asm__( 71 __asm__(
73 " .set push # csum_fold\n" 72 " .set push # csum_fold\n"
@@ -82,7 +81,7 @@ static inline unsigned short int csum_fold(unsigned int sum)
82 : "=r" (sum) 81 : "=r" (sum)
83 : "0" (sum)); 82 : "0" (sum));
84 83
85 return sum; 84 return (__force __sum16)sum;
86} 85}
87 86
88/* 87/*
@@ -92,10 +91,10 @@ static inline unsigned short int csum_fold(unsigned int sum)
92 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by 91 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
93 * Arnt Gulbrandsen. 92 * Arnt Gulbrandsen.
94 */ 93 */
95static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 94static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
96{ 95{
97 unsigned int *word = (unsigned int *) iph; 96 const unsigned int *word = iph;
98 unsigned int *stop = word + ihl; 97 const unsigned int *stop = word + ihl;
99 unsigned int csum; 98 unsigned int csum;
100 int carry; 99 int carry;
101 100
@@ -123,9 +122,9 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
123 return csum_fold(csum); 122 return csum_fold(csum);
124} 123}
125 124
126static inline unsigned int csum_tcpudp_nofold(unsigned long saddr, 125static inline __wsum csum_tcpudp_nofold(__be32 saddr,
127 unsigned long daddr, unsigned short len, unsigned short proto, 126 __be32 daddr, unsigned short len, unsigned short proto,
128 unsigned int sum) 127 __wsum sum)
129{ 128{
130 __asm__( 129 __asm__(
131 " .set push # csum_tcpudp_nofold\n" 130 " .set push # csum_tcpudp_nofold\n"
@@ -155,9 +154,9 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
155 : "=r" (sum) 154 : "=r" (sum)
156 : "0" (daddr), "r"(saddr), 155 : "0" (daddr), "r"(saddr),
157#ifdef __MIPSEL__ 156#ifdef __MIPSEL__
158 "r" (((unsigned long)htons(len)<<16) + proto*256), 157 "r" ((proto + len) << 8),
159#else 158#else
160 "r" (((unsigned long)(proto)<<16) + len), 159 "r" (proto + len),
161#endif 160#endif
162 "r" (sum)); 161 "r" (sum));
163 162
@@ -168,11 +167,10 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
168 * computes the checksum of the TCP/UDP pseudo-header 167 * computes the checksum of the TCP/UDP pseudo-header
169 * returns a 16-bit checksum, already complemented 168 * returns a 16-bit checksum, already complemented
170 */ 169 */
171static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 170static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
172 unsigned long daddr,
173 unsigned short len, 171 unsigned short len,
174 unsigned short proto, 172 unsigned short proto,
175 unsigned int sum) 173 __wsum sum)
176{ 174{
177 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 175 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
178} 176}
@@ -181,17 +179,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
181 * this routine is used for miscellaneous IP-like checksums, mainly 179 * this routine is used for miscellaneous IP-like checksums, mainly
182 * in icmp.c 180 * in icmp.c
183 */ 181 */
184static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 182static inline __sum16 ip_compute_csum(const void *buff, int len)
185{ 183{
186 return csum_fold(csum_partial(buff, len, 0)); 184 return csum_fold(csum_partial(buff, len, 0));
187} 185}
188 186
189#define _HAVE_ARCH_IPV6_CSUM 187#define _HAVE_ARCH_IPV6_CSUM
190static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 188static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
191 struct in6_addr *daddr, 189 const struct in6_addr *daddr,
192 __u32 len, 190 __u32 len, unsigned short proto,
193 unsigned short proto, 191 __wsum sum)
194 unsigned int sum)
195{ 192{
196 __asm__( 193 __asm__(
197 " .set push # csum_ipv6_magic\n" 194 " .set push # csum_ipv6_magic\n"
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index a2f0c8ea9160..610d0cdeaa9e 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -22,12 +22,12 @@
22 * Descriptor for a cache 22 * Descriptor for a cache
23 */ 23 */
24struct cache_desc { 24struct cache_desc {
25 unsigned short linesz; /* Size of line in bytes */
26 unsigned short ways; /* Number of ways */
27 unsigned short sets; /* Number of lines per set */
28 unsigned int waysize; /* Bytes per way */ 25 unsigned int waysize; /* Bytes per way */
29 unsigned int waybit; /* Bits to select in a cache set */ 26 unsigned short sets; /* Number of lines per set */
30 unsigned int flags; /* Flags describing cache properties */ 27 unsigned char ways; /* Number of ways */
28 unsigned char linesz; /* Size of line in bytes */
29 unsigned char waybit; /* Bits to select in a cache set */
30 unsigned char flags; /* Flags describing cache properties */
31}; 31};
32 32
33/* 33/*
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
index 8319ad77b250..93430b5f4724 100644
--- a/include/asm-mips/dec/kn02.h
+++ b/include/asm-mips/dec/kn02.h
@@ -82,11 +82,9 @@
82 82
83#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
84 84
85#include <linux/spinlock.h>
86#include <linux/types.h> 85#include <linux/types.h>
87 86
88extern u32 cached_kn02_csr; 87extern u32 cached_kn02_csr;
89extern spinlock_t kn02_lock;
90extern void init_kn02_irqs(int base); 88extern void init_kn02_irqs(int base);
91#endif 89#endif
92 90
diff --git a/include/asm-mips/device.h b/include/asm-mips/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-mips/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index e85849ac165f..23f789c80845 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -74,7 +74,9 @@
74 * 74 *
75 */ 75 */
76 76
77#ifndef GENERIC_ISA_DMA_SUPPORT_BROKEN
77#define MAX_DMA_CHANNELS 8 78#define MAX_DMA_CHANNELS 8
79#endif
78 80
79/* 81/*
80 * The maximum address in KSEG0 that we can perform a DMA transfer to on this 82 * The maximum address in KSEG0 that we can perform a DMA transfer to on this
diff --git a/include/asm-mips/gt64120.h b/include/asm-mips/gt64120.h
index 2edd171bb6cd..4bf8e28f8850 100644
--- a/include/asm-mips/gt64120.h
+++ b/include/asm-mips/gt64120.h
@@ -451,6 +451,13 @@
451#define GT_SDRAM_OPMODE_OP_MODE 3 451#define GT_SDRAM_OPMODE_OP_MODE 3
452#define GT_SDRAM_OPMODE_OP_CBR 4 452#define GT_SDRAM_OPMODE_OP_CBR 4
453 453
454#define GT_TC_CONTROL_ENTC0_SHF 0
455#define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF)
456#define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK
457#define GT_TC_CONTROL_SELTC0_SHF 1
458#define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF)
459#define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK
460
454 461
455#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0 462#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
456#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF) 463#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
@@ -523,6 +530,13 @@
523#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF) 530#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
524#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK 531#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
525 532
533#define GT_INTR_T0EXP_SHF 8
534#define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF)
535#define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK
536#define GT_INTR_RETRYCTR0_SHF 20
537#define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF)
538#define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK
539
526/* 540/*
527 * Misc 541 * Misc
528 */ 542 */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index bc5f3c53155f..d77b657c09c7 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -113,7 +113,7 @@ static inline void set_io_port_base(unsigned long base)
113 * almost all conceivable cases a device driver should not be using 113 * almost all conceivable cases a device driver should not be using
114 * this function 114 * this function
115 */ 115 */
116static inline unsigned long virt_to_phys(volatile void * address) 116static inline unsigned long virt_to_phys(volatile const void *address)
117{ 117{
118 return (unsigned long)address - PAGE_OFFSET; 118 return (unsigned long)address - PAGE_OFFSET;
119} 119}
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 35a05ca5560c..67657089efa7 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -24,8 +24,6 @@ static inline int irq_canonicalize(int irq)
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif 25#endif
26 26
27extern asmlinkage unsigned int do_IRQ(unsigned int irq);
28
29#ifdef CONFIG_MIPS_MT_SMTC 27#ifdef CONFIG_MIPS_MT_SMTC
30/* 28/*
31 * Clear interrupt mask handling "backstop" if irq_hwmask 29 * Clear interrupt mask handling "backstop" if irq_hwmask
@@ -43,8 +41,6 @@ do { \
43#define __DO_IRQ_SMTC_HOOK() do { } while (0) 41#define __DO_IRQ_SMTC_HOOK() do { } while (0)
44#endif 42#endif
45 43
46#ifdef CONFIG_PREEMPT
47
48/* 44/*
49 * do_IRQ handles all normal device IRQ's (the special 45 * do_IRQ handles all normal device IRQ's (the special
50 * SMP cross-CPU interrupts have their own specific 46 * SMP cross-CPU interrupts have their own specific
@@ -57,12 +53,10 @@ do { \
57do { \ 53do { \
58 irq_enter(); \ 54 irq_enter(); \
59 __DO_IRQ_SMTC_HOOK(); \ 55 __DO_IRQ_SMTC_HOOK(); \
60 __do_IRQ((irq)); \ 56 generic_handle_irq(irq); \
61 irq_exit(); \ 57 irq_exit(); \
62} while (0) 58} while (0)
63 59
64#endif
65
66extern void arch_init_irq(void); 60extern void arch_init_irq(void);
67extern void spurious_interrupt(void); 61extern void spurious_interrupt(void);
68 62
diff --git a/include/asm-mips/kexec.h b/include/asm-mips/kexec.h
new file mode 100644
index 000000000000..b25267ebcb09
--- /dev/null
+++ b/include/asm-mips/kexec.h
@@ -0,0 +1,32 @@
1/*
2 * kexec.h for kexec
3 * Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006
4 *
5 * This source code is licensed under the GNU General Public License,
6 * Version 2. See the file COPYING for more details.
7 */
8
9#ifndef _MIPS_KEXEC
10# define _MIPS_KEXEC
11
12/* Maximum physical address we can use pages from */
13#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
14/* Maximum address we can reach in physical address mode */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
16 /* Maximum address we can use for the control code buffer */
17#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
18
19#define KEXEC_CONTROL_CODE_SIZE 4096
20
21/* The native architecture */
22#define KEXEC_ARCH KEXEC_ARCH_MIPS
23
24#define MAX_NOTE_BYTES 1024
25
26static inline void crash_setup_regs(struct pt_regs *newregs,
27 struct pt_regs *oldregs)
28{
29 /* Dummy implementation for now */
30}
31
32#endif /* !_MIPS_KEXEC */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index 301e71300779..e9fa252f8a3f 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -170,10 +170,8 @@ int __init auide_probe(void);
170 static int auide_dma_host_on(ide_drive_t *drive); 170 static int auide_dma_host_on(ide_drive_t *drive);
171 static int auide_dma_lostirq(ide_drive_t *drive); 171 static int auide_dma_lostirq(ide_drive_t *drive);
172 static int auide_dma_on(ide_drive_t *drive); 172 static int auide_dma_on(ide_drive_t *drive);
173 static void auide_ddma_tx_callback(int irq, void *param, 173 static void auide_ddma_tx_callback(int irq, void *param);
174 struct pt_regs *regs); 174 static void auide_ddma_rx_callback(int irq, void *param);
175 static void auide_ddma_rx_callback(int irq, void *param,
176 struct pt_regs *regs);
177 static int auide_dma_off_quietly(ide_drive_t *drive); 175 static int auide_dma_off_quietly(ide_drive_t *drive);
178#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 176#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
179 177
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index b3c5ecbec03c..00b0fc68d5cb 100644
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
@@ -67,34 +67,9 @@
67#define COBALT_BRD_ID_QUBE2 0x5 67#define COBALT_BRD_ID_QUBE2 0x5
68#define COBALT_BRD_ID_RAQ2 0x6 68#define COBALT_BRD_ID_RAQ2 0x6
69 69
70/*
71 * Galileo chipset access macros for the Cobalt. The base address for
72 * the GT64111 chip is 0x14000000
73 *
74 * Most of this really should go into a separate GT64111 header file.
75 */
76#define GT64111_IO_BASE 0x10000000UL
77#define GT64111_IO_END 0x11ffffffUL
78#define GT64111_MEM_BASE 0x12000000UL
79#define GT64111_MEM_END 0x13ffffffUL
80#define GT64111_BASE 0x14000000UL
81#define GALILEO_REG(ofs) CKSEG1ADDR(GT64111_BASE + (unsigned long)(ofs))
82
83#define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port))
84#define GALILEO_OUTL(val, port) \
85do { \
86 *(volatile unsigned int *) GALILEO_REG(port) = (val); \
87} while (0)
88
89#define GALILEO_INTR_T0EXP (1 << 8)
90#define GALILEO_INTR_RETRY_CTR (1 << 20)
91
92#define GALILEO_ENTC0 0x01
93#define GALILEO_SELTC0 0x02
94
95#define PCI_CFG_SET(devfn,where) \ 70#define PCI_CFG_SET(devfn,where) \
96 GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \ 71 GT_WRITE(GT_PCI0_CFGADDR_OFS, (0x80000000 | (PCI_SLOT (devfn) << 11) | \
97 (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS) 72 (PCI_FUNC (devfn) << 8) | (where)))
98 73
99#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000)) 74#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000))
100# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */ 75# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */
diff --git a/include/asm-mips/mach-cobalt/mach-gt64120.h b/include/asm-mips/mach-cobalt/mach-gt64120.h
index 587fc4378f44..ae9c5523c7ef 100644
--- a/include/asm-mips/mach-cobalt/mach-gt64120.h
+++ b/include/asm-mips/mach-cobalt/mach-gt64120.h
@@ -1 +1,27 @@
1/* there's something here ... in the dark */ 1/*
2 * Copyright (C) 2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
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 the
12 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef _COBALT_MACH_GT64120_H
19#define _COBALT_MACH_GT64120_H
20
21/*
22 * Cobalt uses GT64111. GT64111 is almost the same as GT64120.
23 */
24
25#define GT64120_BASE CKSEG1ADDR(GT_DEF_BASE)
26
27#endif /* _COBALT_MACH_GT64120_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 1f318d707998..9985cb7c16e7 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -545,62 +545,6 @@
545#define MIPS_FPIR_L (_ULCAST_(1) << 21) 545#define MIPS_FPIR_L (_ULCAST_(1) << 21)
546#define MIPS_FPIR_F64 (_ULCAST_(1) << 22) 546#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
547 547
548/*
549 * R10000 performance counter definitions.
550 *
551 * FIXME: The R10000 performance counter opens a nice way to implement CPU
552 * time accounting with a precission of one cycle. I don't have
553 * R10000 silicon but just a manual, so ...
554 */
555
556/*
557 * Events counted by counter #0
558 */
559#define CE0_CYCLES 0
560#define CE0_INSN_ISSUED 1
561#define CE0_LPSC_ISSUED 2
562#define CE0_S_ISSUED 3
563#define CE0_SC_ISSUED 4
564#define CE0_SC_FAILED 5
565#define CE0_BRANCH_DECODED 6
566#define CE0_QW_WB_SECONDARY 7
567#define CE0_CORRECTED_ECC_ERRORS 8
568#define CE0_ICACHE_MISSES 9
569#define CE0_SCACHE_I_MISSES 10
570#define CE0_SCACHE_I_WAY_MISSPREDICTED 11
571#define CE0_EXT_INTERVENTIONS_REQ 12
572#define CE0_EXT_INVALIDATE_REQ 13
573#define CE0_VIRTUAL_COHERENCY_COND 14
574#define CE0_INSN_GRADUATED 15
575
576/*
577 * Events counted by counter #1
578 */
579#define CE1_CYCLES 0
580#define CE1_INSN_GRADUATED 1
581#define CE1_LPSC_GRADUATED 2
582#define CE1_S_GRADUATED 3
583#define CE1_SC_GRADUATED 4
584#define CE1_FP_INSN_GRADUATED 5
585#define CE1_QW_WB_PRIMARY 6
586#define CE1_TLB_REFILL 7
587#define CE1_BRANCH_MISSPREDICTED 8
588#define CE1_DCACHE_MISS 9
589#define CE1_SCACHE_D_MISSES 10
590#define CE1_SCACHE_D_WAY_MISSPREDICTED 11
591#define CE1_EXT_INTERVENTION_HITS 12
592#define CE1_EXT_INVALIDATE_REQ 13
593#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14
594#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15
595
596/*
597 * These flags define in which privilege mode the counters count events
598 */
599#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */
600#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */
601#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
602#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
603
604#ifndef __ASSEMBLY__ 548#ifndef __ASSEMBLY__
605 549
606/* 550/*
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 85b258ee7090..0dc1a45c27ed 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,7 +34,9 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37#include <linux/pfn.h>
37#include <asm/cpu-features.h> 38#include <asm/cpu-features.h>
39#include <asm/io.h>
38 40
39extern void clear_page(void * page); 41extern void clear_page(void * page);
40extern void copy_page(void * to, void * from); 42extern void copy_page(void * to, void * from);
@@ -134,8 +136,14 @@ typedef struct { unsigned long pgprot; } pgprot_t;
134/* to align the pointer to the (next) page boundary */ 136/* to align the pointer to the (next) page boundary */
135#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 137#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
136 138
137#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 139#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
138#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 140#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
141#else
142#define __pa_page_offset(x) PAGE_OFFSET
143#endif
144#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
145#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
146#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
139 147
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 148#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141 149
@@ -160,8 +168,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
160 168
161#endif 169#endif
162 170
163#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 171#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
164#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 172#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr)))
165 173
166#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 174#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
167 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 175 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 7e7320300aa3..b9b1e86493ee 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -14,6 +14,7 @@
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/cachectl.h> 16#include <asm/cachectl.h>
17#include <asm/fixmap.h>
17 18
18#include <asm-generic/pgtable-nopud.h> 19#include <asm-generic/pgtable-nopud.h>
19 20
@@ -103,6 +104,13 @@
103#define VMALLOC_START MAP_BASE 104#define VMALLOC_START MAP_BASE
104#define VMALLOC_END \ 105#define VMALLOC_END \
105 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE) 106 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
107#if defined(CONFIG_MODULES) && !defined(CONFIG_BUILD_ELF64) && \
108 VMALLOC_START != CKSSEG
109/* Load modules into 32bit-compatible segment. */
110#define MODULE_START CKSSEG
111#define MODULE_END (FIXADDR_START-2*PAGE_SIZE)
112extern pgd_t module_pg_dir[PTRS_PER_PGD];
113#endif
106 114
107#define pte_ERROR(e) \ 115#define pte_ERROR(e) \
108 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) 116 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
@@ -174,7 +182,12 @@ static inline void pud_clear(pud_t *pudp)
174#define __pmd_offset(address) pmd_index(address) 182#define __pmd_offset(address) pmd_index(address)
175 183
176/* to find an entry in a kernel page-table-directory */ 184/* to find an entry in a kernel page-table-directory */
185#ifdef MODULE_START
186#define pgd_offset_k(address) \
187 ((address) >= MODULE_START ? module_pg_dir : pgd_offset(&init_mm, 0UL))
188#else
177#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL) 189#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL)
190#endif
178 191
179#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 192#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
180#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 193#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 1ca4d1e185c7..f2e1325fec6c 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -67,7 +67,7 @@ extern unsigned long empty_zero_page;
67extern unsigned long zero_page_mask; 67extern unsigned long zero_page_mask;
68 68
69#define ZERO_PAGE(vaddr) \ 69#define ZERO_PAGE(vaddr) \
70 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) 70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
71 71
72#define __HAVE_ARCH_MOVE_PTE 72#define __HAVE_ARCH_MOVE_PTE
73#define move_pte(pte, prot, old_addr, new_addr) \ 73#define move_pte(pte, prot, old_addr, new_addr) \
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 5f3a9075cd28..30bf555faeaa 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -80,8 +80,6 @@ struct pt_regs {
80#define instruction_pointer(regs) ((regs)->cp0_epc) 80#define instruction_pointer(regs) ((regs)->cp0_epc)
81#define profile_pc(regs) instruction_pointer(regs) 81#define profile_pc(regs) instruction_pointer(regs)
82 82
83extern void show_regs(struct pt_regs *);
84
85extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); 83extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
86 84
87#endif 85#endif
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 625acd337bc3..a632cef830a2 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -21,6 +21,7 @@
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/clocksource.h>
24 25
25extern spinlock_t rtc_lock; 26extern spinlock_t rtc_lock;
26 27
@@ -44,12 +45,10 @@ extern int (*mips_timer_state)(void);
44extern void (*mips_timer_ack)(void); 45extern void (*mips_timer_ack)(void);
45 46
46/* 47/*
47 * High precision timer functions. 48 * High precision timer clocksource.
48 * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted. 49 * If .read is NULL, an R4k-compatible timer setup is attempted.
49 */ 50 */
50extern unsigned int (*mips_hpt_read)(void); 51extern struct clocksource clocksource_mips;
51extern void (*mips_hpt_init)(void);
52extern unsigned int mips_hpt_mask;
53 52
54/* 53/*
55 * to_tm() converts system time back to (year, mon, day, hour, min, sec). 54 * to_tm() converts system time back to (year, mon, day, hour, min, sec).
diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
index 229cb56fdb7a..cc3ec1bd8919 100644
--- a/include/asm-parisc/checksum.h
+++ b/include/asm-parisc/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18extern unsigned int csum_partial(const unsigned char *, int, unsigned int); 18extern __wsum csum_partial(const void *, int, __wsum);
19 19
20/* 20/*
21 * The same as csum_partial, but copies from src while it checksums. 21 * The same as csum_partial, but copies from src while it checksums.
@@ -23,15 +23,14 @@ extern unsigned int csum_partial(const unsigned char *, int, unsigned int);
23 * Here even more important to align src and dst on a 32-bit (or even 23 * Here even more important to align src and dst on a 32-bit (or even
24 * better 64-bit) boundary 24 * better 64-bit) boundary
25 */ 25 */
26extern unsigned int csum_partial_copy_nocheck(const unsigned char *, unsigned char *, 26extern __wsum csum_partial_copy_nocheck(const void *, void *, int, __wsum);
27 int, unsigned int);
28 27
29/* 28/*
30 * this is a new version of the above that records errors it finds in *errp, 29 * this is a new version of the above that records errors it finds in *errp,
31 * but continues and zeros the rest of the buffer. 30 * but continues and zeros the rest of the buffer.
32 */ 31 */
33extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 32extern __wsum csum_partial_copy_from_user(const void __user *src,
34 unsigned char *dst, int len, unsigned int sum, int *errp); 33 void *dst, int len, __wsum sum, int *errp);
35 34
36/* 35/*
37 * Optimized for IP headers, which always checksum on 4 octet boundaries. 36 * Optimized for IP headers, which always checksum on 4 octet boundaries.
@@ -39,11 +38,10 @@ extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
39 * Written by Randolph Chung <tausq@debian.org>, and then mucked with by 38 * Written by Randolph Chung <tausq@debian.org>, and then mucked with by
40 * LaMont Jones <lamont@debian.org> 39 * LaMont Jones <lamont@debian.org>
41 */ 40 */
42static inline unsigned short ip_fast_csum(unsigned char * iph, 41static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
43 unsigned int ihl) { 42{
44 unsigned int sum; 43 unsigned int sum;
45 44
46
47 __asm__ __volatile__ ( 45 __asm__ __volatile__ (
48" ldws,ma 4(%1), %0\n" 46" ldws,ma 4(%1), %0\n"
49" addib,<= -4, %2, 2f\n" 47" addib,<= -4, %2, 2f\n"
@@ -69,27 +67,27 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
69 : "1" (iph), "2" (ihl) 67 : "1" (iph), "2" (ihl)
70 : "r19", "r20", "r21" ); 68 : "r19", "r20", "r21" );
71 69
72 return(sum); 70 return (__force __sum16)sum;
73} 71}
74 72
75/* 73/*
76 * Fold a partial checksum 74 * Fold a partial checksum
77 */ 75 */
78static inline unsigned int csum_fold(unsigned int sum) 76static inline __sum16 csum_fold(__wsum csum)
79{ 77{
78 u32 sum = (__force u32)csum;
80 /* add the swapped two 16-bit halves of sum, 79 /* add the swapped two 16-bit halves of sum,
81 a possible carry from adding the two 16-bit halves, 80 a possible carry from adding the two 16-bit halves,
82 will carry from the lower half into the upper half, 81 will carry from the lower half into the upper half,
83 giving us the correct sum in the upper half. */ 82 giving us the correct sum in the upper half. */
84 sum += (sum << 16) + (sum >> 16); 83 sum += (sum << 16) + (sum >> 16);
85 return (~sum) >> 16; 84 return (__force __sum16)(~sum >> 16);
86} 85}
87 86
88static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 87static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
89 unsigned long daddr,
90 unsigned short len, 88 unsigned short len,
91 unsigned short proto, 89 unsigned short proto,
92 unsigned int sum) 90 __wsum sum)
93{ 91{
94 __asm__( 92 __asm__(
95 " add %1, %0, %0\n" 93 " add %1, %0, %0\n"
@@ -97,19 +95,18 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
97 " addc %3, %0, %0\n" 95 " addc %3, %0, %0\n"
98 " addc %%r0, %0, %0\n" 96 " addc %%r0, %0, %0\n"
99 : "=r" (sum) 97 : "=r" (sum)
100 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); 98 : "r" (daddr), "r"(saddr), "r"(proto+len), "0"(sum));
101 return sum; 99 return sum;
102} 100}
103 101
104/* 102/*
105 * computes the checksum of the TCP/UDP pseudo-header 103 * computes the checksum of the TCP/UDP pseudo-header
106 * returns a 16-bit checksum, already complemented 104 * returns a 16-bit checksum, already complemented
107 */ 105 */
108static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
109 unsigned long daddr,
110 unsigned short len, 107 unsigned short len,
111 unsigned short proto, 108 unsigned short proto,
112 unsigned int sum) 109 __wsum sum)
113{ 110{
114 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 111 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
115} 112}
@@ -118,17 +115,17 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
118 * this routine is used for miscellaneous IP-like checksums, mainly 115 * this routine is used for miscellaneous IP-like checksums, mainly
119 * in icmp.c 116 * in icmp.c
120 */ 117 */
121static inline unsigned short ip_compute_csum(unsigned char * buf, int len) { 118static inline __sum16 ip_compute_csum(const void *buf, int len)
119{
122 return csum_fold (csum_partial(buf, len, 0)); 120 return csum_fold (csum_partial(buf, len, 0));
123} 121}
124 122
125 123
126#define _HAVE_ARCH_IPV6_CSUM 124#define _HAVE_ARCH_IPV6_CSUM
127static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 125static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
128 struct in6_addr *daddr, 126 const struct in6_addr *daddr,
129 __u16 len, 127 __u32 len, unsigned short proto,
130 unsigned short proto, 128 __wsum sum)
131 unsigned int sum)
132{ 129{
133 __asm__ __volatile__ ( 130 __asm__ __volatile__ (
134 131
@@ -193,9 +190,9 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
193 * Copy and checksum to user 190 * Copy and checksum to user
194 */ 191 */
195#define HAVE_CSUM_COPY_USER 192#define HAVE_CSUM_COPY_USER
196static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src, 193static __inline__ __wsum csum_and_copy_to_user(const void *src,
197 unsigned char __user *dst, 194 void __user *dst,
198 int len, int sum, 195 int len, __wsum sum,
199 int *err_ptr) 196 int *err_ptr)
200{ 197{
201 /* code stolen from include/asm-mips64 */ 198 /* code stolen from include/asm-mips64 */
@@ -203,7 +200,7 @@ static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src,
203 200
204 if (copy_to_user(dst, src, len)) { 201 if (copy_to_user(dst, src, len)) {
205 *err_ptr = -EFAULT; 202 *err_ptr = -EFAULT;
206 return -1; 203 return (__force __wsum)-1;
207 } 204 }
208 205
209 return sum; 206 return sum;
diff --git a/include/asm-parisc/device.h b/include/asm-parisc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-parisc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-parisc/dma.h b/include/asm-parisc/dma.h
index da2cf373e31c..31ad0f05af3d 100644
--- a/include/asm-parisc/dma.h
+++ b/include/asm-parisc/dma.h
@@ -17,10 +17,10 @@
17 17
18/* 18/*
19** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up 19** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up
20** (or rather not merge) DMA's into managable chunks. 20** (or rather not merge) DMAs into manageable chunks.
21** On parisc, this is more of the software/tuning constraint 21** On parisc, this is more of the software/tuning constraint
22** rather than the HW. I/O MMU allocation alogorithms can be 22** rather than the HW. I/O MMU allocation algorithms can be
23** faster with smaller size is (to some degree). 23** faster with smaller sizes (to some degree).
24*/ 24*/
25#define DMA_CHUNK_SIZE (BITS_PER_LONG*PAGE_SIZE) 25#define DMA_CHUNK_SIZE (BITS_PER_LONG*PAGE_SIZE)
26 26
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index 7b8ad118d2fe..7b3be9ac0dda 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -149,7 +149,7 @@ extern int parisc_bus_is_phys; /* in arch/parisc/kernel/setup.c */
149/* 149/*
150** Most PCI devices (eg Tulip, NCR720) also export the same registers 150** Most PCI devices (eg Tulip, NCR720) also export the same registers
151** to both MMIO and I/O port space. Due to poor performance of I/O Port 151** to both MMIO and I/O port space. Due to poor performance of I/O Port
152** access under HP PCI bus adapters, strongly reccomend use of MMIO 152** access under HP PCI bus adapters, strongly recommend the use of MMIO
153** address space. 153** address space.
154** 154**
155** While I'm at it more PA programming notes: 155** While I'm at it more PA programming notes:
diff --git a/include/asm-parisc/ropes.h b/include/asm-parisc/ropes.h
index 5542dd00472b..007a880615eb 100644
--- a/include/asm-parisc/ropes.h
+++ b/include/asm-parisc/ropes.h
@@ -14,7 +14,7 @@
14#endif 14#endif
15 15
16/* 16/*
17** The number of pdir entries to "free" before issueing 17** The number of pdir entries to "free" before issuing
18** a read to PCOM register to flush out PCOM writes. 18** a read to PCOM register to flush out PCOM writes.
19** Interacts with allocation granularity (ie 4 or 8 entries 19** Interacts with allocation granularity (ie 4 or 8 entries
20** allocated and free'd/purged at a time might make this 20** allocated and free'd/purged at a time might make this
diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h
index c9ee41cd0707..d45827a21f94 100644
--- a/include/asm-parisc/semaphore.h
+++ b/include/asm-parisc/semaphore.h
@@ -115,7 +115,8 @@ extern __inline__ int down_interruptible(struct semaphore * sem)
115 */ 115 */
116extern __inline__ int down_trylock(struct semaphore * sem) 116extern __inline__ int down_trylock(struct semaphore * sem)
117{ 117{
118 int flags, count; 118 unsigned long flags;
119 int count;
119 120
120 spin_lock_irqsave(&sem->sentry, flags); 121 spin_lock_irqsave(&sem->sentry, flags);
121 count = sem->count - 1; 122 count = sem->count - 1;
@@ -131,7 +132,8 @@ extern __inline__ int down_trylock(struct semaphore * sem)
131 */ 132 */
132extern __inline__ void up(struct semaphore * sem) 133extern __inline__ void up(struct semaphore * sem)
133{ 134{
134 int flags; 135 unsigned long flags;
136
135 spin_lock_irqsave(&sem->sentry, flags); 137 spin_lock_irqsave(&sem->sentry, flags);
136 if (sem->count < 0) { 138 if (sem->count < 0) {
137 __up(sem); 139 __up(sem);
diff --git a/include/asm-powerpc/checksum.h b/include/asm-powerpc/checksum.h
index 609ecbbd7210..7cdf358337cf 100644
--- a/include/asm-powerpc/checksum.h
+++ b/include/asm-powerpc/checksum.h
@@ -14,17 +14,16 @@
14 * which always checksum on 4 octet boundaries. ihl is the number 14 * which always checksum on 4 octet boundaries. ihl is the number
15 * of 32-bit words and is always >= 5. 15 * of 32-bit words and is always >= 5.
16 */ 16 */
17extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 17extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
18 18
19/* 19/*
20 * computes the checksum of the TCP/UDP pseudo-header 20 * computes the checksum of the TCP/UDP pseudo-header
21 * returns a 16-bit checksum, already complemented 21 * returns a 16-bit checksum, already complemented
22 */ 22 */
23extern unsigned short csum_tcpudp_magic(unsigned long saddr, 23extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
24 unsigned long daddr,
25 unsigned short len, 24 unsigned short len,
26 unsigned short proto, 25 unsigned short proto,
27 unsigned int sum); 26 __wsum sum);
28 27
29/* 28/*
30 * computes the checksum of a memory block at buff, length len, 29 * computes the checksum of a memory block at buff, length len,
@@ -38,8 +37,7 @@ extern unsigned short csum_tcpudp_magic(unsigned long saddr,
38 * 37 *
39 * it's best to have buff aligned on a 32-bit boundary 38 * it's best to have buff aligned on a 32-bit boundary
40 */ 39 */
41extern unsigned int csum_partial(const unsigned char * buff, int len, 40extern __wsum csum_partial(const void *buff, int len, __wsum sum);
42 unsigned int sum);
43 41
44/* 42/*
45 * Computes the checksum of a memory block at src, length len, 43 * Computes the checksum of a memory block at src, length len,
@@ -51,20 +49,15 @@ extern unsigned int csum_partial(const unsigned char * buff, int len,
51 * Like csum_partial, this must be called with even lengths, 49 * Like csum_partial, this must be called with even lengths,
52 * except for the last fragment. 50 * except for the last fragment.
53 */ 51 */
54extern unsigned int csum_partial_copy_generic(const char *src, char *dst, 52extern __wsum csum_partial_copy_generic(const void *src, void *dst,
55 int len, unsigned int sum, 53 int len, __wsum sum,
56 int *src_err, int *dst_err); 54 int *src_err, int *dst_err);
57/* 55/*
58 * the same as csum_partial, but copies from src to dst while it 56 * the same as csum_partial, but copies from src to dst while it
59 * checksums. 57 * checksums.
60 */ 58 */
61unsigned int csum_partial_copy_nocheck(const char *src,
62 char *dst,
63 int len,
64 unsigned int sum);
65
66#define csum_partial_copy_from_user(src, dst, len, sum, errp) \ 59#define csum_partial_copy_from_user(src, dst, len, sum, errp) \
67 csum_partial_copy_generic((src), (dst), (len), (sum), (errp), NULL) 60 csum_partial_copy_generic((__force const void *)(src), (dst), (len), (sum), (errp), NULL)
68 61
69#define csum_partial_copy_nocheck(src, dst, len, sum) \ 62#define csum_partial_copy_nocheck(src, dst, len, sum) \
70 csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL) 63 csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL)
@@ -74,7 +67,7 @@ unsigned int csum_partial_copy_nocheck(const char *src,
74 * turns a 32-bit partial checksum (e.g. from csum_partial) into a 67 * turns a 32-bit partial checksum (e.g. from csum_partial) into a
75 * 1's complement 16-bit checksum. 68 * 1's complement 16-bit checksum.
76 */ 69 */
77static inline unsigned int csum_fold(unsigned int sum) 70static inline __sum16 csum_fold(__wsum sum)
78{ 71{
79 unsigned int tmp; 72 unsigned int tmp;
80 73
@@ -83,41 +76,32 @@ static inline unsigned int csum_fold(unsigned int sum)
83 /* if there is a carry from adding the two 16-bit halves, 76 /* if there is a carry from adding the two 16-bit halves,
84 it will carry from the lower half into the upper half, 77 it will carry from the lower half into the upper half,
85 giving us the correct sum in the upper half. */ 78 giving us the correct sum in the upper half. */
86 sum = ~(sum + tmp) >> 16; 79 return (__force __sum16)(~((__force u32)sum + tmp) >> 16);
87 return sum;
88} 80}
89 81
90/* 82/*
91 * this routine is used for miscellaneous IP-like checksums, mainly 83 * this routine is used for miscellaneous IP-like checksums, mainly
92 * in icmp.c 84 * in icmp.c
93 */ 85 */
94static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 86static inline __sum16 ip_compute_csum(const void *buff, int len)
95{ 87{
96 return csum_fold(csum_partial(buff, len, 0)); 88 return csum_fold(csum_partial(buff, len, 0));
97} 89}
98 90
99#ifdef __powerpc64__ 91static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
100static inline u32 csum_tcpudp_nofold(u32 saddr,
101 u32 daddr,
102 unsigned short len, 92 unsigned short len,
103 unsigned short proto, 93 unsigned short proto,
104 unsigned int sum) 94 __wsum sum)
105{ 95{
106 unsigned long s = sum; 96#ifdef __powerpc64__
97 unsigned long s = (__force u32)sum;
107 98
108 s += saddr; 99 s += (__force u32)saddr;
109 s += daddr; 100 s += (__force u32)daddr;
110 s += (proto << 16) + len; 101 s += proto + len;
111 s += (s >> 32); 102 s += (s >> 32);
112 return (u32) s; 103 return (__force __wsum) s;
113}
114#else 104#else
115static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
116 unsigned long daddr,
117 unsigned short len,
118 unsigned short proto,
119 unsigned int sum)
120{
121 __asm__("\n\ 105 __asm__("\n\
122 addc %0,%0,%1 \n\ 106 addc %0,%0,%1 \n\
123 adde %0,%0,%2 \n\ 107 adde %0,%0,%2 \n\
@@ -125,10 +109,9 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
125 addze %0,%0 \n\ 109 addze %0,%0 \n\
126 " 110 "
127 : "=r" (sum) 111 : "=r" (sum)
128 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); 112 : "r" (daddr), "r"(saddr), "r"(proto + len), "0"(sum));
129 return sum; 113 return sum;
130}
131
132#endif 114#endif
115}
133#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
134#endif 117#endif
diff --git a/include/asm-powerpc/device.h b/include/asm-powerpc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-powerpc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 46afd29b904e..721c97f09b20 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -62,19 +62,13 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
62} 62}
63 63
64#ifdef CONFIG_PPC64 64#ifdef CONFIG_PPC64
65#define HAVE_ARCH_PCI_MWI 1 65
66static inline int pcibios_prep_mwi(struct pci_dev *dev) 66/*
67{ 67 * We want to avoid touching the cacheline size or MWI bit.
68 /* 68 * pSeries firmware sets the cacheline size (which is not the cpu cacheline
69 * We would like to avoid touching the cacheline size or MWI bit 69 * size in all cases) and hardware treats MWI the same as memory write.
70 * but we cant do that with the current pcibios_prep_mwi 70 */
71 * interface. pSeries firmware sets the cacheline size (which is not 71#define PCI_DISABLE_MWI
72 * the cpu cacheline size in all cases) and hardware treats MWI
73 * the same as memory write. So we dont touch the cacheline size
74 * here and allow the generic code to set the MWI bit.
75 */
76 return 0;
77}
78 72
79extern struct dma_mapping_ops pci_dma_ops; 73extern struct dma_mapping_ops pci_dma_ops;
80 74
diff --git a/include/asm-ppc/device.h b/include/asm-ppc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-ppc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 37c362d89fad..0a3cd7ec8451 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -27,8 +27,8 @@
27 * 27 *
28 * it's best to have buff aligned on a 32-bit boundary 28 * it's best to have buff aligned on a 32-bit boundary
29 */ 29 */
30static inline unsigned int 30static inline __wsum
31csum_partial(const unsigned char * buff, int len, unsigned int sum) 31csum_partial(const void *buff, int len, __wsum sum)
32{ 32{
33 register unsigned long reg2 asm("2") = (unsigned long) buff; 33 register unsigned long reg2 asm("2") = (unsigned long) buff;
34 register unsigned long reg3 asm("3") = (unsigned long) len; 34 register unsigned long reg3 asm("3") = (unsigned long) len;
@@ -49,9 +49,9 @@ csum_partial(const unsigned char * buff, int len, unsigned int sum)
49 * Copy from userspace and compute checksum. If we catch an exception 49 * Copy from userspace and compute checksum. If we catch an exception
50 * then zero the rest of the buffer. 50 * then zero the rest of the buffer.
51 */ 51 */
52static inline unsigned int 52static inline __wsum
53csum_partial_copy_from_user(const char __user *src, char *dst, 53csum_partial_copy_from_user(const void __user *src, void *dst,
54 int len, unsigned int sum, 54 int len, __wsum sum,
55 int *err_ptr) 55 int *err_ptr)
56{ 56{
57 int missing; 57 int missing;
@@ -66,8 +66,8 @@ csum_partial_copy_from_user(const char __user *src, char *dst,
66} 66}
67 67
68 68
69static inline unsigned int 69static inline __wsum
70csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) 70csum_partial_copy_nocheck (const void *src, void *dst, int len, __wsum sum)
71{ 71{
72 memcpy(dst,src,len); 72 memcpy(dst,src,len);
73 return csum_partial(dst, len, sum); 73 return csum_partial(dst, len, sum);
@@ -76,8 +76,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum
76/* 76/*
77 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
78 */ 78 */
79static inline unsigned short 79static inline __sum16 csum_fold(__wsum sum)
80csum_fold(unsigned int sum)
81{ 80{
82#ifndef __s390x__ 81#ifndef __s390x__
83 register_pair rp; 82 register_pair rp;
@@ -100,7 +99,7 @@ csum_fold(unsigned int sum)
100 " srl %0,16\n" /* %0 = H+L+C */ 99 " srl %0,16\n" /* %0 = H+L+C */
101 : "+&d" (sum) : : "cc", "2", "3"); 100 : "+&d" (sum) : : "cc", "2", "3");
102#endif /* __s390x__ */ 101#endif /* __s390x__ */
103 return ((unsigned short) ~sum); 102 return (__force __sum16) ~sum;
104} 103}
105 104
106/* 105/*
@@ -108,8 +107,7 @@ csum_fold(unsigned int sum)
108 * which always checksum on 4 octet boundaries. 107 * which always checksum on 4 octet boundaries.
109 * 108 *
110 */ 109 */
111static inline unsigned short 110static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
112ip_fast_csum(unsigned char *iph, unsigned int ihl)
113{ 111{
114 return csum_fold(csum_partial(iph, ihl*4, 0)); 112 return csum_fold(csum_partial(iph, ihl*4, 0));
115} 113}
@@ -118,10 +116,10 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl)
118 * computes the checksum of the TCP/UDP pseudo-header 116 * computes the checksum of the TCP/UDP pseudo-header
119 * returns a 32-bit checksum 117 * returns a 32-bit checksum
120 */ 118 */
121static inline unsigned int 119static inline __wsum
122csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 120csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
123 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
124 unsigned int sum) 122 __wsum sum)
125{ 123{
126#ifndef __s390x__ 124#ifndef __s390x__
127 asm volatile( 125 asm volatile(
@@ -137,12 +135,12 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
137 "1:" 135 "1:"
138 : "+&d" (sum) : "d" (daddr) : "cc"); 136 : "+&d" (sum) : "d" (daddr) : "cc");
139 asm volatile( 137 asm volatile(
140 " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */ 138 " alr %0,%1\n" /* sum += len + proto */
141 " brc 12,2f\n" 139 " brc 12,2f\n"
142 " ahi %0,1\n" /* add carry */ 140 " ahi %0,1\n" /* add carry */
143 "2:" 141 "2:"
144 : "+&d" (sum) 142 : "+&d" (sum)
145 : "d" (((unsigned int) len<<16) + (unsigned int) proto) 143 : "d" (len + proto)
146 : "cc"); 144 : "cc");
147#else /* __s390x__ */ 145#else /* __s390x__ */
148 asm volatile( 146 asm volatile(
@@ -153,7 +151,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
153 "0: algr %0,%2\n" /* sum += daddr */ 151 "0: algr %0,%2\n" /* sum += daddr */
154 " brc 12,1f\n" 152 " brc 12,1f\n"
155 " aghi %0,1\n" /* add carry */ 153 " aghi %0,1\n" /* add carry */
156 "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ 154 "1: algfr %0,%3\n" /* sum += len + proto */
157 " brc 12,2f\n" 155 " brc 12,2f\n"
158 " aghi %0,1\n" /* add carry */ 156 " aghi %0,1\n" /* add carry */
159 "2: srlg 0,%0,32\n" 157 "2: srlg 0,%0,32\n"
@@ -163,7 +161,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
163 "3: llgfr %0,%0" 161 "3: llgfr %0,%0"
164 : "+&d" (sum) 162 : "+&d" (sum)
165 : "d" (saddr), "d" (daddr), 163 : "d" (saddr), "d" (daddr),
166 "d" (((unsigned int) len<<16) + (unsigned int) proto) 164 "d" (len + proto)
167 : "cc", "0"); 165 : "cc", "0");
168#endif /* __s390x__ */ 166#endif /* __s390x__ */
169 return sum; 167 return sum;
@@ -174,10 +172,10 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
174 * returns a 16-bit checksum, already complemented 172 * returns a 16-bit checksum, already complemented
175 */ 173 */
176 174
177static inline unsigned short int 175static inline __sum16
178csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 176csum_tcpudp_magic(__be32 saddr, __be32 daddr,
179 unsigned short len, unsigned short proto, 177 unsigned short len, unsigned short proto,
180 unsigned int sum) 178 __wsum sum)
181{ 179{
182 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 180 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
183} 181}
@@ -187,8 +185,7 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
187 * in icmp.c 185 * in icmp.c
188 */ 186 */
189 187
190static inline unsigned short 188static inline __sum16 ip_compute_csum(const void *buff, int len)
191ip_compute_csum(unsigned char * buff, int len)
192{ 189{
193 return csum_fold(csum_partial(buff, len, 0)); 190 return csum_fold(csum_partial(buff, len, 0));
194} 191}
diff --git a/include/asm-s390/device.h b/include/asm-s390/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-s390/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h
index 08168afe6746..d44344c88e73 100644
--- a/include/asm-sh/checksum.h
+++ b/include/asm-sh/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,8 +33,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst, 36asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
37 int len, int sum, int *src_err_ptr, int *dst_err_ptr); 37 int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr);
38 38
39/* 39/*
40 * Note: when you get a NULL pointer exception here this means someone 40 * Note: when you get a NULL pointer exception here this means someone
@@ -44,24 +44,25 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi
44 * access_ok(). 44 * access_ok().
45 */ 45 */
46static __inline__ 46static __inline__
47unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, 47__wsum csum_partial_copy_nocheck(const void *src, void *dst,
48 int len, int sum) 48 int len, __wsum sum)
49{ 49{
50 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 50 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
51} 51}
52 52
53static __inline__ 53static __inline__
54unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst, 54__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
55 int len, int sum, int *err_ptr) 55 int len, __wsum sum, int *err_ptr)
56{ 56{
57 return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); 57 return csum_partial_copy_generic((__force const void *)src, dst,
58 len, sum, err_ptr, NULL);
58} 59}
59 60
60/* 61/*
61 * Fold a partial checksum 62 * Fold a partial checksum
62 */ 63 */
63 64
64static __inline__ unsigned int csum_fold(unsigned int sum) 65static __inline__ __sum16 csum_fold(__wsum sum)
65{ 66{
66 unsigned int __dummy; 67 unsigned int __dummy;
67 __asm__("swap.w %0, %1\n\t" 68 __asm__("swap.w %0, %1\n\t"
@@ -74,7 +75,7 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
74 : "=r" (sum), "=&r" (__dummy) 75 : "=r" (sum), "=&r" (__dummy)
75 : "0" (sum) 76 : "0" (sum)
76 : "t"); 77 : "t");
77 return sum; 78 return (__force __sum16)sum;
78} 79}
79 80
80/* 81/*
@@ -84,7 +85,7 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
84 * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted 85 * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted
85 * for linux by * Arnt Gulbrandsen. 86 * for linux by * Arnt Gulbrandsen.
86 */ 87 */
87static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) 88static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
88{ 89{
89 unsigned int sum, __dummy0, __dummy1; 90 unsigned int sum, __dummy0, __dummy1;
90 91
@@ -112,16 +113,15 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int
112 return csum_fold(sum); 113 return csum_fold(sum);
113} 114}
114 115
115static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, 116static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 unsigned long daddr,
117 unsigned short len, 117 unsigned short len,
118 unsigned short proto, 118 unsigned short proto,
119 unsigned int sum) 119 __wsum sum)
120{ 120{
121#ifdef __LITTLE_ENDIAN__ 121#ifdef __LITTLE_ENDIAN__
122 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 122 unsigned long len_proto = (proto + len) << 8;
123#else 123#else
124 unsigned long len_proto = (proto<<16)+len; 124 unsigned long len_proto = proto + len;
125#endif 125#endif
126 __asm__("clrt\n\t" 126 __asm__("clrt\n\t"
127 "addc %0, %1\n\t" 127 "addc %0, %1\n\t"
@@ -139,11 +139,10 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
139 * computes the checksum of the TCP/UDP pseudo-header 139 * computes the checksum of the TCP/UDP pseudo-header
140 * returns a 16-bit checksum, already complemented 140 * returns a 16-bit checksum, already complemented
141 */ 141 */
142static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, 142static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
143 unsigned long daddr,
144 unsigned short len, 143 unsigned short len,
145 unsigned short proto, 144 unsigned short proto,
146 unsigned int sum) 145 __wsum sum)
147{ 146{
148 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 147 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
149} 148}
@@ -153,18 +152,17 @@ static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr,
153 * in icmp.c 152 * in icmp.c
154 */ 153 */
155 154
156static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) 155static __inline__ __sum16 ip_compute_csum(const void *buff, int len)
157{ 156{
158 return csum_fold (csum_partial(buff, len, 0)); 157 return csum_fold (csum_partial(buff, len, 0));
159} 158}
160 159
161#define _HAVE_ARCH_IPV6_CSUM 160#define _HAVE_ARCH_IPV6_CSUM
162#ifdef CONFIG_IPV6 161#ifdef CONFIG_IPV6
163static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 162static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
164 struct in6_addr *daddr, 163 const struct in6_addr *daddr,
165 __u32 len, 164 __u32 len, unsigned short proto,
166 unsigned short proto, 165 __wsum sum)
167 unsigned int sum)
168{ 166{
169 unsigned int __dummy; 167 unsigned int __dummy;
170 __asm__("clrt\n\t" 168 __asm__("clrt\n\t"
@@ -201,17 +199,18 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
201 * Copy and checksum to user 199 * Copy and checksum to user
202 */ 200 */
203#define HAVE_CSUM_COPY_USER 201#define HAVE_CSUM_COPY_USER
204static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src, 202static __inline__ __wsum csum_and_copy_to_user (const void *src,
205 unsigned char __user *dst, 203 void __user *dst,
206 int len, int sum, 204 int len, __wsum sum,
207 int *err_ptr) 205 int *err_ptr)
208{ 206{
209 if (access_ok(VERIFY_WRITE, dst, len)) 207 if (access_ok(VERIFY_WRITE, dst, len))
210 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); 208 return csum_partial_copy_generic((__force const void *)src,
209 dst, len, sum, NULL, err_ptr);
211 210
212 if (len) 211 if (len)
213 *err_ptr = -EFAULT; 212 *err_ptr = -EFAULT;
214 213
215 return -1; /* invalid checksum */ 214 return (__force __wsum)-1; /* invalid checksum */
216} 215}
217#endif /* __ASM_SH_CHECKSUM_H */ 216#endif /* __ASM_SH_CHECKSUM_H */
diff --git a/include/asm-sh/device.h b/include/asm-sh/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sh/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sh64/checksum.h b/include/asm-sh64/checksum.h
index fd034e9ae6e3..ba594ccb42e5 100644
--- a/include/asm-sh64/checksum.h
+++ b/include/asm-sh64/checksum.h
@@ -26,8 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, 29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * Note: when you get a NULL pointer exception here this means someone 32 * Note: when you get a NULL pointer exception here this means someone
@@ -38,46 +37,34 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len,
38 */ 37 */
39 38
40 39
41unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, 40__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
42 unsigned int sum); 41 __wsum sum);
43 42
44unsigned int csum_partial_copy_from_user(const char *src, char *dst, 43__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
45 int len, int sum, int *err_ptr); 44 int len, __wsum sum, int *err_ptr);
46 45
47/* 46static inline __sum16 csum_fold(__wsum csum)
48 * These are the old (and unsafe) way of doing checksums, a warning message will be
49 * printed if they are used and an exeption occurs.
50 *
51 * these functions should go away after some time.
52 */
53
54#define csum_partial_copy_fromuser csum_partial_copy
55
56unsigned int csum_partial_copy(const char *src, char *dst, int len,
57 unsigned int sum);
58
59static inline unsigned short csum_fold(unsigned int sum)
60{ 47{
48 u32 sum = (__force u32)csum;
61 sum = (sum & 0xffff) + (sum >> 16); 49 sum = (sum & 0xffff) + (sum >> 16);
62 sum = (sum & 0xffff) + (sum >> 16); 50 sum = (sum & 0xffff) + (sum >> 16);
63 return ~(sum); 51 return (__force __sum16)~sum;
64} 52}
65 53
66unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 54__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
67 55
68unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 56__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
69 unsigned short len, unsigned short proto, 57 unsigned short len, unsigned short proto,
70 unsigned int sum); 58 __wsum sum);
71 59
72/* 60/*
73 * computes the checksum of the TCP/UDP pseudo-header 61 * computes the checksum of the TCP/UDP pseudo-header
74 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
75 */ 63 */
76static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 64static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
77 unsigned long daddr,
78 unsigned short len, 65 unsigned short len,
79 unsigned short proto, 66 unsigned short proto,
80 unsigned int sum) 67 __wsum sum)
81{ 68{
82 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 69 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
83} 70}
@@ -86,7 +73,7 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
86 * this routine is used for miscellaneous IP-like checksums, mainly 73 * this routine is used for miscellaneous IP-like checksums, mainly
87 * in icmp.c 74 * in icmp.c
88 */ 75 */
89static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 76static inline __sum16 ip_compute_csum(const void *buff, int len)
90{ 77{
91 return csum_fold(csum_partial(buff, len, 0)); 78 return csum_fold(csum_partial(buff, len, 0));
92} 79}
diff --git a/include/asm-sh64/device.h b/include/asm-sh64/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sh64/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 286158108974..267e631e9bbc 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -30,7 +30,7 @@
30 * 30 *
31 * it's best to have buff aligned on a 32-bit boundary 31 * it's best to have buff aligned on a 32-bit boundary
32 */ 32 */
33extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 33extern __wsum csum_partial(const void *buff, int len, __wsum sum);
34 34
35/* the same as csum_partial, but copies from fs:src while it 35/* the same as csum_partial, but copies from fs:src while it
36 * checksums 36 * checksums
@@ -41,9 +41,8 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
41 41
42extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); 42extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);
43 43
44static inline unsigned int 44static inline __wsum
45csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len, 45csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
46 unsigned int sum)
47{ 46{
48 register unsigned int ret asm("o0") = (unsigned int)src; 47 register unsigned int ret asm("o0") = (unsigned int)src;
49 register char *d asm("o1") = dst; 48 register char *d asm("o1") = dst;
@@ -57,42 +56,36 @@ csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len
57 : "o2", "o3", "o4", "o5", "o7", 56 : "o2", "o3", "o4", "o5", "o7",
58 "g2", "g3", "g4", "g5", "g7", 57 "g2", "g3", "g4", "g5", "g7",
59 "memory", "cc"); 58 "memory", "cc");
60 return ret; 59 return (__force __wsum)ret;
61} 60}
62 61
63static inline unsigned int 62static inline __wsum
64csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len, 63csum_partial_copy_from_user(const void __user *src, void *dst, int len,
65 unsigned int sum, int *err) 64 __wsum sum, int *err)
66 { 65 {
67 if (!access_ok (VERIFY_READ, src, len)) { 66 register unsigned long ret asm("o0") = (unsigned long)src;
68 *err = -EFAULT; 67 register char *d asm("o1") = dst;
69 memset (dst, 0, len); 68 register int l asm("g1") = len;
70 return sum; 69 register __wsum s asm("g7") = sum;
71 } else {
72 register unsigned long ret asm("o0") = (unsigned long)src;
73 register char *d asm("o1") = dst;
74 register int l asm("g1") = len;
75 register unsigned int s asm("g7") = sum;
76 70
77 __asm__ __volatile__ ( 71 __asm__ __volatile__ (
78 ".section __ex_table,#alloc\n\t" 72 ".section __ex_table,#alloc\n\t"
79 ".align 4\n\t" 73 ".align 4\n\t"
80 ".word 1f,2\n\t" 74 ".word 1f,2\n\t"
81 ".previous\n" 75 ".previous\n"
82 "1:\n\t" 76 "1:\n\t"
83 "call __csum_partial_copy_sparc_generic\n\t" 77 "call __csum_partial_copy_sparc_generic\n\t"
84 " st %8, [%%sp + 64]\n" 78 " st %8, [%%sp + 64]\n"
85 : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s) 79 : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
86 : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err) 80 : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
87 : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5", 81 : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5",
88 "cc", "memory"); 82 "cc", "memory");
89 return ret; 83 return (__force __wsum)ret;
90 } 84}
91 }
92 85
93static inline unsigned int 86static inline __wsum
94csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, int len, 87csum_partial_copy_to_user(const void *src, void __user *dst, int len,
95 unsigned int sum, int *err) 88 __wsum sum, int *err)
96{ 89{
97 if (!access_ok (VERIFY_WRITE, dst, len)) { 90 if (!access_ok (VERIFY_WRITE, dst, len)) {
98 *err = -EFAULT; 91 *err = -EFAULT;
@@ -101,7 +94,7 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
101 register unsigned long ret asm("o0") = (unsigned long)src; 94 register unsigned long ret asm("o0") = (unsigned long)src;
102 register char __user *d asm("o1") = dst; 95 register char __user *d asm("o1") = dst;
103 register int l asm("g1") = len; 96 register int l asm("g1") = len;
104 register unsigned int s asm("g7") = sum; 97 register __wsum s asm("g7") = sum;
105 98
106 __asm__ __volatile__ ( 99 __asm__ __volatile__ (
107 ".section __ex_table,#alloc\n\t" 100 ".section __ex_table,#alloc\n\t"
@@ -116,7 +109,7 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
116 : "o2", "o3", "o4", "o5", "o7", 109 : "o2", "o3", "o4", "o5", "o7",
117 "g2", "g3", "g4", "g5", 110 "g2", "g3", "g4", "g5",
118 "cc", "memory"); 111 "cc", "memory");
119 return ret; 112 return (__force __wsum)ret;
120 } 113 }
121} 114}
122 115
@@ -126,10 +119,9 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
126/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 119/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
127 * the majority of the time. 120 * the majority of the time.
128 */ 121 */
129static inline unsigned short ip_fast_csum(const unsigned char *iph, 122static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
130 unsigned int ihl)
131{ 123{
132 unsigned short sum; 124 __sum16 sum;
133 125
134 /* Note: We must read %2 before we touch %0 for the first time, 126 /* Note: We must read %2 before we touch %0 for the first time,
135 * because GCC can legitimately use the same register for 127 * because GCC can legitimately use the same register for
@@ -164,7 +156,7 @@ static inline unsigned short ip_fast_csum(const unsigned char *iph,
164} 156}
165 157
166/* Fold a partial checksum without adding pseudo headers. */ 158/* Fold a partial checksum without adding pseudo headers. */
167static inline unsigned int csum_fold(unsigned int sum) 159static inline __sum16 csum_fold(__wsum sum)
168{ 160{
169 unsigned int tmp; 161 unsigned int tmp;
170 162
@@ -173,23 +165,22 @@ static inline unsigned int csum_fold(unsigned int sum)
173 "addx\t%1, %%g0, %1\n\t" 165 "addx\t%1, %%g0, %1\n\t"
174 "xnor\t%%g0, %1, %0" 166 "xnor\t%%g0, %1, %0"
175 : "=&r" (sum), "=r" (tmp) 167 : "=&r" (sum), "=r" (tmp)
176 : "0" (sum), "1" (sum<<16) 168 : "0" (sum), "1" ((__force u32)sum<<16)
177 : "cc"); 169 : "cc");
178 return sum; 170 return (__force __sum16)sum;
179} 171}
180 172
181static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 173static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
182 unsigned long daddr, 174 unsigned short len,
183 unsigned int len,
184 unsigned short proto, 175 unsigned short proto,
185 unsigned int sum) 176 __wsum sum)
186{ 177{
187 __asm__ __volatile__("addcc\t%1, %0, %0\n\t" 178 __asm__ __volatile__("addcc\t%1, %0, %0\n\t"
188 "addxcc\t%2, %0, %0\n\t" 179 "addxcc\t%2, %0, %0\n\t"
189 "addxcc\t%3, %0, %0\n\t" 180 "addxcc\t%3, %0, %0\n\t"
190 "addx\t%0, %%g0, %0\n\t" 181 "addx\t%0, %%g0, %0\n\t"
191 : "=r" (sum), "=r" (saddr) 182 : "=r" (sum), "=r" (saddr)
192 : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), 183 : "r" (daddr), "r" (proto + len), "0" (sum),
193 "1" (saddr) 184 "1" (saddr)
194 : "cc"); 185 : "cc");
195 return sum; 186 return sum;
@@ -199,22 +190,20 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
199 * computes the checksum of the TCP/UDP pseudo-header 190 * computes the checksum of the TCP/UDP pseudo-header
200 * returns a 16-bit checksum, already complemented 191 * returns a 16-bit checksum, already complemented
201 */ 192 */
202static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 193static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
203 unsigned long daddr,
204 unsigned short len, 194 unsigned short len,
205 unsigned short proto, 195 unsigned short proto,
206 unsigned int sum) 196 __wsum sum)
207{ 197{
208 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 198 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
209} 199}
210 200
211#define _HAVE_ARCH_IPV6_CSUM 201#define _HAVE_ARCH_IPV6_CSUM
212 202
213static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 203static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
214 struct in6_addr *daddr, 204 const struct in6_addr *daddr,
215 __u32 len, 205 __u32 len, unsigned short proto,
216 unsigned short proto, 206 __wsum sum)
217 unsigned int sum)
218{ 207{
219 __asm__ __volatile__ ( 208 __asm__ __volatile__ (
220 "addcc %3, %4, %%g4\n\t" 209 "addcc %3, %4, %%g4\n\t"
@@ -245,7 +234,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
245} 234}
246 235
247/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ 236/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
248static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 237static inline __sum16 ip_compute_csum(const void *buff, int len)
249{ 238{
250 return csum_fold(csum_partial(buff, len, 0)); 239 return csum_fold(csum_partial(buff, len, 0));
251} 240}
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sparc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
index dc8bed246fc9..70a006da7634 100644
--- a/include/asm-sparc64/checksum.h
+++ b/include/asm-sparc64/checksum.h
@@ -30,7 +30,7 @@
30 * 30 *
31 * it's best to have buff aligned on a 32-bit boundary 31 * it's best to have buff aligned on a 32-bit boundary
32 */ 32 */
33extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 33extern __wsum csum_partial(const void * buff, int len, __wsum sum);
34 34
35/* the same as csum_partial, but copies from user space while it 35/* the same as csum_partial, but copies from user space while it
36 * checksums 36 * checksums
@@ -38,52 +38,50 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
38 * here even more important to align src and dst on a 32-bit (or even 38 * here even more important to align src and dst on a 32-bit (or even
39 * better 64-bit) boundary 39 * better 64-bit) boundary
40 */ 40 */
41extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 41extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
42 unsigned char *dst, 42 int len, __wsum sum);
43 int len, unsigned int sum); 43
44 44extern long __csum_partial_copy_from_user(const void __user *src,
45extern long __csum_partial_copy_from_user(const unsigned char __user *src, 45 void *dst, int len,
46 unsigned char *dst, int len, 46 __wsum sum);
47 unsigned int sum); 47
48 48static inline __wsum
49static inline unsigned int 49csum_partial_copy_from_user(const void __user *src,
50csum_partial_copy_from_user(const unsigned char __user *src, 50 void *dst, int len,
51 unsigned char *dst, int len, 51 __wsum sum, int *err)
52 unsigned int sum, int *err)
53{ 52{
54 long ret = __csum_partial_copy_from_user(src, dst, len, sum); 53 long ret = __csum_partial_copy_from_user(src, dst, len, sum);
55 if (ret < 0) 54 if (ret < 0)
56 *err = -EFAULT; 55 *err = -EFAULT;
57 return (unsigned int) ret; 56 return (__force __wsum) ret;
58} 57}
59 58
60/* 59/*
61 * Copy and checksum to user 60 * Copy and checksum to user
62 */ 61 */
63#define HAVE_CSUM_COPY_USER 62#define HAVE_CSUM_COPY_USER
64extern long __csum_partial_copy_to_user(const unsigned char *src, 63extern long __csum_partial_copy_to_user(const void *src,
65 unsigned char __user *dst, int len, 64 void __user *dst, int len,
66 unsigned int sum); 65 __wsum sum);
67 66
68static inline unsigned int 67static inline __wsum
69csum_and_copy_to_user(const unsigned char *src, 68csum_and_copy_to_user(const void *src,
70 unsigned char __user *dst, int len, 69 void __user *dst, int len,
71 unsigned int sum, int *err) 70 __wsum sum, int *err)
72{ 71{
73 long ret = __csum_partial_copy_to_user(src, dst, len, sum); 72 long ret = __csum_partial_copy_to_user(src, dst, len, sum);
74 if (ret < 0) 73 if (ret < 0)
75 *err = -EFAULT; 74 *err = -EFAULT;
76 return (unsigned int) ret; 75 return (__force __wsum) ret;
77} 76}
78 77
79/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 78/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
80 * the majority of the time. 79 * the majority of the time.
81 */ 80 */
82extern unsigned short ip_fast_csum(__const__ unsigned char *iph, 81extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
83 unsigned int ihl);
84 82
85/* Fold a partial checksum without adding pseudo headers. */ 83/* Fold a partial checksum without adding pseudo headers. */
86static inline unsigned short csum_fold(unsigned int sum) 84static inline __sum16 csum_fold(__wsum sum)
87{ 85{
88 unsigned int tmp; 86 unsigned int tmp;
89 87
@@ -93,16 +91,15 @@ static inline unsigned short csum_fold(unsigned int sum)
93" addc %1, %%g0, %1\n" 91" addc %1, %%g0, %1\n"
94" xnor %%g0, %1, %0\n" 92" xnor %%g0, %1, %0\n"
95 : "=&r" (sum), "=r" (tmp) 93 : "=&r" (sum), "=r" (tmp)
96 : "0" (sum), "1" (sum<<16) 94 : "0" (sum), "1" ((__force u32)sum<<16)
97 : "cc"); 95 : "cc");
98 return (sum & 0xffff); 96 return (__force __sum16)sum;
99} 97}
100 98
101static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 99static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
102 unsigned long daddr,
103 unsigned int len, 100 unsigned int len,
104 unsigned short proto, 101 unsigned short proto,
105 unsigned int sum) 102 __wsum sum)
106{ 103{
107 __asm__ __volatile__( 104 __asm__ __volatile__(
108" addcc %1, %0, %0\n" 105" addcc %1, %0, %0\n"
@@ -110,7 +107,7 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
110" addccc %3, %0, %0\n" 107" addccc %3, %0, %0\n"
111" addc %0, %%g0, %0\n" 108" addc %0, %%g0, %0\n"
112 : "=r" (sum), "=r" (saddr) 109 : "=r" (sum), "=r" (saddr)
113 : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr) 110 : "r" (daddr), "r" (proto + len), "0" (sum), "1" (saddr)
114 : "cc"); 111 : "cc");
115 return sum; 112 return sum;
116} 113}
@@ -119,22 +116,20 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
119 * computes the checksum of the TCP/UDP pseudo-header 116 * computes the checksum of the TCP/UDP pseudo-header
120 * returns a 16-bit checksum, already complemented 117 * returns a 16-bit checksum, already complemented
121 */ 118 */
122static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 119static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
123 unsigned long daddr,
124 unsigned short len, 120 unsigned short len,
125 unsigned short proto, 121 unsigned short proto,
126 unsigned int sum) 122 __wsum sum)
127{ 123{
128 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 124 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
129} 125}
130 126
131#define _HAVE_ARCH_IPV6_CSUM 127#define _HAVE_ARCH_IPV6_CSUM
132 128
133static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 129static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
134 struct in6_addr *daddr, 130 const struct in6_addr *daddr,
135 __u32 len, 131 __u32 len, unsigned short proto,
136 unsigned short proto, 132 __wsum sum)
137 unsigned int sum)
138{ 133{
139 __asm__ __volatile__ ( 134 __asm__ __volatile__ (
140" addcc %3, %4, %%g7\n" 135" addcc %3, %4, %%g7\n"
@@ -165,7 +160,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
165} 160}
166 161
167/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ 162/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
168static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 163static inline __sum16 ip_compute_csum(const void *buff, int len)
169{ 164{
170 return csum_fold(csum_partial(buff, len, 0)); 165 return csum_fold(csum_partial(buff, len, 0));
171} 166}
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sparc64/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index e1ea67bc32f2..ca6560288ae8 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -18,6 +18,8 @@
18 18
19#define PCI_IRQ_NONE 0xffffffff 19#define PCI_IRQ_NONE 0xffffffff
20 20
21#define PCI_CACHE_LINE_BYTES 64
22
21static inline void pcibios_set_master(struct pci_dev *dev) 23static inline void pcibios_set_master(struct pci_dev *dev)
22{ 24{
23 /* No special bus mastering setup handling */ 25 /* No special bus mastering setup handling */
@@ -291,10 +293,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
291 enum pci_mmap_state mmap_state, 293 enum pci_mmap_state mmap_state,
292 int write_combine); 294 int write_combine);
293 295
294/* Platform specific MWI support. */
295#define HAVE_ARCH_PCI_MWI
296extern int pcibios_prep_mwi(struct pci_dev *dev);
297
298extern void 296extern void
299pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 297pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
300 struct resource *res); 298 struct resource *res);
diff --git a/include/asm-um/device.h b/include/asm-um/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-um/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-v850/checksum.h b/include/asm-v850/checksum.h
index 4df5e71098f9..d1dddd938262 100644
--- a/include/asm-v850/checksum.h
+++ b/include/asm-v850/checksum.h
@@ -26,8 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29extern unsigned int csum_partial (const unsigned char * buff, int len, 29extern __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -36,8 +35,8 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
36 * here even more important to align src and dst on a 32-bit (or even 35 * here even more important to align src and dst on a 32-bit (or even
37 * better 64-bit) boundary 36 * better 64-bit) boundary
38 */ 37 */
39extern unsigned csum_partial_copy (const unsigned char *src, 38extern __wsum csum_partial_copy_nocheck(const void *src,
40 unsigned char *dst, int len, unsigned sum); 39 void *dst, int len, __wsum sum);
41 40
42 41
43/* 42/*
@@ -46,20 +45,17 @@ extern unsigned csum_partial_copy (const unsigned char *src,
46 * here even more important to align src and dst on a 32-bit (or even 45 * here even more important to align src and dst on a 32-bit (or even
47 * better 64-bit) boundary 46 * better 64-bit) boundary
48 */ 47 */
49extern unsigned csum_partial_copy_from_user (const unsigned char *src, 48extern __wsum csum_partial_copy_from_user (const void *src,
50 unsigned char *dst, 49 void *dst,
51 int len, unsigned sum, 50 int len, __wsum sum,
52 int *csum_err); 51 int *csum_err);
53 52
54#define csum_partial_copy_nocheck(src, dst, len, sum) \ 53__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
55 csum_partial_copy ((src), (dst), (len), (sum))
56
57unsigned short ip_fast_csum (unsigned char *iph, unsigned int ihl);
58 54
59/* 55/*
60 * Fold a partial checksum 56 * Fold a partial checksum
61 */ 57 */
62static inline unsigned int csum_fold (unsigned long sum) 58static inline __sum16 csum_fold (__wsum sum)
63{ 59{
64 unsigned int result; 60 unsigned int result;
65 /* 61 /*
@@ -68,7 +64,7 @@ static inline unsigned int csum_fold (unsigned long sum)
68 add %1, %0 H L H+L+C H+L 64 add %1, %0 H L H+L+C H+L
69 */ 65 */
70 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum)); 66 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum));
71 return (~result) >> 16; 67 return (__force __sum16)(~result >> 16);
72} 68}
73 69
74 70
@@ -76,10 +72,10 @@ static inline unsigned int csum_fold (unsigned long sum)
76 * computes the checksum of the TCP/UDP pseudo-header 72 * computes the checksum of the TCP/UDP pseudo-header
77 * returns a 16-bit checksum, already complemented 73 * returns a 16-bit checksum, already complemented
78 */ 74 */
79static inline unsigned int 75static inline __wsum
80csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr, 76csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
81 unsigned short len, 77 unsigned short len,
82 unsigned short proto, unsigned int sum) 78 unsigned short proto, __wsum sum)
83{ 79{
84 int __carry; 80 int __carry;
85 __asm__ ("add %2, %0;" 81 __asm__ ("add %2, %0;"
@@ -93,15 +89,15 @@ csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
93 "add %1, %0" 89 "add %1, %0"
94 : "=&r" (sum), "=&r" (__carry) 90 : "=&r" (sum), "=&r" (__carry)
95 : "r" (daddr), "r" (saddr), 91 : "r" (daddr), "r" (saddr),
96 "r" (ntohs (len) + (proto << 8)), 92 "r" ((len + proto) << 8),
97 "0" (sum)); 93 "0" (sum));
98 return sum; 94 return sum;
99} 95}
100 96
101static inline unsigned short int 97static inline __sum16
102csum_tcpudp_magic (unsigned long saddr, unsigned long daddr, 98csum_tcpudp_magic (__be32 saddr, __be32 daddr,
103 unsigned short len, 99 unsigned short len,
104 unsigned short proto, unsigned int sum) 100 unsigned short proto, __wsum sum)
105{ 101{
106 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum)); 102 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum));
107} 103}
@@ -110,7 +106,7 @@ csum_tcpudp_magic (unsigned long saddr, unsigned long daddr,
110 * this routine is used for miscellaneous IP-like checksums, mainly 106 * this routine is used for miscellaneous IP-like checksums, mainly
111 * in icmp.c 107 * in icmp.c
112 */ 108 */
113extern unsigned short ip_compute_csum (const unsigned char * buff, int len); 109extern __sum16 ip_compute_csum(const void *buff, int len);
114 110
115 111
116#endif /* __V850_CHECKSUM_H__ */ 112#endif /* __V850_CHECKSUM_H__ */
diff --git a/include/asm-v850/device.h b/include/asm-v850/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-v850/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-x86_64/checksum.h b/include/asm-x86_64/checksum.h
index 989469e8e0b7..419fe88a0342 100644
--- a/include/asm-x86_64/checksum.h
+++ b/include/asm-x86_64/checksum.h
@@ -19,15 +19,16 @@
19 * the last step before putting a checksum into a packet. 19 * the last step before putting a checksum into a packet.
20 * Make sure not to mix with 64bit checksums. 20 * Make sure not to mix with 64bit checksums.
21 */ 21 */
22static inline unsigned int csum_fold(unsigned int sum) 22static inline __sum16 csum_fold(__wsum sum)
23{ 23{
24 __asm__( 24 __asm__(
25 " addl %1,%0\n" 25 " addl %1,%0\n"
26 " adcl $0xffff,%0" 26 " adcl $0xffff,%0"
27 : "=r" (sum) 27 : "=r" (sum)
28 : "r" (sum << 16), "0" (sum & 0xffff0000) 28 : "r" ((__force u32)sum << 16),
29 "0" ((__force u32)sum & 0xffff0000)
29 ); 30 );
30 return (~sum) >> 16; 31 return (__force __sum16)(~(__force u32)sum >> 16);
31} 32}
32 33
33/* 34/*
@@ -43,7 +44,7 @@ static inline unsigned int csum_fold(unsigned int sum)
43 * iph: ipv4 header 44 * iph: ipv4 header
44 * ihl: length of header / 4 45 * ihl: length of header / 4
45 */ 46 */
46static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 47static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
47{ 48{
48 unsigned int sum; 49 unsigned int sum;
49 50
@@ -70,7 +71,7 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
70 : "=r" (sum), "=r" (iph), "=r" (ihl) 71 : "=r" (sum), "=r" (iph), "=r" (ihl)
71 : "1" (iph), "2" (ihl) 72 : "1" (iph), "2" (ihl)
72 : "memory"); 73 : "memory");
73 return(sum); 74 return (__force __sum16)sum;
74} 75}
75 76
76/** 77/**
@@ -84,16 +85,17 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
84 * Returns the pseudo header checksum the input data. Result is 85 * Returns the pseudo header checksum the input data. Result is
85 * 32bit unfolded. 86 * 32bit unfolded.
86 */ 87 */
87static inline unsigned long 88static inline __wsum
88csum_tcpudp_nofold(unsigned saddr, unsigned daddr, unsigned short len, 89csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
89 unsigned short proto, unsigned int sum) 90 unsigned short proto, __wsum sum)
90{ 91{
91 asm(" addl %1, %0\n" 92 asm(" addl %1, %0\n"
92 " adcl %2, %0\n" 93 " adcl %2, %0\n"
93 " adcl %3, %0\n" 94 " adcl %3, %0\n"
94 " adcl $0, %0\n" 95 " adcl $0, %0\n"
95 : "=r" (sum) 96 : "=r" (sum)
96 : "g" (daddr), "g" (saddr), "g" ((ntohs(len)<<16)+proto*256), "0" (sum)); 97 : "g" (daddr), "g" (saddr),
98 "g" ((len + proto)<<8), "0" (sum));
97 return sum; 99 return sum;
98} 100}
99 101
@@ -109,9 +111,9 @@ csum_tcpudp_nofold(unsigned saddr, unsigned daddr, unsigned short len,
109 * Returns the 16bit pseudo header checksum the input data already 111 * Returns the 16bit pseudo header checksum the input data already
110 * complemented and ready to be filled in. 112 * complemented and ready to be filled in.
111 */ 113 */
112static inline unsigned short int 114static inline __sum16
113csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 115csum_tcpudp_magic(__be32 saddr, __be32 daddr,
114 unsigned short len, unsigned short proto, unsigned int sum) 116 unsigned short len, unsigned short proto, __wsum sum)
115{ 117{
116 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 118 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
117} 119}
@@ -126,25 +128,25 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
126 * Before filling it in it needs to be csum_fold()'ed. 128 * Before filling it in it needs to be csum_fold()'ed.
127 * buff should be aligned to a 64bit boundary if possible. 129 * buff should be aligned to a 64bit boundary if possible.
128 */ 130 */
129extern unsigned int csum_partial(const unsigned char *buff, unsigned len, unsigned int sum); 131extern __wsum csum_partial(const void *buff, int len, __wsum sum);
130 132
131#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1 133#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1
132#define HAVE_CSUM_COPY_USER 1 134#define HAVE_CSUM_COPY_USER 1
133 135
134 136
135/* Do not call this directly. Use the wrappers below */ 137/* Do not call this directly. Use the wrappers below */
136extern unsigned long csum_partial_copy_generic(const unsigned char *src, const unsigned char *dst, 138extern __wsum csum_partial_copy_generic(const void *src, const void *dst,
137 unsigned len, 139 int len,
138 unsigned sum, 140 __wsum sum,
139 int *src_err_ptr, int *dst_err_ptr); 141 int *src_err_ptr, int *dst_err_ptr);
140 142
141 143
142extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, 144extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
143 int len, unsigned int isum, int *errp); 145 int len, __wsum isum, int *errp);
144extern unsigned int csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, 146extern __wsum csum_partial_copy_to_user(const void *src, void __user *dst,
145 int len, unsigned int isum, int *errp); 147 int len, __wsum isum, int *errp);
146extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, 148extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
147 unsigned int sum); 149 __wsum sum);
148 150
149/* Old names. To be removed. */ 151/* Old names. To be removed. */
150#define csum_and_copy_to_user csum_partial_copy_to_user 152#define csum_and_copy_to_user csum_partial_copy_to_user
@@ -158,7 +160,7 @@ extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned
158 * Returns the 16bit folded/inverted checksum of the passed buffer. 160 * Returns the 16bit folded/inverted checksum of the passed buffer.
159 * Ready to fill in. 161 * Ready to fill in.
160 */ 162 */
161extern unsigned short ip_compute_csum(unsigned char * buff, int len); 163extern __sum16 ip_compute_csum(const void *buff, int len);
162 164
163/** 165/**
164 * csum_ipv6_magic - Compute checksum of an IPv6 pseudo header. 166 * csum_ipv6_magic - Compute checksum of an IPv6 pseudo header.
@@ -176,9 +178,9 @@ extern unsigned short ip_compute_csum(unsigned char * buff, int len);
176struct in6_addr; 178struct in6_addr;
177 179
178#define _HAVE_ARCH_IPV6_CSUM 1 180#define _HAVE_ARCH_IPV6_CSUM 1
179extern unsigned short 181extern __sum16
180csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 182csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
181 __u32 len, unsigned short proto, unsigned int sum); 183 __u32 len, unsigned short proto, __wsum sum);
182 184
183static inline unsigned add32_with_carry(unsigned a, unsigned b) 185static inline unsigned add32_with_carry(unsigned a, unsigned b)
184{ 186{
diff --git a/include/asm-x86_64/device.h b/include/asm-x86_64/device.h
new file mode 100644
index 000000000000..3afa03f33a36
--- /dev/null
+++ b/include/asm-x86_64/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_X86_64_DEVICE_H
7#define _ASM_X86_64_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_X86_64_DEVICE_H */
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h
index 03114f8d1e18..5435aff9a4b7 100644
--- a/include/asm-xtensa/checksum.h
+++ b/include/asm-xtensa/checksum.h
@@ -26,7 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30 30
31/* 31/*
32 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -36,7 +36,7 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38 38
39asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, 39asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len, __wsum sum,
40 int *src_err_ptr, int *dst_err_ptr); 40 int *src_err_ptr, int *dst_err_ptr);
41 41
42/* 42/*
@@ -46,34 +46,25 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
46 * If you use these functions directly please don't forget the access_ok(). 46 * If you use these functions directly please don't forget the access_ok().
47 */ 47 */
48static inline 48static inline
49unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, 49__wsum csum_partial_copy_nocheck(const void *src, void *dst,
50 int len, int sum) 50 int len, __wsum sum)
51{ 51{
52 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 52 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
53} 53}
54 54
55static inline 55static inline
56unsigned int csum_partial_copy_from_user ( const char *src, char *dst, 56__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
57 int len, int sum, int *err_ptr) 57 int len, __wsum sum, int *err_ptr)
58{ 58{
59 return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); 59 return csum_partial_copy_generic((__force const void *)src, dst,
60 len, sum, err_ptr, NULL);
60} 61}
61 62
62/* 63/*
63 * These are the old (and unsafe) way of doing checksums, a warning message will be
64 * printed if they are used and an exeption occurs.
65 *
66 * these functions should go away after some time.
67 */
68
69#define csum_partial_copy_fromuser csum_partial_copy
70unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum);
71
72/*
73 * Fold a partial checksum 64 * Fold a partial checksum
74 */ 65 */
75 66
76static __inline__ unsigned int csum_fold(unsigned int sum) 67static __inline__ __sum16 csum_fold(__wsum sum)
77{ 68{
78 unsigned int __dummy; 69 unsigned int __dummy;
79 __asm__("extui %1, %0, 16, 16\n\t" 70 __asm__("extui %1, %0, 16, 16\n\t"
@@ -87,14 +78,14 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
87 "extui %0, %0, 0, 16\n\t" 78 "extui %0, %0, 0, 16\n\t"
88 : "=r" (sum), "=&r" (__dummy) 79 : "=r" (sum), "=&r" (__dummy)
89 : "0" (sum)); 80 : "0" (sum));
90 return sum; 81 return (__force __sum16)sum;
91} 82}
92 83
93/* 84/*
94 * This is a version of ip_compute_csum() optimized for IP headers, 85 * This is a version of ip_compute_csum() optimized for IP headers,
95 * which always checksum on 4 octet boundaries. 86 * which always checksum on 4 octet boundaries.
96 */ 87 */
97static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) 88static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
98{ 89{
99 unsigned int sum, tmp, endaddr; 90 unsigned int sum, tmp, endaddr;
100 91
@@ -127,17 +118,16 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int
127 return csum_fold(sum); 118 return csum_fold(sum);
128} 119}
129 120
130static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, 121static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
131 unsigned long daddr,
132 unsigned short len, 122 unsigned short len,
133 unsigned short proto, 123 unsigned short proto,
134 unsigned int sum) 124 __wsum sum)
135{ 125{
136 126
137#ifdef __XTENSA_EL__ 127#ifdef __XTENSA_EL__
138 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 128 unsigned long len_proto = (len + proto) << 8;
139#elif defined(__XTENSA_EB__) 129#elif defined(__XTENSA_EB__)
140 unsigned long len_proto = (proto<<16)+len; 130 unsigned long len_proto = len + proto;
141#else 131#else
142# error processor byte order undefined! 132# error processor byte order undefined!
143#endif 133#endif
@@ -162,11 +152,10 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
162 * computes the checksum of the TCP/UDP pseudo-header 152 * computes the checksum of the TCP/UDP pseudo-header
163 * returns a 16-bit checksum, already complemented 153 * returns a 16-bit checksum, already complemented
164 */ 154 */
165static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, 155static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
166 unsigned long daddr,
167 unsigned short len, 156 unsigned short len,
168 unsigned short proto, 157 unsigned short proto,
169 unsigned int sum) 158 __wsum sum)
170{ 159{
171 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 160 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
172} 161}
@@ -176,17 +165,16 @@ static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr,
176 * in icmp.c 165 * in icmp.c
177 */ 166 */
178 167
179static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) 168static __inline__ __sum16 ip_compute_csum(const void *buff, int len)
180{ 169{
181 return csum_fold (csum_partial(buff, len, 0)); 170 return csum_fold (csum_partial(buff, len, 0));
182} 171}
183 172
184#define _HAVE_ARCH_IPV6_CSUM 173#define _HAVE_ARCH_IPV6_CSUM
185static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 174static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
186 struct in6_addr *daddr, 175 const struct in6_addr *daddr,
187 __u32 len, 176 __u32 len, unsigned short proto,
188 unsigned short proto, 177 __wsum sum)
189 unsigned int sum)
190{ 178{
191 unsigned int __dummy; 179 unsigned int __dummy;
192 __asm__("l32i %1, %2, 0\n\t" 180 __asm__("l32i %1, %2, 0\n\t"
@@ -248,8 +236,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
248 * Copy and checksum to user 236 * Copy and checksum to user
249 */ 237 */
250#define HAVE_CSUM_COPY_USER 238#define HAVE_CSUM_COPY_USER
251static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, 239static __inline__ __wsum csum_and_copy_to_user(const void *src, void __user *dst,
252 int len, int sum, int *err_ptr) 240 int len, __wsum sum, int *err_ptr)
253{ 241{
254 if (access_ok(VERIFY_WRITE, dst, len)) 242 if (access_ok(VERIFY_WRITE, dst, len))
255 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); 243 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr);
@@ -257,6 +245,6 @@ static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst
257 if (len) 245 if (len)
258 *err_ptr = -EFAULT; 246 *err_ptr = -EFAULT;
259 247
260 return -1; /* invalid checksum */ 248 return (__force __wsum)-1; /* invalid checksum */
261} 249}
262#endif 250#endif
diff --git a/include/asm-xtensa/device.h b/include/asm-xtensa/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-xtensa/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a1155a2beb32..ff433126361f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -60,8 +60,6 @@ header-y += fadvise.h
60header-y += fd.h 60header-y += fd.h
61header-y += fdreg.h 61header-y += fdreg.h
62header-y += fib_rules.h 62header-y += fib_rules.h
63header-y += ftape-header-segment.h
64header-y += ftape-vendors.h
65header-y += fuse.h 63header-y += fuse.h
66header-y += futex.h 64header-y += futex.h
67header-y += genetlink.h 65header-y += genetlink.h
@@ -193,7 +191,6 @@ unifdef-y += cuda.h
193unifdef-y += cyclades.h 191unifdef-y += cyclades.h
194unifdef-y += dccp.h 192unifdef-y += dccp.h
195unifdef-y += dirent.h 193unifdef-y += dirent.h
196unifdef-y += divert.h
197unifdef-y += dlm.h 194unifdef-y += dlm.h
198unifdef-y += elfcore.h 195unifdef-y += elfcore.h
199unifdef-y += errno.h 196unifdef-y += errno.h
@@ -207,7 +204,6 @@ unifdef-y += fcntl.h
207unifdef-y += filter.h 204unifdef-y += filter.h
208unifdef-y += flat.h 205unifdef-y += flat.h
209unifdef-y += fs.h 206unifdef-y += fs.h
210unifdef-y += ftape.h
211unifdef-y += gameport.h 207unifdef-y += gameport.h
212unifdef-y += generic_serial.h 208unifdef-y += generic_serial.h
213unifdef-y += genhd.h 209unifdef-y += genhd.h
@@ -342,6 +338,5 @@ unifdef-y += wait.h
342unifdef-y += wanrouter.h 338unifdef-y += wanrouter.h
343unifdef-y += watchdog.h 339unifdef-y += watchdog.h
344unifdef-y += xfrm.h 340unifdef-y += xfrm.h
345unifdef-y += zftape.h
346 341
347objhdr-y += version.h 342objhdr-y += version.h
diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h
index 24f82338f59a..ee108f9e9cb7 100644
--- a/include/linux/atmarp.h
+++ b/include/linux/atmarp.h
@@ -37,7 +37,7 @@ enum atmarp_ctrl_type {
37struct atmarp_ctrl { 37struct atmarp_ctrl {
38 enum atmarp_ctrl_type type; /* message type */ 38 enum atmarp_ctrl_type type; /* message type */
39 int itf_num;/* interface number (if present) */ 39 int itf_num;/* interface number (if present) */
40 uint32_t ip; /* IP address (act_need only) */ 40 __be32 ip; /* IP address (act_need only) */
41}; 41};
42 42
43#endif 43#endif
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 7981b733f1ef..969fb6c9e1cc 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -86,8 +86,8 @@ struct atm_backend_br2684 {
86 * efficient per-if in/out filters, this support will be removed 86 * efficient per-if in/out filters, this support will be removed
87 */ 87 */
88struct br2684_filter { 88struct br2684_filter {
89 __u32 prefix; /* network byte order */ 89 __be32 prefix; /* network byte order */
90 __u32 netmask; /* 0 = disable filter */ 90 __be32 netmask; /* 0 = disable filter */
91}; 91};
92 92
93struct br2684_filter_set { 93struct br2684_filter_set {
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h
index 5fbfa68136d3..ea1650425a12 100644
--- a/include/linux/atmmpc.h
+++ b/include/linux/atmmpc.h
@@ -13,7 +13,7 @@
13 13
14struct atmmpc_ioc { 14struct atmmpc_ioc {
15 int dev_num; 15 int dev_num;
16 uint32_t ipaddr; /* the IP address of the shortcut */ 16 __be32 ipaddr; /* the IP address of the shortcut */
17 int type; /* ingress or egress */ 17 int type; /* ingress or egress */
18}; 18};
19 19
@@ -21,8 +21,8 @@ typedef struct in_ctrl_info {
21 uint8_t Last_NHRP_CIE_code; 21 uint8_t Last_NHRP_CIE_code;
22 uint8_t Last_Q2931_cause_value; 22 uint8_t Last_Q2931_cause_value;
23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN]; 23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN];
24 uint32_t tag; 24 __be32 tag;
25 uint32_t in_dst_ip; /* IP address this ingress MPC sends packets to */ 25 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */
26 uint16_t holding_time; 26 uint16_t holding_time;
27 uint32_t request_id; 27 uint32_t request_id;
28} in_ctrl_info; 28} in_ctrl_info;
@@ -30,10 +30,10 @@ typedef struct in_ctrl_info {
30typedef struct eg_ctrl_info { 30typedef struct eg_ctrl_info {
31 uint8_t DLL_header[256]; 31 uint8_t DLL_header[256];
32 uint8_t DH_length; 32 uint8_t DH_length;
33 uint32_t cache_id; 33 __be32 cache_id;
34 uint32_t tag; 34 __be32 tag;
35 uint32_t mps_ip; 35 __be32 mps_ip;
36 uint32_t eg_dst_ip; /* IP address to which ingress MPC sends packets */ 36 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */
37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN]; 37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN];
38 uint16_t holding_time; 38 uint16_t holding_time;
39} eg_ctrl_info; 39} eg_ctrl_info;
@@ -49,7 +49,7 @@ struct mpc_parameters {
49 49
50struct k_message { 50struct k_message {
51 uint16_t type; 51 uint16_t type;
52 uint32_t ip_mask; 52 __be32 ip_mask;
53 uint8_t MPS_ctrl[ATM_ESA_LEN]; 53 uint8_t MPS_ctrl[ATM_ESA_LEN];
54 union { 54 union {
55 in_ctrl_info in_info; 55 in_ctrl_info in_info;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7bfcde2d5578..e1c7286165ff 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -678,10 +678,11 @@ extern void __blk_stop_queue(request_queue_t *q);
678extern void blk_run_queue(request_queue_t *); 678extern void blk_run_queue(request_queue_t *);
679extern void blk_start_queueing(request_queue_t *); 679extern void blk_start_queueing(request_queue_t *);
680extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); 680extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
681extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); 681extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned long);
682extern int blk_rq_unmap_user(struct bio *, unsigned int); 682extern int blk_rq_unmap_user(struct request *);
683extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t); 683extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t);
684extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 684extern int blk_rq_map_user_iov(request_queue_t *, struct request *,
685 struct sg_iovec *, int, unsigned int);
685extern int blk_execute_rq(request_queue_t *, struct gendisk *, 686extern int blk_execute_rq(request_queue_t *, struct gendisk *,
686 struct request *, int); 687 struct request *, int);
687extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, 688extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index b99a714fcac6..3680ff9a30ed 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -50,6 +50,15 @@ enum blktrace_act {
50}; 50};
51 51
52/* 52/*
53 * Notify events.
54 */
55enum blktrace_notify {
56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
57 __BLK_TN_TIMESTAMP, /* include system clock */
58};
59
60
61/*
53 * Trace actions in full. Additionally, read or write is masked 62 * Trace actions in full. Additionally, read or write is masked
54 */ 63 */
55#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) 64#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
@@ -68,6 +77,9 @@ enum blktrace_act {
68#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) 77#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
69#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) 78#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
70 79
80#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
81#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
82
71#define BLK_IO_TRACE_MAGIC 0x65617400 83#define BLK_IO_TRACE_MAGIC 0x65617400
72#define BLK_IO_TRACE_VERSION 0x07 84#define BLK_IO_TRACE_VERSION 0x07
73 85
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 53553c99cad6..ed6cc8962d87 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -30,7 +30,7 @@ struct dccp_hdr {
30#else 30#else
31#error "Adjust your <asm/byteorder.h> defines" 31#error "Adjust your <asm/byteorder.h> defines"
32#endif 32#endif
33 __u16 dccph_checksum; 33 __sum16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD) 34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u8 dccph_x:1, 35 __u8 dccph_x:1,
36 dccph_type:4, 36 dccph_type:4,
@@ -175,17 +175,21 @@ enum {
175 DCCPC_CCID3 = 3, 175 DCCPC_CCID3 = 3,
176}; 176};
177 177
178/* DCCP features */ 178/* DCCP features (RFC 4340 section 6.4) */
179enum { 179 enum {
180 DCCPF_RESERVED = 0, 180 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 181 DCCPF_CCID = 1,
182 DCCPF_SEQUENCE_WINDOW = 3, 182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */
183 DCCPF_ACK_RATIO = 5, 183 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_SEND_ACK_VECTOR = 6, 184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */
185 DCCPF_SEND_NDP_COUNT = 7, 185 DCCPF_ACK_RATIO = 5,
186 /* 10-127 reserved */ 186 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_MIN_CCID_SPECIFIC = 128, 187 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MAX_CCID_SPECIFIC = 255, 188 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */
190 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128,
192 DCCPF_MAX_CCID_SPECIFIC = 255,
189}; 193};
190 194
191/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ 195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
@@ -196,13 +200,16 @@ struct dccp_so_feat {
196}; 200};
197 201
198/* DCCP socket options */ 202/* DCCP socket options */
199#define DCCP_SOCKOPT_PACKET_SIZE 1 203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
200#define DCCP_SOCKOPT_SERVICE 2 204#define DCCP_SOCKOPT_SERVICE 2
201#define DCCP_SOCKOPT_CHANGE_L 3 205#define DCCP_SOCKOPT_CHANGE_L 3
202#define DCCP_SOCKOPT_CHANGE_R 4 206#define DCCP_SOCKOPT_CHANGE_R 4
207#define DCCP_SOCKOPT_SEND_CSCOV 10
208#define DCCP_SOCKOPT_RECV_CSCOV 11
203#define DCCP_SOCKOPT_CCID_RX_INFO 128 209#define DCCP_SOCKOPT_CCID_RX_INFO 128
204#define DCCP_SOCKOPT_CCID_TX_INFO 192 210#define DCCP_SOCKOPT_CCID_TX_INFO 192
205 211
212/* maximum number of services provided on the same listening port */
206#define DCCP_SERVICE_LIST_MAX_LEN 32 213#define DCCP_SERVICE_LIST_MAX_LEN 32
207 214
208#ifdef __KERNEL__ 215#ifdef __KERNEL__
@@ -256,6 +263,13 @@ static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
256 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb->h.raw;
257} 264}
258 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{
268 skb->h.raw = skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen);
270 return dccp_hdr(skb);
271}
272
259static 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)
260{ 274{
261 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
@@ -342,6 +356,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
342 * @dccpms_ccid - Congestion Control Id (CCID) (section 10) 356 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
343 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5) 357 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
344 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2) 358 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
359 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
360 * @dccpms_pending - List of features being negotiated
361 * @dccpms_conf -
345 */ 362 */
346struct dccp_minisock { 363struct dccp_minisock {
347 __u64 dccpms_sequence_window; 364 __u64 dccpms_sequence_window;
@@ -439,12 +456,25 @@ struct dccp_ackvec;
439 * @dccps_gss - greatest sequence number sent 456 * @dccps_gss - greatest sequence number sent
440 * @dccps_gsr - greatest valid sequence number received 457 * @dccps_gsr - greatest valid sequence number received
441 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 458 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
459 * @dccps_service - first (passive sock) or unique (active sock) service code
460 * @dccps_service_list - second .. last service code on passive socket
442 * @dccps_timestamp_time - time of latest TIMESTAMP option 461 * @dccps_timestamp_time - time of latest TIMESTAMP option
443 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
444 * @dccps_packet_size - Set thru setsockopt 463 * @dccps_l_ack_ratio -
445 * @dccps_role - Role of this sock, one of %dccp_role 464 * @dccps_r_ack_ratio -
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
446 * @dccps_ndp_count - number of Non Data Packets since last data packet 467 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache -
469 * @dccps_minisock -
447 * @dccps_hc_rx_ackvec - rx half connection ack vector 470 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid -
472 * @dccps_hc_tx_ccid -
473 * @dccps_options_received -
474 * @dccps_epoch -
475 * @dccps_role - Role of this sock, one of %dccp_role
476 * @dccps_hc_rx_insert_options -
477 * @dccps_hc_tx_insert_options -
448 * @dccps_xmit_timer - timer for when CCID is not ready to send 478 * @dccps_xmit_timer - timer for when CCID is not ready to send
449 */ 479 */
450struct dccp_sock { 480struct dccp_sock {
@@ -464,9 +494,10 @@ struct dccp_sock {
464 struct dccp_service_list *dccps_service_list; 494 struct dccp_service_list *dccps_service_list;
465 struct timeval dccps_timestamp_time; 495 struct timeval dccps_timestamp_time;
466 __u32 dccps_timestamp_echo; 496 __u32 dccps_timestamp_echo;
467 __u32 dccps_packet_size;
468 __u16 dccps_l_ack_ratio; 497 __u16 dccps_l_ack_ratio;
469 __u16 dccps_r_ack_ratio; 498 __u16 dccps_r_ack_ratio;
499 __u16 dccps_pcslen;
500 __u16 dccps_pcrlen;
470 unsigned long dccps_ndp_count; 501 unsigned long dccps_ndp_count;
471 __u32 dccps_mss_cache; 502 __u32 dccps_mss_cache;
472 struct dccp_minisock dccps_minisock; 503 struct dccp_minisock dccps_minisock;
diff --git a/include/linux/device.h b/include/linux/device.h
index 9d4f6a963936..583a341e016c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -21,6 +21,7 @@
21#include <linux/pm.h> 21#include <linux/pm.h>
22#include <asm/semaphore.h> 22#include <asm/semaphore.h>
23#include <asm/atomic.h> 23#include <asm/atomic.h>
24#include <asm/device.h>
24 25
25#define DEVICE_NAME_SIZE 50 26#define DEVICE_NAME_SIZE 50
26#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ 27#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */
@@ -42,6 +43,8 @@ struct bus_type {
42 struct klist klist_devices; 43 struct klist klist_devices;
43 struct klist klist_drivers; 44 struct klist klist_drivers;
44 45
46 struct blocking_notifier_head bus_notifier;
47
45 struct bus_attribute * bus_attrs; 48 struct bus_attribute * bus_attrs;
46 struct device_attribute * dev_attrs; 49 struct device_attribute * dev_attrs;
47 struct driver_attribute * drv_attrs; 50 struct driver_attribute * drv_attrs;
@@ -75,6 +78,29 @@ int __must_check bus_for_each_drv(struct bus_type *bus,
75 struct device_driver *start, void *data, 78 struct device_driver *start, void *data,
76 int (*fn)(struct device_driver *, void *)); 79 int (*fn)(struct device_driver *, void *));
77 80
81/*
82 * Bus notifiers: Get notified of addition/removal of devices
83 * and binding/unbinding of drivers to devices.
84 * In the long run, it should be a replacement for the platform
85 * notify hooks.
86 */
87struct notifier_block;
88
89extern int bus_register_notifier(struct bus_type *bus,
90 struct notifier_block *nb);
91extern int bus_unregister_notifier(struct bus_type *bus,
92 struct notifier_block *nb);
93
94/* All 4 notifers below get called with the target struct device *
95 * as an argument. Note that those functions are likely to be called
96 * with the device semaphore held in the core, so be careful.
97 */
98#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
99#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
100#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
101#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
102 unbound */
103
78/* driverfs interface for exporting bus attributes */ 104/* driverfs interface for exporting bus attributes */
79 105
80struct bus_attribute { 106struct bus_attribute {
@@ -343,8 +369,6 @@ struct device {
343 void *driver_data; /* data private to the driver */ 369 void *driver_data; /* data private to the driver */
344 void *platform_data; /* Platform specific data, device 370 void *platform_data; /* Platform specific data, device
345 core doesn't touch it */ 371 core doesn't touch it */
346 void *firmware_data; /* Firmware specific data (e.g. ACPI,
347 BIOS data),reserved for device core*/
348 struct dev_pm_info power; 372 struct dev_pm_info power;
349 373
350 u64 *dma_mask; /* dma mask (if dma'able device) */ 374 u64 *dma_mask; /* dma mask (if dma'able device) */
@@ -358,6 +382,8 @@ struct device {
358 382
359 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 383 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
360 override */ 384 override */
385 /* arch specific additions */
386 struct dev_archdata archdata;
361 387
362 /* class_device migration path */ 388 /* class_device migration path */
363 struct list_head node; 389 struct list_head node;
@@ -395,7 +421,10 @@ extern int __must_check device_add(struct device * dev);
395extern void device_del(struct device * dev); 421extern void device_del(struct device * dev);
396extern int device_for_each_child(struct device *, void *, 422extern int device_for_each_child(struct device *, void *,
397 int (*fn)(struct device *, void *)); 423 int (*fn)(struct device *, void *));
424extern struct device *device_find_child(struct device *, void *data,
425 int (*match)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name); 426extern int device_rename(struct device *dev, char *new_name);
427extern int device_move(struct device *dev, struct device *new_parent);
399 428
400/* 429/*
401 * Manual binding of a device to driver. See drivers/base/bus.c 430 * Manual binding of a device to driver. See drivers/base/bus.c
@@ -415,8 +444,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
415 __attribute__((format(printf,4,5))); 444 __attribute__((format(printf,4,5)));
416extern void device_destroy(struct class *cls, dev_t devt); 445extern void device_destroy(struct class *cls, dev_t devt);
417 446
418extern int virtual_device_parent(struct device *dev);
419
420/* 447/*
421 * Platform "fixup" functions - allow the platform to have their say 448 * Platform "fixup" functions - allow the platform to have their say
422 * about devices and actions that the general device layer doesn't 449 * about devices and actions that the general device layer doesn't
diff --git a/include/linux/divert.h b/include/linux/divert.h
deleted file mode 100644
index 8fb4e9de6843..000000000000
--- a/include/linux/divert.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * Frame Diversion, Benoit Locher <Benoit.Locher@skf.com>
3 *
4 * Changes:
5 * 06/09/2000 BL: initial version
6 *
7 */
8
9#ifndef _LINUX_DIVERT_H
10#define _LINUX_DIVERT_H
11
12#include <asm/types.h>
13
14#define MAX_DIVERT_PORTS 8 /* Max number of ports to divert (tcp, udp) */
15
16/* Divertable protocols */
17#define DIVERT_PROTO_NONE 0x0000
18#define DIVERT_PROTO_IP 0x0001
19#define DIVERT_PROTO_ICMP 0x0002
20#define DIVERT_PROTO_TCP 0x0004
21#define DIVERT_PROTO_UDP 0x0008
22
23/*
24 * This is an Ethernet Frame Diverter option block
25 */
26struct divert_blk
27{
28 int divert; /* are we active */
29 unsigned int protos; /* protocols */
30 __u16 tcp_dst[MAX_DIVERT_PORTS]; /* specific tcp dst ports to divert */
31 __u16 tcp_src[MAX_DIVERT_PORTS]; /* specific tcp src ports to divert */
32 __u16 udp_dst[MAX_DIVERT_PORTS]; /* specific udp dst ports to divert */
33 __u16 udp_src[MAX_DIVERT_PORTS]; /* specific udp src ports to divert */
34};
35
36/*
37 * Diversion control block, for configuration with the userspace tool
38 * divert
39 */
40
41typedef union _divert_cf_arg
42{
43 __s16 int16;
44 __u16 uint16;
45 __s32 int32;
46 __u32 uint32;
47 __s64 int64;
48 __u64 uint64;
49 void __user *ptr;
50} divert_cf_arg;
51
52
53struct divert_cf
54{
55 int cmd; /* Command */
56 divert_cf_arg arg1,
57 arg2,
58 arg3;
59 int dev_index; /* device index (eth0=0, etc...) */
60};
61
62
63/* Diversion commands */
64#define DIVCMD_DIVERT 1 /* ENABLE/DISABLE diversion */
65#define DIVCMD_IP 2 /* ENABLE/DISABLE whold IP diversion */
66#define DIVCMD_TCP 3 /* ENABLE/DISABLE whold TCP diversion */
67#define DIVCMD_TCPDST 4 /* ADD/REMOVE TCP DST port for diversion */
68#define DIVCMD_TCPSRC 5 /* ADD/REMOVE TCP SRC port for diversion */
69#define DIVCMD_UDP 6 /* ENABLE/DISABLE whole UDP diversion */
70#define DIVCMD_UDPDST 7 /* ADD/REMOVE UDP DST port for diversion */
71#define DIVCMD_UDPSRC 8 /* ADD/REMOVE UDP SRC port for diversion */
72#define DIVCMD_ICMP 9 /* ENABLE/DISABLE whole ICMP diversion */
73#define DIVCMD_GETSTATUS 10 /* GET the status of the diverter */
74#define DIVCMD_RESET 11 /* Reset the diverter on the specified dev */
75#define DIVCMD_GETVERSION 12 /* Retrieve the diverter code version (char[32]) */
76
77/* General syntax of the commands:
78 *
79 * DIVCMD_xxxxxx(arg1, arg2, arg3, dev_index)
80 *
81 * SIOCSIFDIVERT:
82 * DIVCMD_DIVERT(DIVARG1_ENABLE|DIVARG1_DISABLE, , ,ifindex)
83 * DIVCMD_IP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
84 * DIVCMD_TCP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
85 * DIVCMD_TCPDST(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
86 * DIVCMD_TCPSRC(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
87 * DIVCMD_UDP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
88 * DIVCMD_UDPDST(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
89 * DIVCMD_UDPSRC(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
90 * DIVCMD_ICMP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
91 * DIVCMD_RESET(, , , ifindex)
92 *
93 * SIOGIFDIVERT:
94 * DIVCMD_GETSTATUS(divert_blk, , , ifindex)
95 * DIVCMD_GETVERSION(string[3])
96 */
97
98
99/* Possible values for arg1 */
100#define DIVARG1_ENABLE 0 /* ENABLE something */
101#define DIVARG1_DISABLE 1 /* DISABLE something */
102#define DIVARG1_ADD 2 /* ADD something */
103#define DIVARG1_REMOVE 3 /* REMOVE something */
104
105
106#ifdef __KERNEL__
107
108/* diverter functions */
109#include <linux/skbuff.h>
110
111#ifdef CONFIG_NET_DIVERT
112#include <linux/netdevice.h>
113
114int alloc_divert_blk(struct net_device *);
115void free_divert_blk(struct net_device *);
116int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg);
117void divert_frame(struct sk_buff *skb);
118static inline void handle_diverter(struct sk_buff *skb)
119{
120 /* if diversion is supported on device, then divert */
121 if (skb->dev->divert && skb->dev->divert->divert)
122 divert_frame(skb);
123}
124
125#else
126# define alloc_divert_blk(dev) (0)
127# define free_divert_blk(dev) do {} while (0)
128# define divert_ioctl(cmd, arg) (-ENOPKG)
129# define handle_diverter(skb) do {} while (0)
130#endif
131#endif
132#endif /* _LINUX_DIVERT_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 2fa9f1144228..a24931d24404 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -21,11 +21,11 @@ typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
21typedef int (elevator_may_queue_fn) (request_queue_t *, int); 21typedef int (elevator_may_queue_fn) (request_queue_t *, int);
22 22
23typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t); 23typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t);
24typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); 24typedef void (elevator_put_req_fn) (struct request *);
25typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 25typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
26typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 26typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
27 27
28typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *); 28typedef void *(elevator_init_fn) (request_queue_t *);
29typedef void (elevator_exit_fn) (elevator_t *); 29typedef void (elevator_exit_fn) (elevator_t *);
30 30
31struct elevator_ops 31struct elevator_ops
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 3e69241e6a81..fa23e0671bb3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -774,8 +774,8 @@ struct fb_info {
774#endif 774#endif
775 775
776 struct fb_ops *fbops; 776 struct fb_ops *fbops;
777 struct device *device; 777 struct device *device; /* This is the parent */
778 struct class_device *class_device; /* sysfs per device attrs */ 778 struct device *dev; /* This is this fb device */
779 int class_flag; /* private sysfs flags */ 779 int class_flag; /* private sysfs flags */
780#ifdef CONFIG_FB_TILEBLITTING 780#ifdef CONFIG_FB_TILEBLITTING
781 struct fb_tile_ops *tileops; /* Tile Blitting */ 781 struct fb_tile_ops *tileops; /* Tile Blitting */
@@ -910,8 +910,8 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
910/* drivers/video/fbsysfs.c */ 910/* drivers/video/fbsysfs.c */
911extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 911extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
912extern void framebuffer_release(struct fb_info *info); 912extern void framebuffer_release(struct fb_info *info);
913extern int fb_init_class_device(struct fb_info *fb_info); 913extern int fb_init_device(struct fb_info *fb_info);
914extern void fb_cleanup_class_device(struct fb_info *head); 914extern void fb_cleanup_device(struct fb_info *head);
915extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); 915extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
916 916
917/* drivers/video/fbmon.c */ 917/* drivers/video/fbmon.c */
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 4418c8d9d479..8270aac2aa5d 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -6,6 +6,7 @@
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 1
9#define FIB_RULE_INVERT 2
9 10
10struct fib_rule_hdr 11struct fib_rule_hdr
11{ 12{
@@ -34,7 +35,7 @@ enum
34 FRA_UNUSED3, 35 FRA_UNUSED3,
35 FRA_UNUSED4, 36 FRA_UNUSED4,
36 FRA_UNUSED5, 37 FRA_UNUSED5,
37 FRA_FWMARK, /* netfilter mark */ 38 FRA_FWMARK, /* mark */
38 FRA_FLOW, /* flow/class id */ 39 FRA_FLOW, /* flow/class id */
39 FRA_UNUSED6, 40 FRA_UNUSED6,
40 FRA_UNUSED7, 41 FRA_UNUSED7,
diff --git a/include/linux/ftape-header-segment.h b/include/linux/ftape-header-segment.h
deleted file mode 100644
index 4732218f0708..000000000000
--- a/include/linux/ftape-header-segment.h
+++ /dev/null
@@ -1,122 +0,0 @@
1#ifndef _FTAPE_HEADER_SEGMENT_H
2#define _FTAPE_HEADER_SEGMENT_H
3
4/*
5 * Copyright (C) 1996-1997 Claus-Justus Heine.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 *
22 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-header-segment.h,v $
23 * $Revision: 1.2 $
24 * $Date: 1997/10/05 19:19:28 $
25 *
26 * This file defines some offsets into the header segment of a
27 * floppy tape cartridge. For use with the QIC-40/80/3010/3020
28 * floppy-tape driver "ftape" for Linux.
29 */
30
31#define FT_SIGNATURE 0 /* must be 0xaa55aa55 */
32#define FT_FMT_CODE 4
33#define FT_REV_LEVEL 5 /* only for QIC-80 since. Rev. L (== 0x0c) */
34#define FT_HSEG_1 6 /* first header segment, except for format code 6 */
35#define FT_HSEG_2 8 /* second header segment, except for format code 6 */
36#define FT_FRST_SEG 10 /* first data segment, except for format code 6 */
37#define FT_LAST_SEG 12 /* last data segment, except for format code 6 */
38#define FT_FMT_DATE 14 /* date and time of most recent format, see below */
39#define FT_WR_DATE 18 /* date and time of most recent write or format */
40#define FT_SPT 24 /* segments per track */
41#define FT_TPC 26 /* tracks per cartridge */
42#define FT_FHM 27 /* floppy drive head (maximum of it) */
43#define FT_FTM 28 /* floppy track max. */
44#define FT_FSM 29 /* floppy sector max. (128) */
45#define FT_LABEL 30 /* floppy tape label */
46#define FT_LABEL_DATE 74 /* date and time the tape label was written */
47#define FT_LABEL_SZ (FT_LABEL_DATE - FT_LABEL)
48#define FT_CMAP_START 78 /* starting segment of compression map */
49#define FT_FMT_ERROR 128 /* must be set to 0xff if remainder gets lost during
50 * tape format
51 */
52#define FT_SEG_CNT 130 /* number of seg. written, formatted or verified
53 * through lifetime of tape (why not read?)
54 */
55#define FT_INIT_DATE 138 /* date and time of initial tape format */
56#define FT_FMT_CNT 142 /* number of times tape has been formatted */
57#define FT_FSL_CNT 144 /* number of segments in failed sector log */
58#define FT_MK_CODE 146 /* id string of tape manufacturer */
59#define FT_LOT_CODE 190 /* tape manufacturer lot code */
60#define FT_6_HSEG_1 234 /* first header segment for format code 6 */
61#define FT_6_HSEG_2 238 /* second header segment for format code 6 */
62#define FT_6_FRST_SEG 242 /* first data segment for format code 6 */
63#define FT_6_LAST_SEG 246 /* last data segment for format code 6 */
64
65#define FT_FSL 256
66#define FT_HEADER_END 256 /* space beyond this point:
67 * format codes 2, 3 and 5:
68 * - failed sector log until byte 2047
69 * - bad sector map in the reamining part of segment
70 * format codes 4 and 6:
71 * - bad sector map starts hear
72 */
73
74
75/* value to be stored at the FT_SIGNATURE offset
76 */
77#define FT_HSEG_MAGIC 0xaa55aa55
78#define FT_D2G_MAGIC 0x82288228 /* Ditto 2GB */
79
80/* data and time encoding: */
81#define FT_YEAR_SHIFT 25
82#define FT_YEAR_MASK 0xfe000000
83#define FT_YEAR_0 1970
84#define FT_YEAR_MAX 127
85#define FT_YEAR(year) ((((year)-FT_YEAR_0)<<FT_YEAR_SHIFT)&FT_YEAR_MASK)
86
87#define FT_TIME_SHIFT 0
88#define FT_TIME_MASK 0x01FFFFFF
89#define FT_TIME_MAX 0x01ea6dff /* last second of a year */
90#define FT_TIME(mo,d,h,m,s) \
91 ((((s)+60*((m)+60*((h)+24*((d)+31*(mo))))) & FT_TIME_MASK))
92
93#define FT_TIME_STAMP(y,mo,d,h,m,s) (FT_YEAR(y) | FT_TIME(mo,d,h,m,s))
94
95/* values for the format code field */
96typedef enum {
97 fmt_normal = 2, /* QIC-80 post Rev. B 205Ft or 307Ft tape */
98 fmt_1100ft = 3, /* QIC-80 post Rev. B 1100Ft tape */
99 fmt_var = 4, /* QIC-80 post Rev. B variabel length format */
100 fmt_425ft = 5, /* QIC-80 post Rev. B 425Ft tape */
101 fmt_big = 6 /* QIC-3010/3020 variable length tape with more
102 * than 2^16 segments per tape
103 */
104} ft_format_type;
105
106/* definitions for the failed sector log */
107#define FT_FSL_SIZE (2 * FT_SECTOR_SIZE - FT_HEADER_END)
108#define FT_FSL_MAX_ENTRIES (FT_FSL_SIZE/sizeof(__u32))
109
110typedef struct ft_fsl_entry {
111 __u16 segment;
112 __u16 date;
113} __attribute__ ((packed)) ft_fsl_entry;
114
115
116/* date encoding for the failed sector log
117 * month: 1..12, day: 1..31, year: 1970..2097
118 */
119#define FT_FSL_TIME_STAMP(y,m,d) \
120 (((((y) - FT_YEAR_0)<<9)&0xfe00) | (((m)<<5)&0x01e0) | ((d)&0x001f))
121
122#endif /* _FTAPE_HEADER_SEGMENT_H */
diff --git a/include/linux/ftape-vendors.h b/include/linux/ftape-vendors.h
deleted file mode 100644
index ec1a81f059e5..000000000000
--- a/include/linux/ftape-vendors.h
+++ /dev/null
@@ -1,137 +0,0 @@
1#ifndef _FTAPE_VENDORS_H
2#define _FTAPE_VENDORS_H
3
4/*
5 * Copyright (C) 1993-1996 Bas Laarhoven,
6 * (C) 1996-1997 Claus-Justus Heine.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *
23 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-vendors.h,v $
24 * $Revision: 1.6 $
25 * $Date: 1997/10/09 15:38:11 $
26 *
27 * This file contains the supported drive types with their
28 * QIC-117 spec. vendor code and drive dependent configuration
29 * information.
30 */
31
32typedef enum {
33 unknown_wake_up = 0,
34 no_wake_up,
35 wake_up_colorado,
36 wake_up_mountain,
37 wake_up_insight,
38} wake_up_types;
39
40typedef struct {
41 wake_up_types wake_up; /* see wake_up_types */
42 char *name; /* Text describing the drive */
43} wakeup_method;
44
45/* Note: order of entries in WAKEUP_METHODS must be so that a variable
46 * of type wake_up_types can be used as an index in the array.
47 */
48#define WAKEUP_METHODS { \
49 { unknown_wake_up, "Unknown" }, \
50 { no_wake_up, "None" }, \
51 { wake_up_colorado, "Colorado" }, \
52 { wake_up_mountain, "Mountain" }, \
53 { wake_up_insight, "Motor-on" }, \
54}
55
56typedef struct {
57 unsigned int vendor_id; /* vendor id from drive */
58 int speed; /* maximum tape transport speed (ips) */
59 wake_up_types wake_up; /* see wake_up_types */
60 char *name; /* Text describing the drive */
61} vendor_struct;
62
63#define UNKNOWN_VENDOR (-1)
64
65#define QIC117_VENDORS { \
66/* see _vendor_struct */ \
67 { 0x00000, 82, wake_up_colorado, "Colorado DJ-10 (old)" }, \
68 { 0x00047, 90, wake_up_colorado, "Colorado DJ-10/DJ-20" }, \
69 { 0x011c2, 84, wake_up_colorado, "Colorado 700" }, \
70 { 0x011c3, 90, wake_up_colorado, "Colorado 1400" }, \
71 { 0x011c4, 84, wake_up_colorado, "Colorado DJ-10/DJ-20 (new)" }, \
72 { 0x011c5, 84, wake_up_colorado, "HP Colorado T1000" }, \
73 { 0x011c6, 90, wake_up_colorado, "HP Colorado T3000" }, \
74 { 0x00005, 45, wake_up_mountain, "Archive 5580i" }, \
75 { 0x10005, 50, wake_up_insight, "Insight 80Mb, Irwin 80SX" }, \
76 { 0x00140, 74, wake_up_mountain, "Archive S.Hornet [Identity/Escom]" }, \
77 { 0x00146, 72, wake_up_mountain, "Archive 31250Q [Escom]" }, \
78 { 0x0014a, 100, wake_up_mountain, "Archive XL9250i [Conner/Escom]" }, \
79 { 0x0014c, 98, wake_up_mountain, "Conner C250MQT" }, \
80 { 0x0014e, 80, wake_up_mountain, "Conner C250MQ" }, \
81 { 0x00150, 80, wake_up_mountain, "Conner TSM420R/TST800R" }, \
82 { 0x00152, 80, wake_up_mountain, "Conner TSM850R" }, \
83 { 0x00156, 80, wake_up_mountain, "Conner TSM850R/1700R/TST3200R" }, \
84 { 0x00180, 0, wake_up_mountain, "Summit SE 150" }, \
85 { 0x00181, 85, wake_up_mountain, "Summit SE 250, Mountain FS8000" }, \
86 { 0x001c1, 82, no_wake_up, "Wangtek 3040F" }, \
87 { 0x001c8, 64, no_wake_up, "Wangtek 3080F" }, \
88 { 0x001c8, 64, wake_up_colorado, "Wangtek 3080F" }, \
89 { 0x001ca, 67, no_wake_up, "Wangtek 3080F (new)" }, \
90 { 0x001cc, 77, wake_up_colorado, "Wangtek 3200 / Teac 700" }, \
91 { 0x001cd, 75, wake_up_colorado, "Reveal TB1400" }, \
92 { 0x00380, 85, wake_up_colorado, "Exabyte Eagle-96" }, \
93 { 0x00381, 85, wake_up_colorado, "Exabyte Eagle TR-3" }, \
94 { 0x00382, 85, wake_up_colorado, "Exabyte Eagle TR-3" }, \
95 { 0x003ce, 77, wake_up_colorado, "Teac 800" }, \
96 { 0x003cf, 0, wake_up_colorado, "Teac FT3010TR" }, \
97 { 0x08880, 64, no_wake_up, "Iomega 250, Ditto 800" }, \
98 { 0x08880, 64, wake_up_colorado, "Iomega 250, Ditto 800" }, \
99 { 0x08880, 64, wake_up_insight, "Iomega 250, Ditto 800" }, \
100 { 0x08881, 80, wake_up_colorado, "Iomega 700" }, \
101 { 0x08882, 80, wake_up_colorado, "Iomega 3200" }, \
102 { 0x08883, 80, wake_up_colorado, "Iomega DITTO 2GB" }, \
103 { 0x00021, 70, no_wake_up, "AIWA CT-803" }, \
104 { 0x004c0, 80, no_wake_up, "AIWA TD-S1600" }, \
105 { 0x00021, 0, wake_up_mountain, "COREtape QIC80" }, \
106 { 0x00441, 0, wake_up_mountain, "ComByte DoublePlay" }, \
107 { 0x00481, 127, wake_up_mountain, "PERTEC MyTape 800" }, \
108 { 0x00483, 130, wake_up_mountain, "PERTEC MyTape 3200" }, \
109 { UNKNOWN_VENDOR, 0, no_wake_up, "unknown" } \
110}
111
112#define QIC117_MAKE_CODES { \
113 { 0, "Unassigned" }, \
114 { 1, "Alloy Computer Products" }, \
115 { 2, "3M" }, \
116 { 3, "Tandberg Data" }, \
117 { 4, "Colorado" }, \
118 { 5, "Archive/Conner" }, \
119 { 6, "Mountain/Summit Memory Systems" }, \
120 { 7, "Wangtek/Rexon/Tecmar" }, \
121 { 8, "Sony" }, \
122 { 9, "Cipher Data Products" }, \
123 { 10, "Irwin Magnetic Systems" }, \
124 { 11, "Braemar" }, \
125 { 12, "Verbatim" }, \
126 { 13, "Core International" }, \
127 { 14, "Exabyte" }, \
128 { 15, "Teac" }, \
129 { 16, "Gigatek" }, \
130 { 17, "ComByte" }, \
131 { 18, "PERTEC Memories" }, \
132 { 19, "Aiwa" }, \
133 { 71, "Colorado" }, \
134 { 546, "Iomega Inc" }, \
135}
136
137#endif /* _FTAPE_VENDORS_H */
diff --git a/include/linux/ftape.h b/include/linux/ftape.h
deleted file mode 100644
index 7e7038cba86a..000000000000
--- a/include/linux/ftape.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef _FTAPE_H
2#define _FTAPE_H
3
4/*
5 * Copyright (C) 1994-1996 Bas Laarhoven,
6 * (C) 1996-1997 Claus-Justus Heine.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *
23 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape.h,v $
24 * $Revision: 1.17.6.4 $
25 * $Date: 1997/11/25 01:52:54 $
26 *
27 * This file contains global definitions, typedefs and macro's
28 * for the QIC-40/80/3010/3020 floppy-tape driver for Linux.
29 */
30
31#define FTAPE_VERSION "ftape v3.04d 25/11/97"
32
33#ifdef __KERNEL__
34#include <linux/interrupt.h>
35#include <linux/mm.h>
36#endif
37#include <linux/types.h>
38#include <linux/mtio.h>
39
40#define FT_SECTOR(x) (x+1) /* sector offset into real sector */
41#define FT_SECTOR_SIZE 1024
42#define FT_SECTORS_PER_SEGMENT 32
43#define FT_ECC_SECTORS 3
44#define FT_SEGMENT_SIZE ((FT_SECTORS_PER_SEGMENT - FT_ECC_SECTORS) * FT_SECTOR_SIZE)
45#define FT_BUFF_SIZE (FT_SECTORS_PER_SEGMENT * FT_SECTOR_SIZE)
46
47/*
48 * bits of the minor device number that define drive selection
49 * methods. Could be used one day to access multiple tape
50 * drives on the same controller.
51 */
52#define FTAPE_SEL_A 0
53#define FTAPE_SEL_B 1
54#define FTAPE_SEL_C 2
55#define FTAPE_SEL_D 3
56#define FTAPE_SEL_MASK 3
57#define FTAPE_SEL(unit) ((unit) & FTAPE_SEL_MASK)
58#define FTAPE_NO_REWIND 4 /* mask for minor nr */
59
60/* the following two may be reported when MTIOCGET is requested ... */
61typedef union {
62 struct {
63 __u8 error;
64 __u8 command;
65 } error;
66 long space;
67} ft_drive_error;
68typedef union {
69 struct {
70 __u8 drive_status;
71 __u8 drive_config;
72 __u8 tape_status;
73 } status;
74 long space;
75} ft_drive_status;
76
77#ifdef __KERNEL__
78
79#define FT_RQM_DELAY 12
80#define FT_MILLISECOND 1
81#define FT_SECOND 1000
82#define FT_FOREVER -1
83#ifndef HZ
84#error "HZ undefined."
85#endif
86#define FT_USPT (1000000/HZ) /* microseconds per tick */
87
88/* This defines the number of retries that the driver will allow
89 * before giving up (and letting a higher level handle the error).
90 */
91#ifdef TESTING
92#define FT_SOFT_RETRIES 1 /* number of low level retries */
93#define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
94#else
95#define FT_SOFT_RETRIES 6 /* number of low level retries (triple) */
96#define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
97#endif
98
99#ifndef THE_FTAPE_MAINTAINER
100#define THE_FTAPE_MAINTAINER "the ftape maintainer"
101#endif
102
103/* Initialize missing configuration parameters.
104 */
105#ifndef CONFIG_FT_NR_BUFFERS
106# define CONFIG_FT_NR_BUFFERS 3
107#endif
108#ifndef CONFIG_FT_FDC_THR
109# define CONFIG_FT_FDC_THR 8
110#endif
111#ifndef CONFIG_FT_FDC_MAX_RATE
112# define CONFIG_FT_FDC_MAX_RATE 2000
113#endif
114#ifndef CONFIG_FT_FDC_BASE
115# define CONFIG_FT_FDC_BASE 0
116#endif
117#ifndef CONFIG_FT_FDC_IRQ
118# define CONFIG_FT_FDC_IRQ 0
119#endif
120#ifndef CONFIG_FT_FDC_DMA
121# define CONFIG_FT_FDC_DMA 0
122#endif
123
124/* Turn some booleans into numbers.
125 */
126#ifdef CONFIG_FT_PROBE_FC10
127# undef CONFIG_FT_PROBE_FC10
128# define CONFIG_FT_PROBE_FC10 1
129#else
130# define CONFIG_FT_PROBE_FC10 0
131#endif
132#ifdef CONFIG_FT_MACH2
133# undef CONFIG_FT_MACH2
134# define CONFIG_FT_MACH2 1
135#else
136# define CONFIG_FT_MACH2 0
137#endif
138
139/* Insert default settings
140 */
141#if CONFIG_FT_PROBE_FC10 == 1
142# if CONFIG_FT_FDC_BASE == 0
143# undef CONFIG_FT_FDC_BASE
144# define CONFIG_FT_FDC_BASE 0x180
145# endif
146# if CONFIG_FT_FDC_IRQ == 0
147# undef CONFIG_FT_FDC_IRQ
148# define CONFIG_FT_FDC_IRQ 9
149# endif
150# if CONFIG_FT_FDC_DMA == 0
151# undef CONFIG_FT_FDC_DMA
152# define CONFIG_FT_FDC_DMA 3
153# endif
154#elif CONFIG_FT_MACH2 == 1 /* CONFIG_FT_PROBE_FC10 == 1 */
155# if CONFIG_FT_FDC_BASE == 0
156# undef CONFIG_FT_FDC_BASE
157# define CONFIG_FT_FDC_BASE 0x1E0
158# endif
159# if CONFIG_FT_FDC_IRQ == 0
160# undef CONFIG_FT_FDC_IRQ
161# define CONFIG_FT_FDC_IRQ 6
162# endif
163# if CONFIG_FT_FDC_DMA == 0
164# undef CONFIG_FT_FDC_DMA
165# define CONFIG_FT_FDC_DMA 2
166# endif
167#elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */
168# if CONFIG_FT_FDC_BASE == 0
169# undef CONFIG_FT_FDC_BASE
170# define CONFIG_FT_FDC_BASE 0x370
171# endif
172# if CONFIG_FT_FDC_IRQ == 0
173# undef CONFIG_FT_FDC_IRQ
174# define CONFIG_FT_FDC_IRQ 6
175# endif
176# if CONFIG_FT_FDC_DMA == 0
177# undef CONFIG_FT_FDC_DMA
178# define CONFIG_FT_FDC_DMA 2
179# endif
180#else /* CONFIG_FT_ALT_FDC */
181# if CONFIG_FT_FDC_BASE == 0
182# undef CONFIG_FT_FDC_BASE
183# define CONFIG_FT_FDC_BASE 0x3f0
184# endif
185# if CONFIG_FT_FDC_IRQ == 0
186# undef CONFIG_FT_FDC_IRQ
187# define CONFIG_FT_FDC_IRQ 6
188# endif
189# if CONFIG_FT_FDC_DMA == 0
190# undef CONFIG_FT_FDC_DMA
191# define CONFIG_FT_FDC_DMA 2
192# endif
193#endif /* standard FDC */
194
195/* some useful macro's
196 */
197#define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x))
198
199#endif /* __KERNEL__ */
200
201#endif
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 878cfe4e587f..24da4fbc1a2f 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -68,7 +68,7 @@
68struct icmphdr { 68struct icmphdr {
69 __u8 type; 69 __u8 type;
70 __u8 code; 70 __u8 code;
71 __be16 checksum; 71 __sum16 checksum;
72 union { 72 union {
73 struct { 73 struct {
74 __be16 id; 74 __be16 id;
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index c771a7db9871..68d3526c3a05 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -7,17 +7,17 @@ struct icmp6hdr {
7 7
8 __u8 icmp6_type; 8 __u8 icmp6_type;
9 __u8 icmp6_code; 9 __u8 icmp6_code;
10 __u16 icmp6_cksum; 10 __sum16 icmp6_cksum;
11 11
12 12
13 union { 13 union {
14 __u32 un_data32[1]; 14 __be32 un_data32[1];
15 __u16 un_data16[2]; 15 __be16 un_data16[2];
16 __u8 un_data8[4]; 16 __u8 un_data8[4];
17 17
18 struct icmpv6_echo { 18 struct icmpv6_echo {
19 __u16 identifier; 19 __be16 identifier;
20 __u16 sequence; 20 __be16 sequence;
21 } u_echo; 21 } u_echo;
22 22
23 struct icmpv6_nd_advt { 23 struct icmpv6_nd_advt {
@@ -53,7 +53,7 @@ struct icmp6hdr {
53#else 53#else
54#error "Please fix <asm/byteorder.h>" 54#error "Please fix <asm/byteorder.h>"
55#endif 55#endif
56 __u16 rt_lifetime; 56 __be16 rt_lifetime;
57 } u_nd_ra; 57 } u_nd_ra;
58 58
59 } icmp6_dataun; 59 } icmp6_dataun;
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index b92558549d27..99393ef3af39 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -1,17 +1,19 @@
1#ifndef __LINUX_IF_PACKET_H 1#ifndef __LINUX_IF_PACKET_H
2#define __LINUX_IF_PACKET_H 2#define __LINUX_IF_PACKET_H
3 3
4#include <linux/types.h>
5
4struct sockaddr_pkt 6struct sockaddr_pkt
5{ 7{
6 unsigned short spkt_family; 8 unsigned short spkt_family;
7 unsigned char spkt_device[14]; 9 unsigned char spkt_device[14];
8 unsigned short spkt_protocol; 10 __be16 spkt_protocol;
9}; 11};
10 12
11struct sockaddr_ll 13struct sockaddr_ll
12{ 14{
13 unsigned short sll_family; 15 unsigned short sll_family;
14 unsigned short sll_protocol; 16 __be16 sll_protocol;
15 int sll_ifindex; 17 int sll_ifindex;
16 unsigned short sll_hatype; 18 unsigned short sll_hatype;
17 unsigned char sll_pkttype; 19 unsigned char sll_pkttype;
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index bef9f8fd93b3..8de079ba1107 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -19,10 +19,10 @@ struct ip_tunnel_parm
19{ 19{
20 char name[IFNAMSIZ]; 20 char name[IFNAMSIZ];
21 int link; 21 int link;
22 __u16 i_flags; 22 __be16 i_flags;
23 __u16 o_flags; 23 __be16 o_flags;
24 __u32 i_key; 24 __be32 i_key;
25 __u32 o_key; 25 __be32 o_key;
26 struct iphdr iph; 26 struct iphdr iph;
27}; 27};
28 28
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 21dd56905271..6e7ea2f0a57c 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -30,7 +30,7 @@ struct igmphdr
30{ 30{
31 __u8 type; 31 __u8 type;
32 __u8 code; /* For newer IGMP */ 32 __u8 code; /* For newer IGMP */
33 __be16 csum; 33 __sum16 csum;
34 __be32 group; 34 __be32 group;
35}; 35};
36 36
diff --git a/include/linux/in.h b/include/linux/in.h
index 2619859f6e1b..1912e7c0bc26 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -45,6 +45,7 @@ enum {
45 45
46 IPPROTO_COMP = 108, /* Compression Header protocol */ 46 IPPROTO_COMP = 108, /* Compression Header protocol */
47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ 47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
48 IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
48 49
49 IPPROTO_RAW = 255, /* Raw IP packets */ 50 IPPROTO_RAW = 255, /* Raw IP packets */
50 IPPROTO_MAX 51 IPPROTO_MAX
diff --git a/include/linux/in6.h b/include/linux/in6.h
index f28621f638e0..4e8350ae8869 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -54,7 +54,7 @@ extern const struct in6_addr in6addr_loopback;
54struct sockaddr_in6 { 54struct sockaddr_in6 {
55 unsigned short int sin6_family; /* AF_INET6 */ 55 unsigned short int sin6_family; /* AF_INET6 */
56 __be16 sin6_port; /* Transport layer port # */ 56 __be16 sin6_port; /* Transport layer port # */
57 __u32 sin6_flowinfo; /* IPv6 flow information */ 57 __be32 sin6_flowinfo; /* IPv6 flow information */
58 struct in6_addr sin6_addr; /* IPv6 address */ 58 struct in6_addr sin6_addr; /* IPv6 address */
59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */ 59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
60}; 60};
@@ -72,7 +72,7 @@ struct ipv6_mreq {
72struct in6_flowlabel_req 72struct in6_flowlabel_req
73{ 73{
74 struct in6_addr flr_dst; 74 struct in6_addr flr_dst;
75 __u32 flr_label; 75 __be32 flr_label;
76 __u8 flr_action; 76 __u8 flr_action;
77 __u8 flr_share; 77 __u8 flr_share;
78 __u16 flr_flags; 78 __u16 flr_flags;
diff --git a/include/linux/inet.h b/include/linux/inet.h
index b7c6da7d6d32..675a7dbe86f8 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -46,7 +46,7 @@
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __be32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); 49extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); 50extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
51#endif 51#endif
52#endif /* _LINUX_INET_H */ 52#endif /* _LINUX_INET_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5a0ab04627bc..c0f7aec331c2 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -124,12 +124,13 @@ static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
124 * Check if a mask is acceptable. 124 * Check if a mask is acceptable.
125 */ 125 */
126 126
127static __inline__ int bad_mask(u32 mask, u32 addr) 127static __inline__ int bad_mask(__be32 mask, __be32 addr)
128{ 128{
129 __u32 hmask;
129 if (addr & (mask = ~mask)) 130 if (addr & (mask = ~mask))
130 return 1; 131 return 1;
131 mask = ntohl(mask); 132 hmask = ntohl(mask);
132 if (mask & (mask+1)) 133 if (hmask & (hmask+1))
133 return 1; 134 return 1;
134 return 0; 135 return 0;
135} 136}
@@ -190,11 +191,12 @@ static __inline__ __be32 inet_make_mask(int logmask)
190 return 0; 191 return 0;
191} 192}
192 193
193static __inline__ int inet_mask_len(__u32 mask) 194static __inline__ int inet_mask_len(__be32 mask)
194{ 195{
195 if (!(mask = ntohl(mask))) 196 __u32 hmask = ntohl(mask);
197 if (!hmask)
196 return 0; 198 return 0;
197 return 32 - ffz(~mask); 199 return 32 - ffz(~hmask);
198} 200}
199 201
200 202
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index d42c83399071..cf8696d4a138 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -89,6 +89,7 @@ struct resource_list {
89#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ 89#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */
90#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */ 90#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */
91#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */ 91#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */
92#define IORESOURCE_ROM_BIOS_COPY (1<<3) /* ROM is BIOS copy, resource field overlaid */
92 93
93/* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 94/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
94extern struct resource ioport_resource; 95extern struct resource ioport_resource;
diff --git a/include/linux/ip.h b/include/linux/ip.h
index ecee9bb27d0e..1d36b971a8b5 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -98,7 +98,7 @@ struct iphdr {
98 __be16 frag_off; 98 __be16 frag_off;
99 __u8 ttl; 99 __u8 ttl;
100 __u8 protocol; 100 __u8 protocol;
101 __be16 check; 101 __sum16 check;
102 __be32 saddr; 102 __be32 saddr;
103 __be32 daddr; 103 __be32 daddr;
104 /*The options start here. */ 104 /*The options start here. */
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index 5c23aeb104ca..af3f4a70f3df 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -25,7 +25,7 @@ struct ip6_tnl_parm {
25 __u8 proto; /* tunnel protocol */ 25 __u8 proto; /* tunnel protocol */
26 __u8 encap_limit; /* encapsulation limit for tunnel */ 26 __u8 encap_limit; /* encapsulation limit for tunnel */
27 __u8 hop_limit; /* hop limit for tunnel */ 27 __u8 hop_limit; /* hop limit for tunnel */
28 __u32 flowinfo; /* traffic class and flowlabel for tunnel */ 28 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
29 __u32 flags; /* tunnel flags */ 29 __u32 flags; /* tunnel flags */
30 struct in6_addr laddr; /* local tunnel end-point address */ 30 struct in6_addr laddr; /* local tunnel end-point address */
31 struct in6_addr raddr; /* remote tunnel end-point address */ 31 struct in6_addr raddr; /* remote tunnel end-point address */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4f435c59de06..f8241130f5ea 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -274,7 +274,7 @@ struct ipv6_pinfo {
274 struct in6_addr *saddr_cache; 274 struct in6_addr *saddr_cache;
275#endif 275#endif
276 276
277 __u32 flow_label; 277 __be32 flow_label;
278 __u32 frag_size; 278 __u32 frag_size;
279 __s16 hop_limit; 279 __s16 hop_limit;
280 __s16 mcast_hops; 280 __s16 mcast_hops;
diff --git a/include/linux/ixjuser.h b/include/linux/ixjuser.h
index fd1756d3a47e..88b45895746d 100644
--- a/include/linux/ixjuser.h
+++ b/include/linux/ixjuser.h
@@ -315,7 +315,7 @@ typedef struct {
315* structures. If the freq0 variable is non-zero, the tone table contents 315* structures. If the freq0 variable is non-zero, the tone table contents
316* for the tone_index are updated to the frequencies and gains defined. It 316* for the tone_index are updated to the frequencies and gains defined. It
317* should be noted that DTMF tones cannot be reassigned, so if DTMF tone 317* should be noted that DTMF tones cannot be reassigned, so if DTMF tone
318* table indexs are used in a cadence the frequency and gain variables will 318* table indexes are used in a cadence the frequency and gain variables will
319* be ignored. 319* be ignored.
320* 320*
321* If the array elements contain frequency parameters the driver will 321* If the array elements contain frequency parameters the driver will
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c8d5f207c3d4..0ec6e28bccd2 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -74,7 +74,7 @@
74#define __jiffy_data __attribute__((section(".data"))) 74#define __jiffy_data __attribute__((section(".data")))
75 75
76/* 76/*
77 * The 64-bit value is not volatile - you MUST NOT read it 77 * The 64-bit value is not atomic - you MUST NOT read it
78 * without sampling the sequence number in xtime_lock. 78 * without sampling the sequence number in xtime_lock.
79 * get_jiffies_64() will do this for you as appropriate. 79 * get_jiffies_64() will do this for you as appropriate.
80 */ 80 */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 24b611147adb..6738283ac385 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -30,8 +30,10 @@ extern const char linux_banner[];
30 30
31#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
32 32
33#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
34#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
35
33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
34#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 37#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
36#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 38#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
37#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 39#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -63,7 +65,7 @@ struct user;
63 * context (spinlock, irq-handler, ...). 65 * context (spinlock, irq-handler, ...).
64 * 66 *
65 * This is a useful debugging help to be able to catch problems early and not 67 * This is a useful debugging help to be able to catch problems early and not
66 * be biten later when the calling function happens to sleep when it is not 68 * be bitten later when the calling function happens to sleep when it is not
67 * supposed to. 69 * supposed to.
68 */ 70 */
69#ifdef CONFIG_PREEMPT_VOLUNTARY 71#ifdef CONFIG_PREEMPT_VOLUNTARY
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 6427949ddf99..a4ede62b339d 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -122,6 +122,8 @@ extern struct kimage *kexec_crash_image;
122#define KEXEC_ARCH_IA_64 (50 << 16) 122#define KEXEC_ARCH_IA_64 (50 << 16)
123#define KEXEC_ARCH_S390 (22 << 16) 123#define KEXEC_ARCH_S390 (22 << 16)
124#define KEXEC_ARCH_SH (42 << 16) 124#define KEXEC_ARCH_SH (42 << 16)
125#define KEXEC_ARCH_MIPS_LE (10 << 16)
126#define KEXEC_ARCH_MIPS ( 8 << 16)
125 127
126#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 128#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
127 129
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bcd9cd173c2c..d1c8d28fa92e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -47,6 +47,7 @@ enum kobject_action {
47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ 47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */
48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ 48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */
49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ 49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
50 KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
50}; 51};
51 52
52struct kobject { 53struct kobject {
@@ -76,6 +77,7 @@ extern int __must_check kobject_add(struct kobject *);
76extern void kobject_del(struct kobject *); 77extern void kobject_del(struct kobject *);
77 78
78extern int __must_check kobject_rename(struct kobject *, const char *new_name); 79extern int __must_check kobject_rename(struct kobject *, const char *new_name);
80extern int __must_check kobject_move(struct kobject *, struct kobject *);
79 81
80extern int __must_check kobject_register(struct kobject *); 82extern int __must_check kobject_register(struct kobject *);
81extern void kobject_unregister(struct kobject *); 83extern void kobject_unregister(struct kobject *);
@@ -264,6 +266,8 @@ extern int __must_check subsys_create_file(struct subsystem * ,
264 266
265#if defined(CONFIG_HOTPLUG) 267#if defined(CONFIG_HOTPLUG)
266void kobject_uevent(struct kobject *kobj, enum kobject_action action); 268void kobject_uevent(struct kobject *kobj, enum kobject_action action);
269void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
270 char *envp[]);
267 271
268int add_uevent_var(char **envp, int num_envp, int *cur_index, 272int add_uevent_var(char **envp, int num_envp, int *cur_index,
269 char *buffer, int buffer_size, int *cur_len, 273 char *buffer, int buffer_size, int *cur_len,
@@ -271,6 +275,10 @@ int add_uevent_var(char **envp, int num_envp, int *cur_index,
271 __attribute__((format (printf, 7, 8))); 275 __attribute__((format (printf, 7, 8)));
272#else 276#else
273static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { } 277static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
278static inline void kobject_uevent_env(struct kobject *kobj,
279 enum kobject_action action,
280 char *envp[])
281{ }
274 282
275static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, 283static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
276 char *buffer, int buffer_size, int *cur_len, 284 char *buffer, int buffer_size, int *cur_len,
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index b03cfb91e228..326da7d500c7 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,15 +31,14 @@
31#define HPET_MINOR 228 31#define HPET_MINOR 228
32 32
33struct device; 33struct device;
34struct class_device;
35 34
36struct miscdevice { 35struct miscdevice {
37 int minor; 36 int minor;
38 const char *name; 37 const char *name;
39 const struct file_operations *fops; 38 const struct file_operations *fops;
40 struct list_head list; 39 struct list_head list;
41 struct device *dev; 40 struct device *parent;
42 struct class_device *class; 41 struct device *this_device;
43}; 42};
44 43
45extern int misc_register(struct miscdevice * misc); 44extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 991a37382a22..d0e6a5497614 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -39,6 +39,10 @@ struct mmc_csd {
39 write_misalign:1; 39 write_misalign:1;
40}; 40};
41 41
42struct mmc_ext_csd {
43 unsigned int hs_max_dtr;
44};
45
42struct sd_scr { 46struct sd_scr {
43 unsigned char sda_vsn; 47 unsigned char sda_vsn;
44 unsigned char bus_widths; 48 unsigned char bus_widths;
@@ -46,6 +50,10 @@ struct sd_scr {
46#define SD_SCR_BUS_WIDTH_4 (1<<2) 50#define SD_SCR_BUS_WIDTH_4 (1<<2)
47}; 51};
48 52
53struct sd_switch_caps {
54 unsigned int hs_max_dtr;
55};
56
49struct mmc_host; 57struct mmc_host;
50 58
51/* 59/*
@@ -62,12 +70,15 @@ struct mmc_card {
62#define MMC_STATE_BAD (1<<2) /* unrecognised device */ 70#define MMC_STATE_BAD (1<<2) /* unrecognised device */
63#define MMC_STATE_SDCARD (1<<3) /* is an SD card */ 71#define MMC_STATE_SDCARD (1<<3) /* is an SD card */
64#define MMC_STATE_READONLY (1<<4) /* card is read-only */ 72#define MMC_STATE_READONLY (1<<4) /* card is read-only */
73#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */
65 u32 raw_cid[4]; /* raw card CID */ 74 u32 raw_cid[4]; /* raw card CID */
66 u32 raw_csd[4]; /* raw card CSD */ 75 u32 raw_csd[4]; /* raw card CSD */
67 u32 raw_scr[2]; /* raw card SCR */ 76 u32 raw_scr[2]; /* raw card SCR */
68 struct mmc_cid cid; /* card identification */ 77 struct mmc_cid cid; /* card identification */
69 struct mmc_csd csd; /* card specific */ 78 struct mmc_csd csd; /* card specific */
79 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
70 struct sd_scr scr; /* extra SD information */ 80 struct sd_scr scr; /* extra SD information */
81 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
71}; 82};
72 83
73#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 84#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
@@ -75,12 +86,14 @@ struct mmc_card {
75#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) 86#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
76#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) 87#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
77#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 88#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
89#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
78 90
79#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 91#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
80#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) 92#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
81#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) 93#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
82#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) 94#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
83#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 95#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
96#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
84 97
85#define mmc_card_name(c) ((c)->cid.prod_name) 98#define mmc_card_name(c) ((c)->cid.prod_name)
86#define mmc_card_id(c) ((c)->dev.bus_id) 99#define mmc_card_id(c) ((c)->dev.bus_id)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8b08ef3820f2..c15ae1986b98 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -74,8 +74,8 @@ struct mmc_card;
74struct device; 74struct device;
75 75
76struct mmc_host { 76struct mmc_host {
77 struct device *dev; 77 struct device *parent;
78 struct class_device class_dev; 78 struct device class_dev;
79 int index; 79 int index;
80 const struct mmc_host_ops *ops; 80 const struct mmc_host_ops *ops;
81 unsigned int f_min; 81 unsigned int f_min;
@@ -125,8 +125,8 @@ static inline void *mmc_priv(struct mmc_host *host)
125 return (void *)host->private; 125 return (void *)host->private;
126} 126}
127 127
128#define mmc_dev(x) ((x)->dev) 128#define mmc_dev(x) ((x)->parent)
129#define mmc_hostname(x) ((x)->class_dev.class_id) 129#define mmc_hostname(x) ((x)->class_dev.bus_id)
130 130
131extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 131extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
132extern int mmc_resume_host(struct mmc_host *); 132extern int mmc_resume_host(struct mmc_host *);
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 08dec8d9e703..2dce60c43f4b 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -25,14 +25,16 @@
25#ifndef MMC_MMC_PROTOCOL_H 25#ifndef MMC_MMC_PROTOCOL_H
26#define MMC_MMC_PROTOCOL_H 26#define MMC_MMC_PROTOCOL_H
27 27
28/* Standard MMC commands (3.1) type argument response */ 28/* Standard MMC commands (4.1) type argument response */
29 /* class 1 */ 29 /* class 1 */
30#define MMC_GO_IDLE_STATE 0 /* bc */ 30#define MMC_GO_IDLE_STATE 0 /* bc */
31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */ 31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
32#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
34#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 34#define MMC_SET_DSR 4 /* bc [31:16] RCA */
35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
35#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
36#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */ 38#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */
37#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */ 39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
38#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
@@ -80,6 +82,7 @@
80 /* class 8 */ 82 /* class 8 */
81/* This is basically the same command as for MMC with some quirks. */ 83/* This is basically the same command as for MMC with some quirks. */
82#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */ 84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
85#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
83 86
84 /* Application commands */ 87 /* Application commands */
85#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 88#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
@@ -88,6 +91,30 @@
88#define SD_APP_SEND_SCR 51 /* adtc R1 */ 91#define SD_APP_SEND_SCR 51 /* adtc R1 */
89 92
90/* 93/*
94 * MMC_SWITCH argument format:
95 *
96 * [31:26] Always 0
97 * [25:24] Access Mode
98 * [23:16] Location of target Byte in EXT_CSD
99 * [15:08] Value Byte
100 * [07:03] Always 0
101 * [02:00] Command Set
102 */
103
104/*
105 * SD_SWITCH argument format:
106 *
107 * [31] Check (0) or switch (1)
108 * [30:24] Reserved (0)
109 * [23:20] Function group 6
110 * [19:16] Function group 5
111 * [15:12] Function group 4
112 * [11:8] Function group 3
113 * [7:4] Function group 2
114 * [3:0] Function group 1
115 */
116
117/*
91 MMC status in R1 118 MMC status in R1
92 Type 119 Type
93 e : error bit 120 e : error bit
@@ -230,13 +257,54 @@ struct _mmc_csd {
230 257
231#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */ 258#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */
232#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */ 259#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */
233#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 */ 260#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 - 3.2 - 3.31 - 4.0 - 4.1 */
261#define CSD_STRUCT_EXT_CSD 3 /* Version is coded in CSD_STRUCTURE in EXT_CSD */
234 262
235#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */ 263#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */
236#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */ 264#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */
237#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ 265#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
238#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ 266#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 - 3.2 - 3.31 */
267#define CSD_SPEC_VER_4 4 /* Implements system specification 4.0 - 4.1 */
268
269/*
270 * EXT_CSD fields
271 */
272
273#define EXT_CSD_BUS_WIDTH 183 /* R/W */
274#define EXT_CSD_HS_TIMING 185 /* R/W */
275#define EXT_CSD_CARD_TYPE 196 /* RO */
276
277/*
278 * EXT_CSD field definitions
279 */
280
281#define EXT_CSD_CMD_SET_NORMAL (1<<0)
282#define EXT_CSD_CMD_SET_SECURE (1<<1)
283#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
284
285#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
286#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
287
288#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
289#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
290#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
291
292/*
293 * MMC_SWITCH access modes
294 */
295
296#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
297#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */
298#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
299#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
300
301/*
302 * SCR field definitions
303 */
239 304
305#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
306#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
307#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
240 308
241/* 309/*
242 * SD bus widths 310 * SD bus widths
diff --git a/include/linux/module.h b/include/linux/module.h
index d1d00ce8f4ed..9258ffd8a7f0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -264,6 +264,7 @@ struct module
264 struct module_attribute *modinfo_attrs; 264 struct module_attribute *modinfo_attrs;
265 const char *version; 265 const char *version;
266 const char *srcversion; 266 const char *srcversion;
267 struct kobject *drivers_dir;
267 268
268 /* Exported symbols */ 269 /* Exported symbols */
269 const struct kernel_symbol *syms; 270 const struct kernel_symbol *syms;
diff --git a/include/linux/mqueue.h b/include/linux/mqueue.h
index 8db9d75541a6..8b5a79615fbf 100644
--- a/include/linux/mqueue.h
+++ b/include/linux/mqueue.h
@@ -18,8 +18,6 @@
18#ifndef _LINUX_MQUEUE_H 18#ifndef _LINUX_MQUEUE_H
19#define _LINUX_MQUEUE_H 19#define _LINUX_MQUEUE_H
20 20
21#include <linux/types.h>
22
23#define MQ_PRIO_MAX 32768 21#define MQ_PRIO_MAX 32768
24/* per-uid limit of kernel memory used by mqueue, in bytes */ 22/* per-uid limit of kernel memory used by mqueue, in bytes */
25#define MQ_BYTES_MAX 819200 23#define MQ_BYTES_MAX 819200
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index edfa012fad3a..aff25c000abf 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -724,7 +724,7 @@
724#define MV643XX_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port) (0x2470 + (port<<10)) 724#define MV643XX_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port) (0x2470 + (port<<10))
725#define MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port) (0x2474 + (port<<10)) 725#define MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port) (0x2474 + (port<<10))
726#define MV643XX_ETH_RX_MINIMAL_FRAME_SIZE_REG(port) (0x247c + (port<<10)) 726#define MV643XX_ETH_RX_MINIMAL_FRAME_SIZE_REG(port) (0x247c + (port<<10))
727#define MV643XX_ETH_RX_DISCARDED_FRAMES_COUNTER(port) (0x2484 + (port<<10) 727#define MV643XX_ETH_RX_DISCARDED_FRAMES_COUNTER(port) (0x2484 + (port<<10))
728#define MV643XX_ETH_PORT_DEBUG_0_REG(port) (0x248c + (port<<10)) 728#define MV643XX_ETH_PORT_DEBUG_0_REG(port) (0x248c + (port<<10))
729#define MV643XX_ETH_PORT_DEBUG_1_REG(port) (0x2490 + (port<<10)) 729#define MV643XX_ETH_PORT_DEBUG_1_REG(port) (0x2490 + (port<<10))
730#define MV643XX_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port) (0x2494 + (port<<10)) 730#define MV643XX_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port) (0x2494 + (port<<10))
@@ -1135,7 +1135,7 @@ struct mv64xxx_i2c_pdata {
1135#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_1 (1<<19) 1135#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_1 (1<<19)
1136#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_2 (1<<20) 1136#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_2 (1<<20)
1137#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_3 ((1<<20) | (1<<19)) 1137#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_3 ((1<<20) | (1<<19))
1138#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_4 ((1<<21) 1138#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_4 (1<<21)
1139#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_5 ((1<<21) | (1<<19)) 1139#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_5 ((1<<21) | (1<<19))
1140#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_6 ((1<<21) | (1<<20)) 1140#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_6 ((1<<21) | (1<<20))
1141#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_7 ((1<<21) | (1<<20) | (1<<19)) 1141#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_7 ((1<<21) | (1<<20) | (1<<19))
diff --git a/include/linux/net.h b/include/linux/net.h
index 15c733b816f0..6f0dfeba509a 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -196,7 +196,7 @@ extern struct socket *sockfd_lookup(int fd, int *err);
196extern int net_ratelimit(void); 196extern int net_ratelimit(void);
197 197
198#define net_random() random32() 198#define net_random() random32()
199#define net_srandom(seed) srandom32(seed) 199#define net_srandom(seed) srandom32((__force u32)seed)
200 200
201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
202 struct kvec *vec, size_t num, size_t len); 202 struct kvec *vec, size_t num, size_t len);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9264139bd8df..949eada46ce1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -38,7 +38,6 @@
38#include <linux/percpu.h> 38#include <linux/percpu.h>
39#include <linux/dmaengine.h> 39#include <linux/dmaengine.h>
40 40
41struct divert_blk;
42struct vlan_group; 41struct vlan_group;
43struct ethtool_ops; 42struct ethtool_ops;
44struct netpoll_info; 43struct netpoll_info;
@@ -67,6 +66,10 @@ struct netpoll_info;
67#define NET_RX_CN_HIGH 4 /* The storm is here */ 66#define NET_RX_CN_HIGH 4 /* The storm is here */
68#define NET_RX_BAD 5 /* packet dropped due to kernel error */ 67#define NET_RX_BAD 5 /* packet dropped due to kernel error */
69 68
69/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
70 * indicates that the device will soon be dropping packets, or already drops
71 * some packets of the same priority; prompting us to send less aggressively. */
72#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e))
70#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 73#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
71 74
72#endif 75#endif
@@ -93,8 +96,10 @@ struct netpoll_info;
93#endif 96#endif
94#endif 97#endif
95 98
96#if !defined(CONFIG_NET_IPIP) && \ 99#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
97 !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 100 !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \
101 !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
102 !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
98#define MAX_HEADER LL_MAX_HEADER 103#define MAX_HEADER LL_MAX_HEADER
99#else 104#else
100#define MAX_HEADER (LL_MAX_HEADER + 48) 105#define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -191,7 +196,7 @@ struct hh_cache
191 * NOTE: For VLANs, this will be the 196 * NOTE: For VLANs, this will be the
192 * encapuslated type. --BLG 197 * encapuslated type. --BLG
193 */ 198 */
194 int hh_len; /* length of header */ 199 u16 hh_len; /* length of header */
195 int (*hh_output)(struct sk_buff *skb); 200 int (*hh_output)(struct sk_buff *skb);
196 rwlock_t hh_lock; 201 rwlock_t hh_lock;
197 202
@@ -515,11 +520,6 @@ struct net_device
515 /* bridge stuff */ 520 /* bridge stuff */
516 struct net_bridge_port *br_port; 521 struct net_bridge_port *br_port;
517 522
518#ifdef CONFIG_NET_DIVERT
519 /* this will get initialized at each interface type init routine */
520 struct divert_blk *divert;
521#endif /* CONFIG_NET_DIVERT */
522
523 /* class/net/name entry */ 523 /* class/net/name entry */
524 struct class_device class_dev; 524 struct class_device class_dev;
525 /* space for optional statistics and wireless sysfs groups */ 525 /* space for optional statistics and wireless sysfs groups */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index b7e67d1d4382..d4c4c5120bc0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -117,6 +117,16 @@ void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
117int nf_register_sockopt(struct nf_sockopt_ops *reg); 117int nf_register_sockopt(struct nf_sockopt_ops *reg);
118void nf_unregister_sockopt(struct nf_sockopt_ops *reg); 118void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
119 119
120#ifdef CONFIG_SYSCTL
121/* Sysctl registration */
122struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path,
123 struct ctl_table *table);
124void nf_unregister_sysctl_table(struct ctl_table_header *header,
125 struct ctl_table *table);
126extern struct ctl_table nf_net_netfilter_sysctl_path[];
127extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[];
128#endif /* CONFIG_SYSCTL */
129
120extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 130extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
121 131
122/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will 132/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
@@ -282,15 +292,31 @@ extern void nf_invalidate_cache(int pf);
282 Returns true or false. */ 292 Returns true or false. */
283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 293extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
284 294
285extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval, 295static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
286 u_int32_t csum); 296{
287extern u_int16_t nf_proto_csum_update(struct sk_buff *skb, 297 __be32 diff[] = { ~from, to };
288 u_int32_t oldval, u_int32_t newval, 298
289 u_int16_t csum, int pseudohdr); 299 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
300}
301
302static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
303{
304 nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
305}
306
307extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
308 __be32 from, __be32 to, int pseudohdr);
309
310static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
311 __be16 from, __be16 to, int pseudohdr)
312{
313 nf_proto_csum_replace4(sum, skb, (__force __be32)from,
314 (__force __be32)to, pseudohdr);
315}
290 316
291struct nf_afinfo { 317struct nf_afinfo {
292 unsigned short family; 318 unsigned short family;
293 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, 319 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
294 unsigned int dataoff, u_int8_t protocol); 320 unsigned int dataoff, u_int8_t protocol);
295 void (*saveroute)(const struct sk_buff *skb, 321 void (*saveroute)(const struct sk_buff *skb,
296 struct nf_info *info); 322 struct nf_info *info);
@@ -305,12 +331,12 @@ static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
305 return rcu_dereference(nf_afinfo[family]); 331 return rcu_dereference(nf_afinfo[family]);
306} 332}
307 333
308static inline unsigned int 334static inline __sum16
309nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, 335nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
310 u_int8_t protocol, unsigned short family) 336 u_int8_t protocol, unsigned short family)
311{ 337{
312 struct nf_afinfo *afinfo; 338 struct nf_afinfo *afinfo;
313 unsigned int csum = 0; 339 __sum16 csum = 0;
314 340
315 rcu_read_lock(); 341 rcu_read_lock();
316 afinfo = nf_get_afinfo(family); 342 afinfo = nf_get_afinfo(family);
@@ -331,7 +357,7 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
331static inline void 357static inline void
332nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 358nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
333{ 359{
334#ifdef CONFIG_IP_NF_NAT_NEEDED 360#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED)
335 void (*decodefn)(struct sk_buff *, struct flowi *); 361 void (*decodefn)(struct sk_buff *, struct flowi *);
336 362
337 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) 363 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 312bd2ffee33..6328175a1c3a 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -14,6 +14,7 @@ header-y += xt_dscp.h
14header-y += xt_DSCP.h 14header-y += xt_DSCP.h
15header-y += xt_esp.h 15header-y += xt_esp.h
16header-y += xt_helper.h 16header-y += xt_helper.h
17header-y += xt_hashlimit.h
17header-y += xt_length.h 18header-y += xt_length.h
18header-y += xt_limit.h 19header-y += xt_limit.h
19header-y += xt_mac.h 20header-y += xt_mac.h
@@ -21,6 +22,7 @@ header-y += xt_mark.h
21header-y += xt_MARK.h 22header-y += xt_MARK.h
22header-y += xt_multiport.h 23header-y += xt_multiport.h
23header-y += xt_NFQUEUE.h 24header-y += xt_NFQUEUE.h
25header-y += xt_NFLOG.h
24header-y += xt_pkttype.h 26header-y += xt_pkttype.h
25header-y += xt_policy.h 27header-y += xt_policy.h
26header-y += xt_realm.h 28header-y += xt_realm.h
diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
new file mode 100644
index 000000000000..26c223544ae8
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_amanda.h
@@ -0,0 +1,10 @@
1#ifndef _NF_CONNTRACK_AMANDA_H
2#define _NF_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff **pskb,
6 enum ip_conntrack_info ctinfo,
7 unsigned int matchoff,
8 unsigned int matchlen,
9 struct nf_conntrack_expect *exp);
10#endif /* _NF_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index ad4a41c9ce93..81453ea7e4c2 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -3,16 +3,16 @@
3/* FTP tracking. */ 3/* FTP tracking. */
4 4
5/* This enum is exposed to userspace */ 5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type 6enum nf_ct_ftp_type
7{ 7{
8 /* PORT command from client */ 8 /* PORT command from client */
9 IP_CT_FTP_PORT, 9 NF_CT_FTP_PORT,
10 /* PASV response from server */ 10 /* PASV response from server */
11 IP_CT_FTP_PASV, 11 NF_CT_FTP_PASV,
12 /* EPRT command from client */ 12 /* EPRT command from client */
13 IP_CT_FTP_EPRT, 13 NF_CT_FTP_EPRT,
14 /* EPSV response from server */ 14 /* EPSV response from server */
15 IP_CT_FTP_EPSV, 15 NF_CT_FTP_EPSV,
16}; 16};
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
@@ -21,23 +21,23 @@ enum ip_ct_ftp_type
21 21
22#define NUM_SEQ_TO_REMEMBER 2 22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */ 23/* This structure exists only once per master */
24struct ip_ct_ftp_master { 24struct nf_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */ 25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; 26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */ 27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX]; 28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29}; 29};
30 30
31struct ip_conntrack_expect; 31struct nf_conntrack_expect;
32 32
33/* For NAT to hook in when we find a packet which describes what other 33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */ 34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, 35extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo, 36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type, 37 enum nf_ct_ftp_type type,
38 unsigned int matchoff, 38 unsigned int matchoff,
39 unsigned int matchlen, 39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp, 40 struct nf_conntrack_expect *exp,
41 u32 *seq); 41 u32 *seq);
42#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
43 43
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
new file mode 100644
index 000000000000..08e2f4977c2e
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -0,0 +1,92 @@
1#ifndef _NF_CONNTRACK_H323_H
2#define _NF_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 nf_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 __be16 sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 __be16 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 nf_conn;
31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr,
34 union nf_conntrack_address *addr, __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff **pskb,
40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr,
42 union nf_conntrack_address *addr,
43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff **pskb,
45 unsigned char **data, int dataoff,
46 TransportAddress *taddr,
47 union nf_conntrack_address *addr,
48 __be16 port);
49extern int (*set_sig_addr_hook) (struct sk_buff **pskb,
50 struct nf_conn *ct,
51 enum ip_conntrack_info ctinfo,
52 unsigned char **data,
53 TransportAddress *taddr, int count);
54extern int (*set_ras_addr_hook) (struct sk_buff **pskb,
55 struct nf_conn *ct,
56 enum ip_conntrack_info ctinfo,
57 unsigned char **data,
58 TransportAddress *taddr, int count);
59extern int (*nat_rtp_rtcp_hook) (struct sk_buff **pskb,
60 struct nf_conn *ct,
61 enum ip_conntrack_info ctinfo,
62 unsigned char **data, int dataoff,
63 H245_TransportAddress *taddr,
64 __be16 port, __be16 rtp_port,
65 struct nf_conntrack_expect *rtp_exp,
66 struct nf_conntrack_expect *rtcp_exp);
67extern int (*nat_t120_hook) (struct sk_buff **pskb, struct nf_conn *ct,
68 enum ip_conntrack_info ctinfo,
69 unsigned char **data, int dataoff,
70 H245_TransportAddress *taddr, __be16 port,
71 struct nf_conntrack_expect *exp);
72extern int (*nat_h245_hook) (struct sk_buff **pskb, struct nf_conn *ct,
73 enum ip_conntrack_info ctinfo,
74 unsigned char **data, int dataoff,
75 TransportAddress *taddr, __be16 port,
76 struct nf_conntrack_expect *exp);
77extern int (*nat_callforwarding_hook) (struct sk_buff **pskb,
78 struct nf_conn *ct,
79 enum ip_conntrack_info ctinfo,
80 unsigned char **data, int dataoff,
81 TransportAddress *taddr,
82 __be16 port,
83 struct nf_conntrack_expect *exp);
84extern int (*nat_q931_hook) (struct sk_buff **pskb, struct nf_conn *ct,
85 enum ip_conntrack_info ctinfo,
86 unsigned char **data, TransportAddress *taddr,
87 int idx, __be16 port,
88 struct nf_conntrack_expect *exp);
89
90#endif
91
92#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h b/include/linux/netfilter/nf_conntrack_h323_asn1.h
index c6e9a0b6d30b..8dab5968fc7e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
+++ b/include/linux/netfilter/nf_conntrack_h323_asn1.h
@@ -1,6 +1,6 @@
1/**************************************************************************** 1/****************************************************************************
2 * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323 2 * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
3 * conntrack/NAT module. 3 * conntrack/NAT module.
4 * 4 *
5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net> 5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
6 * 6 *
@@ -34,13 +34,13 @@
34 * 34 *
35 ****************************************************************************/ 35 ****************************************************************************/
36 36
37#ifndef _IP_CONNTRACK_HELPER_H323_ASN1_H_ 37#ifndef _NF_CONNTRACK_HELPER_H323_ASN1_H_
38#define _IP_CONNTRACK_HELPER_H323_ASN1_H_ 38#define _NF_CONNTRACK_HELPER_H323_ASN1_H_
39 39
40/***************************************************************************** 40/*****************************************************************************
41 * H.323 Types 41 * H.323 Types
42 ****************************************************************************/ 42 ****************************************************************************/
43#include "ip_conntrack_helper_h323_types.h" 43#include "nf_conntrack_h323_types.h"
44 44
45typedef struct { 45typedef struct {
46 enum { 46 enum {
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index 3d4a773799fc..38d74d5c9700 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -10,6 +10,11 @@ typedef struct TransportAddress_ipAddress { /* SEQUENCE */
10 unsigned ip; 10 unsigned ip;
11} TransportAddress_ipAddress; 11} TransportAddress_ipAddress;
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */
15 unsigned ip6;
16} TransportAddress_ip6Address;
17
13typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
14 enum { 19 enum {
15 eTransportAddress_ipAddress, 20 eTransportAddress_ipAddress,
@@ -22,6 +27,7 @@ typedef struct TransportAddress { /* CHOICE */
22 } choice; 27 } choice;
23 union { 28 union {
24 TransportAddress_ipAddress ipAddress; 29 TransportAddress_ipAddress ipAddress;
30 TransportAddress_ip6Address ip6Address;
25 }; 31 };
26} TransportAddress; 32} TransportAddress;
27 33
@@ -93,6 +99,11 @@ typedef struct UnicastAddress_iPAddress { /* SEQUENCE */
93 unsigned network; 99 unsigned network;
94} UnicastAddress_iPAddress; 100} UnicastAddress_iPAddress;
95 101
102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */
103 int options; /* No use */
104 unsigned network;
105} UnicastAddress_iP6Address;
106
96typedef struct UnicastAddress { /* CHOICE */ 107typedef struct UnicastAddress { /* CHOICE */
97 enum { 108 enum {
98 eUnicastAddress_iPAddress, 109 eUnicastAddress_iPAddress,
@@ -105,6 +116,7 @@ typedef struct UnicastAddress { /* CHOICE */
105 } choice; 116 } choice;
106 union { 117 union {
107 UnicastAddress_iPAddress iPAddress; 118 UnicastAddress_iPAddress iPAddress;
119 UnicastAddress_iP6Address iP6Address;
108 }; 120 };
109} UnicastAddress; 121} UnicastAddress;
110 122
diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h
new file mode 100644
index 000000000000..2ab6b8255911
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_irc.h
@@ -0,0 +1,15 @@
1#ifndef _NF_CONNTRACK_IRC_H
2#define _NF_CONNTRACK_IRC_H
3
4#ifdef __KERNEL__
5
6#define IRC_PORT 6667
7
8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff **pskb,
9 enum ip_conntrack_info ctinfo,
10 unsigned int matchoff,
11 unsigned int matchlen,
12 struct nf_conntrack_expect *exp);
13
14#endif /* __KERNEL__ */
15#endif /* _NF_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
new file mode 100644
index 000000000000..fb049ec11ff2
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -0,0 +1,321 @@
1/* PPTP constants and structs */
2#ifndef _NF_CONNTRACK_PPTP_H
3#define _NF_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/* conntrack private data */
27struct nf_ct_pptp_master {
28 enum pptp_ctrlsess_state sstate; /* session state */
29 enum pptp_ctrlcall_state cstate; /* call state */
30 __be16 pac_call_id; /* call id of PAC */
31 __be16 pns_call_id; /* call id of PNS */
32
33 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
34 * and therefore imposes a fixed limit on the number of maps */
35 struct nf_ct_gre_keymap *keymap[IP_CT_DIR_MAX];
36};
37
38struct nf_nat_pptp {
39 __be16 pns_call_id; /* NAT'ed PNS call id */
40 __be16 pac_call_id; /* NAT'ed PAC call id */
41};
42
43#ifdef __KERNEL__
44
45#define PPTP_CONTROL_PORT 1723
46
47#define PPTP_PACKET_CONTROL 1
48#define PPTP_PACKET_MGMT 2
49
50#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
51
52struct pptp_pkt_hdr {
53 __u16 packetLength;
54 __be16 packetType;
55 __be32 magicCookie;
56};
57
58/* PptpControlMessageType values */
59#define PPTP_START_SESSION_REQUEST 1
60#define PPTP_START_SESSION_REPLY 2
61#define PPTP_STOP_SESSION_REQUEST 3
62#define PPTP_STOP_SESSION_REPLY 4
63#define PPTP_ECHO_REQUEST 5
64#define PPTP_ECHO_REPLY 6
65#define PPTP_OUT_CALL_REQUEST 7
66#define PPTP_OUT_CALL_REPLY 8
67#define PPTP_IN_CALL_REQUEST 9
68#define PPTP_IN_CALL_REPLY 10
69#define PPTP_IN_CALL_CONNECT 11
70#define PPTP_CALL_CLEAR_REQUEST 12
71#define PPTP_CALL_DISCONNECT_NOTIFY 13
72#define PPTP_WAN_ERROR_NOTIFY 14
73#define PPTP_SET_LINK_INFO 15
74
75#define PPTP_MSG_MAX 15
76
77/* PptpGeneralError values */
78#define PPTP_ERROR_CODE_NONE 0
79#define PPTP_NOT_CONNECTED 1
80#define PPTP_BAD_FORMAT 2
81#define PPTP_BAD_VALUE 3
82#define PPTP_NO_RESOURCE 4
83#define PPTP_BAD_CALLID 5
84#define PPTP_REMOVE_DEVICE_ERROR 6
85
86struct PptpControlHeader {
87 __be16 messageType;
88 __u16 reserved;
89};
90
91/* FramingCapability Bitmap Values */
92#define PPTP_FRAME_CAP_ASYNC 0x1
93#define PPTP_FRAME_CAP_SYNC 0x2
94
95/* BearerCapability Bitmap Values */
96#define PPTP_BEARER_CAP_ANALOG 0x1
97#define PPTP_BEARER_CAP_DIGITAL 0x2
98
99struct PptpStartSessionRequest {
100 __be16 protocolVersion;
101 __u16 reserved1;
102 __be32 framingCapability;
103 __be32 bearerCapability;
104 __be16 maxChannels;
105 __be16 firmwareRevision;
106 __u8 hostName[64];
107 __u8 vendorString[64];
108};
109
110/* PptpStartSessionResultCode Values */
111#define PPTP_START_OK 1
112#define PPTP_START_GENERAL_ERROR 2
113#define PPTP_START_ALREADY_CONNECTED 3
114#define PPTP_START_NOT_AUTHORIZED 4
115#define PPTP_START_UNKNOWN_PROTOCOL 5
116
117struct PptpStartSessionReply {
118 __be16 protocolVersion;
119 __u8 resultCode;
120 __u8 generalErrorCode;
121 __be32 framingCapability;
122 __be32 bearerCapability;
123 __be16 maxChannels;
124 __be16 firmwareRevision;
125 __u8 hostName[64];
126 __u8 vendorString[64];
127};
128
129/* PptpStopReasons */
130#define PPTP_STOP_NONE 1
131#define PPTP_STOP_PROTOCOL 2
132#define PPTP_STOP_LOCAL_SHUTDOWN 3
133
134struct PptpStopSessionRequest {
135 __u8 reason;
136 __u8 reserved1;
137 __u16 reserved2;
138};
139
140/* PptpStopSessionResultCode */
141#define PPTP_STOP_OK 1
142#define PPTP_STOP_GENERAL_ERROR 2
143
144struct PptpStopSessionReply {
145 __u8 resultCode;
146 __u8 generalErrorCode;
147 __u16 reserved1;
148};
149
150struct PptpEchoRequest {
151 __be32 identNumber;
152};
153
154/* PptpEchoReplyResultCode */
155#define PPTP_ECHO_OK 1
156#define PPTP_ECHO_GENERAL_ERROR 2
157
158struct PptpEchoReply {
159 __be32 identNumber;
160 __u8 resultCode;
161 __u8 generalErrorCode;
162 __u16 reserved;
163};
164
165/* PptpFramingType */
166#define PPTP_ASYNC_FRAMING 1
167#define PPTP_SYNC_FRAMING 2
168#define PPTP_DONT_CARE_FRAMING 3
169
170/* PptpCallBearerType */
171#define PPTP_ANALOG_TYPE 1
172#define PPTP_DIGITAL_TYPE 2
173#define PPTP_DONT_CARE_BEARER_TYPE 3
174
175struct PptpOutCallRequest {
176 __be16 callID;
177 __be16 callSerialNumber;
178 __be32 minBPS;
179 __be32 maxBPS;
180 __be32 bearerType;
181 __be32 framingType;
182 __be16 packetWindow;
183 __be16 packetProcDelay;
184 __be16 phoneNumberLength;
185 __u16 reserved1;
186 __u8 phoneNumber[64];
187 __u8 subAddress[64];
188};
189
190/* PptpCallResultCode */
191#define PPTP_OUTCALL_CONNECT 1
192#define PPTP_OUTCALL_GENERAL_ERROR 2
193#define PPTP_OUTCALL_NO_CARRIER 3
194#define PPTP_OUTCALL_BUSY 4
195#define PPTP_OUTCALL_NO_DIAL_TONE 5
196#define PPTP_OUTCALL_TIMEOUT 6
197#define PPTP_OUTCALL_DONT_ACCEPT 7
198
199struct PptpOutCallReply {
200 __be16 callID;
201 __be16 peersCallID;
202 __u8 resultCode;
203 __u8 generalErrorCode;
204 __be16 causeCode;
205 __be32 connectSpeed;
206 __be16 packetWindow;
207 __be16 packetProcDelay;
208 __be32 physChannelID;
209};
210
211struct PptpInCallRequest {
212 __be16 callID;
213 __be16 callSerialNumber;
214 __be32 callBearerType;
215 __be32 physChannelID;
216 __be16 dialedNumberLength;
217 __be16 dialingNumberLength;
218 __u8 dialedNumber[64];
219 __u8 dialingNumber[64];
220 __u8 subAddress[64];
221};
222
223/* PptpInCallResultCode */
224#define PPTP_INCALL_ACCEPT 1
225#define PPTP_INCALL_GENERAL_ERROR 2
226#define PPTP_INCALL_DONT_ACCEPT 3
227
228struct PptpInCallReply {
229 __be16 callID;
230 __be16 peersCallID;
231 __u8 resultCode;
232 __u8 generalErrorCode;
233 __be16 packetWindow;
234 __be16 packetProcDelay;
235 __u16 reserved;
236};
237
238struct PptpInCallConnected {
239 __be16 peersCallID;
240 __u16 reserved;
241 __be32 connectSpeed;
242 __be16 packetWindow;
243 __be16 packetProcDelay;
244 __be32 callFramingType;
245};
246
247struct PptpClearCallRequest {
248 __be16 callID;
249 __u16 reserved;
250};
251
252struct PptpCallDisconnectNotify {
253 __be16 callID;
254 __u8 resultCode;
255 __u8 generalErrorCode;
256 __be16 causeCode;
257 __u16 reserved;
258 __u8 callStatistics[128];
259};
260
261struct PptpWanErrorNotify {
262 __be16 peersCallID;
263 __u16 reserved;
264 __be32 crcErrors;
265 __be32 framingErrors;
266 __be32 hardwareOverRuns;
267 __be32 bufferOverRuns;
268 __be32 timeoutErrors;
269 __be32 alignmentErrors;
270};
271
272struct PptpSetLinkInfo {
273 __be16 peersCallID;
274 __u16 reserved;
275 __be32 sendAccm;
276 __be32 recvAccm;
277};
278
279union pptp_ctrl_union {
280 struct PptpStartSessionRequest sreq;
281 struct PptpStartSessionReply srep;
282 struct PptpStopSessionRequest streq;
283 struct PptpStopSessionReply strep;
284 struct PptpOutCallRequest ocreq;
285 struct PptpOutCallReply ocack;
286 struct PptpInCallRequest icreq;
287 struct PptpInCallReply icack;
288 struct PptpInCallConnected iccon;
289 struct PptpClearCallRequest clrreq;
290 struct PptpCallDisconnectNotify disc;
291 struct PptpWanErrorNotify wanerr;
292 struct PptpSetLinkInfo setlink;
293};
294
295/* crap needed for nf_conntrack_compat.h */
296struct nf_conn;
297struct nf_conntrack_expect;
298enum ip_conntrack_info;
299
300extern int
301(*nf_nat_pptp_hook_outbound)(struct sk_buff **pskb,
302 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
303 struct PptpControlHeader *ctlh,
304 union pptp_ctrl_union *pptpReq);
305
306extern int
307(*nf_nat_pptp_hook_inbound)(struct sk_buff **pskb,
308 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
309 struct PptpControlHeader *ctlh,
310 union pptp_ctrl_union *pptpReq);
311
312extern void
313(*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *exp_orig,
314 struct nf_conntrack_expect *exp_reply);
315
316extern void
317(*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct,
318 struct nf_conntrack_expect *exp);
319
320#endif /* __KERNEL__ */
321#endif /* _NF_CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
new file mode 100644
index 000000000000..4e6bbce04ff8
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -0,0 +1,112 @@
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
67struct nf_ct_gre {
68 unsigned int stream_timeout;
69 unsigned int timeout;
70};
71
72#ifdef __KERNEL__
73#include <net/netfilter/nf_conntrack_tuple.h>
74
75struct nf_conn;
76
77/* structure for original <-> reply keymap */
78struct nf_ct_gre_keymap {
79 struct list_head list;
80 struct nf_conntrack_tuple tuple;
81};
82
83/* add new tuple->key_reply pair to keymap */
84int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
85 struct nf_conntrack_tuple *t);
86
87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89
90/* get pointer to gre key, if present */
91static inline __be32 *gre_key(struct gre_hdr *greh)
92{
93 if (!greh->key)
94 return NULL;
95 if (greh->csum || greh->routing)
96 return (__be32 *)(greh+sizeof(*greh)+4);
97 return (__be32 *)(greh+sizeof(*greh));
98}
99
100/* get pointer ot gre csum, if present */
101static inline __sum16 *gre_csum(struct gre_hdr *greh)
102{
103 if (!greh->csum)
104 return NULL;
105 return (__sum16 *)(greh+sizeof(*greh));
106}
107
108extern void nf_ct_gre_keymap_flush(void);
109extern void nf_nat_need_gre(void);
110
111#endif /* __KERNEL__ */
112#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
index b8994d9fd1a9..5cf2c115cce4 100644
--- a/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -20,7 +20,7 @@ struct ip_ct_sctp
20{ 20{
21 enum sctp_conntrack state; 21 enum sctp_conntrack state;
22 22
23 u_int32_t vtag[IP_CT_DIR_MAX]; 23 __be32 vtag[IP_CT_DIR_MAX];
24 u_int32_t ttag[IP_CT_DIR_MAX]; 24 u_int32_t ttag[IP_CT_DIR_MAX];
25}; 25};
26 26
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
new file mode 100644
index 000000000000..bb7f2041db74
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -0,0 +1,41 @@
1#ifndef __NF_CONNTRACK_SIP_H__
2#define __NF_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_IP4,
18 POS_CONNECTION_IP4,
19 POS_OWNER_IP6,
20 POS_CONNECTION_IP6,
21 POS_SDP_HEADER,
22};
23
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff **pskb,
25 enum ip_conntrack_info ctinfo,
26 struct nf_conn *ct,
27 const char **dptr);
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff **pskb,
29 enum ip_conntrack_info ctinfo,
30 struct nf_conntrack_expect *exp,
31 const char *dptr);
32
33extern int ct_sip_get_info(struct nf_conn *ct, const char *dptr, size_t dlen,
34 unsigned int *matchoff, unsigned int *matchlen,
35 enum sip_header_pos pos);
36extern int ct_sip_lnlen(const char *line, const char *limit);
37extern const char *ct_sip_search(const char *needle, const char *haystack,
38 size_t needle_len, size_t haystack_len,
39 int case_sensitive);
40#endif /* __KERNEL__ */
41#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nf_conntrack_tftp.h b/include/linux/netfilter/nf_conntrack_tftp.h
new file mode 100644
index 000000000000..0d79b7ae051f
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_tftp.h
@@ -0,0 +1,20 @@
1#ifndef _NF_CONNTRACK_TFTP_H
2#define _NF_CONNTRACK_TFTP_H
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 (*nf_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct nf_conntrack_expect *exp);
19
20#endif /* _NF_CONNTRACK_TFTP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 6d8e3e5a80e9..1e9c821f152d 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -78,7 +78,7 @@ struct nfattr
78struct nfgenmsg { 78struct nfgenmsg {
79 u_int8_t nfgen_family; /* AF_xxx */ 79 u_int8_t nfgen_family; /* AF_xxx */
80 u_int8_t version; /* nfnetlink version */ 80 u_int8_t version; /* nfnetlink version */
81 u_int16_t res_id; /* resource id */ 81 __be16 res_id; /* resource id */
82}; 82};
83 83
84#define NFNETLINK_V0 0 84#define NFNETLINK_V0 0
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index 87b92f8b988f..5966afa026e9 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -16,24 +16,22 @@ enum nfulnl_msg_types {
16}; 16};
17 17
18struct nfulnl_msg_packet_hdr { 18struct nfulnl_msg_packet_hdr {
19 u_int16_t hw_protocol; /* hw protocol (network order) */ 19 __be16 hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 u_int8_t hook; /* netfilter hook */
21 u_int8_t _pad; 21 u_int8_t _pad;
22}; 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 u_int16_t hw_addrlen; 25 __be16 hw_addrlen;
26 u_int16_t _pad; 26 u_int16_t _pad;
27 u_int8_t hw_addr[8]; 27 u_int8_t hw_addr[8];
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_u64 sec; 31 aligned_be64 sec;
32 aligned_u64 usec; 32 aligned_be64 usec;
33}; 33};
34 34
35#define NFULNL_PREFIXLEN 30 /* just like old log target */
36
37enum nfulnl_attr_type { 35enum nfulnl_attr_type {
38 NFULA_UNSPEC, 36 NFULA_UNSPEC,
39 NFULA_PACKET_HDR, 37 NFULA_PACKET_HDR,
@@ -67,7 +65,7 @@ struct nfulnl_msg_config_cmd {
67} __attribute__ ((packed)); 65} __attribute__ ((packed));
68 66
69struct nfulnl_msg_config_mode { 67struct nfulnl_msg_config_mode {
70 u_int32_t copy_range; 68 __be32 copy_range;
71 u_int8_t copy_mode; 69 u_int8_t copy_mode;
72 u_int8_t _pad; 70 u_int8_t _pad;
73} __attribute__ ((packed)); 71} __attribute__ ((packed));
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 36af0360b56d..83e789633e35 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -13,20 +13,20 @@ enum nfqnl_msg_types {
13}; 13};
14 14
15struct nfqnl_msg_packet_hdr { 15struct nfqnl_msg_packet_hdr {
16 u_int32_t packet_id; /* unique ID of packet in queue */ 16 __be32 packet_id; /* unique ID of packet in queue */
17 u_int16_t hw_protocol; /* hw protocol (network order) */ 17 __be16 hw_protocol; /* hw protocol (network order) */
18 u_int8_t hook; /* netfilter hook */ 18 u_int8_t hook; /* netfilter hook */
19} __attribute__ ((packed)); 19} __attribute__ ((packed));
20 20
21struct nfqnl_msg_packet_hw { 21struct nfqnl_msg_packet_hw {
22 u_int16_t hw_addrlen; 22 __be16 hw_addrlen;
23 u_int16_t _pad; 23 u_int16_t _pad;
24 u_int8_t hw_addr[8]; 24 u_int8_t hw_addr[8];
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_u64 sec; 28 aligned_be64 sec;
29 aligned_u64 usec; 29 aligned_be64 usec;
30}; 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
@@ -47,8 +47,8 @@ enum nfqnl_attr_type {
47#define NFQA_MAX (__NFQA_MAX - 1) 47#define NFQA_MAX (__NFQA_MAX - 1)
48 48
49struct nfqnl_msg_verdict_hdr { 49struct nfqnl_msg_verdict_hdr {
50 u_int32_t verdict; 50 __be32 verdict;
51 u_int32_t id; 51 __be32 id;
52}; 52};
53 53
54 54
@@ -63,7 +63,7 @@ enum nfqnl_msg_config_cmds {
63struct nfqnl_msg_config_cmd { 63struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 u_int8_t command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 u_int8_t _pad;
66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ 66 __be16 pf; /* AF_xxx for PF_[UN]BIND */
67}; 67};
68 68
69enum nfqnl_config_mode { 69enum nfqnl_config_mode {
@@ -73,7 +73,7 @@ enum nfqnl_config_mode {
73}; 73};
74 74
75struct nfqnl_msg_config_params { 75struct nfqnl_msg_config_params {
76 u_int32_t copy_range; 76 __be32 copy_range;
77 u_int8_t copy_mode; /* enum nfqnl_config_mode */ 77 u_int8_t copy_mode; /* enum nfqnl_config_mode */
78} __attribute__ ((packed)); 78} __attribute__ ((packed));
79 79
@@ -82,6 +82,7 @@ enum nfqnl_attr_config {
82 NFQA_CFG_UNSPEC, 82 NFQA_CFG_UNSPEC,
83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ 83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ 84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
85 NFQA_CFG_QUEUE_MAXLEN, /* u_int32_t */
85 __NFQA_CFG_MAX 86 __NFQA_CFG_MAX
86}; 87};
87#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) 88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h
new file mode 100644
index 000000000000..cdcd0ed58f7a
--- /dev/null
+++ b/include/linux/netfilter/xt_NFLOG.h
@@ -0,0 +1,18 @@
1#ifndef _XT_NFLOG_TARGET
2#define _XT_NFLOG_TARGET
3
4#define XT_NFLOG_DEFAULT_GROUP 0x1
5#define XT_NFLOG_DEFAULT_THRESHOLD 1
6
7#define XT_NFLOG_MASK 0x0
8
9struct xt_nflog_info {
10 u_int32_t len;
11 u_int16_t group;
12 u_int16_t threshold;
13 u_int16_t flags;
14 u_int16_t pad;
15 char prefix[64];
16};
17
18#endif /* _XT_NFLOG_TARGET */
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 4c2d9945ca54..70b6f718cf4c 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -29,14 +29,14 @@
29struct ip_conntrack_old_tuple 29struct ip_conntrack_old_tuple
30{ 30{
31 struct { 31 struct {
32 __u32 ip; 32 __be32 ip;
33 union { 33 union {
34 __u16 all; 34 __u16 all;
35 } u; 35 } u;
36 } src; 36 } src;
37 37
38 struct { 38 struct {
39 __u32 ip; 39 __be32 ip;
40 union { 40 union {
41 __u16 all; 41 __u16 all;
42 } u; 42 } u;
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
new file mode 100644
index 000000000000..b4556b8edbfd
--- /dev/null
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -0,0 +1,40 @@
1#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H
3
4/* timings are in milliseconds. */
5#define XT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
7 seconds, or one every 59 hours. */
8
9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable;
11
12#define XT_HASHLIMIT_HASH_DIP 0x0001
13#define XT_HASHLIMIT_HASH_DPT 0x0002
14#define XT_HASHLIMIT_HASH_SIP 0x0004
15#define XT_HASHLIMIT_HASH_SPT 0x0008
16
17struct hashlimit_cfg {
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */
21
22 /* user specified */
23 u_int32_t size; /* how many buckets */
24 u_int32_t max; /* max number of entries */
25 u_int32_t gc_interval; /* gc interval */
26 u_int32_t expire; /* when do entries expire? */
27};
28
29struct xt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg;
32 struct xt_hashlimit_htable *hinfo;
33
34 /* Used internally by the kernel */
35 union {
36 void *ptr;
37 struct xt_hashlimit_info *master;
38 } u;
39};
40#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index a8132ec076fb..45654d359a68 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -39,7 +39,7 @@ struct xt_policy_elem
39 union xt_policy_addr smask; 39 union xt_policy_addr smask;
40 union xt_policy_addr daddr; 40 union xt_policy_addr daddr;
41 union xt_policy_addr dmask; 41 union xt_policy_addr dmask;
42 u_int32_t spi; 42 __be32 spi;
43 u_int32_t reqid; 43 u_int32_t reqid;
44 u_int8_t proto; 44 u_int8_t proto;
45 u_int8_t mode; 45 u_int8_t mode;
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 9a4dd11af86e..6c4613f8ad75 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -64,7 +64,7 @@ static inline int nf_bridge_pad(const struct sk_buff *skb)
64 64
65struct bridge_skb_cb { 65struct bridge_skb_cb {
66 union { 66 union {
67 __u32 ipv4; 67 __be32 ipv4;
68 } daddr; 68 } daddr;
69}; 69};
70 70
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index b9f712c14a0a..07f044ff1a6b 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -28,21 +28,21 @@ struct hdr_ui {
28 uint8_t ssap; 28 uint8_t ssap;
29 uint8_t ctrl; 29 uint8_t ctrl;
30 uint8_t orig[3]; 30 uint8_t orig[3];
31 uint16_t type; 31 __be16 type;
32}; 32};
33 33
34struct hdr_ni { 34struct hdr_ni {
35 uint8_t dsap; 35 uint8_t dsap;
36 uint8_t ssap; 36 uint8_t ssap;
37 uint16_t ctrl; 37 __be16 ctrl;
38 uint8_t orig[3]; 38 uint8_t orig[3];
39 uint16_t type; 39 __be16 type;
40}; 40};
41 41
42struct ebt_802_3_hdr { 42struct ebt_802_3_hdr {
43 uint8_t daddr[6]; 43 uint8_t daddr[6];
44 uint8_t saddr[6]; 44 uint8_t saddr[6];
45 uint16_t len; 45 __be16 len;
46 union { 46 union {
47 struct hdr_ui ui; 47 struct hdr_ui ui;
48 struct hdr_ni ni; 48 struct hdr_ni ni;
@@ -61,7 +61,7 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
61struct ebt_802_3_info 61struct ebt_802_3_info
62{ 62{
63 uint8_t sap; 63 uint8_t sap;
64 uint16_t type; 64 __be16 type;
65 uint8_t bitmask; 65 uint8_t bitmask;
66 uint8_t invflags; 66 uint8_t invflags;
67}; 67};
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
index 307c1fed8511..7654069233ca 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -32,7 +32,7 @@
32struct ebt_mac_wormhash_tuple 32struct ebt_mac_wormhash_tuple
33{ 33{
34 uint32_t cmp[2]; 34 uint32_t cmp[2];
35 uint32_t ip; 35 __be32 ip;
36}; 36};
37 37
38struct ebt_mac_wormhash 38struct ebt_mac_wormhash
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 537ec6b487a2..97e4dbde1f89 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -14,13 +14,13 @@
14 14
15struct ebt_arp_info 15struct ebt_arp_info
16{ 16{
17 uint16_t htype; 17 __be16 htype;
18 uint16_t ptype; 18 __be16 ptype;
19 uint16_t opcode; 19 __be16 opcode;
20 uint32_t saddr; 20 __be32 saddr;
21 uint32_t smsk; 21 __be32 smsk;
22 uint32_t daddr; 22 __be32 daddr;
23 uint32_t dmsk; 23 __be32 dmsk;
24 unsigned char smaddr[ETH_ALEN]; 24 unsigned char smaddr[ETH_ALEN];
25 unsigned char smmsk[ETH_ALEN]; 25 unsigned char smmsk[ETH_ALEN];
26 unsigned char dmaddr[ETH_ALEN]; 26 unsigned char dmaddr[ETH_ALEN];
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
index 7247385cdcb1..d6847475bf2e 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -28,10 +28,10 @@
28/* the same values are used for the invflags */ 28/* the same values are used for the invflags */
29struct ebt_ip_info 29struct ebt_ip_info
30{ 30{
31 uint32_t saddr; 31 __be32 saddr;
32 uint32_t daddr; 32 __be32 daddr;
33 uint32_t smsk; 33 __be32 smsk;
34 uint32_t dmsk; 34 __be32 dmsk;
35 uint8_t tos; 35 uint8_t tos;
36 uint8_t protocol; 36 uint8_t protocol;
37 uint8_t bitmask; 37 uint8_t bitmask;
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/linux/netfilter_bridge/ebt_nat.h
index 26fd90da4cd6..435b886a51aa 100644
--- a/include/linux/netfilter_bridge/ebt_nat.h
+++ b/include/linux/netfilter_bridge/ebt_nat.h
@@ -1,6 +1,7 @@
1#ifndef __LINUX_BRIDGE_EBT_NAT_H 1#ifndef __LINUX_BRIDGE_EBT_NAT_H
2#define __LINUX_BRIDGE_EBT_NAT_H 2#define __LINUX_BRIDGE_EBT_NAT_H
3 3
4#define NAT_ARP_BIT (0x00000010)
4struct ebt_nat_info 5struct ebt_nat_info
5{ 6{
6 unsigned char mac[ETH_ALEN]; 7 unsigned char mac[ETH_ALEN];
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
index cb1fcc41565f..1d98be4031e7 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -10,7 +10,7 @@
10struct ebt_vlan_info { 10struct ebt_vlan_info {
11 uint16_t id; /* VLAN ID {1-4095} */ 11 uint16_t id; /* VLAN ID {1-4095} */
12 uint8_t prio; /* VLAN User Priority {0-7} */ 12 uint8_t prio; /* VLAN User Priority {0-7} */
13 uint16_t encap; /* VLAN Encapsulated frame code {0-65535} */ 13 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, 14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg,
15 bit 2=1 User-Priority arg, bit 3=1 encap*/ 15 bit 2=1 User-Priority arg, bit 3=1 encap*/
16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, 16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index b1a7cc90877b..94e0a7dc0cb2 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -26,6 +26,10 @@
26#define EBT_CONTINUE -3 26#define EBT_CONTINUE -3
27#define EBT_RETURN -4 27#define EBT_RETURN -4
28#define NUM_STANDARD_TARGETS 4 28#define NUM_STANDARD_TARGETS 4
29/* ebtables target modules store the verdict inside an int. We can
30 * reclaim a part of this int for backwards compatible extensions.
31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F
29 33
30struct ebt_counter 34struct ebt_counter
31{ 35{
@@ -42,6 +46,23 @@ struct ebt_replace
42 /* total size of the entries */ 46 /* total size of the entries */
43 unsigned int entries_size; 47 unsigned int entries_size;
44 /* start of the chains */ 48 /* start of the chains */
49 struct ebt_entries __user *hook_entry[NF_BR_NUMHOOKS];
50 /* nr of counters userspace expects back */
51 unsigned int num_counters;
52 /* where the kernel will put the old counters */
53 struct ebt_counter __user *counters;
54 char __user *entries;
55};
56
57struct ebt_replace_kernel
58{
59 char name[EBT_TABLE_MAXNAMELEN];
60 unsigned int valid_hooks;
61 /* nr of rules in the table */
62 unsigned int nentries;
63 /* total size of the entries */
64 unsigned int entries_size;
65 /* start of the chains */
45 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; 66 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
46 /* nr of counters userspace expects back */ 67 /* nr of counters userspace expects back */
47 unsigned int num_counters; 68 unsigned int num_counters;
@@ -141,7 +162,7 @@ struct ebt_entry {
141 /* this needs to be the first field */ 162 /* this needs to be the first field */
142 unsigned int bitmask; 163 unsigned int bitmask;
143 unsigned int invflags; 164 unsigned int invflags;
144 uint16_t ethproto; 165 __be16 ethproto;
145 /* the physical in-dev */ 166 /* the physical in-dev */
146 char in[IFNAMSIZ]; 167 char in[IFNAMSIZ];
147 /* the logical in-dev */ 168 /* the logical in-dev */
@@ -251,7 +272,7 @@ struct ebt_table
251{ 272{
252 struct list_head list; 273 struct list_head list;
253 char name[EBT_TABLE_MAXNAMELEN]; 274 char name[EBT_TABLE_MAXNAMELEN];
254 struct ebt_replace *table; 275 struct ebt_replace_kernel *table;
255 unsigned int valid_hooks; 276 unsigned int valid_hooks;
256 rwlock_t lock; 277 rwlock_t lock;
257 /* e.g. could be the table explicitly only allows certain 278 /* e.g. could be the table explicitly only allows certain
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 5b63a231a76b..5821eb5a0a3e 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -79,7 +79,7 @@ enum nf_ip_hook_priorities {
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type); 80extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
81extern int ip_xfrm_me_harder(struct sk_buff **pskb); 81extern int ip_xfrm_me_harder(struct sk_buff **pskb);
82extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 82extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
83 unsigned int dataoff, u_int8_t protocol); 83 unsigned int dataoff, u_int8_t protocol);
84#endif /*__KERNEL__*/ 84#endif /*__KERNEL__*/
85 85
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 591c1a809c00..180337801a86 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,6 +1,4 @@
1header-y += ip_conntrack_helper.h 1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_helper_h323_asn1.h
3header-y += ip_conntrack_helper_h323_types.h
4header-y += ip_conntrack_protocol.h 2header-y += ip_conntrack_protocol.h
5header-y += ip_conntrack_sctp.h 3header-y += ip_conntrack_sctp.h
6header-y += ip_conntrack_tcp.h 4header-y += ip_conntrack_tcp.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 64e868034c4a..61da56941dce 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -277,7 +277,7 @@ extern struct ip_conntrack_expect *
277__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); 277__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
278 278
279extern struct ip_conntrack_expect * 279extern struct ip_conntrack_expect *
280ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); 280ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
281 281
282extern struct ip_conntrack_tuple_hash * 282extern struct ip_conntrack_tuple_hash *
283__ip_conntrack_find(const struct ip_conntrack_tuple *tuple, 283__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
index 63811934de4d..2129fc3972ac 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
@@ -1,6 +1,44 @@
1#ifndef _IP_CONNTRACK_FTP_H 1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H 2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
3 4
4#include <linux/netfilter/nf_conntrack_ftp.h> 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__ */
5 43
6#endif /* _IP_CONNTRACK_FTP_H */ 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
index 943cc6a4871d..18f769818f4e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -3,7 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h> 6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7 7
8#define RAS_PORT 1719 8#define RAS_PORT 1719
9#define Q931_PORT 1720 9#define Q931_PORT 1720
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
index 1d853aa873eb..e371e0fc1672 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
@@ -102,11 +102,11 @@ static inline __be32 *gre_key(struct gre_hdr *greh)
102} 102}
103 103
104/* get pointer ot gre csum, if present */ 104/* get pointer ot gre csum, if present */
105static inline u_int16_t *gre_csum(struct gre_hdr *greh) 105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{ 106{
107 if (!greh->csum) 107 if (!greh->csum)
108 return NULL; 108 return NULL;
109 return (u_int16_t *) (greh+sizeof(*greh)); 109 return (__sum16 *) (greh+sizeof(*greh));
110} 110}
111 111
112#endif /* __KERNEL__ */ 112#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
index 913dad66c0fb..bef6c646defa 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
@@ -5,23 +5,18 @@
5#define SIP_PORT 5060 5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600 6#define SIP_TIMEOUT 3600
7 7
8#define POS_VIA 0 8enum sip_header_pos {
9#define POS_CONTACT 1 9 POS_REG_REQ_URI,
10#define POS_CONTENT 2 10 POS_REQ_URI,
11#define POS_MEDIA 3 11 POS_FROM,
12#define POS_OWNER 4 12 POS_TO,
13#define POS_CONNECTION 5 13 POS_VIA,
14#define POS_REQ_HEADER 6 14 POS_CONTACT,
15#define POS_SDP_HEADER 7 15 POS_CONTENT,
16 16 POS_MEDIA,
17struct sip_header_nfo { 17 POS_OWNER,
18 const char *lname; 18 POS_CONNECTION,
19 const char *sname; 19 POS_SDP_HEADER,
20 const char *ln_str;
21 size_t lnlen;
22 size_t snlen;
23 size_t ln_strlen;
24 int (*match_len)(const char *, const char *, int *);
25}; 20};
26 21
27extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb, 22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
@@ -36,9 +31,10 @@ extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
36extern int ct_sip_get_info(const char *dptr, size_t dlen, 31extern int ct_sip_get_info(const char *dptr, size_t dlen,
37 unsigned int *matchoff, 32 unsigned int *matchoff,
38 unsigned int *matchlen, 33 unsigned int *matchlen,
39 struct sip_header_nfo *hnfo); 34 enum sip_header_pos pos);
40extern int ct_sip_lnlen(const char *line, const char *limit); 35extern int ct_sip_lnlen(const char *line, const char *limit);
41extern const char *ct_sip_search(const char *needle, const char *haystack, 36extern const char *ct_sip_search(const char *needle, const char *haystack,
42 size_t needle_len, size_t haystack_len); 37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
43#endif /* __KERNEL__ */ 39#endif /* __KERNEL__ */
44#endif /* __IP_CONNTRACK_SIP_H__ */ 40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
index cde9729aa173..a404fc0abf0e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
@@ -4,7 +4,7 @@
4#define TFTP_PORT 69 4#define TFTP_PORT 69
5 5
6struct tftphdr { 6struct tftphdr {
7 u_int16_t opcode; 7 __be16 opcode;
8}; 8};
9 9
10#define TFTP_OPCODE_READ 1 10#define TFTP_OPCODE_READ 1
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index 892f9a33fea8..90fa6525ef9c 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -6,7 +6,7 @@
6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
7#define IPT_LOG_IPOPT 0x04 /* Log IP options */ 7#define IPT_LOG_IPOPT 0x04 /* Log IP options */
8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */
9#define IPT_LOG_NFLOG 0x10 /* Log using nf_log backend */ 9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define IPT_LOG_MASK 0x1f 10#define IPT_LOG_MASK 0x1f
11 11
12struct ipt_log_info { 12struct ipt_log_info {
diff --git a/include/linux/netfilter_ipv4/ipt_hashlimit.h b/include/linux/netfilter_ipv4/ipt_hashlimit.h
index ac2cb64ecd76..5662120a3d7b 100644
--- a/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ b/include/linux/netfilter_ipv4/ipt_hashlimit.h
@@ -1,40 +1,14 @@
1#ifndef _IPT_HASHLIMIT_H 1#ifndef _IPT_HASHLIMIT_H
2#define _IPT_HASHLIMIT_H 2#define _IPT_HASHLIMIT_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_hashlimit.h>
5#define IPT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
7 seconds, or one every 59 hours. */
8 5
9/* details of this structure hidden by the implementation */ 6#define IPT_HASHLIMIT_SCALE XT_HASHLIMIT_SCALE
10struct ipt_hashlimit_htable; 7#define IPT_HASHLIMIT_HASH_DIP XT_HASHLIMIT_HASH_DIP
8#define IPT_HASHLIMIT_HASH_DPT XT_HASHLIMIT_HASH_DPT
9#define IPT_HASHLIMIT_HASH_SIP XT_HASHLIMIT_HASH_SIP
10#define IPT_HASHLIMIT_HASH_SPT XT_HASHLIMIT_HASH_SPT
11 11
12#define IPT_HASHLIMIT_HASH_DIP 0x0001 12#define ipt_hashlimit_info xt_hashlimit_info
13#define IPT_HASHLIMIT_HASH_DPT 0x0002
14#define IPT_HASHLIMIT_HASH_SIP 0x0004
15#define IPT_HASHLIMIT_HASH_SPT 0x0008
16 13
17struct hashlimit_cfg { 14#endif /* _IPT_HASHLIMIT_H */
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */
21
22 /* user specified */
23 u_int32_t size; /* how many buckets */
24 u_int32_t max; /* max number of entries */
25 u_int32_t gc_interval; /* gc interval */
26 u_int32_t expire; /* when do entries expire? */
27};
28
29struct ipt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg;
32 struct ipt_hashlimit_htable *hinfo;
33
34 /* Used internally by the kernel */
35 union {
36 void *ptr;
37 struct ipt_hashlimit_info *master;
38 } u;
39};
40#endif /*_IPT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index d97e268cdfe5..ab81a6dc94ea 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -74,7 +74,7 @@ enum nf_ip6_hook_priorities {
74 74
75#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
76extern int ip6_route_me_harder(struct sk_buff *skb); 76extern int ip6_route_me_harder(struct sk_buff *skb);
77extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 77extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
78 unsigned int dataoff, u_int8_t protocol); 78 unsigned int dataoff, u_int8_t protocol);
79 79
80extern int ipv6_netfilter_init(void); 80extern int ipv6_netfilter_init(void);
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 060c1a1c6c60..0d0119b0458c 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -6,7 +6,7 @@
6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */
7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ 7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */
8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */
9#define IP6T_LOG_NFLOG 0x10 /* Log using nf_log backend */ 9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */
10#define IP6T_LOG_MASK 0x1f 10#define IP6T_LOG_MASK 0x1f
11 11
12struct ip6t_log_info { 12struct ip6t_log_info {
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 66411622e06e..b3b9b609ee89 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -141,7 +141,6 @@ struct netlink_skb_parms
141{ 141{
142 struct ucred creds; /* Skb credentials */ 142 struct ucred creds; /* Skb credentials */
143 __u32 pid; 143 __u32 pid;
144 __u32 dst_pid;
145 __u32 dst_group; 144 __u32 dst_group;
146 kernel_cap_t eff_cap; 145 kernel_cap_t eff_cap;
147 __u32 loginuid; /* Login (audit) uid */ 146 __u32 loginuid; /* Login (audit) uid */
@@ -174,6 +173,7 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
174 */ 173 */
175#define NLMSG_GOODORDER 0 174#define NLMSG_GOODORDER 0
176#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 175#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER))
176#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
177 177
178 178
179struct netlink_callback 179struct netlink_callback
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 1efe60c5c00c..2cc9867b1626 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -12,26 +12,27 @@
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/list.h> 13#include <linux/list.h>
14 14
15struct netpoll;
16
17struct netpoll { 15struct netpoll {
18 struct net_device *dev; 16 struct net_device *dev;
19 char dev_name[16], *name; 17 char dev_name[IFNAMSIZ];
18 const char *name;
20 void (*rx_hook)(struct netpoll *, int, char *, int); 19 void (*rx_hook)(struct netpoll *, int, char *, int);
21 void (*drop)(struct sk_buff *skb); 20
22 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
23 u16 local_port, remote_port; 22 u16 local_port, remote_port;
24 unsigned char local_mac[6], remote_mac[6]; 23 u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN];
25}; 24};
26 25
27struct netpoll_info { 26struct netpoll_info {
27 atomic_t refcnt;
28 spinlock_t poll_lock; 28 spinlock_t poll_lock;
29 int poll_owner; 29 int poll_owner;
30 int tries;
31 int rx_flags; 30 int rx_flags;
32 spinlock_t rx_lock; 31 spinlock_t rx_lock;
33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 32 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
34 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 33 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
34 struct sk_buff_head txq;
35 struct work_struct tx_work;
35}; 36};
36 37
37void netpoll_poll(struct netpoll *np); 38void netpoll_poll(struct netpoll *np);
@@ -42,7 +43,7 @@ int netpoll_trap(void);
42void netpoll_set_trap(int trap); 43void netpoll_set_trap(int trap);
43void netpoll_cleanup(struct netpoll *np); 44void netpoll_cleanup(struct netpoll *np);
44int __netpoll_rx(struct sk_buff *skb); 45int __netpoll_rx(struct sk_buff *skb);
45void netpoll_queue(struct sk_buff *skb); 46
46 47
47#ifdef CONFIG_NETPOLL 48#ifdef CONFIG_NETPOLL
48static inline int netpoll_rx(struct sk_buff *skb) 49static inline int netpoll_rx(struct sk_buff *skb)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 45228c1a1195..625ffea98561 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -318,7 +318,7 @@ extern void put_nfs_open_context(struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319 319
320/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 320/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
321extern u32 root_nfs_parse_addr(char *name); /*__init*/ 321extern __be32 root_nfs_parse_addr(char *name); /*__init*/
322 322
323static inline void nfs_fattr_init(struct nfs_fattr *fattr) 323static inline void nfs_fattr_init(struct nfs_fattr *fattr)
324{ 324{
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index f6baecdeecd6..971d1c6dfc4b 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -45,8 +45,10 @@ static inline void exit_task_namespaces(struct task_struct *p)
45{ 45{
46 struct nsproxy *ns = p->nsproxy; 46 struct nsproxy *ns = p->nsproxy;
47 if (ns) { 47 if (ns) {
48 put_nsproxy(ns); 48 task_lock(p);
49 p->nsproxy = NULL; 49 p->nsproxy = NULL;
50 task_unlock(p);
51 put_nsproxy(ns);
50 } 52 }
51} 53}
52#endif 54#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 09be0f81b27b..01c707261f9c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -51,6 +51,7 @@
51#include <linux/list.h> 51#include <linux/list.h>
52#include <linux/compiler.h> 52#include <linux/compiler.h>
53#include <linux/errno.h> 53#include <linux/errno.h>
54#include <asm/atomic.h>
54#include <linux/device.h> 55#include <linux/device.h>
55 56
56/* File state for mmap()s on /proc/bus/pci/X/Y */ 57/* File state for mmap()s on /proc/bus/pci/X/Y */
@@ -159,7 +160,6 @@ struct pci_dev {
159 unsigned int transparent:1; /* Transparent PCI bridge */ 160 unsigned int transparent:1; /* Transparent PCI bridge */
160 unsigned int multifunction:1;/* Part of multi-function device */ 161 unsigned int multifunction:1;/* Part of multi-function device */
161 /* keep track of device state */ 162 /* keep track of device state */
162 unsigned int is_enabled:1; /* pci_enable_device has been called */
163 unsigned int is_busmaster:1; /* device is busmaster */ 163 unsigned int is_busmaster:1; /* device is busmaster */
164 unsigned int no_msi:1; /* device may not use msi */ 164 unsigned int no_msi:1; /* device may not use msi */
165 unsigned int no_d1d2:1; /* only allow d0 or d3 */ 165 unsigned int no_d1d2:1; /* only allow d0 or d3 */
@@ -167,6 +167,7 @@ struct pci_dev {
167 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 167 unsigned int broken_parity_status:1; /* Device generates false positive parity */
168 unsigned int msi_enabled:1; 168 unsigned int msi_enabled:1;
169 unsigned int msix_enabled:1; 169 unsigned int msix_enabled:1;
170 atomic_t enable_cnt; /* pci_enable_device has been called */
170 171
171 u32 saved_config_space[16]; /* config space saved at suspend time */ 172 u32 saved_config_space[16]; /* config space saved at suspend time */
172 struct hlist_head saved_cap_space; 173 struct hlist_head saved_cap_space;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index fa4e1d799782..c09da1e30c54 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1213,6 +1213,10 @@
1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1215#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 1215#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1216#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1217#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1218#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
1219#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F
1216#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1220#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1217 1221
1218#define PCI_VENDOR_ID_IMS 0x10e0 1222#define PCI_VENDOR_ID_IMS 0x10e0
@@ -1893,6 +1897,7 @@
1893#define PCI_VENDOR_ID_BROADCOM 0x14e4 1897#define PCI_VENDOR_ID_BROADCOM 0x14e4
1894#define PCI_DEVICE_ID_TIGON3_5752 0x1600 1898#define PCI_DEVICE_ID_TIGON3_5752 0x1600
1895#define PCI_DEVICE_ID_TIGON3_5752M 0x1601 1899#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
1900#define PCI_DEVICE_ID_NX2_5709 0x1639
1896#define PCI_DEVICE_ID_TIGON3_5700 0x1644 1901#define PCI_DEVICE_ID_TIGON3_5700 0x1644
1897#define PCI_DEVICE_ID_TIGON3_5701 0x1645 1902#define PCI_DEVICE_ID_TIGON3_5701 0x1645
1898#define PCI_DEVICE_ID_TIGON3_5702 0x1646 1903#define PCI_DEVICE_ID_TIGON3_5702 0x1646
@@ -2211,6 +2216,13 @@
2211#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 2216#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
2212#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2217#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2213#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2218#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2219#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910
2220#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2911
2221#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912
2222#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913
2223#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2224#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2915
2225#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2214#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2226#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2215#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2227#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2216#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2228#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c321316f1bc7..064b1dc71c22 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -292,6 +292,12 @@
292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ 292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ 293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */
294 294
295/* MSI-X registers (these are at offset PCI_MSI_FLAGS) */
296#define PCI_MSIX_FLAGS_QSIZE 0x7FF
297#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
298#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
299#define PCI_MSIX_FLAGS_BITMASK (1 << 0)
300
295/* CompactPCI Hotswap Register */ 301/* CompactPCI Hotswap Register */
296 302
297#define PCI_CHSWP_CSR 2 /* Control and Status Register */ 303#define PCI_CHSWP_CSR 2 /* Control and Status Register */
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index d5dd471da225..0f0b880c4280 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -32,7 +32,7 @@ struct sadb_ext {
32struct sadb_sa { 32struct sadb_sa {
33 uint16_t sadb_sa_len; 33 uint16_t sadb_sa_len;
34 uint16_t sadb_sa_exttype; 34 uint16_t sadb_sa_exttype;
35 uint32_t sadb_sa_spi; 35 __be32 sadb_sa_spi;
36 uint8_t sadb_sa_replay; 36 uint8_t sadb_sa_replay;
37 uint8_t sadb_sa_state; 37 uint8_t sadb_sa_state;
38 uint8_t sadb_sa_auth; 38 uint8_t sadb_sa_auth;
@@ -211,7 +211,7 @@ struct sadb_x_nat_t_type {
211struct sadb_x_nat_t_port { 211struct sadb_x_nat_t_port {
212 uint16_t sadb_x_nat_t_port_len; 212 uint16_t sadb_x_nat_t_port_len;
213 uint16_t sadb_x_nat_t_port_exttype; 213 uint16_t sadb_x_nat_t_port_exttype;
214 uint16_t sadb_x_nat_t_port_port; 214 __be16 sadb_x_nat_t_port_port;
215 uint16_t sadb_x_nat_t_port_reserved; 215 uint16_t sadb_x_nat_t_port_reserved;
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9447a57ee8a9..edd4c88ca7d8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,6 +20,10 @@
20 20
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/ethtool.h>
24#include <linux/mii.h>
25#include <linux/timer.h>
26#include <linux/workqueue.h>
23 27
24#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ 28#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
25 SUPPORTED_10baseT_Full | \ 29 SUPPORTED_10baseT_Full | \
@@ -43,15 +47,26 @@
43#define PHY_HAS_INTERRUPT 0x00000001 47#define PHY_HAS_INTERRUPT 0x00000001
44#define PHY_HAS_MAGICANEG 0x00000002 48#define PHY_HAS_MAGICANEG 0x00000002
45 49
50/* Interface Mode definitions */
51typedef enum {
52 PHY_INTERFACE_MODE_MII,
53 PHY_INTERFACE_MODE_GMII,
54 PHY_INTERFACE_MODE_SGMII,
55 PHY_INTERFACE_MODE_TBI,
56 PHY_INTERFACE_MODE_RMII,
57 PHY_INTERFACE_MODE_RGMII,
58 PHY_INTERFACE_MODE_RTBI
59} phy_interface_t;
60
46#define MII_BUS_MAX 4 61#define MII_BUS_MAX 4
47 62
48 63
49#define PHY_INIT_TIMEOUT 100000 64#define PHY_INIT_TIMEOUT 100000
50#define PHY_STATE_TIME 1 65#define PHY_STATE_TIME 1
51#define PHY_FORCE_TIMEOUT 10 66#define PHY_FORCE_TIMEOUT 10
52#define PHY_AN_TIMEOUT 10 67#define PHY_AN_TIMEOUT 10
53 68
54#define PHY_MAX_ADDR 32 69#define PHY_MAX_ADDR 32
55 70
56/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 71/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
57#define PHY_ID_FMT "%x:%02x" 72#define PHY_ID_FMT "%x:%02x"
@@ -83,8 +98,8 @@ struct mii_bus {
83 int *irq; 98 int *irq;
84}; 99};
85 100
86#define PHY_INTERRUPT_DISABLED 0x0 101#define PHY_INTERRUPT_DISABLED 0x0
87#define PHY_INTERRUPT_ENABLED 0x80000000 102#define PHY_INTERRUPT_ENABLED 0x80000000
88 103
89/* PHY state machine states: 104/* PHY state machine states:
90 * 105 *
@@ -226,6 +241,8 @@ struct phy_device {
226 241
227 u32 dev_flags; 242 u32 dev_flags;
228 243
244 phy_interface_t interface;
245
229 /* Bus address of the PHY (0-32) */ 246 /* Bus address of the PHY (0-32) */
230 int addr; 247 int addr;
231 248
@@ -341,9 +358,10 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
341int phy_clear_interrupt(struct phy_device *phydev); 358int phy_clear_interrupt(struct phy_device *phydev);
342int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 359int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
343struct phy_device * phy_attach(struct net_device *dev, 360struct phy_device * phy_attach(struct net_device *dev,
344 const char *phy_id, u32 flags); 361 const char *phy_id, u32 flags, phy_interface_t interface);
345struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 362struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
346 void (*handler)(struct net_device *), u32 flags); 363 void (*handler)(struct net_device *), u32 flags,
364 phy_interface_t interface);
347void phy_disconnect(struct phy_device *phydev); 365void phy_disconnect(struct phy_device *phydev);
348void phy_detach(struct phy_device *phydev); 366void phy_detach(struct phy_device *phydev);
349void phy_start(struct phy_device *phydev); 367void phy_start(struct phy_device *phydev);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 29cd6dee13db..20f47b81d3fa 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -58,6 +58,12 @@ struct platform_driver {
58extern int platform_driver_register(struct platform_driver *); 58extern int platform_driver_register(struct platform_driver *);
59extern void platform_driver_unregister(struct platform_driver *); 59extern void platform_driver_unregister(struct platform_driver *);
60 60
61/* non-hotpluggable platform devices may use this so that probe() and
62 * its support may live in __init sections, conserving runtime memory.
63 */
64extern int platform_driver_probe(struct platform_driver *driver,
65 int (*probe)(struct platform_device *));
66
61#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 67#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
62#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 68#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
63 69
diff --git a/include/linux/random.h b/include/linux/random.h
index 0248b30e306d..01ad71033d65 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -51,16 +51,16 @@ extern void add_interrupt_randomness(int irq);
51extern void get_random_bytes(void *buf, int nbytes); 51extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__be32 daddr);
55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
57 __u16 dport); 57 __be16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
59 __u16 sport, __u16 dport); 59 __be16 sport, __be16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
61 __u16 sport, __u16 dport); 61 __be16 sport, __be16 dport);
62extern u64 secure_dccp_sequence_number(__u32 saddr, __u32 daddr, 62extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
63 __u16 sport, __u16 dport); 63 __be16 sport, __be16 dport);
64 64
65#ifndef MODULE 65#ifndef MODULE
66extern struct file_operations random_fops, urandom_fops; 66extern struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 6610103f23e1..3a28742d86f9 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -430,7 +430,7 @@ enum reiserfs_mount_options {
430/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 430/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
431** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 431** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
432** is not required. If the normal autodection code can't determine which 432** is not required. If the normal autodection code can't determine which
433** hash to use (because both hases had the same value for a file) 433** hash to use (because both hashes had the same value for a file)
434** use this option to force a specific hash. It won't allow you to override 434** use this option to force a specific hash. It won't allow you to override
435** the existing hash on the FS, so if you have a tea hash disk, and mount 435** the existing hash on the FS, so if you have a tea hash disk, and mount
436** with -o hash=rupasov, the mount will fail. 436** with -o hash=rupasov, the mount will fail.
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 3a18addaed4c..493297acdae8 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -81,8 +81,6 @@ enum {
81 81
82 RTM_NEWPREFIX = 52, 82 RTM_NEWPREFIX = 52,
83#define RTM_NEWPREFIX RTM_NEWPREFIX 83#define RTM_NEWPREFIX RTM_NEWPREFIX
84 RTM_GETPREFIX = 54,
85#define RTM_GETPREFIX RTM_GETPREFIX
86 84
87 RTM_GETMULTICAST = 58, 85 RTM_GETMULTICAST = 58,
88#define RTM_GETMULTICAST RTM_GETMULTICAST 86#define RTM_GETMULTICAST RTM_GETMULTICAST
@@ -587,6 +585,9 @@ extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
587 struct nlmsghdr *nlh, gfp_t flags); 585 struct nlmsghdr *nlh, gfp_t flags);
588extern void rtnl_set_sk_err(u32 group, int error); 586extern void rtnl_set_sk_err(u32 group, int error);
589extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 587extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
588extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
589 u32 id, u32 ts, u32 tsage, long expires,
590 u32 error);
590 591
591extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); 592extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
592 593
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 6ec66dec29f7..35108fe7a686 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -57,17 +57,17 @@
57 57
58/* Section 3.1. SCTP Common Header Format */ 58/* Section 3.1. SCTP Common Header Format */
59typedef struct sctphdr { 59typedef struct sctphdr {
60 __u16 source; 60 __be16 source;
61 __u16 dest; 61 __be16 dest;
62 __u32 vtag; 62 __be32 vtag;
63 __u32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66/* Section 3.2. Chunk Field Descriptions. */ 66/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 67typedef struct sctp_chunkhdr {
68 __u8 type; 68 __u8 type;
69 __u8 flags; 69 __u8 flags;
70 __u16 length; 70 __be16 length;
71} __attribute__((packed)) sctp_chunkhdr_t; 71} __attribute__((packed)) sctp_chunkhdr_t;
72 72
73 73
@@ -153,8 +153,8 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
153 */ 153 */
154 154
155typedef struct sctp_paramhdr { 155typedef struct sctp_paramhdr {
156 __u16 type; 156 __be16 type;
157 __u16 length; 157 __be16 length;
158} __attribute__((packed)) sctp_paramhdr_t; 158} __attribute__((packed)) sctp_paramhdr_t;
159 159
160typedef enum { 160typedef enum {
@@ -203,10 +203,10 @@ enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), };
203/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 203/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
204 204
205typedef struct sctp_datahdr { 205typedef struct sctp_datahdr {
206 __u32 tsn; 206 __be32 tsn;
207 __u16 stream; 207 __be16 stream;
208 __u16 ssn; 208 __be16 ssn;
209 __u32 ppid; 209 __be32 ppid;
210 __u8 payload[0]; 210 __u8 payload[0];
211} __attribute__((packed)) sctp_datahdr_t; 211} __attribute__((packed)) sctp_datahdr_t;
212 212
@@ -232,11 +232,11 @@ enum { SCTP_DATA_FRAG_MASK = 0x03, };
232 * endpoints. 232 * endpoints.
233 */ 233 */
234typedef struct sctp_inithdr { 234typedef struct sctp_inithdr {
235 __u32 init_tag; 235 __be32 init_tag;
236 __u32 a_rwnd; 236 __be32 a_rwnd;
237 __u16 num_outbound_streams; 237 __be16 num_outbound_streams;
238 __u16 num_inbound_streams; 238 __be16 num_inbound_streams;
239 __u32 initial_tsn; 239 __be32 initial_tsn;
240 __u8 params[0]; 240 __u8 params[0];
241} __attribute__((packed)) sctp_inithdr_t; 241} __attribute__((packed)) sctp_inithdr_t;
242 242
@@ -261,7 +261,7 @@ typedef struct sctp_ipv6addr_param {
261/* Section 3.3.2.1 Cookie Preservative (9) */ 261/* Section 3.3.2.1 Cookie Preservative (9) */
262typedef struct sctp_cookie_preserve_param { 262typedef struct sctp_cookie_preserve_param {
263 sctp_paramhdr_t param_hdr; 263 sctp_paramhdr_t param_hdr;
264 uint32_t lifespan_increment; 264 __be32 lifespan_increment;
265} __attribute__((packed)) sctp_cookie_preserve_param_t; 265} __attribute__((packed)) sctp_cookie_preserve_param_t;
266 266
267/* Section 3.3.2.1 Host Name Address (11) */ 267/* Section 3.3.2.1 Host Name Address (11) */
@@ -273,7 +273,7 @@ typedef struct sctp_hostname_param {
273/* Section 3.3.2.1 Supported Address Types (12) */ 273/* Section 3.3.2.1 Supported Address Types (12) */
274typedef struct sctp_supported_addrs_param { 274typedef struct sctp_supported_addrs_param {
275 sctp_paramhdr_t param_hdr; 275 sctp_paramhdr_t param_hdr;
276 uint16_t types[0]; 276 __be16 types[0];
277} __attribute__((packed)) sctp_supported_addrs_param_t; 277} __attribute__((packed)) sctp_supported_addrs_param_t;
278 278
279/* Appendix A. ECN Capable (32768) */ 279/* Appendix A. ECN Capable (32768) */
@@ -284,7 +284,7 @@ typedef struct sctp_ecn_capable_param {
284/* ADDIP Section 3.2.6 Adaption Layer Indication */ 284/* ADDIP Section 3.2.6 Adaption Layer Indication */
285typedef struct sctp_adaption_ind_param { 285typedef struct sctp_adaption_ind_param {
286 struct sctp_paramhdr param_hdr; 286 struct sctp_paramhdr param_hdr;
287 __u32 adaption_ind; 287 __be32 adaption_ind;
288} __attribute__((packed)) sctp_adaption_ind_param_t; 288} __attribute__((packed)) sctp_adaption_ind_param_t;
289 289
290/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 290/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
@@ -316,11 +316,11 @@ typedef struct sctp_unrecognized_param {
316 */ 316 */
317 317
318typedef struct sctp_gap_ack_block { 318typedef struct sctp_gap_ack_block {
319 __u16 start; 319 __be16 start;
320 __u16 end; 320 __be16 end;
321} __attribute__((packed)) sctp_gap_ack_block_t; 321} __attribute__((packed)) sctp_gap_ack_block_t;
322 322
323typedef uint32_t sctp_dup_tsn_t; 323typedef __be32 sctp_dup_tsn_t;
324 324
325typedef union { 325typedef union {
326 sctp_gap_ack_block_t gab; 326 sctp_gap_ack_block_t gab;
@@ -328,10 +328,10 @@ typedef union {
328} sctp_sack_variable_t; 328} sctp_sack_variable_t;
329 329
330typedef struct sctp_sackhdr { 330typedef struct sctp_sackhdr {
331 __u32 cum_tsn_ack; 331 __be32 cum_tsn_ack;
332 __u32 a_rwnd; 332 __be32 a_rwnd;
333 __u16 num_gap_ack_blocks; 333 __be16 num_gap_ack_blocks;
334 __u16 num_dup_tsns; 334 __be16 num_dup_tsns;
335 sctp_sack_variable_t variable[0]; 335 sctp_sack_variable_t variable[0];
336} __attribute__((packed)) sctp_sackhdr_t; 336} __attribute__((packed)) sctp_sackhdr_t;
337 337
@@ -371,7 +371,7 @@ typedef struct sctp_abort_chunk {
371 * and the highest consecutive acking value. 371 * and the highest consecutive acking value.
372 */ 372 */
373typedef struct sctp_shutdownhdr { 373typedef struct sctp_shutdownhdr {
374 __u32 cum_tsn_ack; 374 __be32 cum_tsn_ack;
375} __attribute__((packed)) sctp_shutdownhdr_t; 375} __attribute__((packed)) sctp_shutdownhdr_t;
376 376
377struct sctp_shutdown_chunk_t { 377struct sctp_shutdown_chunk_t {
@@ -382,8 +382,8 @@ struct sctp_shutdown_chunk_t {
382/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ 382/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
383 383
384typedef struct sctp_errhdr { 384typedef struct sctp_errhdr {
385 __u16 cause; 385 __be16 cause;
386 __u16 length; 386 __be16 length;
387 __u8 variable[0]; 387 __u8 variable[0];
388} __attribute__((packed)) sctp_errhdr_t; 388} __attribute__((packed)) sctp_errhdr_t;
389 389
@@ -462,7 +462,7 @@ typedef enum {
462 * Explicit Congestion Notification Echo (ECNE) (12) 462 * Explicit Congestion Notification Echo (ECNE) (12)
463 */ 463 */
464typedef struct sctp_ecnehdr { 464typedef struct sctp_ecnehdr {
465 __u32 lowest_tsn; 465 __be32 lowest_tsn;
466} sctp_ecnehdr_t; 466} sctp_ecnehdr_t;
467 467
468typedef struct sctp_ecne_chunk { 468typedef struct sctp_ecne_chunk {
@@ -474,7 +474,7 @@ typedef struct sctp_ecne_chunk {
474 * Congestion Window Reduced (CWR) (13) 474 * Congestion Window Reduced (CWR) (13)
475 */ 475 */
476typedef struct sctp_cwrhdr { 476typedef struct sctp_cwrhdr {
477 __u32 lowest_tsn; 477 __be32 lowest_tsn;
478} sctp_cwrhdr_t; 478} sctp_cwrhdr_t;
479 479
480typedef struct sctp_cwr_chunk { 480typedef struct sctp_cwr_chunk {
@@ -529,12 +529,12 @@ typedef struct sctp_cwr_chunk {
529 * chunks this field MUST be filled in. 529 * chunks this field MUST be filled in.
530 */ 530 */
531struct sctp_fwdtsn_skip { 531struct sctp_fwdtsn_skip {
532 __u16 stream; 532 __be16 stream;
533 __u16 ssn; 533 __be16 ssn;
534} __attribute__((packed)); 534} __attribute__((packed));
535 535
536struct sctp_fwdtsn_hdr { 536struct sctp_fwdtsn_hdr {
537 __u32 new_cum_tsn; 537 __be32 new_cum_tsn;
538 struct sctp_fwdtsn_skip skip[0]; 538 struct sctp_fwdtsn_skip skip[0];
539} __attribute((packed)); 539} __attribute((packed));
540 540
@@ -578,11 +578,11 @@ struct sctp_fwdtsn_chunk {
578 */ 578 */
579typedef struct sctp_addip_param { 579typedef struct sctp_addip_param {
580 sctp_paramhdr_t param_hdr; 580 sctp_paramhdr_t param_hdr;
581 __u32 crr_id; 581 __be32 crr_id;
582} __attribute__((packed)) sctp_addip_param_t; 582} __attribute__((packed)) sctp_addip_param_t;
583 583
584typedef struct sctp_addiphdr { 584typedef struct sctp_addiphdr {
585 __u32 serial; 585 __be32 serial;
586 __u8 params[0]; 586 __u8 params[0];
587} __attribute__((packed)) sctp_addiphdr_t; 587} __attribute__((packed)) sctp_addiphdr_t;
588 588
diff --git a/include/linux/security.h b/include/linux/security.h
index b200b9856f32..83cdefae9931 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -826,6 +826,8 @@ struct request_sock;
826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. 826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
827 * @inet_csk_clone: 827 * @inet_csk_clone:
828 * Sets the new child socket's sid to the openreq sid. 828 * Sets the new child socket's sid to the openreq sid.
829 * @inet_conn_established:
830 * Sets the connection's peersid to the secmark on skb.
829 * @req_classify_flow: 831 * @req_classify_flow:
830 * Sets the flow's sid to the openreq sid. 832 * Sets the flow's sid to the openreq sid.
831 * 833 *
@@ -836,10 +838,8 @@ struct request_sock;
836 * used by the XFRM system. 838 * used by the XFRM system.
837 * @sec_ctx contains the security context information being provided by 839 * @sec_ctx contains the security context information being provided by
838 * the user-level policy update program (e.g., setkey). 840 * the user-level policy update program (e.g., setkey).
839 * @sk refers to the sock from which to derive the security context.
840 * Allocate a security structure to the xp->security field; the security 841 * Allocate a security structure to the xp->security field; the security
841 * field is initialized to NULL when the xfrm_policy is allocated. Only 842 * field is initialized to NULL when the xfrm_policy is allocated.
842 * one of sec_ctx or sock can be specified.
843 * Return 0 if operation was successful (memory to allocate, legal context) 843 * Return 0 if operation was successful (memory to allocate, legal context)
844 * @xfrm_policy_clone_security: 844 * @xfrm_policy_clone_security:
845 * @old contains an existing xfrm_policy in the SPD. 845 * @old contains an existing xfrm_policy in the SPD.
@@ -858,9 +858,6 @@ struct request_sock;
858 * Database by the XFRM system. 858 * Database by the XFRM system.
859 * @sec_ctx contains the security context information being provided by 859 * @sec_ctx contains the security context information being provided by
860 * the user-level SA generation program (e.g., setkey or racoon). 860 * the user-level SA generation program (e.g., setkey or racoon).
861 * @polsec contains the security context information associated with a xfrm
862 * policy rule from which to take the base context. polsec must be NULL
863 * when sec_ctx is specified.
864 * @secid contains the secid from which to take the mls portion of the context. 861 * @secid contains the secid from which to take the mls portion of the context.
865 * Allocate a security structure to the x->security field; the security 862 * Allocate a security structure to the x->security field; the security
866 * field is initialized to NULL when the xfrm_state is allocated. Set the 863 * field is initialized to NULL when the xfrm_state is allocated. Set the
@@ -889,11 +886,6 @@ struct request_sock;
889 * @xp contains the policy to check for a match. 886 * @xp contains the policy to check for a match.
890 * @fl contains the flow to check for a match. 887 * @fl contains the flow to check for a match.
891 * Return 1 if there is a match. 888 * Return 1 if there is a match.
892 * @xfrm_flow_state_match:
893 * @fl contains the flow key to match.
894 * @xfrm points to the xfrm_state to match.
895 * @xp points to the xfrm_policy to match.
896 * Return 1 if there is a match.
897 * @xfrm_decode_session: 889 * @xfrm_decode_session:
898 * @skb points to skb to decode. 890 * @skb points to skb to decode.
899 * @secid points to the flow key secid to set. 891 * @secid points to the flow key secid to set.
@@ -1373,25 +1365,24 @@ struct security_operations {
1373 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, 1365 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
1374 struct request_sock *req); 1366 struct request_sock *req);
1375 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); 1367 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
1368 void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb);
1376 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); 1369 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
1377#endif /* CONFIG_SECURITY_NETWORK */ 1370#endif /* CONFIG_SECURITY_NETWORK */
1378 1371
1379#ifdef CONFIG_SECURITY_NETWORK_XFRM 1372#ifdef CONFIG_SECURITY_NETWORK_XFRM
1380 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, 1373 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
1381 struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk); 1374 struct xfrm_user_sec_ctx *sec_ctx);
1382 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1375 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1383 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1376 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1384 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1377 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1385 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1378 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1386 struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec, 1379 struct xfrm_user_sec_ctx *sec_ctx,
1387 u32 secid); 1380 u32 secid);
1388 void (*xfrm_state_free_security) (struct xfrm_state *x); 1381 void (*xfrm_state_free_security) (struct xfrm_state *x);
1389 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1382 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1390 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1383 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
1391 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1384 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1392 struct xfrm_policy *xp, struct flowi *fl); 1385 struct xfrm_policy *xp, struct flowi *fl);
1393 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm,
1394 struct xfrm_policy *xp);
1395 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1386 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1396#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1387#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1397 1388
@@ -2966,9 +2957,15 @@ static inline void security_inet_csk_clone(struct sock *newsk,
2966{ 2957{
2967 security_ops->inet_csk_clone(newsk, req); 2958 security_ops->inet_csk_clone(newsk, req);
2968} 2959}
2960
2961static inline void security_inet_conn_established(struct sock *sk,
2962 struct sk_buff *skb)
2963{
2964 security_ops->inet_conn_established(sk, skb);
2965}
2969#else /* CONFIG_SECURITY_NETWORK */ 2966#else /* CONFIG_SECURITY_NETWORK */
2970static inline int security_unix_stream_connect(struct socket * sock, 2967static inline int security_unix_stream_connect(struct socket * sock,
2971 struct socket * other, 2968 struct socket * other,
2972 struct sock * newsk) 2969 struct sock * newsk)
2973{ 2970{
2974 return 0; 2971 return 0;
@@ -3115,12 +3112,17 @@ static inline void security_inet_csk_clone(struct sock *newsk,
3115 const struct request_sock *req) 3112 const struct request_sock *req)
3116{ 3113{
3117} 3114}
3115
3116static inline void security_inet_conn_established(struct sock *sk,
3117 struct sk_buff *skb)
3118{
3119}
3118#endif /* CONFIG_SECURITY_NETWORK */ 3120#endif /* CONFIG_SECURITY_NETWORK */
3119 3121
3120#ifdef CONFIG_SECURITY_NETWORK_XFRM 3122#ifdef CONFIG_SECURITY_NETWORK_XFRM
3121static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3123static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
3122{ 3124{
3123 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL); 3125 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
3124} 3126}
3125 3127
3126static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3128static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
@@ -3141,7 +3143,7 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
3141static inline int security_xfrm_state_alloc(struct xfrm_state *x, 3143static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3142 struct xfrm_user_sec_ctx *sec_ctx) 3144 struct xfrm_user_sec_ctx *sec_ctx)
3143{ 3145{
3144 return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0); 3146 return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
3145} 3147}
3146 3148
3147static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 3149static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
@@ -3149,7 +3151,11 @@ static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3149{ 3151{
3150 if (!polsec) 3152 if (!polsec)
3151 return 0; 3153 return 0;
3152 return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid); 3154 /*
3155 * We want the context to be taken from secid which is usually
3156 * from the sock.
3157 */
3158 return security_ops->xfrm_state_alloc_security(x, NULL, secid);
3153} 3159}
3154 3160
3155static inline int security_xfrm_state_delete(struct xfrm_state *x) 3161static inline int security_xfrm_state_delete(struct xfrm_state *x)
@@ -3173,12 +3179,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3173 return security_ops->xfrm_state_pol_flow_match(x, xp, fl); 3179 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3174} 3180}
3175 3181
3176static inline int security_xfrm_flow_state_match(struct flowi *fl,
3177 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3178{
3179 return security_ops->xfrm_flow_state_match(fl, xfrm, xp);
3180}
3181
3182static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 3182static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3183{ 3183{
3184 return security_ops->xfrm_decode_session(skb, secid, 1); 3184 return security_ops->xfrm_decode_session(skb, secid, 1);
@@ -3242,12 +3242,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3242 return 1; 3242 return 1;
3243} 3243}
3244 3244
3245static inline int security_xfrm_flow_state_match(struct flowi *fl,
3246 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3247{
3248 return 1;
3249}
3250
3251static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 3245static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3252{ 3246{
3253 return 0; 3247 return 0;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 85577a4ffa61..14ec16d2d9ba 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -139,7 +139,7 @@ struct skb_shared_info {
139 /* Warning: this field is not always filled in (UFO)! */ 139 /* Warning: this field is not always filled in (UFO)! */
140 unsigned short gso_segs; 140 unsigned short gso_segs;
141 unsigned short gso_type; 141 unsigned short gso_type;
142 unsigned int ip6_frag_id; 142 __be32 ip6_frag_id;
143 struct sk_buff *frag_list; 143 struct sk_buff *frag_list;
144 skb_frag_t frags[MAX_SKB_FRAGS]; 144 skb_frag_t frags[MAX_SKB_FRAGS];
145}; 145};
@@ -216,7 +216,7 @@ enum {
216 * @tail: Tail pointer 216 * @tail: Tail pointer
217 * @end: End pointer 217 * @end: End pointer
218 * @destructor: Destruct function 218 * @destructor: Destruct function
219 * @nfmark: Can be used for communication between hooks 219 * @mark: Generic packet mark
220 * @nfct: Associated connection, if any 220 * @nfct: Associated connection, if any
221 * @ipvs_property: skbuff is owned by ipvs 221 * @ipvs_property: skbuff is owned by ipvs
222 * @nfctinfo: Relationship of this skb to the connection 222 * @nfctinfo: Relationship of this skb to the connection
@@ -273,8 +273,11 @@ struct sk_buff {
273 273
274 unsigned int len, 274 unsigned int len,
275 data_len, 275 data_len,
276 mac_len, 276 mac_len;
277 csum; 277 union {
278 __wsum csum;
279 __u32 csum_offset;
280 };
278 __u32 priority; 281 __u32 priority;
279 __u8 local_df:1, 282 __u8 local_df:1,
280 cloned:1, 283 cloned:1,
@@ -295,7 +298,6 @@ struct sk_buff {
295#ifdef CONFIG_BRIDGE_NETFILTER 298#ifdef CONFIG_BRIDGE_NETFILTER
296 struct nf_bridge_info *nf_bridge; 299 struct nf_bridge_info *nf_bridge;
297#endif 300#endif
298 __u32 nfmark;
299#endif /* CONFIG_NETFILTER */ 301#endif /* CONFIG_NETFILTER */
300#ifdef CONFIG_NET_SCHED 302#ifdef CONFIG_NET_SCHED
301 __u16 tc_index; /* traffic control index */ 303 __u16 tc_index; /* traffic control index */
@@ -310,6 +312,7 @@ struct sk_buff {
310 __u32 secmark; 312 __u32 secmark;
311#endif 313#endif
312 314
315 __u32 mark;
313 316
314 /* These elements must be at the end, see alloc_skb() for details. */ 317 /* These elements must be at the end, see alloc_skb() for details. */
315 unsigned int truesize; 318 unsigned int truesize;
@@ -1199,8 +1202,7 @@ static inline int skb_add_data(struct sk_buff *skb,
1199 1202
1200 if (skb->ip_summed == CHECKSUM_NONE) { 1203 if (skb->ip_summed == CHECKSUM_NONE) {
1201 int err = 0; 1204 int err = 0;
1202 unsigned int csum = csum_and_copy_from_user(from, 1205 __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy),
1203 skb_put(skb, copy),
1204 copy, 0, &err); 1206 copy, 0, &err);
1205 if (!err) { 1207 if (!err) {
1206 skb->csum = csum_block_add(skb->csum, csum, off); 1208 skb->csum = csum_block_add(skb->csum, csum, off);
@@ -1335,15 +1337,15 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1335extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1337extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1336extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1338extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1337 unsigned int flags); 1339 unsigned int flags);
1338extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1340extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1339 int len, unsigned int csum); 1341 int len, __wsum csum);
1340extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1342extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1341 void *to, int len); 1343 void *to, int len);
1342extern int skb_store_bits(const struct sk_buff *skb, int offset, 1344extern int skb_store_bits(const struct sk_buff *skb, int offset,
1343 void *from, int len); 1345 void *from, int len);
1344extern unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, 1346extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1345 int offset, u8 *to, int len, 1347 int offset, u8 *to, int len,
1346 unsigned int csum); 1348 __wsum csum);
1347extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1349extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1348extern void skb_split(struct sk_buff *skb, 1350extern void skb_split(struct sk_buff *skb,
1349 struct sk_buff *skb1, const u32 len); 1351 struct sk_buff *skb1, const u32 len);
@@ -1399,7 +1401,7 @@ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *
1399 1401
1400extern void __net_timestamp(struct sk_buff *skb); 1402extern void __net_timestamp(struct sk_buff *skb);
1401 1403
1402extern unsigned int __skb_checksum_complete(struct sk_buff *skb); 1404extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1403 1405
1404/** 1406/**
1405 * skb_checksum_complete - Calculate checksum of an entire packet 1407 * skb_checksum_complete - Calculate checksum of an entire packet
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 361409094649..92cd38efad7f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -264,6 +264,7 @@ struct ucred {
264#define SOL_IPV6 41 264#define SOL_IPV6 41
265#define SOL_ICMPV6 58 265#define SOL_ICMPV6 58
266#define SOL_SCTP 132 266#define SOL_SCTP 132
267#define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */
267#define SOL_RAW 255 268#define SOL_RAW 255
268#define SOL_IPX 256 269#define SOL_IPX 256
269#define SOL_AX25 257 270#define SOL_AX25 257
@@ -292,7 +293,7 @@ extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov,
292extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 293extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
293 struct iovec *iov, 294 struct iovec *iov,
294 int offset, 295 int offset,
295 unsigned int len, int *csump); 296 unsigned int len, __wsum *csump);
296 297
297extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); 298extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
298extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 299extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index e6b9d1d36ea2..abef7596655a 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -72,8 +72,8 @@
72#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 72#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
73#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 73#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
74 74
75#define SIOCGIFDIVERT 0x8944 /* Frame diversion support */ 75/* SIOCGIFDIVERT was: 0x8944 Frame diversion support */
76#define SIOCSIFDIVERT 0x8945 /* Set frame diversion options */ 76/* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */
77 77
78#define SIOCETHTOOL 0x8946 /* Ethtool interface */ 78#define SIOCETHTOOL 0x8946 /* Ethtool interface */
79 79
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index b800d2d68b32..8451052ca66f 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -183,13 +183,27 @@ do { \
183#define read_lock(lock) _read_lock(lock) 183#define read_lock(lock) _read_lock(lock)
184 184
185#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 185#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
186
186#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) 187#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
187#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) 188#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
188#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) 189#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
190
191#ifdef CONFIG_DEBUG_LOCK_ALLOC
192#define spin_lock_irqsave_nested(lock, flags, subclass) \
193 flags = _spin_lock_irqsave_nested(lock, subclass)
194#else
195#define spin_lock_irqsave_nested(lock, flags, subclass) \
196 flags = _spin_lock_irqsave(lock)
197#endif
198
189#else 199#else
200
190#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) 201#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags)
191#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) 202#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags)
192#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) 203#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
204#define spin_lock_irqsave_nested(lock, flags, subclass) \
205 spin_lock_irqsave(lock, flags)
206
193#endif 207#endif
194 208
195#define spin_lock_irq(lock) _spin_lock_irq(lock) 209#define spin_lock_irq(lock) _spin_lock_irq(lock)
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 8828b8155e9c..8a2307ce7296 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -32,6 +32,8 @@ void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock);
32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); 32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock);
33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
34 __acquires(lock); 34 __acquires(lock);
35unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass)
36 __acquires(lock);
35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 37unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
36 __acquires(lock); 38 __acquires(lock);
37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 39unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index ac69e5511606..9a527c364394 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -151,7 +151,7 @@ typedef struct {
151 struct sk_buff *skb; 151 struct sk_buff *skb;
152 unsigned int offset; 152 unsigned int offset;
153 size_t count; 153 size_t count;
154 unsigned int csum; 154 __wsum csum;
155} skb_reader_t; 155} skb_reader_t;
156 156
157typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); 157typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d98562f1df76..94316a98e0d0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -426,6 +426,8 @@ enum
426 NET_CIPSOV4_CACHE_BUCKET_SIZE=119, 426 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
427 NET_CIPSOV4_RBM_OPTFMT=120, 427 NET_CIPSOV4_RBM_OPTFMT=120,
428 NET_CIPSOV4_RBM_STRICTVALID=121, 428 NET_CIPSOV4_RBM_STRICTVALID=121,
429 NET_TCP_AVAIL_CONG_CONTROL=122,
430 NET_TCP_ALLOWED_CONG_CONTROL=123,
429}; 431};
430 432
431enum { 433enum {
@@ -604,16 +606,6 @@ enum {
604 NET_DCCP_DEFAULT=1, 606 NET_DCCP_DEFAULT=1,
605}; 607};
606 608
607/* /proc/sys/net/dccp/default */
608enum {
609 NET_DCCP_DEFAULT_SEQ_WINDOW = 1,
610 NET_DCCP_DEFAULT_RX_CCID = 2,
611 NET_DCCP_DEFAULT_TX_CCID = 3,
612 NET_DCCP_DEFAULT_ACK_RATIO = 4,
613 NET_DCCP_DEFAULT_SEND_ACKVEC = 5,
614 NET_DCCP_DEFAULT_SEND_NDP = 6,
615};
616
617/* /proc/sys/net/ipx */ 609/* /proc/sys/net/ipx */
618enum { 610enum {
619 NET_IPX_PPROP_BROADCASTING=1, 611 NET_IPX_PPROP_BROADCASTING=1,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 6d5c43d31dec..2129d1b6c874 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -97,6 +97,9 @@ extern int __must_check
97sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
98 98
99extern int __must_check 99extern int __must_check
100sysfs_move_dir(struct kobject *, struct kobject *);
101
102extern int __must_check
100sysfs_create_file(struct kobject *, const struct attribute *); 103sysfs_create_file(struct kobject *, const struct attribute *);
101 104
102extern int __must_check 105extern int __must_check
@@ -142,6 +145,11 @@ static inline int sysfs_rename_dir(struct kobject * k, const char *new_name)
142 return 0; 145 return 0;
143} 146}
144 147
148static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent)
149{
150 return 0;
151}
152
145static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) 153static inline int sysfs_create_file(struct kobject * k, const struct attribute * a)
146{ 154{
147 return 0; 155 return 0;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 2d36f6db3706..3cc70d1a3504 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#include <linux/socket.h>
22 23
23struct tcphdr { 24struct tcphdr {
24 __be16 source; 25 __be16 source;
@@ -51,7 +52,7 @@ struct tcphdr {
51#error "Adjust your <asm/byteorder.h> defines" 52#error "Adjust your <asm/byteorder.h> defines"
52#endif 53#endif
53 __be16 window; 54 __be16 window;
54 __be16 check; 55 __sum16 check;
55 __be16 urg_ptr; 56 __be16 urg_ptr;
56}; 57};
57 58
@@ -94,6 +95,7 @@ enum {
94#define TCP_INFO 11 /* Information about this connection. */ 95#define TCP_INFO 11 /* Information about this connection. */
95#define TCP_QUICKACK 12 /* Block/reenable quick acks */ 96#define TCP_QUICKACK 12 /* Block/reenable quick acks */
96#define TCP_CONGESTION 13 /* Congestion control algorithm */ 97#define TCP_CONGESTION 13 /* Congestion control algorithm */
98#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
97 99
98#define TCPI_OPT_TIMESTAMPS 1 100#define TCPI_OPT_TIMESTAMPS 1
99#define TCPI_OPT_SACK 2 101#define TCPI_OPT_SACK 2
@@ -157,6 +159,17 @@ struct tcp_info
157 __u32 tcpi_total_retrans; 159 __u32 tcpi_total_retrans;
158}; 160};
159 161
162/* for TCP_MD5SIG socket option */
163#define TCP_MD5SIG_MAXKEYLEN 80
164
165struct tcp_md5sig {
166 struct __kernel_sockaddr_storage tcpm_addr; /* address associated */
167 __u16 __tcpm_pad1; /* zero */
168 __u16 tcpm_keylen; /* key length */
169 __u32 __tcpm_pad2; /* zero */
170 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */
171};
172
160#ifdef __KERNEL__ 173#ifdef __KERNEL__
161 174
162#include <linux/skbuff.h> 175#include <linux/skbuff.h>
@@ -172,17 +185,17 @@ struct tcp_sack_block_wire {
172}; 185};
173 186
174struct tcp_sack_block { 187struct tcp_sack_block {
175 __u32 start_seq; 188 u32 start_seq;
176 __u32 end_seq; 189 u32 end_seq;
177}; 190};
178 191
179struct tcp_options_received { 192struct tcp_options_received {
180/* PAWS/RTTM data */ 193/* PAWS/RTTM data */
181 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 194 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
182 __u32 ts_recent; /* Time stamp to echo next */ 195 u32 ts_recent; /* Time stamp to echo next */
183 __u32 rcv_tsval; /* Time stamp value */ 196 u32 rcv_tsval; /* Time stamp value */
184 __u32 rcv_tsecr; /* Time stamp echo reply */ 197 u32 rcv_tsecr; /* Time stamp echo reply */
185 __u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */ 198 u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */
186 tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */ 199 tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */
187 dsack : 1, /* D-SACK is scheduled */ 200 dsack : 1, /* D-SACK is scheduled */
188 wscale_ok : 1, /* Wscale seen on SYN packet */ 201 wscale_ok : 1, /* Wscale seen on SYN packet */
@@ -190,16 +203,20 @@ struct tcp_options_received {
190 snd_wscale : 4, /* Window scaling received from sender */ 203 snd_wscale : 4, /* Window scaling received from sender */
191 rcv_wscale : 4; /* Window scaling to send to receiver */ 204 rcv_wscale : 4; /* Window scaling to send to receiver */
192/* SACKs data */ 205/* SACKs data */
193 __u8 eff_sacks; /* Size of SACK array to send with next packet */ 206 u8 eff_sacks; /* Size of SACK array to send with next packet */
194 __u8 num_sacks; /* Number of SACK blocks */ 207 u8 num_sacks; /* Number of SACK blocks */
195 __u16 user_mss; /* mss requested by user in ioctl */ 208 u16 user_mss; /* mss requested by user in ioctl */
196 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 209 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
197}; 210};
198 211
199struct tcp_request_sock { 212struct tcp_request_sock {
200 struct inet_request_sock req; 213 struct inet_request_sock req;
201 __u32 rcv_isn; 214#ifdef CONFIG_TCP_MD5SIG
202 __u32 snt_isn; 215 /* Only used by TCP MD5 Signature so far. */
216 struct tcp_request_sock_ops *af_specific;
217#endif
218 u32 rcv_isn;
219 u32 snt_isn;
203}; 220};
204 221
205static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 222static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
@@ -210,7 +227,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
210struct tcp_sock { 227struct tcp_sock {
211 /* inet_connection_sock has to be the first member of tcp_sock */ 228 /* inet_connection_sock has to be the first member of tcp_sock */
212 struct inet_connection_sock inet_conn; 229 struct inet_connection_sock inet_conn;
213 int tcp_header_len; /* Bytes of tcp header to send */ 230 u16 tcp_header_len; /* Bytes of tcp header to send */
231 u16 xmit_size_goal; /* Goal for segmenting output packets */
214 232
215/* 233/*
216 * Header prediction flags 234 * Header prediction flags
@@ -223,13 +241,13 @@ struct tcp_sock {
223 * read the code and the spec side by side (and laugh ...) 241 * read the code and the spec side by side (and laugh ...)
224 * See RFC793 and RFC1122. The RFC writes these in capitals. 242 * See RFC793 and RFC1122. The RFC writes these in capitals.
225 */ 243 */
226 __u32 rcv_nxt; /* What we want to receive next */ 244 u32 rcv_nxt; /* What we want to receive next */
227 __u32 snd_nxt; /* Next sequence we send */ 245 u32 snd_nxt; /* Next sequence we send */
228 246
229 __u32 snd_una; /* First byte we want an ack for */ 247 u32 snd_una; /* First byte we want an ack for */
230 __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ 248 u32 snd_sml; /* Last byte of the most recently transmitted small packet */
231 __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 249 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
232 __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 250 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
233 251
234 /* Data for direct copy to user */ 252 /* Data for direct copy to user */
235 struct { 253 struct {
@@ -247,32 +265,30 @@ struct tcp_sock {
247#endif 265#endif
248 } ucopy; 266 } ucopy;
249 267
250 __u32 snd_wl1; /* Sequence for window update */ 268 u32 snd_wl1; /* Sequence for window update */
251 __u32 snd_wnd; /* The window we expect to receive */ 269 u32 snd_wnd; /* The window we expect to receive */
252 __u32 max_window; /* Maximal window ever seen from peer */ 270 u32 max_window; /* Maximal window ever seen from peer */
253 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 271 u32 mss_cache; /* Cached effective mss, not including SACKS */
254 __u16 xmit_size_goal; /* Goal for segmenting output packets */
255 /* XXX Two bytes hole, try to pack */
256 272
257 __u32 window_clamp; /* Maximal window to advertise */ 273 u32 window_clamp; /* Maximal window to advertise */
258 __u32 rcv_ssthresh; /* Current window clamp */ 274 u32 rcv_ssthresh; /* Current window clamp */
259 275
260 __u32 frto_highmark; /* snd_nxt when RTO occurred */ 276 u32 frto_highmark; /* snd_nxt when RTO occurred */
261 __u8 reordering; /* Packet reordering metric. */ 277 u8 reordering; /* Packet reordering metric. */
262 __u8 frto_counter; /* Number of new acks after RTO */ 278 u8 frto_counter; /* Number of new acks after RTO */
263 __u8 nonagle; /* Disable Nagle algorithm? */ 279 u8 nonagle; /* Disable Nagle algorithm? */
264 __u8 keepalive_probes; /* num of allowed keep alive probes */ 280 u8 keepalive_probes; /* num of allowed keep alive probes */
265 281
266/* RTT measurement */ 282/* RTT measurement */
267 __u32 srtt; /* smoothed round trip time << 3 */ 283 u32 srtt; /* smoothed round trip time << 3 */
268 __u32 mdev; /* medium deviation */ 284 u32 mdev; /* medium deviation */
269 __u32 mdev_max; /* maximal mdev for the last rtt period */ 285 u32 mdev_max; /* maximal mdev for the last rtt period */
270 __u32 rttvar; /* smoothed mdev_max */ 286 u32 rttvar; /* smoothed mdev_max */
271 __u32 rtt_seq; /* sequence number to update rttvar */ 287 u32 rtt_seq; /* sequence number to update rttvar */
272 288
273 __u32 packets_out; /* Packets which are "in flight" */ 289 u32 packets_out; /* Packets which are "in flight" */
274 __u32 left_out; /* Packets which leaved network */ 290 u32 left_out; /* Packets which leaved network */
275 __u32 retrans_out; /* Retransmitted packets out */ 291 u32 retrans_out; /* Retransmitted packets out */
276/* 292/*
277 * Options received (usually on last packet, some only on SYN packets). 293 * Options received (usually on last packet, some only on SYN packets).
278 */ 294 */
@@ -281,20 +297,20 @@ struct tcp_sock {
281/* 297/*
282 * Slow start and congestion control (see also Nagle, and Karn & Partridge) 298 * Slow start and congestion control (see also Nagle, and Karn & Partridge)
283 */ 299 */
284 __u32 snd_ssthresh; /* Slow start size threshold */ 300 u32 snd_ssthresh; /* Slow start size threshold */
285 __u32 snd_cwnd; /* Sending congestion window */ 301 u32 snd_cwnd; /* Sending congestion window */
286 __u16 snd_cwnd_cnt; /* Linear increase counter */ 302 u16 snd_cwnd_cnt; /* Linear increase counter */
287 __u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
288 __u32 snd_cwnd_used; 304 u32 snd_cwnd_used;
289 __u32 snd_cwnd_stamp; 305 u32 snd_cwnd_stamp;
290 306
291 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
292 308
293 __u32 rcv_wnd; /* Current receiver window */ 309 u32 rcv_wnd; /* Current receiver window */
294 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 310 u32 rcv_wup; /* rcv_nxt on last window update sent */
295 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
296 __u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
297 __u32 copied_seq; /* Head of yet unread data */ 313 u32 copied_seq; /* Head of yet unread data */
298 314
299/* SACKs data */ 315/* SACKs data */
300 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
@@ -315,26 +331,26 @@ struct tcp_sock {
315 int retransmit_cnt_hint; 331 int retransmit_cnt_hint;
316 int forward_cnt_hint; 332 int forward_cnt_hint;
317 333
318 __u16 advmss; /* Advertised MSS */ 334 u16 advmss; /* Advertised MSS */
319 __u16 prior_ssthresh; /* ssthresh saved at recovery start */ 335 u16 prior_ssthresh; /* ssthresh saved at recovery start */
320 __u32 lost_out; /* Lost packets */ 336 u32 lost_out; /* Lost packets */
321 __u32 sacked_out; /* SACK'd packets */ 337 u32 sacked_out; /* SACK'd packets */
322 __u32 fackets_out; /* FACK'd packets */ 338 u32 fackets_out; /* FACK'd packets */
323 __u32 high_seq; /* snd_nxt at onset of congestion */ 339 u32 high_seq; /* snd_nxt at onset of congestion */
324 340
325 __u32 retrans_stamp; /* Timestamp of the last retransmit, 341 u32 retrans_stamp; /* Timestamp of the last retransmit,
326 * also used in SYN-SENT to remember stamp of 342 * also used in SYN-SENT to remember stamp of
327 * the first SYN. */ 343 * the first SYN. */
328 __u32 undo_marker; /* tracking retrans started here. */ 344 u32 undo_marker; /* tracking retrans started here. */
329 int undo_retrans; /* number of undoable retransmissions. */ 345 int undo_retrans; /* number of undoable retransmissions. */
330 __u32 urg_seq; /* Seq of received urgent pointer */ 346 u32 urg_seq; /* Seq of received urgent pointer */
331 __u16 urg_data; /* Saved octet of OOB data and control flags */ 347 u16 urg_data; /* Saved octet of OOB data and control flags */
332 __u8 urg_mode; /* In urgent mode */ 348 u8 urg_mode; /* In urgent mode */
333 __u8 ecn_flags; /* ECN status bits. */ 349 u8 ecn_flags; /* ECN status bits. */
334 __u32 snd_up; /* Urgent pointer */ 350 u32 snd_up; /* Urgent pointer */
335 351
336 __u32 total_retrans; /* Total retransmits for entire connection */ 352 u32 total_retrans; /* Total retransmits for entire connection */
337 __u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ 353 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
338 354
339 unsigned int keepalive_time; /* time before keep alive takes place */ 355 unsigned int keepalive_time; /* time before keep alive takes place */
340 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 356 unsigned int keepalive_intvl; /* time interval between keep alive probes */
@@ -342,27 +358,35 @@ struct tcp_sock {
342 358
343 unsigned long last_synq_overflow; 359 unsigned long last_synq_overflow;
344 360
345 __u32 tso_deferred; 361 u32 tso_deferred;
346 362
347/* Receiver side RTT estimation */ 363/* Receiver side RTT estimation */
348 struct { 364 struct {
349 __u32 rtt; 365 u32 rtt;
350 __u32 seq; 366 u32 seq;
351 __u32 time; 367 u32 time;
352 } rcv_rtt_est; 368 } rcv_rtt_est;
353 369
354/* Receiver queue space */ 370/* Receiver queue space */
355 struct { 371 struct {
356 int space; 372 int space;
357 __u32 seq; 373 u32 seq;
358 __u32 time; 374 u32 time;
359 } rcvq_space; 375 } rcvq_space;
360 376
361/* TCP-specific MTU probe information. */ 377/* TCP-specific MTU probe information. */
362 struct { 378 struct {
363 __u32 probe_seq_start; 379 u32 probe_seq_start;
364 __u32 probe_seq_end; 380 u32 probe_seq_end;
365 } mtu_probe; 381 } mtu_probe;
382
383#ifdef CONFIG_TCP_MD5SIG
384/* TCP AF-Specific parts; only used by MD5 Signature support so far */
385 struct tcp_sock_af_ops *af_specific;
386
387/* TCP MD5 Signagure Option information */
388 struct tcp_md5sig_info *md5sig_info;
389#endif
366}; 390};
367 391
368static inline struct tcp_sock *tcp_sk(const struct sock *sk) 392static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -372,11 +396,15 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk)
372 396
373struct tcp_timewait_sock { 397struct tcp_timewait_sock {
374 struct inet_timewait_sock tw_sk; 398 struct inet_timewait_sock tw_sk;
375 __u32 tw_rcv_nxt; 399 u32 tw_rcv_nxt;
376 __u32 tw_snd_nxt; 400 u32 tw_snd_nxt;
377 __u32 tw_rcv_wnd; 401 u32 tw_rcv_wnd;
378 __u32 tw_ts_recent; 402 u32 tw_ts_recent;
379 long tw_ts_recent_stamp; 403 long tw_ts_recent_stamp;
404#ifdef CONFIG_TCP_MD5SIG
405 u16 tw_md5_keylen;
406 u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN];
407#endif
380}; 408};
381 409
382static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) 410static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 7dac8f04d28e..004808a6df1d 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -20,7 +20,7 @@ struct ts_config;
20/** 20/**
21 * struct ts_state - search state 21 * struct ts_state - search state
22 * @offset: offset for next match 22 * @offset: offset for next match
23 * @cb: control buffer, for persistant variables of get_next_block() 23 * @cb: control buffer, for persistent variables of get_next_block()
24 */ 24 */
25struct ts_state 25struct ts_state
26{ 26{
@@ -71,7 +71,7 @@ struct ts_config
71 * Called repeatedly until 0 is returned. Must assign the 71 * Called repeatedly until 0 is returned. Must assign the
72 * head of the next block of data to &*dst and return the length 72 * head of the next block of data to &*dst and return the length
73 * of the block or 0 if at the end. consumed == 0 indicates 73 * of the block or 0 if at the end. consumed == 0 indicates
74 * a new search. May store/read persistant values in state->cb. 74 * a new search. May store/read persistent values in state->cb.
75 */ 75 */
76 unsigned int (*get_next_block)(unsigned int consumed, 76 unsigned int (*get_next_block)(unsigned int consumed,
77 const u8 **dst, 77 const u8 **dst,
diff --git a/include/linux/tfrc.h b/include/linux/tfrc.h
index 7dab7831c3cb..31a9b25276fe 100644
--- a/include/linux/tfrc.h
+++ b/include/linux/tfrc.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_TFRC_H_ 1#ifndef _LINUX_TFRC_H_
2#define _LINUX_TFRC_H_ 2#define _LINUX_TFRC_H_
3/* 3/*
4 * include/linux/tfrc.h 4 * TFRC - Data Structures for the TCP-Friendly Rate Control congestion
5 * control mechanism as specified in RFC 3448.
5 * 6 *
6 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand. 7 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
7 * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz> 8 * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz>
@@ -13,15 +14,30 @@
13 * the Free Software Foundation; either version 2 of the License, or 14 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 15 * (at your option) any later version.
15 */ 16 */
16
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19/** tfrc_rx_info - TFRC Receiver Data Structure
20 *
21 * @tfrcrx_x_recv: receiver estimate of sending rate (3.2.2)
22 * @tfrcrx_rtt: round-trip-time (communicated by sender)
23 * @tfrcrx_p: current estimate of loss event rate (3.2.2)
24 */
19struct tfrc_rx_info { 25struct tfrc_rx_info {
20 __u32 tfrcrx_x_recv; 26 __u32 tfrcrx_x_recv;
21 __u32 tfrcrx_rtt; 27 __u32 tfrcrx_rtt;
22 __u32 tfrcrx_p; 28 __u32 tfrcrx_p;
23}; 29};
24 30
31/** tfrc_tx_info - TFRC Sender Data Structure
32 *
33 * @tfrctx_x: computed transmit rate (4.3 (4))
34 * @tfrctx_x_recv: receiver estimate of send rate (4.3)
35 * @tfrctx_x_calc: return value of throughput equation (3.1)
36 * @tfrctx_rtt: (moving average) estimate of RTT (4.3)
37 * @tfrctx_p: current loss event rate (5.4)
38 * @tfrctx_rto: estimate of RTO, equals 4*RTT (4.3)
39 * @tfrctx_ipi: inter-packet interval (4.6)
40 */
25struct tfrc_tx_info { 41struct tfrc_tx_info {
26 __u32 tfrctx_x; 42 __u32 tfrctx_x;
27 __u32 tfrctx_x_recv; 43 __u32 tfrctx_x_recv;
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 33a653913d94..b0c916d1f375 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -194,34 +194,34 @@
194 194
195 195
196struct tipc_node_info { 196struct tipc_node_info {
197 __u32 addr; /* network address of node */ 197 __be32 addr; /* network address of node */
198 __u32 up; /* 0=down, 1= up */ 198 __be32 up; /* 0=down, 1= up */
199}; 199};
200 200
201struct tipc_link_info { 201struct tipc_link_info {
202 __u32 dest; /* network address of peer node */ 202 __be32 dest; /* network address of peer node */
203 __u32 up; /* 0=down, 1=up */ 203 __be32 up; /* 0=down, 1=up */
204 char str[TIPC_MAX_LINK_NAME]; /* link name */ 204 char str[TIPC_MAX_LINK_NAME]; /* link name */
205}; 205};
206 206
207struct tipc_bearer_config { 207struct tipc_bearer_config {
208 __u32 priority; /* Range [1,31]. Override per link */ 208 __be32 priority; /* Range [1,31]. Override per link */
209 __u32 detect_scope; 209 __be32 detect_scope;
210 char name[TIPC_MAX_BEARER_NAME]; 210 char name[TIPC_MAX_BEARER_NAME];
211}; 211};
212 212
213struct tipc_link_config { 213struct tipc_link_config {
214 __u32 value; 214 __be32 value;
215 char name[TIPC_MAX_LINK_NAME]; 215 char name[TIPC_MAX_LINK_NAME];
216}; 216};
217 217
218#define TIPC_NTQ_ALLTYPES 0x80000000 218#define TIPC_NTQ_ALLTYPES 0x80000000
219 219
220struct tipc_name_table_query { 220struct tipc_name_table_query {
221 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ 221 __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
222 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ 222 __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
223 __u32 lowbound; /* (i.e. displays all entries of name table) */ 223 __be32 lowbound; /* (i.e. displays all entries of name table) */
224 __u32 upbound; 224 __be32 upbound;
225}; 225};
226 226
227/* 227/*
@@ -262,8 +262,8 @@ struct tipc_route_info {
262 */ 262 */
263 263
264struct tlv_desc { 264struct tlv_desc {
265 __u16 tlv_len; /* TLV length (descriptor + value) */ 265 __be16 tlv_len; /* TLV length (descriptor + value) */
266 __u16 tlv_type; /* TLV identifier */ 266 __be16 tlv_type; /* TLV identifier */
267}; 267};
268 268
269#define TLV_ALIGNTO 4 269#define TLV_ALIGNTO 4
@@ -377,9 +377,9 @@ struct tipc_genlmsghdr {
377 377
378struct tipc_cfg_msg_hdr 378struct tipc_cfg_msg_hdr
379{ 379{
380 __u32 tcm_len; /* Message length (including header) */ 380 __be32 tcm_len; /* Message length (including header) */
381 __u16 tcm_type; /* Command type */ 381 __be16 tcm_type; /* Command type */
382 __u16 tcm_flags; /* Additional flags */ 382 __be16 tcm_flags; /* Additional flags */
383 char tcm_reserved[8]; /* Unused */ 383 char tcm_reserved[8]; /* Unused */
384}; 384};
385 385
diff --git a/include/linux/tty.h b/include/linux/tty.h
index c1f716446161..f717f0898238 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -276,9 +276,8 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
276extern int tty_unregister_ldisc(int disc); 276extern int tty_unregister_ldisc(int disc);
277extern int tty_register_driver(struct tty_driver *driver); 277extern int tty_register_driver(struct tty_driver *driver);
278extern int tty_unregister_driver(struct tty_driver *driver); 278extern int tty_unregister_driver(struct tty_driver *driver);
279extern struct class_device *tty_register_device(struct tty_driver *driver, 279extern struct device *tty_register_device(struct tty_driver *driver,
280 unsigned index, 280 unsigned index, struct device *dev);
281 struct device *dev);
282extern void tty_unregister_device(struct tty_driver *driver, unsigned index); 281extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
283extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 282extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
284 int buflen); 283 int buflen);
diff --git a/include/linux/types.h b/include/linux/types.h
index 750f085fa564..745c409ebbb5 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -128,6 +128,8 @@ typedef __s64 int64_t;
128 128
129/* this is a special 64bit data type that is 8-byte aligned */ 129/* this is a special 64bit data type that is 8-byte aligned */
130#define aligned_u64 unsigned long long __attribute__((aligned(8))) 130#define aligned_u64 unsigned long long __attribute__((aligned(8)))
131#define aligned_be64 __be64 __attribute__((aligned(8)))
132#define aligned_le64 __le64 __attribute__((aligned(8)))
131 133
132/** 134/**
133 * The type used for indexing onto a disc or disc partition. 135 * The type used for indexing onto a disc or disc partition.
@@ -180,6 +182,8 @@ typedef __u32 __bitwise __be32;
180typedef __u64 __bitwise __le64; 182typedef __u64 __bitwise __le64;
181typedef __u64 __bitwise __be64; 183typedef __u64 __bitwise __be64;
182#endif 184#endif
185typedef __u16 __bitwise __sum16;
186typedef __u32 __bitwise __wsum;
183 187
184#ifdef __KERNEL__ 188#ifdef __KERNEL__
185typedef unsigned __bitwise__ gfp_t; 189typedef unsigned __bitwise__ gfp_t;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 014b41d1e308..7e08c07efe0f 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -23,7 +23,7 @@ struct udphdr {
23 __be16 source; 23 __be16 source;
24 __be16 dest; 24 __be16 dest;
25 __be16 len; 25 __be16 len;
26 __be16 check; 26 __sum16 check;
27}; 27};
28 28
29/* UDP socket options */ 29/* UDP socket options */
@@ -38,6 +38,7 @@ struct udphdr {
38#include <linux/types.h> 38#include <linux/types.h>
39 39
40#include <net/inet_sock.h> 40#include <net/inet_sock.h>
41#define UDP_HTABLE_SIZE 128
41 42
42struct udp_sock { 43struct udp_sock {
43 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
@@ -50,12 +51,23 @@ struct udp_sock {
50 * when the socket is uncorked. 51 * when the socket is uncorked.
51 */ 52 */
52 __u16 len; /* total length of pending frames */ 53 __u16 len; /* total length of pending frames */
54 /*
55 * Fields specific to UDP-Lite.
56 */
57 __u16 pcslen;
58 __u16 pcrlen;
59/* indicator bits used by pcflag: */
60#define UDPLITE_BIT 0x1 /* set by udplite proto init function */
61#define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */
62#define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */
63 __u8 pcflag; /* marks socket as UDP-Lite if > 0 */
53}; 64};
54 65
55static inline struct udp_sock *udp_sk(const struct sock *sk) 66static inline struct udp_sock *udp_sk(const struct sock *sk)
56{ 67{
57 return (struct udp_sock *)sk; 68 return (struct udp_sock *)sk;
58} 69}
70#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
59 71
60#endif 72#endif
61 73
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 06ce7a626040..aab5b1b72021 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -313,8 +313,13 @@ struct usb_bus {
313/* This is arbitrary. 313/* This is arbitrary.
314 * From USB 2.0 spec Table 11-13, offset 7, a hub can 314 * From USB 2.0 spec Table 11-13, offset 7, a hub can
315 * have up to 255 ports. The most yet reported is 10. 315 * have up to 255 ports. The most yet reported is 10.
316 *
317 * Current Wireless USB host hardware (Intel i1480 for example) allows
318 * up to 22 devices to connect. Upcoming hardware might raise that
319 * limit. Because the arrays need to add a bit for hub status data, we
320 * do 31, so plus one evens out to four bytes.
316 */ 321 */
317#define USB_MAXCHILDREN (16) 322#define USB_MAXCHILDREN (31)
318 323
319struct usb_tt; 324struct usb_tt;
320 325
@@ -357,7 +362,8 @@ struct usb_device {
357 u8 portnum; /* Parent port number (origin 1) */ 362 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */ 363 u8 level; /* Number of USB hub ancestors */
359 364
360 int have_langid; /* whether string_langid is valid */ 365 unsigned discon_suspended:1; /* Disconnected while suspended */
366 unsigned have_langid:1; /* whether string_langid is valid */
361 int string_langid; /* language ID for strings */ 367 int string_langid; /* language ID for strings */
362 368
363 /* static strings from the device */ 369 /* static strings from the device */
@@ -410,14 +416,37 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
410 416
411/* USB autosuspend and autoresume */ 417/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND 418#ifdef CONFIG_USB_SUSPEND
419extern int usb_autopm_set_interface(struct usb_interface *intf);
413extern int usb_autopm_get_interface(struct usb_interface *intf); 420extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf); 421extern void usb_autopm_put_interface(struct usb_interface *intf);
415 422
423static inline void usb_autopm_enable(struct usb_interface *intf)
424{
425 intf->pm_usage_cnt = 0;
426 usb_autopm_set_interface(intf);
427}
428
429static inline void usb_autopm_disable(struct usb_interface *intf)
430{
431 intf->pm_usage_cnt = 1;
432 usb_autopm_set_interface(intf);
433}
434
416#else 435#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420 436
437static inline int usb_autopm_set_interface(struct usb_interface *intf)
438{ return 0; }
439
440static inline int usb_autopm_get_interface(struct usb_interface *intf)
441{ return 0; }
442
443static inline void usb_autopm_put_interface(struct usb_interface *intf)
444{ }
445static inline void usb_autopm_enable(struct usb_interface *intf)
446{ }
447static inline void usb_autopm_disable(struct usb_interface *intf)
448{ }
449#endif
421 450
422/*-------------------------------------------------------------------------*/ 451/*-------------------------------------------------------------------------*/
423 452
@@ -490,17 +519,137 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
490 519
491/*-------------------------------------------------------------------------*/ 520/*-------------------------------------------------------------------------*/
492 521
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); 522/**
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); 523 * usb_endpoint_dir_in - check if the endpoint has IN direction
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); 524 * @epd: endpoint to be checked
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); 525 *
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd); 526 * Returns true if the endpoint is of type IN, otherwise it returns false.
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); 527 */
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); 528static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); 529{
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); 530 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); 531}
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd); 532
533/**
534 * usb_endpoint_dir_out - check if the endpoint has OUT direction
535 * @epd: endpoint to be checked
536 *
537 * Returns true if the endpoint is of type OUT, otherwise it returns false.
538 */
539static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
540{
541 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
542}
543
544/**
545 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
546 * @epd: endpoint to be checked
547 *
548 * Returns true if the endpoint is of type bulk, otherwise it returns false.
549 */
550static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
551{
552 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
553 USB_ENDPOINT_XFER_BULK);
554}
555
556/**
557 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
558 * @epd: endpoint to be checked
559 *
560 * Returns true if the endpoint is of type interrupt, otherwise it returns
561 * false.
562 */
563static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
564{
565 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
566 USB_ENDPOINT_XFER_INT);
567}
568
569/**
570 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
571 * @epd: endpoint to be checked
572 *
573 * Returns true if the endpoint is of type isochronous, otherwise it returns
574 * false.
575 */
576static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
577{
578 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
579 USB_ENDPOINT_XFER_ISOC);
580}
581
582/**
583 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
584 * @epd: endpoint to be checked
585 *
586 * Returns true if the endpoint has bulk transfer type and IN direction,
587 * otherwise it returns false.
588 */
589static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
590{
591 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
592}
593
594/**
595 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
596 * @epd: endpoint to be checked
597 *
598 * Returns true if the endpoint has bulk transfer type and OUT direction,
599 * otherwise it returns false.
600 */
601static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
602{
603 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
604}
605
606/**
607 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
608 * @epd: endpoint to be checked
609 *
610 * Returns true if the endpoint has interrupt transfer type and IN direction,
611 * otherwise it returns false.
612 */
613static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
614{
615 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
616}
617
618/**
619 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
620 * @epd: endpoint to be checked
621 *
622 * Returns true if the endpoint has interrupt transfer type and OUT direction,
623 * otherwise it returns false.
624 */
625static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)
626{
627 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
628}
629
630/**
631 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
632 * @epd: endpoint to be checked
633 *
634 * Returns true if the endpoint has isochronous transfer type and IN direction,
635 * otherwise it returns false.
636 */
637static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)
638{
639 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
640}
641
642/**
643 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
644 * @epd: endpoint to be checked
645 *
646 * Returns true if the endpoint has isochronous transfer type and OUT direction,
647 * otherwise it returns false.
648 */
649static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)
650{
651 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
652}
504 653
505/*-------------------------------------------------------------------------*/ 654/*-------------------------------------------------------------------------*/
506 655
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index a50a0130fd9e..7c269f4992eb 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -546,6 +546,8 @@
546/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ 546/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
547#define IW_MLME_DEAUTH 0 547#define IW_MLME_DEAUTH 0
548#define IW_MLME_DISASSOC 1 548#define IW_MLME_DISASSOC 1
549#define IW_MLME_AUTH 2
550#define IW_MLME_ASSOC 3
549 551
550/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ 552/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
551#define IW_AUTH_INDEX 0x0FFF 553#define IW_AUTH_INDEX 0x0FFF
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 8ae7f744917b..088ba8113f7e 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -211,8 +211,8 @@ struct xfrm_user_tmpl {
211 211
212struct xfrm_encap_tmpl { 212struct xfrm_encap_tmpl {
213 __u16 encap_type; 213 __u16 encap_type;
214 __u16 encap_sport; 214 __be16 encap_sport;
215 __u16 encap_dport; 215 __be16 encap_dport;
216 xfrm_address_t encap_oa; 216 xfrm_address_t encap_oa;
217}; 217};
218 218
@@ -289,7 +289,9 @@ struct xfrm_usersa_id {
289 289
290struct xfrm_aevent_id { 290struct xfrm_aevent_id {
291 struct xfrm_usersa_id sa_id; 291 struct xfrm_usersa_id sa_id;
292 xfrm_address_t saddr;
292 __u32 flags; 293 __u32 flags;
294 __u32 reqid;
293}; 295};
294 296
295struct xfrm_userspi_info { 297struct xfrm_userspi_info {
diff --git a/include/linux/zftape.h b/include/linux/zftape.h
deleted file mode 100644
index b057c65366c6..000000000000
--- a/include/linux/zftape.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ZFTAPE_H
2#define _ZFTAPE_H
3
4/*
5 * Copyright (C) 1996, 1997 Claus-Justus Heine.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 *
22 * $Source: /homes/cvs/ftape-stacked/include/linux/zftape.h,v $
23 * $Revision: 1.12 $
24 * $Date: 1997/10/21 11:02:37 $
25 *
26 * Special ioctl and other global info for the zftape VFS
27 * interface for the QIC-40/80/3010/3020 floppy-tape driver for
28 * Linux.
29 */
30
31#define ZFTAPE_VERSION "zftape for " FTAPE_VERSION
32
33#include <linux/ftape.h>
34
35#define ZFTAPE_LABEL "Ftape - The Linux Floppy Tape Project!"
36
37/* Bits of the minor device number that control the operation mode */
38#define ZFT_Q80_MODE (1 << 3)
39#define ZFT_ZIP_MODE (1 << 4)
40#define ZFT_RAW_MODE (1 << 5)
41#define ZFT_MINOR_OP_MASK (ZFT_Q80_MODE | \
42 ZFT_ZIP_MODE | \
43 ZFT_RAW_MODE)
44#define ZFT_MINOR_MASK (FTAPE_SEL_MASK | \
45 ZFT_MINOR_OP_MASK | \
46 FTAPE_NO_REWIND)
47
48#ifdef ZFT_OBSOLETE
49struct mtblksz {
50 unsigned int mt_blksz;
51};
52#define MTIOC_ZFTAPE_GETBLKSZ _IOR('m', 104, struct mtblksz)
53#endif
54
55#ifdef __KERNEL__
56
57extern int zft_init(void);
58
59static inline __s64 zft_div_blksz(__s64 value, __u32 blk_sz)
60{
61 if (blk_sz == 1) {
62 return value;
63 } else {
64 return (__s64)(((__u32)(value >> 10) + (blk_sz >> 10) - 1)
65 / (blk_sz >> 10));
66 }
67}
68
69static inline __s64 zft_mul_blksz(__s64 value, __u32 blk_sz)
70{
71 if (blk_sz == 1) {
72 return value;
73 } else {
74 /* if blk_sz != 1, then it is a multiple of 1024. In
75 * this case, `value' will also fit into 32 bits.
76 *
77 * Actually, this limits the capacity to 42
78 * bits. This is (2^32)*1024, roughly a thousand
79 * times 2GB, or 3 Terabytes. Hopefully this is enough
80 */
81 return(__s64)(((__u32)(value)*(blk_sz>>10))<<10);
82 }
83}
84
85#endif
86
87#endif
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 44f1b673f916..88df8fc814e4 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -35,9 +35,9 @@ struct prefix_info {
35#else 35#else
36#error "Please fix <asm/byteorder.h>" 36#error "Please fix <asm/byteorder.h>"
37#endif 37#endif
38 __u32 valid; 38 __be32 valid;
39 __u32 prefered; 39 __be32 prefered;
40 __u32 reserved2; 40 __be32 reserved2;
41 41
42 struct in6_addr prefix; 42 struct in6_addr prefix;
43}; 43};
@@ -183,7 +183,7 @@ static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr)
183 * This will include the IEEE address token on links that support it. 183 * This will include the IEEE address token on links that support it.
184 */ 184 */
185 185
186 word = addr->s6_addr32[2] ^ addr->s6_addr32[3]; 186 word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]);
187 word ^= (word >> 16); 187 word ^= (word >> 16);
188 word ^= (word >> 8); 188 word ^= (word >> 8);
189 189
diff --git a/include/net/arp.h b/include/net/arp.h
index 6a3d9a7d302b..f02664568600 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -16,7 +16,7 @@ extern void arp_send(int type, int ptype, __be32 dest_ip,
16 struct net_device *dev, __be32 src_ip, 16 struct net_device *dev, __be32 src_ip,
17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
18extern int arp_bind_neighbour(struct dst_entry *dst); 18extern int arp_bind_neighbour(struct dst_entry *dst);
19extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); 19extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
20extern void arp_ifdown(struct net_device *dev); 20extern void arp_ifdown(struct net_device *dev);
21 21
22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, 22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 90fcc98e676f..b5a51a7bb364 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -36,7 +36,7 @@ struct clip_vcc {
36 36
37 37
38struct atmarp_entry { 38struct atmarp_entry {
39 u32 ip; /* IP address */ 39 __be32 ip; /* IP address */
40 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is 40 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is
41 pending */ 41 pending */
42 unsigned long expires; /* entry expiration time */ 42 unsigned long expires; /* entry expiration time */
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 89d743cfdfdf..3c563f02907c 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -124,7 +124,7 @@ struct rfcomm_pn {
124 u8 flow_ctrl; 124 u8 flow_ctrl;
125 u8 priority; 125 u8 priority;
126 u8 ack_timer; 126 u8 ack_timer;
127 u16 mtu; 127 __le16 mtu;
128 u8 max_retrans; 128 u8 max_retrans;
129 u8 credits; 129 u8 credits;
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
@@ -136,7 +136,7 @@ struct rfcomm_rpn {
136 u8 flow_ctrl; 136 u8 flow_ctrl;
137 u8 xon_char; 137 u8 xon_char;
138 u8 xoff_char; 138 u8 xoff_char;
139 u16 param_mask; 139 __le16 param_mask;
140} __attribute__ ((packed)); 140} __attribute__ ((packed));
141 141
142struct rfcomm_rls { 142struct rfcomm_rls {
diff --git a/include/net/checksum.h b/include/net/checksum.h
index e3ea7cc2c728..124246172a88 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -27,8 +27,8 @@
27 27
28#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 28#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
29static inline 29static inline
30unsigned int csum_and_copy_from_user (const unsigned char __user *src, unsigned char *dst, 30__wsum csum_and_copy_from_user (const void __user *src, void *dst,
31 int len, int sum, int *err_ptr) 31 int len, __wsum sum, int *err_ptr)
32{ 32{
33 if (access_ok(VERIFY_READ, src, len)) 33 if (access_ok(VERIFY_READ, src, len))
34 return csum_partial_copy_from_user(src, dst, len, sum, err_ptr); 34 return csum_partial_copy_from_user(src, dst, len, sum, err_ptr);
@@ -41,8 +41,8 @@ unsigned int csum_and_copy_from_user (const unsigned char __user *src, unsigned
41#endif 41#endif
42 42
43#ifndef HAVE_CSUM_COPY_USER 43#ifndef HAVE_CSUM_COPY_USER
44static __inline__ unsigned int csum_and_copy_to_user 44static __inline__ __wsum csum_and_copy_to_user
45(const unsigned char *src, unsigned char __user *dst, int len, unsigned int sum, int *err_ptr) 45(const void *src, void __user *dst, int len, __wsum sum, int *err_ptr)
46{ 46{
47 sum = csum_partial(src, len, sum); 47 sum = csum_partial(src, len, sum);
48 48
@@ -53,35 +53,44 @@ static __inline__ unsigned int csum_and_copy_to_user
53 if (len) 53 if (len)
54 *err_ptr = -EFAULT; 54 *err_ptr = -EFAULT;
55 55
56 return -1; /* invalid checksum */ 56 return (__force __wsum)-1; /* invalid checksum */
57} 57}
58#endif 58#endif
59 59
60static inline unsigned int csum_add(unsigned int csum, unsigned int addend) 60static inline __wsum csum_add(__wsum csum, __wsum addend)
61{ 61{
62 csum += addend; 62 u32 res = (__force u32)csum;
63 return csum + (csum < addend); 63 res += (__force u32)addend;
64 return (__force __wsum)(res + (res < (__force u32)addend));
64} 65}
65 66
66static inline unsigned int csum_sub(unsigned int csum, unsigned int addend) 67static inline __wsum csum_sub(__wsum csum, __wsum addend)
67{ 68{
68 return csum_add(csum, ~addend); 69 return csum_add(csum, ~addend);
69} 70}
70 71
71static inline unsigned int 72static inline __wsum
72csum_block_add(unsigned int csum, unsigned int csum2, int offset) 73csum_block_add(__wsum csum, __wsum csum2, int offset)
73{ 74{
75 u32 sum = (__force u32)csum2;
74 if (offset&1) 76 if (offset&1)
75 csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); 77 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
76 return csum_add(csum, csum2); 78 return csum_add(csum, (__force __wsum)sum);
77} 79}
78 80
79static inline unsigned int 81static inline __wsum
80csum_block_sub(unsigned int csum, unsigned int csum2, int offset) 82csum_block_sub(__wsum csum, __wsum csum2, int offset)
81{ 83{
84 u32 sum = (__force u32)csum2;
82 if (offset&1) 85 if (offset&1)
83 csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); 86 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
84 return csum_sub(csum, csum2); 87 return csum_sub(csum, (__force __wsum)sum);
85} 88}
86 89
90static inline __wsum csum_unfold(__sum16 n)
91{
92 return (__force __wsum)n;
93}
94
95#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
87#endif 96#endif
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 718b4d9c891f..4c9522c5178f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -58,10 +58,10 @@
58#define CIPSO_V4_MAP_PASS 2 58#define CIPSO_V4_MAP_PASS 2
59 59
60/* limits */ 60/* limits */
61#define CIPSO_V4_MAX_REM_LVLS 256 61#define CIPSO_V4_MAX_REM_LVLS 255
62#define CIPSO_V4_INV_LVL 0x80000000 62#define CIPSO_V4_INV_LVL 0x80000000
63#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1) 63#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1)
64#define CIPSO_V4_MAX_REM_CATS 65536 64#define CIPSO_V4_MAX_REM_CATS 65534
65#define CIPSO_V4_INV_CAT 0x80000000 65#define CIPSO_V4_INV_CAT 0x80000000
66#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1) 66#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1)
67 67
diff --git a/include/net/dsfield.h b/include/net/dsfield.h
index a79c9e075f7f..eb65bf2e2502 100644
--- a/include/net/dsfield.h
+++ b/include/net/dsfield.h
@@ -20,14 +20,14 @@ static inline __u8 ipv4_get_dsfield(struct iphdr *iph)
20 20
21static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) 21static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h)
22{ 22{
23 return ntohs(*(__u16 *) ipv6h) >> 4; 23 return ntohs(*(__be16 *) ipv6h) >> 4;
24} 24}
25 25
26 26
27static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask, 27static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask,
28 __u8 value) 28 __u8 value)
29{ 29{
30 __u32 check = ntohs(iph->check); 30 __u32 check = ntohs((__force __be16)iph->check);
31 __u8 dsfield; 31 __u8 dsfield;
32 32
33 dsfield = (iph->tos & mask) | value; 33 dsfield = (iph->tos & mask) | value;
@@ -35,7 +35,7 @@ static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask,
35 if ((check+1) >> 16) check = (check+1) & 0xffff; 35 if ((check+1) >> 16) check = (check+1) & 0xffff;
36 check -= dsfield; 36 check -= dsfield;
37 check += check >> 16; /* adjust carry */ 37 check += check >> 16; /* adjust carry */
38 iph->check = htons(check); 38 iph->check = (__force __sum16)htons(check);
39 iph->tos = dsfield; 39 iph->tos = dsfield;
40} 40}
41 41
@@ -45,9 +45,9 @@ static inline void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask,
45{ 45{
46 __u16 tmp; 46 __u16 tmp;
47 47
48 tmp = ntohs(*(__u16 *) ipv6h); 48 tmp = ntohs(*(__be16 *) ipv6h);
49 tmp = (tmp & ((mask << 4) | 0xf00f)) | (value << 4); 49 tmp = (tmp & ((mask << 4) | 0xf00f)) | (value << 4);
50 *(__u16 *) ipv6h = htons(tmp); 50 *(__be16 *) ipv6h = htons(tmp);
51} 51}
52 52
53 53
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 8e2f473d3e82..bc3c26494c3d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -13,6 +13,8 @@ struct fib_rule
13 atomic_t refcnt; 13 atomic_t refcnt;
14 int ifindex; 14 int ifindex;
15 char ifname[IFNAMSIZ]; 15 char ifname[IFNAMSIZ];
16 u32 mark;
17 u32 mark_mask;
16 u32 pref; 18 u32 pref;
17 u32 flags; 19 u32 flags;
18 u32 table; 20 u32 table;
@@ -50,6 +52,7 @@ struct fib_rules_ops
50 struct nlmsghdr *, 52 struct nlmsghdr *,
51 struct fib_rule_hdr *); 53 struct fib_rule_hdr *);
52 u32 (*default_pref)(void); 54 u32 (*default_pref)(void);
55 size_t (*nlmsg_payload)(struct fib_rule *);
53 56
54 int nlgroup; 57 int nlgroup;
55 struct nla_policy *policy; 58 struct nla_policy *policy;
@@ -57,6 +60,13 @@ struct fib_rules_ops
57 struct module *owner; 60 struct module *owner;
58}; 61};
59 62
63#define FRA_GENERIC_POLICY \
64 [FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
65 [FRA_PRIORITY] = { .type = NLA_U32 }, \
66 [FRA_FWMARK] = { .type = NLA_U32 }, \
67 [FRA_FWMASK] = { .type = NLA_U32 }, \
68 [FRA_TABLE] = { .type = NLA_U32 }
69
60static inline void fib_rule_get(struct fib_rule *rule) 70static inline void fib_rule_get(struct fib_rule *rule)
61{ 71{
62 atomic_inc(&rule->refcnt); 72 atomic_inc(&rule->refcnt);
diff --git a/include/net/flow.h b/include/net/flow.h
index 5cda27cd9deb..ce4b10d8b412 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -13,12 +13,12 @@
13struct flowi { 13struct flowi {
14 int oif; 14 int oif;
15 int iif; 15 int iif;
16 __u32 mark;
16 17
17 union { 18 union {
18 struct { 19 struct {
19 __be32 daddr; 20 __be32 daddr;
20 __be32 saddr; 21 __be32 saddr;
21 __u32 fwmark;
22 __u8 tos; 22 __u8 tos;
23 __u8 scope; 23 __u8 scope;
24 } ip4_u; 24 } ip4_u;
@@ -26,28 +26,23 @@ struct flowi {
26 struct { 26 struct {
27 struct in6_addr daddr; 27 struct in6_addr daddr;
28 struct in6_addr saddr; 28 struct in6_addr saddr;
29 __u32 fwmark; 29 __be32 flowlabel;
30 __u32 flowlabel;
31 } ip6_u; 30 } ip6_u;
32 31
33 struct { 32 struct {
34 __le16 daddr; 33 __le16 daddr;
35 __le16 saddr; 34 __le16 saddr;
36 __u32 fwmark;
37 __u8 scope; 35 __u8 scope;
38 } dn_u; 36 } dn_u;
39 } nl_u; 37 } nl_u;
40#define fld_dst nl_u.dn_u.daddr 38#define fld_dst nl_u.dn_u.daddr
41#define fld_src nl_u.dn_u.saddr 39#define fld_src nl_u.dn_u.saddr
42#define fld_fwmark nl_u.dn_u.fwmark
43#define fld_scope nl_u.dn_u.scope 40#define fld_scope nl_u.dn_u.scope
44#define fl6_dst nl_u.ip6_u.daddr 41#define fl6_dst nl_u.ip6_u.daddr
45#define fl6_src nl_u.ip6_u.saddr 42#define fl6_src nl_u.ip6_u.saddr
46#define fl6_fwmark nl_u.ip6_u.fwmark
47#define fl6_flowlabel nl_u.ip6_u.flowlabel 43#define fl6_flowlabel nl_u.ip6_u.flowlabel
48#define fl4_dst nl_u.ip4_u.daddr 44#define fl4_dst nl_u.ip4_u.daddr
49#define fl4_src nl_u.ip4_u.saddr 45#define fl4_src nl_u.ip4_u.saddr
50#define fl4_fwmark nl_u.ip4_u.fwmark
51#define fl4_tos nl_u.ip4_u.tos 46#define fl4_tos nl_u.ip4_u.tos
52#define fl4_scope nl_u.ip4_u.scope 47#define fl4_scope nl_u.ip4_u.scope
53 48
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b619314218a6..adff4c898d50 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -53,6 +53,7 @@ struct genl_info
53 * @policy: attribute validation policy 53 * @policy: attribute validation policy
54 * @doit: standard command callback 54 * @doit: standard command callback
55 * @dumpit: callback for dumpers 55 * @dumpit: callback for dumpers
56 * @done: completion callback for dumps
56 * @ops_list: operations list 57 * @ops_list: operations list
57 */ 58 */
58struct genl_ops 59struct genl_ops
@@ -64,6 +65,7 @@ struct genl_ops
64 struct genl_info *info); 65 struct genl_info *info);
65 int (*dumpit)(struct sk_buff *skb, 66 int (*dumpit)(struct sk_buff *skb,
66 struct netlink_callback *cb); 67 struct netlink_callback *cb);
68 int (*done)(struct netlink_callback *cb);
67 struct list_head ops_list; 69 struct list_head ops_list;
68}; 70};
69 71
@@ -79,34 +81,51 @@ extern struct sock *genl_sock;
79 * @skb: socket buffer holding the message 81 * @skb: socket buffer holding the message
80 * @pid: netlink pid the message is addressed to 82 * @pid: netlink pid the message is addressed to
81 * @seq: sequence number (usually the one of the sender) 83 * @seq: sequence number (usually the one of the sender)
82 * @type: netlink message type 84 * @family: generic netlink family
83 * @hdrlen: length of the user specific header
84 * @flags netlink message flags 85 * @flags netlink message flags
85 * @cmd: generic netlink command 86 * @cmd: generic netlink command
86 * @version: version
87 * 87 *
88 * Returns pointer to user specific header 88 * Returns pointer to user specific header
89 */ 89 */
90static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 90static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
91 int type, int hdrlen, int flags, 91 struct genl_family *family, int flags, u8 cmd)
92 u8 cmd, u8 version)
93{ 92{
94 struct nlmsghdr *nlh; 93 struct nlmsghdr *nlh;
95 struct genlmsghdr *hdr; 94 struct genlmsghdr *hdr;
96 95
97 nlh = nlmsg_put(skb, pid, seq, type, GENL_HDRLEN + hdrlen, flags); 96 nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN +
97 family->hdrsize, flags);
98 if (nlh == NULL) 98 if (nlh == NULL)
99 return NULL; 99 return NULL;
100 100
101 hdr = nlmsg_data(nlh); 101 hdr = nlmsg_data(nlh);
102 hdr->cmd = cmd; 102 hdr->cmd = cmd;
103 hdr->version = version; 103 hdr->version = family->version;
104 hdr->reserved = 0; 104 hdr->reserved = 0;
105 105
106 return (char *) hdr + GENL_HDRLEN; 106 return (char *) hdr + GENL_HDRLEN;
107} 107}
108 108
109/** 109/**
110 * genlmsg_put_reply - Add generic netlink header to a reply message
111 * @skb: socket buffer holding the message
112 * @info: receiver info
113 * @family: generic netlink family
114 * @flags: netlink message flags
115 * @cmd: generic netlink command
116 *
117 * Returns pointer to user specific header
118 */
119static inline void *genlmsg_put_reply(struct sk_buff *skb,
120 struct genl_info *info,
121 struct genl_family *family,
122 int flags, u8 cmd)
123{
124 return genlmsg_put(skb, info->snd_pid, info->snd_seq, family,
125 flags, cmd);
126}
127
128/**
110 * genlmsg_end - Finalize a generic netlink message 129 * genlmsg_end - Finalize a generic netlink message
111 * @skb: socket buffer the message is stored in 130 * @skb: socket buffer the message is stored in
112 * @hdr: user specific header 131 * @hdr: user specific header
@@ -150,6 +169,16 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
150} 169}
151 170
152/** 171/**
172 * genlmsg_reply - reply to a request
173 * @skb: netlink message to be sent back
174 * @info: receiver information
175 */
176static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
177{
178 return genlmsg_unicast(skb, info->snd_pid);
179}
180
181/**
153 * gennlmsg_data - head of message payload 182 * gennlmsg_data - head of message payload
154 * @gnlh: genetlink messsage header 183 * @gnlh: genetlink messsage header
155 */ 184 */
@@ -187,4 +216,15 @@ static inline int genlmsg_total_size(int payload)
187 return NLMSG_ALIGN(genlmsg_msg_size(payload)); 216 return NLMSG_ALIGN(genlmsg_msg_size(payload));
188} 217}
189 218
219/**
220 * genlmsg_new - Allocate a new generic netlink message
221 * @payload: size of the message payload
222 * @flags: the type of memory to allocate.
223 */
224static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
225{
226 return nlmsg_new(genlmsg_total_size(payload), flags);
227}
228
229
190#endif /* __NET_GENERIC_NETLINK_H */ 230#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index b174ebb277a9..e6af381e206d 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -1037,6 +1037,10 @@ struct ieee80211_device {
1037 /* host performs multicast decryption */ 1037 /* host performs multicast decryption */
1038 int host_mc_decrypt; 1038 int host_mc_decrypt;
1039 1039
1040 /* host should strip IV and ICV from protected frames */
1041 /* meaningful only when hardware decryption is being used */
1042 int host_strip_iv_icv;
1043
1040 int host_open_frag; 1044 int host_open_frag;
1041 int host_build_iv; 1045 int host_build_iv;
1042 int ieee802_1x; /* is IEEE 802.1X used */ 1046 int ieee802_1x; /* is IEEE 802.1X used */
@@ -1076,6 +1080,8 @@ struct ieee80211_device {
1076 int perfect_rssi; 1080 int perfect_rssi;
1077 int worst_rssi; 1081 int worst_rssi;
1078 1082
1083 u16 prev_seq_ctl; /* used to drop duplicate frames */
1084
1079 /* Callback functions */ 1085 /* Callback functions */
1080 void (*set_security) (struct net_device * dev, 1086 void (*set_security) (struct net_device * dev,
1081 struct ieee80211_security * sec); 1087 struct ieee80211_security * sec);
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 34489c13c119..3ec7d07346d6 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -152,6 +152,7 @@ struct ifacaddr6
152 152
153struct ipv6_devstat { 153struct ipv6_devstat {
154 struct proc_dir_entry *proc_dir_entry; 154 struct proc_dir_entry *proc_dir_entry;
155 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6);
155 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6); 156 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6);
156}; 157};
157 158
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index b33b438bffcc..16aa96a6a53b 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -27,7 +27,7 @@ extern int inet6_csk_bind_conflict(const struct sock *sk,
27 27
28extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 28extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
29 struct request_sock ***prevp, 29 struct request_sock ***prevp,
30 const __u16 rport, 30 const __be16 rport,
31 const struct in6_addr *raddr, 31 const struct in6_addr *raddr,
32 const struct in6_addr *laddr, 32 const struct in6_addr *laddr,
33 const int iif); 33 const int iif);
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index bc6a71dce984..c28e424f53d9 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -26,11 +26,11 @@ struct inet_hashinfo;
26 26
27/* I have no idea if this is a good hash for v6 or not. -DaveM */ 27/* I have no idea if this is a good hash for v6 or not. -DaveM */
28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
29 const struct in6_addr *faddr, const u16 fport) 29 const struct in6_addr *faddr, const __be16 fport)
30{ 30{
31 unsigned int hashent = (lport ^ fport); 31 unsigned int hashent = (lport ^ (__force u16)fport);
32 32
33 hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 33 hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]);
34 hashent ^= hashent >> 16; 34 hashent ^= hashent >> 16;
35 hashent ^= hashent >> 8; 35 hashent ^= hashent >> 8;
36 return hashent; 36 return hashent;
@@ -43,7 +43,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
43 const struct in6_addr *laddr = &np->rcv_saddr; 43 const struct in6_addr *laddr = &np->rcv_saddr;
44 const struct in6_addr *faddr = &np->daddr; 44 const struct in6_addr *faddr = &np->daddr;
45 const __u16 lport = inet->num; 45 const __u16 lport = inet->num;
46 const __u16 fport = inet->dport; 46 const __be16 fport = inet->dport;
47 return inet6_ehashfn(laddr, lport, faddr, fport); 47 return inet6_ehashfn(laddr, lport, faddr, fport);
48} 48}
49 49
@@ -57,7 +57,7 @@ extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
57 */ 57 */
58extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 58extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
59 const struct in6_addr *saddr, 59 const struct in6_addr *saddr,
60 const u16 sport, 60 const __be16 sport,
61 const struct in6_addr *daddr, 61 const struct in6_addr *daddr,
62 const u16 hnum, 62 const u16 hnum,
63 const int dif); 63 const int dif);
@@ -69,7 +69,7 @@ extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
69 69
70static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo, 70static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
71 const struct in6_addr *saddr, 71 const struct in6_addr *saddr,
72 const u16 sport, 72 const __be16 sport,
73 const struct in6_addr *daddr, 73 const struct in6_addr *daddr,
74 const u16 hnum, 74 const u16 hnum,
75 const int dif) 75 const int dif)
@@ -83,8 +83,8 @@ static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
83} 83}
84 84
85extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 85extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
86 const struct in6_addr *saddr, const u16 sport, 86 const struct in6_addr *saddr, const __be16 sport,
87 const struct in6_addr *daddr, const u16 dport, 87 const struct in6_addr *daddr, const __be16 dport,
88 const int dif); 88 const int dif);
89#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */ 89#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */
90#endif /* _INET6_HASHTABLES_H */ 90#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 0bcf9f237e1f..cccea051e922 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -36,7 +36,8 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 36 * (i.e. things that depend on the address family)
37 */ 37 */
38struct inet_connection_sock_af_ops { 38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok); 39 int (*queue_xmit)(struct sk_buff *skb, struct sock *sk,
40 int ipfragok);
40 void (*send_check)(struct sock *sk, int len, 41 void (*send_check)(struct sock *sk, int len,
41 struct sk_buff *skb); 42 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk); 43 int (*rebuild_header)(struct sock *sk);
@@ -45,7 +46,8 @@ struct inet_connection_sock_af_ops {
45 struct request_sock *req, 46 struct request_sock *req,
46 struct dst_entry *dst); 47 struct dst_entry *dst);
47 int (*remember_stamp)(struct sock *sk); 48 int (*remember_stamp)(struct sock *sk);
48 __u16 net_header_len; 49 u16 net_header_len;
50 u16 sockaddr_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname, 51 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, int optlen); 52 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname, 53 int (*getsockopt)(struct sock *sk, int level, int optname,
@@ -57,7 +59,6 @@ struct inet_connection_sock_af_ops {
57 int level, int optname, 59 int level, int optname,
58 char __user *optval, int __user *optlen); 60 char __user *optval, int __user *optlen);
59 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 61 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
60 int sockaddr_len;
61}; 62};
62 63
63/** inet_connection_sock - INET connection oriented sock 64/** inet_connection_sock - INET connection oriented sock
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 7849844a4911..10117c8503e8 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -53,7 +53,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
53 53
54static inline int IP_ECN_set_ce(struct iphdr *iph) 54static inline int IP_ECN_set_ce(struct iphdr *iph)
55{ 55{
56 u32 check = iph->check; 56 u32 check = (__force u32)iph->check;
57 u32 ecn = (iph->tos + 1) & INET_ECN_MASK; 57 u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
58 58
59 /* 59 /*
@@ -71,9 +71,9 @@ static inline int IP_ECN_set_ce(struct iphdr *iph)
71 * INET_ECN_ECT_1 => check += htons(0xFFFD) 71 * INET_ECN_ECT_1 => check += htons(0xFFFD)
72 * INET_ECN_ECT_0 => check += htons(0xFFFE) 72 * INET_ECN_ECT_0 => check += htons(0xFFFE)
73 */ 73 */
74 check += htons(0xFFFB) + htons(ecn); 74 check += (__force u16)htons(0xFFFB) + (__force u16)htons(ecn);
75 75
76 iph->check = check + (check>=0xFFFF); 76 iph->check = (__force __sum16)(check + (check>=0xFFFF));
77 iph->tos |= INET_ECN_CE; 77 iph->tos |= INET_ECN_CE;
78 return 1; 78 return 1;
79} 79}
@@ -95,13 +95,13 @@ static inline int IP6_ECN_set_ce(struct ipv6hdr *iph)
95{ 95{
96 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) 96 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
97 return 0; 97 return 0;
98 *(u32*)iph |= htonl(INET_ECN_CE << 20); 98 *(__be32*)iph |= htonl(INET_ECN_CE << 20);
99 return 1; 99 return 1;
100} 100}
101 101
102static inline void IP6_ECN_clear(struct ipv6hdr *iph) 102static inline void IP6_ECN_clear(struct ipv6hdr *iph)
103{ 103{
104 *(u32*)iph &= ~htonl(INET_ECN_MASK << 20); 104 *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20);
105} 105}
106 106
107static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) 107static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner)
diff --git a/include/net/ip.h b/include/net/ip.h
index b6d95e553401..83cb9ac5554e 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -97,7 +97,7 @@ extern int ip_mc_output(struct sk_buff *skb);
97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
98extern int ip_do_nat(struct sk_buff *skb); 98extern int ip_do_nat(struct sk_buff *skb);
99extern void ip_send_check(struct iphdr *ip); 99extern void ip_send_check(struct iphdr *ip);
100extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 100extern int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
101extern void ip_init(void); 101extern void ip_init(void);
102extern int ip_append_data(struct sock *sk, 102extern int ip_append_data(struct sock *sk,
103 int getfrag(void *from, char *to, int offset, int len, 103 int getfrag(void *from, char *to, int offset, int len,
@@ -123,7 +123,7 @@ extern int ip4_datagram_connect(struct sock *sk,
123 * multicast packets. 123 * multicast packets.
124 */ 124 */
125 125
126static inline void ip_tr_mc_map(u32 addr, char *buf) 126static inline void ip_tr_mc_map(__be32 addr, char *buf)
127{ 127{
128 buf[0]=0xC0; 128 buf[0]=0xC0;
129 buf[1]=0x00; 129 buf[1]=0x00;
@@ -135,7 +135,7 @@ static inline void ip_tr_mc_map(u32 addr, char *buf)
135 135
136struct ip_reply_arg { 136struct ip_reply_arg {
137 struct kvec iov[1]; 137 struct kvec iov[1];
138 u32 csum; 138 __wsum csum;
139 int csumoffset; /* u16 offset of csum in iov[0].iov_base */ 139 int csumoffset; /* u16 offset of csum in iov[0].iov_base */
140 /* -1 if not needed */ 140 /* -1 if not needed */
141}; 141};
@@ -192,9 +192,9 @@ extern void ipfrag_init(void);
192static inline 192static inline
193int ip_decrease_ttl(struct iphdr *iph) 193int ip_decrease_ttl(struct iphdr *iph)
194{ 194{
195 u32 check = iph->check; 195 u32 check = (__force u32)iph->check;
196 check += htons(0x0100); 196 check += (__force u32)htons(0x0100);
197 iph->check = check + (check>=0xFFFF); 197 iph->check = (__force __sum16)(check + (check>=0xFFFF));
198 return --iph->ttl; 198 return --iph->ttl;
199} 199}
200 200
@@ -238,9 +238,9 @@ static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst
238 * Map a multicast IP onto multicast MAC for type ethernet. 238 * Map a multicast IP onto multicast MAC for type ethernet.
239 */ 239 */
240 240
241static inline void ip_eth_mc_map(u32 addr, char *buf) 241static inline void ip_eth_mc_map(__be32 naddr, char *buf)
242{ 242{
243 addr=ntohl(addr); 243 __u32 addr=ntohl(naddr);
244 buf[0]=0x01; 244 buf[0]=0x01;
245 buf[1]=0x00; 245 buf[1]=0x00;
246 buf[2]=0x5e; 246 buf[2]=0x5e;
@@ -256,13 +256,14 @@ static inline void ip_eth_mc_map(u32 addr, char *buf)
256 * Leave P_Key as 0 to be filled in by driver. 256 * Leave P_Key as 0 to be filled in by driver.
257 */ 257 */
258 258
259static inline void ip_ib_mc_map(u32 addr, char *buf) 259static inline void ip_ib_mc_map(__be32 naddr, char *buf)
260{ 260{
261 __u32 addr;
261 buf[0] = 0; /* Reserved */ 262 buf[0] = 0; /* Reserved */
262 buf[1] = 0xff; /* Multicast QPN */ 263 buf[1] = 0xff; /* Multicast QPN */
263 buf[2] = 0xff; 264 buf[2] = 0xff;
264 buf[3] = 0xff; 265 buf[3] = 0xff;
265 addr = ntohl(addr); 266 addr = ntohl(naddr);
266 buf[4] = 0xff; 267 buf[4] = 0xff;
267 buf[5] = 0x12; /* link local scope */ 268 buf[5] = 0x12; /* link local scope */
268 buf[6] = 0x40; /* IPv4 signature */ 269 buf[6] = 0x40; /* IPv4 signature */
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 3dfc885bdf25..68e2b32cf1d6 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -34,60 +34,60 @@
34 34
35#ifndef _HAVE_ARCH_IPV6_CSUM 35#ifndef _HAVE_ARCH_IPV6_CSUM
36 36
37static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 37static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
38 struct in6_addr *daddr, 38 const struct in6_addr *daddr,
39 __u16 len, 39 __u32 len, unsigned short proto,
40 unsigned short proto, 40 __wsum csum)
41 unsigned int csum)
42{ 41{
43 42
44 int carry; 43 int carry;
45 __u32 ulen; 44 __u32 ulen;
46 __u32 uproto; 45 __u32 uproto;
46 __u32 sum = (__force u32)csum;
47 47
48 csum += saddr->s6_addr32[0]; 48 sum += (__force u32)saddr->s6_addr32[0];
49 carry = (csum < saddr->s6_addr32[0]); 49 carry = (sum < (__force u32)saddr->s6_addr32[0]);
50 csum += carry; 50 sum += carry;
51 51
52 csum += saddr->s6_addr32[1]; 52 sum += (__force u32)saddr->s6_addr32[1];
53 carry = (csum < saddr->s6_addr32[1]); 53 carry = (sum < (__force u32)saddr->s6_addr32[1]);
54 csum += carry; 54 sum += carry;
55 55
56 csum += saddr->s6_addr32[2]; 56 sum += (__force u32)saddr->s6_addr32[2];
57 carry = (csum < saddr->s6_addr32[2]); 57 carry = (sum < (__force u32)saddr->s6_addr32[2]);
58 csum += carry; 58 sum += carry;
59 59
60 csum += saddr->s6_addr32[3]; 60 sum += (__force u32)saddr->s6_addr32[3];
61 carry = (csum < saddr->s6_addr32[3]); 61 carry = (sum < (__force u32)saddr->s6_addr32[3]);
62 csum += carry; 62 sum += carry;
63 63
64 csum += daddr->s6_addr32[0]; 64 sum += (__force u32)daddr->s6_addr32[0];
65 carry = (csum < daddr->s6_addr32[0]); 65 carry = (sum < (__force u32)daddr->s6_addr32[0]);
66 csum += carry; 66 sum += carry;
67 67
68 csum += daddr->s6_addr32[1]; 68 sum += (__force u32)daddr->s6_addr32[1];
69 carry = (csum < daddr->s6_addr32[1]); 69 carry = (sum < (__force u32)daddr->s6_addr32[1]);
70 csum += carry; 70 sum += carry;
71 71
72 csum += daddr->s6_addr32[2]; 72 sum += (__force u32)daddr->s6_addr32[2];
73 carry = (csum < daddr->s6_addr32[2]); 73 carry = (sum < (__force u32)daddr->s6_addr32[2]);
74 csum += carry; 74 sum += carry;
75 75
76 csum += daddr->s6_addr32[3]; 76 sum += (__force u32)daddr->s6_addr32[3];
77 carry = (csum < daddr->s6_addr32[3]); 77 carry = (sum < (__force u32)daddr->s6_addr32[3]);
78 csum += carry; 78 sum += carry;
79 79
80 ulen = htonl((__u32) len); 80 ulen = (__force u32)htonl((__u32) len);
81 csum += ulen; 81 sum += ulen;
82 carry = (csum < ulen); 82 carry = (sum < ulen);
83 csum += carry; 83 sum += carry;
84 84
85 uproto = htonl(proto); 85 uproto = (__force u32)htonl(proto);
86 csum += uproto; 86 sum += uproto;
87 carry = (csum < uproto); 87 carry = (sum < uproto);
88 csum += carry; 88 sum += carry;
89 89
90 return csum_fold(csum); 90 return csum_fold((__force __wsum)csum);
91} 91}
92 92
93#endif 93#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index e4438de3bd6b..f9cde44f93b4 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -107,6 +107,11 @@ struct rt6_info
107 u8 rt6i_protocol; 107 u8 rt6i_protocol;
108}; 108};
109 109
110static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
111{
112 return ((struct rt6_info *)dst)->rt6i_idev;
113}
114
110struct fib6_walker_t 115struct fib6_walker_t
111{ 116{
112 struct fib6_walker_t *prev, *next; 117 struct fib6_walker_t *prev, *next;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index c14b70ed4c57..4e927ebd1cb3 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -20,7 +20,7 @@ struct route_info {
20 route_pref:2, 20 route_pref:2,
21 reserved_h:3; 21 reserved_h:3;
22#endif 22#endif
23 __u32 lifetime; 23 __be32 lifetime;
24 __u8 prefix[0]; /* 0,8 or 16 */ 24 __u8 prefix[0]; /* 0,8 or 16 */
25}; 25};
26 26
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 949b932d2f08..36c635ca1aa6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -115,7 +115,7 @@ struct fib_result {
115 115
116struct fib_result_nl { 116struct fib_result_nl {
117 __be32 fl_addr; /* To be looked up*/ 117 __be32 fl_addr; /* To be looked up*/
118 u32 fl_fwmark; 118 u32 fl_mark;
119 unsigned char fl_tos; 119 unsigned char fl_tos;
120 unsigned char fl_scope; 120 unsigned char fl_scope;
121 unsigned char tb_id_in; 121 unsigned char tb_id_in;
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h
index beffdd66ad74..25b56571e54b 100644
--- a/include/net/ip_mp_alg.h
+++ b/include/net/ip_mp_alg.h
@@ -88,9 +88,7 @@ static inline int multipath_comparekeys(const struct flowi *flp1,
88 return flp1->fl4_dst == flp2->fl4_dst && 88 return flp1->fl4_dst == flp2->fl4_dst &&
89 flp1->fl4_src == flp2->fl4_src && 89 flp1->fl4_src == flp2->fl4_src &&
90 flp1->oif == flp2->oif && 90 flp1->oif == flp2->oif &&
91#ifdef CONFIG_IP_ROUTE_FWMARK 91 flp1->mark == flp2->mark &&
92 flp1->fl4_fwmark == flp2->fl4_fwmark &&
93#endif
94 !((flp1->fl4_tos ^ flp2->fl4_tos) & 92 !((flp1->fl4_tos ^ flp2->fl4_tos) &
95 (IPTOS_RT_MASK | RTO_ONLINK)); 93 (IPTOS_RT_MASK | RTO_ONLINK));
96} 94}
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 903108e583f8..672564e5a81d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -988,14 +988,20 @@ extern int ip_vs_make_skb_writable(struct sk_buff **pskb, int len);
988extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 988extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
989 struct ip_vs_conn *cp, int dir); 989 struct ip_vs_conn *cp, int dir);
990 990
991extern u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 991extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
992 992
993static inline u16 ip_vs_check_diff(u32 old, u32 new, u16 oldsum) 993static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
994{ 994{
995 u32 diff[2] = { old, new }; 995 __be32 diff[2] = { ~old, new };
996 996
997 return csum_fold(csum_partial((char *) diff, sizeof(diff), 997 return csum_partial((char *) diff, sizeof(diff), oldsum);
998 oldsum ^ 0xFFFF)); 998}
999
1000static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
1001{
1002 __be16 diff[2] = { ~old, new };
1003
1004 return csum_partial((char *) diff, sizeof(diff), oldsum);
999} 1005}
1000 1006
1001#endif /* __KERNEL__ */ 1007#endif /* __KERNEL__ */
diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h
index 2a1fe996fbc6..3924d7d2cb11 100644
--- a/include/net/ipconfig.h
+++ b/include/net/ipconfig.h
@@ -11,12 +11,12 @@
11extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ 11extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */
12extern int ic_set_manually; /* IPconfig parameters set manually */ 12extern int ic_set_manually; /* IPconfig parameters set manually */
13 13
14extern u32 ic_myaddr; /* My IP address */ 14extern __be32 ic_myaddr; /* My IP address */
15extern u32 ic_gateway; /* Gateway IP address */ 15extern __be32 ic_gateway; /* Gateway IP address */
16 16
17extern u32 ic_servaddr; /* Boot server IP address */ 17extern __be32 ic_servaddr; /* Boot server IP address */
18 18
19extern u32 root_server_addr; /* Address of NFS server */ 19extern __be32 root_server_addr; /* Address of NFS server */
20extern u8 root_server_path[]; /* Path to mount as root */ 20extern u8 root_server_path[]; /* Path to mount as root */
21 21
22 22
diff --git a/include/net/ipip.h b/include/net/ipip.h
index f490c3cbe377..7cdc914322f0 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -35,7 +35,7 @@ struct ip_tunnel
35 ip_send_check(iph); \ 35 ip_send_check(iph); \
36 \ 36 \
37 err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\ 37 err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\
38 if (err == NET_XMIT_SUCCESS || err == NET_XMIT_CN) { \ 38 if (net_xmit_eval(err) == 0) { \
39 stats->tx_bytes += pkt_len; \ 39 stats->tx_bytes += pkt_len; \
40 stats->tx_packets++; \ 40 stats->tx_packets++; \
41 } else { \ 41 } else { \
@@ -44,8 +44,4 @@ struct ip_tunnel
44 } \ 44 } \
45} while (0) 45} while (0)
46 46
47
48extern int sit_init(void);
49extern void sit_cleanup(void);
50
51#endif 47#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8223c4410b4b..00328b71a08c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -95,10 +95,10 @@
95 */ 95 */
96 96
97struct frag_hdr { 97struct frag_hdr {
98 unsigned char nexthdr; 98 __u8 nexthdr;
99 unsigned char reserved; 99 __u8 reserved;
100 unsigned short frag_off; 100 __be16 frag_off;
101 __u32 identification; 101 __be32 identification;
102}; 102};
103 103
104#define IP6_MF 0x0001 104#define IP6_MF 0x0001
@@ -113,9 +113,24 @@ extern int sysctl_mld_max_msf;
113 113
114/* MIBs */ 114/* MIBs */
115DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); 115DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
116#define IP6_INC_STATS(field) SNMP_INC_STATS(ipv6_statistics, field) 116#define IP6_INC_STATS(idev,field) ({ \
117#define IP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(ipv6_statistics, field) 117 struct inet6_dev *_idev = (idev); \
118#define IP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(ipv6_statistics, field) 118 if (likely(_idev != NULL)) \
119 SNMP_INC_STATS(_idev->stats.ipv6, field); \
120 SNMP_INC_STATS(ipv6_statistics, field); \
121})
122#define IP6_INC_STATS_BH(idev,field) ({ \
123 struct inet6_dev *_idev = (idev); \
124 if (likely(_idev != NULL)) \
125 SNMP_INC_STATS_BH(_idev->stats.ipv6, field); \
126 SNMP_INC_STATS_BH(ipv6_statistics, field); \
127})
128#define IP6_INC_STATS_USER(idev,field) ({ \
129 struct inet6_dev *_idev = (idev); \
130 if (likely(_idev != NULL)) \
131 SNMP_INC_STATS_USER(_idev->stats.ipv6, field); \
132 SNMP_INC_STATS_USER(ipv6_statistics, field); \
133})
119DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 134DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
120#define ICMP6_INC_STATS(idev, field) ({ \ 135#define ICMP6_INC_STATS(idev, field) ({ \
121 struct inet6_dev *_idev = (idev); \ 136 struct inet6_dev *_idev = (idev); \
@@ -143,9 +158,13 @@ DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
143 SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ 158 SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \
144}) 159})
145DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); 160DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6);
146#define UDP6_INC_STATS(field) SNMP_INC_STATS(udp_stats_in6, field) 161DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
147#define UDP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_stats_in6, field) 162#define UDP6_INC_STATS_BH(field, is_udplite) do { \
148#define UDP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_stats_in6, field) 163 if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \
164 else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0)
165#define UDP6_INC_STATS_USER(field, is_udplite) do { \
166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \
167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0)
149 168
150int snmp6_register_dev(struct inet6_dev *idev); 169int snmp6_register_dev(struct inet6_dev *idev);
151int snmp6_unregister_dev(struct inet6_dev *idev); 170int snmp6_unregister_dev(struct inet6_dev *idev);
@@ -191,7 +210,7 @@ struct ipv6_txoptions
191struct ip6_flowlabel 210struct ip6_flowlabel
192{ 211{
193 struct ip6_flowlabel *next; 212 struct ip6_flowlabel *next;
194 u32 label; 213 __be32 label;
195 struct in6_addr dst; 214 struct in6_addr dst;
196 struct ipv6_txoptions *opt; 215 struct ipv6_txoptions *opt;
197 atomic_t users; 216 atomic_t users;
@@ -211,7 +230,7 @@ struct ipv6_fl_socklist
211 struct ip6_flowlabel *fl; 230 struct ip6_flowlabel *fl;
212}; 231};
213 232
214extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, u32 label); 233extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
215extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 234extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
216 struct ip6_flowlabel * fl, 235 struct ip6_flowlabel * fl,
217 struct ipv6_txoptions * fopt); 236 struct ipv6_txoptions * fopt);
@@ -375,22 +394,15 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
375 */ 394 */
376static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) 395static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen)
377{ 396{
378 const __u32 *a1 = token1, *a2 = token2; 397 const __be32 *a1 = token1, *a2 = token2;
379 int i; 398 int i;
380 399
381 addrlen >>= 2; 400 addrlen >>= 2;
382 401
383 for (i = 0; i < addrlen; i++) { 402 for (i = 0; i < addrlen; i++) {
384 __u32 xb = a1[i] ^ a2[i]; 403 __be32 xb = a1[i] ^ a2[i];
385 if (xb) { 404 if (xb)
386 int j = 31; 405 return i * 32 + 32 - fls(ntohl(xb));
387
388 xb = ntohl(xb);
389 while ((xb & (1 << j)) == 0)
390 j--;
391
392 return (i * 32 + 31 - j);
393 }
394 } 406 }
395 407
396 /* 408 /*
@@ -544,7 +556,7 @@ extern int ip6_datagram_connect(struct sock *sk,
544 struct sockaddr *addr, int addr_len); 556 struct sockaddr *addr, int addr_len);
545 557
546extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 558extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
547extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 port, 559extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
548 u32 info, u8 *payload); 560 u32 info, u8 *payload);
549extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 561extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
550 562
@@ -589,6 +601,8 @@ extern int tcp6_proc_init(void);
589extern void tcp6_proc_exit(void); 601extern void tcp6_proc_exit(void);
590extern int udp6_proc_init(void); 602extern int udp6_proc_init(void);
591extern void udp6_proc_exit(void); 603extern void udp6_proc_exit(void);
604extern int udplite6_proc_init(void);
605extern void udplite6_proc_exit(void);
592extern int ipv6_misc_proc_init(void); 606extern int ipv6_misc_proc_init(void);
593extern void ipv6_misc_proc_exit(void); 607extern void ipv6_misc_proc_exit(void);
594 608
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 9dd54a5002b2..641f88e848bd 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -91,8 +91,8 @@ struct xid_frame {
91 __u8 caddr; /* Connection address */ 91 __u8 caddr; /* Connection address */
92 __u8 control; 92 __u8 control;
93 __u8 ident; /* Should always be XID_FORMAT */ 93 __u8 ident; /* Should always be XID_FORMAT */
94 __u32 saddr; /* Source device address */ 94 __le32 saddr; /* Source device address */
95 __u32 daddr; /* Destination device address */ 95 __le32 daddr; /* Destination device address */
96 __u8 flags; /* Discovery flags */ 96 __u8 flags; /* Discovery flags */
97 __u8 slotnr; 97 __u8 slotnr;
98 __u8 version; 98 __u8 version;
@@ -101,15 +101,15 @@ struct xid_frame {
101struct test_frame { 101struct test_frame {
102 __u8 caddr; /* Connection address */ 102 __u8 caddr; /* Connection address */
103 __u8 control; 103 __u8 control;
104 __u32 saddr; /* Source device address */ 104 __le32 saddr; /* Source device address */
105 __u32 daddr; /* Destination device address */ 105 __le32 daddr; /* Destination device address */
106} IRDA_PACK; 106} IRDA_PACK;
107 107
108struct ua_frame { 108struct ua_frame {
109 __u8 caddr; 109 __u8 caddr;
110 __u8 control; 110 __u8 control;
111 __u32 saddr; /* Source device address */ 111 __le32 saddr; /* Source device address */
112 __u32 daddr; /* Dest device address */ 112 __le32 daddr; /* Dest device address */
113} IRDA_PACK; 113} IRDA_PACK;
114 114
115struct dm_frame { 115struct dm_frame {
@@ -135,8 +135,8 @@ struct i_frame {
135struct snrm_frame { 135struct snrm_frame {
136 __u8 caddr; 136 __u8 caddr;
137 __u8 control; 137 __u8 control;
138 __u32 saddr; 138 __le32 saddr;
139 __u32 daddr; 139 __le32 daddr;
140 __u8 ncaddr; 140 __u8 ncaddr;
141} IRDA_PACK; 141} IRDA_PACK;
142 142
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 8f6306581fa7..aa33a477c3fb 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -252,9 +252,9 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
252 */ 252 */
253static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa) 253static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
254{ 254{
255 if (skb->protocol == ntohs(ETH_P_802_2)) 255 if (skb->protocol == htons(ETH_P_802_2))
256 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 256 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
257 else if (skb->protocol == ntohs(ETH_P_TR_802_2)) { 257 else if (skb->protocol == htons(ETH_P_TR_802_2)) {
258 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN); 258 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
259 *sa &= 0x7F; 259 *sa &= 0x7F;
260 } 260 }
@@ -269,9 +269,9 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
269 */ 269 */
270static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da) 270static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
271{ 271{
272 if (skb->protocol == ntohs(ETH_P_802_2)) 272 if (skb->protocol == htons(ETH_P_802_2))
273 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 273 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
274 else if (skb->protocol == ntohs(ETH_P_TR_802_2)) 274 else if (skb->protocol == htons(ETH_P_TR_802_2))
275 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN); 275 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
276} 276}
277 277
@@ -345,7 +345,7 @@ static inline void llc_pdu_init_as_test_rsp(struct sk_buff *skb,
345 pdu->ctrl_1 = LLC_PDU_TYPE_U; 345 pdu->ctrl_1 = LLC_PDU_TYPE_U;
346 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; 346 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
347 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; 347 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK;
348 if (ev_skb->protocol == ntohs(ETH_P_802_2)) { 348 if (ev_skb->protocol == htons(ETH_P_802_2)) {
349 struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb); 349 struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb);
350 int dsize; 350 int dsize;
351 351
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index d3915dabe6de..475b10c575b3 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -66,8 +66,8 @@ struct rs_msg {
66 66
67struct ra_msg { 67struct ra_msg {
68 struct icmp6hdr icmph; 68 struct icmp6hdr icmph;
69 __u32 reachable_time; 69 __be32 reachable_time;
70 __u32 retrans_timer; 70 __be32 retrans_timer;
71}; 71};
72 72
73struct nd_opt_hdr { 73struct nd_opt_hdr {
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 91684436af8e..1401ccc051c4 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -9,32 +9,35 @@
9#ifndef _NF_CONNTRACK_IPV4_H 9#ifndef _NF_CONNTRACK_IPV4_H
10#define _NF_CONNTRACK_IPV4_H 10#define _NF_CONNTRACK_IPV4_H
11 11
12#ifdef CONFIG_IP_NF_NAT_NEEDED 12#ifdef CONFIG_NF_NAT_NEEDED
13#include <linux/netfilter_ipv4/ip_nat.h> 13#include <net/netfilter/nf_nat.h>
14#include <linux/netfilter/nf_conntrack_pptp.h>
14 15
15/* per conntrack: nat application helper private data */ 16/* per conntrack: nat application helper private data */
16union ip_conntrack_nat_help { 17union nf_conntrack_nat_help {
17 /* insert nat helper private data here */ 18 /* insert nat helper private data here */
19 struct nf_nat_pptp nat_pptp_info;
18}; 20};
19 21
20struct nf_conntrack_ipv4_nat { 22struct nf_conn_nat {
21 struct ip_nat_info info; 23 struct nf_nat_info info;
22 union ip_conntrack_nat_help help; 24 union nf_conntrack_nat_help help;
23#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 25#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
24 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) 26 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
25 int masq_index; 27 int masq_index;
26#endif 28#endif
27}; 29};
28#endif /* CONFIG_IP_NF_NAT_NEEDED */ 30#endif /* CONFIG_NF_NAT_NEEDED */
29
30struct nf_conntrack_ipv4 {
31#ifdef CONFIG_IP_NF_NAT_NEEDED
32 struct nf_conntrack_ipv4_nat *nat;
33#endif
34};
35 31
36/* Returns new sk_buff, or NULL */ 32/* Returns new sk_buff, or NULL */
37struct sk_buff * 33struct sk_buff *
38nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); 34nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb);
39 35
36extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
37extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
38extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
39
40extern int nf_conntrack_ipv4_compat_init(void);
41extern void nf_conntrack_ipv4_compat_fini(void);
42
40#endif /*_NF_CONNTRACK_IPV4_H*/ 43#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
new file mode 100644
index 000000000000..b4b6049e01fa
--- /dev/null
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -0,0 +1,25 @@
1#ifndef _NF_CONNTRACK_IPV6_H
2#define _NF_CONNTRACK_IPV6_H
3
4extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
5
6extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9
10extern int nf_ct_ipv6_skip_exthdr(struct sk_buff *skb, int start,
11 u8 *nexthdrp, int len);
12
13extern int nf_ct_frag6_init(void);
14extern void nf_ct_frag6_cleanup(void);
15extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
16extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
17 struct net_device *in,
18 struct net_device *out,
19 int (*okfn)(struct sk_buff *));
20
21extern unsigned int nf_ct_frag6_timeout;
22extern unsigned int nf_ct_frag6_low_thresh;
23extern unsigned int nf_ct_frag6_high_thresh;
24
25#endif /* _NF_CONNTRACK_IPV6_H*/
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 1fbd8193d5f1..032b36a0e378 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/netfilter/nf_conntrack_tcp.h> 22#include <linux/netfilter/nf_conntrack_tcp.h>
23#include <linux/netfilter/nf_conntrack_sctp.h> 23#include <linux/netfilter/nf_conntrack_sctp.h>
24#include <linux/netfilter/nf_conntrack_proto_gre.h>
24#include <net/netfilter/ipv4/nf_conntrack_icmp.h> 25#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
25#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> 26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
26 27
@@ -33,6 +34,7 @@ union nf_conntrack_proto {
33 struct ip_ct_tcp tcp; 34 struct ip_ct_tcp tcp;
34 struct ip_ct_icmp icmp; 35 struct ip_ct_icmp icmp;
35 struct nf_ct_icmpv6 icmpv6; 36 struct nf_ct_icmpv6 icmpv6;
37 struct nf_ct_gre gre;
36}; 38};
37 39
38union nf_conntrack_expect_proto { 40union nf_conntrack_expect_proto {
@@ -41,11 +43,15 @@ union nf_conntrack_expect_proto {
41 43
42/* Add protocol helper include file here */ 44/* Add protocol helper include file here */
43#include <linux/netfilter/nf_conntrack_ftp.h> 45#include <linux/netfilter/nf_conntrack_ftp.h>
46#include <linux/netfilter/nf_conntrack_pptp.h>
47#include <linux/netfilter/nf_conntrack_h323.h>
44 48
45/* per conntrack: application helper private data */ 49/* per conntrack: application helper private data */
46union nf_conntrack_help { 50union nf_conntrack_help {
47 /* insert conntrack helper private data (master) here */ 51 /* insert conntrack helper private data (master) here */
48 struct ip_ct_ftp_master ct_ftp_info; 52 struct nf_ct_ftp_master ct_ftp_info;
53 struct nf_ct_pptp_master ct_pptp_info;
54 struct nf_ct_h323_master ct_h323_info;
49}; 55};
50 56
51#include <linux/types.h> 57#include <linux/types.h>
@@ -79,6 +85,8 @@ struct nf_conn_help {
79 85
80 86
81#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 87#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
88#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
89
82struct nf_conn 90struct nf_conn
83{ 91{
84 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 92 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
@@ -124,44 +132,6 @@ struct nf_conn
124 char data[0]; 132 char data[0];
125}; 133};
126 134
127struct nf_conntrack_expect
128{
129 /* Internal linked list (global expectation list) */
130 struct list_head list;
131
132 /* We expect this tuple, with the following mask */
133 struct nf_conntrack_tuple tuple, mask;
134
135 /* Function to call after setup and insertion */
136 void (*expectfn)(struct nf_conn *new,
137 struct nf_conntrack_expect *this);
138
139 /* The conntrack of the master connection */
140 struct nf_conn *master;
141
142 /* Timer function; deletes the expectation. */
143 struct timer_list timeout;
144
145 /* Usage count. */
146 atomic_t use;
147
148 /* Unique ID */
149 unsigned int id;
150
151 /* Flags */
152 unsigned int flags;
153
154#ifdef CONFIG_NF_NAT_NEEDED
155 /* This is the original per-proto part, used to map the
156 * expected connection the way the recipient expects. */
157 union nf_conntrack_manip_proto saved_proto;
158 /* Direction relative to the master connection. */
159 enum ip_conntrack_dir dir;
160#endif
161};
162
163#define NF_CT_EXPECT_PERMANENT 0x1
164
165static inline struct nf_conn * 135static inline struct nf_conn *
166nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash) 136nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
167{ 137{
@@ -208,16 +178,6 @@ __nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
208 178
209extern void nf_conntrack_hash_insert(struct nf_conn *ct); 179extern void nf_conntrack_hash_insert(struct nf_conn *ct);
210 180
211extern struct nf_conntrack_expect *
212__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
213
214extern struct nf_conntrack_expect *
215nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
216
217extern void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
218
219extern void nf_ct_remove_expectations(struct nf_conn *ct);
220
221extern void nf_conntrack_flush(void); 181extern void nf_conntrack_flush(void);
222 182
223extern struct nf_conntrack_helper * 183extern struct nf_conntrack_helper *
@@ -289,89 +249,12 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
289 249
290extern unsigned int nf_conntrack_htable_size; 250extern unsigned int nf_conntrack_htable_size;
291extern int nf_conntrack_checksum; 251extern int nf_conntrack_checksum;
252extern atomic_t nf_conntrack_count;
253extern int nf_conntrack_max;
292 254
255DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
293#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 256#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
294 257
295#ifdef CONFIG_NF_CONNTRACK_EVENTS
296#include <linux/notifier.h>
297#include <linux/interrupt.h>
298
299struct nf_conntrack_ecache {
300 struct nf_conn *ct;
301 unsigned int events;
302};
303DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
304
305#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
306
307extern struct atomic_notifier_head nf_conntrack_chain;
308extern struct atomic_notifier_head nf_conntrack_expect_chain;
309
310static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
311{
312 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
313}
314
315static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
316{
317 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
318}
319
320static inline int
321nf_conntrack_expect_register_notifier(struct notifier_block *nb)
322{
323 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
324}
325
326static inline int
327nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
328{
329 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
330 nb);
331}
332
333extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
334extern void __nf_ct_event_cache_init(struct nf_conn *ct);
335
336static inline void
337nf_conntrack_event_cache(enum ip_conntrack_events event,
338 const struct sk_buff *skb)
339{
340 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
341 struct nf_conntrack_ecache *ecache;
342
343 local_bh_disable();
344 ecache = &__get_cpu_var(nf_conntrack_ecache);
345 if (ct != ecache->ct)
346 __nf_ct_event_cache_init(ct);
347 ecache->events |= event;
348 local_bh_enable();
349}
350
351static inline void nf_conntrack_event(enum ip_conntrack_events event,
352 struct nf_conn *ct)
353{
354 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
355 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
356}
357
358static inline void
359nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
360 struct nf_conntrack_expect *exp)
361{
362 atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
363}
364#else /* CONFIG_NF_CONNTRACK_EVENTS */
365static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
366 const struct sk_buff *skb) {}
367static inline void nf_conntrack_event(enum ip_conntrack_events event,
368 struct nf_conn *ct) {}
369static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
370static inline void
371nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
372 struct nf_conntrack_expect *exp) {}
373#endif /* CONFIG_NF_CONNTRACK_EVENTS */
374
375/* no helper, no nat */ 258/* no helper, no nat */
376#define NF_CT_F_BASIC 0 259#define NF_CT_F_BASIC 0
377/* for helper */ 260/* for helper */
@@ -387,17 +270,45 @@ nf_conntrack_unregister_cache(u_int32_t features);
387 270
388/* valid combinations: 271/* valid combinations:
389 * basic: nf_conn, nf_conn .. nf_conn_help 272 * basic: nf_conn, nf_conn .. nf_conn_help
390 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help 273 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat .. nf_conn help
391 */ 274 */
275#ifdef CONFIG_NF_NAT_NEEDED
276static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
277{
278 unsigned int offset = sizeof(struct nf_conn);
279
280 if (!(ct->features & NF_CT_F_NAT))
281 return NULL;
282
283 offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
284 return (struct nf_conn_nat *) ((void *)ct + offset);
285}
286
392static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 287static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
393{ 288{
394 unsigned int offset = sizeof(struct nf_conn); 289 unsigned int offset = sizeof(struct nf_conn);
395 290
396 if (!(ct->features & NF_CT_F_HELP)) 291 if (!(ct->features & NF_CT_F_HELP))
397 return NULL; 292 return NULL;
293 if (ct->features & NF_CT_F_NAT) {
294 offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
295 offset += sizeof(struct nf_conn_nat);
296 }
398 297
298 offset = ALIGN(offset, __alignof__(struct nf_conn_help));
399 return (struct nf_conn_help *) ((void *)ct + offset); 299 return (struct nf_conn_help *) ((void *)ct + offset);
400} 300}
301#else /* No NAT */
302static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
303{
304 unsigned int offset = sizeof(struct nf_conn);
305
306 if (!(ct->features & NF_CT_F_HELP))
307 return NULL;
401 308
309 offset = ALIGN(offset, __alignof__(struct nf_conn_help));
310 return (struct nf_conn_help *) ((void *)ct + offset);
311}
312#endif /* CONFIG_NF_NAT_NEEDED */
402#endif /* __KERNEL__ */ 313#endif /* __KERNEL__ */
403#endif /* _NF_CONNTRACK_H */ 314#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index da254525a4ce..7fdc72c01356 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -13,6 +13,9 @@
13#define _NF_CONNTRACK_CORE_H 13#define _NF_CONNTRACK_CORE_H
14 14
15#include <linux/netfilter.h> 15#include <linux/netfilter.h>
16#include <net/netfilter/nf_conntrack_l3proto.h>
17#include <net/netfilter/nf_conntrack_l4proto.h>
18#include <net/netfilter/nf_conntrack_ecache.h>
16 19
17/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
18 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
@@ -29,7 +32,7 @@ extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
29/* Like above, but you already have conntrack read lock. */ 32/* Like above, but you already have conntrack read lock. */
30extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); 33extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
31 34
32struct nf_conntrack_protocol; 35struct nf_conntrack_l4proto;
33 36
34extern int 37extern int
35nf_ct_get_tuple(const struct sk_buff *skb, 38nf_ct_get_tuple(const struct sk_buff *skb,
@@ -39,13 +42,13 @@ nf_ct_get_tuple(const struct sk_buff *skb,
39 u_int8_t protonum, 42 u_int8_t protonum,
40 struct nf_conntrack_tuple *tuple, 43 struct nf_conntrack_tuple *tuple,
41 const struct nf_conntrack_l3proto *l3proto, 44 const struct nf_conntrack_l3proto *l3proto,
42 const struct nf_conntrack_protocol *protocol); 45 const struct nf_conntrack_l4proto *l4proto);
43 46
44extern int 47extern int
45nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, 48nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
46 const struct nf_conntrack_tuple *orig, 49 const struct nf_conntrack_tuple *orig,
47 const struct nf_conntrack_l3proto *l3proto, 50 const struct nf_conntrack_l3proto *l3proto,
48 const struct nf_conntrack_protocol *protocol); 51 const struct nf_conntrack_l4proto *l4proto);
49 52
50/* Find a connection corresponding to a tuple. */ 53/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash * 54extern struct nf_conntrack_tuple_hash *
@@ -70,7 +73,14 @@ static inline int nf_conntrack_confirm(struct sk_buff **pskb)
70 73
71extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); 74extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
72 75
76int
77print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
78 struct nf_conntrack_l3proto *l3proto,
79 struct nf_conntrack_l4proto *proto);
80
73extern struct list_head *nf_conntrack_hash; 81extern struct list_head *nf_conntrack_hash;
74extern struct list_head nf_conntrack_expect_list; 82extern struct list_head nf_conntrack_expect_list;
75extern rwlock_t nf_conntrack_lock ; 83extern rwlock_t nf_conntrack_lock ;
84extern struct list_head unconfirmed;
85
76#endif /* _NF_CONNTRACK_CORE_H */ 86#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
new file mode 100644
index 000000000000..b62a8a9ec9d8
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -0,0 +1,95 @@
1/*
2 * connection tracking event cache.
3 */
4
5#ifndef _NF_CONNTRACK_ECACHE_H
6#define _NF_CONNTRACK_ECACHE_H
7#include <net/netfilter/nf_conntrack.h>
8
9#include <linux/notifier.h>
10#include <linux/interrupt.h>
11#include <net/netfilter/nf_conntrack_expect.h>
12
13#ifdef CONFIG_NF_CONNTRACK_EVENTS
14struct nf_conntrack_ecache {
15 struct nf_conn *ct;
16 unsigned int events;
17};
18DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
19
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21
22extern struct atomic_notifier_head nf_conntrack_chain;
23extern struct atomic_notifier_head nf_conntrack_expect_chain;
24
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
48extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
49extern void __nf_ct_event_cache_init(struct nf_conn *ct);
50extern void nf_ct_event_cache_flush(void);
51
52static inline void
53nf_conntrack_event_cache(enum ip_conntrack_events event,
54 const struct sk_buff *skb)
55{
56 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
57 struct nf_conntrack_ecache *ecache;
58
59 local_bh_disable();
60 ecache = &__get_cpu_var(nf_conntrack_ecache);
61 if (ct != ecache->ct)
62 __nf_ct_event_cache_init(ct);
63 ecache->events |= event;
64 local_bh_enable();
65}
66
67static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct)
69{
70 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
71 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
72}
73
74static inline void
75nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
76 struct nf_conntrack_expect *exp)
77{
78 atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
79}
80
81#else /* CONFIG_NF_CONNTRACK_EVENTS */
82
83static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
84 const struct sk_buff *skb) {}
85static inline void nf_conntrack_event(enum ip_conntrack_events event,
86 struct nf_conn *ct) {}
87static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
88static inline void
89nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
90 struct nf_conntrack_expect *exp) {}
91static inline void nf_ct_event_cache_flush(void) {}
92#endif /* CONFIG_NF_CONNTRACK_EVENTS */
93
94#endif /*_NF_CONNTRACK_ECACHE_H*/
95
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
new file mode 100644
index 000000000000..cef3136e22a3
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -0,0 +1,80 @@
1/*
2 * connection tracking expectations.
3 */
4
5#ifndef _NF_CONNTRACK_EXPECT_H
6#define _NF_CONNTRACK_EXPECT_H
7#include <net/netfilter/nf_conntrack.h>
8
9extern struct list_head nf_conntrack_expect_list;
10extern kmem_cache_t *nf_conntrack_expect_cachep;
11extern struct file_operations exp_file_ops;
12
13struct nf_conntrack_expect
14{
15 /* Internal linked list (global expectation list) */
16 struct list_head list;
17
18 /* We expect this tuple, with the following mask */
19 struct nf_conntrack_tuple tuple, mask;
20
21 /* Function to call after setup and insertion */
22 void (*expectfn)(struct nf_conn *new,
23 struct nf_conntrack_expect *this);
24
25 /* Helper to assign to new connection */
26 struct nf_conntrack_helper *helper;
27
28 /* The conntrack of the master connection */
29 struct nf_conn *master;
30
31 /* Timer function; deletes the expectation. */
32 struct timer_list timeout;
33
34 /* Usage count. */
35 atomic_t use;
36
37 /* Unique ID */
38 unsigned int id;
39
40 /* Flags */
41 unsigned int flags;
42
43#ifdef CONFIG_NF_NAT_NEEDED
44 __be32 saved_ip;
45 /* This is the original per-proto part, used to map the
46 * expected connection the way the recipient expects. */
47 union nf_conntrack_man_proto saved_proto;
48 /* Direction relative to the master connection. */
49 enum ip_conntrack_dir dir;
50#endif
51};
52
53#define NF_CT_EXPECT_PERMANENT 0x1
54
55
56struct nf_conntrack_expect *
57__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
58
59struct nf_conntrack_expect *
60nf_conntrack_expect_find_get(const struct nf_conntrack_tuple *tuple);
61
62struct nf_conntrack_expect *
63find_expectation(const struct nf_conntrack_tuple *tuple);
64
65void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
66void nf_ct_remove_expectations(struct nf_conn *ct);
67void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
68
69/* Allocate space for an expectation: this is mandatory before calling
70 nf_conntrack_expect_related. You will have to call put afterwards. */
71struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me);
72void nf_conntrack_expect_init(struct nf_conntrack_expect *, int,
73 union nf_conntrack_address *,
74 union nf_conntrack_address *,
75 u_int8_t, __be16 *, __be16 *);
76void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
77int nf_conntrack_expect_related(struct nf_conntrack_expect *expect);
78
79#endif /*_NF_CONNTRACK_EXPECT_H*/
80
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 86ec8174ad02..8c72ac9f0ab8 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -34,20 +34,22 @@ struct nf_conntrack_helper
34 struct nf_conn *ct, 34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo); 35 enum ip_conntrack_info conntrackinfo);
36 36
37 void (*destroy)(struct nf_conn *ct);
38
37 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct); 39 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct);
38}; 40};
39 41
40extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 42extern struct nf_conntrack_helper *
41extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
42 44
43/* Allocate space for an expectation: this is mandatory before calling 45extern struct nf_conntrack_helper *
44 nf_conntrack_expect_related. You will have to call put afterwards. */ 46nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
45extern struct nf_conntrack_expect *
46nf_conntrack_expect_alloc(struct nf_conn *master);
47extern void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
48 47
49/* Add an expected connection: can have more than one per connection */ 48extern struct nf_conntrack_helper *
50extern int nf_conntrack_expect_related(struct nf_conntrack_expect *exp); 49__nf_conntrack_helper_find_byname(const char *name);
51extern void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp); 50
51extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
52extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
53extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
52 54
53#endif /*_NF_CONNTRACK_HELPER_H*/ 55#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index dac43b15a5b0..664ddcffe00d 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -18,9 +18,6 @@ struct nfattr;
18 18
19struct nf_conntrack_l3proto 19struct nf_conntrack_l3proto
20{ 20{
21 /* Next pointer. */
22 struct list_head list;
23
24 /* L3 Protocol Family number. ex) PF_INET */ 21 /* L3 Protocol Family number. ex) PF_INET */
25 u_int16_t l3proto; 22 u_int16_t l3proto;
26 23
@@ -78,6 +75,12 @@ struct nf_conntrack_l3proto
78 int (*nfattr_to_tuple)(struct nfattr *tb[], 75 int (*nfattr_to_tuple)(struct nfattr *tb[],
79 struct nf_conntrack_tuple *t); 76 struct nf_conntrack_tuple *t);
80 77
78#ifdef CONFIG_SYSCTL
79 struct ctl_table_header *ctl_table_header;
80 struct ctl_table *ctl_table_path;
81 struct ctl_table *ctl_table;
82#endif /* CONFIG_SYSCTL */
83
81 /* Module (if any) which this is connected to. */ 84 /* Module (if any) which this is connected to. */
82 struct module *me; 85 struct module *me;
83}; 86};
@@ -86,7 +89,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
86 89
87/* Protocol registration. */ 90/* Protocol registration. */
88extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
89extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 92extern int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
90 93
91extern struct nf_conntrack_l3proto * 94extern struct nf_conntrack_l3proto *
92nf_ct_l3proto_find_get(u_int16_t l3proto); 95nf_ct_l3proto_find_get(u_int16_t l3proto);
@@ -96,13 +99,13 @@ extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
96/* Existing built-in protocols */ 99/* Existing built-in protocols */
97extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; 100extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
98extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; 101extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
99extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; 102extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
100 103
101static inline struct nf_conntrack_l3proto * 104static inline struct nf_conntrack_l3proto *
102__nf_ct_l3proto_find(u_int16_t l3proto) 105__nf_ct_l3proto_find(u_int16_t l3proto)
103{ 106{
104 if (unlikely(l3proto >= AF_MAX)) 107 if (unlikely(l3proto >= AF_MAX))
105 return &nf_conntrack_generic_l3proto; 108 return &nf_conntrack_l3proto_generic;
106 return nf_ct_l3protos[l3proto]; 109 return nf_ct_l3protos[l3proto];
107} 110}
108 111
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 1f33737fcea5..fc8af08ff542 100644
--- a/include/net/netfilter/nf_conntrack_protocol.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Header for use in defining a given protocol for connection tracking. 2 * Header for use in defining a given L4 protocol for connection tracking.
3 * 3 *
4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> 4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - generalized L3 protocol dependent part. 5 * - generalized L3 protocol dependent part.
@@ -7,23 +7,20 @@
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h 7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h
8 */ 8 */
9 9
10#ifndef _NF_CONNTRACK_PROTOCOL_H 10#ifndef _NF_CONNTRACK_L4PROTO_H
11#define _NF_CONNTRACK_PROTOCOL_H 11#define _NF_CONNTRACK_L4PROTO_H
12#include <net/netfilter/nf_conntrack.h> 12#include <net/netfilter/nf_conntrack.h>
13 13
14struct seq_file; 14struct seq_file;
15struct nfattr; 15struct nfattr;
16 16
17struct nf_conntrack_protocol 17struct nf_conntrack_l4proto
18{ 18{
19 /* Next pointer. */
20 struct list_head list;
21
22 /* L3 Protocol number. */ 19 /* L3 Protocol number. */
23 u_int16_t l3proto; 20 u_int16_t l3proto;
24 21
25 /* Protocol number. */ 22 /* L4 Protocol number. */
26 u_int8_t proto; 23 u_int8_t l4proto;
27 24
28 /* Protocol name */ 25 /* Protocol name */
29 const char *name; 26 const char *name;
@@ -79,30 +76,40 @@ struct nf_conntrack_protocol
79 int (*nfattr_to_tuple)(struct nfattr *tb[], 76 int (*nfattr_to_tuple)(struct nfattr *tb[],
80 struct nf_conntrack_tuple *t); 77 struct nf_conntrack_tuple *t);
81 78
79#ifdef CONFIG_SYSCTL
80 struct ctl_table_header **ctl_table_header;
81 struct ctl_table *ctl_table;
82 unsigned int *ctl_table_users;
83#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
84 struct ctl_table_header *ctl_compat_table_header;
85 struct ctl_table *ctl_compat_table;
86#endif
87#endif
88
82 /* Module (if any) which this is connected to. */ 89 /* Module (if any) which this is connected to. */
83 struct module *me; 90 struct module *me;
84}; 91};
85 92
86/* Existing built-in protocols */ 93/* Existing built-in protocols */
87extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6; 94extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
88extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4; 95extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
89extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6; 96extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
90extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; 97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
91 98
92#define MAX_NF_CT_PROTO 256 99#define MAX_NF_CT_PROTO 256
93extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; 100extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
94 101
95extern struct nf_conntrack_protocol * 102extern struct nf_conntrack_l4proto *
96__nf_ct_proto_find(u_int16_t l3proto, u_int8_t protocol); 103__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
97 104
98extern struct nf_conntrack_protocol * 105extern struct nf_conntrack_l4proto *
99nf_ct_proto_find_get(u_int16_t l3proto, u_int8_t protocol); 106nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
100 107
101extern void nf_ct_proto_put(struct nf_conntrack_protocol *p); 108extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
102 109
103/* Protocol registration. */ 110/* Protocol registration. */
104extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); 111extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
105extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); 112extern int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
106 113
107/* Generic netlink helpers */ 114/* Generic netlink helpers */
108extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, 115extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 530ef1f75283..5d72b16e876f 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -24,10 +24,10 @@
24 24
25/* The l3 protocol-specific manipulable parts of the tuple: always in 25/* The l3 protocol-specific manipulable parts of the tuple: always in
26 network order! */ 26 network order! */
27union nf_conntrack_man_l3proto { 27union nf_conntrack_address {
28 u_int32_t all[NF_CT_TUPLE_L3SIZE]; 28 u_int32_t all[NF_CT_TUPLE_L3SIZE];
29 u_int32_t ip; 29 __be32 ip;
30 u_int32_t ip6[4]; 30 __be32 ip6[4];
31}; 31};
32 32
33/* The protocol-specific manipulable parts of the tuple: always in 33/* The protocol-specific manipulable parts of the tuple: always in
@@ -38,23 +38,26 @@ union nf_conntrack_man_proto
38 u_int16_t all; 38 u_int16_t all;
39 39
40 struct { 40 struct {
41 u_int16_t port; 41 __be16 port;
42 } tcp; 42 } tcp;
43 struct { 43 struct {
44 u_int16_t port; 44 __be16 port;
45 } udp; 45 } udp;
46 struct { 46 struct {
47 u_int16_t id; 47 __be16 id;
48 } icmp; 48 } icmp;
49 struct { 49 struct {
50 u_int16_t port; 50 __be16 port;
51 } sctp; 51 } sctp;
52 struct {
53 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
54 } gre;
52}; 55};
53 56
54/* The manipulable part of the tuple. */ 57/* The manipulable part of the tuple. */
55struct nf_conntrack_man 58struct nf_conntrack_man
56{ 59{
57 union nf_conntrack_man_l3proto u3; 60 union nf_conntrack_address u3;
58 union nf_conntrack_man_proto u; 61 union nf_conntrack_man_proto u;
59 /* Layer 3 protocol */ 62 /* Layer 3 protocol */
60 u_int16_t l3num; 63 u_int16_t l3num;
@@ -67,27 +70,26 @@ struct nf_conntrack_tuple
67 70
68 /* These are the parts of the tuple which are fixed. */ 71 /* These are the parts of the tuple which are fixed. */
69 struct { 72 struct {
70 union { 73 union nf_conntrack_address u3;
71 u_int32_t all[NF_CT_TUPLE_L3SIZE];
72 u_int32_t ip;
73 u_int32_t ip6[4];
74 } u3;
75 union { 74 union {
76 /* Add other protocols here. */ 75 /* Add other protocols here. */
77 u_int16_t all; 76 u_int16_t all;
78 77
79 struct { 78 struct {
80 u_int16_t port; 79 __be16 port;
81 } tcp; 80 } tcp;
82 struct { 81 struct {
83 u_int16_t port; 82 __be16 port;
84 } udp; 83 } udp;
85 struct { 84 struct {
86 u_int8_t type, code; 85 u_int8_t type, code;
87 } icmp; 86 } icmp;
88 struct { 87 struct {
89 u_int16_t port; 88 __be16 port;
90 } sctp; 89 } sctp;
90 struct {
91 __be16 key;
92 } gre;
91 } u; 93 } u;
92 94
93 /* The protocol. */ 95 /* The protocol. */
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
new file mode 100644
index 000000000000..61c62068ca6b
--- /dev/null
+++ b/include/net/netfilter/nf_nat.h
@@ -0,0 +1,77 @@
1#ifndef _NF_NAT_H
2#define _NF_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <net/netfilter/nf_conntrack_tuple.h>
5
6#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum nf_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
20/* NAT sequence number modifications */
21struct nf_nat_seq {
22 /* position of the last TCP sequence number modification (if any) */
23 u_int32_t correction_pos;
24
25 /* sequence number offset before and after last modification */
26 int16_t offset_before, offset_after;
27};
28
29/* Single range specification. */
30struct nf_nat_range
31{
32 /* Set to OR of flags above. */
33 unsigned int flags;
34
35 /* Inclusive: network order. */
36 __be32 min_ip, max_ip;
37
38 /* Inclusive: network order */
39 union nf_conntrack_man_proto min, max;
40};
41
42/* For backwards compat: don't use in modern code. */
43struct nf_nat_multi_range_compat
44{
45 unsigned int rangesize; /* Must be 1. */
46
47 /* hangs off end. */
48 struct nf_nat_range range[1];
49};
50
51#ifdef __KERNEL__
52#include <linux/list.h>
53
54/* The structure embedded in the conntrack structure. */
55struct nf_nat_info
56{
57 struct list_head bysource;
58 struct nf_nat_seq seq[IP_CT_DIR_MAX];
59};
60
61struct nf_conn;
62
63/* Set up the info structure to map into this range. */
64extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
65 const struct nf_nat_range *range,
66 unsigned int hooknum);
67
68/* Is this tuple already taken? (not by us)*/
69extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
70 const struct nf_conn *ignored_conntrack);
71
72extern int nf_nat_module_is_loaded;
73
74#else /* !__KERNEL__: iptables wants this to compile. */
75#define nf_nat_multi_range nf_nat_multi_range_compat
76#endif /*__KERNEL__*/
77#endif
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
new file mode 100644
index 000000000000..9778ffa93440
--- /dev/null
+++ b/include/net/netfilter/nf_nat_core.h
@@ -0,0 +1,27 @@
1#ifndef _NF_NAT_CORE_H
2#define _NF_NAT_CORE_H
3#include <linux/list.h>
4#include <net/netfilter/nf_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 nf_nat_packet(struct nf_conn *ct,
10 enum ip_conntrack_info ctinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int nf_nat_icmp_reply_translation(struct nf_conn *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18
19static inline int nf_nat_initialized(struct nf_conn *ct,
20 enum nf_nat_manip_type manip)
21{
22 if (manip == IP_NAT_MANIP_SRC)
23 return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
24 else
25 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status);
26}
27#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
new file mode 100644
index 000000000000..ec98ecf95fc8
--- /dev/null
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -0,0 +1,32 @@
1#ifndef _NF_NAT_HELPER_H
2#define _NF_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <net/netfilter/nf_conntrack.h>
6
7struct sk_buff;
8
9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff **skb,
11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset,
14 unsigned int match_len,
15 const char *rep_buffer,
16 unsigned int rep_len);
17extern int nf_nat_mangle_udp_packet(struct sk_buff **skb,
18 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo,
20 unsigned int match_offset,
21 unsigned int match_len,
22 const char *rep_buffer,
23 unsigned int rep_len);
24extern int nf_nat_seq_adjust(struct sk_buff **pskb,
25 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo);
27
28/* Setup NAT on this expected conntrack so it follows master, but goes
29 * to port ct->master->saved_proto. */
30extern void nf_nat_follow_master(struct nf_conn *ct,
31 struct nf_conntrack_expect *this);
32#endif
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
new file mode 100644
index 000000000000..a9ec5ef61468
--- /dev/null
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -0,0 +1,70 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_PROTOCOL_H
3#define _NF_NAT_PROTOCOL_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_range;
8
9struct nf_nat_protocol
10{
11 /* Protocol name */
12 const char *name;
13
14 /* Protocol number. */
15 unsigned int protonum;
16
17 struct module *me;
18
19 /* Translate a packet to the target according to manip type.
20 Return true if succeeded. */
21 int (*manip_pkt)(struct sk_buff **pskb,
22 unsigned int iphdroff,
23 const struct nf_conntrack_tuple *tuple,
24 enum nf_nat_manip_type maniptype);
25
26 /* Is the manipable part of the tuple between min and max incl? */
27 int (*in_range)(const struct nf_conntrack_tuple *tuple,
28 enum nf_nat_manip_type maniptype,
29 const union nf_conntrack_man_proto *min,
30 const union nf_conntrack_man_proto *max);
31
32 /* Alter the per-proto part of the tuple (depending on
33 maniptype), to give a unique tuple in the given range if
34 possible; return false if not. Per-protocol part of tuple
35 is initialized to the incoming packet. */
36 int (*unique_tuple)(struct nf_conntrack_tuple *tuple,
37 const struct nf_nat_range *range,
38 enum nf_nat_manip_type maniptype,
39 const struct nf_conn *ct);
40
41 int (*range_to_nfattr)(struct sk_buff *skb,
42 const struct nf_nat_range *range);
43
44 int (*nfattr_to_range)(struct nfattr *tb[],
45 struct nf_nat_range *range);
46};
47
48/* Protocol registration. */
49extern int nf_nat_protocol_register(struct nf_nat_protocol *proto);
50extern void nf_nat_protocol_unregister(struct nf_nat_protocol *proto);
51
52extern struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol);
53extern void nf_nat_proto_put(struct nf_nat_protocol *proto);
54
55/* Built-in protocols. */
56extern struct nf_nat_protocol nf_nat_protocol_tcp;
57extern struct nf_nat_protocol nf_nat_protocol_udp;
58extern struct nf_nat_protocol nf_nat_protocol_icmp;
59extern struct nf_nat_protocol nf_nat_unknown_protocol;
60
61extern int init_protocols(void) __init;
62extern void cleanup_protocols(void);
63extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
64
65extern int nf_nat_port_range_to_nfattr(struct sk_buff *skb,
66 const struct nf_nat_range *range);
67extern int nf_nat_port_nfattr_to_range(struct nfattr *tb[],
68 struct nf_nat_range *range);
69
70#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
new file mode 100644
index 000000000000..f191c672bcc6
--- /dev/null
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -0,0 +1,35 @@
1#ifndef _NF_NAT_RULE_H
2#define _NF_NAT_RULE_H
3#include <net/netfilter/nf_conntrack.h>
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h>
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;
18extern void nf_nat_rule_cleanup(void);
19extern int nf_nat_rule_find(struct sk_buff **pskb,
20 unsigned int hooknum,
21 const struct net_device *in,
22 const struct net_device *out,
23 struct nf_conn *ct,
24 struct nf_nat_info *info);
25
26extern unsigned int
27alloc_null_binding(struct nf_conn *ct,
28 struct nf_nat_info *info,
29 unsigned int hooknum);
30
31extern unsigned int
32alloc_null_binding_confirmed(struct nf_conn *ct,
33 struct nf_nat_info *info,
34 unsigned int hooknum);
35#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 12c214b9eadf..83da7e1f0d3d 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -111,13 +111,34 @@ struct netlbl_lsm_cache {
111 void (*free) (const void *data); 111 void (*free) (const void *data);
112 void *data; 112 void *data;
113}; 113};
114/* The catmap bitmap field MUST be a power of two in length and large
115 * enough to hold at least 240 bits. Special care (i.e. check the code!)
116 * should be used when changing these values as the LSM implementation
117 * probably has functions which rely on the sizes of these types to speed
118 * processing. */
119#define NETLBL_CATMAP_MAPTYPE u64
120#define NETLBL_CATMAP_MAPCNT 4
121#define NETLBL_CATMAP_MAPSIZE (sizeof(NETLBL_CATMAP_MAPTYPE) * 8)
122#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
123 NETLBL_CATMAP_MAPCNT)
124#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01
125struct netlbl_lsm_secattr_catmap {
126 u32 startbit;
127 NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT];
128 struct netlbl_lsm_secattr_catmap *next;
129};
130#define NETLBL_SECATTR_NONE 0x00000000
131#define NETLBL_SECATTR_DOMAIN 0x00000001
132#define NETLBL_SECATTR_CACHE 0x00000002
133#define NETLBL_SECATTR_MLS_LVL 0x00000004
134#define NETLBL_SECATTR_MLS_CAT 0x00000008
114struct netlbl_lsm_secattr { 135struct netlbl_lsm_secattr {
136 u32 flags;
137
115 char *domain; 138 char *domain;
116 139
117 u32 mls_lvl; 140 u32 mls_lvl;
118 u32 mls_lvl_vld; 141 struct netlbl_lsm_secattr_catmap *mls_cat;
119 unsigned char *mls_cat;
120 size_t mls_cat_len;
121 142
122 struct netlbl_lsm_cache *cache; 143 struct netlbl_lsm_cache *cache;
123}; 144};
@@ -165,18 +186,54 @@ static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
165} 186}
166 187
167/** 188/**
189 * netlbl_secattr_catmap_alloc - Allocate a LSM secattr catmap
190 * @flags: memory allocation flags
191 *
192 * Description:
193 * Allocate memory for a LSM secattr catmap, returns a pointer on success, NULL
194 * on failure.
195 *
196 */
197static inline struct netlbl_lsm_secattr_catmap *netlbl_secattr_catmap_alloc(
198 gfp_t flags)
199{
200 return kzalloc(sizeof(struct netlbl_lsm_secattr_catmap), flags);
201}
202
203/**
204 * netlbl_secattr_catmap_free - Free a LSM secattr catmap
205 * @catmap: the category bitmap
206 *
207 * Description:
208 * Free a LSM secattr catmap.
209 *
210 */
211static inline void netlbl_secattr_catmap_free(
212 struct netlbl_lsm_secattr_catmap *catmap)
213{
214 struct netlbl_lsm_secattr_catmap *iter;
215
216 do {
217 iter = catmap;
218 catmap = catmap->next;
219 kfree(iter);
220 } while (catmap);
221}
222
223/**
168 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct 224 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
169 * @secattr: the struct to initialize 225 * @secattr: the struct to initialize
170 * 226 *
171 * Description: 227 * Description:
172 * Initialize an already allocated netlbl_lsm_secattr struct. Returns zero on 228 * Initialize an already allocated netlbl_lsm_secattr struct.
173 * success, negative values on error.
174 * 229 *
175 */ 230 */
176static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr) 231static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
177{ 232{
178 memset(secattr, 0, sizeof(*secattr)); 233 secattr->flags = 0;
179 return 0; 234 secattr->domain = NULL;
235 secattr->mls_cat = NULL;
236 secattr->cache = NULL;
180} 237}
181 238
182/** 239/**
@@ -193,7 +250,8 @@ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
193 if (secattr->cache) 250 if (secattr->cache)
194 netlbl_secattr_cache_free(secattr->cache); 251 netlbl_secattr_cache_free(secattr->cache);
195 kfree(secattr->domain); 252 kfree(secattr->domain);
196 kfree(secattr->mls_cat); 253 if (secattr->mls_cat)
254 netlbl_secattr_catmap_free(secattr->mls_cat);
197} 255}
198 256
199/** 257/**
@@ -205,7 +263,7 @@ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
205 * pointer on success, or NULL on failure. 263 * pointer on success, or NULL on failure.
206 * 264 *
207 */ 265 */
208static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags) 266static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(gfp_t flags)
209{ 267{
210 return kzalloc(sizeof(struct netlbl_lsm_secattr), flags); 268 return kzalloc(sizeof(struct netlbl_lsm_secattr), flags);
211} 269}
@@ -224,6 +282,51 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
224 kfree(secattr); 282 kfree(secattr);
225} 283}
226 284
285#ifdef CONFIG_NETLABEL
286int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap,
287 u32 offset);
288int netlbl_secattr_catmap_walk_rng(struct netlbl_lsm_secattr_catmap *catmap,
289 u32 offset);
290int netlbl_secattr_catmap_setbit(struct netlbl_lsm_secattr_catmap *catmap,
291 u32 bit,
292 gfp_t flags);
293int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
294 u32 start,
295 u32 end,
296 gfp_t flags);
297#else
298static inline int netlbl_secattr_catmap_walk(
299 struct netlbl_lsm_secattr_catmap *catmap,
300 u32 offset)
301{
302 return -ENOENT;
303}
304
305static inline int netlbl_secattr_catmap_walk_rng(
306 struct netlbl_lsm_secattr_catmap *catmap,
307 u32 offset)
308{
309 return -ENOENT;
310}
311
312static inline int netlbl_secattr_catmap_setbit(
313 struct netlbl_lsm_secattr_catmap *catmap,
314 u32 bit,
315 gfp_t flags)
316{
317 return 0;
318}
319
320static inline int netlbl_secattr_catmap_setrng(
321 struct netlbl_lsm_secattr_catmap *catmap,
322 u32 start,
323 u32 end,
324 gfp_t flags)
325{
326 return 0;
327}
328#endif
329
227/* 330/*
228 * LSM protocol operations 331 * LSM protocol operations
229 */ 332 */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index ce5cba19c393..fd75fd65d59e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -500,14 +500,15 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
500 500
501/** 501/**
502 * nlmsg_new - Allocate a new netlink message 502 * nlmsg_new - Allocate a new netlink message
503 * @size: maximum size of message 503 * @payload: size of the message payload
504 * @flags: the type of memory to allocate. 504 * @flags: the type of memory to allocate.
505 * 505 *
506 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. 506 * Use NLMSG_DEFAULT_SIZE if the size of the payload isn't known
507 * and a good default is needed.
507 */ 508 */
508static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) 509static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
509{ 510{
510 return alloc_skb(size, flags); 511 return alloc_skb(nlmsg_total_size(payload), flags);
511} 512}
512 513
513/** 514/**
@@ -828,6 +829,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828#define NLA_PUT_U16(skb, attrtype, value) \ 829#define NLA_PUT_U16(skb, attrtype, value) \
829 NLA_PUT_TYPE(skb, u16, attrtype, value) 830 NLA_PUT_TYPE(skb, u16, attrtype, value)
830 831
832#define NLA_PUT_LE16(skb, attrtype, value) \
833 NLA_PUT_TYPE(skb, __le16, attrtype, value)
834
831#define NLA_PUT_U32(skb, attrtype, value) \ 835#define NLA_PUT_U32(skb, attrtype, value) \
832 NLA_PUT_TYPE(skb, u32, attrtype, value) 836 NLA_PUT_TYPE(skb, u32, attrtype, value)
833 837
@@ -874,6 +878,15 @@ static inline u16 nla_get_u16(struct nlattr *nla)
874} 878}
875 879
876/** 880/**
881 * nla_get_le16 - return payload of __le16 attribute
882 * @nla: __le16 netlink attribute
883 */
884static inline __le16 nla_get_le16(struct nlattr *nla)
885{
886 return *(__le16 *) nla_data(nla);
887}
888
889/**
877 * nla_get_u8 - return payload of u8 attribute 890 * nla_get_u8 - return payload of u8 attribute
878 * @nla: u8 netlink attribute 891 * @nla: u8 netlink attribute
879 */ 892 */
diff --git a/include/net/protocol.h b/include/net/protocol.h
index c643bce64e55..105bf12b0c79 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -50,7 +50,7 @@ struct inet6_protocol
50 void (*err_handler)(struct sk_buff *skb, 50 void (*err_handler)(struct sk_buff *skb,
51 struct inet6_skb_parm *opt, 51 struct inet6_skb_parm *opt,
52 int type, int code, int offset, 52 int type, int code, int offset,
53 __u32 info); 53 __be32 info);
54 54
55 int (*gso_send_check)(struct sk_buff *skb); 55 int (*gso_send_check)(struct sk_buff *skb);
56 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 56 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
@@ -71,7 +71,7 @@ struct inet_protosw {
71 71
72 /* These two fields form the lookup key. */ 72 /* These two fields form the lookup key. */
73 unsigned short type; /* This is the 2nd argument to socket(2). */ 73 unsigned short type; /* This is the 2nd argument to socket(2). */
74 int protocol; /* This is the L4 protocol number. */ 74 unsigned short protocol; /* This is the L4 protocol number. */
75 75
76 struct proto *prot; 76 struct proto *prot;
77 const struct proto_ops *ops; 77 const struct proto_ops *ops;
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index 14476a71725e..af8960878ef4 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -21,7 +21,7 @@ extern void rawv6_err(struct sock *sk,
21 struct sk_buff *skb, 21 struct sk_buff *skb,
22 struct inet6_skb_parm *opt, 22 struct inet6_skb_parm *opt,
23 int type, int code, 23 int type, int code,
24 int offset, u32 info); 24 int offset, __be32 info);
25 25
26#endif 26#endif
27 27
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 8e165ca16bd8..e37baaf2080b 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -28,14 +28,15 @@ struct proto;
28 28
29struct request_sock_ops { 29struct request_sock_ops {
30 int family; 30 int family;
31 kmem_cache_t *slab;
32 int obj_size; 31 int obj_size;
32 kmem_cache_t *slab;
33 int (*rtx_syn_ack)(struct sock *sk, 33 int (*rtx_syn_ack)(struct sock *sk,
34 struct request_sock *req, 34 struct request_sock *req,
35 struct dst_entry *dst); 35 struct dst_entry *dst);
36 void (*send_ack)(struct sk_buff *skb, 36 void (*send_ack)(struct sk_buff *skb,
37 struct request_sock *req); 37 struct request_sock *req);
38 void (*send_reset)(struct sk_buff *skb); 38 void (*send_reset)(struct sock *sk,
39 struct sk_buff *skb);
39 void (*destructor)(struct request_sock *req); 40 void (*destructor)(struct request_sock *req);
40}; 41};
41 42
@@ -51,12 +52,13 @@ struct request_sock {
51 u32 rcv_wnd; /* rcv_wnd offered first time */ 52 u32 rcv_wnd; /* rcv_wnd offered first time */
52 u32 ts_recent; 53 u32 ts_recent;
53 unsigned long expires; 54 unsigned long expires;
54 struct request_sock_ops *rsk_ops; 55 const struct request_sock_ops *rsk_ops;
55 struct sock *sk; 56 struct sock *sk;
56 u32 secid; 57 u32 secid;
58 u32 peer_secid;
57}; 59};
58 60
59static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) 61static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops)
60{ 62{
61 struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC); 63 struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC);
62 64
@@ -120,7 +122,7 @@ struct request_sock_queue {
120}; 122};
121 123
122extern int reqsk_queue_alloc(struct request_sock_queue *queue, 124extern int reqsk_queue_alloc(struct request_sock_queue *queue,
123 const int nr_table_entries); 125 unsigned int nr_table_entries);
124 126
125static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue) 127static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue)
126{ 128{
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b0e9108a4e18..82086392735a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -60,6 +60,7 @@ struct Qdisc_class_ops
60 int (*graft)(struct Qdisc *, unsigned long cl, 60 int (*graft)(struct Qdisc *, unsigned long cl,
61 struct Qdisc *, struct Qdisc **); 61 struct Qdisc *, struct Qdisc **);
62 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); 62 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
63 void (*qlen_notify)(struct Qdisc *, unsigned long);
63 64
64 /* Class manipulation routines */ 65 /* Class manipulation routines */
65 unsigned long (*get)(struct Qdisc *, u32 classid); 66 unsigned long (*get)(struct Qdisc *, u32 classid);
@@ -144,7 +145,7 @@ struct tcf_proto
144 void *root; 145 void *root;
145 int (*classify)(struct sk_buff*, struct tcf_proto*, 146 int (*classify)(struct sk_buff*, struct tcf_proto*,
146 struct tcf_result *); 147 struct tcf_result *);
147 u32 protocol; 148 __be16 protocol;
148 149
149 /* All the rest */ 150 /* All the rest */
150 u32 prio; 151 u32 prio;
@@ -172,9 +173,10 @@ extern void dev_activate(struct net_device *dev);
172extern void dev_deactivate(struct net_device *dev); 173extern void dev_deactivate(struct net_device *dev);
173extern void qdisc_reset(struct Qdisc *qdisc); 174extern void qdisc_reset(struct Qdisc *qdisc);
174extern void qdisc_destroy(struct Qdisc *qdisc); 175extern void qdisc_destroy(struct Qdisc *qdisc);
176extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
175extern 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);
176extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
177 struct Qdisc_ops *ops); 179 struct Qdisc_ops *ops, u32 parentid);
178 180
179static inline void 181static inline void
180tcf_destroy(struct tcf_proto *tp) 182tcf_destroy(struct tcf_proto *tp)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 807d6f1ef4b5..6114c4f54b0a 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -116,9 +116,11 @@ typedef enum {
116typedef union { 116typedef union {
117 __s32 i32; 117 __s32 i32;
118 __u32 u32; 118 __u32 u32;
119 __be32 be32;
119 __u16 u16; 120 __u16 u16;
120 __u8 u8; 121 __u8 u8;
121 int error; 122 int error;
123 __be16 err;
122 sctp_state_t state; 124 sctp_state_t state;
123 sctp_event_timeout_t to; 125 sctp_event_timeout_t to;
124 unsigned long zero; 126 unsigned long zero;
@@ -164,9 +166,11 @@ SCTP_## name (type arg) \
164 166
165SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) 167SCTP_ARG_CONSTRUCTOR(I32, __s32, i32)
166SCTP_ARG_CONSTRUCTOR(U32, __u32, u32) 168SCTP_ARG_CONSTRUCTOR(U32, __u32, u32)
169SCTP_ARG_CONSTRUCTOR(BE32, __be32, be32)
167SCTP_ARG_CONSTRUCTOR(U16, __u16, u16) 170SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
168SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 171SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
169SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 172SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
173SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
170SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 174SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
171SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 175SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
172SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) 176SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 6c632e26f72d..5ddb85599863 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -356,7 +356,7 @@ typedef enum {
356 * addresses. 356 * addresses.
357 */ 357 */
358#define IS_IPV4_UNUSABLE_ADDRESS(a) \ 358#define IS_IPV4_UNUSABLE_ADDRESS(a) \
359 ((INADDR_BROADCAST == *a) || \ 359 ((htonl(INADDR_BROADCAST) == *a) || \
360 (MULTICAST(*a)) || \ 360 (MULTICAST(*a)) || \
361 (((unsigned char *)(a))[0] == 0) || \ 361 (((unsigned char *)(a))[0] == 0) || \
362 ((((unsigned char *)(a))[0] == 198) && \ 362 ((((unsigned char *)(a))[0] == 198) && \
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 764e3af5be93..215461f18db1 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -585,7 +585,7 @@ static inline int ipver2af(__u8 ipver)
585} 585}
586 586
587/* Convert from an address parameter type to an address family. */ 587/* Convert from an address parameter type to an address family. */
588static inline int param_type2af(__u16 type) 588static inline int param_type2af(__be16 type)
589{ 589{
590 switch (type) { 590 switch (type) {
591 case SCTP_PARAM_IPV4_ADDRESS: 591 case SCTP_PARAM_IPV4_ADDRESS:
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index de313de4fefe..3269ed1cc222 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -213,7 +213,7 @@ struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc,
213 const struct sctp_chunk *); 213 const struct sctp_chunk *);
214struct sctp_chunk *sctp_make_shutdown_complete(const struct sctp_association *, 214struct sctp_chunk *sctp_make_shutdown_complete(const struct sctp_association *,
215 const struct sctp_chunk *); 215 const struct sctp_chunk *);
216void sctp_init_cause(struct sctp_chunk *, __u16 cause, const void *, size_t); 216void sctp_init_cause(struct sctp_chunk *, __be16 cause, const void *, size_t);
217struct sctp_chunk *sctp_make_abort(const struct sctp_association *, 217struct sctp_chunk *sctp_make_abort(const struct sctp_association *,
218 const struct sctp_chunk *, 218 const struct sctp_chunk *,
219 const size_t hint); 219 const size_t hint);
@@ -236,14 +236,14 @@ struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *,
236 const size_t paylen); 236 const size_t paylen);
237struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, 237struct sctp_chunk *sctp_make_op_error(const struct sctp_association *,
238 const struct sctp_chunk *chunk, 238 const struct sctp_chunk *chunk,
239 __u16 cause_code, 239 __be16 cause_code,
240 const void *payload, 240 const void *payload,
241 size_t paylen); 241 size_t paylen);
242 242
243struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, 243struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
244 union sctp_addr *, 244 union sctp_addr *,
245 struct sockaddr *, 245 struct sockaddr *,
246 int, __u16); 246 int, __be16);
247struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, 247struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
248 union sctp_addr *addr); 248 union sctp_addr *addr);
249struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, 249struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 60b684470db8..c089f93ba591 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -537,7 +537,7 @@ struct sctp_af {
537 struct net_device *); 537 struct net_device *);
538 void (*dst_saddr) (union sctp_addr *saddr, 538 void (*dst_saddr) (union sctp_addr *saddr,
539 struct dst_entry *dst, 539 struct dst_entry *dst,
540 unsigned short port); 540 __be16 port);
541 int (*cmp_addr) (const union sctp_addr *addr1, 541 int (*cmp_addr) (const union sctp_addr *addr1,
542 const union sctp_addr *addr2); 542 const union sctp_addr *addr2);
543 void (*addr_copy) (union sctp_addr *dst, 543 void (*addr_copy) (union sctp_addr *dst,
@@ -553,14 +553,14 @@ struct sctp_af {
553 struct sock *sk); 553 struct sock *sk);
554 void (*from_addr_param) (union sctp_addr *, 554 void (*from_addr_param) (union sctp_addr *,
555 union sctp_addr_param *, 555 union sctp_addr_param *,
556 __u16 port, int iif); 556 __be16 port, int iif);
557 int (*to_addr_param) (const union sctp_addr *, 557 int (*to_addr_param) (const union sctp_addr *,
558 union sctp_addr_param *); 558 union sctp_addr_param *);
559 int (*addr_valid) (union sctp_addr *, 559 int (*addr_valid) (union sctp_addr *,
560 struct sctp_sock *, 560 struct sctp_sock *,
561 const struct sk_buff *); 561 const struct sk_buff *);
562 sctp_scope_t (*scope) (union sctp_addr *); 562 sctp_scope_t (*scope) (union sctp_addr *);
563 void (*inaddr_any) (union sctp_addr *, unsigned short); 563 void (*inaddr_any) (union sctp_addr *, __be16);
564 int (*is_any) (const union sctp_addr *); 564 int (*is_any) (const union sctp_addr *);
565 int (*available) (union sctp_addr *, 565 int (*available) (union sctp_addr *,
566 struct sctp_sock *); 566 struct sctp_sock *);
@@ -587,7 +587,7 @@ struct sctp_pf {
587 struct sctp_sock *); 587 struct sctp_sock *);
588 int (*bind_verify) (struct sctp_sock *, union sctp_addr *); 588 int (*bind_verify) (struct sctp_sock *, union sctp_addr *);
589 int (*send_verify) (struct sctp_sock *, union sctp_addr *); 589 int (*send_verify) (struct sctp_sock *, union sctp_addr *);
590 int (*supported_addrs)(const struct sctp_sock *, __u16 *); 590 int (*supported_addrs)(const struct sctp_sock *, __be16 *);
591 struct sock *(*create_accept_sk) (struct sock *sk, 591 struct sock *(*create_accept_sk) (struct sock *sk,
592 struct sctp_association *asoc); 592 struct sctp_association *asoc);
593 void (*addr_v4map) (struct sctp_sock *, union sctp_addr *); 593 void (*addr_v4map) (struct sctp_sock *, union sctp_addr *);
@@ -1270,7 +1270,7 @@ struct sctp_endpoint {
1270 * this here so we pre-allocate this once and can re-use 1270 * this here so we pre-allocate this once and can re-use
1271 * on every receive. 1271 * on every receive.
1272 */ 1272 */
1273 __u8 digest[SCTP_SIGNATURE_SIZE]; 1273 __u8 *digest;
1274 1274
1275 /* sendbuf acct. policy. */ 1275 /* sendbuf acct. policy. */
1276 __u32 sndbuf_policy; 1276 __u32 sndbuf_policy;
@@ -1314,6 +1314,13 @@ int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
1314__u32 sctp_generate_tag(const struct sctp_endpoint *); 1314__u32 sctp_generate_tag(const struct sctp_endpoint *);
1315__u32 sctp_generate_tsn(const struct sctp_endpoint *); 1315__u32 sctp_generate_tsn(const struct sctp_endpoint *);
1316 1316
1317struct sctp_inithdr_host {
1318 __u32 init_tag;
1319 __u32 a_rwnd;
1320 __u16 num_outbound_streams;
1321 __u16 num_inbound_streams;
1322 __u32 initial_tsn;
1323};
1317 1324
1318/* RFC2960 1325/* RFC2960
1319 * 1326 *
@@ -1482,9 +1489,9 @@ struct sctp_association {
1482 /* This mask is used to disable sending the ASCONF chunk 1489 /* This mask is used to disable sending the ASCONF chunk
1483 * with specified parameter to peer. 1490 * with specified parameter to peer.
1484 */ 1491 */
1485 __u16 addip_disabled_mask; 1492 __be16 addip_disabled_mask;
1486 1493
1487 struct sctp_inithdr i; 1494 struct sctp_inithdr_host i;
1488 int cookie_len; 1495 int cookie_len;
1489 void *cookie; 1496 void *cookie;
1490 1497
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h
index 021947da70ea..70a824df6f60 100644
--- a/include/net/sctp/tsnmap.h
+++ b/include/net/sctp/tsnmap.h
@@ -105,7 +105,7 @@ struct sctp_tsnmap {
105 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of 105 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of
106 * information. 106 * information.
107 */ 107 */
108 __u32 dup_tsns[SCTP_MAX_DUP_TSNS]; 108 __be32 dup_tsns[SCTP_MAX_DUP_TSNS];
109 __u16 num_dup_tsns; 109 __u16 num_dup_tsns;
110 110
111 /* Record gap ack block information here. */ 111 /* Record gap ack block information here. */
@@ -162,7 +162,7 @@ static inline __u16 sctp_tsnmap_num_dups(struct sctp_tsnmap *map)
162} 162}
163 163
164/* Return pointer to duplicate tsn array as needed by SACK. */ 164/* Return pointer to duplicate tsn array as needed by SACK. */
165static inline __u32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map) 165static inline __be32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map)
166{ 166{
167 map->num_dup_tsns = 0; 167 map->num_dup_tsns = 0;
168 return map->dup_tsns; 168 return map->dup_tsns;
diff --git a/include/net/sock.h b/include/net/sock.h
index ac286a353032..26fc0b16bc0c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -745,7 +745,13 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
745 */ 745 */
746#define sock_owned_by_user(sk) ((sk)->sk_lock.owner) 746#define sock_owned_by_user(sk) ((sk)->sk_lock.owner)
747 747
748extern void FASTCALL(lock_sock(struct sock *sk)); 748extern void FASTCALL(lock_sock_nested(struct sock *sk, int subclass));
749
750static inline void lock_sock(struct sock *sk)
751{
752 lock_sock_nested(sk, 0);
753}
754
749extern void FASTCALL(release_sock(struct sock *sk)); 755extern void FASTCALL(release_sock(struct sock *sk));
750 756
751/* BH context may only use the following locking interface. */ 757/* BH context may only use the following locking interface. */
@@ -883,18 +889,23 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
883} 889}
884 890
885/** 891/**
886 * sk_filter_release: Release a socket filter 892 * sk_filter_rcu_free: Free a socket filter
887 * @rcu: rcu_head that contains the sk_filter info to remove 893 * @rcu: rcu_head that contains the sk_filter to free
888 *
889 * Remove a filter from a socket and release its resources.
890 */ 894 */
891
892static inline void sk_filter_rcu_free(struct rcu_head *rcu) 895static inline void sk_filter_rcu_free(struct rcu_head *rcu)
893{ 896{
894 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); 897 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
895 kfree(fp); 898 kfree(fp);
896} 899}
897 900
901/**
902 * sk_filter_release: Release a socket filter
903 * @sk: socket
904 * @fp: filter to remove
905 *
906 * Remove a filter from a socket and release its resources.
907 */
908
898static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) 909static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp)
899{ 910{
900 unsigned int size = sk_filter_len(fp); 911 unsigned int size = sk_filter_len(fp);
@@ -943,7 +954,8 @@ static inline void sock_put(struct sock *sk)
943 sk_free(sk); 954 sk_free(sk);
944} 955}
945 956
946extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb); 957extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
958 const int nested);
947 959
948/* Detach socket from process context. 960/* Detach socket from process context.
949 * Announce socket dead, detach it from wait queue and inode. 961 * Announce socket dead, detach it from wait queue and inode.
@@ -1077,7 +1089,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1077{ 1089{
1078 if (skb->ip_summed == CHECKSUM_NONE) { 1090 if (skb->ip_summed == CHECKSUM_NONE) {
1079 int err = 0; 1091 int err = 0;
1080 unsigned int csum = csum_and_copy_from_user(from, 1092 __wsum csum = csum_and_copy_from_user(from,
1081 page_address(page) + off, 1093 page_address(page) + off,
1082 copy, 0, &err); 1094 copy, 0, &err);
1083 if (err) 1095 if (err)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7a093d0aa0fe..c99774f15eba 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -28,6 +28,7 @@
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/crypto.h>
31 32
32#include <net/inet_connection_sock.h> 33#include <net/inet_connection_sock.h>
33#include <net/inet_timewait_sock.h> 34#include <net/inet_timewait_sock.h>
@@ -138,7 +139,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
138#define MAX_TCP_SYNCNT 127 139#define MAX_TCP_SYNCNT 127
139 140
140#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ 141#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
141#define TCP_SYNQ_HSIZE 512 /* Size of SYNACK hash table */
142 142
143#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24) 143#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24)
144#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated 144#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated
@@ -162,6 +162,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
162#define TCPOPT_SACK_PERM 4 /* SACK Permitted */ 162#define TCPOPT_SACK_PERM 4 /* SACK Permitted */
163#define TCPOPT_SACK 5 /* SACK Block */ 163#define TCPOPT_SACK 5 /* SACK Block */
164#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 164#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
165#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
165 166
166/* 167/*
167 * TCP option lengths 168 * TCP option lengths
@@ -171,6 +172,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
171#define TCPOLEN_WINDOW 3 172#define TCPOLEN_WINDOW 3
172#define TCPOLEN_SACK_PERM 2 173#define TCPOLEN_SACK_PERM 2
173#define TCPOLEN_TIMESTAMP 10 174#define TCPOLEN_TIMESTAMP 10
175#define TCPOLEN_MD5SIG 18
174 176
175/* But this is what stacks really send out. */ 177/* But this is what stacks really send out. */
176#define TCPOLEN_TSTAMP_ALIGNED 12 178#define TCPOLEN_TSTAMP_ALIGNED 12
@@ -179,6 +181,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
179#define TCPOLEN_SACK_BASE 2 181#define TCPOLEN_SACK_BASE 2
180#define TCPOLEN_SACK_BASE_ALIGNED 4 182#define TCPOLEN_SACK_BASE_ALIGNED 4
181#define TCPOLEN_SACK_PERBLOCK 8 183#define TCPOLEN_SACK_PERBLOCK 8
184#define TCPOLEN_MD5SIG_ALIGNED 20
182 185
183/* Flags in tp->nonagle */ 186/* Flags in tp->nonagle */
184#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ 187#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
@@ -300,6 +303,8 @@ extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
300extern int tcp_twsk_unique(struct sock *sk, 303extern int tcp_twsk_unique(struct sock *sk,
301 struct sock *sktw, void *twp); 304 struct sock *sktw, void *twp);
302 305
306extern void tcp_twsk_destructor(struct sock *sk);
307
303static inline void tcp_dec_quickack_mode(struct sock *sk, 308static inline void tcp_dec_quickack_mode(struct sock *sk,
304 const unsigned int pkts) 309 const unsigned int pkts)
305{ 310{
@@ -621,8 +626,12 @@ enum tcp_ca_event {
621 * Interface for adding new TCP congestion control handlers 626 * Interface for adding new TCP congestion control handlers
622 */ 627 */
623#define TCP_CA_NAME_MAX 16 628#define TCP_CA_NAME_MAX 16
629#define TCP_CA_MAX 128
630#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
631
624struct tcp_congestion_ops { 632struct tcp_congestion_ops {
625 struct list_head list; 633 struct list_head list;
634 int non_restricted;
626 635
627 /* initialize private data (optional) */ 636 /* initialize private data (optional) */
628 void (*init)(struct sock *sk); 637 void (*init)(struct sock *sk);
@@ -660,6 +669,9 @@ extern void tcp_init_congestion_control(struct sock *sk);
660extern void tcp_cleanup_congestion_control(struct sock *sk); 669extern void tcp_cleanup_congestion_control(struct sock *sk);
661extern int tcp_set_default_congestion_control(const char *name); 670extern int tcp_set_default_congestion_control(const char *name);
662extern void tcp_get_default_congestion_control(char *name); 671extern void tcp_get_default_congestion_control(char *name);
672extern void tcp_get_available_congestion_control(char *buf, size_t len);
673extern void tcp_get_allowed_congestion_control(char *buf, size_t len);
674extern int tcp_set_allowed_congestion_control(char *allowed);
663extern int tcp_set_congestion_control(struct sock *sk, const char *name); 675extern int tcp_set_congestion_control(struct sock *sk, const char *name);
664extern void tcp_slow_start(struct tcp_sock *tp); 676extern void tcp_slow_start(struct tcp_sock *tp);
665 677
@@ -795,14 +807,14 @@ static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
795/* 807/*
796 * Calculate(/check) TCP checksum 808 * Calculate(/check) TCP checksum
797 */ 809 */
798static inline u16 tcp_v4_check(struct tcphdr *th, int len, 810static inline __sum16 tcp_v4_check(struct tcphdr *th, int len,
799 unsigned long saddr, unsigned long daddr, 811 __be32 saddr, __be32 daddr,
800 unsigned long base) 812 __wsum base)
801{ 813{
802 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 814 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
803} 815}
804 816
805static inline int __tcp_checksum_complete(struct sk_buff *skb) 817static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
806{ 818{
807 return __skb_checksum_complete(skb); 819 return __skb_checksum_complete(skb);
808} 820}
@@ -1058,6 +1070,114 @@ static inline void clear_all_retrans_hints(struct tcp_sock *tp){
1058 tp->fastpath_skb_hint = NULL; 1070 tp->fastpath_skb_hint = NULL;
1059} 1071}
1060 1072
1073/* MD5 Signature */
1074struct crypto_hash;
1075
1076/* - key database */
1077struct tcp_md5sig_key {
1078 u8 *key;
1079 u8 keylen;
1080};
1081
1082struct tcp4_md5sig_key {
1083 u8 *key;
1084 u16 keylen;
1085 __be32 addr;
1086};
1087
1088struct tcp6_md5sig_key {
1089 u8 *key;
1090 u16 keylen;
1091#if 0
1092 u32 scope_id; /* XXX */
1093#endif
1094 struct in6_addr addr;
1095};
1096
1097/* - sock block */
1098struct tcp_md5sig_info {
1099 struct tcp4_md5sig_key *keys4;
1100#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1101 struct tcp6_md5sig_key *keys6;
1102 u32 entries6;
1103 u32 alloced6;
1104#endif
1105 u32 entries4;
1106 u32 alloced4;
1107};
1108
1109/* - pseudo header */
1110struct tcp4_pseudohdr {
1111 __be32 saddr;
1112 __be32 daddr;
1113 __u8 pad;
1114 __u8 protocol;
1115 __be16 len;
1116};
1117
1118struct tcp6_pseudohdr {
1119 struct in6_addr saddr;
1120 struct in6_addr daddr;
1121 __be32 len;
1122 __be32 protocol; /* including padding */
1123};
1124
1125union tcp_md5sum_block {
1126 struct tcp4_pseudohdr ip4;
1127#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1128 struct tcp6_pseudohdr ip6;
1129#endif
1130};
1131
1132/* - pool: digest algorithm, hash description and scratch buffer */
1133struct tcp_md5sig_pool {
1134 struct hash_desc md5_desc;
1135 union tcp_md5sum_block md5_blk;
1136};
1137
1138#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1139
1140/* - functions */
1141extern int tcp_v4_calc_md5_hash(char *md5_hash,
1142 struct tcp_md5sig_key *key,
1143 struct sock *sk,
1144 struct dst_entry *dst,
1145 struct request_sock *req,
1146 struct tcphdr *th,
1147 int protocol, int tcplen);
1148extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1149 struct sock *addr_sk);
1150
1151extern int tcp_v4_md5_do_add(struct sock *sk,
1152 __be32 addr,
1153 u8 *newkey,
1154 u8 newkeylen);
1155
1156extern int tcp_v4_md5_do_del(struct sock *sk,
1157 __be32 addr);
1158
1159extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void);
1160extern void tcp_free_md5sig_pool(void);
1161
1162extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
1163extern void __tcp_put_md5sig_pool(void);
1164
1165static inline
1166struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
1167{
1168 int cpu = get_cpu();
1169 struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
1170 if (!ret)
1171 put_cpu();
1172 return ret;
1173}
1174
1175static inline void tcp_put_md5sig_pool(void)
1176{
1177 __tcp_put_md5sig_pool();
1178 put_cpu();
1179}
1180
1061/* /proc */ 1181/* /proc */
1062enum tcp_seq_states { 1182enum tcp_seq_states {
1063 TCP_SEQ_STATE_LISTENING, 1183 TCP_SEQ_STATE_LISTENING,
@@ -1097,6 +1217,35 @@ extern int tcp4_proc_init(void);
1097extern void tcp4_proc_exit(void); 1217extern void tcp4_proc_exit(void);
1098#endif 1218#endif
1099 1219
1220/* TCP af-specific functions */
1221struct tcp_sock_af_ops {
1222#ifdef CONFIG_TCP_MD5SIG
1223 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1224 struct sock *addr_sk);
1225 int (*calc_md5_hash) (char *location,
1226 struct tcp_md5sig_key *md5,
1227 struct sock *sk,
1228 struct dst_entry *dst,
1229 struct request_sock *req,
1230 struct tcphdr *th,
1231 int protocol, int len);
1232 int (*md5_add) (struct sock *sk,
1233 struct sock *addr_sk,
1234 u8 *newkey,
1235 u8 len);
1236 int (*md5_parse) (struct sock *sk,
1237 char __user *optval,
1238 int optlen);
1239#endif
1240};
1241
1242struct tcp_request_sock_ops {
1243#ifdef CONFIG_TCP_MD5SIG
1244 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1245 struct request_sock *req);
1246#endif
1247};
1248
1100extern void tcp_v4_init(struct net_proto_family *ops); 1249extern void tcp_v4_init(struct net_proto_family *ops);
1101extern void tcp_init(void); 1250extern void tcp_init(void);
1102 1251
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index be293d795e38..d7a306ea560d 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -31,6 +31,9 @@ static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
31 31
32static inline void twsk_destructor(struct sock *sk) 32static inline void twsk_destructor(struct sock *sk)
33{ 33{
34 BUG_ON(sk == NULL);
35 BUG_ON(sk->sk_prot == NULL);
36 BUG_ON(sk->sk_prot->twsk_prot == NULL);
34 if (sk->sk_prot->twsk_prot->twsk_destructor != NULL) 37 if (sk->sk_prot->twsk_prot->twsk_destructor != NULL)
35 sk->sk_prot->twsk_prot->twsk_destructor(sk); 38 sk->sk_prot->twsk_prot->twsk_destructor(sk);
36} 39}
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
index e07136d74c2f..2151a80cdf30 100644
--- a/include/net/tipc/tipc_bearer.h
+++ b/include/net/tipc/tipc_bearer.h
@@ -58,7 +58,7 @@
58 */ 58 */
59 59
60struct tipc_media_addr { 60struct tipc_media_addr {
61 __u32 type; /* bearer type (network byte order) */ 61 __be32 type; /* bearer type (network byte order) */
62 union { 62 union {
63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ 63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
64#if 0 64#if 0
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h
index 4d096eebc93f..fb42eb7a86a5 100644
--- a/include/net/tipc/tipc_msg.h
+++ b/include/net/tipc/tipc_msg.h
@@ -40,7 +40,7 @@
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
41 41
42struct tipc_msg { 42struct tipc_msg {
43 u32 hdr[15]; 43 __be32 hdr[15];
44}; 44};
45 45
46 46
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 61f724c1036f..409da3a9a455 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -11,6 +11,7 @@
11 11
12extern struct proto rawv6_prot; 12extern struct proto rawv6_prot;
13extern struct proto udpv6_prot; 13extern struct proto udpv6_prot;
14extern struct proto udplitev6_prot;
14extern struct proto tcpv6_prot; 15extern struct proto tcpv6_prot;
15 16
16struct flowi; 17struct flowi;
@@ -24,6 +25,7 @@ extern void ipv6_destopt_init(void);
24/* transport protocols */ 25/* transport protocols */
25extern void rawv6_init(void); 26extern void rawv6_init(void);
26extern void udpv6_init(void); 27extern void udpv6_init(void);
28extern void udplitev6_init(void);
27extern void tcpv6_init(void); 29extern void tcpv6_init(void);
28 30
29extern int udpv6_connect(struct sock *sk, 31extern int udpv6_connect(struct sock *sk,
diff --git a/include/net/udp.h b/include/net/udp.h
index db0c05f67546..1548d68d45da 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -26,9 +26,28 @@
26#include <net/inet_sock.h> 26#include <net/inet_sock.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/snmp.h> 28#include <net/snmp.h>
29#include <net/ip.h>
30#include <linux/ipv6.h>
29#include <linux/seq_file.h> 31#include <linux/seq_file.h>
30 32
31#define UDP_HTABLE_SIZE 128 33/**
34 * struct udp_skb_cb - UDP(-Lite) private variables
35 *
36 * @header: private variables used by IPv4/IPv6
37 * @cscov: checksum coverage length (UDP-Lite only)
38 * @partial_cov: if set indicates partial csum coverage
39 */
40struct udp_skb_cb {
41 union {
42 struct inet_skb_parm h4;
43#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
44 struct inet6_skb_parm h6;
45#endif
46 } header;
47 __u16 cscov;
48 __u8 partial_cov;
49};
50#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb))
32 51
33extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 52extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
34extern rwlock_t udp_hash_lock; 53extern rwlock_t udp_hash_lock;
@@ -47,6 +66,62 @@ extern struct proto udp_prot;
47 66
48struct sk_buff; 67struct sk_buff;
49 68
69/*
70 * Generic checksumming routines for UDP(-Lite) v4 and v6
71 */
72static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
73{
74 if (! UDP_SKB_CB(skb)->partial_cov)
75 return __skb_checksum_complete(skb);
76 return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
77 skb->csum));
78}
79
80static inline int udp_lib_checksum_complete(struct sk_buff *skb)
81{
82 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
83 __udp_lib_checksum_complete(skb);
84}
85
86/**
87 * udp_csum_outgoing - compute UDPv4/v6 checksum over fragments
88 * @sk: socket we are writing to
89 * @skb: sk_buff containing the filled-in UDP header
90 * (checksum field must be zeroed out)
91 */
92static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
93{
94 __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
95
96 skb_queue_walk(&sk->sk_write_queue, skb) {
97 csum = csum_add(csum, skb->csum);
98 }
99 return csum;
100}
101
102/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
103static inline void udp_lib_hash(struct sock *sk)
104{
105 BUG();
106}
107
108static inline void udp_lib_unhash(struct sock *sk)
109{
110 write_lock_bh(&udp_hash_lock);
111 if (sk_del_node_init(sk)) {
112 inet_sk(sk)->num = 0;
113 sock_prot_dec_use(sk->sk_prot);
114 }
115 write_unlock_bh(&udp_hash_lock);
116}
117
118static inline void udp_lib_close(struct sock *sk, long timeout)
119{
120 sk_common_release(sk);
121}
122
123
124/* net/ipv4/udp.c */
50extern int udp_get_port(struct sock *sk, unsigned short snum, 125extern int udp_get_port(struct sock *sk, unsigned short snum,
51 int (*saddr_cmp)(const struct sock *, const struct sock *)); 126 int (*saddr_cmp)(const struct sock *, const struct sock *));
52extern void udp_err(struct sk_buff *, u32); 127extern void udp_err(struct sk_buff *, u32);
@@ -59,23 +134,36 @@ extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
59extern int udp_disconnect(struct sock *sk, int flags); 134extern int udp_disconnect(struct sock *sk, int flags);
60extern unsigned int udp_poll(struct file *file, struct socket *sock, 135extern unsigned int udp_poll(struct file *file, struct socket *sock,
61 poll_table *wait); 136 poll_table *wait);
137extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
138 char __user *optval, int __user *optlen);
139extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
140 char __user *optval, int optlen,
141 int (*push_pending_frames)(struct sock *));
62 142
63DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); 143DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
64#define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field) 144/*
65#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field) 145 * SNMP statistics for UDP and UDP-Lite
66#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field) 146 */
147#define UDP_INC_STATS_USER(field, is_udplite) do { \
148 if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \
149 else SNMP_INC_STATS_USER(udp_statistics, field); } while(0)
150#define UDP_INC_STATS_BH(field, is_udplite) do { \
151 if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \
152 else SNMP_INC_STATS_BH(udp_statistics, field); } while(0)
67 153
68/* /proc */ 154/* /proc */
69struct udp_seq_afinfo { 155struct udp_seq_afinfo {
70 struct module *owner; 156 struct module *owner;
71 char *name; 157 char *name;
72 sa_family_t family; 158 sa_family_t family;
159 struct hlist_head *hashtable;
73 int (*seq_show) (struct seq_file *m, void *v); 160 int (*seq_show) (struct seq_file *m, void *v);
74 struct file_operations *seq_fops; 161 struct file_operations *seq_fops;
75}; 162};
76 163
77struct udp_iter_state { 164struct udp_iter_state {
78 sa_family_t family; 165 sa_family_t family;
166 struct hlist_head *hashtable;
79 int bucket; 167 int bucket;
80 struct seq_operations seq_ops; 168 struct seq_operations seq_ops;
81}; 169};
diff --git a/include/net/udplite.h b/include/net/udplite.h
new file mode 100644
index 000000000000..67ac51424307
--- /dev/null
+++ b/include/net/udplite.h
@@ -0,0 +1,151 @@
1/*
2 * Definitions for the UDP-Lite (RFC 3828) code.
3 */
4#ifndef _UDPLITE_H
5#define _UDPLITE_H
6
7#include <net/ip6_checksum.h>
8
9/* UDP-Lite socket options */
10#define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */
11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
12
13extern struct proto udplite_prot;
14extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE];
15
16/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */
17DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics);
18
19/*
20 * Checksum computation is all in software, hence simpler getfrag.
21 */
22static __inline__ int udplite_getfrag(void *from, char *to, int offset,
23 int len, int odd, struct sk_buff *skb)
24{
25 return memcpy_fromiovecend(to, (struct iovec *) from, offset, len);
26}
27
28/* Designate sk as UDP-Lite socket */
29static inline int udplite_sk_init(struct sock *sk)
30{
31 udp_sk(sk)->pcflag = UDPLITE_BIT;
32 return 0;
33}
34
35/*
36 * Checksumming routines
37 */
38static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
39{
40 u16 cscov;
41
42 /* In UDPv4 a zero checksum means that the transmitter generated no
43 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
44 * with a zero checksum field are illegal. */
45 if (uh->check == 0) {
46 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n");
47 return 1;
48 }
49
50 UDP_SKB_CB(skb)->partial_cov = 0;
51 cscov = ntohs(uh->len);
52
53 if (cscov == 0) /* Indicates that full coverage is required. */
54 cscov = skb->len;
55 else if (cscov < 8 || cscov > skb->len) {
56 /*
57 * Coverage length violates RFC 3828: log and discard silently.
58 */
59 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n",
60 cscov, skb->len);
61 return 1;
62
63 } else if (cscov < skb->len)
64 UDP_SKB_CB(skb)->partial_cov = 1;
65
66 UDP_SKB_CB(skb)->cscov = cscov;
67
68 /*
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
74 return 0;
75}
76
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)
100{
101 int cscov = up->len;
102
103 /*
104 * Sender has set `partial coverage' option on UDP-Lite socket
105 */
106 if (up->pcflag & UDPLITE_SEND_CC) {
107 if (up->pcslen < up->len) {
108 /* up->pcslen == 0 means that full coverage is required,
109 * partial coverage only if 0 < up->pcslen < up->len */
110 if (0 < up->pcslen) {
111 cscov = up->pcslen;
112 }
113 uh->len = htons(up->pcslen);
114 }
115 /*
116 * NOTE: Causes for the error case `up->pcslen > up->len':
117 * (i) Application error (will not be penalized).
118 * (ii) Payload too big for send buffer: data is split
119 * into several packets, each with its own header.
120 * In this case (e.g. last segment), coverage may
121 * exceed packet length.
122 * Since packets with coverage length > packet length are
123 * illegal, we fall back to the defaults here.
124 */
125 }
126 return cscov;
127}
128
129static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
130{
131 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
132 __wsum csum = 0;
133
134 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
135
136 skb_queue_walk(&sk->sk_write_queue, skb) {
137 off = skb->h.raw - skb->data;
138 len = skb->len - off;
139
140 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
141
142 if ((cscov -= len) <= 0)
143 break;
144 }
145 return csum;
146}
147
148extern void udplite4_register(void);
149extern int udplite_get_port(struct sock *sk, unsigned short snum,
150 int (*scmp)(const struct sock *, const struct sock *));
151#endif /* _UDPLITE_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 737fdb2ee8a4..15ec19dcf9c8 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -310,6 +310,8 @@ struct xfrm_tmpl
310/* Source address of tunnel. Ignored, if it is not a tunnel. */ 310/* Source address of tunnel. Ignored, if it is not a tunnel. */
311 xfrm_address_t saddr; 311 xfrm_address_t saddr;
312 312
313 unsigned short encap_family;
314
313 __u32 reqid; 315 __u32 reqid;
314 316
315/* Mode: transport, tunnel etc. */ 317/* Mode: transport, tunnel etc. */
@@ -340,18 +342,19 @@ struct xfrm_policy
340 atomic_t refcnt; 342 atomic_t refcnt;
341 struct timer_list timer; 343 struct timer_list timer;
342 344
343 u8 type;
344 u32 priority; 345 u32 priority;
345 u32 index; 346 u32 index;
346 struct xfrm_selector selector; 347 struct xfrm_selector selector;
347 struct xfrm_lifetime_cfg lft; 348 struct xfrm_lifetime_cfg lft;
348 struct xfrm_lifetime_cur curlft; 349 struct xfrm_lifetime_cur curlft;
349 struct dst_entry *bundles; 350 struct dst_entry *bundles;
350 __u16 family; 351 u16 family;
351 __u8 action; 352 u8 type;
352 __u8 flags; 353 u8 action;
353 __u8 dead; 354 u8 flags;
354 __u8 xfrm_nr; 355 u8 dead;
356 u8 xfrm_nr;
357 /* XXX 1 byte hole, try to pack */
355 struct xfrm_sec_ctx *security; 358 struct xfrm_sec_ctx *security;
356 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 359 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
357}; 360};
@@ -379,7 +382,7 @@ struct xfrm_mgr
379 int (*notify)(struct xfrm_state *x, struct km_event *c); 382 int (*notify)(struct xfrm_state *x, struct km_event *c);
380 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 383 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
381 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 384 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
382 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 385 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
383 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 386 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
384 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 387 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
385}; 388};
@@ -468,6 +471,7 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
468 switch(fl->proto) { 471 switch(fl->proto) {
469 case IPPROTO_TCP: 472 case IPPROTO_TCP:
470 case IPPROTO_UDP: 473 case IPPROTO_UDP:
474 case IPPROTO_UDPLITE:
471 case IPPROTO_SCTP: 475 case IPPROTO_SCTP:
472 port = fl->fl_ip_sport; 476 port = fl->fl_ip_sport;
473 break; 477 break;
@@ -493,6 +497,7 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
493 switch(fl->proto) { 497 switch(fl->proto) {
494 case IPPROTO_TCP: 498 case IPPROTO_TCP:
495 case IPPROTO_UDP: 499 case IPPROTO_UDP:
500 case IPPROTO_UDPLITE:
496 case IPPROTO_SCTP: 501 case IPPROTO_SCTP:
497 port = fl->fl_ip_dport; 502 port = fl->fl_ip_dport;
498 break; 503 break;
@@ -506,40 +511,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
506 return port; 511 return port;
507} 512}
508 513
509static inline int 514extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
510__xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) 515 unsigned short family);
511{
512 return addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) &&
513 addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) &&
514 !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
515 !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
516 (fl->proto == sel->proto || !sel->proto) &&
517 (fl->oif == sel->ifindex || !sel->ifindex);
518}
519
520static inline int
521__xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
522{
523 return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) &&
524 addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) &&
525 !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
526 !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
527 (fl->proto == sel->proto || !sel->proto) &&
528 (fl->oif == sel->ifindex || !sel->ifindex);
529}
530
531static inline int
532xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
533 unsigned short family)
534{
535 switch (family) {
536 case AF_INET:
537 return __xfrm4_selector_match(sel, fl);
538 case AF_INET6:
539 return __xfrm6_selector_match(sel, fl);
540 }
541 return 0;
542}
543 516
544#ifdef CONFIG_SECURITY_NETWORK_XFRM 517#ifdef CONFIG_SECURITY_NETWORK_XFRM
545/* If neither has a context --> match 518/* If neither has a context --> match
@@ -887,8 +860,7 @@ struct xfrm_tunnel {
887struct xfrm6_tunnel { 860struct xfrm6_tunnel {
888 int (*handler)(struct sk_buff *skb); 861 int (*handler)(struct sk_buff *skb);
889 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 862 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
890 int type, int code, int offset, __u32 info); 863 int type, int code, int offset, __be32 info);
891
892 struct xfrm6_tunnel *next; 864 struct xfrm6_tunnel *next;
893 int priority; 865 int priority;
894}; 866};
@@ -951,9 +923,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
951 xfrm_address_t *saddr, u8 proto); 923 xfrm_address_t *saddr, u8 proto);
952extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 924extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
953extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 925extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
954extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 926extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
955extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 927extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
956extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 928extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
957extern int xfrm6_output(struct sk_buff *skb); 929extern int xfrm6_output(struct sk_buff *skb);
958extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 930extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
959 u8 **prevhdr); 931 u8 **prevhdr);
@@ -1000,7 +972,7 @@ extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1000extern void xfrm_init_pmtu(struct dst_entry *dst); 972extern void xfrm_init_pmtu(struct dst_entry *dst);
1001 973
1002extern wait_queue_head_t km_waitq; 974extern wait_queue_head_t km_waitq;
1003extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 975extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1004extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 976extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1005extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 977extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1006 978
@@ -1033,7 +1005,7 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
1033 switch (family) { 1005 switch (family) {
1034 default: 1006 default:
1035 case AF_INET: 1007 case AF_INET:
1036 return a->a4 - b->a4; 1008 return (__force __u32)a->a4 - (__force __u32)b->a4;
1037 case AF_INET6: 1009 case AF_INET6:
1038 return ipv6_addr_cmp((struct in6_addr *)a, 1010 return ipv6_addr_cmp((struct in6_addr *)a,
1039 (struct in6_addr *)b); 1011 (struct in6_addr *)b);
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index c9b4738be9d6..5c070176d9ab 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -60,6 +60,7 @@ enum ib_cm_state {
60}; 60};
61 61
62enum ib_cm_lap_state { 62enum ib_cm_lap_state {
63 IB_CM_LAP_UNINIT,
63 IB_CM_LAP_IDLE, 64 IB_CM_LAP_IDLE,
64 IB_CM_LAP_SENT, 65 IB_CM_LAP_SENT,
65 IB_CM_LAP_RCVD, 66 IB_CM_LAP_RCVD,
@@ -443,13 +444,20 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id,
443 u8 private_data_len); 444 u8 private_data_len);
444 445
445/** 446/**
446 * ib_cm_establish - Forces a connection state to established. 447 * ib_cm_notify - Notifies the CM of an event reported to the consumer.
447 * @cm_id: Connection identifier to transition to established. 448 * @cm_id: Connection identifier to transition to established.
449 * @event: Type of event.
448 * 450 *
449 * This routine should be invoked by users who receive messages on a 451 * This routine should be invoked by users to notify the CM of relevant
450 * connected QP before an RTU has been received. 452 * communication events. Events that should be reported to the CM and
453 * when to report them are:
454 *
455 * IB_EVENT_COMM_EST - Used when a message is received on a connected
456 * QP before an RTU has been received.
457 * IB_EVENT_PATH_MIG - Notifies the CM that the connection has failed over
458 * to the alternate path.
451 */ 459 */
452int ib_cm_establish(struct ib_cm_id *cm_id); 460int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event);
453 461
454/** 462/**
455 * ib_send_cm_rej - Sends a connection rejection message to the 463 * ib_send_cm_rej - Sends a connection rejection message to the
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 066c20b7cdfb..37650afb982c 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -38,7 +38,7 @@
38 38
39#include <rdma/ib_user_sa.h> 39#include <rdma/ib_user_sa.h>
40 40
41#define IB_USER_CM_ABI_VERSION 4 41#define IB_USER_CM_ABI_VERSION 5
42 42
43enum { 43enum {
44 IB_USER_CM_CMD_CREATE_ID, 44 IB_USER_CM_CMD_CREATE_ID,
@@ -46,7 +46,7 @@ enum {
46 IB_USER_CM_CMD_ATTR_ID, 46 IB_USER_CM_CMD_ATTR_ID,
47 47
48 IB_USER_CM_CMD_LISTEN, 48 IB_USER_CM_CMD_LISTEN,
49 IB_USER_CM_CMD_ESTABLISH, 49 IB_USER_CM_CMD_NOTIFY,
50 50
51 IB_USER_CM_CMD_SEND_REQ, 51 IB_USER_CM_CMD_SEND_REQ,
52 IB_USER_CM_CMD_SEND_REP, 52 IB_USER_CM_CMD_SEND_REP,
@@ -117,8 +117,9 @@ struct ib_ucm_listen {
117 __u32 reserved; 117 __u32 reserved;
118}; 118};
119 119
120struct ib_ucm_establish { 120struct ib_ucm_notify {
121 __u32 id; 121 __u32 id;
122 __u32 event;
122}; 123};
123 124
124struct ib_ucm_private_data { 125struct ib_ucm_private_data {
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 9ccc0365aa89..1f989fb42c70 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -35,6 +35,7 @@
35#include <scsi/scsi_device.h> 35#include <scsi/scsi_device.h>
36#include <scsi/scsi_cmnd.h> 36#include <scsi/scsi_cmnd.h>
37#include <scsi/scsi_transport_sas.h> 37#include <scsi/scsi_transport_sas.h>
38#include <asm/scatterlist.h>
38 39
39struct block_device; 40struct block_device;
40 41
diff --git a/include/sound/core.h b/include/sound/core.h
index fa1ca0127bab..a994bea09cd6 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -132,6 +132,7 @@ struct snd_card {
132 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */ 133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct device *parent;
135 struct device *dev; 136 struct device *dev;
136 137
137#ifdef CONFIG_PM 138#ifdef CONFIG_PM
@@ -187,13 +188,14 @@ struct snd_minor {
187 int device; /* device number */ 188 int device; /* device number */
188 const struct file_operations *f_ops; /* file operations */ 189 const struct file_operations *f_ops; /* file operations */
189 void *private_data; /* private data for f_ops->open */ 190 void *private_data; /* private data for f_ops->open */
190 struct class_device *class_dev; /* class device for sysfs */ 191 struct device *dev; /* device for sysfs */
191}; 192};
192 193
193/* sound.c */ 194/* sound.c */
194 195
195extern int snd_major; 196extern int snd_major;
196extern int snd_ecards_limit; 197extern int snd_ecards_limit;
198extern struct class *sound_class;
197 199
198void snd_request_card(int card); 200void snd_request_card(int card);
199 201
@@ -203,7 +205,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
203int snd_unregister_device(int type, struct snd_card *card, int dev); 205int snd_unregister_device(int type, struct snd_card *card, int dev);
204void *snd_lookup_minor_data(unsigned int minor, int type); 206void *snd_lookup_minor_data(unsigned int minor, int type);
205int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, 207int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
206 const struct class_device_attribute *attr); 208 struct device_attribute *attr);
207 209
208#ifdef CONFIG_SND_OSSEMUL 210#ifdef CONFIG_SND_OSSEMUL
209int snd_register_oss_device(int type, struct snd_card *card, int dev, 211int snd_register_oss_device(int type, struct snd_card *card, int dev,
@@ -255,7 +257,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file);
255int snd_card_file_remove(struct snd_card *card, struct file *file); 257int snd_card_file_remove(struct snd_card *card, struct file *file);
256 258
257#ifndef snd_card_set_dev 259#ifndef snd_card_set_dev
258#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 260#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr))
259#endif 261#endif
260 262
261/* device.c */ 263/* device.c */
diff --git a/include/sound/version.h b/include/sound/version.h
index 52fd6879b86e..17137f3a3b6f 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.13" 2#define CONFIG_SND_VERSION "1.0.13"
3#define CONFIG_SND_DATE " (Sun Oct 22 08:56:16 2006 UTC)" 3#define CONFIG_SND_DATE " (Tue Nov 28 14:07:24 2006 UTC)"