aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpiosxf.h2
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/acrestyp.h2
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actbl2.h2
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/asm-generic/pgtable.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h31
-rw-r--r--include/drm/drmP.h4
-rw-r--r--include/drm/drm_crtc.h7
-rw-r--r--include/drm/drm_pciids.h1
-rw-r--r--include/drm/radeon_drm.h1
-rw-r--r--include/keys/rxrpc-type.h1
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/acpi_io.h16
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/blkdev.h5
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/caif/Kbuild2
-rw-r--r--include/linux/ceph/messenger.h2
-rw-r--r--include/linux/console.h6
-rw-r--r--include/linux/cpu_rmap.h73
-rw-r--r--include/linux/dcbnl.h115
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/ethtool.h91
-rw-r--r--include/linux/freezer.h2
-rw-r--r--include/linux/fs.h9
-rw-r--r--include/linux/gfp.h13
-rw-r--r--include/linux/huge_mm.h3
-rw-r--r--include/linux/icmpv6.h4
-rw-r--r--include/linux/if.h9
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/input/bu21013.h4
-rw-r--r--include/linux/input/matrix_keypad.h4
-rw-r--r--include/linux/interrupt.h33
-rw-r--r--include/linux/ip_vs.h8
-rw-r--r--include/linux/irq.h3
-rw-r--r--include/linux/irqdesc.h17
-rw-r--r--include/linux/kernel.h34
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kmemcheck.h2
-rw-r--r--include/linux/list.h12
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/memcontrol.h9
-rw-r--r--include/linux/mfd/wm8994/core.h1
-rw-r--r--include/linux/micrel_phy.h16
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mmc/sh_mmcif.h4
-rw-r--r--include/linux/module.h31
-rw-r--r--include/linux/moduleparam.h6
-rw-r--r--include/linux/mroute.h1
-rw-r--r--include/linux/mroute6.h1
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h258
-rw-r--r--include/linux/netfilter.h27
-rw-r--r--include/linux/netfilter/Kbuild6
-rw-r--r--include/linux/netfilter/ipset/Kbuild4
-rw-r--r--include/linux/netfilter/ipset/ip_set.h452
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h1074
-rw-r--r--include/linux/netfilter/ipset/ip_set_bitmap.h31
-rw-r--r--include/linux/netfilter/ipset/ip_set_getport.h21
-rw-r--r--include/linux/netfilter/ipset/ip_set_hash.h26
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h27
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h127
-rw-r--r--include/linux/netfilter/ipset/pfxlen.h35
-rw-r--r--include/linux/netfilter/nf_conntrack_snmp.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h9
-rw-r--r--include/linux/netfilter/x_tables.h3
-rw-r--r--include/linux/netfilter/xt_AUDIT.h30
-rw-r--r--include/linux/netfilter/xt_CT.h12
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h6
-rw-r--r--include/linux/netfilter/xt_TCPOPTSTRIP.h4
-rw-r--r--include/linux/netfilter/xt_TPROXY.h10
-rw-r--r--include/linux/netfilter/xt_cluster.h10
-rw-r--r--include/linux/netfilter/xt_comment.h2
-rw-r--r--include/linux/netfilter/xt_connlimit.h16
-rw-r--r--include/linux/netfilter/xt_conntrack.h15
-rw-r--r--include/linux/netfilter/xt_devgroup.h21
-rw-r--r--include/linux/netfilter/xt_quota.h8
-rw-r--r--include/linux/netfilter/xt_set.h56
-rw-r--r--include/linux/netfilter/xt_socket.h2
-rw-r--r--include/linux/netfilter/xt_time.h16
-rw-r--r--include/linux/netfilter/xt_u32.h18
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h14
-rw-r--r--include/linux/netfilter_bridge/ebt_ip6.h25
-rw-r--r--include/linux/netfilter_bridge/ebt_limit.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_log.h8
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_m.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h12
-rw-r--r--include/linux/netfilter_bridge/ebt_pkttype.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_stp.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_ulog.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ECN.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_TTL.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_addrtype.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ah.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_ttl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_HL.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_REJECT.h4
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ah.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_frag.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_hl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ipv6header.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mh.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_opts.h12
-rw-r--r--include/linux/netfilter_ipv6/ip6t_rt.h13
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/nfsacl.h4
-rw-r--r--include/linux/oprofile.h13
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/phonet.h4
-rw-r--r--include/linux/pkt_sched.h107
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_wakeup.h25
-rw-r--r--include/linux/posix_acl.h1
-rw-r--r--include/linux/ptrace.h3
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/res_counter.h20
-rw-r--r--include/linux/rio_regs.h4
-rw-r--r--include/linux/rtc.h15
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/security.h13
-rw-r--r--include/linux/skbuff.h11
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/sunrpc/bc_xprt.h13
-rw-r--r--include/linux/sunrpc/svc_xprt.h1
-rw-r--r--include/linux/syscalls.h28
-rw-r--r--include/linux/sysctl.h14
-rw-r--r--include/linux/sysrq.h3
-rw-r--r--include/linux/thermal.h8
-rw-r--r--include/linux/tipc.h8
-rw-r--r--include/linux/tipc_config.h38
-rw-r--r--include/linux/tracepoint.h35
-rw-r--r--include/linux/usb/cdc.h23
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/msm_hsusb_hw.h4
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/virtio_config.h5
-rw-r--r--include/linux/virtio_console.h3
-rw-r--r--include/linux/workqueue.h8
-rw-r--r--include/linux/xfrm.h13
-rw-r--r--include/media/mt9v011.h17
-rw-r--r--include/media/rc-core.h3
-rw-r--r--include/media/saa7146.h2
-rw-r--r--include/media/v4l2-common.h13
-rw-r--r--include/media/v4l2-ctrls.h7
-rw-r--r--include/media/v4l2-subdev.h23
-rw-r--r--include/net/dcbnl.h9
-rw-r--r--include/net/dn.h6
-rw-r--r--include/net/dn_fib.h8
-rw-r--r--include/net/dn_route.h8
-rw-r--r--include/net/dst.h142
-rw-r--r--include/net/dst_ops.h1
-rw-r--r--include/net/flow.h204
-rw-r--r--include/net/genetlink.h3
-rw-r--r--include/net/icmp.h3
-rw-r--r--include/net/inet_sock.h31
-rw-r--r--include/net/inetpeer.h44
-rw-r--r--include/net/ip.h16
-rw-r--r--include/net/ip6_fib.h5
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h43
-rw-r--r--include/net/ip_vs.h315
-rw-r--r--include/net/ipv6.h40
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netevent.h1
-rw-r--r--include/net/netfilter/nf_conntrack.h23
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h15
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h6
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h2
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h65
-rw-r--r--include/net/netfilter/nf_nat.h6
-rw-r--r--include/net/netfilter/nf_nat_core.h4
-rw-r--r--include/net/netfilter/nf_tproxy_core.h12
-rw-r--r--include/net/netlink.h9
-rw-r--r--include/net/netns/conntrack.h4
-rw-r--r--include/net/netns/ip_vs.h143
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--include/net/phonet/pep.h23
-rw-r--r--include/net/phonet/phonet.h1
-rw-r--r--include/net/protocol.h4
-rw-r--r--include/net/route.h164
-rw-r--r--include/net/sch_generic.h70
-rw-r--r--include/net/sctp/user.h1
-rw-r--r--include/net/sock.h11
-rw-r--r--include/net/tcp.h16
-rw-r--r--include/net/transp_v6.h4
-rw-r--r--include/net/udp.h13
-rw-r--r--include/net/udplite.h12
-rw-r--r--include/net/xfrm.h213
-rw-r--r--include/pcmcia/ds.h1
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/sound/wm8903.h10
-rw-r--r--include/target/target_core_base.h28
-rw-r--r--include/target/target_core_transport.h2
-rw-r--r--include/trace/events/block.h6
-rw-r--r--include/trace/ftrace.h24
218 files changed, 4606 insertions, 986 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 17714beb868e..5b6c391efc8e 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 9cf736ea4691..fc1575fd4596 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index bc4a6deb73b0..ef1cef77d32b 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index a091cabca4b1..de39915f6b7f 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 65b3f5888f42..a3252a5ead66 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10/* 10/*
11 * Copyright (C) 2000 - 2010, Intel Corp. 11 * Copyright (C) 2000 - 2011, Intel Corp.
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 241b8a04c83c..e46ec95a8ada 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20101209 50#define ACPI_CA_VERSION 0x20110112
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index e5526354ba5e..0a66cc45dd6b 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index ad2001683ba7..7e42bfee0e29 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index cd77aa75c962..7504bc99b29b 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index d4136b28011f..0fc15dfb2e22 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 939a431a6ab6..64f838beaabf 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index a3e334ab1119..5af3ed52ef98 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 5dcb9537343c..e228893591a9 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 572189e37133..5d2a5e9544d9 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 31b6188df221..b4bfe338ea0e 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -4,6 +4,8 @@
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#ifdef CONFIG_MMU 5#ifdef CONFIG_MMU
6 6
7#include <linux/mm_types.h>
8
7#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 9#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
8extern int ptep_set_access_flags(struct vm_area_struct *vma, 10extern int ptep_set_access_flags(struct vm_area_struct *vma,
9 unsigned long address, pte_t *ptep, 11 unsigned long address, pte_t *ptep,
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 68649336c4ad..fe77e3395b40 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,7 +124,8 @@
124#endif 124#endif
125 125
126#ifdef CONFIG_EVENT_TRACING 126#ifdef CONFIG_EVENT_TRACING
127#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 127#define FTRACE_EVENTS() . = ALIGN(8); \
128 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
128 *(_ftrace_events) \ 129 *(_ftrace_events) \
129 VMLINUX_SYMBOL(__stop_ftrace_events) = .; 130 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
130#else 131#else
@@ -140,7 +141,8 @@
140#endif 141#endif
141 142
142#ifdef CONFIG_FTRACE_SYSCALLS 143#ifdef CONFIG_FTRACE_SYSCALLS
143#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ 144#define TRACE_SYSCALLS() . = ALIGN(8); \
145 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
144 *(__syscalls_metadata) \ 146 *(__syscalls_metadata) \
145 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; 147 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
146#else 148#else
@@ -165,10 +167,8 @@
165 CPU_KEEP(exit.data) \ 167 CPU_KEEP(exit.data) \
166 MEM_KEEP(init.data) \ 168 MEM_KEEP(init.data) \
167 MEM_KEEP(exit.data) \ 169 MEM_KEEP(exit.data) \
168 . = ALIGN(32); \ 170 STRUCT_ALIGN(); \
169 VMLINUX_SYMBOL(__start___tracepoints) = .; \
170 *(__tracepoints) \ 171 *(__tracepoints) \
171 VMLINUX_SYMBOL(__stop___tracepoints) = .; \
172 /* implement dynamic printk debug */ \ 172 /* implement dynamic printk debug */ \
173 . = ALIGN(8); \ 173 . = ALIGN(8); \
174 VMLINUX_SYMBOL(__start___verbose) = .; \ 174 VMLINUX_SYMBOL(__start___verbose) = .; \
@@ -176,13 +176,7 @@
176 VMLINUX_SYMBOL(__stop___verbose) = .; \ 176 VMLINUX_SYMBOL(__stop___verbose) = .; \
177 LIKELY_PROFILE() \ 177 LIKELY_PROFILE() \
178 BRANCH_PROFILE() \ 178 BRANCH_PROFILE() \
179 TRACE_PRINTKS() \ 179 TRACE_PRINTKS()
180 \
181 STRUCT_ALIGN(); \
182 FTRACE_EVENTS() \
183 \
184 STRUCT_ALIGN(); \
185 TRACE_SYSCALLS()
186 180
187/* 181/*
188 * Data section helpers 182 * Data section helpers
@@ -220,6 +214,10 @@
220 VMLINUX_SYMBOL(__start_rodata) = .; \ 214 VMLINUX_SYMBOL(__start_rodata) = .; \
221 *(.rodata) *(.rodata.*) \ 215 *(.rodata) *(.rodata.*) \
222 *(__vermagic) /* Kernel version magic */ \ 216 *(__vermagic) /* Kernel version magic */ \
217 . = ALIGN(8); \
218 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
219 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
220 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
223 *(__markers_strings) /* Markers: strings */ \ 221 *(__markers_strings) /* Markers: strings */ \
224 *(__tracepoints_strings)/* Tracepoints: strings */ \ 222 *(__tracepoints_strings)/* Tracepoints: strings */ \
225 } \ 223 } \
@@ -364,6 +362,13 @@
364 VMLINUX_SYMBOL(__start___param) = .; \ 362 VMLINUX_SYMBOL(__start___param) = .; \
365 *(__param) \ 363 *(__param) \
366 VMLINUX_SYMBOL(__stop___param) = .; \ 364 VMLINUX_SYMBOL(__stop___param) = .; \
365 } \
366 \
367 /* Built-in module versions. */ \
368 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
369 VMLINUX_SYMBOL(__start___modver) = .; \
370 *(__modver) \
371 VMLINUX_SYMBOL(__stop___modver) = .; \
367 . = ALIGN((align)); \ 372 . = ALIGN((align)); \
368 VMLINUX_SYMBOL(__end_rodata) = .; \ 373 VMLINUX_SYMBOL(__end_rodata) = .; \
369 } \ 374 } \
@@ -475,6 +480,8 @@
475 KERNEL_CTORS() \ 480 KERNEL_CTORS() \
476 *(.init.rodata) \ 481 *(.init.rodata) \
477 MCOUNT_REC() \ 482 MCOUNT_REC() \
483 FTRACE_EVENTS() \
484 TRACE_SYSCALLS() \
478 DEV_DISCARD(init.rodata) \ 485 DEV_DISCARD(init.rodata) \
479 CPU_DISCARD(init.rodata) \ 486 CPU_DISCARD(init.rodata) \
480 MEM_DISCARD(init.rodata) \ 487 MEM_DISCARD(init.rodata) \
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index a4694c610330..348843b80150 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1101,7 +1101,7 @@ struct drm_device {
1101 struct platform_device *platformdev; /**< Platform device struture */ 1101 struct platform_device *platformdev; /**< Platform device struture */
1102 1102
1103 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1103 struct drm_sg_mem *sg; /**< Scatter gather memory */
1104 int num_crtcs; /**< Number of CRTCs on this device */ 1104 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1105 void *dev_private; /**< device private data */ 1105 void *dev_private; /**< device private data */
1106 void *mm_private; 1106 void *mm_private;
1107 struct address_space *dev_mapping; 1107 struct address_space *dev_mapping;
@@ -1367,7 +1367,7 @@ extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
1367extern u32 drm_vblank_count(struct drm_device *dev, int crtc); 1367extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1368extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, 1368extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1369 struct timeval *vblanktime); 1369 struct timeval *vblanktime);
1370extern void drm_handle_vblank(struct drm_device *dev, int crtc); 1370extern bool drm_handle_vblank(struct drm_device *dev, int crtc);
1371extern int drm_vblank_get(struct drm_device *dev, int crtc); 1371extern int drm_vblank_get(struct drm_device *dev, int crtc);
1372extern void drm_vblank_put(struct drm_device *dev, int crtc); 1372extern void drm_vblank_put(struct drm_device *dev, int crtc);
1373extern void drm_vblank_off(struct drm_device *dev, int crtc); 1373extern void drm_vblank_off(struct drm_device *dev, int crtc);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index acd7fade160d..801be59f4f15 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -275,6 +275,7 @@ struct drm_pending_vblank_event;
275 275
276/** 276/**
277 * drm_crtc_funcs - control CRTCs for a given device 277 * drm_crtc_funcs - control CRTCs for a given device
278 * @reset: reset CRTC after state has been invalidate (e.g. resume)
278 * @dpms: control display power levels 279 * @dpms: control display power levels
279 * @save: save CRTC state 280 * @save: save CRTC state
280 * @resore: restore CRTC state 281 * @resore: restore CRTC state
@@ -302,6 +303,8 @@ struct drm_crtc_funcs {
302 void (*save)(struct drm_crtc *crtc); /* suspend? */ 303 void (*save)(struct drm_crtc *crtc); /* suspend? */
303 /* Restore CRTC state */ 304 /* Restore CRTC state */
304 void (*restore)(struct drm_crtc *crtc); /* resume? */ 305 void (*restore)(struct drm_crtc *crtc); /* resume? */
306 /* Reset CRTC state */
307 void (*reset)(struct drm_crtc *crtc);
305 308
306 /* cursor controls */ 309 /* cursor controls */
307 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 310 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
@@ -379,6 +382,7 @@ struct drm_crtc {
379 * @dpms: set power state (see drm_crtc_funcs above) 382 * @dpms: set power state (see drm_crtc_funcs above)
380 * @save: save connector state 383 * @save: save connector state
381 * @restore: restore connector state 384 * @restore: restore connector state
385 * @reset: reset connector after state has been invalidate (e.g. resume)
382 * @mode_valid: is this mode valid on the given connector? 386 * @mode_valid: is this mode valid on the given connector?
383 * @mode_fixup: try to fixup proposed mode for this connector 387 * @mode_fixup: try to fixup proposed mode for this connector
384 * @mode_set: set this mode 388 * @mode_set: set this mode
@@ -396,6 +400,7 @@ struct drm_connector_funcs {
396 void (*dpms)(struct drm_connector *connector, int mode); 400 void (*dpms)(struct drm_connector *connector, int mode);
397 void (*save)(struct drm_connector *connector); 401 void (*save)(struct drm_connector *connector);
398 void (*restore)(struct drm_connector *connector); 402 void (*restore)(struct drm_connector *connector);
403 void (*reset)(struct drm_connector *connector);
399 404
400 /* Check to see if anything is attached to the connector. 405 /* Check to see if anything is attached to the connector.
401 * @force is set to false whilst polling, true when checking the 406 * @force is set to false whilst polling, true when checking the
@@ -413,6 +418,7 @@ struct drm_connector_funcs {
413}; 418};
414 419
415struct drm_encoder_funcs { 420struct drm_encoder_funcs {
421 void (*reset)(struct drm_encoder *encoder);
416 void (*destroy)(struct drm_encoder *encoder); 422 void (*destroy)(struct drm_encoder *encoder);
417}; 423};
418 424
@@ -656,6 +662,7 @@ extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
656 struct drm_display_mode *mode); 662 struct drm_display_mode *mode);
657extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 663extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
658extern void drm_mode_config_init(struct drm_device *dev); 664extern void drm_mode_config_init(struct drm_device *dev);
665extern void drm_mode_config_reset(struct drm_device *dev);
659extern void drm_mode_config_cleanup(struct drm_device *dev); 666extern void drm_mode_config_cleanup(struct drm_device *dev);
660extern void drm_mode_set_name(struct drm_display_mode *mode); 667extern void drm_mode_set_name(struct drm_display_mode *mode);
661extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); 668extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index fe29ae328bd9..5ff1194dc2ea 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -28,7 +28,6 @@
28 {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ 28 {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
29 {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \ 29 {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \
30 {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ 30 {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
31 {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
32 {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 31 {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
33 {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 32 {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
34 {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 33 {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index e95a86b8b689..e5c607a02d57 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -907,6 +907,7 @@ struct drm_radeon_cs {
907#define RADEON_INFO_TILING_CONFIG 0x06 907#define RADEON_INFO_TILING_CONFIG 0x06
908#define RADEON_INFO_WANT_HYPERZ 0x07 908#define RADEON_INFO_WANT_HYPERZ 0x07
909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ 909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */
910#define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */
910 911
911struct drm_radeon_info { 912struct drm_radeon_info {
912 uint32_t request; 913 uint32_t request;
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
index 5cb86c307f5d..fc4875433817 100644
--- a/include/keys/rxrpc-type.h
+++ b/include/keys/rxrpc-type.h
@@ -99,7 +99,6 @@ struct rxrpc_key_token {
99 * structure of raw payloads passed to add_key() or instantiate key 99 * structure of raw payloads passed to add_key() or instantiate key
100 */ 100 */
101struct rxrpc_key_data_v1 { 101struct rxrpc_key_data_v1 {
102 u32 kif_version; /* 1 */
103 u16 security_index; 102 u16 security_index;
104 u16 ticket_length; 103 u16 ticket_length;
105 u32 expiry; /* time_t */ 104 u32 expiry; /* time_t */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2296d8b1931f..b0ada6f37dd6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,5 +1,6 @@
1header-y += byteorder/ 1header-y += byteorder/
2header-y += can/ 2header-y += can/
3header-y += caif/
3header-y += dvb/ 4header-y += dvb/
4header-y += hdlc/ 5header-y += hdlc/
5header-y += isdn/ 6header-y += isdn/
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index eb176bb1b15b..a2e910e01293 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -306,9 +306,6 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 306 u32 *mask, u32 req);
307extern void acpi_early_init(void); 307extern void acpi_early_init(void);
308 308
309int acpi_os_map_generic_address(struct acpi_generic_address *addr);
310void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
311
312#else /* !CONFIG_ACPI */ 309#else /* !CONFIG_ACPI */
313 310
314#define acpi_disabled 1 311#define acpi_disabled 1
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
new file mode 100644
index 000000000000..7180013a4a3a
--- /dev/null
+++ b/include/linux/acpi_io.h
@@ -0,0 +1,16 @@
1#ifndef _ACPI_IO_H_
2#define _ACPI_IO_H_
3
4#include <linux/io.h>
5#include <acpi/acpi.h>
6
7static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
8 acpi_size size)
9{
10 return ioremap_cache(phys, size);
11}
12
13int acpi_os_map_generic_address(struct acpi_generic_address *addr);
14void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
15
16#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 359df0487690..9d339eb27881 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,6 +103,8 @@
103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ 103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ 104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ 105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
106#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
107#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
106 108
107#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 109#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
108#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 110#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4d18ff34670a..d5063e1b5555 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -699,7 +699,7 @@ extern void blk_start_queue(struct request_queue *q);
699extern void blk_stop_queue(struct request_queue *q); 699extern void blk_stop_queue(struct request_queue *q);
700extern void blk_sync_queue(struct request_queue *q); 700extern void blk_sync_queue(struct request_queue *q);
701extern void __blk_stop_queue(struct request_queue *q); 701extern void __blk_stop_queue(struct request_queue *q);
702extern void __blk_run_queue(struct request_queue *); 702extern void __blk_run_queue(struct request_queue *q, bool force_kblockd);
703extern void blk_run_queue(struct request_queue *); 703extern void blk_run_queue(struct request_queue *);
704extern int blk_rq_map_user(struct request_queue *, struct request *, 704extern int blk_rq_map_user(struct request_queue *, struct request *,
705 struct rq_map_data *, void __user *, unsigned long, 705 struct rq_map_data *, void __user *, unsigned long,
@@ -1088,7 +1088,6 @@ static inline void put_dev_sector(Sector p)
1088 1088
1089struct work_struct; 1089struct work_struct;
1090int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1090int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1091int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
1092 1091
1093#ifdef CONFIG_BLK_CGROUP 1092#ifdef CONFIG_BLK_CGROUP
1094/* 1093/*
@@ -1136,7 +1135,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1136extern int blk_throtl_init(struct request_queue *q); 1135extern int blk_throtl_init(struct request_queue *q);
1137extern void blk_throtl_exit(struct request_queue *q); 1136extern void blk_throtl_exit(struct request_queue *q);
1138extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); 1137extern int blk_throtl_bio(struct request_queue *q, struct bio **bio);
1139extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay);
1140extern void throtl_shutdown_timer_wq(struct request_queue *q); 1138extern void throtl_shutdown_timer_wq(struct request_queue *q);
1141#else /* CONFIG_BLK_DEV_THROTTLING */ 1139#else /* CONFIG_BLK_DEV_THROTTLING */
1142static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) 1140static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
@@ -1146,7 +1144,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1146 1144
1147static inline int blk_throtl_init(struct request_queue *q) { return 0; } 1145static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1148static inline int blk_throtl_exit(struct request_queue *q) { return 0; } 1146static inline int blk_throtl_exit(struct request_queue *q) { return 0; }
1149static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {}
1150static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} 1147static inline void throtl_shutdown_timer_wq(struct request_queue *q) {}
1151#endif /* CONFIG_BLK_DEV_THROTTLING */ 1148#endif /* CONFIG_BLK_DEV_THROTTLING */
1152 1149
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 3395cf7130f5..b22fb0d3db0f 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -245,7 +245,6 @@ static inline int blk_cmd_buf_len(struct request *rq)
245 245
246extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
247extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); 247extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes);
248extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq);
249 248
250#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ 249#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */
251 250
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild
new file mode 100644
index 000000000000..a9cf250689dc
--- /dev/null
+++ b/include/linux/caif/Kbuild
@@ -0,0 +1,2 @@
1header-y += caif_socket.h
2header-y += if_caif.h
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index c3011beac30d..31d91a64838b 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -123,6 +123,7 @@ struct ceph_msg_pos {
123#define SOCK_CLOSED 11 /* socket state changed to closed */ 123#define SOCK_CLOSED 11 /* socket state changed to closed */
124#define OPENING 13 /* open connection w/ (possibly new) peer */ 124#define OPENING 13 /* open connection w/ (possibly new) peer */
125#define DEAD 14 /* dead, about to kfree */ 125#define DEAD 14 /* dead, about to kfree */
126#define BACKOFF 15
126 127
127/* 128/*
128 * A single connection with another host. 129 * A single connection with another host.
@@ -160,7 +161,6 @@ struct ceph_connection {
160 struct list_head out_queue; 161 struct list_head out_queue;
161 struct list_head out_sent; /* sending or sent but unacked */ 162 struct list_head out_sent; /* sending or sent but unacked */
162 u64 out_seq; /* last message queued for send */ 163 u64 out_seq; /* last message queued for send */
163 bool out_keepalive_pending;
164 164
165 u64 in_seq, in_seq_acked; /* last message received, acked */ 165 u64 in_seq, in_seq_acked; /* last message received, acked */
166 166
diff --git a/include/linux/console.h b/include/linux/console.h
index 9774fe6a1a97..7453cfd593c8 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -139,9 +139,9 @@ extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_n
139extern void register_console(struct console *); 139extern void register_console(struct console *);
140extern int unregister_console(struct console *); 140extern int unregister_console(struct console *);
141extern struct console *console_drivers; 141extern struct console *console_drivers;
142extern void acquire_console_sem(void); 142extern void console_lock(void);
143extern int try_acquire_console_sem(void); 143extern int console_trylock(void);
144extern void release_console_sem(void); 144extern void console_unlock(void);
145extern void console_conditional_schedule(void); 145extern void console_conditional_schedule(void);
146extern void console_unblank(void); 146extern void console_unblank(void);
147extern struct tty_driver *console_device(int *); 147extern struct tty_driver *console_device(int *);
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
new file mode 100644
index 000000000000..473771a528c0
--- /dev/null
+++ b/include/linux/cpu_rmap.h
@@ -0,0 +1,73 @@
1/*
2 * cpu_rmap.c: CPU affinity reverse-map support
3 * Copyright 2011 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#include <linux/cpumask.h>
11#include <linux/gfp.h>
12#include <linux/slab.h>
13
14/**
15 * struct cpu_rmap - CPU affinity reverse-map
16 * @size: Number of objects to be reverse-mapped
17 * @used: Number of objects added
18 * @obj: Pointer to array of object pointers
19 * @near: For each CPU, the index and distance to the nearest object,
20 * based on affinity masks
21 */
22struct cpu_rmap {
23 u16 size, used;
24 void **obj;
25 struct {
26 u16 index;
27 u16 dist;
28 } near[0];
29};
30#define CPU_RMAP_DIST_INF 0xffff
31
32extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
33
34/**
35 * free_cpu_rmap - free CPU affinity reverse-map
36 * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL
37 */
38static inline void free_cpu_rmap(struct cpu_rmap *rmap)
39{
40 kfree(rmap);
41}
42
43extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
44extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
45 const struct cpumask *affinity);
46
47static inline u16 cpu_rmap_lookup_index(struct cpu_rmap *rmap, unsigned int cpu)
48{
49 return rmap->near[cpu].index;
50}
51
52static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
53{
54 return rmap->obj[rmap->near[cpu].index];
55}
56
57#ifdef CONFIG_GENERIC_HARDIRQS
58
59/**
60 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
61 * @size: Number of objects to be mapped
62 *
63 * Must be called in process context.
64 */
65static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size)
66{
67 return alloc_cpu_rmap(size, GFP_KERNEL);
68}
69extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
70
71extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
72
73#endif
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 68cd248f6d3e..c52280047e2c 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2008, Intel Corporation. 2 * Copyright (c) 2008-2011, Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -25,9 +25,14 @@
25/* IEEE 802.1Qaz std supported values */ 25/* IEEE 802.1Qaz std supported values */
26#define IEEE_8021QAZ_MAX_TCS 8 26#define IEEE_8021QAZ_MAX_TCS 8
27 27
28#define IEEE_8021QAZ_TSA_STRICT 0
29#define IEEE_8021QAZ_TSA_CB_SHAPER 1
30#define IEEE_8021QAZ_TSA_ETS 2
31#define IEEE_8021QAZ_TSA_VENDOR 255
32
28/* This structure contains the IEEE 802.1Qaz ETS managed object 33/* This structure contains the IEEE 802.1Qaz ETS managed object
29 * 34 *
30 * @willing: willing bit in ETS configuratin TLV 35 * @willing: willing bit in ETS configuration TLV
31 * @ets_cap: indicates supported capacity of ets feature 36 * @ets_cap: indicates supported capacity of ets feature
32 * @cbs: credit based shaper ets algorithm supported 37 * @cbs: credit based shaper ets algorithm supported
33 * @tc_tx_bw: tc tx bandwidth indexed by traffic class 38 * @tc_tx_bw: tc tx bandwidth indexed by traffic class
@@ -82,6 +87,50 @@ struct ieee_pfc {
82 __u64 indications[IEEE_8021QAZ_MAX_TCS]; 87 __u64 indications[IEEE_8021QAZ_MAX_TCS];
83}; 88};
84 89
90/* CEE DCBX std supported values */
91#define CEE_DCBX_MAX_PGS 8
92#define CEE_DCBX_MAX_PRIO 8
93
94/**
95 * struct cee_pg - CEE Priority-Group managed object
96 *
97 * @willing: willing bit in the PG tlv
98 * @error: error bit in the PG tlv
99 * @pg_en: enable bit of the PG feature
100 * @tcs_supported: number of traffic classes supported
101 * @pg_bw: bandwidth percentage for each priority group
102 * @prio_pg: priority to PG mapping indexed by priority
103 */
104struct cee_pg {
105 __u8 willing;
106 __u8 error;
107 __u8 pg_en;
108 __u8 tcs_supported;
109 __u8 pg_bw[CEE_DCBX_MAX_PGS];
110 __u8 prio_pg[CEE_DCBX_MAX_PGS];
111};
112
113/**
114 * struct cee_pfc - CEE PFC managed object
115 *
116 * @willing: willing bit in the PFC tlv
117 * @error: error bit in the PFC tlv
118 * @pfc_en: bitmap indicating pfc enabled traffic classes
119 * @tcs_supported: number of traffic classes supported
120 */
121struct cee_pfc {
122 __u8 willing;
123 __u8 error;
124 __u8 pfc_en;
125 __u8 tcs_supported;
126};
127
128/* IEEE 802.1Qaz std supported values */
129#define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1
130#define IEEE_8021QAZ_APP_SEL_STREAM 2
131#define IEEE_8021QAZ_APP_SEL_DGRAM 3
132#define IEEE_8021QAZ_APP_SEL_ANY 4
133
85/* This structure contains the IEEE 802.1Qaz APP managed object. This 134/* This structure contains the IEEE 802.1Qaz APP managed object. This
86 * object is also used for the CEE std as well. There is no difference 135 * object is also used for the CEE std as well. There is no difference
87 * between the objects. 136 * between the objects.
@@ -101,8 +150,22 @@ struct ieee_pfc {
101 */ 150 */
102struct dcb_app { 151struct dcb_app {
103 __u8 selector; 152 __u8 selector;
104 __u32 protocol;
105 __u8 priority; 153 __u8 priority;
154 __u16 protocol;
155};
156
157/**
158 * struct dcb_peer_app_info - APP feature information sent by the peer
159 *
160 * @willing: willing bit in the peer APP tlv
161 * @error: error bit in the peer APP tlv
162 *
163 * In addition to this information the full peer APP tlv also contains
164 * a table of 'app_count' APP objects defined above.
165 */
166struct dcb_peer_app_info {
167 __u8 willing;
168 __u8 error;
106}; 169};
107 170
108struct dcbmsg { 171struct dcbmsg {
@@ -139,6 +202,7 @@ struct dcbmsg {
139 * @DCB_CMD_SDCBX: set DCBX engine configuration 202 * @DCB_CMD_SDCBX: set DCBX engine configuration
140 * @DCB_CMD_GFEATCFG: get DCBX features flags 203 * @DCB_CMD_GFEATCFG: get DCBX features flags
141 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags 204 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
205 * @DCB_CMD_CEE_GET: get CEE aggregated configuration
142 */ 206 */
143enum dcbnl_commands { 207enum dcbnl_commands {
144 DCB_CMD_UNDEFINED, 208 DCB_CMD_UNDEFINED,
@@ -181,6 +245,8 @@ enum dcbnl_commands {
181 DCB_CMD_GFEATCFG, 245 DCB_CMD_GFEATCFG,
182 DCB_CMD_SFEATCFG, 246 DCB_CMD_SFEATCFG,
183 247
248 DCB_CMD_CEE_GET,
249
184 __DCB_CMD_ENUM_MAX, 250 __DCB_CMD_ENUM_MAX,
185 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 251 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
186}; 252};
@@ -203,6 +269,7 @@ enum dcbnl_commands {
203 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) 269 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
204 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) 270 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
205 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) 271 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
272 * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED)
206 */ 273 */
207enum dcbnl_attrs { 274enum dcbnl_attrs {
208 DCB_ATTR_UNDEFINED, 275 DCB_ATTR_UNDEFINED,
@@ -226,15 +293,32 @@ enum dcbnl_attrs {
226 DCB_ATTR_DCBX, 293 DCB_ATTR_DCBX,
227 DCB_ATTR_FEATCFG, 294 DCB_ATTR_FEATCFG,
228 295
296 /* CEE nested attributes */
297 DCB_ATTR_CEE,
298
229 __DCB_ATTR_ENUM_MAX, 299 __DCB_ATTR_ENUM_MAX,
230 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 300 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
231}; 301};
232 302
303/**
304 * enum ieee_attrs - IEEE 802.1Qaz get/set attributes
305 *
306 * @DCB_ATTR_IEEE_UNSPEC: unspecified
307 * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration
308 * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration
309 * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration
310 * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only
311 * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only
312 * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only
313 */
233enum ieee_attrs { 314enum ieee_attrs {
234 DCB_ATTR_IEEE_UNSPEC, 315 DCB_ATTR_IEEE_UNSPEC,
235 DCB_ATTR_IEEE_ETS, 316 DCB_ATTR_IEEE_ETS,
236 DCB_ATTR_IEEE_PFC, 317 DCB_ATTR_IEEE_PFC,
237 DCB_ATTR_IEEE_APP_TABLE, 318 DCB_ATTR_IEEE_APP_TABLE,
319 DCB_ATTR_IEEE_PEER_ETS,
320 DCB_ATTR_IEEE_PEER_PFC,
321 DCB_ATTR_IEEE_PEER_APP,
238 __DCB_ATTR_IEEE_MAX 322 __DCB_ATTR_IEEE_MAX
239}; 323};
240#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 324#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
@@ -247,6 +331,31 @@ enum ieee_attrs_app {
247#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) 331#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
248 332
249/** 333/**
334 * enum cee_attrs - CEE DCBX get attributes
335 *
336 * @DCB_ATTR_CEE_UNSPEC: unspecified
337 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
338 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
339 * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only
340 */
341enum cee_attrs {
342 DCB_ATTR_CEE_UNSPEC,
343 DCB_ATTR_CEE_PEER_PG,
344 DCB_ATTR_CEE_PEER_PFC,
345 DCB_ATTR_CEE_PEER_APP_TABLE,
346 __DCB_ATTR_CEE_MAX
347};
348#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
349
350enum peer_app_attr {
351 DCB_ATTR_CEE_PEER_APP_UNSPEC,
352 DCB_ATTR_CEE_PEER_APP_INFO,
353 DCB_ATTR_CEE_PEER_APP,
354 __DCB_ATTR_CEE_PEER_APP_MAX
355};
356#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
357
358/**
250 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs 359 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
251 * 360 *
252 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors 361 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 010e2d87ed75..d638e85dc501 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -279,8 +279,6 @@ enum dccp_state {
279 DCCP_MAX_STATES 279 DCCP_MAX_STATES
280}; 280};
281 281
282#define DCCP_STATE_MASK 0x1f
283
284enum { 282enum {
285 DCCPF_OPEN = TCPF_ESTABLISHED, 283 DCCPF_OPEN = TCPF_ESTABLISHED,
286 DCCPF_REQUESTING = TCPF_SYN_SENT, 284 DCCPF_REQUESTING = TCPF_SYN_SENT,
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 1908929204a9..aac3e2eeb4fd 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -251,6 +251,7 @@ enum ethtool_stringset {
251 ETH_SS_STATS, 251 ETH_SS_STATS,
252 ETH_SS_PRIV_FLAGS, 252 ETH_SS_PRIV_FLAGS,
253 ETH_SS_NTUPLE_FILTERS, 253 ETH_SS_NTUPLE_FILTERS,
254 ETH_SS_FEATURES,
254}; 255};
255 256
256/* for passing string sets for data tagging */ 257/* for passing string sets for data tagging */
@@ -523,6 +524,92 @@ struct ethtool_flash {
523 char data[ETHTOOL_FLASH_MAX_FILENAME]; 524 char data[ETHTOOL_FLASH_MAX_FILENAME];
524}; 525};
525 526
527/* for returning and changing feature sets */
528
529/**
530 * struct ethtool_get_features_block - block with state of 32 features
531 * @available: mask of changeable features
532 * @requested: mask of features requested to be enabled if possible
533 * @active: mask of currently enabled features
534 * @never_changed: mask of features not changeable for any device
535 */
536struct ethtool_get_features_block {
537 __u32 available;
538 __u32 requested;
539 __u32 active;
540 __u32 never_changed;
541};
542
543/**
544 * struct ethtool_gfeatures - command to get state of device's features
545 * @cmd: command number = %ETHTOOL_GFEATURES
546 * @size: in: number of elements in the features[] array;
547 * out: number of elements in features[] needed to hold all features
548 * @features: state of features
549 */
550struct ethtool_gfeatures {
551 __u32 cmd;
552 __u32 size;
553 struct ethtool_get_features_block features[0];
554};
555
556/**
557 * struct ethtool_set_features_block - block with request for 32 features
558 * @valid: mask of features to be changed
559 * @requested: values of features to be changed
560 */
561struct ethtool_set_features_block {
562 __u32 valid;
563 __u32 requested;
564};
565
566/**
567 * struct ethtool_sfeatures - command to request change in device's features
568 * @cmd: command number = %ETHTOOL_SFEATURES
569 * @size: array size of the features[] array
570 * @features: feature change masks
571 */
572struct ethtool_sfeatures {
573 __u32 cmd;
574 __u32 size;
575 struct ethtool_set_features_block features[0];
576};
577
578/*
579 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
580 * values of corresponding bits in features[].requested. Bits in .requested
581 * not set in .valid or not changeable are ignored.
582 *
583 * Returns %EINVAL when .valid contains undefined or never-changable bits
584 * or size is not equal to required number of features words (32-bit blocks).
585 * Returns >= 0 if request was completed; bits set in the value mean:
586 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
587 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
588 * those bits were ignored.
589 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
590 * resulting state of bits masked by .valid is not equal to .requested.
591 * Probably there are other device-specific constraints on some features
592 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
593 * here as though ignored bits were cleared.
594 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
595 * compatibility functions. Requested offload state cannot be properly
596 * managed by kernel.
597 *
598 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
599 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
600 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
601 * significant bit in features[0] fields. Empty strings mark undefined features.
602 */
603enum ethtool_sfeatures_retval_bits {
604 ETHTOOL_F_UNSUPPORTED__BIT,
605 ETHTOOL_F_WISH__BIT,
606 ETHTOOL_F_COMPAT__BIT,
607};
608
609#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
610#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
611#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
612
526#ifdef __KERNEL__ 613#ifdef __KERNEL__
527 614
528#include <linux/rculist.h> 615#include <linux/rculist.h>
@@ -543,7 +630,6 @@ struct net_device;
543 630
544/* Some generic methods drivers may use in their ethtool_ops */ 631/* Some generic methods drivers may use in their ethtool_ops */
545u32 ethtool_op_get_link(struct net_device *dev); 632u32 ethtool_op_get_link(struct net_device *dev);
546u32 ethtool_op_get_rx_csum(struct net_device *dev);
547u32 ethtool_op_get_tx_csum(struct net_device *dev); 633u32 ethtool_op_get_tx_csum(struct net_device *dev);
548int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 634int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
549int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 635int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
@@ -744,6 +830,9 @@ struct ethtool_ops {
744#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 830#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
745#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 831#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
746 832
833#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
834#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
835
747/* compatibility with older code */ 836/* compatibility with older code */
748#define SPARC_ETH_GSET ETHTOOL_GSET 837#define SPARC_ETH_GSET ETHTOOL_GSET
749#define SPARC_ETH_SSET ETHTOOL_SSET 838#define SPARC_ETH_SSET ETHTOOL_SSET
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index da7e52b099f3..1effc8b56b4e 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -109,7 +109,7 @@ static inline void freezer_count(void)
109} 109}
110 110
111/* 111/*
112 * Check if the task should be counted as freezeable by the freezer 112 * Check if the task should be counted as freezable by the freezer
113 */ 113 */
114static inline int freezer_should_skip(struct task_struct *p) 114static inline int freezer_should_skip(struct task_struct *p)
115{ 115{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 32b38cd829d3..e38b50a4b9d2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -649,6 +649,7 @@ struct address_space {
649 spinlock_t private_lock; /* for use by the address_space */ 649 spinlock_t private_lock; /* for use by the address_space */
650 struct list_head private_list; /* ditto */ 650 struct list_head private_list; /* ditto */
651 struct address_space *assoc_mapping; /* ditto */ 651 struct address_space *assoc_mapping; /* ditto */
652 struct mutex unmap_mutex; /* to protect unmapping */
652} __attribute__((aligned(sizeof(long)))); 653} __attribute__((aligned(sizeof(long))));
653 /* 654 /*
654 * On most architectures that alignment is already the case; but 655 * On most architectures that alignment is already the case; but
@@ -2139,7 +2140,7 @@ extern void check_disk_size_change(struct gendisk *disk,
2139 struct block_device *bdev); 2140 struct block_device *bdev);
2140extern int revalidate_disk(struct gendisk *); 2141extern int revalidate_disk(struct gendisk *);
2141extern int check_disk_change(struct block_device *); 2142extern int check_disk_change(struct block_device *);
2142extern int __invalidate_device(struct block_device *); 2143extern int __invalidate_device(struct block_device *, bool);
2143extern int invalidate_partition(struct gendisk *, int); 2144extern int invalidate_partition(struct gendisk *, int);
2144#endif 2145#endif
2145unsigned long invalidate_mapping_pages(struct address_space *mapping, 2146unsigned long invalidate_mapping_pages(struct address_space *mapping,
@@ -2225,6 +2226,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
2225 2226
2226extern int inode_init_always(struct super_block *, struct inode *); 2227extern int inode_init_always(struct super_block *, struct inode *);
2227extern void inode_init_once(struct inode *); 2228extern void inode_init_once(struct inode *);
2229extern void address_space_init_once(struct address_space *mapping);
2228extern void ihold(struct inode * inode); 2230extern void ihold(struct inode * inode);
2229extern void iput(struct inode *); 2231extern void iput(struct inode *);
2230extern struct inode * igrab(struct inode *); 2232extern struct inode * igrab(struct inode *);
@@ -2555,9 +2557,12 @@ int proc_nr_inodes(struct ctl_table *table, int write,
2555 void __user *buffer, size_t *lenp, loff_t *ppos); 2557 void __user *buffer, size_t *lenp, loff_t *ppos);
2556int __init get_filesystem_list(char *buf); 2558int __init get_filesystem_list(char *buf);
2557 2559
2560#define __FMODE_EXEC ((__force int) FMODE_EXEC)
2561#define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY)
2562
2558#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2563#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2559#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2564#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2560 (flag & FMODE_NONOTIFY))) 2565 (flag & __FMODE_NONOTIFY)))
2561 2566
2562#endif /* __KERNEL__ */ 2567#endif /* __KERNEL__ */
2563#endif /* _LINUX_FS_H */ 2568#endif /* _LINUX_FS_H */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index a3b148a91874..dca31761b311 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -249,7 +249,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
249 ((1 << ZONES_SHIFT) - 1); 249 ((1 << ZONES_SHIFT) - 1);
250 250
251 if (__builtin_constant_p(bit)) 251 if (__builtin_constant_p(bit))
252 MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 252 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
253 else { 253 else {
254#ifdef CONFIG_DEBUG_VM 254#ifdef CONFIG_DEBUG_VM
255 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 255 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
@@ -332,16 +332,19 @@ alloc_pages(gfp_t gfp_mask, unsigned int order)
332 return alloc_pages_current(gfp_mask, order); 332 return alloc_pages_current(gfp_mask, order);
333} 333}
334extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, 334extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
335 struct vm_area_struct *vma, unsigned long addr); 335 struct vm_area_struct *vma, unsigned long addr,
336 int node);
336#else 337#else
337#define alloc_pages(gfp_mask, order) \ 338#define alloc_pages(gfp_mask, order) \
338 alloc_pages_node(numa_node_id(), gfp_mask, order) 339 alloc_pages_node(numa_node_id(), gfp_mask, order)
339#define alloc_pages_vma(gfp_mask, order, vma, addr) \ 340#define alloc_pages_vma(gfp_mask, order, vma, addr, node) \
340 alloc_pages(gfp_mask, order) 341 alloc_pages(gfp_mask, order)
341#endif 342#endif
342#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 343#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
343#define alloc_page_vma(gfp_mask, vma, addr) \ 344#define alloc_page_vma(gfp_mask, vma, addr) \
344 alloc_pages_vma(gfp_mask, 0, vma, addr) 345 alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id())
346#define alloc_page_vma_node(gfp_mask, vma, addr, node) \
347 alloc_pages_vma(gfp_mask, 0, vma, addr, node)
345 348
346extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 349extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
347extern unsigned long get_zeroed_page(gfp_t gfp_mask); 350extern unsigned long get_zeroed_page(gfp_t gfp_mask);
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 8e6c8c42bc3c..df29c8fde36b 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -57,7 +57,8 @@ extern pmd_t *page_check_address_pmd(struct page *page,
57 (transparent_hugepage_flags & \ 57 (transparent_hugepage_flags & \
58 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \ 58 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \
59 ((__vma)->vm_flags & VM_HUGEPAGE))) && \ 59 ((__vma)->vm_flags & VM_HUGEPAGE))) && \
60 !((__vma)->vm_flags & VM_NOHUGEPAGE)) 60 !((__vma)->vm_flags & VM_NOHUGEPAGE) && \
61 !is_vma_temporary_stack(__vma))
61#define transparent_hugepage_defrag(__vma) \ 62#define transparent_hugepage_defrag(__vma) \
62 ((transparent_hugepage_flags & \ 63 ((transparent_hugepage_flags & \
63 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)) || \ 64 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)) || \
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 4c4c74ec5987..ba45e6bc0764 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -183,10 +183,10 @@ extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 u8 code, int pos); 184 u8 code, int pos);
185 185
186struct flowi; 186struct flowi6;
187struct in6_addr; 187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk, 188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl, 189 struct flowi6 *fl6,
190 u8 type, 190 u8 type,
191 const struct in6_addr *saddr, 191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr, 192 const struct in6_addr *daddr,
diff --git a/include/linux/if.h b/include/linux/if.h
index 123959927745..3bc63e6a02f7 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,11 +71,10 @@
71 * release skb->dst 71 * release skb->dst
72 */ 72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */ 74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */ 75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
76#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */ 76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */ 77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
79 * datapath port */ 78 * datapath port */
80 79
81#define IF_GET_IFACE 0x0001 /* for querying only */ 80#define IF_GET_IFACE 0x0001 /* for querying only */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 6485d2a89bec..f4a2e6b1b864 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -135,6 +135,7 @@ enum {
135 IFLA_VF_PORTS, 135 IFLA_VF_PORTS,
136 IFLA_PORT_SELF, 136 IFLA_PORT_SELF,
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */
138 __IFLA_MAX 139 __IFLA_MAX
139}; 140};
140 141
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 74cfcff0148b..82de336b8155 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -217,7 +217,7 @@ struct ip_mc_list {
217#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 217#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
218#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) 218#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
219 219
220extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); 220extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
221extern int igmp_rcv(struct sk_buff *); 221extern int igmp_rcv(struct sk_buff *);
222extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); 222extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
223extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); 223extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ae8fdc54e0c0..5f8146695b7f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -144,6 +144,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
145 145
146struct in_ifaddr { 146struct in_ifaddr {
147 struct hlist_node hash;
147 struct in_ifaddr *ifa_next; 148 struct in_ifaddr *ifa_next;
148 struct in_device *ifa_dev; 149 struct in_device *ifa_dev;
149 struct rcu_head rcu_head; 150 struct rcu_head rcu_head;
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h
index e470d387dd49..05e03284b92a 100644
--- a/include/linux/input/bu21013.h
+++ b/include/linux/input/bu21013.h
@@ -12,8 +12,6 @@
12 * @cs_en: pointer to the cs enable function 12 * @cs_en: pointer to the cs enable function
13 * @cs_dis: pointer to the cs disable function 13 * @cs_dis: pointer to the cs disable function
14 * @irq_read_val: pointer to read the pen irq value function 14 * @irq_read_val: pointer to read the pen irq value function
15 * @x_max_res: xmax resolution
16 * @y_max_res: ymax resolution
17 * @touch_x_max: touch x max 15 * @touch_x_max: touch x max
18 * @touch_y_max: touch y max 16 * @touch_y_max: touch y max
19 * @cs_pin: chip select pin 17 * @cs_pin: chip select pin
@@ -29,8 +27,6 @@ struct bu21013_platform_device {
29 int (*cs_en)(int reset_pin); 27 int (*cs_en)(int reset_pin);
30 int (*cs_dis)(int reset_pin); 28 int (*cs_dis)(int reset_pin);
31 int (*irq_read_val)(void); 29 int (*irq_read_val)(void);
32 int x_max_res;
33 int y_max_res;
34 int touch_x_max; 30 int touch_x_max;
35 int touch_y_max; 31 int touch_y_max;
36 unsigned int cs_pin; 32 unsigned int cs_pin;
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 697474691749..fe7c4b9ae270 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -4,8 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/input.h> 5#include <linux/input.h>
6 6
7#define MATRIX_MAX_ROWS 16 7#define MATRIX_MAX_ROWS 32
8#define MATRIX_MAX_COLS 16 8#define MATRIX_MAX_COLS 32
9 9
10#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ 10#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ 11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 55e0d4253e49..63c5ad78e37c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,6 +14,8 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/percpu.h> 15#include <linux/percpu.h>
16#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
17#include <linux/kref.h>
18#include <linux/workqueue.h>
17 19
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/ptrace.h> 21#include <asm/ptrace.h>
@@ -240,6 +242,35 @@ extern int irq_can_set_affinity(unsigned int irq);
240extern int irq_select_affinity(unsigned int irq); 242extern int irq_select_affinity(unsigned int irq);
241 243
242extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 244extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
245
246/**
247 * struct irq_affinity_notify - context for notification of IRQ affinity changes
248 * @irq: Interrupt to which notification applies
249 * @kref: Reference count, for internal use
250 * @work: Work item, for internal use
251 * @notify: Function to be called on change. This will be
252 * called in process context.
253 * @release: Function to be called on release. This will be
254 * called in process context. Once registered, the
255 * structure must only be freed when this function is
256 * called or later.
257 */
258struct irq_affinity_notify {
259 unsigned int irq;
260 struct kref kref;
261 struct work_struct work;
262 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
263 void (*release)(struct kref *ref);
264};
265
266extern int
267irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
268
269static inline void irq_run_affinity_notifiers(void)
270{
271 flush_scheduled_work();
272}
273
243#else /* CONFIG_SMP */ 274#else /* CONFIG_SMP */
244 275
245static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 276static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -255,7 +286,7 @@ static inline int irq_can_set_affinity(unsigned int irq)
255static inline int irq_select_affinity(unsigned int irq) { return 0; } 286static inline int irq_select_affinity(unsigned int irq) { return 0; }
256 287
257static inline int irq_set_affinity_hint(unsigned int irq, 288static inline int irq_set_affinity_hint(unsigned int irq,
258 const struct cpumask *m) 289 const struct cpumask *m)
259{ 290{
260 return -EINVAL; 291 return -EINVAL;
261} 292}
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 5f43a3b2e3ad..4deb3834d62c 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,14 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \
95 IP_VS_CONN_F_SEQ_MASK | \
96 IP_VS_CONN_F_NO_CPORT | \
97 IP_VS_CONN_F_TEMPLATE \
98 )
99
92/* Flags that are not sent to backup server start from bit 16 */ 100/* Flags that are not sent to backup server start from bit 16 */
93#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
94 102
diff --git a/include/linux/irq.h b/include/linux/irq.h
index abde2527c699..80fcb53057bc 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -74,7 +74,8 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
74 74
75#define IRQF_MODIFY_MASK \ 75#define IRQF_MODIFY_MASK \
76 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ 76 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
77 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL) 77 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
78 IRQ_PER_CPU)
78 79
79#ifdef CONFIG_IRQ_PER_CPU 80#ifdef CONFIG_IRQ_PER_CPU
80# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 81# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 6a64c6fa81af..bfef56dadddb 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -8,6 +8,7 @@
8 * For now it's included from <linux/irq.h> 8 * For now it's included from <linux/irq.h>
9 */ 9 */
10 10
11struct irq_affinity_notify;
11struct proc_dir_entry; 12struct proc_dir_entry;
12struct timer_rand_state; 13struct timer_rand_state;
13/** 14/**
@@ -24,6 +25,7 @@ struct timer_rand_state;
24 * @last_unhandled: aging timer for unhandled count 25 * @last_unhandled: aging timer for unhandled count
25 * @irqs_unhandled: stats field for spurious unhandled interrupts 26 * @irqs_unhandled: stats field for spurious unhandled interrupts
26 * @lock: locking for SMP 27 * @lock: locking for SMP
28 * @affinity_notify: context for notification of affinity changes
27 * @pending_mask: pending rebalanced interrupts 29 * @pending_mask: pending rebalanced interrupts
28 * @threads_active: number of irqaction threads currently running 30 * @threads_active: number of irqaction threads currently running
29 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 31 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
@@ -70,6 +72,7 @@ struct irq_desc {
70 raw_spinlock_t lock; 72 raw_spinlock_t lock;
71#ifdef CONFIG_SMP 73#ifdef CONFIG_SMP
72 const struct cpumask *affinity_hint; 74 const struct cpumask *affinity_hint;
75 struct irq_affinity_notify *affinity_notify;
73#ifdef CONFIG_GENERIC_PENDING_IRQ 76#ifdef CONFIG_GENERIC_PENDING_IRQ
74 cpumask_var_t pending_mask; 77 cpumask_var_t pending_mask;
75#endif 78#endif
@@ -101,13 +104,6 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) 104#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc)
102 105
103/* 106/*
104 * Monolithic do_IRQ implementation.
105 */
106#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
107extern unsigned int __do_IRQ(unsigned int irq);
108#endif
109
110/*
111 * Architectures call this to let the generic IRQ layer 107 * Architectures call this to let the generic IRQ layer
112 * handle an interrupt. If the descriptor is attached to an 108 * handle an interrupt. If the descriptor is attached to an
113 * irqchip-style controller then we call the ->handle_irq() handler, 109 * irqchip-style controller then we call the ->handle_irq() handler,
@@ -115,14 +111,7 @@ extern unsigned int __do_IRQ(unsigned int irq);
115 */ 111 */
116static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) 112static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
117{ 113{
118#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
119 desc->handle_irq(irq, desc); 114 desc->handle_irq(irq, desc);
120#else
121 if (likely(desc->handle_irq))
122 desc->handle_irq(irq, desc);
123 else
124 __do_IRQ(irq);
125#endif
126} 115}
127 116
128static inline void generic_handle_irq(unsigned int irq) 117static inline void generic_handle_irq(unsigned int irq)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5a9d9059520b..2fe6e84894a4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -243,6 +243,8 @@ extern int test_taint(unsigned flag);
243extern unsigned long get_taint(void); 243extern unsigned long get_taint(void);
244extern int root_mountflags; 244extern int root_mountflags;
245 245
246extern bool early_boot_irqs_disabled;
247
246/* Values used for system_state */ 248/* Values used for system_state */
247extern enum system_states { 249extern enum system_states {
248 SYSTEM_BOOTING, 250 SYSTEM_BOOTING,
@@ -573,12 +575,6 @@ struct sysinfo {
573 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 575 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
574}; 576};
575 577
576/* Force a compilation error if condition is true */
577#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
578
579/* Force a compilation error if condition is constant and true */
580#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
581
582/* Force a compilation error if a constant expression is not a power of 2 */ 578/* Force a compilation error if a constant expression is not a power of 2 */
583#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 579#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
584 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) 580 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
@@ -590,6 +586,32 @@ struct sysinfo {
590#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) 586#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
591#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) 587#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
592 588
589/**
590 * BUILD_BUG_ON - break compile if a condition is true.
591 * @condition: the condition which the compiler should know is false.
592 *
593 * If you have some code which relies on certain constants being equal, or
594 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
595 * detect if someone changes it.
596 *
597 * The implementation uses gcc's reluctance to create a negative array, but
598 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
599 * to inline functions). So as a fallback we use the optimizer; if it can't
600 * prove the condition is false, it will cause a link error on the undefined
601 * "__build_bug_on_failed". This error message can be harder to track down
602 * though, hence the two different methods.
603 */
604#ifndef __OPTIMIZE__
605#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
606#else
607extern int __build_bug_on_failed;
608#define BUILD_BUG_ON(condition) \
609 do { \
610 ((void)sizeof(char[1 - 2*!!(condition)])); \
611 if (condition) __build_bug_on_failed = 1; \
612 } while(0)
613#endif
614
593/* Trap pasters of __FUNCTION__ at compile-time */ 615/* Trap pasters of __FUNCTION__ at compile-time */
594#define __FUNCTION__ (__func__) 616#define __FUNCTION__ (__func__)
595 617
diff --git a/include/linux/klist.h b/include/linux/klist.h
index e91a4e59b771..a370ce57cf1d 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -22,7 +22,7 @@ struct klist {
22 struct list_head k_list; 22 struct list_head k_list;
23 void (*get)(struct klist_node *); 23 void (*get)(struct klist_node *);
24 void (*put)(struct klist_node *); 24 void (*put)(struct klist_node *);
25} __attribute__ ((aligned (4))); 25} __attribute__ ((aligned (sizeof(void *))));
26 26
27#define KLIST_INIT(_name, _get, _put) \ 27#define KLIST_INIT(_name, _get, _put) \
28 { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ 28 { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 08d7dc4ddf40..39f8453239f7 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -76,7 +76,7 @@ bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
76 \ 76 \
77 _n = (long) &((ptr)->name##_end) \ 77 _n = (long) &((ptr)->name##_end) \
78 - (long) &((ptr)->name##_begin); \ 78 - (long) &((ptr)->name##_begin); \
79 MAYBE_BUILD_BUG_ON(_n < 0); \ 79 BUILD_BUG_ON(_n < 0); \
80 \ 80 \
81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
82 } while (0) 82 } while (0)
diff --git a/include/linux/list.h b/include/linux/list.h
index 9a5f8a71810c..3a54266a1e85 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -96,6 +96,11 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
96 * in an undefined state. 96 * in an undefined state.
97 */ 97 */
98#ifndef CONFIG_DEBUG_LIST 98#ifndef CONFIG_DEBUG_LIST
99static inline void __list_del_entry(struct list_head *entry)
100{
101 __list_del(entry->prev, entry->next);
102}
103
99static inline void list_del(struct list_head *entry) 104static inline void list_del(struct list_head *entry)
100{ 105{
101 __list_del(entry->prev, entry->next); 106 __list_del(entry->prev, entry->next);
@@ -103,6 +108,7 @@ static inline void list_del(struct list_head *entry)
103 entry->prev = LIST_POISON2; 108 entry->prev = LIST_POISON2;
104} 109}
105#else 110#else
111extern void __list_del_entry(struct list_head *entry);
106extern void list_del(struct list_head *entry); 112extern void list_del(struct list_head *entry);
107#endif 113#endif
108 114
@@ -135,7 +141,7 @@ static inline void list_replace_init(struct list_head *old,
135 */ 141 */
136static inline void list_del_init(struct list_head *entry) 142static inline void list_del_init(struct list_head *entry)
137{ 143{
138 __list_del(entry->prev, entry->next); 144 __list_del_entry(entry);
139 INIT_LIST_HEAD(entry); 145 INIT_LIST_HEAD(entry);
140} 146}
141 147
@@ -146,7 +152,7 @@ static inline void list_del_init(struct list_head *entry)
146 */ 152 */
147static inline void list_move(struct list_head *list, struct list_head *head) 153static inline void list_move(struct list_head *list, struct list_head *head)
148{ 154{
149 __list_del(list->prev, list->next); 155 __list_del_entry(list);
150 list_add(list, head); 156 list_add(list, head);
151} 157}
152 158
@@ -158,7 +164,7 @@ static inline void list_move(struct list_head *list, struct list_head *head)
158static inline void list_move_tail(struct list_head *list, 164static inline void list_move_tail(struct list_head *list,
159 struct list_head *head) 165 struct list_head *head)
160{ 166{
161 __list_del(list->prev, list->next); 167 __list_del_entry(list);
162 list_add_tail(list, head); 168 list_add_tail(list, head);
163} 169}
164 170
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 71c09b26c759..4aef1dda6406 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -436,16 +436,8 @@ do { \
436#endif /* CONFIG_LOCKDEP */ 436#endif /* CONFIG_LOCKDEP */
437 437
438#ifdef CONFIG_TRACE_IRQFLAGS 438#ifdef CONFIG_TRACE_IRQFLAGS
439extern void early_boot_irqs_off(void);
440extern void early_boot_irqs_on(void);
441extern void print_irqtrace_events(struct task_struct *curr); 439extern void print_irqtrace_events(struct task_struct *curr);
442#else 440#else
443static inline void early_boot_irqs_off(void)
444{
445}
446static inline void early_boot_irqs_on(void)
447{
448}
449static inline void print_irqtrace_events(struct task_struct *curr) 441static inline void print_irqtrace_events(struct task_struct *curr)
450{ 442{
451} 443}
@@ -522,12 +514,15 @@ static inline void print_irqtrace_events(struct task_struct *curr)
522#ifdef CONFIG_DEBUG_LOCK_ALLOC 514#ifdef CONFIG_DEBUG_LOCK_ALLOC
523# ifdef CONFIG_PROVE_LOCKING 515# ifdef CONFIG_PROVE_LOCKING
524# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) 516# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
517# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
525# else 518# else
526# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) 519# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
520# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
527# endif 521# endif
528# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 522# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
529#else 523#else
530# define lock_map_acquire(l) do { } while (0) 524# define lock_map_acquire(l) do { } while (0)
525# define lock_map_acquire_read(l) do { } while (0)
531# define lock_map_release(l) do { } while (0) 526# define lock_map_release(l) do { } while (0)
532#endif 527#endif
533 528
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6a576f989437..f512e189be5a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -146,6 +146,10 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
146 gfp_t gfp_mask); 146 gfp_t gfp_mask);
147u64 mem_cgroup_get_limit(struct mem_cgroup *mem); 147u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
148 148
149#ifdef CONFIG_TRANSPARENT_HUGEPAGE
150void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail);
151#endif
152
149#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 153#else /* CONFIG_CGROUP_MEM_RES_CTLR */
150struct mem_cgroup; 154struct mem_cgroup;
151 155
@@ -335,6 +339,11 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
335 return 0; 339 return 0;
336} 340}
337 341
342static inline void mem_cgroup_split_huge_fixup(struct page *head,
343 struct page *tail)
344{
345}
346
338#endif /* CONFIG_CGROUP_MEM_CONT */ 347#endif /* CONFIG_CGROUP_MEM_CONT */
339 348
340#endif /* _LINUX_MEMCONTROL_H */ 349#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 3fd36845ca45..ef4f0b6083a3 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -71,6 +71,7 @@ struct wm8994 {
71 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; 71 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
72 72
73 /* Used over suspend/resume */ 73 /* Used over suspend/resume */
74 bool suspended;
74 u16 ldo_regs[WM8994_NUM_LDO_REGS]; 75 u16 ldo_regs[WM8994_NUM_LDO_REGS];
75 u16 gpio_regs[WM8994_NUM_GPIO_REGS]; 76 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
76 77
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
new file mode 100644
index 000000000000..dd8da342a991
--- /dev/null
+++ b/include/linux/micrel_phy.h
@@ -0,0 +1,16 @@
1#ifndef _MICREL_PHY_H
2#define _MICREL_PHY_H
3
4#define MICREL_PHY_ID_MASK 0x00fffff0
5
6#define PHY_ID_KSZ9021 0x00221611
7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550
10/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
11#define PHY_ID_KS8001 0x0022161A
12
13/* struct phy_device dev_flags definitions */
14#define MICREL_PHY_50MHZ_CLK 0x00000001
15
16#endif /* _MICREL_PHY_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 956a35532f47..f6385fc17ad4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -470,6 +470,7 @@ static inline void set_compound_order(struct page *page, unsigned long order)
470 page[1].lru.prev = (void *)order; 470 page[1].lru.prev = (void *)order;
471} 471}
472 472
473#ifdef CONFIG_MMU
473/* 474/*
474 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when 475 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when
475 * servicing faults for write access. In the normal case, do always want 476 * servicing faults for write access. In the normal case, do always want
@@ -482,6 +483,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
482 pte = pte_mkwrite(pte); 483 pte = pte_mkwrite(pte);
483 return pte; 484 return pte;
484} 485}
486#endif
485 487
486/* 488/*
487 * Multiple processes may "see" the same page. E.g. for untouched 489 * Multiple processes may "see" the same page. E.g. for untouched
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index bf173502d744..38d393092812 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -94,12 +94,12 @@ struct sh_mmcif_plat_data {
94 94
95static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 95static inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
96{ 96{
97 return readl(addr + reg); 97 return __raw_readl(addr + reg);
98} 98}
99 99
100static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) 100static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
101{ 101{
102 writel(val, addr + reg); 102 __raw_writel(val, addr + reg);
103} 103}
104 104
105#define SH_MMCIF_BBS 512 /* boot block size */ 105#define SH_MMCIF_BBS 512 /* boot block size */
diff --git a/include/linux/module.h b/include/linux/module.h
index 8b17fd8c790d..5de42043dff0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -58,6 +58,12 @@ struct module_attribute {
58 void (*free)(struct module *); 58 void (*free)(struct module *);
59}; 59};
60 60
61struct module_version_attribute {
62 struct module_attribute mattr;
63 const char *module_name;
64 const char *version;
65} __attribute__ ((__aligned__(sizeof(void *))));
66
61struct module_kobject 67struct module_kobject
62{ 68{
63 struct kobject kobj; 69 struct kobject kobj;
@@ -161,7 +167,28 @@ extern struct module __this_module;
161 Using this automatically adds a checksum of the .c files and the 167 Using this automatically adds a checksum of the .c files and the
162 local headers in "srcversion". 168 local headers in "srcversion".
163*/ 169*/
170
171#if defined(MODULE) || !defined(CONFIG_SYSFS)
164#define MODULE_VERSION(_version) MODULE_INFO(version, _version) 172#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
173#else
174#define MODULE_VERSION(_version) \
175 extern ssize_t __modver_version_show(struct module_attribute *, \
176 struct module *, char *); \
177 static struct module_version_attribute __modver_version_attr \
178 __used \
179 __attribute__ ((__section__ ("__modver"),aligned(sizeof(void *)))) \
180 = { \
181 .mattr = { \
182 .attr = { \
183 .name = "version", \
184 .mode = S_IRUGO, \
185 }, \
186 .show = __modver_version_show, \
187 }, \
188 .module_name = KBUILD_MODNAME, \
189 .version = _version, \
190 }
191#endif
165 192
166/* Optional firmware file (or files) needed by the module 193/* Optional firmware file (or files) needed by the module
167 * format is simply firmware file name. Multiple firmware 194 * format is simply firmware file name. Multiple firmware
@@ -350,7 +377,7 @@ struct module
350 keeping pointers to this stuff */ 377 keeping pointers to this stuff */
351 char *args; 378 char *args;
352#ifdef CONFIG_TRACEPOINTS 379#ifdef CONFIG_TRACEPOINTS
353 struct tracepoint *tracepoints; 380 struct tracepoint * const *tracepoints_ptrs;
354 unsigned int num_tracepoints; 381 unsigned int num_tracepoints;
355#endif 382#endif
356#ifdef HAVE_JUMP_LABEL 383#ifdef HAVE_JUMP_LABEL
@@ -362,7 +389,7 @@ struct module
362 unsigned int num_trace_bprintk_fmt; 389 unsigned int num_trace_bprintk_fmt;
363#endif 390#endif
364#ifdef CONFIG_EVENT_TRACING 391#ifdef CONFIG_EVENT_TRACING
365 struct ftrace_event_call *trace_events; 392 struct ftrace_event_call **trace_events;
366 unsigned int num_trace_events; 393 unsigned int num_trace_events;
367#endif 394#endif
368#ifdef CONFIG_FTRACE_MCOUNT_RECORD 395#ifdef CONFIG_FTRACE_MCOUNT_RECORD
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 112adf8bd47d..07b41951e3fa 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -16,15 +16,17 @@
16/* Chosen so that structs with an unsigned long line up. */ 16/* Chosen so that structs with an unsigned long line up. */
17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) 17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
18 18
19#ifdef MODULE
20#define ___module_cat(a,b) __mod_ ## a ## b 19#define ___module_cat(a,b) __mod_ ## a ## b
21#define __module_cat(a,b) ___module_cat(a,b) 20#define __module_cat(a,b) ___module_cat(a,b)
21#ifdef MODULE
22#define __MODULE_INFO(tag, name, info) \ 22#define __MODULE_INFO(tag, name, info) \
23static const char __module_cat(name,__LINE__)[] \ 23static const char __module_cat(name,__LINE__)[] \
24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \ 24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \
25 = __stringify(tag) "=" info 25 = __stringify(tag) "=" info
26#else /* !MODULE */ 26#else /* !MODULE */
27#define __MODULE_INFO(tag, name, info) 27/* This struct is here for syntactic coherency, it is not used */
28#define __MODULE_INFO(tag, name, info) \
29 struct __module_cat(name,__LINE__) {}
28#endif 30#endif
29#define __MODULE_PARM_TYPE(name, _type) \ 31#define __MODULE_PARM_TYPE(name, _type) \
30 __MODULE_INFO(parmtype, name##type, #name ":" _type) 32 __MODULE_INFO(parmtype, name##type, #name ":" _type)
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0fa7a3a874c8..b21d567692b2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -150,6 +150,7 @@ static inline int ip_mroute_opt(int opt)
150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); 150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
153extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
153extern int ip_mr_init(void); 154extern int ip_mr_init(void);
154#else 155#else
155static inline 156static inline
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6091ab77f388..9d2deb200f54 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -136,6 +136,7 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int
136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
137extern int ip6_mr_input(struct sk_buff *skb); 137extern int ip6_mr_input(struct sk_buff *skb);
138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
139extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
139extern int ip6_mr_init(void); 140extern int ip6_mr_init(void);
140extern void ip6_mr_cleanup(void); 141extern void ip6_mr_cleanup(void);
141#else 142#else
diff --git a/include/linux/net.h b/include/linux/net.h
index 16faa130088c..94de83c0f877 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -118,6 +118,7 @@ enum sock_shutdown_cmd {
118}; 118};
119 119
120struct socket_wq { 120struct socket_wq {
121 /* Note: wait MUST be first field of socket_wq */
121 wait_queue_head_t wait; 122 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list; 123 struct fasync_struct *fasync_list;
123 struct rcu_head rcu; 124 struct rcu_head rcu;
@@ -142,7 +143,7 @@ struct socket {
142 143
143 unsigned long flags; 144 unsigned long flags;
144 145
145 struct socket_wq *wq; 146 struct socket_wq __rcu *wq;
146 147
147 struct file *file; 148 struct file *file;
148 struct sock *sk; 149 struct sock *sk;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d971346b0340..604dbf5051d3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -138,6 +138,9 @@ static inline bool dev_xmit_complete(int rc)
138 138
139#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 139#define MAX_ADDR_LEN 32 /* Largest hardware address length */
140 140
141/* Initial net device group. All devices belong to group 0 by default. */
142#define INIT_NETDEV_GROUP 0
143
141#ifdef __KERNEL__ 144#ifdef __KERNEL__
142/* 145/*
143 * Compute the worst case header length according to the protocols 146 * Compute the worst case header length according to the protocols
@@ -551,14 +554,16 @@ struct rps_map {
551#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 554#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
552 555
553/* 556/*
554 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the 557 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
555 * tail pointer for that CPU's input queue at the time of last enqueue. 558 * tail pointer for that CPU's input queue at the time of last enqueue, and
559 * a hardware filter index.
556 */ 560 */
557struct rps_dev_flow { 561struct rps_dev_flow {
558 u16 cpu; 562 u16 cpu;
559 u16 fill; 563 u16 filter;
560 unsigned int last_qtail; 564 unsigned int last_qtail;
561}; 565};
566#define RPS_NO_FILTER 0xffff
562 567
563/* 568/*
564 * The rps_dev_flow_table structure contains a table of flow mappings. 569 * The rps_dev_flow_table structure contains a table of flow mappings.
@@ -608,6 +613,11 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
608 613
609extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 614extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
610 615
616#ifdef CONFIG_RFS_ACCEL
617extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
618 u32 flow_id, u16 filter_id);
619#endif
620
611/* This structure contains an instance of an RX queue. */ 621/* This structure contains an instance of an RX queue. */
612struct netdev_rx_queue { 622struct netdev_rx_queue {
613 struct rps_map __rcu *rps_map; 623 struct rps_map __rcu *rps_map;
@@ -643,6 +653,14 @@ struct xps_dev_maps {
643 (nr_cpu_ids * sizeof(struct xps_map *))) 653 (nr_cpu_ids * sizeof(struct xps_map *)))
644#endif /* CONFIG_XPS */ 654#endif /* CONFIG_XPS */
645 655
656#define TC_MAX_QUEUE 16
657#define TC_BITMASK 15
658/* HW offloaded queuing disciplines txq count and offset maps */
659struct netdev_tc_txq {
660 u16 count;
661 u16 offset;
662};
663
646/* 664/*
647 * This structure defines the management hooks for network devices. 665 * This structure defines the management hooks for network devices.
648 * The following hooks can be defined; unless noted otherwise, they are 666 * The following hooks can be defined; unless noted otherwise, they are
@@ -753,6 +771,74 @@ struct xps_dev_maps {
753 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 771 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
754 * struct nlattr *port[]); 772 * struct nlattr *port[]);
755 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 773 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
774 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
775 * Called to setup 'tc' number of traffic classes in the net device. This
776 * is always called from the stack with the rtnl lock held and netif tx
777 * queues stopped. This allows the netdevice to perform queue management
778 * safely.
779 *
780 * Fiber Channel over Ethernet (FCoE) offload functions.
781 * int (*ndo_fcoe_enable)(struct net_device *dev);
782 * Called when the FCoE protocol stack wants to start using LLD for FCoE
783 * so the underlying device can perform whatever needed configuration or
784 * initialization to support acceleration of FCoE traffic.
785 *
786 * int (*ndo_fcoe_disable)(struct net_device *dev);
787 * Called when the FCoE protocol stack wants to stop using LLD for FCoE
788 * so the underlying device can perform whatever needed clean-ups to
789 * stop supporting acceleration of FCoE traffic.
790 *
791 * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid,
792 * struct scatterlist *sgl, unsigned int sgc);
793 * Called when the FCoE Initiator wants to initialize an I/O that
794 * is a possible candidate for Direct Data Placement (DDP). The LLD can
795 * perform necessary setup and returns 1 to indicate the device is set up
796 * successfully to perform DDP on this I/O, otherwise this returns 0.
797 *
798 * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid);
799 * Called when the FCoE Initiator/Target is done with the DDPed I/O as
800 * indicated by the FC exchange id 'xid', so the underlying device can
801 * clean up and reuse resources for later DDP requests.
802 *
803 * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid,
804 * struct scatterlist *sgl, unsigned int sgc);
805 * Called when the FCoE Target wants to initialize an I/O that
806 * is a possible candidate for Direct Data Placement (DDP). The LLD can
807 * perform necessary setup and returns 1 to indicate the device is set up
808 * successfully to perform DDP on this I/O, otherwise this returns 0.
809 *
810 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
811 * Called when the underlying device wants to override default World Wide
812 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
813 * World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE
814 * protocol stack to use.
815 *
816 * RFS acceleration.
817 * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb,
818 * u16 rxq_index, u32 flow_id);
819 * Set hardware filter for RFS. rxq_index is the target queue index;
820 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
821 * Return the filter ID on success, or a negative error code.
822 *
823 * Slave management functions (for bridge, bonding, etc). User should
824 * call netdev_set_master() to set dev->master properly.
825 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
826 * Called to make another netdev an underling.
827 *
828 * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
829 * Called to release previously enslaved netdev.
830 *
831 * Feature/offload setting functions.
832 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features);
833 * Adjusts the requested feature flags according to device-specific
834 * constraints, and returns the resulting flags. Must not modify
835 * the device state.
836 *
837 * int (*ndo_set_features)(struct net_device *dev, u32 features);
838 * Called to update device configuration to new features. Passed
839 * feature set might be less than what was returned by ndo_fix_features()).
840 * Must return >0 or -errno if it changed dev->features itself.
841 *
756 */ 842 */
757#define HAVE_NET_DEVICE_OPS 843#define HAVE_NET_DEVICE_OPS
758struct net_device_ops { 844struct net_device_ops {
@@ -811,6 +897,7 @@ struct net_device_ops {
811 struct nlattr *port[]); 897 struct nlattr *port[]);
812 int (*ndo_get_vf_port)(struct net_device *dev, 898 int (*ndo_get_vf_port)(struct net_device *dev,
813 int vf, struct sk_buff *skb); 899 int vf, struct sk_buff *skb);
900 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
814#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 901#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
815 int (*ndo_fcoe_enable)(struct net_device *dev); 902 int (*ndo_fcoe_enable)(struct net_device *dev);
816 int (*ndo_fcoe_disable)(struct net_device *dev); 903 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -820,11 +907,29 @@ struct net_device_ops {
820 unsigned int sgc); 907 unsigned int sgc);
821 int (*ndo_fcoe_ddp_done)(struct net_device *dev, 908 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
822 u16 xid); 909 u16 xid);
910 int (*ndo_fcoe_ddp_target)(struct net_device *dev,
911 u16 xid,
912 struct scatterlist *sgl,
913 unsigned int sgc);
823#define NETDEV_FCOE_WWNN 0 914#define NETDEV_FCOE_WWNN 0
824#define NETDEV_FCOE_WWPN 1 915#define NETDEV_FCOE_WWPN 1
825 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 916 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
826 u64 *wwn, int type); 917 u64 *wwn, int type);
827#endif 918#endif
919#ifdef CONFIG_RFS_ACCEL
920 int (*ndo_rx_flow_steer)(struct net_device *dev,
921 const struct sk_buff *skb,
922 u16 rxq_index,
923 u32 flow_id);
924#endif
925 int (*ndo_add_slave)(struct net_device *dev,
926 struct net_device *slave_dev);
927 int (*ndo_del_slave)(struct net_device *dev,
928 struct net_device *slave_dev);
929 u32 (*ndo_fix_features)(struct net_device *dev,
930 u32 features);
931 int (*ndo_set_features)(struct net_device *dev,
932 u32 features);
828}; 933};
829 934
830/* 935/*
@@ -876,8 +981,18 @@ struct net_device {
876 struct list_head napi_list; 981 struct list_head napi_list;
877 struct list_head unreg_list; 982 struct list_head unreg_list;
878 983
879 /* Net device features */ 984 /* currently active device features */
880 unsigned long features; 985 u32 features;
986 /* user-changeable features */
987 u32 hw_features;
988 /* user-requested features */
989 u32 wanted_features;
990 /* VLAN feature mask */
991 u32 vlan_features;
992
993 /* Net device feature bits; if you change something,
994 * also update netdev_features_strings[] in ethtool.c */
995
881#define NETIF_F_SG 1 /* Scatter/gather IO. */ 996#define NETIF_F_SG 1 /* Scatter/gather IO. */
882#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ 997#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
883#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ 998#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
@@ -902,6 +1017,7 @@ struct net_device {
902#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 1017#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
903#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ 1018#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
904#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ 1019#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1020#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
905 1021
906 /* Segmentation offload features */ 1022 /* Segmentation offload features */
907#define NETIF_F_GSO_SHIFT 16 1023#define NETIF_F_GSO_SHIFT 16
@@ -913,6 +1029,12 @@ struct net_device {
913#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) 1029#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
914#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) 1030#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
915 1031
1032 /* Features valid for ethtool to change */
1033 /* = all defined minus driver/device-class-related */
1034#define NETIF_F_NEVER_CHANGE (NETIF_F_HIGHDMA | NETIF_F_VLAN_CHALLENGED | \
1035 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1036#define NETIF_F_ETHTOOL_BITS (0x3f3fffff & ~NETIF_F_NEVER_CHANGE)
1037
916 /* List of features with software fallbacks. */ 1038 /* List of features with software fallbacks. */
917#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ 1039#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
918 NETIF_F_TSO6 | NETIF_F_UFO) 1040 NETIF_F_TSO6 | NETIF_F_UFO)
@@ -923,6 +1045,12 @@ struct net_device {
923#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 1045#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
924#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 1046#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
925 1047
1048#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1049
1050#define NETIF_F_ALL_TX_OFFLOADS (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1051 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1052 NETIF_F_SCTP_CSUM | NETIF_F_FCOE_CRC)
1053
926 /* 1054 /*
927 * If one device supports one of these features, then enable them 1055 * If one device supports one of these features, then enable them
928 * for all in netdev_increment_features. 1056 * for all in netdev_increment_features.
@@ -931,6 +1059,9 @@ struct net_device {
931 NETIF_F_SG | NETIF_F_HIGHDMA | \ 1059 NETIF_F_SG | NETIF_F_HIGHDMA | \
932 NETIF_F_FRAGLIST) 1060 NETIF_F_FRAGLIST)
933 1061
1062 /* changeable features with no special hardware requirements */
1063#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
1064
934 /* Interface index. Unique device identifier */ 1065 /* Interface index. Unique device identifier */
935 int ifindex; 1066 int ifindex;
936 int iflink; 1067 int iflink;
@@ -1039,6 +1170,13 @@ struct net_device {
1039 1170
1040 /* Number of RX queues currently active in device */ 1171 /* Number of RX queues currently active in device */
1041 unsigned int real_num_rx_queues; 1172 unsigned int real_num_rx_queues;
1173
1174#ifdef CONFIG_RFS_ACCEL
1175 /* CPU reverse-mapping for RX completion interrupts, indexed
1176 * by RX queue number. Assigned by driver. This must only be
1177 * set if the ndo_rx_flow_steer operation is defined. */
1178 struct cpu_rmap *rx_cpu_rmap;
1179#endif
1042#endif 1180#endif
1043 1181
1044 rx_handler_func_t __rcu *rx_handler; 1182 rx_handler_func_t __rcu *rx_handler;
@@ -1132,9 +1270,6 @@ struct net_device {
1132 /* rtnetlink link ops */ 1270 /* rtnetlink link ops */
1133 const struct rtnl_link_ops *rtnl_link_ops; 1271 const struct rtnl_link_ops *rtnl_link_ops;
1134 1272
1135 /* VLAN feature mask */
1136 unsigned long vlan_features;
1137
1138 /* for setting kernel sock attribute on TCP connection setup */ 1273 /* for setting kernel sock attribute on TCP connection setup */
1139#define GSO_MAX_SIZE 65536 1274#define GSO_MAX_SIZE 65536
1140 unsigned int gso_max_size; 1275 unsigned int gso_max_size;
@@ -1143,6 +1278,9 @@ struct net_device {
1143 /* Data Center Bridging netlink ops */ 1278 /* Data Center Bridging netlink ops */
1144 const struct dcbnl_rtnl_ops *dcbnl_ops; 1279 const struct dcbnl_rtnl_ops *dcbnl_ops;
1145#endif 1280#endif
1281 u8 num_tc;
1282 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1283 u8 prio_tc_map[TC_BITMASK + 1];
1146 1284
1147#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1285#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
1148 /* max exchange id for FCoE LRO by ddp */ 1286 /* max exchange id for FCoE LRO by ddp */
@@ -1153,12 +1291,66 @@ struct net_device {
1153 1291
1154 /* phy device may attach itself for hardware timestamping */ 1292 /* phy device may attach itself for hardware timestamping */
1155 struct phy_device *phydev; 1293 struct phy_device *phydev;
1294
1295 /* group the device belongs to */
1296 int group;
1156}; 1297};
1157#define to_net_dev(d) container_of(d, struct net_device, dev) 1298#define to_net_dev(d) container_of(d, struct net_device, dev)
1158 1299
1159#define NETDEV_ALIGN 32 1300#define NETDEV_ALIGN 32
1160 1301
1161static inline 1302static inline
1303int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio)
1304{
1305 return dev->prio_tc_map[prio & TC_BITMASK];
1306}
1307
1308static inline
1309int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc)
1310{
1311 if (tc >= dev->num_tc)
1312 return -EINVAL;
1313
1314 dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK;
1315 return 0;
1316}
1317
1318static inline
1319void netdev_reset_tc(struct net_device *dev)
1320{
1321 dev->num_tc = 0;
1322 memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq));
1323 memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map));
1324}
1325
1326static inline
1327int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset)
1328{
1329 if (tc >= dev->num_tc)
1330 return -EINVAL;
1331
1332 dev->tc_to_txq[tc].count = count;
1333 dev->tc_to_txq[tc].offset = offset;
1334 return 0;
1335}
1336
1337static inline
1338int netdev_set_num_tc(struct net_device *dev, u8 num_tc)
1339{
1340 if (num_tc > TC_MAX_QUEUE)
1341 return -EINVAL;
1342
1343 dev->num_tc = num_tc;
1344 return 0;
1345}
1346
1347static inline
1348int netdev_get_num_tc(struct net_device *dev)
1349{
1350 return dev->num_tc;
1351}
1352
1353static inline
1162struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 1354struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1163 unsigned int index) 1355 unsigned int index)
1164{ 1356{
@@ -1300,7 +1492,7 @@ struct packet_type {
1300 struct packet_type *, 1492 struct packet_type *,
1301 struct net_device *); 1493 struct net_device *);
1302 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1494 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1303 int features); 1495 u32 features);
1304 int (*gso_send_check)(struct sk_buff *skb); 1496 int (*gso_send_check)(struct sk_buff *skb);
1305 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1497 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1306 struct sk_buff *skb); 1498 struct sk_buff *skb);
@@ -1345,7 +1537,7 @@ static inline struct net_device *next_net_device_rcu(struct net_device *dev)
1345 struct net *net; 1537 struct net *net;
1346 1538
1347 net = dev_net(dev); 1539 net = dev_net(dev);
1348 lh = rcu_dereference(dev->dev_list.next); 1540 lh = rcu_dereference(list_next_rcu(&dev->dev_list));
1349 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1541 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1350} 1542}
1351 1543
@@ -1355,6 +1547,13 @@ static inline struct net_device *first_net_device(struct net *net)
1355 net_device_entry(net->dev_base_head.next); 1547 net_device_entry(net->dev_base_head.next);
1356} 1548}
1357 1549
1550static inline struct net_device *first_net_device_rcu(struct net *net)
1551{
1552 struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head));
1553
1554 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1555}
1556
1358extern int netdev_boot_setup_check(struct net_device *dev); 1557extern int netdev_boot_setup_check(struct net_device *dev);
1359extern unsigned long netdev_boot_base(const char *prefix, int unit); 1558extern unsigned long netdev_boot_base(const char *prefix, int unit);
1360extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1559extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
@@ -1606,8 +1805,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
1606static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) 1805static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1607{ 1806{
1608 if (WARN_ON(!dev_queue)) { 1807 if (WARN_ON(!dev_queue)) {
1609 printk(KERN_INFO "netif_stop_queue() cannot be called before " 1808 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1610 "register_netdev()");
1611 return; 1809 return;
1612 } 1810 }
1613 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1811 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
@@ -1844,6 +2042,7 @@ extern int dev_set_alias(struct net_device *, const char *, size_t);
1844extern int dev_change_net_namespace(struct net_device *, 2042extern int dev_change_net_namespace(struct net_device *,
1845 struct net *, const char *); 2043 struct net *, const char *);
1846extern int dev_set_mtu(struct net_device *, int); 2044extern int dev_set_mtu(struct net_device *, int);
2045extern void dev_set_group(struct net_device *, int);
1847extern int dev_set_mac_address(struct net_device *, 2046extern int dev_set_mac_address(struct net_device *,
1848 struct sockaddr *); 2047 struct sockaddr *);
1849extern int dev_hard_start_xmit(struct sk_buff *skb, 2048extern int dev_hard_start_xmit(struct sk_buff *skb,
@@ -2267,8 +2466,10 @@ extern int netdev_max_backlog;
2267extern int netdev_tstamp_prequeue; 2466extern int netdev_tstamp_prequeue;
2268extern int weight_p; 2467extern int weight_p;
2269extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2468extern int netdev_set_master(struct net_device *dev, struct net_device *master);
2469extern int netdev_set_bond_master(struct net_device *dev,
2470 struct net_device *master);
2270extern int skb_checksum_help(struct sk_buff *skb); 2471extern int skb_checksum_help(struct sk_buff *skb);
2271extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); 2472extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features);
2272#ifdef CONFIG_BUG 2473#ifdef CONFIG_BUG
2273extern void netdev_rx_csum_fault(struct net_device *dev); 2474extern void netdev_rx_csum_fault(struct net_device *dev);
2274#else 2475#else
@@ -2295,22 +2496,26 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l
2295 2496
2296extern void linkwatch_run_queue(void); 2497extern void linkwatch_run_queue(void);
2297 2498
2298unsigned long netdev_increment_features(unsigned long all, unsigned long one, 2499static inline u32 netdev_get_wanted_features(struct net_device *dev)
2299 unsigned long mask); 2500{
2300unsigned long netdev_fix_features(unsigned long features, const char *name); 2501 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2502}
2503u32 netdev_increment_features(u32 all, u32 one, u32 mask);
2504u32 netdev_fix_features(struct net_device *dev, u32 features);
2505void netdev_update_features(struct net_device *dev);
2301 2506
2302void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2507void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2303 struct net_device *dev); 2508 struct net_device *dev);
2304 2509
2305int netif_skb_features(struct sk_buff *skb); 2510u32 netif_skb_features(struct sk_buff *skb);
2306 2511
2307static inline int net_gso_ok(int features, int gso_type) 2512static inline int net_gso_ok(u32 features, int gso_type)
2308{ 2513{
2309 int feature = gso_type << NETIF_F_GSO_SHIFT; 2514 int feature = gso_type << NETIF_F_GSO_SHIFT;
2310 return (features & feature) == feature; 2515 return (features & feature) == feature;
2311} 2516}
2312 2517
2313static inline int skb_gso_ok(struct sk_buff *skb, int features) 2518static inline int skb_gso_ok(struct sk_buff *skb, u32 features)
2314{ 2519{
2315 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2520 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2316 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2521 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
@@ -2328,15 +2533,9 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2328 dev->gso_max_size = size; 2533 dev->gso_max_size = size;
2329} 2534}
2330 2535
2331extern int __skb_bond_should_drop(struct sk_buff *skb, 2536static inline int netif_is_bond_slave(struct net_device *dev)
2332 struct net_device *master);
2333
2334static inline int skb_bond_should_drop(struct sk_buff *skb,
2335 struct net_device *master)
2336{ 2537{
2337 if (master) 2538 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2338 return __skb_bond_should_drop(skb, master);
2339 return 0;
2340} 2539}
2341 2540
2342extern struct pernet_operations __net_initdata loopback_net_ops; 2541extern struct pernet_operations __net_initdata loopback_net_ops;
@@ -2351,6 +2550,8 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
2351 2550
2352static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) 2551static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2353{ 2552{
2553 if (dev->hw_features & NETIF_F_RXCSUM)
2554 return !!(dev->features & NETIF_F_RXCSUM);
2354 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) 2555 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2355 return 0; 2556 return 0;
2356 return dev->ethtool_ops->get_rx_csum(dev); 2557 return dev->ethtool_ops->get_rx_csum(dev);
@@ -2392,6 +2593,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2392extern int netdev_info(const struct net_device *dev, const char *format, ...) 2593extern int netdev_info(const struct net_device *dev, const char *format, ...)
2393 __attribute__ ((format (printf, 2, 3))); 2594 __attribute__ ((format (printf, 2, 3)));
2394 2595
2596#define MODULE_ALIAS_NETDEV(device) \
2597 MODULE_ALIAS("netdev-" device)
2598
2395#if defined(DEBUG) 2599#if defined(DEBUG)
2396#define netdev_dbg(__dev, format, args...) \ 2600#define netdev_dbg(__dev, format, args...) \
2397 netdev_printk(KERN_DEBUG, __dev, format, ##args) 2601 netdev_printk(KERN_DEBUG, __dev, format, ##args)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1893837b3966..eeec00abb664 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -24,16 +24,20 @@
24#define NF_MAX_VERDICT NF_STOP 24#define NF_MAX_VERDICT NF_STOP
25 25
26/* we overload the higher bits for encoding auxiliary data such as the queue 26/* we overload the higher bits for encoding auxiliary data such as the queue
27 * number. Not nice, but better than additional function arguments. */ 27 * number or errno values. Not nice, but better than additional function
28#define NF_VERDICT_MASK 0x0000ffff 28 * arguments. */
29#define NF_VERDICT_BITS 16 29#define NF_VERDICT_MASK 0x000000ff
30
31/* extra verdict flags have mask 0x0000ff00 */
32#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000
30 33
34/* queue number (NF_QUEUE) or errno (NF_DROP) */
31#define NF_VERDICT_QMASK 0xffff0000 35#define NF_VERDICT_QMASK 0xffff0000
32#define NF_VERDICT_QBITS 16 36#define NF_VERDICT_QBITS 16
33 37
34#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) 38#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
35 39
36#define NF_DROP_ERR(x) (((-x) << NF_VERDICT_BITS) | NF_DROP) 40#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
37 41
38/* only for userspace compatibility */ 42/* only for userspace compatibility */
39#ifndef __KERNEL__ 43#ifndef __KERNEL__
@@ -41,6 +45,9 @@
41 <= 0x2000 is used for protocol-flags. */ 45 <= 0x2000 is used for protocol-flags. */
42#define NFC_UNKNOWN 0x4000 46#define NFC_UNKNOWN 0x4000
43#define NFC_ALTERED 0x8000 47#define NFC_ALTERED 0x8000
48
49/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
50#define NF_VERDICT_BITS 16
44#endif 51#endif
45 52
46enum nf_inet_hooks { 53enum nf_inet_hooks {
@@ -72,6 +79,10 @@ union nf_inet_addr {
72 79
73#ifdef __KERNEL__ 80#ifdef __KERNEL__
74#ifdef CONFIG_NETFILTER 81#ifdef CONFIG_NETFILTER
82static inline int NF_DROP_GETERR(int verdict)
83{
84 return -(verdict >> NF_VERDICT_QBITS);
85}
75 86
76static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, 87static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
77 const union nf_inet_addr *a2) 88 const union nf_inet_addr *a2)
@@ -267,7 +278,7 @@ struct nf_afinfo {
267 int route_key_size; 278 int route_key_size;
268}; 279};
269 280
270extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; 281extern const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO];
271static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) 282static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
272{ 283{
273 return rcu_dereference(nf_afinfo[family]); 284 return rcu_dereference(nf_afinfo[family]);
@@ -357,9 +368,9 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
357#endif /*CONFIG_NETFILTER*/ 368#endif /*CONFIG_NETFILTER*/
358 369
359#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 370#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
360extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); 371extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu;
361extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); 372extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
362extern void (*nf_ct_destroy)(struct nf_conntrack *); 373extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
363#else 374#else
364static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 375static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
365#endif 376#endif
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 9d40effe7ca7..15e83bf3dd58 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -1,3 +1,5 @@
1header-y += ipset/
2
1header-y += nf_conntrack_common.h 3header-y += nf_conntrack_common.h
2header-y += nf_conntrack_ftp.h 4header-y += nf_conntrack_ftp.h
3header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
@@ -9,6 +11,7 @@ header-y += nfnetlink_conntrack.h
9header-y += nfnetlink_log.h 11header-y += nfnetlink_log.h
10header-y += nfnetlink_queue.h 12header-y += nfnetlink_queue.h
11header-y += x_tables.h 13header-y += x_tables.h
14header-y += xt_AUDIT.h
12header-y += xt_CHECKSUM.h 15header-y += xt_CHECKSUM.h
13header-y += xt_CLASSIFY.h 16header-y += xt_CLASSIFY.h
14header-y += xt_CONNMARK.h 17header-y += xt_CONNMARK.h
@@ -34,6 +37,7 @@ header-y += xt_connmark.h
34header-y += xt_conntrack.h 37header-y += xt_conntrack.h
35header-y += xt_cpu.h 38header-y += xt_cpu.h
36header-y += xt_dccp.h 39header-y += xt_dccp.h
40header-y += xt_devgroup.h
37header-y += xt_dscp.h 41header-y += xt_dscp.h
38header-y += xt_esp.h 42header-y += xt_esp.h
39header-y += xt_hashlimit.h 43header-y += xt_hashlimit.h
@@ -54,7 +58,9 @@ header-y += xt_quota.h
54header-y += xt_rateest.h 58header-y += xt_rateest.h
55header-y += xt_realm.h 59header-y += xt_realm.h
56header-y += xt_recent.h 60header-y += xt_recent.h
61header-y += xt_set.h
57header-y += xt_sctp.h 62header-y += xt_sctp.h
63header-y += xt_socket.h
58header-y += xt_state.h 64header-y += xt_state.h
59header-y += xt_statistic.h 65header-y += xt_statistic.h
60header-y += xt_string.h 66header-y += xt_string.h
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild
new file mode 100644
index 000000000000..601fe71d34d5
--- /dev/null
+++ b/include/linux/netfilter/ipset/Kbuild
@@ -0,0 +1,4 @@
1header-y += ip_set.h
2header-y += ip_set_bitmap.h
3header-y += ip_set_hash.h
4header-y += ip_set_list.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
new file mode 100644
index 000000000000..ec333d83f3b4
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -0,0 +1,452 @@
1#ifndef _IP_SET_H
2#define _IP_SET_H
3
4/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
5 * Patrick Schaaf <bof@bof.de>
6 * Martin Josefsson <gandalf@wlug.westbo.se>
7 * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14/* The protocol version */
15#define IPSET_PROTOCOL 6
16
17/* The max length of strings including NUL: set and type identifiers */
18#define IPSET_MAXNAMELEN 32
19
20/* Message types and commands */
21enum ipset_cmd {
22 IPSET_CMD_NONE,
23 IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
24 IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
25 IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
26 IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
27 IPSET_CMD_RENAME, /* 5: Rename a set */
28 IPSET_CMD_SWAP, /* 6: Swap two sets */
29 IPSET_CMD_LIST, /* 7: List sets */
30 IPSET_CMD_SAVE, /* 8: Save sets */
31 IPSET_CMD_ADD, /* 9: Add an element to a set */
32 IPSET_CMD_DEL, /* 10: Delete an element from a set */
33 IPSET_CMD_TEST, /* 11: Test an element in a set */
34 IPSET_CMD_HEADER, /* 12: Get set header data only */
35 IPSET_CMD_TYPE, /* 13: Get set type */
36 IPSET_MSG_MAX, /* Netlink message commands */
37
38 /* Commands in userspace: */
39 IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
40 IPSET_CMD_HELP, /* 15: Get help */
41 IPSET_CMD_VERSION, /* 16: Get program version */
42 IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
43
44 IPSET_CMD_MAX,
45
46 IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
47};
48
49/* Attributes at command level */
50enum {
51 IPSET_ATTR_UNSPEC,
52 IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
53 IPSET_ATTR_SETNAME, /* 2: Name of the set */
54 IPSET_ATTR_TYPENAME, /* 3: Typename */
55 IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
56 IPSET_ATTR_REVISION, /* 4: Settype revision */
57 IPSET_ATTR_FAMILY, /* 5: Settype family */
58 IPSET_ATTR_FLAGS, /* 6: Flags at command level */
59 IPSET_ATTR_DATA, /* 7: Nested attributes */
60 IPSET_ATTR_ADT, /* 8: Multiple data containers */
61 IPSET_ATTR_LINENO, /* 9: Restore lineno */
62 IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
63 IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
64 __IPSET_ATTR_CMD_MAX,
65};
66#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
67
68/* CADT specific attributes */
69enum {
70 IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
71 IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
72 IPSET_ATTR_IP_TO, /* 2 */
73 IPSET_ATTR_CIDR, /* 3 */
74 IPSET_ATTR_PORT, /* 4 */
75 IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
76 IPSET_ATTR_PORT_TO, /* 5 */
77 IPSET_ATTR_TIMEOUT, /* 6 */
78 IPSET_ATTR_PROTO, /* 7 */
79 IPSET_ATTR_CADT_FLAGS, /* 8 */
80 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
81 /* Reserve empty slots */
82 IPSET_ATTR_CADT_MAX = 16,
83 /* Create-only specific attributes */
84 IPSET_ATTR_GC,
85 IPSET_ATTR_HASHSIZE,
86 IPSET_ATTR_MAXELEM,
87 IPSET_ATTR_NETMASK,
88 IPSET_ATTR_PROBES,
89 IPSET_ATTR_RESIZE,
90 IPSET_ATTR_SIZE,
91 /* Kernel-only */
92 IPSET_ATTR_ELEMENTS,
93 IPSET_ATTR_REFERENCES,
94 IPSET_ATTR_MEMSIZE,
95
96 __IPSET_ATTR_CREATE_MAX,
97};
98#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
99
100/* ADT specific attributes */
101enum {
102 IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
103 IPSET_ATTR_NAME,
104 IPSET_ATTR_NAMEREF,
105 IPSET_ATTR_IP2,
106 IPSET_ATTR_CIDR2,
107 __IPSET_ATTR_ADT_MAX,
108};
109#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
110
111/* IP specific attributes */
112enum {
113 IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
114 IPSET_ATTR_IPADDR_IPV6,
115 __IPSET_ATTR_IPADDR_MAX,
116};
117#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
118
119/* Error codes */
120enum ipset_errno {
121 IPSET_ERR_PRIVATE = 4096,
122 IPSET_ERR_PROTOCOL,
123 IPSET_ERR_FIND_TYPE,
124 IPSET_ERR_MAX_SETS,
125 IPSET_ERR_BUSY,
126 IPSET_ERR_EXIST_SETNAME2,
127 IPSET_ERR_TYPE_MISMATCH,
128 IPSET_ERR_EXIST,
129 IPSET_ERR_INVALID_CIDR,
130 IPSET_ERR_INVALID_NETMASK,
131 IPSET_ERR_INVALID_FAMILY,
132 IPSET_ERR_TIMEOUT,
133 IPSET_ERR_REFERENCED,
134 IPSET_ERR_IPADDR_IPV4,
135 IPSET_ERR_IPADDR_IPV6,
136
137 /* Type specific error codes */
138 IPSET_ERR_TYPE_SPECIFIC = 4352,
139};
140
141/* Flags at command level */
142enum ipset_cmd_flags {
143 IPSET_FLAG_BIT_EXIST = 0,
144 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
145};
146
147/* Flags at CADT attribute level */
148enum ipset_cadt_flags {
149 IPSET_FLAG_BIT_BEFORE = 0,
150 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
151};
152
153/* Commands with settype-specific attributes */
154enum ipset_adt {
155 IPSET_ADD,
156 IPSET_DEL,
157 IPSET_TEST,
158 IPSET_ADT_MAX,
159 IPSET_CREATE = IPSET_ADT_MAX,
160 IPSET_CADT_MAX,
161};
162
163#ifdef __KERNEL__
164#include <linux/ip.h>
165#include <linux/ipv6.h>
166#include <linux/netlink.h>
167#include <linux/netfilter.h>
168#include <linux/vmalloc.h>
169#include <net/netlink.h>
170
171/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
172 * and IPSET_INVALID_ID if you want to increase the max number of sets.
173 */
174typedef u16 ip_set_id_t;
175
176#define IPSET_INVALID_ID 65535
177
178enum ip_set_dim {
179 IPSET_DIM_ZERO = 0,
180 IPSET_DIM_ONE,
181 IPSET_DIM_TWO,
182 IPSET_DIM_THREE,
183 /* Max dimension in elements.
184 * If changed, new revision of iptables match/target is required.
185 */
186 IPSET_DIM_MAX = 6,
187};
188
189/* Option flags for kernel operations */
190enum ip_set_kopt {
191 IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
192 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
193 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
194 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
195};
196
197/* Set features */
198enum ip_set_feature {
199 IPSET_TYPE_IP_FLAG = 0,
200 IPSET_TYPE_IP = (1 << IPSET_TYPE_IP_FLAG),
201 IPSET_TYPE_PORT_FLAG = 1,
202 IPSET_TYPE_PORT = (1 << IPSET_TYPE_PORT_FLAG),
203 IPSET_TYPE_MAC_FLAG = 2,
204 IPSET_TYPE_MAC = (1 << IPSET_TYPE_MAC_FLAG),
205 IPSET_TYPE_IP2_FLAG = 3,
206 IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG),
207 IPSET_TYPE_NAME_FLAG = 4,
208 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
209 /* Strictly speaking not a feature, but a flag for dumping:
210 * this settype must be dumped last */
211 IPSET_DUMP_LAST_FLAG = 7,
212 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
213};
214
215struct ip_set;
216
217typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout);
218
219/* Set type, variant-specific part */
220struct ip_set_type_variant {
221 /* Kernelspace: test/add/del entries
222 * returns negative error code,
223 * zero for no match/success to add/delete
224 * positive for matching element */
225 int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
226 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
227
228 /* Userspace: test/add/del entries
229 * returns negative error code,
230 * zero for no match/success to add/delete
231 * positive for matching element */
232 int (*uadt)(struct ip_set *set, struct nlattr *tb[],
233 enum ipset_adt adt, u32 *lineno, u32 flags);
234
235 /* Low level add/del/test functions */
236 ipset_adtfn adt[IPSET_ADT_MAX];
237
238 /* When adding entries and set is full, try to resize the set */
239 int (*resize)(struct ip_set *set, bool retried);
240 /* Destroy the set */
241 void (*destroy)(struct ip_set *set);
242 /* Flush the elements */
243 void (*flush)(struct ip_set *set);
244 /* Expire entries before listing */
245 void (*expire)(struct ip_set *set);
246 /* List set header data */
247 int (*head)(struct ip_set *set, struct sk_buff *skb);
248 /* List elements */
249 int (*list)(const struct ip_set *set, struct sk_buff *skb,
250 struct netlink_callback *cb);
251
252 /* Return true if "b" set is the same as "a"
253 * according to the create set parameters */
254 bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
255};
256
257/* The core set type structure */
258struct ip_set_type {
259 struct list_head list;
260
261 /* Typename */
262 char name[IPSET_MAXNAMELEN];
263 /* Protocol version */
264 u8 protocol;
265 /* Set features to control swapping */
266 u8 features;
267 /* Set type dimension */
268 u8 dimension;
269 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */
270 u8 family;
271 /* Type revision */
272 u8 revision;
273
274 /* Create set */
275 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags);
276
277 /* Attribute policies */
278 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1];
279 const struct nla_policy adt_policy[IPSET_ATTR_ADT_MAX + 1];
280
281 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
282 struct module *me;
283};
284
285/* register and unregister set type */
286extern int ip_set_type_register(struct ip_set_type *set_type);
287extern void ip_set_type_unregister(struct ip_set_type *set_type);
288
289/* A generic IP set */
290struct ip_set {
291 /* The name of the set */
292 char name[IPSET_MAXNAMELEN];
293 /* Lock protecting the set data */
294 rwlock_t lock;
295 /* References to the set */
296 atomic_t ref;
297 /* The core set type */
298 struct ip_set_type *type;
299 /* The type variant doing the real job */
300 const struct ip_set_type_variant *variant;
301 /* The actual INET family of the set */
302 u8 family;
303 /* The type specific data */
304 void *data;
305};
306
307/* register and unregister set references */
308extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
309extern void ip_set_put_byindex(ip_set_id_t index);
310extern const char * ip_set_name_byindex(ip_set_id_t index);
311extern ip_set_id_t ip_set_nfnl_get(const char *name);
312extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index);
313extern void ip_set_nfnl_put(ip_set_id_t index);
314
315/* API for iptables set match, and SET target */
316extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
317 u8 family, u8 dim, u8 flags);
318extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
319 u8 family, u8 dim, u8 flags);
320extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
321 u8 family, u8 dim, u8 flags);
322
323/* Utility functions */
324extern void * ip_set_alloc(size_t size);
325extern void ip_set_free(void *members);
326extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
327extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
328
329static inline int
330ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr)
331{
332 __be32 ip;
333 int ret = ip_set_get_ipaddr4(nla, &ip);
334
335 if (ret)
336 return ret;
337 *ipaddr = ntohl(ip);
338 return 0;
339}
340
341/* Ignore IPSET_ERR_EXIST errors if asked to do so? */
342static inline bool
343ip_set_eexist(int ret, u32 flags)
344{
345 return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST);
346}
347
348/* Check the NLA_F_NET_BYTEORDER flag */
349static inline bool
350ip_set_attr_netorder(struct nlattr *tb[], int type)
351{
352 return tb[type] && (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
353}
354
355static inline bool
356ip_set_optattr_netorder(struct nlattr *tb[], int type)
357{
358 return !tb[type] || (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
359}
360
361/* Useful converters */
362static inline u32
363ip_set_get_h32(const struct nlattr *attr)
364{
365 return ntohl(nla_get_be32(attr));
366}
367
368static inline u16
369ip_set_get_h16(const struct nlattr *attr)
370{
371 return ntohs(nla_get_be16(attr));
372}
373
374#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
375#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
376
377#define NLA_PUT_IPADDR4(skb, type, ipaddr) \
378do { \
379 struct nlattr *__nested = ipset_nest_start(skb, type); \
380 \
381 if (!__nested) \
382 goto nla_put_failure; \
383 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \
384 ipset_nest_end(skb, __nested); \
385} while (0)
386
387#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \
388do { \
389 struct nlattr *__nested = ipset_nest_start(skb, type); \
390 \
391 if (!__nested) \
392 goto nla_put_failure; \
393 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \
394 sizeof(struct in6_addr), ipaddrptr); \
395 ipset_nest_end(skb, __nested); \
396} while (0)
397
398/* Get address from skbuff */
399static inline __be32
400ip4addr(const struct sk_buff *skb, bool src)
401{
402 return src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
403}
404
405static inline void
406ip4addrptr(const struct sk_buff *skb, bool src, __be32 *addr)
407{
408 *addr = src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
409}
410
411static inline void
412ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
413{
414 memcpy(addr, src ? &ipv6_hdr(skb)->saddr : &ipv6_hdr(skb)->daddr,
415 sizeof(*addr));
416}
417
418/* Calculate the bytes required to store the inclusive range of a-b */
419static inline int
420bitmap_bytes(u32 a, u32 b)
421{
422 return 4 * ((((b - a + 8) / 8) + 3) / 4);
423}
424
425/* Interface to iptables/ip6tables */
426
427#define SO_IP_SET 83
428
429union ip_set_name_index {
430 char name[IPSET_MAXNAMELEN];
431 ip_set_id_t index;
432};
433
434#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
435struct ip_set_req_get_set {
436 unsigned op;
437 unsigned version;
438 union ip_set_name_index set;
439};
440
441#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
442/* Uses ip_set_req_get_set */
443
444#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
445struct ip_set_req_version {
446 unsigned op;
447 unsigned version;
448};
449
450#endif /* __KERNEL__ */
451
452#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
new file mode 100644
index 000000000000..ec9d9bea1e37
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -0,0 +1,1074 @@
1#ifndef _IP_SET_AHASH_H
2#define _IP_SET_AHASH_H
3
4#include <linux/rcupdate.h>
5#include <linux/jhash.h>
6#include <linux/netfilter/ipset/ip_set_timeout.h>
7
8/* Hashing which uses arrays to resolve clashing. The hash table is resized
9 * (doubled) when searching becomes too long.
10 * Internally jhash is used with the assumption that the size of the
11 * stored data is a multiple of sizeof(u32). If storage supports timeout,
12 * the timeout field must be the last one in the data structure - that field
13 * is ignored when computing the hash key.
14 *
15 * Readers and resizing
16 *
17 * Resizing can be triggered by userspace command only, and those
18 * are serialized by the nfnl mutex. During resizing the set is
19 * read-locked, so the only possible concurrent operations are
20 * the kernel side readers. Those must be protected by proper RCU locking.
21 */
22
23/* Number of elements to store in an initial array block */
24#define AHASH_INIT_SIZE 4
25/* Max number of elements to store in an array block */
26#define AHASH_MAX_SIZE (3*4)
27
28/* A hash bucket */
29struct hbucket {
30 void *value; /* the array of the values */
31 u8 size; /* size of the array */
32 u8 pos; /* position of the first free entry */
33};
34
35/* The hash table: the table size stored here in order to make resizing easy */
36struct htable {
37 u8 htable_bits; /* size of hash table == 2^htable_bits */
38 struct hbucket bucket[0]; /* hashtable buckets */
39};
40
41#define hbucket(h, i) &((h)->bucket[i])
42
43/* Book-keeping of the prefixes added to the set */
44struct ip_set_hash_nets {
45 u8 cidr; /* the different cidr values in the set */
46 u32 nets; /* number of elements per cidr */
47};
48
49/* The generic ip_set hash structure */
50struct ip_set_hash {
51 struct htable *table; /* the hash table */
52 u32 maxelem; /* max elements in the hash */
53 u32 elements; /* current element (vs timeout) */
54 u32 initval; /* random jhash init value */
55 u32 timeout; /* timeout value, if enabled */
56 struct timer_list gc; /* garbage collection when timeout enabled */
57#ifdef IP_SET_HASH_WITH_NETMASK
58 u8 netmask; /* netmask value for subnets to store */
59#endif
60#ifdef IP_SET_HASH_WITH_NETS
61 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */
62#endif
63};
64
65/* Compute htable_bits from the user input parameter hashsize */
66static u8
67htable_bits(u32 hashsize)
68{
69 /* Assume that hashsize == 2^htable_bits */
70 u8 bits = fls(hashsize - 1);
71 if (jhash_size(bits) != hashsize)
72 /* Round up to the first 2^n value */
73 bits = fls(hashsize);
74
75 return bits;
76}
77
78#ifdef IP_SET_HASH_WITH_NETS
79
80#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
81
82/* Network cidr size book keeping when the hash stores different
83 * sized networks */
84static void
85add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
86{
87 u8 i;
88
89 ++h->nets[cidr-1].nets;
90
91 pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
92
93 if (h->nets[cidr-1].nets > 1)
94 return;
95
96 /* New cidr size */
97 for (i = 0; i < host_mask && h->nets[i].cidr; i++) {
98 /* Add in increasing prefix order, so larger cidr first */
99 if (h->nets[i].cidr < cidr)
100 swap(h->nets[i].cidr, cidr);
101 }
102 if (i < host_mask)
103 h->nets[i].cidr = cidr;
104}
105
106static void
107del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
108{
109 u8 i;
110
111 --h->nets[cidr-1].nets;
112
113 pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets);
114
115 if (h->nets[cidr-1].nets != 0)
116 return;
117
118 /* All entries with this cidr size deleted, so cleanup h->cidr[] */
119 for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) {
120 if (h->nets[i].cidr == cidr)
121 h->nets[i].cidr = cidr = h->nets[i+1].cidr;
122 }
123 h->nets[i - 1].cidr = 0;
124}
125#endif
126
127/* Destroy the hashtable part of the set */
128static void
129ahash_destroy(struct htable *t)
130{
131 struct hbucket *n;
132 u32 i;
133
134 for (i = 0; i < jhash_size(t->htable_bits); i++) {
135 n = hbucket(t, i);
136 if (n->size)
137 /* FIXME: use slab cache */
138 kfree(n->value);
139 }
140
141 ip_set_free(t);
142}
143
144/* Calculate the actual memory size of the set data */
145static size_t
146ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask)
147{
148 u32 i;
149 struct htable *t = h->table;
150 size_t memsize = sizeof(*h)
151 + sizeof(*t)
152#ifdef IP_SET_HASH_WITH_NETS
153 + sizeof(struct ip_set_hash_nets) * host_mask
154#endif
155 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
156
157 for (i = 0; i < jhash_size(t->htable_bits); i++)
158 memsize += t->bucket[i].size * dsize;
159
160 return memsize;
161}
162
163/* Flush a hash type of set: destroy all elements */
164static void
165ip_set_hash_flush(struct ip_set *set)
166{
167 struct ip_set_hash *h = set->data;
168 struct htable *t = h->table;
169 struct hbucket *n;
170 u32 i;
171
172 for (i = 0; i < jhash_size(t->htable_bits); i++) {
173 n = hbucket(t, i);
174 if (n->size) {
175 n->size = n->pos = 0;
176 /* FIXME: use slab cache */
177 kfree(n->value);
178 }
179 }
180#ifdef IP_SET_HASH_WITH_NETS
181 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
182 * SET_HOST_MASK(set->family));
183#endif
184 h->elements = 0;
185}
186
187/* Destroy a hash type of set */
188static void
189ip_set_hash_destroy(struct ip_set *set)
190{
191 struct ip_set_hash *h = set->data;
192
193 if (with_timeout(h->timeout))
194 del_timer_sync(&h->gc);
195
196 ahash_destroy(h->table);
197 kfree(h);
198
199 set->data = NULL;
200}
201
202#define HKEY(data, initval, htable_bits) \
203(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
204 & jhash_mask(htable_bits))
205
206#endif /* _IP_SET_AHASH_H */
207
208#define CONCAT(a, b, c) a##b##c
209#define TOKEN(a, b, c) CONCAT(a, b, c)
210
211/* Type/family dependent function prototypes */
212
213#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
214#define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull)
215#define type_pf_data_copy TOKEN(TYPE, PF, _data_copy)
216#define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out)
217#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask)
218#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
219#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
220
221#define type_pf_elem TOKEN(TYPE, PF, _elem)
222#define type_pf_telem TOKEN(TYPE, PF, _telem)
223#define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout)
224#define type_pf_data_expired TOKEN(TYPE, PF, _data_expired)
225#define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set)
226
227#define type_pf_elem_add TOKEN(TYPE, PF, _elem_add)
228#define type_pf_add TOKEN(TYPE, PF, _add)
229#define type_pf_del TOKEN(TYPE, PF, _del)
230#define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs)
231#define type_pf_test TOKEN(TYPE, PF, _test)
232
233#define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd)
234#define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem)
235#define type_pf_expire TOKEN(TYPE, PF, _expire)
236#define type_pf_tadd TOKEN(TYPE, PF, _tadd)
237#define type_pf_tdel TOKEN(TYPE, PF, _tdel)
238#define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs)
239#define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest)
240
241#define type_pf_resize TOKEN(TYPE, PF, _resize)
242#define type_pf_tresize TOKEN(TYPE, PF, _tresize)
243#define type_pf_flush ip_set_hash_flush
244#define type_pf_destroy ip_set_hash_destroy
245#define type_pf_head TOKEN(TYPE, PF, _head)
246#define type_pf_list TOKEN(TYPE, PF, _list)
247#define type_pf_tlist TOKEN(TYPE, PF, _tlist)
248#define type_pf_same_set TOKEN(TYPE, PF, _same_set)
249#define type_pf_kadt TOKEN(TYPE, PF, _kadt)
250#define type_pf_uadt TOKEN(TYPE, PF, _uadt)
251#define type_pf_gc TOKEN(TYPE, PF, _gc)
252#define type_pf_gc_init TOKEN(TYPE, PF, _gc_init)
253#define type_pf_variant TOKEN(TYPE, PF, _variant)
254#define type_pf_tvariant TOKEN(TYPE, PF, _tvariant)
255
256/* Flavour without timeout */
257
258/* Get the ith element from the array block n */
259#define ahash_data(n, i) \
260 ((struct type_pf_elem *)((n)->value) + (i))
261
262/* Add an element to the hash table when resizing the set:
263 * we spare the maintenance of the internal counters. */
264static int
265type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value)
266{
267 if (n->pos >= n->size) {
268 void *tmp;
269
270 if (n->size >= AHASH_MAX_SIZE)
271 /* Trigger rehashing */
272 return -EAGAIN;
273
274 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
275 * sizeof(struct type_pf_elem),
276 GFP_ATOMIC);
277 if (!tmp)
278 return -ENOMEM;
279 if (n->size) {
280 memcpy(tmp, n->value,
281 sizeof(struct type_pf_elem) * n->size);
282 kfree(n->value);
283 }
284 n->value = tmp;
285 n->size += AHASH_INIT_SIZE;
286 }
287 type_pf_data_copy(ahash_data(n, n->pos++), value);
288 return 0;
289}
290
291/* Resize a hash: create a new hash table with doubling the hashsize
292 * and inserting the elements to it. Repeat until we succeed or
293 * fail due to memory pressures. */
294static int
295type_pf_resize(struct ip_set *set, bool retried)
296{
297 struct ip_set_hash *h = set->data;
298 struct htable *t, *orig = h->table;
299 u8 htable_bits = orig->htable_bits;
300 const struct type_pf_elem *data;
301 struct hbucket *n, *m;
302 u32 i, j;
303 int ret;
304
305retry:
306 ret = 0;
307 htable_bits++;
308 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
309 set->name, orig->htable_bits, htable_bits, orig);
310 if (!htable_bits)
311 /* In case we have plenty of memory :-) */
312 return -IPSET_ERR_HASH_FULL;
313 t = ip_set_alloc(sizeof(*t)
314 + jhash_size(htable_bits) * sizeof(struct hbucket));
315 if (!t)
316 return -ENOMEM;
317 t->htable_bits = htable_bits;
318
319 read_lock_bh(&set->lock);
320 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
321 n = hbucket(orig, i);
322 for (j = 0; j < n->pos; j++) {
323 data = ahash_data(n, j);
324 m = hbucket(t, HKEY(data, h->initval, htable_bits));
325 ret = type_pf_elem_add(m, data);
326 if (ret < 0) {
327 read_unlock_bh(&set->lock);
328 ahash_destroy(t);
329 if (ret == -EAGAIN)
330 goto retry;
331 return ret;
332 }
333 }
334 }
335
336 rcu_assign_pointer(h->table, t);
337 read_unlock_bh(&set->lock);
338
339 /* Give time to other readers of the set */
340 synchronize_rcu_bh();
341
342 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
343 orig->htable_bits, orig, t->htable_bits, t);
344 ahash_destroy(orig);
345
346 return 0;
347}
348
349/* Add an element to a hash and update the internal counters when succeeded,
350 * otherwise report the proper error code. */
351static int
352type_pf_add(struct ip_set *set, void *value, u32 timeout)
353{
354 struct ip_set_hash *h = set->data;
355 struct htable *t;
356 const struct type_pf_elem *d = value;
357 struct hbucket *n;
358 int i, ret = 0;
359 u32 key;
360
361 if (h->elements >= h->maxelem)
362 return -IPSET_ERR_HASH_FULL;
363
364 rcu_read_lock_bh();
365 t = rcu_dereference_bh(h->table);
366 key = HKEY(value, h->initval, t->htable_bits);
367 n = hbucket(t, key);
368 for (i = 0; i < n->pos; i++)
369 if (type_pf_data_equal(ahash_data(n, i), d)) {
370 ret = -IPSET_ERR_EXIST;
371 goto out;
372 }
373
374 ret = type_pf_elem_add(n, value);
375 if (ret != 0)
376 goto out;
377
378#ifdef IP_SET_HASH_WITH_NETS
379 add_cidr(h, d->cidr, HOST_MASK);
380#endif
381 h->elements++;
382out:
383 rcu_read_unlock_bh();
384 return ret;
385}
386
387/* Delete an element from the hash: swap it with the last element
388 * and free up space if possible.
389 */
390static int
391type_pf_del(struct ip_set *set, void *value, u32 timeout)
392{
393 struct ip_set_hash *h = set->data;
394 struct htable *t = h->table;
395 const struct type_pf_elem *d = value;
396 struct hbucket *n;
397 int i;
398 struct type_pf_elem *data;
399 u32 key;
400
401 key = HKEY(value, h->initval, t->htable_bits);
402 n = hbucket(t, key);
403 for (i = 0; i < n->pos; i++) {
404 data = ahash_data(n, i);
405 if (!type_pf_data_equal(data, d))
406 continue;
407 if (i != n->pos - 1)
408 /* Not last one */
409 type_pf_data_copy(data, ahash_data(n, n->pos - 1));
410
411 n->pos--;
412 h->elements--;
413#ifdef IP_SET_HASH_WITH_NETS
414 del_cidr(h, d->cidr, HOST_MASK);
415#endif
416 if (n->pos + AHASH_INIT_SIZE < n->size) {
417 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
418 * sizeof(struct type_pf_elem),
419 GFP_ATOMIC);
420 if (!tmp)
421 return 0;
422 n->size -= AHASH_INIT_SIZE;
423 memcpy(tmp, n->value,
424 n->size * sizeof(struct type_pf_elem));
425 kfree(n->value);
426 n->value = tmp;
427 }
428 return 0;
429 }
430
431 return -IPSET_ERR_EXIST;
432}
433
434#ifdef IP_SET_HASH_WITH_NETS
435
436/* Special test function which takes into account the different network
437 * sizes added to the set */
438static int
439type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
440{
441 struct ip_set_hash *h = set->data;
442 struct htable *t = h->table;
443 struct hbucket *n;
444 const struct type_pf_elem *data;
445 int i, j = 0;
446 u32 key;
447 u8 host_mask = SET_HOST_MASK(set->family);
448
449 pr_debug("test by nets\n");
450 for (; j < host_mask && h->nets[j].cidr; j++) {
451 type_pf_data_netmask(d, h->nets[j].cidr);
452 key = HKEY(d, h->initval, t->htable_bits);
453 n = hbucket(t, key);
454 for (i = 0; i < n->pos; i++) {
455 data = ahash_data(n, i);
456 if (type_pf_data_equal(data, d))
457 return 1;
458 }
459 }
460 return 0;
461}
462#endif
463
464/* Test whether the element is added to the set */
465static int
466type_pf_test(struct ip_set *set, void *value, u32 timeout)
467{
468 struct ip_set_hash *h = set->data;
469 struct htable *t = h->table;
470 struct type_pf_elem *d = value;
471 struct hbucket *n;
472 const struct type_pf_elem *data;
473 int i;
474 u32 key;
475
476#ifdef IP_SET_HASH_WITH_NETS
477 /* If we test an IP address and not a network address,
478 * try all possible network sizes */
479 if (d->cidr == SET_HOST_MASK(set->family))
480 return type_pf_test_cidrs(set, d, timeout);
481#endif
482
483 key = HKEY(d, h->initval, t->htable_bits);
484 n = hbucket(t, key);
485 for (i = 0; i < n->pos; i++) {
486 data = ahash_data(n, i);
487 if (type_pf_data_equal(data, d))
488 return 1;
489 }
490 return 0;
491}
492
493/* Reply a HEADER request: fill out the header part of the set */
494static int
495type_pf_head(struct ip_set *set, struct sk_buff *skb)
496{
497 const struct ip_set_hash *h = set->data;
498 struct nlattr *nested;
499 size_t memsize;
500
501 read_lock_bh(&set->lock);
502 memsize = ahash_memsize(h, with_timeout(h->timeout)
503 ? sizeof(struct type_pf_telem)
504 : sizeof(struct type_pf_elem),
505 set->family == AF_INET ? 32 : 128);
506 read_unlock_bh(&set->lock);
507
508 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
509 if (!nested)
510 goto nla_put_failure;
511 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE,
512 htonl(jhash_size(h->table->htable_bits)));
513 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem));
514#ifdef IP_SET_HASH_WITH_NETMASK
515 if (h->netmask != HOST_MASK)
516 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask);
517#endif
518 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES,
519 htonl(atomic_read(&set->ref) - 1));
520 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize));
521 if (with_timeout(h->timeout))
522 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout));
523 ipset_nest_end(skb, nested);
524
525 return 0;
526nla_put_failure:
527 return -EMSGSIZE;
528}
529
530/* Reply a LIST/SAVE request: dump the elements of the specified set */
531static int
532type_pf_list(const struct ip_set *set,
533 struct sk_buff *skb, struct netlink_callback *cb)
534{
535 const struct ip_set_hash *h = set->data;
536 const struct htable *t = h->table;
537 struct nlattr *atd, *nested;
538 const struct hbucket *n;
539 const struct type_pf_elem *data;
540 u32 first = cb->args[2];
541 /* We assume that one hash bucket fills into one page */
542 void *incomplete;
543 int i;
544
545 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
546 if (!atd)
547 return -EMSGSIZE;
548 pr_debug("list hash set %s\n", set->name);
549 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
550 incomplete = skb_tail_pointer(skb);
551 n = hbucket(t, cb->args[2]);
552 pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n);
553 for (i = 0; i < n->pos; i++) {
554 data = ahash_data(n, i);
555 pr_debug("list hash %lu hbucket %p i %u, data %p\n",
556 cb->args[2], n, i, data);
557 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
558 if (!nested) {
559 if (cb->args[2] == first) {
560 nla_nest_cancel(skb, atd);
561 return -EMSGSIZE;
562 } else
563 goto nla_put_failure;
564 }
565 if (type_pf_data_list(skb, data))
566 goto nla_put_failure;
567 ipset_nest_end(skb, nested);
568 }
569 }
570 ipset_nest_end(skb, atd);
571 /* Set listing finished */
572 cb->args[2] = 0;
573
574 return 0;
575
576nla_put_failure:
577 nlmsg_trim(skb, incomplete);
578 ipset_nest_end(skb, atd);
579 if (unlikely(first == cb->args[2])) {
580 pr_warning("Can't list set %s: one bucket does not fit into "
581 "a message. Please report it!\n", set->name);
582 cb->args[2] = 0;
583 return -EMSGSIZE;
584 }
585 return 0;
586}
587
588static int
589type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,
590 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
591static int
592type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
593 enum ipset_adt adt, u32 *lineno, u32 flags);
594
595static const struct ip_set_type_variant type_pf_variant = {
596 .kadt = type_pf_kadt,
597 .uadt = type_pf_uadt,
598 .adt = {
599 [IPSET_ADD] = type_pf_add,
600 [IPSET_DEL] = type_pf_del,
601 [IPSET_TEST] = type_pf_test,
602 },
603 .destroy = type_pf_destroy,
604 .flush = type_pf_flush,
605 .head = type_pf_head,
606 .list = type_pf_list,
607 .resize = type_pf_resize,
608 .same_set = type_pf_same_set,
609};
610
611/* Flavour with timeout support */
612
613#define ahash_tdata(n, i) \
614 (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i))
615
616static inline u32
617type_pf_data_timeout(const struct type_pf_elem *data)
618{
619 const struct type_pf_telem *tdata =
620 (const struct type_pf_telem *) data;
621
622 return tdata->timeout;
623}
624
625static inline bool
626type_pf_data_expired(const struct type_pf_elem *data)
627{
628 const struct type_pf_telem *tdata =
629 (const struct type_pf_telem *) data;
630
631 return ip_set_timeout_expired(tdata->timeout);
632}
633
634static inline void
635type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
636{
637 struct type_pf_telem *tdata = (struct type_pf_telem *) data;
638
639 tdata->timeout = ip_set_timeout_set(timeout);
640}
641
642static int
643type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
644 u32 timeout)
645{
646 struct type_pf_elem *data;
647
648 if (n->pos >= n->size) {
649 void *tmp;
650
651 if (n->size >= AHASH_MAX_SIZE)
652 /* Trigger rehashing */
653 return -EAGAIN;
654
655 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
656 * sizeof(struct type_pf_telem),
657 GFP_ATOMIC);
658 if (!tmp)
659 return -ENOMEM;
660 if (n->size) {
661 memcpy(tmp, n->value,
662 sizeof(struct type_pf_telem) * n->size);
663 kfree(n->value);
664 }
665 n->value = tmp;
666 n->size += AHASH_INIT_SIZE;
667 }
668 data = ahash_tdata(n, n->pos++);
669 type_pf_data_copy(data, value);
670 type_pf_data_timeout_set(data, timeout);
671 return 0;
672}
673
674/* Delete expired elements from the hashtable */
675static void
676type_pf_expire(struct ip_set_hash *h)
677{
678 struct htable *t = h->table;
679 struct hbucket *n;
680 struct type_pf_elem *data;
681 u32 i;
682 int j;
683
684 for (i = 0; i < jhash_size(t->htable_bits); i++) {
685 n = hbucket(t, i);
686 for (j = 0; j < n->pos; j++) {
687 data = ahash_tdata(n, j);
688 if (type_pf_data_expired(data)) {
689 pr_debug("expired %u/%u\n", i, j);
690#ifdef IP_SET_HASH_WITH_NETS
691 del_cidr(h, data->cidr, HOST_MASK);
692#endif
693 if (j != n->pos - 1)
694 /* Not last one */
695 type_pf_data_copy(data,
696 ahash_tdata(n, n->pos - 1));
697 n->pos--;
698 h->elements--;
699 }
700 }
701 if (n->pos + AHASH_INIT_SIZE < n->size) {
702 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
703 * sizeof(struct type_pf_telem),
704 GFP_ATOMIC);
705 if (!tmp)
706 /* Still try to delete expired elements */
707 continue;
708 n->size -= AHASH_INIT_SIZE;
709 memcpy(tmp, n->value,
710 n->size * sizeof(struct type_pf_telem));
711 kfree(n->value);
712 n->value = tmp;
713 }
714 }
715}
716
717static int
718type_pf_tresize(struct ip_set *set, bool retried)
719{
720 struct ip_set_hash *h = set->data;
721 struct htable *t, *orig = h->table;
722 u8 htable_bits = orig->htable_bits;
723 const struct type_pf_elem *data;
724 struct hbucket *n, *m;
725 u32 i, j;
726 int ret;
727
728 /* Try to cleanup once */
729 if (!retried) {
730 i = h->elements;
731 write_lock_bh(&set->lock);
732 type_pf_expire(set->data);
733 write_unlock_bh(&set->lock);
734 if (h->elements < i)
735 return 0;
736 }
737
738retry:
739 ret = 0;
740 htable_bits++;
741 if (!htable_bits)
742 /* In case we have plenty of memory :-) */
743 return -IPSET_ERR_HASH_FULL;
744 t = ip_set_alloc(sizeof(*t)
745 + jhash_size(htable_bits) * sizeof(struct hbucket));
746 if (!t)
747 return -ENOMEM;
748 t->htable_bits = htable_bits;
749
750 read_lock_bh(&set->lock);
751 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
752 n = hbucket(orig, i);
753 for (j = 0; j < n->pos; j++) {
754 data = ahash_tdata(n, j);
755 m = hbucket(t, HKEY(data, h->initval, htable_bits));
756 ret = type_pf_elem_tadd(m, data,
757 type_pf_data_timeout(data));
758 if (ret < 0) {
759 read_unlock_bh(&set->lock);
760 ahash_destroy(t);
761 if (ret == -EAGAIN)
762 goto retry;
763 return ret;
764 }
765 }
766 }
767
768 rcu_assign_pointer(h->table, t);
769 read_unlock_bh(&set->lock);
770
771 /* Give time to other readers of the set */
772 synchronize_rcu_bh();
773
774 ahash_destroy(orig);
775
776 return 0;
777}
778
779static int
780type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
781{
782 struct ip_set_hash *h = set->data;
783 struct htable *t = h->table;
784 const struct type_pf_elem *d = value;
785 struct hbucket *n;
786 struct type_pf_elem *data;
787 int ret = 0, i, j = AHASH_MAX_SIZE + 1;
788 u32 key;
789
790 if (h->elements >= h->maxelem)
791 /* FIXME: when set is full, we slow down here */
792 type_pf_expire(h);
793 if (h->elements >= h->maxelem)
794 return -IPSET_ERR_HASH_FULL;
795
796 rcu_read_lock_bh();
797 t = rcu_dereference_bh(h->table);
798 key = HKEY(d, h->initval, t->htable_bits);
799 n = hbucket(t, key);
800 for (i = 0; i < n->pos; i++) {
801 data = ahash_tdata(n, i);
802 if (type_pf_data_equal(data, d)) {
803 if (type_pf_data_expired(data))
804 j = i;
805 else {
806 ret = -IPSET_ERR_EXIST;
807 goto out;
808 }
809 } else if (j == AHASH_MAX_SIZE + 1 &&
810 type_pf_data_expired(data))
811 j = i;
812 }
813 if (j != AHASH_MAX_SIZE + 1) {
814 data = ahash_tdata(n, j);
815#ifdef IP_SET_HASH_WITH_NETS
816 del_cidr(h, data->cidr, HOST_MASK);
817 add_cidr(h, d->cidr, HOST_MASK);
818#endif
819 type_pf_data_copy(data, d);
820 type_pf_data_timeout_set(data, timeout);
821 goto out;
822 }
823 ret = type_pf_elem_tadd(n, d, timeout);
824 if (ret != 0)
825 goto out;
826
827#ifdef IP_SET_HASH_WITH_NETS
828 add_cidr(h, d->cidr, HOST_MASK);
829#endif
830 h->elements++;
831out:
832 rcu_read_unlock_bh();
833 return ret;
834}
835
836static int
837type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
838{
839 struct ip_set_hash *h = set->data;
840 struct htable *t = h->table;
841 const struct type_pf_elem *d = value;
842 struct hbucket *n;
843 int i, ret = 0;
844 struct type_pf_elem *data;
845 u32 key;
846
847 key = HKEY(value, h->initval, t->htable_bits);
848 n = hbucket(t, key);
849 for (i = 0; i < n->pos; i++) {
850 data = ahash_tdata(n, i);
851 if (!type_pf_data_equal(data, d))
852 continue;
853 if (type_pf_data_expired(data))
854 ret = -IPSET_ERR_EXIST;
855 if (i != n->pos - 1)
856 /* Not last one */
857 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
858
859 n->pos--;
860 h->elements--;
861#ifdef IP_SET_HASH_WITH_NETS
862 del_cidr(h, d->cidr, HOST_MASK);
863#endif
864 if (n->pos + AHASH_INIT_SIZE < n->size) {
865 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
866 * sizeof(struct type_pf_telem),
867 GFP_ATOMIC);
868 if (!tmp)
869 return 0;
870 n->size -= AHASH_INIT_SIZE;
871 memcpy(tmp, n->value,
872 n->size * sizeof(struct type_pf_telem));
873 kfree(n->value);
874 n->value = tmp;
875 }
876 return 0;
877 }
878
879 return -IPSET_ERR_EXIST;
880}
881
882#ifdef IP_SET_HASH_WITH_NETS
883static int
884type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
885{
886 struct ip_set_hash *h = set->data;
887 struct htable *t = h->table;
888 struct type_pf_elem *data;
889 struct hbucket *n;
890 int i, j = 0;
891 u32 key;
892 u8 host_mask = SET_HOST_MASK(set->family);
893
894 for (; j < host_mask && h->nets[j].cidr; j++) {
895 type_pf_data_netmask(d, h->nets[j].cidr);
896 key = HKEY(d, h->initval, t->htable_bits);
897 n = hbucket(t, key);
898 for (i = 0; i < n->pos; i++) {
899 data = ahash_tdata(n, i);
900 if (type_pf_data_equal(data, d))
901 return !type_pf_data_expired(data);
902 }
903 }
904 return 0;
905}
906#endif
907
908static int
909type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
910{
911 struct ip_set_hash *h = set->data;
912 struct htable *t = h->table;
913 struct type_pf_elem *data, *d = value;
914 struct hbucket *n;
915 int i;
916 u32 key;
917
918#ifdef IP_SET_HASH_WITH_NETS
919 if (d->cidr == SET_HOST_MASK(set->family))
920 return type_pf_ttest_cidrs(set, d, timeout);
921#endif
922 key = HKEY(d, h->initval, t->htable_bits);
923 n = hbucket(t, key);
924 for (i = 0; i < n->pos; i++) {
925 data = ahash_tdata(n, i);
926 if (type_pf_data_equal(data, d))
927 return !type_pf_data_expired(data);
928 }
929 return 0;
930}
931
932static int
933type_pf_tlist(const struct ip_set *set,
934 struct sk_buff *skb, struct netlink_callback *cb)
935{
936 const struct ip_set_hash *h = set->data;
937 const struct htable *t = h->table;
938 struct nlattr *atd, *nested;
939 const struct hbucket *n;
940 const struct type_pf_elem *data;
941 u32 first = cb->args[2];
942 /* We assume that one hash bucket fills into one page */
943 void *incomplete;
944 int i;
945
946 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
947 if (!atd)
948 return -EMSGSIZE;
949 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
950 incomplete = skb_tail_pointer(skb);
951 n = hbucket(t, cb->args[2]);
952 for (i = 0; i < n->pos; i++) {
953 data = ahash_tdata(n, i);
954 pr_debug("list %p %u\n", n, i);
955 if (type_pf_data_expired(data))
956 continue;
957 pr_debug("do list %p %u\n", n, i);
958 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
959 if (!nested) {
960 if (cb->args[2] == first) {
961 nla_nest_cancel(skb, atd);
962 return -EMSGSIZE;
963 } else
964 goto nla_put_failure;
965 }
966 if (type_pf_data_tlist(skb, data))
967 goto nla_put_failure;
968 ipset_nest_end(skb, nested);
969 }
970 }
971 ipset_nest_end(skb, atd);
972 /* Set listing finished */
973 cb->args[2] = 0;
974
975 return 0;
976
977nla_put_failure:
978 nlmsg_trim(skb, incomplete);
979 ipset_nest_end(skb, atd);
980 if (unlikely(first == cb->args[2])) {
981 pr_warning("Can't list set %s: one bucket does not fit into "
982 "a message. Please report it!\n", set->name);
983 cb->args[2] = 0;
984 return -EMSGSIZE;
985 }
986 return 0;
987}
988
989static const struct ip_set_type_variant type_pf_tvariant = {
990 .kadt = type_pf_kadt,
991 .uadt = type_pf_uadt,
992 .adt = {
993 [IPSET_ADD] = type_pf_tadd,
994 [IPSET_DEL] = type_pf_tdel,
995 [IPSET_TEST] = type_pf_ttest,
996 },
997 .destroy = type_pf_destroy,
998 .flush = type_pf_flush,
999 .head = type_pf_head,
1000 .list = type_pf_tlist,
1001 .resize = type_pf_tresize,
1002 .same_set = type_pf_same_set,
1003};
1004
1005static void
1006type_pf_gc(unsigned long ul_set)
1007{
1008 struct ip_set *set = (struct ip_set *) ul_set;
1009 struct ip_set_hash *h = set->data;
1010
1011 pr_debug("called\n");
1012 write_lock_bh(&set->lock);
1013 type_pf_expire(h);
1014 write_unlock_bh(&set->lock);
1015
1016 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1017 add_timer(&h->gc);
1018}
1019
1020static void
1021type_pf_gc_init(struct ip_set *set)
1022{
1023 struct ip_set_hash *h = set->data;
1024
1025 init_timer(&h->gc);
1026 h->gc.data = (unsigned long) set;
1027 h->gc.function = type_pf_gc;
1028 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1029 add_timer(&h->gc);
1030 pr_debug("gc initialized, run in every %u\n",
1031 IPSET_GC_PERIOD(h->timeout));
1032}
1033
1034#undef type_pf_data_equal
1035#undef type_pf_data_isnull
1036#undef type_pf_data_copy
1037#undef type_pf_data_zero_out
1038#undef type_pf_data_list
1039#undef type_pf_data_tlist
1040
1041#undef type_pf_elem
1042#undef type_pf_telem
1043#undef type_pf_data_timeout
1044#undef type_pf_data_expired
1045#undef type_pf_data_netmask
1046#undef type_pf_data_timeout_set
1047
1048#undef type_pf_elem_add
1049#undef type_pf_add
1050#undef type_pf_del
1051#undef type_pf_test_cidrs
1052#undef type_pf_test
1053
1054#undef type_pf_elem_tadd
1055#undef type_pf_expire
1056#undef type_pf_tadd
1057#undef type_pf_tdel
1058#undef type_pf_ttest_cidrs
1059#undef type_pf_ttest
1060
1061#undef type_pf_resize
1062#undef type_pf_tresize
1063#undef type_pf_flush
1064#undef type_pf_destroy
1065#undef type_pf_head
1066#undef type_pf_list
1067#undef type_pf_tlist
1068#undef type_pf_same_set
1069#undef type_pf_kadt
1070#undef type_pf_uadt
1071#undef type_pf_gc
1072#undef type_pf_gc_init
1073#undef type_pf_variant
1074#undef type_pf_tvariant
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h
new file mode 100644
index 000000000000..61a9e8746c83
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -0,0 +1,31 @@
1#ifndef __IP_SET_BITMAP_H
2#define __IP_SET_BITMAP_H
3
4/* Bitmap type specific error codes */
5enum {
6 /* The element is out of the range of the set */
7 IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
8 /* The range exceeds the size limit of the set type */
9 IPSET_ERR_BITMAP_RANGE_SIZE,
10};
11
12#ifdef __KERNEL__
13#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
14
15/* Common functions */
16
17static inline u32
18range_to_mask(u32 from, u32 to, u8 *bits)
19{
20 u32 mask = 0xFFFFFFFE;
21
22 *bits = 32;
23 while (--(*bits) > 0 && mask && (to & mask) != from)
24 mask <<= 1;
25
26 return mask;
27}
28
29#endif /* __KERNEL__ */
30
31#endif /* __IP_SET_BITMAP_H */
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h
new file mode 100644
index 000000000000..3882a81a3b3c
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_getport.h
@@ -0,0 +1,21 @@
1#ifndef _IP_SET_GETPORT_H
2#define _IP_SET_GETPORT_H
3
4extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
5 __be16 *port, u8 *proto);
6
7#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
8extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
9 __be16 *port, u8 *proto);
10#else
11static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
12 __be16 *port, u8 *proto)
13{
14 return false;
15}
16#endif
17
18extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
19 __be16 *port);
20
21#endif /*_IP_SET_GETPORT_H*/
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h
new file mode 100644
index 000000000000..b86f15c04524
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_hash.h
@@ -0,0 +1,26 @@
1#ifndef __IP_SET_HASH_H
2#define __IP_SET_HASH_H
3
4/* Hash type specific error codes */
5enum {
6 /* Hash is full */
7 IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
8 /* Null-valued element */
9 IPSET_ERR_HASH_ELEM,
10 /* Invalid protocol */
11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO,
14};
15
16#ifdef __KERNEL__
17
18#define IPSET_DEFAULT_HASHSIZE 1024
19#define IPSET_MIMINAL_HASHSIZE 64
20#define IPSET_DEFAULT_MAXELEM 65536
21#define IPSET_DEFAULT_PROBES 4
22#define IPSET_DEFAULT_RESIZE 100
23
24#endif /* __KERNEL__ */
25
26#endif /* __IP_SET_HASH_H */
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
new file mode 100644
index 000000000000..40a63f302613
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -0,0 +1,27 @@
1#ifndef __IP_SET_LIST_H
2#define __IP_SET_LIST_H
3
4/* List type specific error codes */
5enum {
6 /* Set name to be added/deleted/tested does not exist. */
7 IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
8 /* list:set type is not permitted to add */
9 IPSET_ERR_LOOP,
10 /* Missing reference set */
11 IPSET_ERR_BEFORE,
12 /* Reference set does not exist */
13 IPSET_ERR_NAMEREF,
14 /* Set is full */
15 IPSET_ERR_LIST_FULL,
16 /* Reference set is not added to the set */
17 IPSET_ERR_REF_EXIST,
18};
19
20#ifdef __KERNEL__
21
22#define IP_SET_LIST_DEFAULT_SIZE 8
23#define IP_SET_LIST_MIN_SIZE 4
24
25#endif /* __KERNEL__ */
26
27#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
new file mode 100644
index 000000000000..9f30c5f2ec1c
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -0,0 +1,127 @@
1#ifndef _IP_SET_TIMEOUT_H
2#define _IP_SET_TIMEOUT_H
3
4/* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifdef __KERNEL__
12
13/* How often should the gc be run by default */
14#define IPSET_GC_TIME (3 * 60)
15
16/* Timeout period depending on the timeout value of the given set */
17#define IPSET_GC_PERIOD(timeout) \
18 ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1)
19
20/* Set is defined without timeout support: timeout value may be 0 */
21#define IPSET_NO_TIMEOUT UINT_MAX
22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)
24
25static inline unsigned int
26ip_set_timeout_uget(struct nlattr *tb)
27{
28 unsigned int timeout = ip_set_get_h32(tb);
29
30 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
31 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
32}
33
34#ifdef IP_SET_BITMAP_TIMEOUT
35
36/* Bitmap specific timeout constants and macros for the entries */
37
38/* Bitmap entry is unset */
39#define IPSET_ELEM_UNSET 0
40/* Bitmap entry is set with no timeout value */
41#define IPSET_ELEM_PERMANENT (UINT_MAX/2)
42
43static inline bool
44ip_set_timeout_test(unsigned long timeout)
45{
46 return timeout != IPSET_ELEM_UNSET &&
47 (timeout == IPSET_ELEM_PERMANENT ||
48 time_after(timeout, jiffies));
49}
50
51static inline bool
52ip_set_timeout_expired(unsigned long timeout)
53{
54 return timeout != IPSET_ELEM_UNSET &&
55 timeout != IPSET_ELEM_PERMANENT &&
56 time_before(timeout, jiffies);
57}
58
59static inline unsigned long
60ip_set_timeout_set(u32 timeout)
61{
62 unsigned long t;
63
64 if (!timeout)
65 return IPSET_ELEM_PERMANENT;
66
67 t = timeout * HZ + jiffies;
68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 /* Bingo! */
70 t++;
71
72 return t;
73}
74
75static inline u32
76ip_set_timeout_get(unsigned long timeout)
77{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
79}
80
81#else
82
83/* Hash specific timeout constants and macros for the entries */
84
85/* Hash entry is set with no timeout value */
86#define IPSET_ELEM_PERMANENT 0
87
88static inline bool
89ip_set_timeout_test(unsigned long timeout)
90{
91 return timeout == IPSET_ELEM_PERMANENT ||
92 time_after(timeout, jiffies);
93}
94
95static inline bool
96ip_set_timeout_expired(unsigned long timeout)
97{
98 return timeout != IPSET_ELEM_PERMANENT &&
99 time_before(timeout, jiffies);
100}
101
102static inline unsigned long
103ip_set_timeout_set(u32 timeout)
104{
105 unsigned long t;
106
107 if (!timeout)
108 return IPSET_ELEM_PERMANENT;
109
110 t = timeout * HZ + jiffies;
111 if (t == IPSET_ELEM_PERMANENT)
112 /* Bingo! :-) */
113 t++;
114
115 return t;
116}
117
118static inline u32
119ip_set_timeout_get(unsigned long timeout)
120{
121 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
122}
123#endif /* ! IP_SET_BITMAP_TIMEOUT */
124
125#endif /* __KERNEL__ */
126
127#endif /* _IP_SET_TIMEOUT_H */
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h
new file mode 100644
index 000000000000..0e1fb50da562
--- /dev/null
+++ b/include/linux/netfilter/ipset/pfxlen.h
@@ -0,0 +1,35 @@
1#ifndef _PFXLEN_H
2#define _PFXLEN_H
3
4#include <asm/byteorder.h>
5#include <linux/netfilter.h>
6
7/* Prefixlen maps, by Jan Engelhardt */
8extern const union nf_inet_addr ip_set_netmask_map[];
9extern const union nf_inet_addr ip_set_hostmask_map[];
10
11static inline __be32
12ip_set_netmask(u8 pfxlen)
13{
14 return ip_set_netmask_map[pfxlen].ip;
15}
16
17static inline const __be32 *
18ip_set_netmask6(u8 pfxlen)
19{
20 return &ip_set_netmask_map[pfxlen].ip6[0];
21}
22
23static inline u32
24ip_set_hostmask(u8 pfxlen)
25{
26 return (__force u32) ip_set_hostmask_map[pfxlen].ip;
27}
28
29static inline const __be32 *
30ip_set_hostmask6(u8 pfxlen)
31{
32 return &ip_set_hostmask_map[pfxlen].ip6[0];
33}
34
35#endif /*_PFXLEN_H */
diff --git a/include/linux/netfilter/nf_conntrack_snmp.h b/include/linux/netfilter/nf_conntrack_snmp.h
new file mode 100644
index 000000000000..064bc63a5346
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_snmp.h
@@ -0,0 +1,9 @@
1#ifndef _NF_CONNTRACK_SNMP_H
2#define _NF_CONNTRACK_SNMP_H
3
4extern int (*nf_nat_snmp_hook)(struct sk_buff *skb,
5 unsigned int protoff,
6 struct nf_conn *ct,
7 enum ip_conntrack_info ctinfo);
8
9#endif /* _NF_CONNTRACK_SNMP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 361d6b5630ee..2b11fc1a86be 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -47,7 +47,8 @@ struct nfgenmsg {
47#define NFNL_SUBSYS_QUEUE 3 47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_COUNT 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7
51 52
52#ifdef __KERNEL__ 53#ifdef __KERNEL__
53 54
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 19711e3ffd42..debf1aefd753 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -42,6 +42,7 @@ enum ctattr_type {
42 CTA_SECMARK, /* obsolete */ 42 CTA_SECMARK, /* obsolete */
43 CTA_ZONE, 43 CTA_ZONE,
44 CTA_SECCTX, 44 CTA_SECCTX,
45 CTA_TIMESTAMP,
45 __CTA_MAX 46 __CTA_MAX
46}; 47};
47#define CTA_MAX (__CTA_MAX - 1) 48#define CTA_MAX (__CTA_MAX - 1)
@@ -127,6 +128,14 @@ enum ctattr_counters {
127}; 128};
128#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) 129#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
129 130
131enum ctattr_tstamp {
132 CTA_TIMESTAMP_UNSPEC,
133 CTA_TIMESTAMP_START,
134 CTA_TIMESTAMP_STOP,
135 __CTA_TIMESTAMP_MAX
136};
137#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
138
130enum ctattr_nat { 139enum ctattr_nat {
131 CTA_NAT_UNSPEC, 140 CTA_NAT_UNSPEC,
132 CTA_NAT_MINIP, 141 CTA_NAT_MINIP,
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 6712e713b299..37219525ff6f 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -611,8 +611,9 @@ struct _compat_xt_align {
611extern void xt_compat_lock(u_int8_t af); 611extern void xt_compat_lock(u_int8_t af);
612extern void xt_compat_unlock(u_int8_t af); 612extern void xt_compat_unlock(u_int8_t af);
613 613
614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); 614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
615extern void xt_compat_flush_offsets(u_int8_t af); 615extern void xt_compat_flush_offsets(u_int8_t af);
616extern void xt_compat_init_offsets(u_int8_t af, unsigned int number);
616extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); 617extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
617 618
618extern int xt_compat_match_offset(const struct xt_match *match); 619extern int xt_compat_match_offset(const struct xt_match *match);
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/linux/netfilter/xt_AUDIT.h
new file mode 100644
index 000000000000..38751d2ea52b
--- /dev/null
+++ b/include/linux/netfilter/xt_AUDIT.h
@@ -0,0 +1,30 @@
1/*
2 * Header file for iptables xt_AUDIT target
3 *
4 * (C) 2010-2011 Thomas Graf <tgraf@redhat.com>
5 * (C) 2010-2011 Red Hat, Inc.
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _XT_AUDIT_TARGET_H
13#define _XT_AUDIT_TARGET_H
14
15#include <linux/types.h>
16
17enum {
18 XT_AUDIT_TYPE_ACCEPT = 0,
19 XT_AUDIT_TYPE_DROP,
20 XT_AUDIT_TYPE_REJECT,
21 __XT_AUDIT_TYPE_MAX,
22};
23
24#define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1)
25
26struct xt_audit_info {
27 __u8 type; /* XT_AUDIT_TYPE_* */
28};
29
30#endif /* _XT_AUDIT_TARGET_H */
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index 1b564106891d..b56e76811c04 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -1,14 +1,16 @@
1#ifndef _XT_CT_H 1#ifndef _XT_CT_H
2#define _XT_CT_H 2#define _XT_CT_H
3 3
4#include <linux/types.h>
5
4#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
5 7
6struct xt_ct_target_info { 8struct xt_ct_target_info {
7 u_int16_t flags; 9 __u16 flags;
8 u_int16_t zone; 10 __u16 zone;
9 u_int32_t ct_events; 11 __u32 ct_events;
10 u_int32_t exp_events; 12 __u32 exp_events;
11 char helper[16]; 13 char helper[16];
12 14
13 /* Used internally by the kernel */ 15 /* Used internally by the kernel */
14 struct nf_conn *ct __attribute__((aligned(8))); 16 struct nf_conn *ct __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 2584f4a777de..9eafdbbb401c 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -20,4 +20,10 @@ struct xt_NFQ_info_v1 {
20 __u16 queues_total; 20 __u16 queues_total;
21}; 21};
22 22
23struct xt_NFQ_info_v2 {
24 __u16 queuenum;
25 __u16 queues_total;
26 __u16 bypass;
27};
28
23#endif /* _XT_NFQ_TARGET_H */ 29#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h
index 2db543214ff5..7157318499c2 100644
--- a/include/linux/netfilter/xt_TCPOPTSTRIP.h
+++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -1,13 +1,15 @@
1#ifndef _XT_TCPOPTSTRIP_H 1#ifndef _XT_TCPOPTSTRIP_H
2#define _XT_TCPOPTSTRIP_H 2#define _XT_TCPOPTSTRIP_H
3 3
4#include <linux/types.h>
5
4#define tcpoptstrip_set_bit(bmap, idx) \ 6#define tcpoptstrip_set_bit(bmap, idx) \
5 (bmap[(idx) >> 5] |= 1U << (idx & 31)) 7 (bmap[(idx) >> 5] |= 1U << (idx & 31))
6#define tcpoptstrip_test_bit(bmap, idx) \ 8#define tcpoptstrip_test_bit(bmap, idx) \
7 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) 9 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
8 10
9struct xt_tcpoptstrip_target_info { 11struct xt_tcpoptstrip_target_info {
10 u_int32_t strip_bmap[8]; 12 __u32 strip_bmap[8];
11}; 13};
12 14
13#endif /* _XT_TCPOPTSTRIP_H */ 15#endif /* _XT_TCPOPTSTRIP_H */
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h
index 3f3d69361289..902043c2073f 100644
--- a/include/linux/netfilter/xt_TPROXY.h
+++ b/include/linux/netfilter/xt_TPROXY.h
@@ -1,19 +1,21 @@
1#ifndef _XT_TPROXY_H 1#ifndef _XT_TPROXY_H
2#define _XT_TPROXY_H 2#define _XT_TPROXY_H
3 3
4#include <linux/types.h>
5
4/* TPROXY target is capable of marking the packet to perform 6/* TPROXY target is capable of marking the packet to perform
5 * redirection. We can get rid of that whenever we get support for 7 * redirection. We can get rid of that whenever we get support for
6 * mutliple targets in the same rule. */ 8 * mutliple targets in the same rule. */
7struct xt_tproxy_target_info { 9struct xt_tproxy_target_info {
8 u_int32_t mark_mask; 10 __u32 mark_mask;
9 u_int32_t mark_value; 11 __u32 mark_value;
10 __be32 laddr; 12 __be32 laddr;
11 __be16 lport; 13 __be16 lport;
12}; 14};
13 15
14struct xt_tproxy_target_info_v1 { 16struct xt_tproxy_target_info_v1 {
15 u_int32_t mark_mask; 17 __u32 mark_mask;
16 u_int32_t mark_value; 18 __u32 mark_value;
17 union nf_inet_addr laddr; 19 union nf_inet_addr laddr;
18 __be16 lport; 20 __be16 lport;
19}; 21};
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
index 886682656f09..9b883c8fbf54 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/linux/netfilter/xt_cluster.h
@@ -1,15 +1,17 @@
1#ifndef _XT_CLUSTER_MATCH_H 1#ifndef _XT_CLUSTER_MATCH_H
2#define _XT_CLUSTER_MATCH_H 2#define _XT_CLUSTER_MATCH_H
3 3
4#include <linux/types.h>
5
4enum xt_cluster_flags { 6enum xt_cluster_flags {
5 XT_CLUSTER_F_INV = (1 << 0) 7 XT_CLUSTER_F_INV = (1 << 0)
6}; 8};
7 9
8struct xt_cluster_match_info { 10struct xt_cluster_match_info {
9 u_int32_t total_nodes; 11 __u32 total_nodes;
10 u_int32_t node_mask; 12 __u32 node_mask;
11 u_int32_t hash_seed; 13 __u32 hash_seed;
12 u_int32_t flags; 14 __u32 flags;
13}; 15};
14 16
15#define XT_CLUSTER_NODES_MAX 32 17#define XT_CLUSTER_NODES_MAX 32
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
index eacfedc6b5d0..0ea5e79f5bd7 100644
--- a/include/linux/netfilter/xt_comment.h
+++ b/include/linux/netfilter/xt_comment.h
@@ -4,7 +4,7 @@
4#define XT_MAX_COMMENT_LEN 256 4#define XT_MAX_COMMENT_LEN 256
5 5
6struct xt_comment_info { 6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN]; 7 char comment[XT_MAX_COMMENT_LEN];
8}; 8};
9 9
10#endif /* XT_COMMENT_H */ 10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 7e3284bcbd2b..0ca66e97acbc 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -1,8 +1,15 @@
1#ifndef _XT_CONNLIMIT_H 1#ifndef _XT_CONNLIMIT_H
2#define _XT_CONNLIMIT_H 2#define _XT_CONNLIMIT_H
3 3
4#include <linux/types.h>
5
4struct xt_connlimit_data; 6struct xt_connlimit_data;
5 7
8enum {
9 XT_CONNLIMIT_INVERT = 1 << 0,
10 XT_CONNLIMIT_DADDR = 1 << 1,
11};
12
6struct xt_connlimit_info { 13struct xt_connlimit_info {
7 union { 14 union {
8 union nf_inet_addr mask; 15 union nf_inet_addr mask;
@@ -13,7 +20,14 @@ struct xt_connlimit_info {
13 }; 20 };
14#endif 21#endif
15 }; 22 };
16 unsigned int limit, inverse; 23 unsigned int limit;
24 union {
25 /* revision 0 */
26 unsigned int inverse;
27
28 /* revision 1 */
29 __u32 flags;
30 };
17 31
18 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
19 struct xt_connlimit_data *data __attribute__((aligned(8))); 33 struct xt_connlimit_data *data __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 54f47a2f6152..74b904d8f99c 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -58,4 +58,19 @@ struct xt_conntrack_mtinfo2 {
58 __u16 state_mask, status_mask; 58 __u16 state_mask, status_mask;
59}; 59};
60 60
61struct xt_conntrack_mtinfo3 {
62 union nf_inet_addr origsrc_addr, origsrc_mask;
63 union nf_inet_addr origdst_addr, origdst_mask;
64 union nf_inet_addr replsrc_addr, replsrc_mask;
65 union nf_inet_addr repldst_addr, repldst_mask;
66 __u32 expires_min, expires_max;
67 __u16 l4proto;
68 __u16 origsrc_port, origdst_port;
69 __u16 replsrc_port, repldst_port;
70 __u16 match_flags, invert_flags;
71 __u16 state_mask, status_mask;
72 __u16 origsrc_port_high, origdst_port_high;
73 __u16 replsrc_port_high, repldst_port_high;
74};
75
61#endif /*_XT_CONNTRACK_H*/ 76#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/linux/netfilter/xt_devgroup.h
new file mode 100644
index 000000000000..1babde0ec900
--- /dev/null
+++ b/include/linux/netfilter/xt_devgroup.h
@@ -0,0 +1,21 @@
1#ifndef _XT_DEVGROUP_H
2#define _XT_DEVGROUP_H
3
4#include <linux/types.h>
5
6enum xt_devgroup_flags {
7 XT_DEVGROUP_MATCH_SRC = 0x1,
8 XT_DEVGROUP_INVERT_SRC = 0x2,
9 XT_DEVGROUP_MATCH_DST = 0x4,
10 XT_DEVGROUP_INVERT_DST = 0x8,
11};
12
13struct xt_devgroup_info {
14 __u32 flags;
15 __u32 src_group;
16 __u32 src_mask;
17 __u32 dst_group;
18 __u32 dst_mask;
19};
20
21#endif /* _XT_DEVGROUP_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index b0d28c659ab7..ca6e03e47a17 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -1,6 +1,8 @@
1#ifndef _XT_QUOTA_H 1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H 2#define _XT_QUOTA_H
3 3
4#include <linux/types.h>
5
4enum xt_quota_flags { 6enum xt_quota_flags {
5 XT_QUOTA_INVERT = 0x1, 7 XT_QUOTA_INVERT = 0x1,
6}; 8};
@@ -9,9 +11,9 @@ enum xt_quota_flags {
9struct xt_quota_priv; 11struct xt_quota_priv;
10 12
11struct xt_quota_info { 13struct xt_quota_info {
12 u_int32_t flags; 14 __u32 flags;
13 u_int32_t pad; 15 __u32 pad;
14 aligned_u64 quota; 16 aligned_u64 quota;
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 struct xt_quota_priv *master; 19 struct xt_quota_priv *master;
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
new file mode 100644
index 000000000000..081f1ded2842
--- /dev/null
+++ b/include/linux/netfilter/xt_set.h
@@ -0,0 +1,56 @@
1#ifndef _XT_SET_H
2#define _XT_SET_H
3
4#include <linux/types.h>
5#include <linux/netfilter/ipset/ip_set.h>
6
7/* Revision 0 interface: backward compatible with netfilter/iptables */
8
9/*
10 * Option flags for kernel operations (xt_set_info_v0)
11 */
12#define IPSET_SRC 0x01 /* Source match/add */
13#define IPSET_DST 0x02 /* Destination match/add */
14#define IPSET_MATCH_INV 0x04 /* Inverse matching */
15
16struct xt_set_info_v0 {
17 ip_set_id_t index;
18 union {
19 __u32 flags[IPSET_DIM_MAX + 1];
20 struct {
21 __u32 __flags[IPSET_DIM_MAX];
22 __u8 dim;
23 __u8 flags;
24 } compat;
25 } u;
26};
27
28/* match and target infos */
29struct xt_set_info_match_v0 {
30 struct xt_set_info_v0 match_set;
31};
32
33struct xt_set_info_target_v0 {
34 struct xt_set_info_v0 add_set;
35 struct xt_set_info_v0 del_set;
36};
37
38/* Revision 1: current interface to netfilter/iptables */
39
40struct xt_set_info {
41 ip_set_id_t index;
42 __u8 dim;
43 __u8 flags;
44};
45
46/* match and target infos */
47struct xt_set_info_match {
48 struct xt_set_info match_set;
49};
50
51struct xt_set_info_target {
52 struct xt_set_info add_set;
53 struct xt_set_info del_set;
54};
55
56#endif /*_XT_SET_H*/
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 6f475b8ff34b..26d7217bd4f1 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SOCKET_H 1#ifndef _XT_SOCKET_H
2#define _XT_SOCKET_H 2#define _XT_SOCKET_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_SOCKET_TRANSPARENT = 1 << 0, 7 XT_SOCKET_TRANSPARENT = 1 << 0,
6}; 8};
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
index 14b6df412c9f..7c37fac576c4 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/linux/netfilter/xt_time.h
@@ -1,14 +1,16 @@
1#ifndef _XT_TIME_H 1#ifndef _XT_TIME_H
2#define _XT_TIME_H 1 2#define _XT_TIME_H 1
3 3
4#include <linux/types.h>
5
4struct xt_time_info { 6struct xt_time_info {
5 u_int32_t date_start; 7 __u32 date_start;
6 u_int32_t date_stop; 8 __u32 date_stop;
7 u_int32_t daytime_start; 9 __u32 daytime_start;
8 u_int32_t daytime_stop; 10 __u32 daytime_stop;
9 u_int32_t monthdays_match; 11 __u32 monthdays_match;
10 u_int8_t weekdays_match; 12 __u8 weekdays_match;
11 u_int8_t flags; 13 __u8 flags;
12}; 14};
13 15
14enum { 16enum {
diff --git a/include/linux/netfilter/xt_u32.h b/include/linux/netfilter/xt_u32.h
index 9947f56cdbdd..04d1bfea03c2 100644
--- a/include/linux/netfilter/xt_u32.h
+++ b/include/linux/netfilter/xt_u32.h
@@ -1,6 +1,8 @@
1#ifndef _XT_U32_H 1#ifndef _XT_U32_H
2#define _XT_U32_H 1 2#define _XT_U32_H 1
3 3
4#include <linux/types.h>
5
4enum xt_u32_ops { 6enum xt_u32_ops {
5 XT_U32_AND, 7 XT_U32_AND,
6 XT_U32_LEFTSH, 8 XT_U32_LEFTSH,
@@ -9,13 +11,13 @@ enum xt_u32_ops {
9}; 11};
10 12
11struct xt_u32_location_element { 13struct xt_u32_location_element {
12 u_int32_t number; 14 __u32 number;
13 u_int8_t nextop; 15 __u8 nextop;
14}; 16};
15 17
16struct xt_u32_value_element { 18struct xt_u32_value_element {
17 u_int32_t min; 19 __u32 min;
18 u_int32_t max; 20 __u32 max;
19}; 21};
20 22
21/* 23/*
@@ -27,14 +29,14 @@ struct xt_u32_value_element {
27struct xt_u32_test { 29struct xt_u32_test {
28 struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; 30 struct xt_u32_location_element location[XT_U32_MAXSIZE+1];
29 struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; 31 struct xt_u32_value_element value[XT_U32_MAXSIZE+1];
30 u_int8_t nnums; 32 __u8 nnums;
31 u_int8_t nvalues; 33 __u8 nvalues;
32}; 34};
33 35
34struct xt_u32 { 36struct xt_u32 {
35 struct xt_u32_test tests[XT_U32_MAXSIZE+1]; 37 struct xt_u32_test tests[XT_U32_MAXSIZE+1];
36 u_int8_t ntests; 38 __u8 ntests;
37 u_int8_t invert; 39 __u8 invert;
38}; 40};
39 41
40#endif /* _XT_U32_H */ 42#endif /* _XT_U32_H */
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index c73ef0b18bdc..be5be1577a56 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_802_3_H 1#ifndef __LINUX_BRIDGE_EBT_802_3_H
2#define __LINUX_BRIDGE_EBT_802_3_H 2#define __LINUX_BRIDGE_EBT_802_3_H
3 3
4#include <linux/types.h>
5
4#define EBT_802_3_SAP 0x01 6#define EBT_802_3_SAP 0x01
5#define EBT_802_3_TYPE 0x02 7#define EBT_802_3_TYPE 0x02
6 8
@@ -24,24 +26,24 @@
24 26
25/* ui has one byte ctrl, ni has two */ 27/* ui has one byte ctrl, ni has two */
26struct hdr_ui { 28struct hdr_ui {
27 uint8_t dsap; 29 __u8 dsap;
28 uint8_t ssap; 30 __u8 ssap;
29 uint8_t ctrl; 31 __u8 ctrl;
30 uint8_t orig[3]; 32 __u8 orig[3];
31 __be16 type; 33 __be16 type;
32}; 34};
33 35
34struct hdr_ni { 36struct hdr_ni {
35 uint8_t dsap; 37 __u8 dsap;
36 uint8_t ssap; 38 __u8 ssap;
37 __be16 ctrl; 39 __be16 ctrl;
38 uint8_t orig[3]; 40 __u8 orig[3];
39 __be16 type; 41 __be16 type;
40}; 42};
41 43
42struct ebt_802_3_hdr { 44struct ebt_802_3_hdr {
43 uint8_t daddr[6]; 45 __u8 daddr[6];
44 uint8_t saddr[6]; 46 __u8 saddr[6];
45 __be16 len; 47 __be16 len;
46 union { 48 union {
47 struct hdr_ui ui; 49 struct hdr_ui ui;
@@ -59,10 +61,10 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
59#endif 61#endif
60 62
61struct ebt_802_3_info { 63struct ebt_802_3_info {
62 uint8_t sap; 64 __u8 sap;
63 __be16 type; 65 __be16 type;
64 uint8_t bitmask; 66 __u8 bitmask;
65 uint8_t invflags; 67 __u8 invflags;
66}; 68};
67 69
68#endif 70#endif
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
index 0009558609a7..bd4e3ad0b706 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_AMONG_H 1#ifndef __LINUX_BRIDGE_EBT_AMONG_H
2#define __LINUX_BRIDGE_EBT_AMONG_H 2#define __LINUX_BRIDGE_EBT_AMONG_H
3 3
4#include <linux/types.h>
5
4#define EBT_AMONG_DST 0x01 6#define EBT_AMONG_DST 0x01
5#define EBT_AMONG_SRC 0x02 7#define EBT_AMONG_SRC 0x02
6 8
@@ -30,7 +32,7 @@
30 */ 32 */
31 33
32struct ebt_mac_wormhash_tuple { 34struct ebt_mac_wormhash_tuple {
33 uint32_t cmp[2]; 35 __u32 cmp[2];
34 __be32 ip; 36 __be32 ip;
35}; 37};
36 38
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index cbf4843b6b0f..522f3e427f49 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_ARP_H 1#ifndef __LINUX_BRIDGE_EBT_ARP_H
2#define __LINUX_BRIDGE_EBT_ARP_H 2#define __LINUX_BRIDGE_EBT_ARP_H
3 3
4#include <linux/types.h>
5
4#define EBT_ARP_OPCODE 0x01 6#define EBT_ARP_OPCODE 0x01
5#define EBT_ARP_HTYPE 0x02 7#define EBT_ARP_HTYPE 0x02
6#define EBT_ARP_PTYPE 0x04 8#define EBT_ARP_PTYPE 0x04
@@ -27,8 +29,8 @@ struct ebt_arp_info
27 unsigned char smmsk[ETH_ALEN]; 29 unsigned char smmsk[ETH_ALEN];
28 unsigned char dmaddr[ETH_ALEN]; 30 unsigned char dmaddr[ETH_ALEN];
29 unsigned char dmmsk[ETH_ALEN]; 31 unsigned char dmmsk[ETH_ALEN];
30 uint8_t bitmask; 32 __u8 bitmask;
31 uint8_t invflags; 33 __u8 invflags;
32}; 34};
33 35
34#endif 36#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
index 6a708fb92241..c4bbc41b0ea4 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_BRIDGE_EBT_IP_H 15#ifndef __LINUX_BRIDGE_EBT_IP_H
16#define __LINUX_BRIDGE_EBT_IP_H 16#define __LINUX_BRIDGE_EBT_IP_H
17 17
18#include <linux/types.h>
19
18#define EBT_IP_SOURCE 0x01 20#define EBT_IP_SOURCE 0x01
19#define EBT_IP_DEST 0x02 21#define EBT_IP_DEST 0x02
20#define EBT_IP_TOS 0x04 22#define EBT_IP_TOS 0x04
@@ -31,12 +33,12 @@ struct ebt_ip_info {
31 __be32 daddr; 33 __be32 daddr;
32 __be32 smsk; 34 __be32 smsk;
33 __be32 dmsk; 35 __be32 dmsk;
34 uint8_t tos; 36 __u8 tos;
35 uint8_t protocol; 37 __u8 protocol;
36 uint8_t bitmask; 38 __u8 bitmask;
37 uint8_t invflags; 39 __u8 invflags;
38 uint16_t sport[2]; 40 __u16 sport[2];
39 uint16_t dport[2]; 41 __u16 dport[2];
40}; 42};
41 43
42#endif 44#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h
index e5de98701519..42b889682721 100644
--- a/include/linux/netfilter_bridge/ebt_ip6.h
+++ b/include/linux/netfilter_bridge/ebt_ip6.h
@@ -12,14 +12,19 @@
12#ifndef __LINUX_BRIDGE_EBT_IP6_H 12#ifndef __LINUX_BRIDGE_EBT_IP6_H
13#define __LINUX_BRIDGE_EBT_IP6_H 13#define __LINUX_BRIDGE_EBT_IP6_H
14 14
15#include <linux/types.h>
16
15#define EBT_IP6_SOURCE 0x01 17#define EBT_IP6_SOURCE 0x01
16#define EBT_IP6_DEST 0x02 18#define EBT_IP6_DEST 0x02
17#define EBT_IP6_TCLASS 0x04 19#define EBT_IP6_TCLASS 0x04
18#define EBT_IP6_PROTO 0x08 20#define EBT_IP6_PROTO 0x08
19#define EBT_IP6_SPORT 0x10 21#define EBT_IP6_SPORT 0x10
20#define EBT_IP6_DPORT 0x20 22#define EBT_IP6_DPORT 0x20
23#define EBT_IP6_ICMP6 0x40
24
21#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ 25#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
22 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT) 26 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
27 EBT_IP6_ICMP6)
23#define EBT_IP6_MATCH "ip6" 28#define EBT_IP6_MATCH "ip6"
24 29
25/* the same values are used for the invflags */ 30/* the same values are used for the invflags */
@@ -28,12 +33,18 @@ struct ebt_ip6_info {
28 struct in6_addr daddr; 33 struct in6_addr daddr;
29 struct in6_addr smsk; 34 struct in6_addr smsk;
30 struct in6_addr dmsk; 35 struct in6_addr dmsk;
31 uint8_t tclass; 36 __u8 tclass;
32 uint8_t protocol; 37 __u8 protocol;
33 uint8_t bitmask; 38 __u8 bitmask;
34 uint8_t invflags; 39 __u8 invflags;
35 uint16_t sport[2]; 40 union {
36 uint16_t dport[2]; 41 __u16 sport[2];
42 __u8 icmpv6_type[2];
43 };
44 union {
45 __u16 dport[2];
46 __u8 icmpv6_code[2];
47 };
37}; 48};
38 49
39#endif 50#endif
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h
index 4bf76b751676..66d80b30ba0e 100644
--- a/include/linux/netfilter_bridge/ebt_limit.h
+++ b/include/linux/netfilter_bridge/ebt_limit.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H 1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H
2#define __LINUX_BRIDGE_EBT_LIMIT_H 2#define __LINUX_BRIDGE_EBT_LIMIT_H
3 3
4#include <linux/types.h>
5
4#define EBT_LIMIT_MATCH "limit" 6#define EBT_LIMIT_MATCH "limit"
5 7
6/* timings are in milliseconds. */ 8/* timings are in milliseconds. */
@@ -10,13 +12,13 @@
10 seconds, or one every 59 hours. */ 12 seconds, or one every 59 hours. */
11 13
12struct ebt_limit_info { 14struct ebt_limit_info {
13 u_int32_t avg; /* Average secs between packets * scale */ 15 __u32 avg; /* Average secs between packets * scale */
14 u_int32_t burst; /* Period multiplier for upper limit. */ 16 __u32 burst; /* Period multiplier for upper limit. */
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 unsigned long prev; 19 unsigned long prev;
18 u_int32_t credit; 20 __u32 credit;
19 u_int32_t credit_cap, cost; 21 __u32 credit_cap, cost;
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h
index cc2cdfb764bc..7e7f1d1fe494 100644
--- a/include/linux/netfilter_bridge/ebt_log.h
+++ b/include/linux/netfilter_bridge/ebt_log.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LOG_H 1#ifndef __LINUX_BRIDGE_EBT_LOG_H
2#define __LINUX_BRIDGE_EBT_LOG_H 2#define __LINUX_BRIDGE_EBT_LOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ 6#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
5#define EBT_LOG_ARP 0x02 7#define EBT_LOG_ARP 0x02
6#define EBT_LOG_NFLOG 0x04 8#define EBT_LOG_NFLOG 0x04
@@ -10,9 +12,9 @@
10#define EBT_LOG_WATCHER "log" 12#define EBT_LOG_WATCHER "log"
11 13
12struct ebt_log_info { 14struct ebt_log_info {
13 uint8_t loglevel; 15 __u8 loglevel;
14 uint8_t prefix[EBT_LOG_PREFIX_SIZE]; 16 __u8 prefix[EBT_LOG_PREFIX_SIZE];
15 uint32_t bitmask; 17 __u32 bitmask;
16}; 18};
17 19
18#endif 20#endif
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h
index 9ceb10ec0ed6..410f9e5a71d4 100644
--- a/include/linux/netfilter_bridge/ebt_mark_m.h
+++ b/include/linux/netfilter_bridge/ebt_mark_m.h
@@ -1,13 +1,15 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H 1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H
2#define __LINUX_BRIDGE_EBT_MARK_M_H 2#define __LINUX_BRIDGE_EBT_MARK_M_H
3 3
4#include <linux/types.h>
5
4#define EBT_MARK_AND 0x01 6#define EBT_MARK_AND 0x01
5#define EBT_MARK_OR 0x02 7#define EBT_MARK_OR 0x02
6#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) 8#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
7struct ebt_mark_m_info { 9struct ebt_mark_m_info {
8 unsigned long mark, mask; 10 unsigned long mark, mask;
9 uint8_t invert; 11 __u8 invert;
10 uint8_t bitmask; 12 __u8 bitmask;
11}; 13};
12#define EBT_MARK_MATCH "mark_m" 14#define EBT_MARK_MATCH "mark_m"
13 15
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
index 052817849b83..df829fce9125 100644
--- a/include/linux/netfilter_bridge/ebt_nflog.h
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H 1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H 2#define __LINUX_BRIDGE_EBT_NFLOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_NFLOG_MASK 0x0 6#define EBT_NFLOG_MASK 0x0
5 7
6#define EBT_NFLOG_PREFIX_SIZE 64 8#define EBT_NFLOG_PREFIX_SIZE 64
@@ -10,11 +12,11 @@
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1 12#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11 13
12struct ebt_nflog_info { 14struct ebt_nflog_info {
13 u_int32_t len; 15 __u32 len;
14 u_int16_t group; 16 __u16 group;
15 u_int16_t threshold; 17 __u16 threshold;
16 u_int16_t flags; 18 __u16 flags;
17 u_int16_t pad; 19 __u16 pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE]; 20 char prefix[EBT_NFLOG_PREFIX_SIZE];
19}; 21};
20 22
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h
index 51a799840931..c241badcd036 100644
--- a/include/linux/netfilter_bridge/ebt_pkttype.h
+++ b/include/linux/netfilter_bridge/ebt_pkttype.h
@@ -1,9 +1,11 @@
1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H 1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
2#define __LINUX_BRIDGE_EBT_PKTTYPE_H 2#define __LINUX_BRIDGE_EBT_PKTTYPE_H
3 3
4#include <linux/types.h>
5
4struct ebt_pkttype_info { 6struct ebt_pkttype_info {
5 uint8_t pkt_type; 7 __u8 pkt_type;
6 uint8_t invert; 8 __u8 invert;
7}; 9};
8#define EBT_PKTTYPE_MATCH "pkttype" 10#define EBT_PKTTYPE_MATCH "pkttype"
9 11
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h
index e503a0aa2728..1025b9f5fb7d 100644
--- a/include/linux/netfilter_bridge/ebt_stp.h
+++ b/include/linux/netfilter_bridge/ebt_stp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_STP_H 1#ifndef __LINUX_BRIDGE_EBT_STP_H
2#define __LINUX_BRIDGE_EBT_STP_H 2#define __LINUX_BRIDGE_EBT_STP_H
3 3
4#include <linux/types.h>
5
4#define EBT_STP_TYPE 0x0001 6#define EBT_STP_TYPE 0x0001
5 7
6#define EBT_STP_FLAGS 0x0002 8#define EBT_STP_FLAGS 0x0002
@@ -21,24 +23,24 @@
21#define EBT_STP_MATCH "stp" 23#define EBT_STP_MATCH "stp"
22 24
23struct ebt_stp_config_info { 25struct ebt_stp_config_info {
24 uint8_t flags; 26 __u8 flags;
25 uint16_t root_priol, root_priou; 27 __u16 root_priol, root_priou;
26 char root_addr[6], root_addrmsk[6]; 28 char root_addr[6], root_addrmsk[6];
27 uint32_t root_costl, root_costu; 29 __u32 root_costl, root_costu;
28 uint16_t sender_priol, sender_priou; 30 __u16 sender_priol, sender_priou;
29 char sender_addr[6], sender_addrmsk[6]; 31 char sender_addr[6], sender_addrmsk[6];
30 uint16_t portl, portu; 32 __u16 portl, portu;
31 uint16_t msg_agel, msg_ageu; 33 __u16 msg_agel, msg_ageu;
32 uint16_t max_agel, max_ageu; 34 __u16 max_agel, max_ageu;
33 uint16_t hello_timel, hello_timeu; 35 __u16 hello_timel, hello_timeu;
34 uint16_t forward_delayl, forward_delayu; 36 __u16 forward_delayl, forward_delayu;
35}; 37};
36 38
37struct ebt_stp_info { 39struct ebt_stp_info {
38 uint8_t type; 40 __u8 type;
39 struct ebt_stp_config_info config; 41 struct ebt_stp_config_info config;
40 uint16_t bitmask; 42 __u16 bitmask;
41 uint16_t invflags; 43 __u16 invflags;
42}; 44};
43 45
44#endif 46#endif
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h
index b677e2671541..89a6becb5269 100644
--- a/include/linux/netfilter_bridge/ebt_ulog.h
+++ b/include/linux/netfilter_bridge/ebt_ulog.h
@@ -1,6 +1,8 @@
1#ifndef _EBT_ULOG_H 1#ifndef _EBT_ULOG_H
2#define _EBT_ULOG_H 2#define _EBT_ULOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_ULOG_DEFAULT_NLGROUP 0 6#define EBT_ULOG_DEFAULT_NLGROUP 0
5#define EBT_ULOG_DEFAULT_QTHRESHOLD 1 7#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
6#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ 8#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
@@ -10,7 +12,7 @@
10#define EBT_ULOG_VERSION 1 12#define EBT_ULOG_VERSION 1
11 13
12struct ebt_ulog_info { 14struct ebt_ulog_info {
13 uint32_t nlgroup; 15 __u32 nlgroup;
14 unsigned int cprange; 16 unsigned int cprange;
15 unsigned int qthreshold; 17 unsigned int qthreshold;
16 char prefix[EBT_ULOG_PREFIX_LEN]; 18 char prefix[EBT_ULOG_PREFIX_LEN];
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
index 1d98be4031e7..967d1d5cf98d 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_VLAN_H 1#ifndef __LINUX_BRIDGE_EBT_VLAN_H
2#define __LINUX_BRIDGE_EBT_VLAN_H 2#define __LINUX_BRIDGE_EBT_VLAN_H
3 3
4#include <linux/types.h>
5
4#define EBT_VLAN_ID 0x01 6#define EBT_VLAN_ID 0x01
5#define EBT_VLAN_PRIO 0x02 7#define EBT_VLAN_PRIO 0x02
6#define EBT_VLAN_ENCAP 0x04 8#define EBT_VLAN_ENCAP 0x04
@@ -8,12 +10,12 @@
8#define EBT_VLAN_MATCH "vlan" 10#define EBT_VLAN_MATCH "vlan"
9 11
10struct ebt_vlan_info { 12struct ebt_vlan_info {
11 uint16_t id; /* VLAN ID {1-4095} */ 13 __u16 id; /* VLAN ID {1-4095} */
12 uint8_t prio; /* VLAN User Priority {0-7} */ 14 __u8 prio; /* VLAN User Priority {0-7} */
13 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ 15 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, 16 __u8 bitmask; /* Args bitmask bit 1=1 - ID arg,
15 bit 2=1 User-Priority arg, bit 3=1 encap*/ 17 bit 2=1 User-Priority arg, bit 3=1 encap*/
16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, 18 __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
17 bit 2=1 - inversed Pirority arg */ 19 bit 2=1 - inversed Pirority arg */
18}; 20};
19 21
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index e5a3687c8a72..c6a204c97047 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_CLUSTERIP_H_target 1#ifndef _IPT_CLUSTERIP_H_target
2#define _IPT_CLUSTERIP_H_target 2#define _IPT_CLUSTERIP_H_target
3 3
4#include <linux/types.h>
5
4enum clusterip_hashmode { 6enum clusterip_hashmode {
5 CLUSTERIP_HASHMODE_SIP = 0, 7 CLUSTERIP_HASHMODE_SIP = 0,
6 CLUSTERIP_HASHMODE_SIP_SPT, 8 CLUSTERIP_HASHMODE_SIP_SPT,
@@ -17,15 +19,15 @@ struct clusterip_config;
17 19
18struct ipt_clusterip_tgt_info { 20struct ipt_clusterip_tgt_info {
19 21
20 u_int32_t flags; 22 __u32 flags;
21 23
22 /* only relevant for new ones */ 24 /* only relevant for new ones */
23 u_int8_t clustermac[6]; 25 __u8 clustermac[6];
24 u_int16_t num_total_nodes; 26 __u16 num_total_nodes;
25 u_int16_t num_local_nodes; 27 __u16 num_local_nodes;
26 u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; 28 __u16 local_nodes[CLUSTERIP_MAX_NODES];
27 u_int32_t hash_mode; 29 __u32 hash_mode;
28 u_int32_t hash_initval; 30 __u32 hash_initval;
29 31
30 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
31 struct clusterip_config *config; 33 struct clusterip_config *config;
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h
index 7ca45918ab8e..bb88d5315a4d 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,6 +8,8 @@
8*/ 8*/
9#ifndef _IPT_ECN_TARGET_H 9#ifndef _IPT_ECN_TARGET_H
10#define _IPT_ECN_TARGET_H 10#define _IPT_ECN_TARGET_H
11
12#include <linux/types.h>
11#include <linux/netfilter/xt_DSCP.h> 13#include <linux/netfilter/xt_DSCP.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -19,11 +21,11 @@
19#define IPT_ECN_OP_MASK 0xce 21#define IPT_ECN_OP_MASK 0xce
20 22
21struct ipt_ECN_info { 23struct ipt_ECN_info {
22 u_int8_t operation; /* bitset of operations */ 24 __u8 operation; /* bitset of operations */
23 u_int8_t ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ 25 __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */
24 union { 26 union {
25 struct { 27 struct {
26 u_int8_t ece:1, cwr:1; /* TCP ECT bits */ 28 __u8 ece:1, cwr:1; /* TCP ECT bits */
27 } tcp; 29 } tcp;
28 } proto; 30 } proto;
29}; 31};
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index 2529660c5b38..5bca78267afd 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -1,15 +1,17 @@
1#ifndef _IPT_SAME_H 1#ifndef _IPT_SAME_H
2#define _IPT_SAME_H 2#define _IPT_SAME_H
3 3
4#include <linux/types.h>
5
4#define IPT_SAME_MAX_RANGE 10 6#define IPT_SAME_MAX_RANGE 10
5 7
6#define IPT_SAME_NODST 0x01 8#define IPT_SAME_NODST 0x01
7 9
8struct ipt_same_info { 10struct ipt_same_info {
9 unsigned char info; 11 unsigned char info;
10 u_int32_t rangesize; 12 __u32 rangesize;
11 u_int32_t ipnum; 13 __u32 ipnum;
12 u_int32_t *iparray; 14 __u32 *iparray;
13 15
14 /* hangs off end. */ 16 /* hangs off end. */
15 struct nf_nat_range range[IPT_SAME_MAX_RANGE]; 17 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h
index ee6611edc112..f6ac169d92f9 100644
--- a/include/linux/netfilter_ipv4/ipt_TTL.h
+++ b/include/linux/netfilter_ipv4/ipt_TTL.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_SET = 0, 10 IPT_TTL_SET = 0,
9 IPT_TTL_INC, 11 IPT_TTL_INC,
@@ -13,8 +15,8 @@ enum {
13#define IPT_TTL_MAXMODE IPT_TTL_DEC 15#define IPT_TTL_MAXMODE IPT_TTL_DEC
14 16
15struct ipt_TTL_info { 17struct ipt_TTL_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h
index 446de6aef983..0da42237c8da 100644
--- a/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_ADDRTYPE_H 1#ifndef _IPT_ADDRTYPE_H
2#define _IPT_ADDRTYPE_H 2#define _IPT_ADDRTYPE_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, 7 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001,
6 IPT_ADDRTYPE_INVERT_DEST = 0x0002, 8 IPT_ADDRTYPE_INVERT_DEST = 0x0002,
@@ -9,17 +11,17 @@ enum {
9}; 11};
10 12
11struct ipt_addrtype_info_v1 { 13struct ipt_addrtype_info_v1 {
12 u_int16_t source; /* source-type mask */ 14 __u16 source; /* source-type mask */
13 u_int16_t dest; /* dest-type mask */ 15 __u16 dest; /* dest-type mask */
14 u_int32_t flags; 16 __u32 flags;
15}; 17};
16 18
17/* revision 0 */ 19/* revision 0 */
18struct ipt_addrtype_info { 20struct ipt_addrtype_info {
19 u_int16_t source; /* source-type mask */ 21 __u16 source; /* source-type mask */
20 u_int16_t dest; /* dest-type mask */ 22 __u16 dest; /* dest-type mask */
21 u_int32_t invert_source; 23 __u32 invert_source;
22 u_int32_t invert_dest; 24 __u32 invert_dest;
23}; 25};
24 26
25#endif 27#endif
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h
index 2e555b4d05e3..4e02bb0119e3 100644
--- a/include/linux/netfilter_ipv4/ipt_ah.h
+++ b/include/linux/netfilter_ipv4/ipt_ah.h
@@ -1,9 +1,11 @@
1#ifndef _IPT_AH_H 1#ifndef _IPT_AH_H
2#define _IPT_AH_H 2#define _IPT_AH_H
3 3
4#include <linux/types.h>
5
4struct ipt_ah { 6struct ipt_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int8_t invflags; /* Inverse flags */ 8 __u8 invflags; /* Inverse flags */
7}; 9};
8 10
9 11
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index 9945baa4ccd7..eabf95fb7d3e 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -8,6 +8,8 @@
8*/ 8*/
9#ifndef _IPT_ECN_H 9#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 10#define _IPT_ECN_H
11
12#include <linux/types.h>
11#include <linux/netfilter/xt_dscp.h> 13#include <linux/netfilter/xt_dscp.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -20,12 +22,12 @@
20 22
21/* match info */ 23/* match info */
22struct ipt_ecn_info { 24struct ipt_ecn_info {
23 u_int8_t operation; 25 __u8 operation;
24 u_int8_t invert; 26 __u8 invert;
25 u_int8_t ip_ect; 27 __u8 ip_ect;
26 union { 28 union {
27 struct { 29 struct {
28 u_int8_t ect; 30 __u8 ect;
29 } tcp; 31 } tcp;
30 } proto; 32 } proto;
31}; 33};
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/linux/netfilter_ipv4/ipt_ttl.h
index ee24fd86a3aa..37bee4442486 100644
--- a/include/linux/netfilter_ipv4/ipt_ttl.h
+++ b/include/linux/netfilter_ipv4/ipt_ttl.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_EQ = 0, /* equals */ 10 IPT_TTL_EQ = 0, /* equals */
9 IPT_TTL_NE, /* not equals */ 11 IPT_TTL_NE, /* not equals */
@@ -13,8 +15,8 @@ enum {
13 15
14 16
15struct ipt_ttl_info { 17struct ipt_ttl_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h
index afb7813d45ab..ebd8ead1bb63 100644
--- a/include/linux/netfilter_ipv6/ip6t_HL.h
+++ b/include/linux/netfilter_ipv6/ip6t_HL.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_SET = 0, 11 IP6T_HL_SET = 0,
10 IP6T_HL_INC, 12 IP6T_HL_INC,
@@ -14,8 +16,8 @@ enum {
14#define IP6T_HL_MAXMODE IP6T_HL_DEC 16#define IP6T_HL_MAXMODE IP6T_HL_DEC
15 17
16struct ip6t_HL_info { 18struct ip6t_HL_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h
index 6be6504162bb..205ed62e4605 100644
--- a/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_REJECT_H 1#ifndef _IP6T_REJECT_H
2#define _IP6T_REJECT_H 2#define _IP6T_REJECT_H
3 3
4#include <linux/types.h>
5
4enum ip6t_reject_with { 6enum ip6t_reject_with {
5 IP6T_ICMP6_NO_ROUTE, 7 IP6T_ICMP6_NO_ROUTE,
6 IP6T_ICMP6_ADM_PROHIBITED, 8 IP6T_ICMP6_ADM_PROHIBITED,
@@ -12,7 +14,7 @@ enum ip6t_reject_with {
12}; 14};
13 15
14struct ip6t_reject_info { 16struct ip6t_reject_info {
15 u_int32_t with; /* reject type */ 17 __u32 with; /* reject type */
16}; 18};
17 19
18#endif /*_IP6T_REJECT_H*/ 20#endif /*_IP6T_REJECT_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h
index 17a745cfb2c7..5da2b65cb3ad 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_AH_H 1#ifndef _IP6T_AH_H
2#define _IP6T_AH_H 2#define _IP6T_AH_H
3 3
4#include <linux/types.h>
5
4struct ip6t_ah { 6struct ip6t_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t hdrres; /* Test of the Reserved Filed */ 9 __u8 hdrres; /* Test of the Reserved Filed */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_AH_SPI 0x01 13#define IP6T_AH_SPI 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h
index 3724d0850920..b47f61b9e082 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_FRAG_H 1#ifndef _IP6T_FRAG_H
2#define _IP6T_FRAG_H 2#define _IP6T_FRAG_H
3 3
4#include <linux/types.h>
5
4struct ip6t_frag { 6struct ip6t_frag {
5 u_int32_t ids[2]; /* Security Parameter Index */ 7 __u32 ids[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t flags; /* */ 9 __u8 flags; /* */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_FRAG_IDS 0x01 13#define IP6T_FRAG_IDS 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/linux/netfilter_ipv6/ip6t_hl.h
index 5ef91b8319a8..6e76dbc6c19a 100644
--- a/include/linux/netfilter_ipv6/ip6t_hl.h
+++ b/include/linux/netfilter_ipv6/ip6t_hl.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_EQ = 0, /* equals */ 11 IP6T_HL_EQ = 0, /* equals */
10 IP6T_HL_NE, /* not equals */ 12 IP6T_HL_NE, /* not equals */
@@ -14,8 +16,8 @@ enum {
14 16
15 17
16struct ip6t_hl_info { 18struct ip6t_hl_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
index 01dfd445596a..efae3a20c214 100644
--- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
@@ -8,10 +8,12 @@ on whether they contain certain headers */
8#ifndef __IPV6HEADER_H 8#ifndef __IPV6HEADER_H
9#define __IPV6HEADER_H 9#define __IPV6HEADER_H
10 10
11#include <linux/types.h>
12
11struct ip6t_ipv6header_info { 13struct ip6t_ipv6header_info {
12 u_int8_t matchflags; 14 __u8 matchflags;
13 u_int8_t invflags; 15 __u8 invflags;
14 u_int8_t modeflag; 16 __u8 modeflag;
15}; 17};
16 18
17#define MASK_HOPOPTS 128 19#define MASK_HOPOPTS 128
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h
index 18549bca2d1f..a7729a5025cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_mh.h
+++ b/include/linux/netfilter_ipv6/ip6t_mh.h
@@ -1,10 +1,12 @@
1#ifndef _IP6T_MH_H 1#ifndef _IP6T_MH_H
2#define _IP6T_MH_H 2#define _IP6T_MH_H
3 3
4#include <linux/types.h>
5
4/* MH matching stuff */ 6/* MH matching stuff */
5struct ip6t_mh { 7struct ip6t_mh {
6 u_int8_t types[2]; /* MH type range */ 8 __u8 types[2]; /* MH type range */
7 u_int8_t invflags; /* Inverse flags */ 9 __u8 invflags; /* Inverse flags */
8}; 10};
9 11
10/* Values for "invflags" field in struct ip6t_mh. */ 12/* Values for "invflags" field in struct ip6t_mh. */
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h
index 62d89bcd9f9c..17d419a811fd 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -1,14 +1,16 @@
1#ifndef _IP6T_OPTS_H 1#ifndef _IP6T_OPTS_H
2#define _IP6T_OPTS_H 2#define _IP6T_OPTS_H
3 3
4#include <linux/types.h>
5
4#define IP6T_OPTS_OPTSNR 16 6#define IP6T_OPTS_OPTSNR 16
5 7
6struct ip6t_opts { 8struct ip6t_opts {
7 u_int32_t hdrlen; /* Header Length */ 9 __u32 hdrlen; /* Header Length */
8 u_int8_t flags; /* */ 10 __u8 flags; /* */
9 u_int8_t invflags; /* Inverse flags */ 11 __u8 invflags; /* Inverse flags */
10 u_int16_t opts[IP6T_OPTS_OPTSNR]; /* opts */ 12 __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */
11 u_int8_t optsnr; /* Nr of OPts */ 13 __u8 optsnr; /* Nr of OPts */
12}; 14};
13 15
14#define IP6T_OPTS_LEN 0x01 16#define IP6T_OPTS_LEN 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h
index ab91bfd2cd00..7605a5ff81cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -1,18 +1,19 @@
1#ifndef _IP6T_RT_H 1#ifndef _IP6T_RT_H
2#define _IP6T_RT_H 2#define _IP6T_RT_H
3 3
4#include <linux/types.h>
4/*#include <linux/in6.h>*/ 5/*#include <linux/in6.h>*/
5 6
6#define IP6T_RT_HOPS 16 7#define IP6T_RT_HOPS 16
7 8
8struct ip6t_rt { 9struct ip6t_rt {
9 u_int32_t rt_type; /* Routing Type */ 10 __u32 rt_type; /* Routing Type */
10 u_int32_t segsleft[2]; /* Segments Left */ 11 __u32 segsleft[2]; /* Segments Left */
11 u_int32_t hdrlen; /* Header Length */ 12 __u32 hdrlen; /* Header Length */
12 u_int8_t flags; /* */ 13 __u8 flags; /* */
13 u_int8_t invflags; /* Inverse flags */ 14 __u8 invflags; /* Inverse flags */
14 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ 15 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */
15 u_int8_t addrnr; /* Nr of Addresses */ 16 __u8 addrnr; /* Nr of Addresses */
16}; 17};
17 18
18#define IP6T_RT_TYP 0x01 19#define IP6T_RT_TYP 0x01
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index e2b9e63afa68..4c4ac3f3ce5a 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,10 +160,6 @@ struct netlink_skb_parms {
160 struct ucred creds; /* Skb credentials */ 160 struct ucred creds; /* Skb credentials */
161 __u32 pid; 161 __u32 pid;
162 __u32 dst_group; 162 __u32 dst_group;
163 kernel_cap_t eff_cap;
164 __u32 loginuid; /* Login (audit) uid */
165 __u32 sessionid; /* Session id (audit) */
166 __u32 sid; /* SELinux security id */
167}; 163};
168 164
169#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 165#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index f321b578edeb..fabcb1e5c460 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
51 return w; 51 return w;
52} 52}
53 53
54extern unsigned int 54extern int
55nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, 55nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
56 struct posix_acl *acl, int encode_entries, int typeflag); 56 struct posix_acl *acl, int encode_entries, int typeflag);
57extern unsigned int 57extern int
58nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, 58nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
59 struct posix_acl **pacl); 59 struct posix_acl **pacl);
60 60
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 32fb81212fd1..1ca64113efe8 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -16,6 +16,8 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/printk.h>
19#include <asm/atomic.h> 21#include <asm/atomic.h>
20 22
21/* Each escaped entry is prefixed by ESCAPE_CODE 23/* Each escaped entry is prefixed by ESCAPE_CODE
@@ -186,10 +188,17 @@ int oprofile_add_data(struct op_entry *entry, unsigned long val);
186int oprofile_add_data64(struct op_entry *entry, u64 val); 188int oprofile_add_data64(struct op_entry *entry, u64 val);
187int oprofile_write_commit(struct op_entry *entry); 189int oprofile_write_commit(struct op_entry *entry);
188 190
189#ifdef CONFIG_PERF_EVENTS 191#ifdef CONFIG_HW_PERF_EVENTS
190int __init oprofile_perf_init(struct oprofile_operations *ops); 192int __init oprofile_perf_init(struct oprofile_operations *ops);
191void oprofile_perf_exit(void); 193void oprofile_perf_exit(void);
192char *op_name_from_perf_id(void); 194char *op_name_from_perf_id(void);
193#endif /* CONFIG_PERF_EVENTS */ 195#else
196static inline int __init oprofile_perf_init(struct oprofile_operations *ops)
197{
198 pr_info("oprofile: hardware counters not available\n");
199 return -ENODEV;
200}
201static inline void oprofile_perf_exit(void) { }
202#endif /* CONFIG_HW_PERF_EVENTS */
194 203
195#endif /* OPROFILE_H */ 204#endif /* OPROFILE_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 559d02897075..ff5bccb87136 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1479,6 +1479,7 @@ void pci_request_acs(void);
1479#define PCI_VPD_RO_KEYWORD_PARTNO "PN" 1479#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
1480#define PCI_VPD_RO_KEYWORD_MFR_ID "MN" 1480#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
1481#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" 1481#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
1482#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"
1482 1483
1483/** 1484/**
1484 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length 1485 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 26c8df786918..6fb13841db45 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -36,9 +36,7 @@
36/* Socket options for SOL_PNPIPE level */ 36/* Socket options for SOL_PNPIPE level */
37#define PNPIPE_ENCAP 1 37#define PNPIPE_ENCAP 1
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39#define PNPIPE_PIPE_HANDLE 3 39#define PNPIPE_HANDLE 3
40#define PNPIPE_ENABLE 4
41/* unused slot */
42 40
43#define PNADDR_ANY 0 41#define PNADDR_ANY 0
44#define PNADDR_BROADCAST 0xFC 42#define PNADDR_BROADCAST 0xFC
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 2cfa4bc8dea6..b1032a3fafdc 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -247,6 +247,35 @@ struct tc_gred_sopt {
247 __u16 pad1; 247 __u16 pad1;
248}; 248};
249 249
250/* CHOKe section */
251
252enum {
253 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB,
256 __TCA_CHOKE_MAX,
257};
258
259#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1)
260
261struct tc_choke_qopt {
262 __u32 limit; /* Hard queue length (packets) */
263 __u32 qth_min; /* Min average threshold (packets) */
264 __u32 qth_max; /* Max average threshold (packets) */
265 unsigned char Wlog; /* log(W) */
266 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
267 unsigned char Scell_log; /* cell size for idle damping */
268 unsigned char flags; /* see RED flags */
269};
270
271struct tc_choke_xstats {
272 __u32 early; /* Early drops */
273 __u32 pdrop; /* Drops due to queue limits */
274 __u32 other; /* Drops due to drop() calls */
275 __u32 marked; /* Marked packets */
276 __u32 matched; /* Drops due to flow match */
277};
278
250/* HTB section */ 279/* HTB section */
251#define TC_HTB_NUMPRIO 8 280#define TC_HTB_NUMPRIO 8
252#define TC_HTB_MAXDEPTH 8 281#define TC_HTB_MAXDEPTH 8
@@ -435,6 +464,7 @@ enum {
435 TCA_NETEM_DELAY_DIST, 464 TCA_NETEM_DELAY_DIST,
436 TCA_NETEM_REORDER, 465 TCA_NETEM_REORDER,
437 TCA_NETEM_CORRUPT, 466 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS,
438 __TCA_NETEM_MAX, 468 __TCA_NETEM_MAX,
439}; 469};
440 470
@@ -465,7 +495,33 @@ struct tc_netem_corrupt {
465 __u32 correlation; 495 __u32 correlation;
466}; 496};
467 497
498enum {
499 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
501 NETEM_LOSS_GE, /* Gilbert Elliot models */
502 __NETEM_LOSS_MAX
503};
504#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
505
506/* State transition probablities for 4 state model */
507struct tc_netem_gimodel {
508 __u32 p13;
509 __u32 p31;
510 __u32 p32;
511 __u32 p14;
512 __u32 p23;
513};
514
515/* Gilbert-Elliot models */
516struct tc_netem_gemodel {
517 __u32 p;
518 __u32 r;
519 __u32 h;
520 __u32 k1;
521};
522
468#define NETEM_DIST_SCALE 8192 523#define NETEM_DIST_SCALE 8192
524#define NETEM_DIST_MAX 16384
469 525
470/* DRR */ 526/* DRR */
471 527
@@ -481,4 +537,55 @@ struct tc_drr_stats {
481 __u32 deficit; 537 __u32 deficit;
482}; 538};
483 539
540/* MQPRIO */
541#define TC_QOPT_BITMASK 15
542#define TC_QOPT_MAX_QUEUE 16
543
544struct tc_mqprio_qopt {
545 __u8 num_tc;
546 __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
547 __u8 hw;
548 __u16 count[TC_QOPT_MAX_QUEUE];
549 __u16 offset[TC_QOPT_MAX_QUEUE];
550};
551
552/* SFB */
553
554enum {
555 TCA_SFB_UNSPEC,
556 TCA_SFB_PARMS,
557 __TCA_SFB_MAX,
558};
559
560#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
561
562/*
563 * Note: increment, decrement are Q0.16 fixed-point values.
564 */
565struct tc_sfb_qopt {
566 __u32 rehash_interval; /* delay between hash move, in ms */
567 __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */
568 __u32 max; /* max len of qlen_min */
569 __u32 bin_size; /* maximum queue length per bin */
570 __u32 increment; /* probability increment, (d1 in Blue) */
571 __u32 decrement; /* probability decrement, (d2 in Blue) */
572 __u32 limit; /* max SFB queue length */
573 __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */
574 __u32 penalty_burst;
575};
576
577struct tc_sfb_xstats {
578 __u32 earlydrop;
579 __u32 penaltydrop;
580 __u32 bucketdrop;
581 __u32 queuedrop;
582 __u32 childdrop; /* drops in child qdisc */
583 __u32 marked;
584 __u32 maxqlen;
585 __u32 maxprob;
586 __u32 avgprob;
587};
588
589#define SFB_MAX_PROB 0xFFFF
590
484#endif 591#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index dd9c7ab38270..21415cc91cbb 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -431,6 +431,8 @@ struct dev_pm_info {
431 struct list_head entry; 431 struct list_head entry;
432 struct completion completion; 432 struct completion completion;
433 struct wakeup_source *wakeup; 433 struct wakeup_source *wakeup;
434#else
435 unsigned int should_wakeup:1;
434#endif 436#endif
435#ifdef CONFIG_PM_RUNTIME 437#ifdef CONFIG_PM_RUNTIME
436 struct timer_list suspend_timer; 438 struct timer_list suspend_timer;
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 9cff00dd6b63..03a67db03d01 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -109,11 +109,6 @@ static inline bool device_can_wakeup(struct device *dev)
109 return dev->power.can_wakeup; 109 return dev->power.can_wakeup;
110} 110}
111 111
112static inline bool device_may_wakeup(struct device *dev)
113{
114 return false;
115}
116
117static inline struct wakeup_source *wakeup_source_create(const char *name) 112static inline struct wakeup_source *wakeup_source_create(const char *name)
118{ 113{
119 return NULL; 114 return NULL;
@@ -134,24 +129,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {}
134 129
135static inline int device_wakeup_enable(struct device *dev) 130static inline int device_wakeup_enable(struct device *dev)
136{ 131{
137 return -EINVAL; 132 dev->power.should_wakeup = true;
133 return 0;
138} 134}
139 135
140static inline int device_wakeup_disable(struct device *dev) 136static inline int device_wakeup_disable(struct device *dev)
141{ 137{
138 dev->power.should_wakeup = false;
142 return 0; 139 return 0;
143} 140}
144 141
145static inline int device_init_wakeup(struct device *dev, bool val) 142static inline int device_set_wakeup_enable(struct device *dev, bool enable)
146{ 143{
147 dev->power.can_wakeup = val; 144 dev->power.should_wakeup = enable;
148 return val ? -EINVAL : 0; 145 return 0;
149} 146}
150 147
148static inline int device_init_wakeup(struct device *dev, bool val)
149{
150 device_set_wakeup_capable(dev, val);
151 device_set_wakeup_enable(dev, val);
152 return 0;
153}
151 154
152static inline int device_set_wakeup_enable(struct device *dev, bool enable) 155static inline bool device_may_wakeup(struct device *dev)
153{ 156{
154 return -EINVAL; 157 return dev->power.can_wakeup && dev->power.should_wakeup;
155} 158}
156 159
157static inline void __pm_stay_awake(struct wakeup_source *ws) {} 160static inline void __pm_stay_awake(struct wakeup_source *ws) {}
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index d68283a898bb..54211c1cd926 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -71,6 +71,7 @@ posix_acl_release(struct posix_acl *acl)
71 71
72/* posix_acl.c */ 72/* posix_acl.c */
73 73
74extern void posix_acl_init(struct posix_acl *, int);
74extern struct posix_acl *posix_acl_alloc(int, gfp_t); 75extern struct posix_acl *posix_acl_alloc(int, gfp_t);
75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t); 76extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
76extern int posix_acl_valid(const struct posix_acl *); 77extern int posix_acl_valid(const struct posix_acl *);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 092a04f874a8..a1147e5dd245 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -102,11 +102,8 @@
102 102
103extern long arch_ptrace(struct task_struct *child, long request, 103extern long arch_ptrace(struct task_struct *child, long request,
104 unsigned long addr, unsigned long data); 104 unsigned long addr, unsigned long data);
105extern int ptrace_traceme(void);
106extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 105extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
107extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 106extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
108extern int ptrace_attach(struct task_struct *tsk);
109extern int ptrace_detach(struct task_struct *, unsigned int);
110extern void ptrace_disable(struct task_struct *); 107extern void ptrace_disable(struct task_struct *);
111extern int ptrace_check_attach(struct task_struct *task, int kill); 108extern int ptrace_check_attach(struct task_struct *task, int kill);
112extern int ptrace_request(struct task_struct *child, long request, 109extern int ptrace_request(struct task_struct *child, long request,
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 94c1f03b50eb..9a85412e0db6 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -322,9 +322,12 @@ struct dquot_operations {
322 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323}; 323};
324 324
325struct path;
326
325/* Operations handling requests from userspace */ 327/* Operations handling requests from userspace */
326struct quotactl_ops { 328struct quotactl_ops {
327 int (*quota_on)(struct super_block *, int, int, char *); 329 int (*quota_on)(struct super_block *, int, int, struct path *);
330 int (*quota_on_meta)(struct super_block *, int, int);
328 int (*quota_off)(struct super_block *, int); 331 int (*quota_off)(struct super_block *, int);
329 int (*quota_sync)(struct super_block *, int, int); 332 int (*quota_sync)(struct super_block *, int, int);
330 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 333 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 223b14cd129c..eb354f6f26b3 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -76,11 +76,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
76 76
77int dquot_file_open(struct inode *inode, struct file *file); 77int dquot_file_open(struct inode *inode, struct file *file);
78 78
79int dquot_quota_on(struct super_block *sb, int type, int format_id,
80 char *path);
81int dquot_enable(struct inode *inode, int type, int format_id, 79int dquot_enable(struct inode *inode, int type, int format_id,
82 unsigned int flags); 80 unsigned int flags);
83int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 81int dquot_quota_on(struct super_block *sb, int type, int format_id,
84 struct path *path); 82 struct path *path);
85int dquot_quota_on_mount(struct super_block *sb, char *qf_name, 83int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
86 int format_id, int type); 84 int format_id, int type);
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index fcb9884df618..a5930cb66145 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -182,6 +182,26 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
182 return ret; 182 return ret;
183} 183}
184 184
185/**
186 * res_counter_check_margin - check if the counter allows charging
187 * @cnt: the resource counter to check
188 * @bytes: the number of bytes to check the remaining space against
189 *
190 * Returns a boolean value on whether the counter can be charged
191 * @bytes or whether this would exceed the limit.
192 */
193static inline bool res_counter_check_margin(struct res_counter *cnt,
194 unsigned long bytes)
195{
196 bool ret;
197 unsigned long flags;
198
199 spin_lock_irqsave(&cnt->lock, flags);
200 ret = cnt->limit - cnt->usage >= bytes;
201 spin_unlock_irqrestore(&cnt->lock, flags);
202 return ret;
203}
204
185static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt) 205static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
186{ 206{
187 bool ret; 207 bool ret;
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index d63dcbaea169..9026b30238f3 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -14,10 +14,12 @@
14#define LINUX_RIO_REGS_H 14#define LINUX_RIO_REGS_H
15 15
16/* 16/*
17 * In RapidIO, each device has a 2MB configuration space that is 17 * In RapidIO, each device has a 16MB configuration space that is
18 * accessed via maintenance transactions. Portions of configuration 18 * accessed via maintenance transactions. Portions of configuration
19 * space are standardized and/or reserved. 19 * space are standardized and/or reserved.
20 */ 20 */
21#define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */
22
21#define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ 23#define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */
22#define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ 24#define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */
23#define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ 25#define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 3c995b4d742c..89c3e5182991 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -203,6 +203,18 @@ struct rtc_device
203 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ 203 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */
204 int pie_enabled; 204 int pie_enabled;
205 struct work_struct irqwork; 205 struct work_struct irqwork;
206
207
208#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
209 struct work_struct uie_task;
210 struct timer_list uie_timer;
211 /* Those fields are protected by rtc->irq_lock */
212 unsigned int oldsecs;
213 unsigned int uie_irq_active:1;
214 unsigned int stop_uie_polling:1;
215 unsigned int uie_task_active:1;
216 unsigned int uie_timer_active:1;
217#endif
206}; 218};
207#define to_rtc_device(d) container_of(d, struct rtc_device, dev) 219#define to_rtc_device(d) container_of(d, struct rtc_device, dev)
208 220
@@ -238,6 +250,7 @@ extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
238extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, 250extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
239 unsigned int enabled); 251 unsigned int enabled);
240 252
253void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode);
241void rtc_aie_update_irq(void *private); 254void rtc_aie_update_irq(void *private);
242void rtc_uie_update_irq(void *private); 255void rtc_uie_update_irq(void *private);
243enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer); 256enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer);
@@ -246,8 +259,6 @@ int rtc_register(rtc_task_t *task);
246int rtc_unregister(rtc_task_t *task); 259int rtc_unregister(rtc_task_t *task);
247int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 260int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
248 261
249void rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer);
250void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer);
251void rtc_timer_init(struct rtc_timer *timer, void (*f)(void* p), void* data); 262void rtc_timer_init(struct rtc_timer *timer, void (*f)(void* p), void* data);
252int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer, 263int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer,
253 ktime_t expires, ktime_t period); 264 ktime_t expires, ktime_t period);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d747f948b34e..777d8a5ed06b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1744,7 +1744,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1744#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1744#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1745#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1745#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1746#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1746#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1747#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1747#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1748#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ 1748#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1749 1749
1750/* 1750/*
diff --git a/include/linux/security.h b/include/linux/security.h
index c642bb8b8f5a..9b5f184a7f65 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1623,7 +1623,7 @@ struct security_operations {
1623 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1623 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1624 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, 1624 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,
1625 struct xfrm_policy *xp, 1625 struct xfrm_policy *xp,
1626 struct flowi *fl); 1626 const struct flowi *fl);
1627 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); 1627 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
1628#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1628#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1629 1629
@@ -1662,7 +1662,7 @@ int security_capset(struct cred *new, const struct cred *old,
1662 const kernel_cap_t *effective, 1662 const kernel_cap_t *effective,
1663 const kernel_cap_t *inheritable, 1663 const kernel_cap_t *inheritable,
1664 const kernel_cap_t *permitted); 1664 const kernel_cap_t *permitted);
1665int security_capable(int cap); 1665int security_capable(const struct cred *cred, int cap);
1666int security_real_capable(struct task_struct *tsk, int cap); 1666int security_real_capable(struct task_struct *tsk, int cap);
1667int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1667int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1668int security_sysctl(struct ctl_table *table, int op); 1668int security_sysctl(struct ctl_table *table, int op);
@@ -1856,9 +1856,9 @@ static inline int security_capset(struct cred *new,
1856 return cap_capset(new, old, effective, inheritable, permitted); 1856 return cap_capset(new, old, effective, inheritable, permitted);
1857} 1857}
1858 1858
1859static inline int security_capable(int cap) 1859static inline int security_capable(const struct cred *cred, int cap)
1860{ 1860{
1861 return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT); 1861 return cap_capable(current, cred, cap, SECURITY_CAP_AUDIT);
1862} 1862}
1863 1863
1864static inline int security_real_capable(struct task_struct *tsk, int cap) 1864static inline int security_real_capable(struct task_struct *tsk, int cap)
@@ -2761,7 +2761,8 @@ int security_xfrm_state_delete(struct xfrm_state *x);
2761void security_xfrm_state_free(struct xfrm_state *x); 2761void security_xfrm_state_free(struct xfrm_state *x);
2762int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 2762int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2763int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2763int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2764 struct xfrm_policy *xp, struct flowi *fl); 2764 struct xfrm_policy *xp,
2765 const struct flowi *fl);
2765int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2766int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
2766void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); 2767void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2767 2768
@@ -2813,7 +2814,7 @@ static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_s
2813} 2814}
2814 2815
2815static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2816static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2816 struct xfrm_policy *xp, struct flowi *fl) 2817 struct xfrm_policy *xp, const struct flowi *fl)
2817{ 2818{
2818 return 1; 2819 return 1;
2819} 2820}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf221d65d9ad..31f02d0b46a7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1801,6 +1801,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1801 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1801 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
1802 skb = skb->prev) 1802 skb = skb->prev)
1803 1803
1804#define skb_queue_reverse_walk_safe(queue, skb, tmp) \
1805 for (skb = (queue)->prev, tmp = skb->prev; \
1806 skb != (struct sk_buff *)(queue); \
1807 skb = tmp, tmp = skb->prev)
1808
1809#define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \
1810 for (tmp = skb->prev; \
1811 skb != (struct sk_buff *)(queue); \
1812 skb = tmp, tmp = skb->prev)
1804 1813
1805static inline bool skb_has_frag_list(const struct sk_buff *skb) 1814static inline bool skb_has_frag_list(const struct sk_buff *skb)
1806{ 1815{
@@ -1868,7 +1877,7 @@ extern void skb_split(struct sk_buff *skb,
1868extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 1877extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1869 int shiftlen); 1878 int shiftlen);
1870 1879
1871extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1880extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features);
1872 1881
1873static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1882static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1874 int len, void *buffer) 1883 int len, void *buffer)
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 241f179347d9..7997a506ad41 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -22,7 +22,7 @@
22 22
23/* Linux-specific socket ioctls */ 23/* Linux-specific socket ioctls */
24#define SIOCINQ FIONREAD 24#define SIOCINQ FIONREAD
25#define SIOCOUTQ TIOCOUTQ 25#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */
26 26
27/* Routing table calls. */ 27/* Routing table calls. */
28#define SIOCADDRT 0x890B /* add routing table entry */ 28#define SIOCADDRT 0x890B /* add routing table entry */
@@ -83,6 +83,8 @@
83 83
84#define SIOCWANDEV 0x894A /* get/set netdev parameters */ 84#define SIOCWANDEV 0x894A /* get/set netdev parameters */
85 85
86#define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */
87
86/* ARP cache control calls. */ 88/* ARP cache control calls. */
87 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ 89 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
88#define SIOCDARP 0x8953 /* delete ARP table entry */ 90#define SIOCDARP 0x8953 /* delete ARP table entry */
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index c50b458b8a3f..082884295f80 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -47,14 +47,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
47 return 1; 47 return 1;
48 return 0; 48 return 0;
49} 49}
50static inline struct nfs4_sessionid *bc_xprt_sid(struct svc_rqst *rqstp)
51{
52 if (svc_is_backchannel(rqstp))
53 return (struct nfs4_sessionid *)
54 rqstp->rq_server->sv_bc_xprt->xpt_bc_sid;
55 return NULL;
56}
57
58#else /* CONFIG_NFS_V4_1 */ 50#else /* CONFIG_NFS_V4_1 */
59static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, 51static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
60 unsigned int min_reqs) 52 unsigned int min_reqs)
@@ -67,11 +59,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
67 return 0; 59 return 0;
68} 60}
69 61
70static inline struct nfs4_sessionid *bc_xprt_sid(struct svc_rqst *rqstp)
71{
72 return NULL;
73}
74
75static inline void xprt_free_bc_request(struct rpc_rqst *req) 62static inline void xprt_free_bc_request(struct rpc_rqst *req)
76{ 63{
77} 64}
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 059877b4d85b..7ad9751a0d87 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -77,7 +77,6 @@ struct svc_xprt {
77 size_t xpt_remotelen; /* length of address */ 77 size_t xpt_remotelen; /* length of address */
78 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */ 78 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
79 struct list_head xpt_users; /* callbacks on free */ 79 struct list_head xpt_users; /* callbacks on free */
80 void *xpt_bc_sid; /* back channel session ID */
81 80
82 struct net *xpt_net; 81 struct net *xpt_net;
83 struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ 82 struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 18cd0684fc4e..98664db1be47 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -125,39 +125,37 @@ extern struct trace_event_functions enter_syscall_print_funcs;
125extern struct trace_event_functions exit_syscall_print_funcs; 125extern struct trace_event_functions exit_syscall_print_funcs;
126 126
127#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 127#define SYSCALL_TRACE_ENTER_EVENT(sname) \
128 static struct syscall_metadata \ 128 static struct syscall_metadata __syscall_meta_##sname; \
129 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
130 static struct ftrace_event_call __used \ 129 static struct ftrace_event_call __used \
131 __attribute__((__aligned__(4))) \
132 __attribute__((section("_ftrace_events"))) \
133 event_enter_##sname = { \ 130 event_enter_##sname = { \
134 .name = "sys_enter"#sname, \ 131 .name = "sys_enter"#sname, \
135 .class = &event_class_syscall_enter, \ 132 .class = &event_class_syscall_enter, \
136 .event.funcs = &enter_syscall_print_funcs, \ 133 .event.funcs = &enter_syscall_print_funcs, \
137 .data = (void *)&__syscall_meta_##sname,\ 134 .data = (void *)&__syscall_meta_##sname,\
138 }; \ 135 }; \
136 static struct ftrace_event_call __used \
137 __attribute__((section("_ftrace_events"))) \
138 *__event_enter_##sname = &event_enter_##sname; \
139 __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) 139 __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY)
140 140
141#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 141#define SYSCALL_TRACE_EXIT_EVENT(sname) \
142 static struct syscall_metadata \ 142 static struct syscall_metadata __syscall_meta_##sname; \
143 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
144 static struct ftrace_event_call __used \ 143 static struct ftrace_event_call __used \
145 __attribute__((__aligned__(4))) \
146 __attribute__((section("_ftrace_events"))) \
147 event_exit_##sname = { \ 144 event_exit_##sname = { \
148 .name = "sys_exit"#sname, \ 145 .name = "sys_exit"#sname, \
149 .class = &event_class_syscall_exit, \ 146 .class = &event_class_syscall_exit, \
150 .event.funcs = &exit_syscall_print_funcs, \ 147 .event.funcs = &exit_syscall_print_funcs, \
151 .data = (void *)&__syscall_meta_##sname,\ 148 .data = (void *)&__syscall_meta_##sname,\
152 }; \ 149 }; \
150 static struct ftrace_event_call __used \
151 __attribute__((section("_ftrace_events"))) \
152 *__event_exit_##sname = &event_exit_##sname; \
153 __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) 153 __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY)
154 154
155#define SYSCALL_METADATA(sname, nb) \ 155#define SYSCALL_METADATA(sname, nb) \
156 SYSCALL_TRACE_ENTER_EVENT(sname); \ 156 SYSCALL_TRACE_ENTER_EVENT(sname); \
157 SYSCALL_TRACE_EXIT_EVENT(sname); \ 157 SYSCALL_TRACE_EXIT_EVENT(sname); \
158 static struct syscall_metadata __used \ 158 static struct syscall_metadata __used \
159 __attribute__((__aligned__(4))) \
160 __attribute__((section("__syscalls_metadata"))) \
161 __syscall_meta_##sname = { \ 159 __syscall_meta_##sname = { \
162 .name = "sys"#sname, \ 160 .name = "sys"#sname, \
163 .nb_args = nb, \ 161 .nb_args = nb, \
@@ -166,14 +164,15 @@ extern struct trace_event_functions exit_syscall_print_funcs;
166 .enter_event = &event_enter_##sname, \ 164 .enter_event = &event_enter_##sname, \
167 .exit_event = &event_exit_##sname, \ 165 .exit_event = &event_exit_##sname, \
168 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 166 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
169 }; 167 }; \
168 static struct syscall_metadata __used \
169 __attribute__((section("__syscalls_metadata"))) \
170 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
170 171
171#define SYSCALL_DEFINE0(sname) \ 172#define SYSCALL_DEFINE0(sname) \
172 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 173 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
173 SYSCALL_TRACE_EXIT_EVENT(_##sname); \ 174 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
174 static struct syscall_metadata __used \ 175 static struct syscall_metadata __used \
175 __attribute__((__aligned__(4))) \
176 __attribute__((section("__syscalls_metadata"))) \
177 __syscall_meta__##sname = { \ 176 __syscall_meta__##sname = { \
178 .name = "sys_"#sname, \ 177 .name = "sys_"#sname, \
179 .nb_args = 0, \ 178 .nb_args = 0, \
@@ -181,6 +180,9 @@ extern struct trace_event_functions exit_syscall_print_funcs;
181 .exit_event = &event_exit__##sname, \ 180 .exit_event = &event_exit__##sname, \
182 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ 181 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
183 }; \ 182 }; \
183 static struct syscall_metadata __used \
184 __attribute__((section("__syscalls_metadata"))) \
185 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
184 asmlinkage long sys_##sname(void) 186 asmlinkage long sys_##sname(void)
185#else 187#else
186#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 188#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 7bb5cb64f3b8..11684d9e6bd2 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -930,6 +930,7 @@ enum
930 930
931#ifdef __KERNEL__ 931#ifdef __KERNEL__
932#include <linux/list.h> 932#include <linux/list.h>
933#include <linux/rcupdate.h>
933 934
934/* For the /proc/sys support */ 935/* For the /proc/sys support */
935struct ctl_table; 936struct ctl_table;
@@ -1037,10 +1038,15 @@ struct ctl_table_root {
1037 struct ctl_table trees. */ 1038 struct ctl_table trees. */
1038struct ctl_table_header 1039struct ctl_table_header
1039{ 1040{
1040 struct ctl_table *ctl_table; 1041 union {
1041 struct list_head ctl_entry; 1042 struct {
1042 int used; 1043 struct ctl_table *ctl_table;
1043 int count; 1044 struct list_head ctl_entry;
1045 int used;
1046 int count;
1047 };
1048 struct rcu_head rcu;
1049 };
1044 struct completion *unregistering; 1050 struct completion *unregistering;
1045 struct ctl_table *ctl_table_arg; 1051 struct ctl_table *ctl_table_arg;
1046 struct ctl_table_root *root; 1052 struct ctl_table_root *root;
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 387fa7d05c98..7faf933cced7 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -17,6 +17,9 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
21#define SYSRQ_DEFAULT_ENABLE 1
22
20/* Possible values of bitmask for enabling sysrq functions */ 23/* Possible values of bitmask for enabling sysrq functions */
21/* 0x0001 is reserved for enable everything */ 24/* 0x0001 is reserved for enable everything */
22#define SYSRQ_ENABLE_LOG 0x0002 25#define SYSRQ_ENABLE_LOG 0x0002
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 8651556dbd52..d3ec89fb4122 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -172,6 +172,14 @@ void thermal_zone_device_update(struct thermal_zone_device *);
172struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 172struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
173 const struct thermal_cooling_device_ops *); 173 const struct thermal_cooling_device_ops *);
174void thermal_cooling_device_unregister(struct thermal_cooling_device *); 174void thermal_cooling_device_unregister(struct thermal_cooling_device *);
175
176#ifdef CONFIG_NET
175extern int generate_netlink_event(u32 orig, enum events event); 177extern int generate_netlink_event(u32 orig, enum events event);
178#else
179static inline int generate_netlink_event(u32 orig, enum events event)
180{
181 return 0;
182}
183#endif
176 184
177#endif /* __THERMAL_H__ */ 185#endif /* __THERMAL_H__ */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 1eefa3f6d1f4..a5b994a204d2 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -2,7 +2,7 @@
2 * include/linux/tipc.h: Include file for TIPC socket interface 2 * include/linux/tipc.h: Include file for TIPC socket interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr)
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ 132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
133#if 0
134/* The following filter options are not currently implemented */
135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
136#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
137#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
138#endif
139 133
140#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ 134#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */
141 135
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 7d42460a5e3c..0db239590b4d 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -2,7 +2,7 @@
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2007, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -76,13 +76,6 @@
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ 76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ 77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
78 78
79#if 0
80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
81#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
82#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
83#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
84#endif
85
86/* 79/*
87 * Protected commands: 80 * Protected commands:
88 * May only be issued by "network administration capable" process. 81 * May only be issued by "network administration capable" process.
@@ -96,7 +89,7 @@
96#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 89#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ 90#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
98#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ 91#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
99#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
100#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ 93#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */
101#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ 94#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
102 95
@@ -109,13 +102,6 @@
109#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ 102#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
110#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ 103#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
111 104
112#if 0
113#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
114#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
115#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
116#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
117#endif
118
119/* 105/*
120 * Private commands: 106 * Private commands:
121 * May only be issued by "network administration capable" process. 107 * May only be issued by "network administration capable" process.
@@ -123,16 +109,13 @@
123 */ 109 */
124 110
125#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 111#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
126#if 0
127#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
128#endif
129#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 112#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 113#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 114#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 115#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ 116#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
134#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ 117#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
135#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
136#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ 119#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */
137#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ 120#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
138 121
@@ -193,6 +176,10 @@
193#define TIPC_DEF_LINK_TOL 1500 176#define TIPC_DEF_LINK_TOL 1500
194#define TIPC_MAX_LINK_TOL 30000 177#define TIPC_MAX_LINK_TOL 30000
195 178
179#if (TIPC_MIN_LINK_TOL < 16)
180#error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)"
181#endif
182
196/* 183/*
197 * Link window limits (min, default, max), in packets 184 * Link window limits (min, default, max), in packets
198 */ 185 */
@@ -215,7 +202,7 @@ struct tipc_link_info {
215 202
216struct tipc_bearer_config { 203struct tipc_bearer_config {
217 __be32 priority; /* Range [1,31]. Override per link */ 204 __be32 priority; /* Range [1,31]. Override per link */
218 __be32 detect_scope; 205 __be32 disc_domain; /* <Z.C.N> describing desired nodes */
219 char name[TIPC_MAX_BEARER_NAME]; 206 char name[TIPC_MAX_BEARER_NAME];
220}; 207};
221 208
@@ -247,15 +234,6 @@ struct tipc_name_table_query {
247#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ 234#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
248#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ 235#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
249 236
250#if 0
251/* prototypes TLV structures for proposed commands */
252struct tipc_link_create {
253 __u32 domain;
254 struct tipc_media_addr peer_addr;
255 char bearer_name[TIPC_MAX_BEARER_NAME];
256};
257#endif
258
259/* 237/*
260 * A TLV consists of a descriptor, followed by the TLV value. 238 * A TLV consists of a descriptor, followed by the TLV value.
261 * TLV descriptor fields are stored in network byte order; 239 * TLV descriptor fields are stored in network byte order;
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c6814616653b..97c84a58efb8 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -33,12 +33,7 @@ struct tracepoint {
33 void (*regfunc)(void); 33 void (*regfunc)(void);
34 void (*unregfunc)(void); 34 void (*unregfunc)(void);
35 struct tracepoint_func __rcu *funcs; 35 struct tracepoint_func __rcu *funcs;
36} __attribute__((aligned(32))); /* 36};
37 * Aligned on 32 bytes because it is
38 * globally visible and gcc happily
39 * align these on the structure size.
40 * Keep in sync with vmlinux.lds.h.
41 */
42 37
43/* 38/*
44 * Connect a probe to a tracepoint. 39 * Connect a probe to a tracepoint.
@@ -61,15 +56,15 @@ extern void tracepoint_probe_update_all(void);
61 56
62struct tracepoint_iter { 57struct tracepoint_iter {
63 struct module *module; 58 struct module *module;
64 struct tracepoint *tracepoint; 59 struct tracepoint * const *tracepoint;
65}; 60};
66 61
67extern void tracepoint_iter_start(struct tracepoint_iter *iter); 62extern void tracepoint_iter_start(struct tracepoint_iter *iter);
68extern void tracepoint_iter_next(struct tracepoint_iter *iter); 63extern void tracepoint_iter_next(struct tracepoint_iter *iter);
69extern void tracepoint_iter_stop(struct tracepoint_iter *iter); 64extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
70extern void tracepoint_iter_reset(struct tracepoint_iter *iter); 65extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
71extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, 66extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
72 struct tracepoint *begin, struct tracepoint *end); 67 struct tracepoint * const *begin, struct tracepoint * const *end);
73 68
74/* 69/*
75 * tracepoint_synchronize_unregister must be called between the last tracepoint 70 * tracepoint_synchronize_unregister must be called between the last tracepoint
@@ -84,11 +79,13 @@ static inline void tracepoint_synchronize_unregister(void)
84#define PARAMS(args...) args 79#define PARAMS(args...) args
85 80
86#ifdef CONFIG_TRACEPOINTS 81#ifdef CONFIG_TRACEPOINTS
87extern void tracepoint_update_probe_range(struct tracepoint *begin, 82extern
88 struct tracepoint *end); 83void tracepoint_update_probe_range(struct tracepoint * const *begin,
84 struct tracepoint * const *end);
89#else 85#else
90static inline void tracepoint_update_probe_range(struct tracepoint *begin, 86static inline
91 struct tracepoint *end) 87void tracepoint_update_probe_range(struct tracepoint * const *begin,
88 struct tracepoint * const *end)
92{ } 89{ }
93#endif /* CONFIG_TRACEPOINTS */ 90#endif /* CONFIG_TRACEPOINTS */
94 91
@@ -174,12 +171,20 @@ do_trace: \
174 { \ 171 { \
175 } 172 }
176 173
174/*
175 * We have no guarantee that gcc and the linker won't up-align the tracepoint
176 * structures, so we create an array of pointers that will be used for iteration
177 * on the tracepoints.
178 */
177#define DEFINE_TRACE_FN(name, reg, unreg) \ 179#define DEFINE_TRACE_FN(name, reg, unreg) \
178 static const char __tpstrtab_##name[] \ 180 static const char __tpstrtab_##name[] \
179 __attribute__((section("__tracepoints_strings"))) = #name; \ 181 __attribute__((section("__tracepoints_strings"))) = #name; \
180 struct tracepoint __tracepoint_##name \ 182 struct tracepoint __tracepoint_##name \
181 __attribute__((section("__tracepoints"), aligned(32))) = \ 183 __attribute__((section("__tracepoints"))) = \
182 { __tpstrtab_##name, 0, reg, unreg, NULL } 184 { __tpstrtab_##name, 0, reg, unreg, NULL }; \
185 static struct tracepoint * const __tracepoint_ptr_##name __used \
186 __attribute__((section("__tracepoints_ptrs"))) = \
187 &__tracepoint_##name;
183 188
184#define DEFINE_TRACE(name) \ 189#define DEFINE_TRACE(name) \
185 DEFINE_TRACE_FN(name, NULL, NULL); 190 DEFINE_TRACE_FN(name, NULL, NULL);
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 5e86dc771da4..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -89,7 +89,7 @@ struct usb_cdc_acm_descriptor {
89 89
90#define USB_CDC_COMM_FEATURE 0x01 90#define USB_CDC_COMM_FEATURE 0x01
91#define USB_CDC_CAP_LINE 0x02 91#define USB_CDC_CAP_LINE 0x02
92#define USB_CDC_CAP_BRK 0x04 92#define USB_CDC_CAP_BRK 0x04
93#define USB_CDC_CAP_NOTIFY 0x08 93#define USB_CDC_CAP_NOTIFY 0x08
94 94
95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
@@ -271,6 +271,11 @@ struct usb_cdc_notification {
271 __le16 wLength; 271 __le16 wLength;
272} __attribute__ ((packed)); 272} __attribute__ ((packed));
273 273
274struct usb_cdc_speed_change {
275 __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */
276 __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */
277} __attribute__ ((packed));
278
274/*-------------------------------------------------------------------------*/ 279/*-------------------------------------------------------------------------*/
275 280
276/* 281/*
@@ -292,7 +297,7 @@ struct usb_cdc_ncm_ntb_parameters {
292 __le16 wNdpOutDivisor; 297 __le16 wNdpOutDivisor;
293 __le16 wNdpOutPayloadRemainder; 298 __le16 wNdpOutPayloadRemainder;
294 __le16 wNdpOutAlignment; 299 __le16 wNdpOutAlignment;
295 __le16 wPadding2; 300 __le16 wNtbOutMaxDatagrams;
296} __attribute__ ((packed)); 301} __attribute__ ((packed));
297 302
298/* 303/*
@@ -307,7 +312,7 @@ struct usb_cdc_ncm_nth16 {
307 __le16 wHeaderLength; 312 __le16 wHeaderLength;
308 __le16 wSequence; 313 __le16 wSequence;
309 __le16 wBlockLength; 314 __le16 wBlockLength;
310 __le16 wFpIndex; 315 __le16 wNdpIndex;
311} __attribute__ ((packed)); 316} __attribute__ ((packed));
312 317
313struct usb_cdc_ncm_nth32 { 318struct usb_cdc_ncm_nth32 {
@@ -315,7 +320,7 @@ struct usb_cdc_ncm_nth32 {
315 __le16 wHeaderLength; 320 __le16 wHeaderLength;
316 __le16 wSequence; 321 __le16 wSequence;
317 __le32 dwBlockLength; 322 __le32 dwBlockLength;
318 __le32 dwFpIndex; 323 __le32 dwNdpIndex;
319} __attribute__ ((packed)); 324} __attribute__ ((packed));
320 325
321/* 326/*
@@ -337,7 +342,7 @@ struct usb_cdc_ncm_dpe16 {
337struct usb_cdc_ncm_ndp16 { 342struct usb_cdc_ncm_ndp16 {
338 __le32 dwSignature; 343 __le32 dwSignature;
339 __le16 wLength; 344 __le16 wLength;
340 __le16 wNextFpIndex; 345 __le16 wNextNdpIndex;
341 struct usb_cdc_ncm_dpe16 dpe16[0]; 346 struct usb_cdc_ncm_dpe16 dpe16[0];
342} __attribute__ ((packed)); 347} __attribute__ ((packed));
343 348
@@ -375,6 +380,7 @@ struct usb_cdc_ncm_ndp32 {
375#define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) 380#define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2)
376#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) 381#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3)
377#define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) 382#define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4)
383#define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5)
378 384
379/* CDC NCM subclass Table 6-3: NTB Parameter Structure */ 385/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
380#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) 386#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0)
@@ -392,6 +398,13 @@ struct usb_cdc_ncm_ndp32 {
392#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 398#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048
393#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 399#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048
394 400
401/* NTB Input Size Structure */
402struct usb_cdc_ncm_ndp_input_size {
403 __le32 dwNtbInMaxSize;
404 __le16 wNtbInMaxDatagrams;
405 __le16 wReserved;
406} __attribute__ ((packed));
407
395/* CDC NCM subclass 6.2.11 SetCrcMode */ 408/* CDC NCM subclass 6.2.11 SetCrcMode */
396#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 409#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00
397#define USB_CDC_NCM_CRC_APPENDED 0x01 410#define USB_CDC_NCM_CRC_APPENDED 0x01
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index dd6ee49a0844..a854fe89484e 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -112,6 +112,7 @@ struct usb_hcd {
112 /* Flags that get set only during HCD registration or removal. */ 112 /* Flags that get set only during HCD registration or removal. */
113 unsigned rh_registered:1;/* is root hub registered? */ 113 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */ 114 unsigned rh_pollable:1; /* may we poll the root hub? */
115 unsigned msix_enabled:1; /* driver has MSI-X enabled? */
115 116
116 /* The next flag is a stopgap, to be removed when all the HCDs 117 /* The next flag is a stopgap, to be removed when all the HCDs
117 * support the new root-hub polling mechanism. */ 118 * support the new root-hub polling mechanism. */
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index b92e17349c7b..7d1babbff071 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -16,12 +16,8 @@
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__ 16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__ 17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18 18
19#ifdef CONFIG_ARCH_MSM7X00A
20#define USB_SBUSCFG (MSM_USB_BASE + 0x0090)
21#else
22#define USB_AHBBURST (MSM_USB_BASE + 0x0090) 19#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
23#define USB_AHBMODE (MSM_USB_BASE + 0x0098) 20#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
24#endif
25#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */ 21#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
26 22
27#define USB_USBCMD (MSM_USB_BASE + 0x0140) 23#define USB_USBCMD (MSM_USB_BASE + 0x0140)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 16d682f4f7c3..c9049139a7a5 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -347,6 +347,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
347extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, 347extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
348 unsigned int ch); 348 unsigned int ch);
349extern int usb_serial_handle_break(struct usb_serial_port *port); 349extern int usb_serial_handle_break(struct usb_serial_port *port);
350extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
351 struct tty_struct *tty,
352 unsigned int status);
350 353
351 354
352extern int usb_serial_bus_register(struct usb_serial_driver *device); 355extern int usb_serial_bus_register(struct usb_serial_driver *device);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 0093dd7c1d6f..800617b4ddd5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,7 +109,10 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
109 unsigned int fbit) 109 unsigned int fbit)
110{ 110{
111 /* Did you forget to fix assumptions on max features? */ 111 /* Did you forget to fix assumptions on max features? */
112 MAYBE_BUILD_BUG_ON(fbit >= 32); 112 if (__builtin_constant_p(fbit))
113 BUILD_BUG_ON(fbit >= 32);
114 else
115 BUG_ON(fbit >= 32);
113 116
114 if (fbit < VIRTIO_TRANSPORT_F_START) 117 if (fbit < VIRTIO_TRANSPORT_F_START)
115 virtio_check_driver_offered_feature(vdev, fbit); 118 virtio_check_driver_offered_feature(vdev, fbit);
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index a85064db8f94..e4d333543a33 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -7,7 +7,8 @@
7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
8 * anyone can use the definitions to implement compatible drivers/servers. 8 * anyone can use the definitions to implement compatible drivers/servers.
9 * 9 *
10 * Copyright (C) Red Hat, Inc., 2009, 2010 10 * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
11 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
11 */ 12 */
12 13
13/* Feature bits */ 14/* Feature bits */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1ac11586a2f5..f7998a3bf020 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -250,7 +250,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
250enum { 250enum {
251 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 251 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */
252 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 252 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
253 WQ_FREEZEABLE = 1 << 2, /* freeze during suspend */ 253 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
254 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 254 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
255 WQ_HIGHPRI = 1 << 4, /* high priority */ 255 WQ_HIGHPRI = 1 << 4, /* high priority */
256 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 256 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
@@ -318,7 +318,7 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
318/** 318/**
319 * alloc_ordered_workqueue - allocate an ordered workqueue 319 * alloc_ordered_workqueue - allocate an ordered workqueue
320 * @name: name of the workqueue 320 * @name: name of the workqueue
321 * @flags: WQ_* flags (only WQ_FREEZEABLE and WQ_MEM_RECLAIM are meaningful) 321 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
322 * 322 *
323 * Allocate an ordered workqueue. An ordered workqueue executes at 323 * Allocate an ordered workqueue. An ordered workqueue executes at
324 * most one work item at any given time in the queued order. They are 324 * most one work item at any given time in the queued order. They are
@@ -335,8 +335,8 @@ alloc_ordered_workqueue(const char *name, unsigned int flags)
335 335
336#define create_workqueue(name) \ 336#define create_workqueue(name) \
337 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 337 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
338#define create_freezeable_workqueue(name) \ 338#define create_freezable_workqueue(name) \
339 alloc_workqueue((name), WQ_FREEZEABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 339 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
340#define create_singlethread_workqueue(name) \ 340#define create_singlethread_workqueue(name) \
341 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 341 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
342 342
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 930fdd2de79c..22e61fdf75a2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,16 @@ struct xfrm_replay_state {
84 __u32 bitmap; 84 __u32 bitmap;
85}; 85};
86 86
87struct xfrm_replay_state_esn {
88 unsigned int bmp_len;
89 __u32 oseq;
90 __u32 seq;
91 __u32 oseq_hi;
92 __u32 seq_hi;
93 __u32 replay_window;
94 __u32 bmp[0];
95};
96
87struct xfrm_algo { 97struct xfrm_algo {
88 char alg_name[64]; 98 char alg_name[64];
89 unsigned int alg_key_len; /* in bits */ 99 unsigned int alg_key_len; /* in bits */
@@ -284,6 +294,7 @@ enum xfrm_attr_type_t {
284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 294 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
285 XFRMA_MARK, /* struct xfrm_mark */ 295 XFRMA_MARK, /* struct xfrm_mark */
286 XFRMA_TFCPAD, /* __u32 */ 296 XFRMA_TFCPAD, /* __u32 */
297 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
287 __XFRMA_MAX 298 __XFRMA_MAX
288 299
289#define XFRMA_MAX (__XFRMA_MAX - 1) 300#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -350,6 +361,8 @@ struct xfrm_usersa_info {
350#define XFRM_STATE_WILDRECV 8 361#define XFRM_STATE_WILDRECV 8
351#define XFRM_STATE_ICMP 16 362#define XFRM_STATE_ICMP 16
352#define XFRM_STATE_AF_UNSPEC 32 363#define XFRM_STATE_AF_UNSPEC 32
364#define XFRM_STATE_ALIGN4 64
365#define XFRM_STATE_ESN 128
353}; 366};
354 367
355struct xfrm_usersa_id { 368struct xfrm_usersa_id {
diff --git a/include/media/mt9v011.h b/include/media/mt9v011.h
new file mode 100644
index 000000000000..ea29fc74cd06
--- /dev/null
+++ b/include/media/mt9v011.h
@@ -0,0 +1,17 @@
1/* mt9v011 sensor
2 *
3 * Copyright (C) 2011 Hans Verkuil <hverkuil@xs4all.nl>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __MT9V011_H__
11#define __MT9V011_H__
12
13struct mt9v011_platform_data {
14 unsigned xtal; /* Hz */
15};
16
17#endif
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index a23c1fc685a1..2963263f31e2 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -183,6 +183,9 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev)
183} 183}
184 184
185#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ 185#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */
186#define US_TO_NS(usec) ((usec) * 1000)
187#define MS_TO_US(msec) ((msec) * 1000)
188#define MS_TO_NS(msec) ((msec) * 1000 * 1000)
186 189
187void ir_raw_event_handle(struct rc_dev *dev); 190void ir_raw_event_handle(struct rc_dev *dev);
188int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); 191int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev);
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index ac7ce00f39cf..79827143d5ac 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -115,7 +115,7 @@ struct saa7146_dev
115 115
116 /* different device locks */ 116 /* different device locks */
117 spinlock_t slock; 117 spinlock_t slock;
118 struct mutex lock; 118 struct mutex v4l2_lock;
119 119
120 unsigned char __iomem *mem; /* pointer to mapped IO memory */ 120 unsigned char __iomem *mem; /* pointer to mapped IO memory */
121 u32 revision; /* chip revision; needed for bug-workarounds*/ 121 u32 revision; /* chip revision; needed for bug-workarounds*/
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 2d65b35cdab2..a659319e8582 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -138,21 +138,10 @@ struct v4l2_subdev_ops;
138 138
139/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
140 The client_type argument is the name of the chip that's on the adapter. */ 140 The client_type argument is the name of the chip that's on the adapter. */
141struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, 141struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
142 struct i2c_adapter *adapter, const char *client_type, 142 struct i2c_adapter *adapter, const char *client_type,
143 int irq, void *platform_data,
144 u8 addr, const unsigned short *probe_addrs); 143 u8 addr, const unsigned short *probe_addrs);
145 144
146/* Load an i2c module and return an initialized v4l2_subdev struct.
147 The client_type argument is the name of the chip that's on the adapter. */
148static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter, const char *client_type,
150 u8 addr, const unsigned short *probe_addrs)
151{
152 return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, client_type, 0, NULL,
153 addr, probe_addrs);
154}
155
156struct i2c_board_info; 145struct i2c_board_info;
157 146
158struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, 147struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index d69ab4aae032..97d063837b61 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/videodev2.h>
26 27
27/* forward references */ 28/* forward references */
28struct v4l2_ctrl_handler; 29struct v4l2_ctrl_handler;
@@ -53,8 +54,10 @@ struct v4l2_ctrl_ops {
53 * @handler: The handler that owns the control. 54 * @handler: The handler that owns the control.
54 * @cluster: Point to start of cluster array. 55 * @cluster: Point to start of cluster array.
55 * @ncontrols: Number of controls in cluster array. 56 * @ncontrols: Number of controls in cluster array.
56 * @has_new: Internal flag: set when there is a valid new value.
57 * @done: Internal flag: set for each processed control. 57 * @done: Internal flag: set for each processed control.
58 * @is_new: Set when the user specified a new value for this control. It
59 * is also set when called from v4l2_ctrl_handler_setup. Drivers
60 * should never set this flag.
58 * @is_private: If set, then this control is private to its handler and it 61 * @is_private: If set, then this control is private to its handler and it
59 * will not be added to any other handlers. Drivers can set 62 * will not be added to any other handlers. Drivers can set
60 * this flag. 63 * this flag.
@@ -97,9 +100,9 @@ struct v4l2_ctrl {
97 struct v4l2_ctrl_handler *handler; 100 struct v4l2_ctrl_handler *handler;
98 struct v4l2_ctrl **cluster; 101 struct v4l2_ctrl **cluster;
99 unsigned ncontrols; 102 unsigned ncontrols;
100 unsigned int has_new:1;
101 unsigned int done:1; 103 unsigned int done:1;
102 104
105 unsigned int is_new:1;
103 unsigned int is_private:1; 106 unsigned int is_private:1;
104 unsigned int is_volatile:1; 107 unsigned int is_volatile:1;
105 108
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b0316a7cf08d..daf1e57d9b26 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -106,10 +106,7 @@ struct v4l2_subdev_io_pin_config {
106 u8 strength; /* Pin drive strength */ 106 u8 strength; /* Pin drive strength */
107}; 107};
108 108
109/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* 109/*
110 functions after the v4l2_subdev was registered. It is used to pass
111 platform data to the subdev which can be used during initialization.
112
113 s_io_pin_config: configure one or more chip I/O pins for chips that 110 s_io_pin_config: configure one or more chip I/O pins for chips that
114 multiplex different internal signal pads out to IO pins. This function 111 multiplex different internal signal pads out to IO pins. This function
115 takes a pointer to an array of 'n' pin configuration entries, one for 112 takes a pointer to an array of 'n' pin configuration entries, one for
@@ -141,7 +138,6 @@ struct v4l2_subdev_io_pin_config {
141struct v4l2_subdev_core_ops { 138struct v4l2_subdev_core_ops {
142 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 139 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
143 int (*log_status)(struct v4l2_subdev *sd); 140 int (*log_status)(struct v4l2_subdev *sd);
144 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
145 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, 141 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
146 struct v4l2_subdev_io_pin_config *pincfg); 142 struct v4l2_subdev_io_pin_config *pincfg);
147 int (*init)(struct v4l2_subdev *sd, u32 val); 143 int (*init)(struct v4l2_subdev *sd, u32 val);
@@ -415,6 +411,21 @@ struct v4l2_subdev_ops {
415 const struct v4l2_subdev_sensor_ops *sensor; 411 const struct v4l2_subdev_sensor_ops *sensor;
416}; 412};
417 413
414/*
415 * Internal ops. Never call this from drivers, only the v4l2 framework can call
416 * these ops.
417 *
418 * registered: called when this subdev is registered. When called the v4l2_dev
419 * field is set to the correct v4l2_device.
420 *
421 * unregistered: called when this subdev is unregistered. When called the
422 * v4l2_dev field is still set to the correct v4l2_device.
423 */
424struct v4l2_subdev_internal_ops {
425 int (*registered)(struct v4l2_subdev *sd);
426 void (*unregistered)(struct v4l2_subdev *sd);
427};
428
418#define V4L2_SUBDEV_NAME_SIZE 32 429#define V4L2_SUBDEV_NAME_SIZE 32
419 430
420/* Set this flag if this subdev is a i2c device. */ 431/* Set this flag if this subdev is a i2c device. */
@@ -431,6 +442,8 @@ struct v4l2_subdev {
431 u32 flags; 442 u32 flags;
432 struct v4l2_device *v4l2_dev; 443 struct v4l2_device *v4l2_dev;
433 const struct v4l2_subdev_ops *ops; 444 const struct v4l2_subdev_ops *ops;
445 /* Never call these internal ops from within a driver! */
446 const struct v4l2_subdev_internal_ops *internal_ops;
434 /* The control handler of this subdev. May be NULL. */ 447 /* The control handler of this subdev. May be NULL. */
435 struct v4l2_ctrl_handler *ctrl_handler; 448 struct v4l2_ctrl_handler *ctrl_handler;
436 /* name must be unique */ 449 /* name must be unique */
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index a8e7852b10ab..e5983c9053dc 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -43,6 +43,8 @@ struct dcbnl_rtnl_ops {
43 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 43 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
44 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 44 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
45 int (*ieee_setapp) (struct net_device *, struct dcb_app *); 45 int (*ieee_setapp) (struct net_device *, struct dcb_app *);
46 int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *);
47 int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *);
46 48
47 /* CEE std */ 49 /* CEE std */
48 u8 (*getstate)(struct net_device *); 50 u8 (*getstate)(struct net_device *);
@@ -77,7 +79,14 @@ struct dcbnl_rtnl_ops {
77 u8 (*getdcbx)(struct net_device *); 79 u8 (*getdcbx)(struct net_device *);
78 u8 (*setdcbx)(struct net_device *, u8); 80 u8 (*setdcbx)(struct net_device *, u8);
79 81
82 /* peer apps */
83 int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *,
84 u16 *);
85 int (*peer_getapptable)(struct net_device *, struct dcb_app *);
80 86
87 /* CEE peer */
88 int (*cee_peer_getpg) (struct net_device *, struct cee_pg *);
89 int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *);
81}; 90};
82 91
83#endif /* __NET_DCBNL_H__ */ 92#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dn.h b/include/net/dn.h
index a514a3cf4573..298521e0d8a2 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -192,10 +192,10 @@ static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
192 ethaddr[5] = (__u8)(a >> 8); 192 ethaddr[5] = (__u8)(a >> 8);
193} 193}
194 194
195static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) 195static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
196{ 196{
197 fl->uli_u.dnports.sport = scp->addrloc; 197 fld->fld_sport = scp->addrloc;
198 fl->uli_u.dnports.dport = scp->addrrem; 198 fld->fld_dport = scp->addrrem;
199} 199}
200 200
201extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); 201extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index bbcde3238e58..782ef7cb4930 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -98,7 +98,7 @@ struct dn_fib_table {
98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r, 98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
99 struct dn_kern_rta *rta, struct nlmsghdr *n, 99 struct dn_kern_rta *rta, struct nlmsghdr *n,
100 struct netlink_skb_parms *req); 100 struct netlink_skb_parms *req);
101 int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, 101 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,
102 struct dn_fib_res *res); 102 struct dn_fib_res *res);
103 int (*flush)(struct dn_fib_table *t); 103 int (*flush)(struct dn_fib_table *t);
104 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); 104 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb);
@@ -119,12 +119,12 @@ extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
119 struct dn_kern_rta *rta, 119 struct dn_kern_rta *rta,
120 const struct nlmsghdr *nlh, int *errp); 120 const struct nlmsghdr *nlh, int *errp);
121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
122 const struct flowi *fl, 122 const struct flowidn *fld,
123 struct dn_fib_res *res); 123 struct dn_fib_res *res);
124extern void dn_fib_release_info(struct dn_fib_info *fi); 124extern void dn_fib_release_info(struct dn_fib_info *fi);
125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); 125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
126extern void dn_fib_flush(void); 126extern void dn_fib_flush(void);
127extern void dn_fib_select_multipath(const struct flowi *fl, 127extern void dn_fib_select_multipath(const struct flowidn *fld,
128 struct dn_fib_res *res); 128 struct dn_fib_res *res);
129 129
130/* 130/*
@@ -141,7 +141,7 @@ extern void dn_fib_table_cleanup(void);
141extern void dn_fib_rules_init(void); 141extern void dn_fib_rules_init(void);
142extern void dn_fib_rules_cleanup(void); 142extern void dn_fib_rules_cleanup(void);
143extern unsigned dnet_addr_type(__le16 addr); 143extern unsigned dnet_addr_type(__le16 addr);
144extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); 144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
145 145
146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
147 147
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 9b185df265fb..81712cfa1ddf 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -16,7 +16,7 @@
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
22 22
@@ -67,7 +67,7 @@ extern void dn_rt_cache_flush(int delay);
67struct dn_route { 67struct dn_route {
68 struct dst_entry dst; 68 struct dst_entry dst;
69 69
70 struct flowi fl; 70 struct flowidn fld;
71 71
72 __le16 rt_saddr; 72 __le16 rt_saddr;
73 __le16 rt_daddr; 73 __le16 rt_daddr;
@@ -82,12 +82,12 @@ struct dn_route {
82 82
83static inline bool dn_is_input_route(struct dn_route *rt) 83static inline bool dn_is_input_route(struct dn_route *rt)
84{ 84{
85 return rt->fl.iif != 0; 85 return rt->fld.flowidn_iif != 0;
86} 86}
87 87
88static inline bool dn_is_output_route(struct dn_route *rt) 88static inline bool dn_is_output_route(struct dn_route *rt)
89{ 89{
90 return rt->fl.iif == 0; 90 return rt->fld.flowidn_iif == 0;
91} 91}
92 92
93extern void dn_route_init(void); 93extern void dn_route_init(void);
diff --git a/include/net/dst.h b/include/net/dst.h
index 93b0310317be..2a46cbaef92d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -40,24 +40,10 @@ struct dst_entry {
40 struct rcu_head rcu_head; 40 struct rcu_head rcu_head;
41 struct dst_entry *child; 41 struct dst_entry *child;
42 struct net_device *dev; 42 struct net_device *dev;
43 short error; 43 struct dst_ops *ops;
44 short obsolete; 44 unsigned long _metrics;
45 int flags;
46#define DST_HOST 0x0001
47#define DST_NOXFRM 0x0002
48#define DST_NOPOLICY 0x0004
49#define DST_NOHASH 0x0008
50#define DST_NOCACHE 0x0010
51 unsigned long expires; 45 unsigned long expires;
52
53 unsigned short header_len; /* more space at head required */
54 unsigned short trailer_len; /* space to reserve at tail */
55
56 unsigned int rate_tokens;
57 unsigned long rate_last; /* rate limiting for ICMP */
58
59 struct dst_entry *path; 46 struct dst_entry *path;
60
61 struct neighbour *neighbour; 47 struct neighbour *neighbour;
62 struct hh_cache *hh; 48 struct hh_cache *hh;
63#ifdef CONFIG_XFRM 49#ifdef CONFIG_XFRM
@@ -68,17 +54,16 @@ struct dst_entry {
68 int (*input)(struct sk_buff*); 54 int (*input)(struct sk_buff*);
69 int (*output)(struct sk_buff*); 55 int (*output)(struct sk_buff*);
70 56
71 struct dst_ops *ops; 57 short error;
72 58 short obsolete;
73 u32 _metrics[RTAX_MAX]; 59 unsigned short header_len; /* more space at head required */
74 60 unsigned short trailer_len; /* space to reserve at tail */
75#ifdef CONFIG_NET_CLS_ROUTE 61#ifdef CONFIG_IP_ROUTE_CLASSID
76 __u32 tclassid; 62 __u32 tclassid;
77#else 63#else
78 __u32 __pad2; 64 __u32 __pad2;
79#endif 65#endif
80 66
81
82 /* 67 /*
83 * Align __refcnt to a 64 bytes alignment 68 * Align __refcnt to a 64 bytes alignment
84 * (L1_CACHE_SIZE would be too much) 69 * (L1_CACHE_SIZE would be too much)
@@ -93,6 +78,12 @@ struct dst_entry {
93 atomic_t __refcnt; /* client references */ 78 atomic_t __refcnt; /* client references */
94 int __use; 79 int __use;
95 unsigned long lastuse; 80 unsigned long lastuse;
81 int flags;
82#define DST_HOST 0x0001
83#define DST_NOXFRM 0x0002
84#define DST_NOPOLICY 0x0004
85#define DST_NOHASH 0x0008
86#define DST_NOCACHE 0x0010
96 union { 87 union {
97 struct dst_entry *next; 88 struct dst_entry *next;
98 struct rtable __rcu *rt_next; 89 struct rtable __rcu *rt_next;
@@ -103,10 +94,70 @@ struct dst_entry {
103 94
104#ifdef __KERNEL__ 95#ifdef __KERNEL__
105 96
97extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
98extern const u32 dst_default_metrics[RTAX_MAX];
99
100#define DST_METRICS_READ_ONLY 0x1UL
101#define __DST_METRICS_PTR(Y) \
102 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY))
103#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
104
105static inline bool dst_metrics_read_only(const struct dst_entry *dst)
106{
107 return dst->_metrics & DST_METRICS_READ_ONLY;
108}
109
110extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
111
112static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
113{
114 unsigned long val = dst->_metrics;
115 if (!(val & DST_METRICS_READ_ONLY))
116 __dst_destroy_metrics_generic(dst, val);
117}
118
119static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
120{
121 unsigned long p = dst->_metrics;
122
123 if (p & DST_METRICS_READ_ONLY)
124 return dst->ops->cow_metrics(dst, p);
125 return __DST_METRICS_PTR(p);
126}
127
128/* This may only be invoked before the entry has reached global
129 * visibility.
130 */
131static inline void dst_init_metrics(struct dst_entry *dst,
132 const u32 *src_metrics,
133 bool read_only)
134{
135 dst->_metrics = ((unsigned long) src_metrics) |
136 (read_only ? DST_METRICS_READ_ONLY : 0);
137}
138
139static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src)
140{
141 u32 *dst_metrics = dst_metrics_write_ptr(dest);
142
143 if (dst_metrics) {
144 u32 *src_metrics = DST_METRICS_PTR(src);
145
146 memcpy(dst_metrics, src_metrics, RTAX_MAX * sizeof(u32));
147 }
148}
149
150static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
151{
152 return DST_METRICS_PTR(dst);
153}
154
106static inline u32 155static inline u32
107dst_metric_raw(const struct dst_entry *dst, const int metric) 156dst_metric_raw(const struct dst_entry *dst, const int metric)
108{ 157{
109 return dst->_metrics[metric-1]; 158 u32 *p = DST_METRICS_PTR(dst);
159
160 return p[metric-1];
110} 161}
111 162
112static inline u32 163static inline u32
@@ -131,22 +182,10 @@ dst_metric_advmss(const struct dst_entry *dst)
131 182
132static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) 183static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
133{ 184{
134 dst->_metrics[metric-1] = val; 185 u32 *p = dst_metrics_write_ptr(dst);
135}
136 186
137static inline void dst_import_metrics(struct dst_entry *dst, const u32 *src_metrics) 187 if (p)
138{ 188 p[metric-1] = val;
139 memcpy(dst->_metrics, src_metrics, RTAX_MAX * sizeof(u32));
140}
141
142static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src)
143{
144 dst_import_metrics(dest, src->_metrics);
145}
146
147static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
148{
149 return dst->_metrics;
150} 189}
151 190
152static inline u32 191static inline u32
@@ -181,8 +220,6 @@ static inline u32
181dst_allfrag(const struct dst_entry *dst) 220dst_allfrag(const struct dst_entry *dst)
182{ 221{
183 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG); 222 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG);
184 /* Yes, _exactly_. This is paranoia. */
185 barrier();
186 return ret; 223 return ret;
187} 224}
188 225
@@ -315,7 +352,7 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
315} 352}
316 353
317extern int dst_discard(struct sk_buff *skb); 354extern int dst_discard(struct sk_buff *skb);
318extern void * dst_alloc(struct dst_ops * ops); 355extern void *dst_alloc(struct dst_ops * ops, int initial_ref);
319extern void __dst_free(struct dst_entry * dst); 356extern void __dst_free(struct dst_entry * dst);
320extern struct dst_entry *dst_destroy(struct dst_entry * dst); 357extern struct dst_entry *dst_destroy(struct dst_entry * dst);
321 358
@@ -384,27 +421,22 @@ extern void dst_init(void);
384 421
385/* Flags for xfrm_lookup flags argument. */ 422/* Flags for xfrm_lookup flags argument. */
386enum { 423enum {
387 XFRM_LOOKUP_WAIT = 1 << 0, 424 XFRM_LOOKUP_ICMP = 1 << 0,
388 XFRM_LOOKUP_ICMP = 1 << 1,
389}; 425};
390 426
391struct flowi; 427struct flowi;
392#ifndef CONFIG_XFRM 428#ifndef CONFIG_XFRM
393static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p, 429static inline struct dst_entry *xfrm_lookup(struct net *net,
394 struct flowi *fl, struct sock *sk, int flags) 430 struct dst_entry *dst_orig,
431 const struct flowi *fl, struct sock *sk,
432 int flags)
395{ 433{
396 return 0; 434 return dst_orig;
397} 435}
398static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
399 struct flowi *fl, struct sock *sk, int flags)
400{
401 return 0;
402}
403#else 436#else
404extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p, 437extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
405 struct flowi *fl, struct sock *sk, int flags); 438 const struct flowi *fl, struct sock *sk,
406extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, 439 int flags);
407 struct flowi *fl, struct sock *sk, int flags);
408#endif 440#endif
409#endif 441#endif
410 442
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 21a320b8708e..dc0746328947 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -18,6 +18,7 @@ struct dst_ops {
18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); 18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
19 unsigned int (*default_advmss)(const struct dst_entry *); 19 unsigned int (*default_advmss)(const struct dst_entry *);
20 unsigned int (*default_mtu)(const struct dst_entry *); 20 unsigned int (*default_mtu)(const struct dst_entry *);
21 u32 * (*cow_metrics)(struct dst_entry *, unsigned long);
21 void (*destroy)(struct dst_entry *); 22 void (*destroy)(struct dst_entry *);
22 void (*ifdown)(struct dst_entry *, 23 void (*ifdown)(struct dst_entry *,
23 struct net_device *dev, int how); 24 struct net_device *dev, int how);
diff --git a/include/net/flow.h b/include/net/flow.h
index 240b7f356c71..7fe5a0f9483a 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -10,78 +10,136 @@
10#include <linux/in6.h> 10#include <linux/in6.h>
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12 12
13struct flowi { 13struct flowi_common {
14 int oif; 14 int flowic_oif;
15 int iif; 15 int flowic_iif;
16 __u32 mark; 16 __u32 flowic_mark;
17 __u8 flowic_tos;
18 __u8 flowic_scope;
19 __u8 flowic_proto;
20 __u8 flowic_flags;
21#define FLOWI_FLAG_ANYSRC 0x01
22#define FLOWI_FLAG_PRECOW_METRICS 0x02
23#define FLOWI_FLAG_CAN_SLEEP 0x04
24 __u32 flowic_secid;
25};
17 26
27union flowi_uli {
28 struct {
29 __be16 sport;
30 __be16 dport;
31 } ports;
32
33 struct {
34 __u8 type;
35 __u8 code;
36 } icmpt;
37
38 struct {
39 __le16 sport;
40 __le16 dport;
41 } dnports;
42
43 __be32 spi;
44 __be32 gre_key;
45
46 struct {
47 __u8 type;
48 } mht;
49};
50
51struct flowi4 {
52 struct flowi_common __fl_common;
53#define flowi4_oif __fl_common.flowic_oif
54#define flowi4_iif __fl_common.flowic_iif
55#define flowi4_mark __fl_common.flowic_mark
56#define flowi4_tos __fl_common.flowic_tos
57#define flowi4_scope __fl_common.flowic_scope
58#define flowi4_proto __fl_common.flowic_proto
59#define flowi4_flags __fl_common.flowic_flags
60#define flowi4_secid __fl_common.flowic_secid
61 __be32 daddr;
62 __be32 saddr;
63 union flowi_uli uli;
64#define fl4_sport uli.ports.sport
65#define fl4_dport uli.ports.dport
66#define fl4_icmp_type uli.icmpt.type
67#define fl4_icmp_code uli.icmpt.code
68#define fl4_ipsec_spi uli.spi
69#define fl4_mh_type uli.mht.type
70#define fl4_gre_key uli.gre_key
71};
72
73struct flowi6 {
74 struct flowi_common __fl_common;
75#define flowi6_oif __fl_common.flowic_oif
76#define flowi6_iif __fl_common.flowic_iif
77#define flowi6_mark __fl_common.flowic_mark
78#define flowi6_tos __fl_common.flowic_tos
79#define flowi6_scope __fl_common.flowic_scope
80#define flowi6_proto __fl_common.flowic_proto
81#define flowi6_flags __fl_common.flowic_flags
82#define flowi6_secid __fl_common.flowic_secid
83 struct in6_addr daddr;
84 struct in6_addr saddr;
85 __be32 flowlabel;
86 union flowi_uli uli;
87#define fl6_sport uli.ports.sport
88#define fl6_dport uli.ports.dport
89#define fl6_icmp_type uli.icmpt.type
90#define fl6_icmp_code uli.icmpt.code
91#define fl6_ipsec_spi uli.spi
92#define fl6_mh_type uli.mht.type
93#define fl6_gre_key uli.gre_key
94};
95
96struct flowidn {
97 struct flowi_common __fl_common;
98#define flowidn_oif __fl_common.flowic_oif
99#define flowidn_iif __fl_common.flowic_iif
100#define flowidn_mark __fl_common.flowic_mark
101#define flowidn_scope __fl_common.flowic_scope
102#define flowidn_proto __fl_common.flowic_proto
103#define flowidn_flags __fl_common.flowic_flags
104 __le16 daddr;
105 __le16 saddr;
106 union flowi_uli uli;
107#define fld_sport uli.ports.sport
108#define fld_dport uli.ports.dport
109};
110
111struct flowi {
18 union { 112 union {
19 struct { 113 struct flowi_common __fl_common;
20 __be32 daddr; 114 struct flowi4 ip4;
21 __be32 saddr; 115 struct flowi6 ip6;
22 __u8 tos; 116 struct flowidn dn;
23 __u8 scope; 117 } u;
24 } ip4_u; 118#define flowi_oif u.__fl_common.flowic_oif
25 119#define flowi_iif u.__fl_common.flowic_iif
26 struct { 120#define flowi_mark u.__fl_common.flowic_mark
27 struct in6_addr daddr; 121#define flowi_tos u.__fl_common.flowic_tos
28 struct in6_addr saddr; 122#define flowi_scope u.__fl_common.flowic_scope
29 __be32 flowlabel; 123#define flowi_proto u.__fl_common.flowic_proto
30 } ip6_u; 124#define flowi_flags u.__fl_common.flowic_flags
31 125#define flowi_secid u.__fl_common.flowic_secid
32 struct {
33 __le16 daddr;
34 __le16 saddr;
35 __u8 scope;
36 } dn_u;
37 } nl_u;
38#define fld_dst nl_u.dn_u.daddr
39#define fld_src nl_u.dn_u.saddr
40#define fld_scope nl_u.dn_u.scope
41#define fl6_dst nl_u.ip6_u.daddr
42#define fl6_src nl_u.ip6_u.saddr
43#define fl6_flowlabel nl_u.ip6_u.flowlabel
44#define fl4_dst nl_u.ip4_u.daddr
45#define fl4_src nl_u.ip4_u.saddr
46#define fl4_tos nl_u.ip4_u.tos
47#define fl4_scope nl_u.ip4_u.scope
48
49 __u8 proto;
50 __u8 flags;
51#define FLOWI_FLAG_ANYSRC 0x01
52 union {
53 struct {
54 __be16 sport;
55 __be16 dport;
56 } ports;
57
58 struct {
59 __u8 type;
60 __u8 code;
61 } icmpt;
62
63 struct {
64 __le16 sport;
65 __le16 dport;
66 } dnports;
67
68 __be32 spi;
69 __be32 gre_key;
70
71 struct {
72 __u8 type;
73 } mht;
74 } uli_u;
75#define fl_ip_sport uli_u.ports.sport
76#define fl_ip_dport uli_u.ports.dport
77#define fl_icmp_type uli_u.icmpt.type
78#define fl_icmp_code uli_u.icmpt.code
79#define fl_ipsec_spi uli_u.spi
80#define fl_mh_type uli_u.mht.type
81#define fl_gre_key uli_u.gre_key
82 __u32 secid; /* used by xfrm; see secid.txt */
83} __attribute__((__aligned__(BITS_PER_LONG/8))); 126} __attribute__((__aligned__(BITS_PER_LONG/8)));
84 127
128static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)
129{
130 return container_of(fl4, struct flowi, u.ip4);
131}
132
133static inline struct flowi *flowi6_to_flowi(struct flowi6 *fl6)
134{
135 return container_of(fl6, struct flowi, u.ip6);
136}
137
138static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn)
139{
140 return container_of(fldn, struct flowi, u.dn);
141}
142
85#define FLOW_DIR_IN 0 143#define FLOW_DIR_IN 0
86#define FLOW_DIR_OUT 1 144#define FLOW_DIR_OUT 1
87#define FLOW_DIR_FWD 2 145#define FLOW_DIR_FWD 2
@@ -101,20 +159,14 @@ struct flow_cache_ops {
101}; 159};
102 160
103typedef struct flow_cache_object *(*flow_resolve_t)( 161typedef struct flow_cache_object *(*flow_resolve_t)(
104 struct net *net, struct flowi *key, u16 family, 162 struct net *net, const struct flowi *key, u16 family,
105 u8 dir, struct flow_cache_object *oldobj, void *ctx); 163 u8 dir, struct flow_cache_object *oldobj, void *ctx);
106 164
107extern struct flow_cache_object *flow_cache_lookup( 165extern struct flow_cache_object *flow_cache_lookup(
108 struct net *net, struct flowi *key, u16 family, 166 struct net *net, const struct flowi *key, u16 family,
109 u8 dir, flow_resolve_t resolver, void *ctx); 167 u8 dir, flow_resolve_t resolver, void *ctx);
110 168
111extern void flow_cache_flush(void); 169extern void flow_cache_flush(void);
112extern atomic_t flow_cache_genid; 170extern atomic_t flow_cache_genid;
113 171
114static inline int flow_cache_uli_match(struct flowi *fl1, struct flowi *fl2)
115{
116 return (fl1->proto == fl2->proto &&
117 !memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
118}
119
120#endif 172#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8a64b811a39a..b4c7c1cbcf40 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -195,7 +195,8 @@ static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
195 */ 195 */
196static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr) 196static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
197{ 197{
198 nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); 198 if (hdr)
199 nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
199} 200}
200 201
201/** 202/**
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6e991e0d0d6f..f0698b955b73 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -45,7 +45,4 @@ extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
45extern int icmp_init(void); 45extern int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 46extern void icmp_out_count(struct net *net, unsigned char type);
47 47
48/* Move into dst.h ? */
49extern int xrlim_allow(struct dst_entry *dst, int timeout);
50
51#endif /* _ICMP_H */ 48#endif /* _ICMP_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 8181498fa96c..7a37369f8ea3 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -86,6 +86,19 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
86 return (struct inet_request_sock *)sk; 86 return (struct inet_request_sock *)sk;
87} 87}
88 88
89struct inet_cork {
90 unsigned int flags;
91 unsigned int fragsize;
92 struct ip_options *opt;
93 struct dst_entry *dst;
94 int length; /* Total length of all frames */
95 __be32 addr;
96 struct flowi fl;
97 struct page *page;
98 u32 off;
99 u8 tx_flags;
100};
101
89struct ip_mc_socklist; 102struct ip_mc_socklist;
90struct ipv6_pinfo; 103struct ipv6_pinfo;
91struct rtable; 104struct rtable;
@@ -143,15 +156,7 @@ struct inet_sock {
143 int mc_index; 156 int mc_index;
144 __be32 mc_addr; 157 __be32 mc_addr;
145 struct ip_mc_socklist __rcu *mc_list; 158 struct ip_mc_socklist __rcu *mc_list;
146 struct { 159 struct inet_cork cork;
147 unsigned int flags;
148 unsigned int fragsize;
149 struct ip_options *opt;
150 struct dst_entry *dst;
151 int length; /* Total length of all frames */
152 __be32 addr;
153 struct flowi fl;
154 } cork;
155}; 160};
156 161
157#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ 162#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
@@ -219,7 +224,13 @@ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops
219 224
220static inline __u8 inet_sk_flowi_flags(const struct sock *sk) 225static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
221{ 226{
222 return inet_sk(sk)->transparent ? FLOWI_FLAG_ANYSRC : 0; 227 __u8 flags = 0;
228
229 if (inet_sk(sk)->transparent)
230 flags |= FLOWI_FLAG_ANYSRC;
231 if (sk->sk_protocol == IPPROTO_TCP)
232 flags |= FLOWI_FLAG_PRECOW_METRICS;
233 return flags;
223} 234}
224 235
225#endif /* _INET_SOCK_H */ 236#endif /* _INET_SOCK_H */
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 599d96e74114..e6dd8da6b2ad 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -11,15 +11,20 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/jiffies.h> 12#include <linux/jiffies.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/rtnetlink.h>
14#include <net/ipv6.h> 15#include <net/ipv6.h>
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16 17
17struct inetpeer_addr { 18struct inetpeer_addr_base {
18 union { 19 union {
19 __be32 a4; 20 __be32 a4;
20 __be32 a6[4]; 21 __be32 a6[4];
21 }; 22 };
22 __u16 family; 23};
24
25struct inetpeer_addr {
26 struct inetpeer_addr_base addr;
27 __u16 family;
23}; 28};
24 29
25struct inet_peer { 30struct inet_peer {
@@ -33,15 +38,22 @@ struct inet_peer {
33 atomic_t refcnt; 38 atomic_t refcnt;
34 /* 39 /*
35 * Once inet_peer is queued for deletion (refcnt == -1), following fields 40 * Once inet_peer is queued for deletion (refcnt == -1), following fields
36 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 41 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp, metrics
37 * We can share memory with rcu_head to keep inet_peer small 42 * We can share memory with rcu_head to help keep inet_peer small.
38 */ 43 */
39 union { 44 union {
40 struct { 45 struct {
41 atomic_t rid; /* Frag reception counter */ 46 atomic_t rid; /* Frag reception counter */
42 atomic_t ip_id_count; /* IP ID for the next packet */ 47 atomic_t ip_id_count; /* IP ID for the next packet */
43 __u32 tcp_ts; 48 __u32 tcp_ts;
44 __u32 tcp_ts_stamp; 49 __u32 tcp_ts_stamp;
50 u32 metrics[RTAX_MAX];
51 u32 rate_tokens; /* rate limiting for ICMP */
52 unsigned long rate_last;
53 unsigned long pmtu_expires;
54 u32 pmtu_orig;
55 u32 pmtu_learned;
56 struct inetpeer_addr_base redirect_learned;
45 }; 57 };
46 struct rcu_head rcu; 58 struct rcu_head rcu;
47 }; 59 };
@@ -49,6 +61,13 @@ struct inet_peer {
49 61
50void inet_initpeers(void) __init; 62void inet_initpeers(void) __init;
51 63
64#define INETPEER_METRICS_NEW (~(u32) 0)
65
66static inline bool inet_metrics_new(const struct inet_peer *p)
67{
68 return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW;
69}
70
52/* can be called with or without local BH being disabled */ 71/* can be called with or without local BH being disabled */
53struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); 72struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create);
54 73
@@ -56,7 +75,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
56{ 75{
57 struct inetpeer_addr daddr; 76 struct inetpeer_addr daddr;
58 77
59 daddr.a4 = v4daddr; 78 daddr.addr.a4 = v4daddr;
60 daddr.family = AF_INET; 79 daddr.family = AF_INET;
61 return inet_getpeer(&daddr, create); 80 return inet_getpeer(&daddr, create);
62} 81}
@@ -65,13 +84,14 @@ static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int cr
65{ 84{
66 struct inetpeer_addr daddr; 85 struct inetpeer_addr daddr;
67 86
68 ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr); 87 ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr);
69 daddr.family = AF_INET6; 88 daddr.family = AF_INET6;
70 return inet_getpeer(&daddr, create); 89 return inet_getpeer(&daddr, create);
71} 90}
72 91
73/* can be called from BH context or outside */ 92/* can be called from BH context or outside */
74extern void inet_putpeer(struct inet_peer *p); 93extern void inet_putpeer(struct inet_peer *p);
94extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
75 95
76/* 96/*
77 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 97 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 67fac78a186b..a4f631108c54 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -116,8 +116,24 @@ extern int ip_append_data(struct sock *sk,
116extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 116extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
117extern ssize_t ip_append_page(struct sock *sk, struct page *page, 117extern ssize_t ip_append_page(struct sock *sk, struct page *page,
118 int offset, size_t size, int flags); 118 int offset, size_t size, int flags);
119extern struct sk_buff *__ip_make_skb(struct sock *sk,
120 struct sk_buff_head *queue,
121 struct inet_cork *cork);
122extern int ip_send_skb(struct sk_buff *skb);
119extern int ip_push_pending_frames(struct sock *sk); 123extern int ip_push_pending_frames(struct sock *sk);
120extern void ip_flush_pending_frames(struct sock *sk); 124extern void ip_flush_pending_frames(struct sock *sk);
125extern struct sk_buff *ip_make_skb(struct sock *sk,
126 int getfrag(void *from, char *to, int offset, int len,
127 int odd, struct sk_buff *skb),
128 void *from, int length, int transhdrlen,
129 struct ipcm_cookie *ipc,
130 struct rtable **rtp,
131 unsigned int flags);
132
133static inline struct sk_buff *ip_finish_skb(struct sock *sk)
134{
135 return __ip_make_skb(sk, &sk->sk_write_queue, &inet_sk(sk)->cork);
136}
121 137
122/* datagram.c */ 138/* datagram.c */
123extern int ip4_datagram_connect(struct sock *sk, 139extern int ip4_datagram_connect(struct sock *sk,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 708ff7cb8806..bc3cde0a810c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -108,6 +108,7 @@ struct rt6_info {
108 u32 rt6i_flags; 108 u32 rt6i_flags;
109 struct rt6key rt6i_src; 109 struct rt6key rt6i_src;
110 u32 rt6i_metric; 110 u32 rt6i_metric;
111 u32 rt6i_peer_genid;
111 112
112 struct inet6_dev *rt6i_idev; 113 struct inet6_dev *rt6i_idev;
113 struct inet_peer *rt6i_peer; 114 struct inet_peer *rt6i_peer;
@@ -182,7 +183,7 @@ struct fib6_table {
182 183
183typedef struct rt6_info *(*pol_lookup_t)(struct net *, 184typedef struct rt6_info *(*pol_lookup_t)(struct net *,
184 struct fib6_table *, 185 struct fib6_table *,
185 struct flowi *, int); 186 struct flowi6 *, int);
186 187
187/* 188/*
188 * exported functions 189 * exported functions
@@ -191,7 +192,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
191extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 192extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
192extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 193extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
193extern struct dst_entry *fib6_rule_lookup(struct net *net, 194extern struct dst_entry *fib6_rule_lookup(struct net *net,
194 struct flowi *fl, int flags, 195 struct flowi6 *fl6, int flags,
195 pol_lookup_t lookup); 196 pol_lookup_t lookup);
196 197
197extern struct fib6_node *fib6_lookup(struct fib6_node *root, 198extern struct fib6_node *fib6_lookup(struct fib6_node *root,
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 8552f0a2e854..642a80bb42cf 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -71,7 +71,7 @@ extern void ip6_route_input(struct sk_buff *skb);
71 71
72extern struct dst_entry * ip6_route_output(struct net *net, 72extern struct dst_entry * ip6_route_output(struct net *net,
73 struct sock *sk, 73 struct sock *sk,
74 struct flowi *fl); 74 struct flowi6 *fl6);
75 75
76extern int ip6_route_init(void); 76extern int ip6_route_init(void);
77extern void ip6_route_cleanup(void); 77extern void ip6_route_cleanup(void);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 07bdb5e9e8ac..a1a858035913 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -51,15 +51,17 @@ struct fib_nh {
51 struct fib_info *nh_parent; 51 struct fib_info *nh_parent;
52 unsigned nh_flags; 52 unsigned nh_flags;
53 unsigned char nh_scope; 53 unsigned char nh_scope;
54 unsigned char nh_cfg_scope;
54#ifdef CONFIG_IP_ROUTE_MULTIPATH 55#ifdef CONFIG_IP_ROUTE_MULTIPATH
55 int nh_weight; 56 int nh_weight;
56 int nh_power; 57 int nh_power;
57#endif 58#endif
58#ifdef CONFIG_NET_CLS_ROUTE 59#ifdef CONFIG_IP_ROUTE_CLASSID
59 __u32 nh_tclassid; 60 __u32 nh_tclassid;
60#endif 61#endif
61 int nh_oif; 62 int nh_oif;
62 __be32 nh_gw; 63 __be32 nh_gw;
64 __be32 nh_saddr;
63}; 65};
64 66
65/* 67/*
@@ -77,7 +79,7 @@ struct fib_info {
77 int fib_protocol; 79 int fib_protocol;
78 __be32 fib_prefsrc; 80 __be32 fib_prefsrc;
79 u32 fib_priority; 81 u32 fib_priority;
80 u32 fib_metrics[RTAX_MAX]; 82 u32 *fib_metrics;
81#define fib_mtu fib_metrics[RTAX_MTU-1] 83#define fib_mtu fib_metrics[RTAX_MTU-1]
82#define fib_window fib_metrics[RTAX_WINDOW-1] 84#define fib_window fib_metrics[RTAX_WINDOW-1]
83#define fib_rtt fib_metrics[RTAX_RTT-1] 85#define fib_rtt fib_metrics[RTAX_RTT-1]
@@ -96,12 +98,15 @@ struct fib_info {
96struct fib_rule; 98struct fib_rule;
97#endif 99#endif
98 100
101struct fib_table;
99struct fib_result { 102struct fib_result {
100 unsigned char prefixlen; 103 unsigned char prefixlen;
101 unsigned char nh_sel; 104 unsigned char nh_sel;
102 unsigned char type; 105 unsigned char type;
103 unsigned char scope; 106 unsigned char scope;
104 struct fib_info *fi; 107 struct fib_info *fi;
108 struct fib_table *table;
109 struct list_head *fa_head;
105#ifdef CONFIG_IP_MULTIPLE_TABLES 110#ifdef CONFIG_IP_MULTIPLE_TABLES
106 struct fib_rule *r; 111 struct fib_rule *r;
107#endif 112#endif
@@ -136,11 +141,13 @@ struct fib_result_nl {
136 141
137#endif /* CONFIG_IP_ROUTE_MULTIPATH */ 142#endif /* CONFIG_IP_ROUTE_MULTIPATH */
138 143
139#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) 144#define FIB_RES_SADDR(res) (FIB_RES_NH(res).nh_saddr)
140#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) 145#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw)
141#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) 146#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev)
142#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) 147#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif)
143 148
149#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : FIB_RES_SADDR(res))
150
144struct fib_table { 151struct fib_table {
145 struct hlist_node tb_hlist; 152 struct hlist_node tb_hlist;
146 u32 tb_id; 153 u32 tb_id;
@@ -148,16 +155,13 @@ struct fib_table {
148 unsigned char tb_data[0]; 155 unsigned char tb_data[0];
149}; 156};
150 157
151extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, 158extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
152 struct fib_result *res, int fib_flags); 159 struct fib_result *res, int fib_flags);
153extern int fib_table_insert(struct fib_table *, struct fib_config *); 160extern int fib_table_insert(struct fib_table *, struct fib_config *);
154extern int fib_table_delete(struct fib_table *, struct fib_config *); 161extern int fib_table_delete(struct fib_table *, struct fib_config *);
155extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 162extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
156 struct netlink_callback *cb); 163 struct netlink_callback *cb);
157extern int fib_table_flush(struct fib_table *table); 164extern int fib_table_flush(struct fib_table *table);
158extern void fib_table_select_default(struct fib_table *table,
159 const struct flowi *flp,
160 struct fib_result *res);
161extern void fib_free_table(struct fib_table *tb); 165extern void fib_free_table(struct fib_table *tb);
162 166
163 167
@@ -182,7 +186,7 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id)
182 return fib_get_table(net, id); 186 return fib_get_table(net, id);
183} 187}
184 188
185static inline int fib_lookup(struct net *net, const struct flowi *flp, 189static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
186 struct fib_result *res) 190 struct fib_result *res)
187{ 191{
188 struct fib_table *table; 192 struct fib_table *table;
@@ -201,11 +205,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
201extern int __net_init fib4_rules_init(struct net *net); 205extern int __net_init fib4_rules_init(struct net *net);
202extern void __net_exit fib4_rules_exit(struct net *net); 206extern void __net_exit fib4_rules_exit(struct net *net);
203 207
204#ifdef CONFIG_NET_CLS_ROUTE 208#ifdef CONFIG_IP_ROUTE_CLASSID
205extern u32 fib_rules_tclass(struct fib_result *res); 209extern u32 fib_rules_tclass(const struct fib_result *res);
206#endif 210#endif
207 211
208extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); 212extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res);
209 213
210extern struct fib_table *fib_new_table(struct net *net, u32 id); 214extern struct fib_table *fib_new_table(struct net *net, u32 id);
211extern struct fib_table *fib_get_table(struct net *net, u32 id); 215extern struct fib_table *fib_get_table(struct net *net, u32 id);
@@ -218,24 +222,23 @@ extern void ip_fib_init(void);
218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 222extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
219 struct net_device *dev, __be32 *spec_dst, 223 struct net_device *dev, __be32 *spec_dst,
220 u32 *itag, u32 mark); 224 u32 *itag, u32 mark);
221extern void fib_select_default(struct net *net, const struct flowi *flp, 225extern void fib_select_default(struct fib_result *res);
222 struct fib_result *res);
223 226
224/* Exported by fib_semantics.c */ 227/* Exported by fib_semantics.c */
225extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 228extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
226extern int fib_sync_down_dev(struct net_device *dev, int force); 229extern int fib_sync_down_dev(struct net_device *dev, int force);
227extern int fib_sync_down_addr(struct net *net, __be32 local); 230extern int fib_sync_down_addr(struct net *net, __be32 local);
231extern void fib_update_nh_saddrs(struct net_device *dev);
228extern int fib_sync_up(struct net_device *dev); 232extern int fib_sync_up(struct net_device *dev);
229extern __be32 __fib_res_prefsrc(struct fib_result *res); 233extern void fib_select_multipath(struct fib_result *res);
230extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
231 234
232/* Exported by fib_{hash|trie}.c */ 235/* Exported by fib_trie.c */
233extern void fib_hash_init(void); 236extern void fib_trie_init(void);
234extern struct fib_table *fib_hash_table(u32 id); 237extern struct fib_table *fib_trie_table(u32 id);
235 238
236static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 239static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
237{ 240{
238#ifdef CONFIG_NET_CLS_ROUTE 241#ifdef CONFIG_IP_ROUTE_CLASSID
239#ifdef CONFIG_IP_MULTIPLE_TABLES 242#ifdef CONFIG_IP_MULTIPLE_TABLES
240 u32 rtag; 243 u32 rtag;
241#endif 244#endif
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index b7bbd6c28cfa..e74da41ebd1b 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -28,6 +28,80 @@
28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
29#include <net/netfilter/nf_conntrack.h> 29#include <net/netfilter/nf_conntrack.h>
30#endif 30#endif
31#include <net/net_namespace.h> /* Netw namespace */
32
33/*
34 * Generic access of ipvs struct
35 */
36static inline struct netns_ipvs *net_ipvs(struct net* net)
37{
38 return net->ipvs;
39}
40/*
41 * Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink)
43 */
44static inline struct net *skb_net(const struct sk_buff *skb)
45{
46#ifdef CONFIG_NET_NS
47#ifdef CONFIG_IP_VS_DEBUG
48 /*
49 * This is used for debug only.
50 * Start with the most likely hit
51 * End with BUG
52 */
53 if (likely(skb->dev && skb->dev->nd_net))
54 return dev_net(skb->dev);
55 if (skb_dst(skb)->dev)
56 return dev_net(skb_dst(skb)->dev);
57 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n",
58 __func__, __LINE__);
59 if (likely(skb->sk && skb->sk->sk_net))
60 return sock_net(skb->sk);
61 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
62 __func__, __LINE__);
63 BUG();
64#else
65 return dev_net(skb->dev ? : skb_dst(skb)->dev);
66#endif
67#else
68 return &init_net;
69#endif
70}
71
72static inline struct net *skb_sknet(const struct sk_buff *skb)
73{
74#ifdef CONFIG_NET_NS
75#ifdef CONFIG_IP_VS_DEBUG
76 /* Start with the most likely hit */
77 if (likely(skb->sk && skb->sk->sk_net))
78 return sock_net(skb->sk);
79 WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n",
80 __func__, __LINE__);
81 if (likely(skb->dev && skb->dev->nd_net))
82 return dev_net(skb->dev);
83 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
84 __func__, __LINE__);
85 BUG();
86#else
87 return sock_net(skb->sk);
88#endif
89#else
90 return &init_net;
91#endif
92}
93/*
94 * This one needed for single_open_net since net is stored directly in
95 * private not as a struct i.e. seq_file_net cant be used.
96 */
97static inline struct net *seq_file_single_net(struct seq_file *seq)
98{
99#ifdef CONFIG_NET_NS
100 return (struct net *)seq->private;
101#else
102 return &init_net;
103#endif
104}
31 105
32/* Connections' size value needed by ip_vs_ctl.c */ 106/* Connections' size value needed by ip_vs_ctl.c */
33extern int ip_vs_conn_tab_size; 107extern int ip_vs_conn_tab_size;
@@ -258,6 +332,23 @@ struct ip_vs_seq {
258 before last resized pkt */ 332 before last resized pkt */
259}; 333};
260 334
335/*
336 * counters per cpu
337 */
338struct ip_vs_counters {
339 __u32 conns; /* connections scheduled */
340 __u32 inpkts; /* incoming packets */
341 __u32 outpkts; /* outgoing packets */
342 __u64 inbytes; /* incoming bytes */
343 __u64 outbytes; /* outgoing bytes */
344};
345/*
346 * Stats per cpu
347 */
348struct ip_vs_cpu_stats {
349 struct ip_vs_counters ustats;
350 struct u64_stats_sync syncp;
351};
261 352
262/* 353/*
263 * IPVS statistics objects 354 * IPVS statistics objects
@@ -279,17 +370,34 @@ struct ip_vs_estimator {
279}; 370};
280 371
281struct ip_vs_stats { 372struct ip_vs_stats {
282 struct ip_vs_stats_user ustats; /* statistics */ 373 struct ip_vs_stats_user ustats; /* statistics */
283 struct ip_vs_estimator est; /* estimator */ 374 struct ip_vs_estimator est; /* estimator */
284 375 struct ip_vs_cpu_stats *cpustats; /* per cpu counters */
285 spinlock_t lock; /* spin lock */ 376 spinlock_t lock; /* spin lock */
286}; 377};
287 378
379/*
380 * Helper Macros for per cpu
381 * ipvs->tot_stats->ustats.count
382 */
383#define IPVS_STAT_INC(ipvs, count) \
384 __this_cpu_inc((ipvs)->ustats->count)
385
386#define IPVS_STAT_ADD(ipvs, count, value) \
387 do {\
388 write_seqcount_begin(per_cpu_ptr((ipvs)->ustats_seq, \
389 raw_smp_processor_id())); \
390 __this_cpu_add((ipvs)->ustats->count, value); \
391 write_seqcount_end(per_cpu_ptr((ipvs)->ustats_seq, \
392 raw_smp_processor_id())); \
393 } while (0)
394
288struct dst_entry; 395struct dst_entry;
289struct iphdr; 396struct iphdr;
290struct ip_vs_conn; 397struct ip_vs_conn;
291struct ip_vs_app; 398struct ip_vs_app;
292struct sk_buff; 399struct sk_buff;
400struct ip_vs_proto_data;
293 401
294struct ip_vs_protocol { 402struct ip_vs_protocol {
295 struct ip_vs_protocol *next; 403 struct ip_vs_protocol *next;
@@ -297,21 +405,22 @@ struct ip_vs_protocol {
297 u16 protocol; 405 u16 protocol;
298 u16 num_states; 406 u16 num_states;
299 int dont_defrag; 407 int dont_defrag;
300 atomic_t appcnt; /* counter of proto app incs */
301 int *timeout_table; /* protocol timeout table */
302 408
303 void (*init)(struct ip_vs_protocol *pp); 409 void (*init)(struct ip_vs_protocol *pp);
304 410
305 void (*exit)(struct ip_vs_protocol *pp); 411 void (*exit)(struct ip_vs_protocol *pp);
306 412
413 void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
414
415 void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
416
307 int (*conn_schedule)(int af, struct sk_buff *skb, 417 int (*conn_schedule)(int af, struct sk_buff *skb,
308 struct ip_vs_protocol *pp, 418 struct ip_vs_proto_data *pd,
309 int *verdict, struct ip_vs_conn **cpp); 419 int *verdict, struct ip_vs_conn **cpp);
310 420
311 struct ip_vs_conn * 421 struct ip_vs_conn *
312 (*conn_in_get)(int af, 422 (*conn_in_get)(int af,
313 const struct sk_buff *skb, 423 const struct sk_buff *skb,
314 struct ip_vs_protocol *pp,
315 const struct ip_vs_iphdr *iph, 424 const struct ip_vs_iphdr *iph,
316 unsigned int proto_off, 425 unsigned int proto_off,
317 int inverse); 426 int inverse);
@@ -319,7 +428,6 @@ struct ip_vs_protocol {
319 struct ip_vs_conn * 428 struct ip_vs_conn *
320 (*conn_out_get)(int af, 429 (*conn_out_get)(int af,
321 const struct sk_buff *skb, 430 const struct sk_buff *skb,
322 struct ip_vs_protocol *pp,
323 const struct ip_vs_iphdr *iph, 431 const struct ip_vs_iphdr *iph,
324 unsigned int proto_off, 432 unsigned int proto_off,
325 int inverse); 433 int inverse);
@@ -337,11 +445,11 @@ struct ip_vs_protocol {
337 445
338 int (*state_transition)(struct ip_vs_conn *cp, int direction, 446 int (*state_transition)(struct ip_vs_conn *cp, int direction,
339 const struct sk_buff *skb, 447 const struct sk_buff *skb,
340 struct ip_vs_protocol *pp); 448 struct ip_vs_proto_data *pd);
341 449
342 int (*register_app)(struct ip_vs_app *inc); 450 int (*register_app)(struct net *net, struct ip_vs_app *inc);
343 451
344 void (*unregister_app)(struct ip_vs_app *inc); 452 void (*unregister_app)(struct net *net, struct ip_vs_app *inc);
345 453
346 int (*app_conn_bind)(struct ip_vs_conn *cp); 454 int (*app_conn_bind)(struct ip_vs_conn *cp);
347 455
@@ -350,14 +458,26 @@ struct ip_vs_protocol {
350 int offset, 458 int offset,
351 const char *msg); 459 const char *msg);
352 460
353 void (*timeout_change)(struct ip_vs_protocol *pp, int flags); 461 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
462};
354 463
355 int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to); 464/*
465 * protocol data per netns
466 */
467struct ip_vs_proto_data {
468 struct ip_vs_proto_data *next;
469 struct ip_vs_protocol *pp;
470 int *timeout_table; /* protocol timeout table */
471 atomic_t appcnt; /* counter of proto app incs. */
472 struct tcp_states_t *tcp_state_table;
356}; 473};
357 474
358extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); 475extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
476extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
477 unsigned short proto);
359 478
360struct ip_vs_conn_param { 479struct ip_vs_conn_param {
480 struct net *net;
361 const union nf_inet_addr *caddr; 481 const union nf_inet_addr *caddr;
362 const union nf_inet_addr *vaddr; 482 const union nf_inet_addr *vaddr;
363 __be16 cport; 483 __be16 cport;
@@ -374,17 +494,20 @@ struct ip_vs_conn_param {
374 * IP_VS structure allocated for each dynamically scheduled connection 494 * IP_VS structure allocated for each dynamically scheduled connection
375 */ 495 */
376struct ip_vs_conn { 496struct ip_vs_conn {
377 struct list_head c_list; /* hashed list heads */ 497 struct hlist_node c_list; /* hashed list heads */
378 498#ifdef CONFIG_NET_NS
499 struct net *net; /* Name space */
500#endif
379 /* Protocol, addresses and port numbers */ 501 /* Protocol, addresses and port numbers */
380 u16 af; /* address family */ 502 u16 af; /* address family */
381 union nf_inet_addr caddr; /* client address */ 503 __be16 cport;
382 union nf_inet_addr vaddr; /* virtual address */ 504 __be16 vport;
383 union nf_inet_addr daddr; /* destination address */ 505 __be16 dport;
384 volatile __u32 flags; /* status flags */ 506 __u32 fwmark; /* Fire wall mark from skb */
385 __be16 cport; 507 union nf_inet_addr caddr; /* client address */
386 __be16 vport; 508 union nf_inet_addr vaddr; /* virtual address */
387 __be16 dport; 509 union nf_inet_addr daddr; /* destination address */
510 volatile __u32 flags; /* status flags */
388 __u16 protocol; /* Which protocol (TCP/UDP) */ 511 __u16 protocol; /* Which protocol (TCP/UDP) */
389 512
390 /* counter and timer */ 513 /* counter and timer */
@@ -422,10 +545,38 @@ struct ip_vs_conn {
422 struct ip_vs_seq in_seq; /* incoming seq. struct */ 545 struct ip_vs_seq in_seq; /* incoming seq. struct */
423 struct ip_vs_seq out_seq; /* outgoing seq. struct */ 546 struct ip_vs_seq out_seq; /* outgoing seq. struct */
424 547
548 const struct ip_vs_pe *pe;
425 char *pe_data; 549 char *pe_data;
426 __u8 pe_data_len; 550 __u8 pe_data_len;
427}; 551};
428 552
553/*
554 * To save some memory in conn table when name space is disabled.
555 */
556static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
557{
558#ifdef CONFIG_NET_NS
559 return cp->net;
560#else
561 return &init_net;
562#endif
563}
564static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
565{
566#ifdef CONFIG_NET_NS
567 cp->net = net;
568#endif
569}
570
571static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
572 struct net *net)
573{
574#ifdef CONFIG_NET_NS
575 return cp->net == net;
576#else
577 return 1;
578#endif
579}
429 580
430/* 581/*
431 * Extended internal versions of struct ip_vs_service_user and 582 * Extended internal versions of struct ip_vs_service_user and
@@ -485,6 +636,7 @@ struct ip_vs_service {
485 unsigned flags; /* service status flags */ 636 unsigned flags; /* service status flags */
486 unsigned timeout; /* persistent timeout in ticks */ 637 unsigned timeout; /* persistent timeout in ticks */
487 __be32 netmask; /* grouping granularity */ 638 __be32 netmask; /* grouping granularity */
639 struct net *net;
488 640
489 struct list_head destinations; /* real server d-linked list */ 641 struct list_head destinations; /* real server d-linked list */
490 __u32 num_dests; /* number of servers */ 642 __u32 num_dests; /* number of servers */
@@ -510,8 +662,8 @@ struct ip_vs_dest {
510 struct list_head d_list; /* for table with all the dests */ 662 struct list_head d_list; /* for table with all the dests */
511 663
512 u16 af; /* address family */ 664 u16 af; /* address family */
513 union nf_inet_addr addr; /* IP address of the server */
514 __be16 port; /* port number of the server */ 665 __be16 port; /* port number of the server */
666 union nf_inet_addr addr; /* IP address of the server */
515 volatile unsigned flags; /* dest status flags */ 667 volatile unsigned flags; /* dest status flags */
516 atomic_t conn_flags; /* flags to copy to conn */ 668 atomic_t conn_flags; /* flags to copy to conn */
517 atomic_t weight; /* server weight */ 669 atomic_t weight; /* server weight */
@@ -538,8 +690,8 @@ struct ip_vs_dest {
538 /* for virtual service */ 690 /* for virtual service */
539 struct ip_vs_service *svc; /* service it belongs to */ 691 struct ip_vs_service *svc; /* service it belongs to */
540 __u16 protocol; /* which protocol (TCP/UDP) */ 692 __u16 protocol; /* which protocol (TCP/UDP) */
541 union nf_inet_addr vaddr; /* virtual IP address */
542 __be16 vport; /* virtual port number */ 693 __be16 vport; /* virtual port number */
694 union nf_inet_addr vaddr; /* virtual IP address */
543 __u32 vfwmark; /* firewall mark of service */ 695 __u32 vfwmark; /* firewall mark of service */
544}; 696};
545 697
@@ -674,13 +826,14 @@ enum {
674 IP_VS_DIR_LAST, 826 IP_VS_DIR_LAST,
675}; 827};
676 828
677static inline void ip_vs_conn_fill_param(int af, int protocol, 829static inline void ip_vs_conn_fill_param(struct net *net, int af, int protocol,
678 const union nf_inet_addr *caddr, 830 const union nf_inet_addr *caddr,
679 __be16 cport, 831 __be16 cport,
680 const union nf_inet_addr *vaddr, 832 const union nf_inet_addr *vaddr,
681 __be16 vport, 833 __be16 vport,
682 struct ip_vs_conn_param *p) 834 struct ip_vs_conn_param *p)
683{ 835{
836 p->net = net;
684 p->af = af; 837 p->af = af;
685 p->protocol = protocol; 838 p->protocol = protocol;
686 p->caddr = caddr; 839 p->caddr = caddr;
@@ -695,7 +848,6 @@ struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p);
695struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); 848struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
696 849
697struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 850struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
698 struct ip_vs_protocol *pp,
699 const struct ip_vs_iphdr *iph, 851 const struct ip_vs_iphdr *iph,
700 unsigned int proto_off, 852 unsigned int proto_off,
701 int inverse); 853 int inverse);
@@ -703,7 +855,6 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
703struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 855struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
704 856
705struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 857struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
706 struct ip_vs_protocol *pp,
707 const struct ip_vs_iphdr *iph, 858 const struct ip_vs_iphdr *iph,
708 unsigned int proto_off, 859 unsigned int proto_off,
709 int inverse); 860 int inverse);
@@ -719,14 +870,14 @@ extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
719struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 870struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
720 const union nf_inet_addr *daddr, 871 const union nf_inet_addr *daddr,
721 __be16 dport, unsigned flags, 872 __be16 dport, unsigned flags,
722 struct ip_vs_dest *dest); 873 struct ip_vs_dest *dest, __u32 fwmark);
723extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 874extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
724 875
725extern const char * ip_vs_state_name(__u16 proto, int state); 876extern const char * ip_vs_state_name(__u16 proto, int state);
726 877
727extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); 878extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
728extern int ip_vs_check_template(struct ip_vs_conn *ct); 879extern int ip_vs_check_template(struct ip_vs_conn *ct);
729extern void ip_vs_random_dropentry(void); 880extern void ip_vs_random_dropentry(struct net *net);
730extern int ip_vs_conn_init(void); 881extern int ip_vs_conn_init(void);
731extern void ip_vs_conn_cleanup(void); 882extern void ip_vs_conn_cleanup(void);
732 883
@@ -796,12 +947,12 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
796 * (from ip_vs_app.c) 947 * (from ip_vs_app.c)
797 */ 948 */
798#define IP_VS_APP_MAX_PORTS 8 949#define IP_VS_APP_MAX_PORTS 8
799extern int register_ip_vs_app(struct ip_vs_app *app); 950extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app);
800extern void unregister_ip_vs_app(struct ip_vs_app *app); 951extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
801extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 952extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
802extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 953extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
803extern int 954extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app,
804register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port); 955 __u16 proto, __u16 port);
805extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 956extern int ip_vs_app_inc_get(struct ip_vs_app *inc);
806extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 957extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
807 958
@@ -814,15 +965,27 @@ void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
814void ip_vs_unbind_pe(struct ip_vs_service *svc); 965void ip_vs_unbind_pe(struct ip_vs_service *svc);
815int register_ip_vs_pe(struct ip_vs_pe *pe); 966int register_ip_vs_pe(struct ip_vs_pe *pe);
816int unregister_ip_vs_pe(struct ip_vs_pe *pe); 967int unregister_ip_vs_pe(struct ip_vs_pe *pe);
817extern struct ip_vs_pe *ip_vs_pe_get(const char *name); 968struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
818extern void ip_vs_pe_put(struct ip_vs_pe *pe); 969struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
970
971static inline void ip_vs_pe_get(const struct ip_vs_pe *pe)
972{
973 if (pe && pe->module)
974 __module_get(pe->module);
975}
976
977static inline void ip_vs_pe_put(const struct ip_vs_pe *pe)
978{
979 if (pe && pe->module)
980 module_put(pe->module);
981}
819 982
820/* 983/*
821 * IPVS protocol functions (from ip_vs_proto.c) 984 * IPVS protocol functions (from ip_vs_proto.c)
822 */ 985 */
823extern int ip_vs_protocol_init(void); 986extern int ip_vs_protocol_init(void);
824extern void ip_vs_protocol_cleanup(void); 987extern void ip_vs_protocol_cleanup(void);
825extern void ip_vs_protocol_timeout_change(int flags); 988extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
826extern int *ip_vs_create_timeout_table(int *table, int size); 989extern int *ip_vs_create_timeout_table(int *table, int size);
827extern int 990extern int
828ip_vs_set_state_timeout(int *table, int num, const char *const *names, 991ip_vs_set_state_timeout(int *table, int num, const char *const *names,
@@ -852,26 +1015,23 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
852extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1015extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
853extern struct ip_vs_conn * 1016extern struct ip_vs_conn *
854ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1017ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
855 struct ip_vs_protocol *pp, int *ignored); 1018 struct ip_vs_proto_data *pd, int *ignored);
856extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1019extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
857 struct ip_vs_protocol *pp); 1020 struct ip_vs_proto_data *pd);
1021
1022extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
858 1023
859 1024
860/* 1025/*
861 * IPVS control data and functions (from ip_vs_ctl.c) 1026 * IPVS control data and functions (from ip_vs_ctl.c)
862 */ 1027 */
863extern int sysctl_ip_vs_cache_bypass;
864extern int sysctl_ip_vs_expire_nodest_conn;
865extern int sysctl_ip_vs_expire_quiescent_template;
866extern int sysctl_ip_vs_sync_threshold[2];
867extern int sysctl_ip_vs_nat_icmp_send;
868extern int sysctl_ip_vs_conntrack;
869extern int sysctl_ip_vs_snat_reroute;
870extern struct ip_vs_stats ip_vs_stats; 1028extern struct ip_vs_stats ip_vs_stats;
871extern const struct ctl_path net_vs_ctl_path[]; 1029extern const struct ctl_path net_vs_ctl_path[];
1030extern int sysctl_ip_vs_sync_ver;
872 1031
1032extern void ip_vs_sync_switch_mode(struct net *net, int mode);
873extern struct ip_vs_service * 1033extern struct ip_vs_service *
874ip_vs_service_get(int af, __u32 fwmark, __u16 protocol, 1034ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
875 const union nf_inet_addr *vaddr, __be16 vport); 1035 const union nf_inet_addr *vaddr, __be16 vport);
876 1036
877static inline void ip_vs_service_put(struct ip_vs_service *svc) 1037static inline void ip_vs_service_put(struct ip_vs_service *svc)
@@ -880,7 +1040,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
880} 1040}
881 1041
882extern struct ip_vs_dest * 1042extern struct ip_vs_dest *
883ip_vs_lookup_real_service(int af, __u16 protocol, 1043ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
884 const union nf_inet_addr *daddr, __be16 dport); 1044 const union nf_inet_addr *daddr, __be16 dport);
885 1045
886extern int ip_vs_use_count_inc(void); 1046extern int ip_vs_use_count_inc(void);
@@ -888,8 +1048,9 @@ extern void ip_vs_use_count_dec(void);
888extern int ip_vs_control_init(void); 1048extern int ip_vs_control_init(void);
889extern void ip_vs_control_cleanup(void); 1049extern void ip_vs_control_cleanup(void);
890extern struct ip_vs_dest * 1050extern struct ip_vs_dest *
891ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport, 1051ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
892 const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol); 1052 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1053 __u16 protocol, __u32 fwmark);
893extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1054extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
894 1055
895 1056
@@ -897,14 +1058,12 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
897 * IPVS sync daemon data and function prototypes 1058 * IPVS sync daemon data and function prototypes
898 * (from ip_vs_sync.c) 1059 * (from ip_vs_sync.c)
899 */ 1060 */
900extern volatile int ip_vs_sync_state; 1061extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
901extern volatile int ip_vs_master_syncid; 1062 __u8 syncid);
902extern volatile int ip_vs_backup_syncid; 1063extern int stop_sync_thread(struct net *net, int state);
903extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1064extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp);
904extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1065extern int ip_vs_sync_init(void);
905extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid); 1066extern void ip_vs_sync_cleanup(void);
906extern int stop_sync_thread(int state);
907extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
908 1067
909 1068
910/* 1069/*
@@ -912,8 +1071,8 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
912 */ 1071 */
913extern int ip_vs_estimator_init(void); 1072extern int ip_vs_estimator_init(void);
914extern void ip_vs_estimator_cleanup(void); 1073extern void ip_vs_estimator_cleanup(void);
915extern void ip_vs_new_estimator(struct ip_vs_stats *stats); 1074extern void ip_vs_new_estimator(struct net *net, struct ip_vs_stats *stats);
916extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); 1075extern void ip_vs_kill_estimator(struct net *net, struct ip_vs_stats *stats);
917extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1076extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
918 1077
919/* 1078/*
@@ -952,14 +1111,14 @@ extern int ip_vs_icmp_xmit_v6
952 * we are loaded. Just set ip_vs_drop_rate to 'n' and 1111 * we are loaded. Just set ip_vs_drop_rate to 'n' and
953 * we start to drop 1/rate of the packets 1112 * we start to drop 1/rate of the packets
954 */ 1113 */
955extern int ip_vs_drop_rate;
956extern int ip_vs_drop_counter;
957 1114
958static __inline__ int ip_vs_todrop(void) 1115static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
959{ 1116{
960 if (!ip_vs_drop_rate) return 0; 1117 if (!ipvs->drop_rate)
961 if (--ip_vs_drop_counter > 0) return 0; 1118 return 0;
962 ip_vs_drop_counter = ip_vs_drop_rate; 1119 if (--ipvs->drop_counter > 0)
1120 return 0;
1121 ipvs->drop_counter = ipvs->drop_rate;
963 return 1; 1122 return 1;
964} 1123}
965 1124
@@ -1047,9 +1206,9 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1047 * Netfilter connection tracking 1206 * Netfilter connection tracking
1048 * (from ip_vs_nfct.c) 1207 * (from ip_vs_nfct.c)
1049 */ 1208 */
1050static inline int ip_vs_conntrack_enabled(void) 1209static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1051{ 1210{
1052 return sysctl_ip_vs_conntrack; 1211 return ipvs->sysctl_conntrack;
1053} 1212}
1054 1213
1055extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1214extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1062,7 +1221,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1062 1221
1063#else 1222#else
1064 1223
1065static inline int ip_vs_conntrack_enabled(void) 1224static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1066{ 1225{
1067 return 0; 1226 return 0;
1068} 1227}
@@ -1084,6 +1243,20 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1084/* CONFIG_IP_VS_NFCT */ 1243/* CONFIG_IP_VS_NFCT */
1085#endif 1244#endif
1086 1245
1246static inline unsigned int
1247ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1248{
1249 /*
1250 * We think the overhead of processing active connections is 256
1251 * times higher than that of inactive connections in average. (This
1252 * 256 times might not be accurate, we will change it later) We
1253 * use the following formula to estimate the overhead now:
1254 * dest->activeconns*256 + dest->inactconns
1255 */
1256 return (atomic_read(&dest->activeconns) << 8) +
1257 atomic_read(&dest->inactconns);
1258}
1259
1087#endif /* __KERNEL__ */ 1260#endif /* __KERNEL__ */
1088 1261
1089#endif /* _NET_IP_VS_H */ 1262#endif /* _NET_IP_VS_H */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4a3cd2cd2f5e..34200f9e6805 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -89,6 +89,18 @@
89#define IPV6_ADDR_SCOPE_GLOBAL 0x0e 89#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
90 90
91/* 91/*
92 * Addr flags
93 */
94#ifdef __KERNEL__
95#define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \
96 ((a)->s6_addr[1] & 0x10)
97#define IPV6_ADDR_MC_FLAG_PREFIX(a) \
98 ((a)->s6_addr[1] & 0x20)
99#define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \
100 ((a)->s6_addr[1] & 0x40)
101#endif
102
103/*
92 * fragmentation header 104 * fragmentation header
93 */ 105 */
94 106
@@ -480,7 +492,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
480 */ 492 */
481extern int ip6_xmit(struct sock *sk, 493extern int ip6_xmit(struct sock *sk,
482 struct sk_buff *skb, 494 struct sk_buff *skb,
483 struct flowi *fl, 495 struct flowi6 *fl6,
484 struct ipv6_txoptions *opt); 496 struct ipv6_txoptions *opt);
485 497
486extern int ip6_nd_hdr(struct sock *sk, 498extern int ip6_nd_hdr(struct sock *sk,
@@ -500,7 +512,7 @@ extern int ip6_append_data(struct sock *sk,
500 int hlimit, 512 int hlimit,
501 int tclass, 513 int tclass,
502 struct ipv6_txoptions *opt, 514 struct ipv6_txoptions *opt,
503 struct flowi *fl, 515 struct flowi6 *fl6,
504 struct rt6_info *rt, 516 struct rt6_info *rt,
505 unsigned int flags, 517 unsigned int flags,
506 int dontfrag); 518 int dontfrag);
@@ -511,13 +523,17 @@ extern void ip6_flush_pending_frames(struct sock *sk);
511 523
512extern int ip6_dst_lookup(struct sock *sk, 524extern int ip6_dst_lookup(struct sock *sk,
513 struct dst_entry **dst, 525 struct dst_entry **dst,
514 struct flowi *fl); 526 struct flowi6 *fl6);
515extern int ip6_dst_blackhole(struct sock *sk, 527extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
516 struct dst_entry **dst, 528 struct flowi6 *fl6,
517 struct flowi *fl); 529 const struct in6_addr *final_dst,
518extern int ip6_sk_dst_lookup(struct sock *sk, 530 bool can_sleep);
519 struct dst_entry **dst, 531extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
520 struct flowi *fl); 532 struct flowi6 *fl6,
533 const struct in6_addr *final_dst,
534 bool can_sleep);
535extern struct dst_entry * ip6_blackhole_route(struct net *net,
536 struct dst_entry *orig_dst);
521 537
522/* 538/*
523 * skb processing functions 539 * skb processing functions
@@ -550,7 +566,7 @@ extern int ipv6_ext_hdr(u8 nexthdr);
550 566
551extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 567extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
552 568
553extern struct in6_addr *fl6_update_dst(struct flowi *fl, 569extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
554 const struct ipv6_txoptions *opt, 570 const struct ipv6_txoptions *opt,
555 struct in6_addr *orig); 571 struct in6_addr *orig);
556 572
@@ -584,8 +600,8 @@ extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
584extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 600extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
585extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 601extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
586 u32 info, u8 *payload); 602 u32 info, u8 *payload);
587extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 603extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
588extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu); 604extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
589 605
590extern int inet6_release(struct socket *sock); 606extern int inet6_release(struct socket *sock);
591extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, 607extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 1bf812b21fb7..b3b4a34cb2cc 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -20,6 +20,7 @@
20#include <net/netns/conntrack.h> 20#include <net/netns/conntrack.h>
21#endif 21#endif
22#include <net/netns/xfrm.h> 22#include <net/netns/xfrm.h>
23#include <net/netns/ip_vs.h>
23 24
24struct proc_dir_entry; 25struct proc_dir_entry;
25struct net_device; 26struct net_device;
@@ -94,6 +95,7 @@ struct net {
94#ifdef CONFIG_XFRM 95#ifdef CONFIG_XFRM
95 struct netns_xfrm xfrm; 96 struct netns_xfrm xfrm;
96#endif 97#endif
98 struct netns_ipvs *ipvs;
97}; 99};
98 100
99 101
diff --git a/include/net/netevent.h b/include/net/netevent.h
index e82b7bab3ff3..22b239c17eaa 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -21,7 +21,6 @@ struct netevent_redirect {
21 21
22enum netevent_notif_type { 22enum netevent_notif_type {
23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ 23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
24 NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */
25 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ 24 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
26}; 25};
27 26
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index d85cff10e169..d0d13378991e 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -50,11 +50,24 @@ union nf_conntrack_expect_proto {
50/* per conntrack: application helper private data */ 50/* per conntrack: application helper private data */
51union nf_conntrack_help { 51union nf_conntrack_help {
52 /* insert conntrack helper private data (master) here */ 52 /* insert conntrack helper private data (master) here */
53#if defined(CONFIG_NF_CONNTRACK_FTP) || defined(CONFIG_NF_CONNTRACK_FTP_MODULE)
53 struct nf_ct_ftp_master ct_ftp_info; 54 struct nf_ct_ftp_master ct_ftp_info;
55#endif
56#if defined(CONFIG_NF_CONNTRACK_PPTP) || \
57 defined(CONFIG_NF_CONNTRACK_PPTP_MODULE)
54 struct nf_ct_pptp_master ct_pptp_info; 58 struct nf_ct_pptp_master ct_pptp_info;
59#endif
60#if defined(CONFIG_NF_CONNTRACK_H323) || \
61 defined(CONFIG_NF_CONNTRACK_H323_MODULE)
55 struct nf_ct_h323_master ct_h323_info; 62 struct nf_ct_h323_master ct_h323_info;
63#endif
64#if defined(CONFIG_NF_CONNTRACK_SANE) || \
65 defined(CONFIG_NF_CONNTRACK_SANE_MODULE)
56 struct nf_ct_sane_master ct_sane_info; 66 struct nf_ct_sane_master ct_sane_info;
67#endif
68#if defined(CONFIG_NF_CONNTRACK_SIP) || defined(CONFIG_NF_CONNTRACK_SIP_MODULE)
57 struct nf_ct_sip_master ct_sip_info; 69 struct nf_ct_sip_master ct_sip_info;
70#endif
58}; 71};
59 72
60#include <linux/types.h> 73#include <linux/types.h>
@@ -116,14 +129,14 @@ struct nf_conn {
116 u_int32_t secmark; 129 u_int32_t secmark;
117#endif 130#endif
118 131
119 /* Storage reserved for other modules: */
120 union nf_conntrack_proto proto;
121
122 /* Extensions */ 132 /* Extensions */
123 struct nf_ct_ext *ext; 133 struct nf_ct_ext *ext;
124#ifdef CONFIG_NET_NS 134#ifdef CONFIG_NET_NS
125 struct net *ct_net; 135 struct net *ct_net;
126#endif 136#endif
137
138 /* Storage reserved for other modules, must be the last member */
139 union nf_conntrack_proto proto;
127}; 140};
128 141
129static inline struct nf_conn * 142static inline struct nf_conn *
@@ -189,9 +202,9 @@ extern void nf_ct_l3proto_module_put(unsigned short l3proto);
189 * Allocate a hashtable of hlist_head (if nulls == 0), 202 * Allocate a hashtable of hlist_head (if nulls == 0),
190 * or hlist_nulls_head (if nulls == 1) 203 * or hlist_nulls_head (if nulls == 1)
191 */ 204 */
192extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls); 205extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
193 206
194extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); 207extern void nf_ct_free_hashtable(void *hash, unsigned int size);
195 208
196extern struct nf_conntrack_tuple_hash * 209extern struct nf_conntrack_tuple_hash *
197__nf_conntrack_find(struct net *net, u16 zone, 210__nf_conntrack_find(struct net *net, u16 zone,
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 96ba5f7dcab6..4283508b3e18 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -23,12 +23,17 @@ struct nf_conntrack_ecache {
23static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
24nf_ct_ecache_find(const struct nf_conn *ct) 24nf_ct_ecache_find(const struct nf_conn *ct)
25{ 25{
26#ifdef CONFIG_NF_CONNTRACK_EVENTS
26 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); 27 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
28#else
29 return NULL;
30#endif
27} 31}
28 32
29static inline struct nf_conntrack_ecache * 33static inline struct nf_conntrack_ecache *
30nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) 34nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
31{ 35{
36#ifdef CONFIG_NF_CONNTRACK_EVENTS
32 struct net *net = nf_ct_net(ct); 37 struct net *net = nf_ct_net(ct);
33 struct nf_conntrack_ecache *e; 38 struct nf_conntrack_ecache *e;
34 39
@@ -45,6 +50,9 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
45 e->expmask = expmask; 50 e->expmask = expmask;
46 } 51 }
47 return e; 52 return e;
53#else
54 return NULL;
55#endif
48}; 56};
49 57
50#ifdef CONFIG_NF_CONNTRACK_EVENTS 58#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -59,7 +67,7 @@ struct nf_ct_event_notifier {
59 int (*fcn)(unsigned int events, struct nf_ct_event *item); 67 int (*fcn)(unsigned int events, struct nf_ct_event *item);
60}; 68};
61 69
62extern struct nf_ct_event_notifier *nf_conntrack_event_cb; 70extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
63extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); 71extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb);
64extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); 72extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb);
65 73
@@ -77,9 +85,6 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
77 if (e == NULL) 85 if (e == NULL)
78 return; 86 return;
79 87
80 if (!(e->ctmask & (1 << event)))
81 return;
82
83 set_bit(event, &e->cache); 88 set_bit(event, &e->cache);
84} 89}
85 90
@@ -159,7 +164,7 @@ struct nf_exp_event_notifier {
159 int (*fcn)(unsigned int events, struct nf_exp_event *item); 164 int (*fcn)(unsigned int events, struct nf_exp_event *item);
160}; 165};
161 166
162extern struct nf_exp_event_notifier *nf_expect_event_cb; 167extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
163extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); 168extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb);
164extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); 169extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb);
165 170
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 0772d296dfdb..2dcf31703acb 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -7,10 +7,19 @@
7 7
8enum nf_ct_ext_id { 8enum nf_ct_ext_id {
9 NF_CT_EXT_HELPER, 9 NF_CT_EXT_HELPER,
10#if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE)
10 NF_CT_EXT_NAT, 11 NF_CT_EXT_NAT,
12#endif
11 NF_CT_EXT_ACCT, 13 NF_CT_EXT_ACCT,
14#ifdef CONFIG_NF_CONNTRACK_EVENTS
12 NF_CT_EXT_ECACHE, 15 NF_CT_EXT_ECACHE,
16#endif
17#ifdef CONFIG_NF_CONNTRACK_ZONES
13 NF_CT_EXT_ZONE, 18 NF_CT_EXT_ZONE,
19#endif
20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
21 NF_CT_EXT_TSTAMP,
22#endif
14 NF_CT_EXT_NUM, 23 NF_CT_EXT_NUM,
15}; 24};
16 25
@@ -19,6 +28,7 @@ enum nf_ct_ext_id {
19#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 28#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
20#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 29#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
21#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 30#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
31#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
22 32
23/* Extensions: optional stuff which isn't permanently in struct. */ 33/* Extensions: optional stuff which isn't permanently in struct. */
24struct nf_ct_ext { 34struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 32c305dbdab6..f1c1311adc2c 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -63,4 +63,10 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
63extern int nf_conntrack_helper_init(void); 63extern int nf_conntrack_helper_init(void);
64extern void nf_conntrack_helper_fini(void); 64extern void nf_conntrack_helper_fini(void);
65 65
66extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
67 unsigned int protoff,
68 struct nf_conn *ct,
69 enum ip_conntrack_info ctinfo,
70 unsigned int timeout);
71
66#endif /*_NF_CONNTRACK_HELPER_H*/ 72#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index a7547611e8f1..e8010f445ae1 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -73,7 +73,7 @@ struct nf_conntrack_l3proto {
73 struct module *me; 73 struct module *me;
74}; 74};
75 75
76extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; 76extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
77 77
78/* Protocol registration. */ 78/* Protocol registration. */
79extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 79extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
new file mode 100644
index 000000000000..fc9c82b1f06b
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -0,0 +1,65 @@
1#ifndef _NF_CONNTRACK_TSTAMP_H
2#define _NF_CONNTRACK_TSTAMP_H
3
4#include <net/net_namespace.h>
5#include <linux/netfilter/nf_conntrack_common.h>
6#include <linux/netfilter/nf_conntrack_tuple_common.h>
7#include <net/netfilter/nf_conntrack.h>
8#include <net/netfilter/nf_conntrack_extend.h>
9
10struct nf_conn_tstamp {
11 u_int64_t start;
12 u_int64_t stop;
13};
14
15static inline
16struct nf_conn_tstamp *nf_conn_tstamp_find(const struct nf_conn *ct)
17{
18#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
19 return nf_ct_ext_find(ct, NF_CT_EXT_TSTAMP);
20#else
21 return NULL;
22#endif
23}
24
25static inline
26struct nf_conn_tstamp *nf_ct_tstamp_ext_add(struct nf_conn *ct, gfp_t gfp)
27{
28#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
29 struct net *net = nf_ct_net(ct);
30
31 if (!net->ct.sysctl_tstamp)
32 return NULL;
33
34 return nf_ct_ext_add(ct, NF_CT_EXT_TSTAMP, gfp);
35#else
36 return NULL;
37#endif
38};
39
40static inline bool nf_ct_tstamp_enabled(struct net *net)
41{
42 return net->ct.sysctl_tstamp != 0;
43}
44
45static inline void nf_ct_set_tstamp(struct net *net, bool enable)
46{
47 net->ct.sysctl_tstamp = enable;
48}
49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_init(struct net *net);
52extern void nf_conntrack_tstamp_fini(struct net *net);
53#else
54static inline int nf_conntrack_tstamp_init(struct net *net)
55{
56 return 0;
57}
58
59static inline void nf_conntrack_tstamp_fini(struct net *net)
60{
61 return;
62}
63#endif /* CONFIG_NF_CONNTRACK_TIMESTAMP */
64
65#endif /* _NF_CONNTRACK_TSTAMP_H */
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index f5f09f032a90..aff80b190c12 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -56,7 +56,9 @@ struct nf_nat_multi_range_compat {
56/* per conntrack: nat application helper private data */ 56/* per conntrack: nat application helper private data */
57union nf_conntrack_nat_help { 57union nf_conntrack_nat_help {
58 /* insert nat helper private data here */ 58 /* insert nat helper private data here */
59#if defined(CONFIG_NF_NAT_PPTP) || defined(CONFIG_NF_NAT_PPTP_MODULE)
59 struct nf_nat_pptp nat_pptp_info; 60 struct nf_nat_pptp nat_pptp_info;
61#endif
60}; 62};
61 63
62struct nf_conn; 64struct nf_conn;
@@ -84,7 +86,11 @@ extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
84 86
85static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) 87static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
86{ 88{
89#if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE)
87 return nf_ct_ext_find(ct, NF_CT_EXT_NAT); 90 return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
91#else
92 return NULL;
93#endif
88} 94}
89 95
90#else /* !__KERNEL__: iptables wants this to compile. */ 96#else /* !__KERNEL__: iptables wants this to compile. */
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 33602ab66190..3dc7b98effeb 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 21 enum nf_nat_manip_type manip)
22{ 22{
23 if (manip == IP_NAT_MANIP_SRC) 23 if (manip == IP_NAT_MANIP_SRC)
24 return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); 24 return ct->status & IPS_SRC_NAT_DONE;
25 else 25 else
26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); 26 return ct->status & IPS_DST_NAT_DONE;
27} 27}
28 28
29struct nlattr; 29struct nlattr;
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index cd85b3bc8327..e505358d8999 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -201,18 +201,8 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
201} 201}
202#endif 202#endif
203 203
204static inline void
205nf_tproxy_put_sock(struct sock *sk)
206{
207 /* TIME_WAIT inet sockets have to be handled differently */
208 if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT))
209 inet_twsk_put(inet_twsk(sk));
210 else
211 sock_put(sk);
212}
213
214/* assign a socket to the skb -- consumes sk */ 204/* assign a socket to the skb -- consumes sk */
215int 205void
216nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); 206nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk);
217 207
218#endif 208#endif
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 373f1a900cf4..8a3906a08f5f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -856,18 +856,27 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
856#define NLA_PUT_BE16(skb, attrtype, value) \ 856#define NLA_PUT_BE16(skb, attrtype, value) \
857 NLA_PUT_TYPE(skb, __be16, attrtype, value) 857 NLA_PUT_TYPE(skb, __be16, attrtype, value)
858 858
859#define NLA_PUT_NET16(skb, attrtype, value) \
860 NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
861
859#define NLA_PUT_U32(skb, attrtype, value) \ 862#define NLA_PUT_U32(skb, attrtype, value) \
860 NLA_PUT_TYPE(skb, u32, attrtype, value) 863 NLA_PUT_TYPE(skb, u32, attrtype, value)
861 864
862#define NLA_PUT_BE32(skb, attrtype, value) \ 865#define NLA_PUT_BE32(skb, attrtype, value) \
863 NLA_PUT_TYPE(skb, __be32, attrtype, value) 866 NLA_PUT_TYPE(skb, __be32, attrtype, value)
864 867
868#define NLA_PUT_NET32(skb, attrtype, value) \
869 NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
870
865#define NLA_PUT_U64(skb, attrtype, value) \ 871#define NLA_PUT_U64(skb, attrtype, value) \
866 NLA_PUT_TYPE(skb, u64, attrtype, value) 872 NLA_PUT_TYPE(skb, u64, attrtype, value)
867 873
868#define NLA_PUT_BE64(skb, attrtype, value) \ 874#define NLA_PUT_BE64(skb, attrtype, value) \
869 NLA_PUT_TYPE(skb, __be64, attrtype, value) 875 NLA_PUT_TYPE(skb, __be64, attrtype, value)
870 876
877#define NLA_PUT_NET64(skb, attrtype, value) \
878 NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
879
871#define NLA_PUT_STRING(skb, attrtype, value) \ 880#define NLA_PUT_STRING(skb, attrtype, value) \
872 NLA_PUT(skb, attrtype, strlen(value) + 1, value) 881 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
873 882
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index d4958d4c6574..341eb089349e 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -21,15 +21,15 @@ struct netns_ct {
21 int sysctl_events; 21 int sysctl_events;
22 unsigned int sysctl_events_retry_timeout; 22 unsigned int sysctl_events_retry_timeout;
23 int sysctl_acct; 23 int sysctl_acct;
24 int sysctl_tstamp;
24 int sysctl_checksum; 25 int sysctl_checksum;
25 unsigned int sysctl_log_invalid; /* Log invalid packets */ 26 unsigned int sysctl_log_invalid; /* Log invalid packets */
26#ifdef CONFIG_SYSCTL 27#ifdef CONFIG_SYSCTL
27 struct ctl_table_header *sysctl_header; 28 struct ctl_table_header *sysctl_header;
28 struct ctl_table_header *acct_sysctl_header; 29 struct ctl_table_header *acct_sysctl_header;
30 struct ctl_table_header *tstamp_sysctl_header;
29 struct ctl_table_header *event_sysctl_header; 31 struct ctl_table_header *event_sysctl_header;
30#endif 32#endif
31 int hash_vmalloc;
32 int expect_vmalloc;
33 char *slabname; 33 char *slabname;
34}; 34};
35#endif 35#endif
diff --git a/include/net/netns/ip_vs.h b/include/net/netns/ip_vs.h
new file mode 100644
index 000000000000..259ebac904bf
--- /dev/null
+++ b/include/net/netns/ip_vs.h
@@ -0,0 +1,143 @@
1/*
2 * IP Virtual Server
3 * Data structure for network namspace
4 *
5 */
6
7#ifndef IP_VS_H_
8#define IP_VS_H_
9
10#include <linux/list.h>
11#include <linux/mutex.h>
12#include <linux/list_nulls.h>
13#include <linux/ip_vs.h>
14#include <asm/atomic.h>
15#include <linux/in.h>
16
17struct ip_vs_stats;
18struct ip_vs_sync_buff;
19struct ctl_table_header;
20
21struct netns_ipvs {
22 int gen; /* Generation */
23 /*
24 * Hash table: for real service lookups
25 */
26 #define IP_VS_RTAB_BITS 4
27 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
28 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
29
30 struct list_head rs_table[IP_VS_RTAB_SIZE];
31 /* ip_vs_app */
32 struct list_head app_list;
33 struct mutex app_mutex;
34 struct lock_class_key app_key; /* mutex debuging */
35
36 /* ip_vs_proto */
37 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
38 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
39 /* ip_vs_proto_tcp */
40#ifdef CONFIG_IP_VS_PROTO_TCP
41 #define TCP_APP_TAB_BITS 4
42 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
43 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
44 struct list_head tcp_apps[TCP_APP_TAB_SIZE];
45 spinlock_t tcp_app_lock;
46#endif
47 /* ip_vs_proto_udp */
48#ifdef CONFIG_IP_VS_PROTO_UDP
49 #define UDP_APP_TAB_BITS 4
50 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
51 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
52 struct list_head udp_apps[UDP_APP_TAB_SIZE];
53 spinlock_t udp_app_lock;
54#endif
55 /* ip_vs_proto_sctp */
56#ifdef CONFIG_IP_VS_PROTO_SCTP
57 #define SCTP_APP_TAB_BITS 4
58 #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
59 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
60 /* Hash table for SCTP application incarnations */
61 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
62 spinlock_t sctp_app_lock;
63#endif
64 /* ip_vs_conn */
65 atomic_t conn_count; /* connection counter */
66
67 /* ip_vs_ctl */
68 struct ip_vs_stats *tot_stats; /* Statistics & est. */
69 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
70 seqcount_t *ustats_seq; /* u64 read retry */
71
72 int num_services; /* no of virtual services */
73 /* 1/rate drop and drop-entry variables */
74 struct delayed_work defense_work; /* Work handler */
75 int drop_rate;
76 int drop_counter;
77 atomic_t dropentry;
78 /* locks in ctl.c */
79 spinlock_t dropentry_lock; /* drop entry handling */
80 spinlock_t droppacket_lock; /* drop packet handling */
81 spinlock_t securetcp_lock; /* state and timeout tables */
82 rwlock_t rs_lock; /* real services table */
83 /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
84 struct lock_class_key ctl_key; /* ctl_mutex debuging */
85 /* Trash for destinations */
86 struct list_head dest_trash;
87 /* Service counters */
88 atomic_t ftpsvc_counter;
89 atomic_t nullsvc_counter;
90
91 /* sys-ctl struct */
92 struct ctl_table_header *sysctl_hdr;
93 struct ctl_table *sysctl_tbl;
94 /* sysctl variables */
95 int sysctl_amemthresh;
96 int sysctl_am_droprate;
97 int sysctl_drop_entry;
98 int sysctl_drop_packet;
99 int sysctl_secure_tcp;
100#ifdef CONFIG_IP_VS_NFCT
101 int sysctl_conntrack;
102#endif
103 int sysctl_snat_reroute;
104 int sysctl_sync_ver;
105 int sysctl_cache_bypass;
106 int sysctl_expire_nodest_conn;
107 int sysctl_expire_quiescent_template;
108 int sysctl_sync_threshold[2];
109 int sysctl_nat_icmp_send;
110
111 /* ip_vs_lblc */
112 int sysctl_lblc_expiration;
113 struct ctl_table_header *lblc_ctl_header;
114 struct ctl_table *lblc_ctl_table;
115 /* ip_vs_lblcr */
116 int sysctl_lblcr_expiration;
117 struct ctl_table_header *lblcr_ctl_header;
118 struct ctl_table *lblcr_ctl_table;
119 /* ip_vs_est */
120 struct list_head est_list; /* estimator list */
121 spinlock_t est_lock;
122 struct timer_list est_timer; /* Estimation timer */
123 /* ip_vs_sync */
124 struct list_head sync_queue;
125 spinlock_t sync_lock;
126 struct ip_vs_sync_buff *sync_buff;
127 spinlock_t sync_buff_lock;
128 struct sockaddr_in sync_mcast_addr;
129 struct task_struct *master_thread;
130 struct task_struct *backup_thread;
131 int send_mesg_maxlen;
132 int recv_mesg_maxlen;
133 volatile int sync_state;
134 volatile int master_syncid;
135 volatile int backup_syncid;
136 /* multicast interface name */
137 char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
138 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
139 /* net name space ptr */
140 struct net *net; /* Needed by timer routines */
141};
142
143#endif /* IP_VS_H_ */
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index d68c3f121774..e2e2ef57eca2 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -43,7 +43,6 @@ struct netns_ipv4 {
43 struct xt_table *nat_table; 43 struct xt_table *nat_table;
44 struct hlist_head *nat_bysource; 44 struct hlist_head *nat_bysource;
45 unsigned int nat_htable_size; 45 unsigned int nat_htable_size;
46 int nat_vmalloced;
47#endif 46#endif
48 47
49 int sysctl_icmp_echo_ignore_all; 48 int sysctl_icmp_echo_ignore_all;
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index b60b28c99e87..b669fe6dbc3b 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -28,7 +28,6 @@ struct pep_sock {
28 28
29 /* XXX: union-ify listening vs connected stuff ? */ 29 /* XXX: union-ify listening vs connected stuff ? */
30 /* Listening socket stuff: */ 30 /* Listening socket stuff: */
31 struct hlist_head ackq;
32 struct hlist_head hlist; 31 struct hlist_head hlist;
33 32
34 /* Connected socket stuff: */ 33 /* Connected socket stuff: */
@@ -45,10 +44,6 @@ struct pep_sock {
45 u8 tx_fc; /* TX flow control */ 44 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 45 u8 init_enable; /* auto-enable at creation */
47 u8 aligned; 46 u8 aligned;
48#ifdef CONFIG_PHONET_PIPECTRLR
49 u8 pipe_state;
50 struct sockaddr_pn remote_pep;
51#endif
52}; 47};
53 48
54static inline struct pep_sock *pep_sk(struct sock *sk) 49static inline struct pep_sock *pep_sk(struct sock *sk)
@@ -158,6 +153,7 @@ enum {
158 PN_LEGACY_FLOW_CONTROL, 153 PN_LEGACY_FLOW_CONTROL,
159 PN_ONE_CREDIT_FLOW_CONTROL, 154 PN_ONE_CREDIT_FLOW_CONTROL,
160 PN_MULTI_CREDIT_FLOW_CONTROL, 155 PN_MULTI_CREDIT_FLOW_CONTROL,
156 PN_MAX_FLOW_CONTROL,
161}; 157};
162 158
163#define pn_flow_safe(fc) ((fc) >> 1) 159#define pn_flow_safe(fc) ((fc) >> 1)
@@ -169,21 +165,4 @@ enum {
169 PEP_IND_READY, 165 PEP_IND_READY,
170}; 166};
171 167
172#ifdef CONFIG_PHONET_PIPECTRLR
173#define PNS_PEP_CONNECT_UTID 0x02
174#define PNS_PIPE_CREATED_IND_UTID 0x04
175#define PNS_PIPE_ENABLE_UTID 0x0A
176#define PNS_PIPE_ENABLED_IND_UTID 0x0C
177#define PNS_PIPE_DISABLE_UTID 0x0F
178#define PNS_PIPE_DISABLED_IND_UTID 0x11
179#define PNS_PEP_DISCONNECT_UTID 0x06
180
181/* Used for tracking state of a pipe */
182enum {
183 PIPE_IDLE,
184 PIPE_DISABLED,
185 PIPE_ENABLED,
186};
187#endif /* CONFIG_PHONET_PIPECTRLR */
188
189#endif 168#endif
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 5395e09187df..68e509750caa 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -36,6 +36,7 @@
36struct pn_sock { 36struct pn_sock {
37 struct sock sk; 37 struct sock sk;
38 u16 sobject; 38 u16 sobject;
39 u16 dobject;
39 u8 resource; 40 u8 resource;
40}; 41};
41 42
diff --git a/include/net/protocol.h b/include/net/protocol.h
index dc07495bce4c..6f7eb800974a 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -38,7 +38,7 @@ struct net_protocol {
38 void (*err_handler)(struct sk_buff *skb, u32 info); 38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 int (*gso_send_check)(struct sk_buff *skb); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features); 41 u32 features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head, 42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb); 43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb); 44 int (*gro_complete)(struct sk_buff *skb);
@@ -57,7 +57,7 @@ struct inet6_protocol {
57 57
58 int (*gso_send_check)(struct sk_buff *skb); 58 int (*gso_send_check)(struct sk_buff *skb);
59 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 59 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
60 int features); 60 u32 features);
61 struct sk_buff **(*gro_receive)(struct sk_buff **head, 61 struct sk_buff **(*gro_receive)(struct sk_buff **head,
62 struct sk_buff *skb); 62 struct sk_buff *skb);
63 int (*gro_complete)(struct sk_buff *skb); 63 int (*gro_complete)(struct sk_buff *skb);
diff --git a/include/net/route.h b/include/net/route.h
index 93e10c453f6b..30d6cae3841a 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -49,36 +49,43 @@
49 49
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct fib_info;
52struct rtable { 53struct rtable {
53 struct dst_entry dst; 54 struct dst_entry dst;
54 55
55 /* Cache lookup keys */ 56 /* Lookup key. */
56 struct flowi fl; 57 __be32 rt_key_dst;
58 __be32 rt_key_src;
57 59
58 int rt_genid; 60 int rt_genid;
59 unsigned rt_flags; 61 unsigned rt_flags;
60 __u16 rt_type; 62 __u16 rt_type;
63 __u8 rt_tos;
61 64
62 __be32 rt_dst; /* Path destination */ 65 __be32 rt_dst; /* Path destination */
63 __be32 rt_src; /* Path source */ 66 __be32 rt_src; /* Path source */
64 int rt_iif; 67 int rt_iif;
68 int rt_oif;
69 __u32 rt_mark;
65 70
66 /* Info on neighbour */ 71 /* Info on neighbour */
67 __be32 rt_gateway; 72 __be32 rt_gateway;
68 73
69 /* Miscellaneous cached information */ 74 /* Miscellaneous cached information */
70 __be32 rt_spec_dst; /* RFC1122 specific destination */ 75 __be32 rt_spec_dst; /* RFC1122 specific destination */
76 u32 rt_peer_genid;
71 struct inet_peer *peer; /* long-living peer info */ 77 struct inet_peer *peer; /* long-living peer info */
78 struct fib_info *fi; /* for client ref to shared metrics */
72}; 79};
73 80
74static inline bool rt_is_input_route(struct rtable *rt) 81static inline bool rt_is_input_route(struct rtable *rt)
75{ 82{
76 return rt->fl.iif != 0; 83 return rt->rt_iif != 0;
77} 84}
78 85
79static inline bool rt_is_output_route(struct rtable *rt) 86static inline bool rt_is_output_route(struct rtable *rt)
80{ 87{
81 return rt->fl.iif == 0; 88 return rt->rt_iif == 0;
82} 89}
83 90
84struct ip_rt_acct { 91struct ip_rt_acct {
@@ -115,9 +122,63 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
115 __be32 src, struct net_device *dev); 122 __be32 src, struct net_device *dev);
116extern void rt_cache_flush(struct net *net, int how); 123extern void rt_cache_flush(struct net *net, int how);
117extern void rt_cache_flush_batch(struct net *net); 124extern void rt_cache_flush_batch(struct net *net);
118extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 125extern struct rtable *__ip_route_output_key(struct net *, const struct flowi4 *flp);
119extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 126extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
120extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 127 struct sock *sk);
128extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig);
129
130static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp)
131{
132 return ip_route_output_flow(net, flp, NULL);
133}
134
135static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
136 __be32 saddr, u8 tos, int oif)
137{
138 struct flowi4 fl4 = {
139 .flowi4_oif = oif,
140 .daddr = daddr,
141 .saddr = saddr,
142 .flowi4_tos = tos,
143 };
144 return ip_route_output_key(net, &fl4);
145}
146
147static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk,
148 __be32 daddr, __be32 saddr,
149 __be16 dport, __be16 sport,
150 __u8 proto, __u8 tos, int oif)
151{
152 struct flowi4 fl4 = {
153 .flowi4_oif = oif,
154 .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0,
155 .flowi4_mark = sk ? sk->sk_mark : 0,
156 .daddr = daddr,
157 .saddr = saddr,
158 .flowi4_tos = tos,
159 .flowi4_proto = proto,
160 .fl4_dport = dport,
161 .fl4_sport = sport,
162 };
163 if (sk)
164 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
165 return ip_route_output_flow(net, &fl4, sk);
166}
167
168static inline struct rtable *ip_route_output_gre(struct net *net,
169 __be32 daddr, __be32 saddr,
170 __be32 gre_key, __u8 tos, int oif)
171{
172 struct flowi4 fl4 = {
173 .flowi4_oif = oif,
174 .daddr = daddr,
175 .saddr = saddr,
176 .flowi4_tos = tos,
177 .flowi4_proto = IPPROTO_GRE,
178 .fl4_gre_key = gre_key,
179 };
180 return ip_route_output_key(net, &fl4);
181}
121 182
122extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, 183extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
123 u8 tos, struct net_device *devin, bool noref); 184 u8 tos, struct net_device *devin, bool noref);
@@ -162,57 +223,68 @@ static inline char rt_tos2priority(u8 tos)
162 return ip_tos2prio[IPTOS_TOS(tos)>>1]; 223 return ip_tos2prio[IPTOS_TOS(tos)>>1];
163} 224}
164 225
165static inline int ip_route_connect(struct rtable **rp, __be32 dst, 226static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
166 __be32 src, u32 tos, int oif, u8 protocol, 227 int oif, u8 protocol,
167 __be16 sport, __be16 dport, struct sock *sk, 228 __be16 sport, __be16 dport,
168 int flags) 229 struct sock *sk, bool can_sleep)
169{ 230{
170 struct flowi fl = { .oif = oif, 231 struct flowi4 fl4 = {
171 .mark = sk->sk_mark, 232 .flowi4_oif = oif,
172 .fl4_dst = dst, 233 .flowi4_mark = sk->sk_mark,
173 .fl4_src = src, 234 .daddr = dst,
174 .fl4_tos = tos, 235 .saddr = src,
175 .proto = protocol, 236 .flowi4_tos = tos,
176 .fl_ip_sport = sport, 237 .flowi4_proto = protocol,
177 .fl_ip_dport = dport }; 238 .fl4_sport = sport,
178 int err; 239 .fl4_dport = dport,
240 };
179 struct net *net = sock_net(sk); 241 struct net *net = sock_net(sk);
242 struct rtable *rt;
180 243
181 if (inet_sk(sk)->transparent) 244 if (inet_sk(sk)->transparent)
182 fl.flags |= FLOWI_FLAG_ANYSRC; 245 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
246 if (protocol == IPPROTO_TCP)
247 fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS;
248 if (can_sleep)
249 fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP;
183 250
184 if (!dst || !src) { 251 if (!dst || !src) {
185 err = __ip_route_output_key(net, rp, &fl); 252 rt = __ip_route_output_key(net, &fl4);
186 if (err) 253 if (IS_ERR(rt))
187 return err; 254 return rt;
188 fl.fl4_dst = (*rp)->rt_dst; 255 fl4.daddr = rt->rt_dst;
189 fl.fl4_src = (*rp)->rt_src; 256 fl4.saddr = rt->rt_src;
190 ip_rt_put(*rp); 257 ip_rt_put(rt);
191 *rp = NULL;
192 } 258 }
193 security_sk_classify_flow(sk, &fl); 259 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
194 return ip_route_output_flow(net, rp, &fl, sk, flags); 260 return ip_route_output_flow(net, &fl4, sk);
195} 261}
196 262
197static inline int ip_route_newports(struct rtable **rp, u8 protocol, 263static inline struct rtable *ip_route_newports(struct rtable *rt,
198 __be16 sport, __be16 dport, struct sock *sk) 264 u8 protocol, __be16 orig_sport,
265 __be16 orig_dport, __be16 sport,
266 __be16 dport, struct sock *sk)
199{ 267{
200 if (sport != (*rp)->fl.fl_ip_sport || 268 if (sport != orig_sport || dport != orig_dport) {
201 dport != (*rp)->fl.fl_ip_dport) { 269 struct flowi4 fl4 = {
202 struct flowi fl; 270 .flowi4_oif = rt->rt_oif,
203 271 .flowi4_mark = rt->rt_mark,
204 memcpy(&fl, &(*rp)->fl, sizeof(fl)); 272 .daddr = rt->rt_key_dst,
205 fl.fl_ip_sport = sport; 273 .saddr = rt->rt_key_src,
206 fl.fl_ip_dport = dport; 274 .flowi4_tos = rt->rt_tos,
207 fl.proto = protocol; 275 .flowi4_proto = protocol,
276 .fl4_sport = sport,
277 .fl4_dport = dport
278 };
208 if (inet_sk(sk)->transparent) 279 if (inet_sk(sk)->transparent)
209 fl.flags |= FLOWI_FLAG_ANYSRC; 280 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
210 ip_rt_put(*rp); 281 if (protocol == IPPROTO_TCP)
211 *rp = NULL; 282 fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS;
212 security_sk_classify_flow(sk, &fl); 283 ip_rt_put(rt);
213 return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0); 284 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
285 return ip_route_output_flow(sock_net(sk), &fl4, sk);
214 } 286 }
215 return 0; 287 return rt;
216} 288}
217 289
218extern void rt_bind_peer(struct rtable *rt, int create); 290extern void rt_bind_peer(struct rtable *rt, int create);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e9eee99d8b1f..a9505b6a18e3 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -31,10 +31,12 @@ enum qdisc_state_t {
31 * following bits are only changed while qdisc lock is held 31 * following bits are only changed while qdisc lock is held
32 */ 32 */
33enum qdisc___state_t { 33enum qdisc___state_t {
34 __QDISC___STATE_RUNNING, 34 __QDISC___STATE_RUNNING = 1,
35 __QDISC___STATE_THROTTLED = 2,
35}; 36};
36 37
37struct qdisc_size_table { 38struct qdisc_size_table {
39 struct rcu_head rcu;
38 struct list_head list; 40 struct list_head list;
39 struct tc_sizespec szopts; 41 struct tc_sizespec szopts;
40 int refcnt; 42 int refcnt;
@@ -46,14 +48,13 @@ struct Qdisc {
46 struct sk_buff * (*dequeue)(struct Qdisc *dev); 48 struct sk_buff * (*dequeue)(struct Qdisc *dev);
47 unsigned flags; 49 unsigned flags;
48#define TCQ_F_BUILTIN 1 50#define TCQ_F_BUILTIN 1
49#define TCQ_F_THROTTLED 2 51#define TCQ_F_INGRESS 2
50#define TCQ_F_INGRESS 4 52#define TCQ_F_CAN_BYPASS 4
51#define TCQ_F_CAN_BYPASS 8 53#define TCQ_F_MQROOT 8
52#define TCQ_F_MQROOT 16
53#define TCQ_F_WARN_NONWC (1 << 16) 54#define TCQ_F_WARN_NONWC (1 << 16)
54 int padded; 55 int padded;
55 struct Qdisc_ops *ops; 56 struct Qdisc_ops *ops;
56 struct qdisc_size_table *stab; 57 struct qdisc_size_table __rcu *stab;
57 struct list_head list; 58 struct list_head list;
58 u32 handle; 59 u32 handle;
59 u32 parent; 60 u32 parent;
@@ -78,25 +79,44 @@ struct Qdisc {
78 unsigned long state; 79 unsigned long state;
79 struct sk_buff_head q; 80 struct sk_buff_head q;
80 struct gnet_stats_basic_packed bstats; 81 struct gnet_stats_basic_packed bstats;
81 unsigned long __state; 82 unsigned int __state;
82 struct gnet_stats_queue qstats; 83 struct gnet_stats_queue qstats;
83 struct rcu_head rcu_head; 84 struct rcu_head rcu_head;
84 spinlock_t busylock; 85 spinlock_t busylock;
86 u32 limit;
85}; 87};
86 88
87static inline bool qdisc_is_running(struct Qdisc *qdisc) 89static inline bool qdisc_is_running(const struct Qdisc *qdisc)
88{ 90{
89 return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 91 return (qdisc->__state & __QDISC___STATE_RUNNING) ? true : false;
90} 92}
91 93
92static inline bool qdisc_run_begin(struct Qdisc *qdisc) 94static inline bool qdisc_run_begin(struct Qdisc *qdisc)
93{ 95{
94 return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 96 if (qdisc_is_running(qdisc))
97 return false;
98 qdisc->__state |= __QDISC___STATE_RUNNING;
99 return true;
95} 100}
96 101
97static inline void qdisc_run_end(struct Qdisc *qdisc) 102static inline void qdisc_run_end(struct Qdisc *qdisc)
98{ 103{
99 __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 104 qdisc->__state &= ~__QDISC___STATE_RUNNING;
105}
106
107static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
108{
109 return (qdisc->__state & __QDISC___STATE_THROTTLED) ? true : false;
110}
111
112static inline void qdisc_throttled(struct Qdisc *qdisc)
113{
114 qdisc->__state |= __QDISC___STATE_THROTTLED;
115}
116
117static inline void qdisc_unthrottled(struct Qdisc *qdisc)
118{
119 qdisc->__state &= ~__QDISC___STATE_THROTTLED;
100} 120}
101 121
102struct Qdisc_class_ops { 122struct Qdisc_class_ops {
@@ -199,7 +219,7 @@ struct tcf_proto {
199 219
200struct qdisc_skb_cb { 220struct qdisc_skb_cb {
201 unsigned int pkt_len; 221 unsigned int pkt_len;
202 char data[]; 222 long data[];
203}; 223};
204 224
205static inline int qdisc_qlen(struct Qdisc *q) 225static inline int qdisc_qlen(struct Qdisc *q)
@@ -331,8 +351,8 @@ extern struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
331 struct Qdisc_ops *ops); 351 struct Qdisc_ops *ops);
332extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, 352extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
333 struct Qdisc_ops *ops, u32 parentid); 353 struct Qdisc_ops *ops, u32 parentid);
334extern void qdisc_calculate_pkt_len(struct sk_buff *skb, 354extern void __qdisc_calculate_pkt_len(struct sk_buff *skb,
335 struct qdisc_size_table *stab); 355 const struct qdisc_size_table *stab);
336extern void tcf_destroy(struct tcf_proto *tp); 356extern void tcf_destroy(struct tcf_proto *tp);
337extern void tcf_destroy_chain(struct tcf_proto **fl); 357extern void tcf_destroy_chain(struct tcf_proto **fl);
338 358
@@ -411,12 +431,20 @@ enum net_xmit_qdisc_t {
411#define net_xmit_drop_count(e) (1) 431#define net_xmit_drop_count(e) (1)
412#endif 432#endif
413 433
414static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) 434static inline void qdisc_calculate_pkt_len(struct sk_buff *skb,
435 const struct Qdisc *sch)
415{ 436{
416#ifdef CONFIG_NET_SCHED 437#ifdef CONFIG_NET_SCHED
417 if (sch->stab) 438 struct qdisc_size_table *stab = rcu_dereference_bh(sch->stab);
418 qdisc_calculate_pkt_len(skb, sch->stab); 439
440 if (stab)
441 __qdisc_calculate_pkt_len(skb, stab);
419#endif 442#endif
443}
444
445static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
446{
447 qdisc_calculate_pkt_len(skb, sch);
420 return sch->enqueue(skb, sch); 448 return sch->enqueue(skb, sch);
421} 449}
422 450
@@ -445,7 +473,6 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
445{ 473{
446 __skb_queue_tail(list, skb); 474 __skb_queue_tail(list, skb);
447 sch->qstats.backlog += qdisc_pkt_len(skb); 475 sch->qstats.backlog += qdisc_pkt_len(skb);
448 qdisc_bstats_update(sch, skb);
449 476
450 return NET_XMIT_SUCCESS; 477 return NET_XMIT_SUCCESS;
451} 478}
@@ -460,8 +487,10 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
460{ 487{
461 struct sk_buff *skb = __skb_dequeue(list); 488 struct sk_buff *skb = __skb_dequeue(list);
462 489
463 if (likely(skb != NULL)) 490 if (likely(skb != NULL)) {
464 sch->qstats.backlog -= qdisc_pkt_len(skb); 491 sch->qstats.backlog -= qdisc_pkt_len(skb);
492 qdisc_bstats_update(sch, skb);
493 }
465 494
466 return skb; 495 return skb;
467} 496}
@@ -474,10 +503,11 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
474static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, 503static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
475 struct sk_buff_head *list) 504 struct sk_buff_head *list)
476{ 505{
477 struct sk_buff *skb = __qdisc_dequeue_head(sch, list); 506 struct sk_buff *skb = __skb_dequeue(list);
478 507
479 if (likely(skb != NULL)) { 508 if (likely(skb != NULL)) {
480 unsigned int len = qdisc_pkt_len(skb); 509 unsigned int len = qdisc_pkt_len(skb);
510 sch->qstats.backlog -= len;
481 kfree_skb(skb); 511 kfree_skb(skb);
482 return len; 512 return len;
483 } 513 }
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2a128c8c2718..e73ebdae323d 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -78,6 +78,7 @@ typedef __s32 sctp_assoc_t;
78#define SCTP_GET_PEER_ADDR_INFO 15 78#define SCTP_GET_PEER_ADDR_INFO 15
79#define SCTP_DELAYED_ACK_TIME 16 79#define SCTP_DELAYED_ACK_TIME 16
80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME 80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
81#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
81#define SCTP_CONTEXT 17 82#define SCTP_CONTEXT 17
82#define SCTP_FRAGMENT_INTERLEAVE 18 83#define SCTP_FRAGMENT_INTERLEAVE 18
83#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ 84#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
diff --git a/include/net/sock.h b/include/net/sock.h
index d884d268c704..da0534d3401c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -281,7 +281,7 @@ struct sock {
281 int sk_rcvbuf; 281 int sk_rcvbuf;
282 282
283 struct sk_filter __rcu *sk_filter; 283 struct sk_filter __rcu *sk_filter;
284 struct socket_wq *sk_wq; 284 struct socket_wq __rcu *sk_wq;
285 285
286#ifdef CONFIG_NET_DMA 286#ifdef CONFIG_NET_DMA
287 struct sk_buff_head sk_async_wait_queue; 287 struct sk_buff_head sk_async_wait_queue;
@@ -753,6 +753,8 @@ struct proto {
753 int level, 753 int level,
754 int optname, char __user *optval, 754 int optname, char __user *optval,
755 int __user *option); 755 int __user *option);
756 int (*compat_ioctl)(struct sock *sk,
757 unsigned int cmd, unsigned long arg);
756#endif 758#endif
757 int (*sendmsg)(struct kiocb *iocb, struct sock *sk, 759 int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
758 struct msghdr *msg, size_t len); 760 struct msghdr *msg, size_t len);
@@ -1189,7 +1191,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu);
1189static inline void sk_filter_release(struct sk_filter *fp) 1191static inline void sk_filter_release(struct sk_filter *fp)
1190{ 1192{
1191 if (atomic_dec_and_test(&fp->refcnt)) 1193 if (atomic_dec_and_test(&fp->refcnt))
1192 call_rcu_bh(&fp->rcu, sk_filter_release_rcu); 1194 call_rcu(&fp->rcu, sk_filter_release_rcu);
1193} 1195}
1194 1196
1195static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1197static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
@@ -1264,7 +1266,8 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1264 1266
1265static inline wait_queue_head_t *sk_sleep(struct sock *sk) 1267static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1266{ 1268{
1267 return &sk->sk_wq->wait; 1269 BUILD_BUG_ON(offsetof(struct socket_wq, wait) != 0);
1270 return &rcu_dereference_raw(sk->sk_wq)->wait;
1268} 1271}
1269/* Detach socket from process context. 1272/* Detach socket from process context.
1270 * Announce socket dead, detach it from wait queue and inode. 1273 * Announce socket dead, detach it from wait queue and inode.
@@ -1285,7 +1288,7 @@ static inline void sock_orphan(struct sock *sk)
1285static inline void sock_graft(struct sock *sk, struct socket *parent) 1288static inline void sock_graft(struct sock *sk, struct socket *parent)
1286{ 1289{
1287 write_lock_bh(&sk->sk_callback_lock); 1290 write_lock_bh(&sk->sk_callback_lock);
1288 rcu_assign_pointer(sk->sk_wq, parent->wq); 1291 sk->sk_wq = parent->wq;
1289 parent->sk = sk; 1292 parent->sk = sk;
1290 sk_set_socket(sk, parent); 1293 sk_set_socket(sk, parent);
1291 security_sock_graft(sk, parent); 1294 security_sock_graft(sk, parent);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 38509f047382..cda30ea354a2 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
196/* TCP thin-stream limits */ 196/* TCP thin-stream limits */
197#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ 197#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */
198 198
199/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */
200#define TCP_INIT_CWND 10
201
199extern struct inet_timewait_death_row tcp_death_row; 202extern struct inet_timewait_death_row tcp_death_row;
200 203
201/* sysctl variables for tcp */ 204/* sysctl variables for tcp */
@@ -799,15 +802,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
799/* Use define here intentionally to get WARN_ON location shown at the caller */ 802/* Use define here intentionally to get WARN_ON location shown at the caller */
800#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 803#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
801 804
802/*
803 * Convert RFC 3390 larger initial window into an equivalent number of packets.
804 * This is based on the numbers specified in RFC 5681, 3.1.
805 */
806static inline u32 rfc3390_bytes_to_packets(const u32 smss)
807{
808 return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3);
809}
810
811extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 805extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
812extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 806extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
813 807
@@ -1074,8 +1068,6 @@ static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1074 return 1; 1068 return 1;
1075} 1069}
1076 1070
1077#define TCP_CHECK_TIMER(sk) do { } while (0)
1078
1079static inline void tcp_mib_init(struct net *net) 1071static inline void tcp_mib_init(struct net *net)
1080{ 1072{
1081 /* See RFC 2012 */ 1073 /* See RFC 2012 */
@@ -1404,7 +1396,7 @@ extern struct request_sock_ops tcp6_request_sock_ops;
1404extern void tcp_v4_destroy_sock(struct sock *sk); 1396extern void tcp_v4_destroy_sock(struct sock *sk);
1405 1397
1406extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1398extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1407extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1399extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features);
1408extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1400extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1409 struct sk_buff *skb); 1401 struct sk_buff *skb);
1410extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, 1402extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 42a0eb68b7b6..eeb077dd735f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -14,7 +14,7 @@ extern struct proto udpv6_prot;
14extern struct proto udplitev6_prot; 14extern struct proto udplitev6_prot;
15extern struct proto tcpv6_prot; 15extern struct proto tcpv6_prot;
16 16
17struct flowi; 17struct flowi6;
18 18
19/* extention headers */ 19/* extention headers */
20extern int ipv6_exthdrs_init(void); 20extern int ipv6_exthdrs_init(void);
@@ -42,7 +42,7 @@ extern int datagram_recv_ctl(struct sock *sk,
42 42
43extern int datagram_send_ctl(struct net *net, 43extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg, 44 struct msghdr *msg,
45 struct flowi *fl, 45 struct flowi6 *fl6,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass, 47 int *hlimit, int *tclass,
48 int *dontfrag); 48 int *dontfrag);
diff --git a/include/net/udp.h b/include/net/udp.h
index bb967dd59bf7..67ea6fcb3ec0 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -144,6 +144,17 @@ static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
144 return csum; 144 return csum;
145} 145}
146 146
147static inline __wsum udp_csum(struct sk_buff *skb)
148{
149 __wsum csum = csum_partial(skb_transport_header(skb),
150 sizeof(struct udphdr), skb->csum);
151
152 for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next) {
153 csum = csum_add(csum, skb->csum);
154 }
155 return csum;
156}
157
147/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 158/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
148static inline void udp_lib_hash(struct sock *sk) 159static inline void udp_lib_hash(struct sock *sk)
149{ 160{
@@ -245,5 +256,5 @@ extern void udp4_proc_exit(void);
245extern void udp_init(void); 256extern void udp_init(void);
246 257
247extern int udp4_ufo_send_check(struct sk_buff *skb); 258extern int udp4_ufo_send_check(struct sk_buff *skb);
248extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features); 259extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features);
249#endif /* _UDP_H */ 260#endif /* _UDP_H */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index afdffe607b24..673a024c6b2a 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -115,6 +115,18 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
115 return csum; 115 return csum;
116} 116}
117 117
118static inline __wsum udplite_csum(struct sk_buff *skb)
119{
120 struct sock *sk = skb->sk;
121 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
122 const int off = skb_transport_offset(skb);
123 const int len = skb->len - off;
124
125 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
126
127 return skb_checksum(skb, off, min(cscov, len), 0);
128}
129
118extern void udplite4_register(void); 130extern void udplite4_register(void);
119extern int udplite_get_port(struct sock *sk, unsigned short snum, 131extern int udplite_get_port(struct sock *sk, unsigned short snum,
120 int (*scmp)(const struct sock *, const struct sock *)); 132 int (*scmp)(const struct sock *, const struct sock *));
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b9f385da758e..42a8c32a10e2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -36,6 +36,7 @@
36#define XFRM_PROTO_ROUTING IPPROTO_ROUTING 36#define XFRM_PROTO_ROUTING IPPROTO_ROUTING
37#define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS 37#define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS
38 38
39#define XFRM_ALIGN4(len) (((len) + 3) & ~3)
39#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 40#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
40#define MODULE_ALIAS_XFRM_MODE(family, encap) \ 41#define MODULE_ALIAS_XFRM_MODE(family, encap) \
41 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) 42 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap))
@@ -185,9 +186,14 @@ struct xfrm_state {
185 186
186 /* State for replay detection */ 187 /* State for replay detection */
187 struct xfrm_replay_state replay; 188 struct xfrm_replay_state replay;
189 struct xfrm_replay_state_esn *replay_esn;
188 190
189 /* Replay detection state at the time we sent the last notification */ 191 /* Replay detection state at the time we sent the last notification */
190 struct xfrm_replay_state preplay; 192 struct xfrm_replay_state preplay;
193 struct xfrm_replay_state_esn *preplay_esn;
194
195 /* The functions for replay detection. */
196 struct xfrm_replay *repl;
191 197
192 /* internal flag that only holds state for delayed aevent at the 198 /* internal flag that only holds state for delayed aevent at the
193 * moment 199 * moment
@@ -258,6 +264,15 @@ struct km_event {
258 struct net *net; 264 struct net *net;
259}; 265};
260 266
267struct xfrm_replay {
268 void (*advance)(struct xfrm_state *x, __be32 net_seq);
269 int (*check)(struct xfrm_state *x,
270 struct sk_buff *skb,
271 __be32 net_seq);
272 void (*notify)(struct xfrm_state *x, int event);
273 int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
274};
275
261struct net_device; 276struct net_device;
262struct xfrm_type; 277struct xfrm_type;
263struct xfrm_dst; 278struct xfrm_dst;
@@ -266,25 +281,26 @@ struct xfrm_policy_afinfo {
266 struct dst_ops *dst_ops; 281 struct dst_ops *dst_ops;
267 void (*garbage_collect)(struct net *net); 282 void (*garbage_collect)(struct net *net);
268 struct dst_entry *(*dst_lookup)(struct net *net, int tos, 283 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
269 xfrm_address_t *saddr, 284 const xfrm_address_t *saddr,
270 xfrm_address_t *daddr); 285 const xfrm_address_t *daddr);
271 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); 286 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
272 void (*decode_session)(struct sk_buff *skb, 287 void (*decode_session)(struct sk_buff *skb,
273 struct flowi *fl, 288 struct flowi *fl,
274 int reverse); 289 int reverse);
275 int (*get_tos)(struct flowi *fl); 290 int (*get_tos)(const struct flowi *fl);
276 int (*init_path)(struct xfrm_dst *path, 291 int (*init_path)(struct xfrm_dst *path,
277 struct dst_entry *dst, 292 struct dst_entry *dst,
278 int nfheader_len); 293 int nfheader_len);
279 int (*fill_dst)(struct xfrm_dst *xdst, 294 int (*fill_dst)(struct xfrm_dst *xdst,
280 struct net_device *dev, 295 struct net_device *dev,
281 struct flowi *fl); 296 const struct flowi *fl);
297 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig);
282}; 298};
283 299
284extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 300extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
285extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 301extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
286extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); 302extern void km_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c);
287extern void km_state_notify(struct xfrm_state *x, struct km_event *c); 303extern void km_state_notify(struct xfrm_state *x, const struct km_event *c);
288 304
289struct xfrm_tmpl; 305struct xfrm_tmpl;
290extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 306extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
@@ -299,9 +315,12 @@ struct xfrm_state_afinfo {
299 const struct xfrm_type *type_map[IPPROTO_MAX]; 315 const struct xfrm_type *type_map[IPPROTO_MAX];
300 struct xfrm_mode *mode_map[XFRM_MODE_MAX]; 316 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
301 int (*init_flags)(struct xfrm_state *x); 317 int (*init_flags)(struct xfrm_state *x);
302 void (*init_tempsel)(struct xfrm_selector *sel, struct flowi *fl); 318 void (*init_tempsel)(struct xfrm_selector *sel,
303 void (*init_temprop)(struct xfrm_state *x, struct xfrm_tmpl *tmpl, 319 const struct flowi *fl);
304 xfrm_address_t *daddr, xfrm_address_t *saddr); 320 void (*init_temprop)(struct xfrm_state *x,
321 const struct xfrm_tmpl *tmpl,
322 const xfrm_address_t *daddr,
323 const xfrm_address_t *saddr);
305 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 324 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
306 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 325 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
307 int (*output)(struct sk_buff *skb); 326 int (*output)(struct sk_buff *skb);
@@ -332,7 +351,8 @@ struct xfrm_type {
332 void (*destructor)(struct xfrm_state *); 351 void (*destructor)(struct xfrm_state *);
333 int (*input)(struct xfrm_state *, struct sk_buff *skb); 352 int (*input)(struct xfrm_state *, struct sk_buff *skb);
334 int (*output)(struct xfrm_state *, struct sk_buff *pskb); 353 int (*output)(struct xfrm_state *, struct sk_buff *pskb);
335 int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); 354 int (*reject)(struct xfrm_state *, struct sk_buff *,
355 const struct flowi *);
336 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); 356 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
337 /* Estimate maximal size of result of transformation of a dgram */ 357 /* Estimate maximal size of result of transformation of a dgram */
338 u32 (*get_mtu)(struct xfrm_state *, int size); 358 u32 (*get_mtu)(struct xfrm_state *, int size);
@@ -501,7 +521,7 @@ struct xfrm_policy {
501 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 521 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
502}; 522};
503 523
504static inline struct net *xp_net(struct xfrm_policy *xp) 524static inline struct net *xp_net(const struct xfrm_policy *xp)
505{ 525{
506 return read_pnet(&xp->xp_net); 526 return read_pnet(&xp->xp_net);
507} 527}
@@ -545,13 +565,17 @@ struct xfrm_migrate {
545struct xfrm_mgr { 565struct xfrm_mgr {
546 struct list_head list; 566 struct list_head list;
547 char *id; 567 char *id;
548 int (*notify)(struct xfrm_state *x, struct km_event *c); 568 int (*notify)(struct xfrm_state *x, const struct km_event *c);
549 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 569 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
550 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 570 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
551 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 571 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
552 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 572 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c);
553 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 573 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
554 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); 574 int (*migrate)(const struct xfrm_selector *sel,
575 u8 dir, u8 type,
576 const struct xfrm_migrate *m,
577 int num_bundles,
578 const struct xfrm_kmaddress *k);
555}; 579};
556 580
557extern int xfrm_register_km(struct xfrm_mgr *km); 581extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -570,8 +594,14 @@ struct xfrm_skb_cb {
570 594
571 /* Sequence number for replay protection. */ 595 /* Sequence number for replay protection. */
572 union { 596 union {
573 u64 output; 597 struct {
574 __be32 input; 598 __u32 low;
599 __u32 hi;
600 } output;
601 struct {
602 __be32 low;
603 __be32 hi;
604 } input;
575 } seq; 605 } seq;
576}; 606};
577 607
@@ -675,6 +705,8 @@ extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
675 u32 auid, u32 ses, u32 secid); 705 u32 auid, u32 ses, u32 secid);
676extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 706extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
677 struct sk_buff *skb); 707 struct sk_buff *skb);
708extern void xfrm_audit_state_replay(struct xfrm_state *x,
709 struct sk_buff *skb, __be32 net_seq);
678extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); 710extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family);
679extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, 711extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family,
680 __be32 net_spi, __be32 net_seq); 712 __be32 net_spi, __be32 net_seq);
@@ -707,6 +739,11 @@ static inline void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
707{ 739{
708} 740}
709 741
742static inline void xfrm_audit_state_replay(struct xfrm_state *x,
743 struct sk_buff *skb, __be32 net_seq)
744{
745}
746
710static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb, 747static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb,
711 u16 family) 748 u16 family)
712{ 749{
@@ -762,10 +799,11 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
762 atomic_inc(&x->refcnt); 799 atomic_inc(&x->refcnt);
763} 800}
764 801
765static __inline__ int addr_match(void *token1, void *token2, int prefixlen) 802static inline bool addr_match(const void *token1, const void *token2,
803 int prefixlen)
766{ 804{
767 __be32 *a1 = token1; 805 const __be32 *a1 = token1;
768 __be32 *a2 = token2; 806 const __be32 *a2 = token2;
769 int pdw; 807 int pdw;
770 int pbi; 808 int pbi;
771 809
@@ -774,7 +812,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
774 812
775 if (pdw) 813 if (pdw)
776 if (memcmp(a1, a2, pdw << 2)) 814 if (memcmp(a1, a2, pdw << 2))
777 return 0; 815 return false;
778 816
779 if (pbi) { 817 if (pbi) {
780 __be32 mask; 818 __be32 mask;
@@ -782,32 +820,32 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
782 mask = htonl((0xffffffff) << (32 - pbi)); 820 mask = htonl((0xffffffff) << (32 - pbi));
783 821
784 if ((a1[pdw] ^ a2[pdw]) & mask) 822 if ((a1[pdw] ^ a2[pdw]) & mask)
785 return 0; 823 return false;
786 } 824 }
787 825
788 return 1; 826 return true;
789} 827}
790 828
791static __inline__ 829static __inline__
792__be16 xfrm_flowi_sport(struct flowi *fl) 830__be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli)
793{ 831{
794 __be16 port; 832 __be16 port;
795 switch(fl->proto) { 833 switch(fl->flowi_proto) {
796 case IPPROTO_TCP: 834 case IPPROTO_TCP:
797 case IPPROTO_UDP: 835 case IPPROTO_UDP:
798 case IPPROTO_UDPLITE: 836 case IPPROTO_UDPLITE:
799 case IPPROTO_SCTP: 837 case IPPROTO_SCTP:
800 port = fl->fl_ip_sport; 838 port = uli->ports.sport;
801 break; 839 break;
802 case IPPROTO_ICMP: 840 case IPPROTO_ICMP:
803 case IPPROTO_ICMPV6: 841 case IPPROTO_ICMPV6:
804 port = htons(fl->fl_icmp_type); 842 port = htons(uli->icmpt.type);
805 break; 843 break;
806 case IPPROTO_MH: 844 case IPPROTO_MH:
807 port = htons(fl->fl_mh_type); 845 port = htons(uli->mht.type);
808 break; 846 break;
809 case IPPROTO_GRE: 847 case IPPROTO_GRE:
810 port = htons(ntohl(fl->fl_gre_key) >> 16); 848 port = htons(ntohl(uli->gre_key) >> 16);
811 break; 849 break;
812 default: 850 default:
813 port = 0; /*XXX*/ 851 port = 0; /*XXX*/
@@ -816,22 +854,22 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
816} 854}
817 855
818static __inline__ 856static __inline__
819__be16 xfrm_flowi_dport(struct flowi *fl) 857__be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
820{ 858{
821 __be16 port; 859 __be16 port;
822 switch(fl->proto) { 860 switch(fl->flowi_proto) {
823 case IPPROTO_TCP: 861 case IPPROTO_TCP:
824 case IPPROTO_UDP: 862 case IPPROTO_UDP:
825 case IPPROTO_UDPLITE: 863 case IPPROTO_UDPLITE:
826 case IPPROTO_SCTP: 864 case IPPROTO_SCTP:
827 port = fl->fl_ip_dport; 865 port = uli->ports.dport;
828 break; 866 break;
829 case IPPROTO_ICMP: 867 case IPPROTO_ICMP:
830 case IPPROTO_ICMPV6: 868 case IPPROTO_ICMPV6:
831 port = htons(fl->fl_icmp_code); 869 port = htons(uli->icmpt.code);
832 break; 870 break;
833 case IPPROTO_GRE: 871 case IPPROTO_GRE:
834 port = htons(ntohl(fl->fl_gre_key) & 0xffff); 872 port = htons(ntohl(uli->gre_key) & 0xffff);
835 break; 873 break;
836 default: 874 default:
837 port = 0; /*XXX*/ 875 port = 0; /*XXX*/
@@ -839,7 +877,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
839 return port; 877 return port;
840} 878}
841 879
842extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, 880extern int xfrm_selector_match(const struct xfrm_selector *sel,
881 const struct flowi *fl,
843 unsigned short family); 882 unsigned short family);
844 883
845#ifdef CONFIG_SECURITY_NETWORK_XFRM 884#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -947,7 +986,7 @@ secpath_reset(struct sk_buff *skb)
947} 986}
948 987
949static inline int 988static inline int
950xfrm_addr_any(xfrm_address_t *addr, unsigned short family) 989xfrm_addr_any(const xfrm_address_t *addr, unsigned short family)
951{ 990{
952 switch (family) { 991 switch (family) {
953 case AF_INET: 992 case AF_INET:
@@ -959,21 +998,21 @@ xfrm_addr_any(xfrm_address_t *addr, unsigned short family)
959} 998}
960 999
961static inline int 1000static inline int
962__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 1001__xfrm4_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
963{ 1002{
964 return (tmpl->saddr.a4 && 1003 return (tmpl->saddr.a4 &&
965 tmpl->saddr.a4 != x->props.saddr.a4); 1004 tmpl->saddr.a4 != x->props.saddr.a4);
966} 1005}
967 1006
968static inline int 1007static inline int
969__xfrm6_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 1008__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
970{ 1009{
971 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && 1010 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) &&
972 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); 1011 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr));
973} 1012}
974 1013
975static inline int 1014static inline int
976xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) 1015xfrm_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, unsigned short family)
977{ 1016{
978 switch (family) { 1017 switch (family) {
979 case AF_INET: 1018 case AF_INET:
@@ -1126,49 +1165,49 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
1126#endif 1165#endif
1127 1166
1128static __inline__ 1167static __inline__
1129xfrm_address_t *xfrm_flowi_daddr(struct flowi *fl, unsigned short family) 1168xfrm_address_t *xfrm_flowi_daddr(const struct flowi *fl, unsigned short family)
1130{ 1169{
1131 switch (family){ 1170 switch (family){
1132 case AF_INET: 1171 case AF_INET:
1133 return (xfrm_address_t *)&fl->fl4_dst; 1172 return (xfrm_address_t *)&fl->u.ip4.daddr;
1134 case AF_INET6: 1173 case AF_INET6:
1135 return (xfrm_address_t *)&fl->fl6_dst; 1174 return (xfrm_address_t *)&fl->u.ip6.daddr;
1136 } 1175 }
1137 return NULL; 1176 return NULL;
1138} 1177}
1139 1178
1140static __inline__ 1179static __inline__
1141xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family) 1180xfrm_address_t *xfrm_flowi_saddr(const struct flowi *fl, unsigned short family)
1142{ 1181{
1143 switch (family){ 1182 switch (family){
1144 case AF_INET: 1183 case AF_INET:
1145 return (xfrm_address_t *)&fl->fl4_src; 1184 return (xfrm_address_t *)&fl->u.ip4.saddr;
1146 case AF_INET6: 1185 case AF_INET6:
1147 return (xfrm_address_t *)&fl->fl6_src; 1186 return (xfrm_address_t *)&fl->u.ip6.saddr;
1148 } 1187 }
1149 return NULL; 1188 return NULL;
1150} 1189}
1151 1190
1152static __inline__ 1191static __inline__
1153void xfrm_flowi_addr_get(struct flowi *fl, 1192void xfrm_flowi_addr_get(const struct flowi *fl,
1154 xfrm_address_t *saddr, xfrm_address_t *daddr, 1193 xfrm_address_t *saddr, xfrm_address_t *daddr,
1155 unsigned short family) 1194 unsigned short family)
1156{ 1195{
1157 switch(family) { 1196 switch(family) {
1158 case AF_INET: 1197 case AF_INET:
1159 memcpy(&saddr->a4, &fl->fl4_src, sizeof(saddr->a4)); 1198 memcpy(&saddr->a4, &fl->u.ip4.saddr, sizeof(saddr->a4));
1160 memcpy(&daddr->a4, &fl->fl4_dst, sizeof(daddr->a4)); 1199 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4));
1161 break; 1200 break;
1162 case AF_INET6: 1201 case AF_INET6:
1163 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->fl6_src); 1202 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->u.ip6.saddr);
1164 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->fl6_dst); 1203 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->u.ip6.daddr);
1165 break; 1204 break;
1166 } 1205 }
1167} 1206}
1168 1207
1169static __inline__ int 1208static __inline__ int
1170__xfrm4_state_addr_check(struct xfrm_state *x, 1209__xfrm4_state_addr_check(const struct xfrm_state *x,
1171 xfrm_address_t *daddr, xfrm_address_t *saddr) 1210 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1172{ 1211{
1173 if (daddr->a4 == x->id.daddr.a4 && 1212 if (daddr->a4 == x->id.daddr.a4 &&
1174 (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4)) 1213 (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4))
@@ -1177,8 +1216,8 @@ __xfrm4_state_addr_check(struct xfrm_state *x,
1177} 1216}
1178 1217
1179static __inline__ int 1218static __inline__ int
1180__xfrm6_state_addr_check(struct xfrm_state *x, 1219__xfrm6_state_addr_check(const struct xfrm_state *x,
1181 xfrm_address_t *daddr, xfrm_address_t *saddr) 1220 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1182{ 1221{
1183 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && 1222 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) &&
1184 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| 1223 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)||
@@ -1189,8 +1228,8 @@ __xfrm6_state_addr_check(struct xfrm_state *x,
1189} 1228}
1190 1229
1191static __inline__ int 1230static __inline__ int
1192xfrm_state_addr_check(struct xfrm_state *x, 1231xfrm_state_addr_check(const struct xfrm_state *x,
1193 xfrm_address_t *daddr, xfrm_address_t *saddr, 1232 const xfrm_address_t *daddr, const xfrm_address_t *saddr,
1194 unsigned short family) 1233 unsigned short family)
1195{ 1234{
1196 switch (family) { 1235 switch (family) {
@@ -1203,23 +1242,23 @@ xfrm_state_addr_check(struct xfrm_state *x,
1203} 1242}
1204 1243
1205static __inline__ int 1244static __inline__ int
1206xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl, 1245xfrm_state_addr_flow_check(const struct xfrm_state *x, const struct flowi *fl,
1207 unsigned short family) 1246 unsigned short family)
1208{ 1247{
1209 switch (family) { 1248 switch (family) {
1210 case AF_INET: 1249 case AF_INET:
1211 return __xfrm4_state_addr_check(x, 1250 return __xfrm4_state_addr_check(x,
1212 (xfrm_address_t *)&fl->fl4_dst, 1251 (const xfrm_address_t *)&fl->u.ip4.daddr,
1213 (xfrm_address_t *)&fl->fl4_src); 1252 (const xfrm_address_t *)&fl->u.ip4.saddr);
1214 case AF_INET6: 1253 case AF_INET6:
1215 return __xfrm6_state_addr_check(x, 1254 return __xfrm6_state_addr_check(x,
1216 (xfrm_address_t *)&fl->fl6_dst, 1255 (const xfrm_address_t *)&fl->u.ip6.daddr,
1217 (xfrm_address_t *)&fl->fl6_src); 1256 (const xfrm_address_t *)&fl->u.ip6.saddr);
1218 } 1257 }
1219 return 0; 1258 return 0;
1220} 1259}
1221 1260
1222static inline int xfrm_state_kern(struct xfrm_state *x) 1261static inline int xfrm_state_kern(const struct xfrm_state *x)
1223{ 1262{
1224 return atomic_read(&x->tunnel_users); 1263 return atomic_read(&x->tunnel_users);
1225} 1264}
@@ -1323,8 +1362,10 @@ extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1323 int (*func)(struct xfrm_state *, int, void*), void *); 1362 int (*func)(struct xfrm_state *, int, void*), void *);
1324extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1363extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1325extern struct xfrm_state *xfrm_state_alloc(struct net *net); 1364extern struct xfrm_state *xfrm_state_alloc(struct net *net);
1326extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1365extern struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr,
1327 struct flowi *fl, struct xfrm_tmpl *tmpl, 1366 const xfrm_address_t *saddr,
1367 const struct flowi *fl,
1368 struct xfrm_tmpl *tmpl,
1328 struct xfrm_policy *pol, int *err, 1369 struct xfrm_policy *pol, int *err,
1329 unsigned short family); 1370 unsigned short family);
1330extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, 1371extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
@@ -1337,11 +1378,11 @@ extern void xfrm_state_insert(struct xfrm_state *x);
1337extern int xfrm_state_add(struct xfrm_state *x); 1378extern int xfrm_state_add(struct xfrm_state *x);
1338extern int xfrm_state_update(struct xfrm_state *x); 1379extern int xfrm_state_update(struct xfrm_state *x);
1339extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, 1380extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1340 xfrm_address_t *daddr, __be32 spi, 1381 const xfrm_address_t *daddr, __be32 spi,
1341 u8 proto, unsigned short family); 1382 u8 proto, unsigned short family);
1342extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, 1383extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1343 xfrm_address_t *daddr, 1384 const xfrm_address_t *daddr,
1344 xfrm_address_t *saddr, 1385 const xfrm_address_t *saddr,
1345 u8 proto, 1386 u8 proto,
1346 unsigned short family); 1387 unsigned short family);
1347#ifdef CONFIG_XFRM_SUB_POLICY 1388#ifdef CONFIG_XFRM_SUB_POLICY
@@ -1386,10 +1427,8 @@ extern int xfrm_state_delete(struct xfrm_state *x);
1386extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1427extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1387extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1428extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1388extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1429extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1389extern int xfrm_replay_check(struct xfrm_state *x, 1430extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
1390 struct sk_buff *skb, __be32 seq); 1431extern int xfrm_init_replay(struct xfrm_state *x);
1391extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
1392extern void xfrm_replay_notify(struct xfrm_state *x, int event);
1393extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1432extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1394extern int xfrm_init_state(struct xfrm_state *x); 1433extern int xfrm_init_state(struct xfrm_state *x);
1395extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); 1434extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
@@ -1468,19 +1507,19 @@ u32 xfrm_get_acqseq(void);
1468extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1507extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1469struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, 1508struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
1470 u8 mode, u32 reqid, u8 proto, 1509 u8 mode, u32 reqid, u8 proto,
1471 xfrm_address_t *daddr, 1510 const xfrm_address_t *daddr,
1472 xfrm_address_t *saddr, int create, 1511 const xfrm_address_t *saddr, int create,
1473 unsigned short family); 1512 unsigned short family);
1474extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1513extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1475 1514
1476#ifdef CONFIG_XFRM_MIGRATE 1515#ifdef CONFIG_XFRM_MIGRATE
1477extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1516extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1478 struct xfrm_migrate *m, int num_bundles, 1517 const struct xfrm_migrate *m, int num_bundles,
1479 struct xfrm_kmaddress *k); 1518 const struct xfrm_kmaddress *k);
1480extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1519extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m);
1481extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1520extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x,
1482 struct xfrm_migrate *m); 1521 struct xfrm_migrate *m);
1483extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1522extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1484 struct xfrm_migrate *m, int num_bundles, 1523 struct xfrm_migrate *m, int num_bundles,
1485 struct xfrm_kmaddress *k); 1524 struct xfrm_kmaddress *k);
1486#endif 1525#endif
@@ -1500,10 +1539,10 @@ extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx);
1500extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); 1539extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id);
1501extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); 1540extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id);
1502extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); 1541extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1503extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); 1542extern struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe);
1504extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 1543extern struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe);
1505extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 1544extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1506extern struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len, 1545extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1507 int probe); 1546 int probe);
1508 1547
1509struct hash_desc; 1548struct hash_desc;
@@ -1511,7 +1550,8 @@ struct scatterlist;
1511typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, 1550typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1512 unsigned int); 1551 unsigned int);
1513 1552
1514static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, 1553static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1554 const xfrm_address_t *b,
1515 int family) 1555 int family)
1516{ 1556{
1517 switch (family) { 1557 switch (family) {
@@ -1544,16 +1584,21 @@ static inline int xfrm_aevent_is_on(struct net *net)
1544} 1584}
1545#endif 1585#endif
1546 1586
1547static inline int xfrm_alg_len(struct xfrm_algo *alg) 1587static inline int xfrm_alg_len(const struct xfrm_algo *alg)
1548{ 1588{
1549 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1589 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1550} 1590}
1551 1591
1552static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg) 1592static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg)
1553{ 1593{
1554 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1594 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1555} 1595}
1556 1596
1597static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn)
1598{
1599 return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32);
1600}
1601
1557#ifdef CONFIG_XFRM_MIGRATE 1602#ifdef CONFIG_XFRM_MIGRATE
1558static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1603static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1559{ 1604{
@@ -1597,7 +1642,7 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1597 return m->v & m->m; 1642 return m->v & m->m;
1598} 1643}
1599 1644
1600static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m) 1645static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1601{ 1646{
1602 if (m->m | m->v) 1647 if (m->m | m->v)
1603 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); 1648 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 8479b66c067b..3fd5064dd43a 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -261,6 +261,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev);
261#define CONF_ENABLE_ESR 0x0008 261#define CONF_ENABLE_ESR 0x0008
262#define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ 262#define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ
263 * (CONF_ENABLE_IRQ) in use */ 263 * (CONF_ENABLE_IRQ) in use */
264#define CONF_ENABLE_ZVCARD 0x0020
264 265
265/* flags used by pcmcia_loop_config() autoconfiguration */ 266/* flags used by pcmcia_loop_config() autoconfiguration */
266#define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ 267#define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 648d23358038..b76d4006e36d 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -9,6 +9,7 @@
9#define _SCSI_SCSI_H 9#define _SCSI_SCSI_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/scatterlist.h>
12 13
13struct scsi_cmnd; 14struct scsi_cmnd;
14 15
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
index b4a0db2307ef..1eeebd534f7e 100644
--- a/include/sound/wm8903.h
+++ b/include/sound/wm8903.h
@@ -17,13 +17,9 @@
17/* 17/*
18 * R6 (0x06) - Mic Bias Control 0 18 * R6 (0x06) - Mic Bias Control 0
19 */ 19 */
20#define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */ 20#define WM8903_MICDET_THR_MASK 0x0030 /* MICDET_THR - [5:4] */
21#define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */ 21#define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [5:4] */
22#define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */ 22#define WM8903_MICDET_THR_WIDTH 2 /* MICDET_THR - [5:4] */
23#define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */
24#define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
25#define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
26#define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
27#define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ 23#define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
28#define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ 24#define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
29#define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ 25#define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 07fdfb6b9a9a..0828b6c8610a 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -8,7 +8,6 @@
8#include <scsi/scsi_cmnd.h> 8#include <scsi/scsi_cmnd.h>
9#include <net/sock.h> 9#include <net/sock.h>
10#include <net/tcp.h> 10#include <net/tcp.h>
11#include "target_core_mib.h"
12 11
13#define TARGET_CORE_MOD_VERSION "v4.0.0-rc6" 12#define TARGET_CORE_MOD_VERSION "v4.0.0-rc6"
14#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) 13#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
@@ -195,6 +194,21 @@ typedef enum {
195 SAM_TASK_ATTR_EMULATED 194 SAM_TASK_ATTR_EMULATED
196} t10_task_attr_index_t; 195} t10_task_attr_index_t;
197 196
197/*
198 * Used for target SCSI statistics
199 */
200typedef enum {
201 SCSI_INST_INDEX,
202 SCSI_DEVICE_INDEX,
203 SCSI_AUTH_INTR_INDEX,
204 SCSI_INDEX_TYPE_MAX
205} scsi_index_t;
206
207struct scsi_index_table {
208 spinlock_t lock;
209 u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX];
210} ____cacheline_aligned;
211
198struct se_cmd; 212struct se_cmd;
199 213
200struct t10_alua { 214struct t10_alua {
@@ -578,8 +592,6 @@ struct se_node_acl {
578 spinlock_t stats_lock; 592 spinlock_t stats_lock;
579 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ 593 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
580 atomic_t acl_pr_ref_count; 594 atomic_t acl_pr_ref_count;
581 /* Used for MIB access */
582 atomic_t mib_ref_count;
583 struct se_dev_entry *device_list; 595 struct se_dev_entry *device_list;
584 struct se_session *nacl_sess; 596 struct se_session *nacl_sess;
585 struct se_portal_group *se_tpg; 597 struct se_portal_group *se_tpg;
@@ -595,8 +607,6 @@ struct se_node_acl {
595} ____cacheline_aligned; 607} ____cacheline_aligned;
596 608
597struct se_session { 609struct se_session {
598 /* Used for MIB access */
599 atomic_t mib_ref_count;
600 u64 sess_bin_isid; 610 u64 sess_bin_isid;
601 struct se_node_acl *se_node_acl; 611 struct se_node_acl *se_node_acl;
602 struct se_portal_group *se_tpg; 612 struct se_portal_group *se_tpg;
@@ -806,7 +816,6 @@ struct se_hba {
806 /* Virtual iSCSI devices attached. */ 816 /* Virtual iSCSI devices attached. */
807 u32 dev_count; 817 u32 dev_count;
808 u32 hba_index; 818 u32 hba_index;
809 atomic_t dev_mib_access_count;
810 atomic_t load_balance_queue; 819 atomic_t load_balance_queue;
811 atomic_t left_queue_depth; 820 atomic_t left_queue_depth;
812 /* Maximum queue depth the HBA can handle. */ 821 /* Maximum queue depth the HBA can handle. */
@@ -845,6 +854,12 @@ struct se_lun {
845 854
846#define SE_LUN(c) ((struct se_lun *)(c)->se_lun) 855#define SE_LUN(c) ((struct se_lun *)(c)->se_lun)
847 856
857struct scsi_port_stats {
858 u64 cmd_pdus;
859 u64 tx_data_octets;
860 u64 rx_data_octets;
861} ____cacheline_aligned;
862
848struct se_port { 863struct se_port {
849 /* RELATIVE TARGET PORT IDENTIFER */ 864 /* RELATIVE TARGET PORT IDENTIFER */
850 u16 sep_rtpi; 865 u16 sep_rtpi;
@@ -867,6 +882,7 @@ struct se_port {
867} ____cacheline_aligned; 882} ____cacheline_aligned;
868 883
869struct se_tpg_np { 884struct se_tpg_np {
885 struct se_portal_group *tpg_np_parent;
870 struct config_group tpg_np_group; 886 struct config_group tpg_np_group;
871} ____cacheline_aligned; 887} ____cacheline_aligned;
872 888
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index 66f44e56eb80..246940511579 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -111,6 +111,8 @@ struct se_subsystem_api;
111 111
112extern int init_se_global(void); 112extern int init_se_global(void);
113extern void release_se_global(void); 113extern void release_se_global(void);
114extern void init_scsi_index_table(void);
115extern u32 scsi_get_new_index(scsi_index_t);
114extern void transport_init_queue_obj(struct se_queue_obj *); 116extern void transport_init_queue_obj(struct se_queue_obj *);
115extern int transport_subsystem_check_init(void); 117extern int transport_subsystem_check_init(void);
116extern int transport_subsystem_register(struct se_subsystem_api *); 118extern int transport_subsystem_register(struct se_subsystem_api *);
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index aba421d68f6f..78f18adb49c8 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
31 0 : blk_rq_sectors(rq); 31 0 : blk_rq_sectors(rq);
32 __entry->errors = rq->errors; 32 __entry->errors = rq->errors;
33 33
34 blk_fill_rwbs_rq(__entry->rwbs, rq); 34 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
35 blk_dump_cmd(__get_str(cmd), rq); 35 blk_dump_cmd(__get_str(cmd), rq);
36 ), 36 ),
37 37
@@ -118,7 +118,7 @@ DECLARE_EVENT_CLASS(block_rq,
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? 118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0; 119 blk_rq_bytes(rq) : 0;
120 120
121 blk_fill_rwbs_rq(__entry->rwbs, rq); 121 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
122 blk_dump_cmd(__get_str(cmd), rq); 122 blk_dump_cmd(__get_str(cmd), rq);
123 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 123 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
124 ), 124 ),
@@ -563,7 +563,7 @@ TRACE_EVENT(block_rq_remap,
563 __entry->nr_sector = blk_rq_sectors(rq); 563 __entry->nr_sector = blk_rq_sectors(rq);
564 __entry->old_dev = dev; 564 __entry->old_dev = dev;
565 __entry->old_sector = from; 565 __entry->old_sector = from;
566 blk_fill_rwbs_rq(__entry->rwbs, rq); 566 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
567 ), 567 ),
568 568
569 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 569 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index e16610c208c9..3e68366d485a 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -446,14 +446,16 @@ static inline notrace int ftrace_get_offsets_##call( \
446 * .reg = ftrace_event_reg, 446 * .reg = ftrace_event_reg,
447 * }; 447 * };
448 * 448 *
449 * static struct ftrace_event_call __used 449 * static struct ftrace_event_call event_<call> = {
450 * __attribute__((__aligned__(4)))
451 * __attribute__((section("_ftrace_events"))) event_<call> = {
452 * .name = "<call>", 450 * .name = "<call>",
453 * .class = event_class_<template>, 451 * .class = event_class_<template>,
454 * .event = &ftrace_event_type_<call>, 452 * .event = &ftrace_event_type_<call>,
455 * .print_fmt = print_fmt_<call>, 453 * .print_fmt = print_fmt_<call>,
456 * }; 454 * };
455 * // its only safe to use pointers when doing linker tricks to
456 * // create an array.
457 * static struct ftrace_event_call __used
458 * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>;
457 * 459 *
458 */ 460 */
459 461
@@ -579,28 +581,28 @@ static struct ftrace_event_class __used event_class_##call = { \
579#undef DEFINE_EVENT 581#undef DEFINE_EVENT
580#define DEFINE_EVENT(template, call, proto, args) \ 582#define DEFINE_EVENT(template, call, proto, args) \
581 \ 583 \
582static struct ftrace_event_call __used \ 584static struct ftrace_event_call __used event_##call = { \
583__attribute__((__aligned__(4))) \
584__attribute__((section("_ftrace_events"))) event_##call = { \
585 .name = #call, \ 585 .name = #call, \
586 .class = &event_class_##template, \ 586 .class = &event_class_##template, \
587 .event.funcs = &ftrace_event_type_funcs_##template, \ 587 .event.funcs = &ftrace_event_type_funcs_##template, \
588 .print_fmt = print_fmt_##template, \ 588 .print_fmt = print_fmt_##template, \
589}; 589}; \
590static struct ftrace_event_call __used \
591__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
590 592
591#undef DEFINE_EVENT_PRINT 593#undef DEFINE_EVENT_PRINT
592#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 594#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
593 \ 595 \
594static const char print_fmt_##call[] = print; \ 596static const char print_fmt_##call[] = print; \
595 \ 597 \
596static struct ftrace_event_call __used \ 598static struct ftrace_event_call __used event_##call = { \
597__attribute__((__aligned__(4))) \
598__attribute__((section("_ftrace_events"))) event_##call = { \
599 .name = #call, \ 599 .name = #call, \
600 .class = &event_class_##template, \ 600 .class = &event_class_##template, \
601 .event.funcs = &ftrace_event_type_funcs_##call, \ 601 .event.funcs = &ftrace_event_type_funcs_##call, \
602 .print_fmt = print_fmt_##call, \ 602 .print_fmt = print_fmt_##call, \
603} 603}; \
604static struct ftrace_event_call __used \
605__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
604 606
605#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 607#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
606 608