aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-29 16:32:35 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-29 16:32:35 -0500
commit33edcf133ba93ecba2e4b6472e97b689895d805c (patch)
tree327d7a20acef64005e7c5ccbfa1265be28aeb6ac /include
parentbe4d638c1597580ed2294d899d9f1a2cd10e462c (diff)
parent3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/platform/aclinux.h6
-rw-r--r--include/asm-generic/bug.h8
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/pgtable.h50
-rw-r--r--include/asm-generic/vmlinux.lds.h31
-rw-r--r--include/asm-m32r/system.h2
-rw-r--r--include/asm-m68k/byteorder.h16
-rw-r--r--include/asm-m68k/machw.h22
-rw-r--r--include/crypto/aes.h8
-rw-r--r--include/crypto/algapi.h16
-rw-r--r--include/crypto/hash.h125
-rw-r--r--include/crypto/internal/hash.h16
-rw-r--r--include/keys/keyring-type.h31
-rw-r--r--include/linux/atm.h17
-rw-r--r--include/linux/atmdev.h15
-rw-r--r--include/linux/audit.h26
-rw-r--r--include/linux/binfmts.h16
-rw-r--r--include/linux/blktrace_api.h172
-rw-r--r--include/linux/capability.h25
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/compiler.h84
-rw-r--r--include/linux/crc32c.h6
-rw-r--r--include/linux/cred.h342
-rw-r--r--include/linux/crypto.h10
-rw-r--r--include/linux/dcbnl.h340
-rw-r--r--include/linux/dccp.h42
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/etherdevice.h46
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fddidevice.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/fs.h8
-rw-r--r--include/linux/fsl_devices.h18
-rw-r--r--include/linux/ftrace.h293
-rw-r--r--include/linux/ftrace_irq.h13
-rw-r--r--include/linux/hardirq.h15
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/hippidevice.h4
-rw-r--r--include/linux/ieee80211.h212
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arp.h3
-rw-r--r--include/linux/in.h4
-rw-r--r--include/linux/init_task.h14
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/kexec.h4
-rw-r--r--include/linux/key-ui.h66
-rw-r--r--include/linux/key.h32
-rw-r--r--include/linux/keyctl.h4
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/list_nulls.h94
-rw-r--r--include/linux/marker.h75
-rw-r--r--include/linux/mdio-gpio.h25
-rw-r--r--include/linux/mfd/wm8350/audio.h38
-rw-r--r--include/linux/mii.h33
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mm.h21
-rw-r--r--include/linux/mroute6.h26
-rw-r--r--include/linux/netdevice.h395
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h2
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nl80211.h223
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/of.h6
-rw-r--r--include/linux/of_gpio.h44
-rw-r--r--include/linux/pci.h6
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/pid.h4
-rw-r--r--include/linux/pkt_cls.h14
-rw-r--r--include/linux/pkt_sched.h16
-rw-r--r--include/linux/ptrace.h22
-rw-r--r--include/linux/rculist_nulls.h110
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/rfkill.h8
-rw-r--r--include/linux/ring_buffer.h16
-rw-r--r--include/linux/rio_drv.h4
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h102
-rw-r--r--include/linux/securebits.h2
-rw-r--r--include/linux/security.h344
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/skbuff.h54
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/smsc911x.h47
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/stacktrace.h8
-rw-r--r--include/linux/sunrpc/svc_xprt.h8
-rw-r--r--include/linux/topology.h2
-rw-r--r--include/linux/tracepoint.h57
-rw-r--r--include/linux/tty.h6
-rw-r--r--include/linux/usb/ch9.h8
-rw-r--r--include/linux/user_namespace.h13
-rw-r--r--include/linux/virtio_net.h9
-rw-r--r--include/linux/xfrm.h14
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/cfg80211.h142
-rw-r--r--include/net/checksum.h2
-rw-r--r--include/net/dcbnl.h53
-rw-r--r--include/net/dn.h8
-rw-r--r--include/net/dn_fib.h6
-rw-r--r--include/net/dst.h39
-rw-r--r--include/net/flow.h9
-rw-r--r--include/net/gen_stats.h3
-rw-r--r--include/net/ieee80211.h148
-rw-r--r--include/net/ieee80211_radiotap.h15
-rw-r--r--include/net/inet_hashtables.h85
-rw-r--r--include/net/inet_timewait_sock.h10
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip_vs.h17
-rw-r--r--include/net/irda/irda_device.h4
-rw-r--r--include/net/iucv/iucv.h45
-rw-r--r--include/net/lib80211.h (renamed from include/net/ieee80211_crypt.h)75
-rw-r--r--include/net/mac80211.h446
-rw-r--r--include/net/ndisc.h14
-rw-r--r--include/net/neighbour.h15
-rw-r--r--include/net/net_namespace.h22
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h57
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h2
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h12
-rw-r--r--include/net/netfilter/nfnetlink_log.h14
-rw-r--r--include/net/netlink.h24
-rw-r--r--include/net/netns/ipv4.h2
-rw-r--r--include/net/netns/ipv6.h12
-rw-r--r--include/net/netns/mib.h3
-rw-r--r--include/net/netns/x_tables.h5
-rw-r--r--include/net/netns/xfrm.h56
-rw-r--r--include/net/phonet/pep.h2
-rw-r--r--include/net/phonet/phonet.h2
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/sch_generic.h38
-rw-r--r--include/net/scm.h4
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/sock.h86
-rw-r--r--include/net/syncppp.h102
-rw-r--r--include/net/tcp.h20
-rw-r--r--include/net/udp.h25
-rw-r--r--include/net/udplite.h2
-rw-r--r--include/net/wireless.h90
-rw-r--r--include/net/xfrm.h110
-rw-r--r--include/sound/ac97_codec.h2
-rw-r--r--include/sound/asound.h1
-rw-r--r--include/sound/core.h28
-rw-r--r--include/sound/info.h106
-rw-r--r--include/sound/jack.h2
-rw-r--r--include/sound/l3.h18
-rw-r--r--include/sound/s3c24xx_uda134x.h14
-rw-r--r--include/sound/soc-dai.h231
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h206
-rw-r--r--include/sound/uda134x.h26
-rw-r--r--include/sound/version.h2
-rw-r--r--include/trace/block.h76
-rw-r--r--include/trace/boot.h60
-rw-r--r--include/trace/sched.h36
-rw-r--r--include/video/sh_mobile_lcdc.h1
-rw-r--r--include/xen/interface/event_channel.h2
171 files changed, 4847 insertions, 1936 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 09d33c7740f0..db8852d8bcf7 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -172,7 +172,7 @@
172 172
173/* Defaults for debug_level, debug and normal */ 173/* Defaults for debug_level, debug and normal */
174 174
175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO)
176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
178 178
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 029c8c06c151..0515e754449d 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -141,6 +141,10 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
141/* 141/*
142 * We need to show where it is safe to preempt execution of ACPICA 142 * We need to show where it is safe to preempt execution of ACPICA
143 */ 143 */
144#define ACPI_PREEMPTION_POINT() cond_resched() 144#define ACPI_PREEMPTION_POINT() \
145 do { \
146 if (!irqs_disabled()) \
147 cond_resched(); \
148 } while (0)
145 149
146#endif /* __ACLINUX_H__ */ 150#endif /* __ACLINUX_H__ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 12c07c1866b2..4c794d73fb84 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -8,9 +8,17 @@
8#ifdef CONFIG_GENERIC_BUG 8#ifdef CONFIG_GENERIC_BUG
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10struct bug_entry { 10struct bug_entry {
11#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
11 unsigned long bug_addr; 12 unsigned long bug_addr;
13#else
14 signed int bug_addr_disp;
15#endif
12#ifdef CONFIG_DEBUG_BUGVERBOSE 16#ifdef CONFIG_DEBUG_BUGVERBOSE
17#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
13 const char *file; 18 const char *file;
19#else
20 signed int file_disp;
21#endif
14 unsigned short line; 22 unsigned short line;
15#endif 23#endif
16 unsigned short flags; 24 unsigned short flags;
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 18546d8eb78e..36fa286adad5 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -49,7 +49,7 @@
49 49
50/* memmap is virtually contigious. */ 50/* memmap is virtually contigious. */
51#define __pfn_to_page(pfn) (vmemmap + (pfn)) 51#define __pfn_to_page(pfn) (vmemmap + (pfn))
52#define __page_to_pfn(page) ((page) - vmemmap) 52#define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
53 53
54#elif defined(CONFIG_SPARSEMEM) 54#elif defined(CONFIG_SPARSEMEM)
55/* 55/*
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index ef87f889ef62..72ebe91005a8 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
129#define move_pte(pte, prot, old_addr, new_addr) (pte) 129#define move_pte(pte, prot, old_addr, new_addr) (pte)
130#endif 130#endif
131 131
132#ifndef pgprot_writecombine
133#define pgprot_writecombine pgprot_noncached
134#endif
135
132/* 136/*
133 * When walking page tables, get the address of the next boundary, 137 * When walking page tables, get the address of the next boundary,
134 * or the end address of the range if that comes earlier. Although no 138 * or the end address of the range if that comes earlier. Although no
@@ -289,6 +293,52 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
289#define arch_flush_lazy_cpu_mode() do {} while (0) 293#define arch_flush_lazy_cpu_mode() do {} while (0)
290#endif 294#endif
291 295
296#ifndef __HAVE_PFNMAP_TRACKING
297/*
298 * Interface that can be used by architecture code to keep track of
299 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
300 *
301 * track_pfn_vma_new is called when a _new_ pfn mapping is being established
302 * for physical range indicated by pfn and size.
303 */
304static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
305 unsigned long pfn, unsigned long size)
306{
307 return 0;
308}
309
310/*
311 * Interface that can be used by architecture code to keep track of
312 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
313 *
314 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets
315 * copied through copy_page_range().
316 */
317static inline int track_pfn_vma_copy(struct vm_area_struct *vma)
318{
319 return 0;
320}
321
322/*
323 * Interface that can be used by architecture code to keep track of
324 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
325 *
326 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
327 * untrack can be called for a specific region indicated by pfn and size or
328 * can be for the entire vma (in which case size can be zero).
329 */
330static inline void untrack_pfn_vma(struct vm_area_struct *vma,
331 unsigned long pfn, unsigned long size)
332{
333}
334#else
335extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
336 unsigned long pfn, unsigned long size);
337extern int track_pfn_vma_copy(struct vm_area_struct *vma);
338extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
339 unsigned long size);
340#endif
341
292#endif /* !__ASSEMBLY__ */ 342#endif /* !__ASSEMBLY__ */
293 343
294#endif /* _ASM_GENERIC_PGTABLE_H */ 344#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 80744606bad1..c61fab1dd2f8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -45,6 +45,22 @@
45#define MCOUNT_REC() 45#define MCOUNT_REC()
46#endif 46#endif
47 47
48#ifdef CONFIG_TRACE_BRANCH_PROFILING
49#define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
50 *(_ftrace_annotated_branch) \
51 VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
52#else
53#define LIKELY_PROFILE()
54#endif
55
56#ifdef CONFIG_PROFILE_ALL_BRANCHES
57#define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
58 *(_ftrace_branch) \
59 VMLINUX_SYMBOL(__stop_branch_profile) = .;
60#else
61#define BRANCH_PROFILE()
62#endif
63
48/* .data section */ 64/* .data section */
49#define DATA_DATA \ 65#define DATA_DATA \
50 *(.data) \ 66 *(.data) \
@@ -60,9 +76,12 @@
60 VMLINUX_SYMBOL(__start___markers) = .; \ 76 VMLINUX_SYMBOL(__start___markers) = .; \
61 *(__markers) \ 77 *(__markers) \
62 VMLINUX_SYMBOL(__stop___markers) = .; \ 78 VMLINUX_SYMBOL(__stop___markers) = .; \
79 . = ALIGN(32); \
63 VMLINUX_SYMBOL(__start___tracepoints) = .; \ 80 VMLINUX_SYMBOL(__start___tracepoints) = .; \
64 *(__tracepoints) \ 81 *(__tracepoints) \
65 VMLINUX_SYMBOL(__stop___tracepoints) = .; 82 VMLINUX_SYMBOL(__stop___tracepoints) = .; \
83 LIKELY_PROFILE() \
84 BRANCH_PROFILE()
66 85
67#define RO_DATA(align) \ 86#define RO_DATA(align) \
68 . = ALIGN((align)); \ 87 . = ALIGN((align)); \
@@ -269,6 +288,16 @@
269 *(.kprobes.text) \ 288 *(.kprobes.text) \
270 VMLINUX_SYMBOL(__kprobes_text_end) = .; 289 VMLINUX_SYMBOL(__kprobes_text_end) = .;
271 290
291#ifdef CONFIG_FUNCTION_GRAPH_TRACER
292#define IRQENTRY_TEXT \
293 ALIGN_FUNCTION(); \
294 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
295 *(.irqentry.text) \
296 VMLINUX_SYMBOL(__irqentry_text_end) = .;
297#else
298#define IRQENTRY_TEXT
299#endif
300
272/* Section used for early init (in .S files) */ 301/* Section used for early init (in .S files) */
273#define HEAD_TEXT *(.head.text) 302#define HEAD_TEXT *(.head.text)
274 303
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 70a57c8c002b..c980f5ba8de7 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#if defined(CONFIG_FRAME_POINTER) || \ 25#if defined(CONFIG_FRAME_POINTER) || \
26 !defined(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER) 26 !defined(CONFIG_SCHED_OMIT_FRAME_POINTER)
27#define M32R_PUSH_FP " push fp\n" 27#define M32R_PUSH_FP " push fp\n"
28#define M32R_POP_FP " pop fp\n" 28#define M32R_POP_FP " pop fp\n"
29#else 29#else
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h
index 81d420b35c80..b354acdafec8 100644
--- a/include/asm-m68k/byteorder.h
+++ b/include/asm-m68k/byteorder.h
@@ -4,22 +4,16 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef __GNUC__ 7#define __BIG_ENDIAN
8#define __SWAB_64_THRU_32__
8 9
9static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 val) 10static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
10{ 11{
11 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); 12 __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
12 return val; 13 return val;
13} 14}
14#define __arch__swab32(x) ___arch__swab32(x) 15#define __arch_swab32 __arch_swab32
15 16
16#endif 17#include <linux/byteorder.h>
17
18#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
19# define __BYTEORDER_HAS_U64__
20# define __SWAB_64_THRU_32__
21#endif
22
23#include <linux/byteorder/big_endian.h>
24 18
25#endif /* _M68K_BYTEORDER_H */ 19#endif /* _M68K_BYTEORDER_H */
diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h
index 35624998291c..2b4de0c2ce4a 100644
--- a/include/asm-m68k/machw.h
+++ b/include/asm-m68k/machw.h
@@ -26,28 +26,6 @@
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#if 0 28#if 0
29/* Mac SCSI Controller 5380 */
30
31#define MAC_5380_BAS (0x50F10000) /* This is definitely wrong!! */
32struct MAC_5380 {
33 u_char scsi_data;
34 u_char char_dummy1;
35 u_char scsi_icr;
36 u_char char_dummy2;
37 u_char scsi_mode;
38 u_char char_dummy3;
39 u_char scsi_tcr;
40 u_char char_dummy4;
41 u_char scsi_idstat;
42 u_char char_dummy5;
43 u_char scsi_dmastat;
44 u_char char_dummy6;
45 u_char scsi_targrcv;
46 u_char char_dummy7;
47 u_char scsi_inircv;
48};
49#define mac_scsi ((*(volatile struct MAC_5380 *)MAC_5380_BAS))
50
51/* 29/*
52** SCC Z8530 30** SCC Z8530
53*/ 31*/
diff --git a/include/crypto/aes.h b/include/crypto/aes.h
index 40008d67ee3d..656a4c66a568 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -23,10 +23,10 @@ struct crypto_aes_ctx {
23 u32 key_dec[AES_MAX_KEYLENGTH_U32]; 23 u32 key_dec[AES_MAX_KEYLENGTH_U32];
24}; 24};
25 25
26extern u32 crypto_ft_tab[4][256]; 26extern const u32 crypto_ft_tab[4][256];
27extern u32 crypto_fl_tab[4][256]; 27extern const u32 crypto_fl_tab[4][256];
28extern u32 crypto_it_tab[4][256]; 28extern const u32 crypto_it_tab[4][256];
29extern u32 crypto_il_tab[4][256]; 29extern const u32 crypto_il_tab[4][256];
30 30
31int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, 31int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
32 unsigned int key_len); 32 unsigned int key_len);
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 60d06e784be3..010545436efa 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -22,9 +22,18 @@ struct seq_file;
22 22
23struct crypto_type { 23struct crypto_type {
24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); 24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
25 unsigned int (*extsize)(struct crypto_alg *alg,
26 const struct crypto_type *frontend);
25 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); 27 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask);
26 void (*exit)(struct crypto_tfm *tfm); 28 int (*init_tfm)(struct crypto_tfm *tfm,
29 const struct crypto_type *frontend);
27 void (*show)(struct seq_file *m, struct crypto_alg *alg); 30 void (*show)(struct seq_file *m, struct crypto_alg *alg);
31 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask);
32
33 unsigned int type;
34 unsigned int maskclear;
35 unsigned int maskset;
36 unsigned int tfmsize;
28}; 37};
29 38
30struct crypto_instance { 39struct crypto_instance {
@@ -239,6 +248,11 @@ static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn)
239 return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask)); 248 return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask));
240} 249}
241 250
251static inline void *crypto_hash_ctx(struct crypto_hash *tfm)
252{
253 return crypto_tfm_ctx(&tfm->base);
254}
255
242static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) 256static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm)
243{ 257{
244 return crypto_tfm_ctx_aligned(&tfm->base); 258 return crypto_tfm_ctx_aligned(&tfm->base);
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index ee48ef8fb2ea..cd16d6e668ce 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -15,10 +15,40 @@
15 15
16#include <linux/crypto.h> 16#include <linux/crypto.h>
17 17
18struct shash_desc {
19 struct crypto_shash *tfm;
20 u32 flags;
21
22 void *__ctx[] CRYPTO_MINALIGN_ATTR;
23};
24
25struct shash_alg {
26 int (*init)(struct shash_desc *desc);
27 int (*reinit)(struct shash_desc *desc);
28 int (*update)(struct shash_desc *desc, const u8 *data,
29 unsigned int len);
30 int (*final)(struct shash_desc *desc, u8 *out);
31 int (*finup)(struct shash_desc *desc, const u8 *data,
32 unsigned int len, u8 *out);
33 int (*digest)(struct shash_desc *desc, const u8 *data,
34 unsigned int len, u8 *out);
35 int (*setkey)(struct crypto_shash *tfm, const u8 *key,
36 unsigned int keylen);
37
38 unsigned int descsize;
39 unsigned int digestsize;
40
41 struct crypto_alg base;
42};
43
18struct crypto_ahash { 44struct crypto_ahash {
19 struct crypto_tfm base; 45 struct crypto_tfm base;
20}; 46};
21 47
48struct crypto_shash {
49 struct crypto_tfm base;
50};
51
22static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) 52static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
23{ 53{
24 return (struct crypto_ahash *)tfm; 54 return (struct crypto_ahash *)tfm;
@@ -87,6 +117,11 @@ static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm)
87 return crypto_ahash_crt(tfm)->reqsize; 117 return crypto_ahash_crt(tfm)->reqsize;
88} 118}
89 119
120static inline void *ahash_request_ctx(struct ahash_request *req)
121{
122 return req->__ctx;
123}
124
90static inline int crypto_ahash_setkey(struct crypto_ahash *tfm, 125static inline int crypto_ahash_setkey(struct crypto_ahash *tfm,
91 const u8 *key, unsigned int keylen) 126 const u8 *key, unsigned int keylen)
92{ 127{
@@ -101,6 +136,14 @@ static inline int crypto_ahash_digest(struct ahash_request *req)
101 return crt->digest(req); 136 return crt->digest(req);
102} 137}
103 138
139static inline void crypto_ahash_export(struct ahash_request *req, u8 *out)
140{
141 memcpy(out, ahash_request_ctx(req),
142 crypto_ahash_reqsize(crypto_ahash_reqtfm(req)));
143}
144
145int crypto_ahash_import(struct ahash_request *req, const u8 *in);
146
104static inline int crypto_ahash_init(struct ahash_request *req) 147static inline int crypto_ahash_init(struct ahash_request *req)
105{ 148{
106 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 149 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req));
@@ -169,4 +212,86 @@ static inline void ahash_request_set_crypt(struct ahash_request *req,
169 req->result = result; 212 req->result = result;
170} 213}
171 214
215struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
216 u32 mask);
217
218static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)
219{
220 return &tfm->base;
221}
222
223static inline void crypto_free_shash(struct crypto_shash *tfm)
224{
225 crypto_free_tfm(crypto_shash_tfm(tfm));
226}
227
228static inline unsigned int crypto_shash_alignmask(
229 struct crypto_shash *tfm)
230{
231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm));
232}
233
234static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg)
235{
236 return container_of(alg, struct shash_alg, base);
237}
238
239static inline struct shash_alg *crypto_shash_alg(struct crypto_shash *tfm)
240{
241 return __crypto_shash_alg(crypto_shash_tfm(tfm)->__crt_alg);
242}
243
244static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm)
245{
246 return crypto_shash_alg(tfm)->digestsize;
247}
248
249static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm)
250{
251 return crypto_tfm_get_flags(crypto_shash_tfm(tfm));
252}
253
254static inline void crypto_shash_set_flags(struct crypto_shash *tfm, u32 flags)
255{
256 crypto_tfm_set_flags(crypto_shash_tfm(tfm), flags);
257}
258
259static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags)
260{
261 crypto_tfm_clear_flags(crypto_shash_tfm(tfm), flags);
262}
263
264static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
265{
266 return crypto_shash_alg(tfm)->descsize;
267}
268
269static inline void *shash_desc_ctx(struct shash_desc *desc)
270{
271 return desc->__ctx;
272}
273
274int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
275 unsigned int keylen);
276int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
277 unsigned int len, u8 *out);
278
279static inline void crypto_shash_export(struct shash_desc *desc, u8 *out)
280{
281 memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm));
282}
283
284int crypto_shash_import(struct shash_desc *desc, const u8 *in);
285
286static inline int crypto_shash_init(struct shash_desc *desc)
287{
288 return crypto_shash_alg(desc->tfm)->init(desc);
289}
290
291int crypto_shash_update(struct shash_desc *desc, const u8 *data,
292 unsigned int len);
293int crypto_shash_final(struct shash_desc *desc, u8 *out);
294int crypto_shash_finup(struct shash_desc *desc, const u8 *data,
295 unsigned int len, u8 *out);
296
172#endif /* _CRYPTO_HASH_H */ 297#endif /* _CRYPTO_HASH_H */
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 917ae57bad4a..82b70564bcab 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -39,6 +39,12 @@ extern const struct crypto_type crypto_ahash_type;
39int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); 39int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
40int crypto_hash_walk_first(struct ahash_request *req, 40int crypto_hash_walk_first(struct ahash_request *req,
41 struct crypto_hash_walk *walk); 41 struct crypto_hash_walk *walk);
42int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
43 struct crypto_hash_walk *walk,
44 struct scatterlist *sg, unsigned int len);
45
46int crypto_register_shash(struct shash_alg *alg);
47int crypto_unregister_shash(struct shash_alg *alg);
42 48
43static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) 49static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
44{ 50{
@@ -63,16 +69,16 @@ static inline struct ahash_request *ahash_dequeue_request(
63 return ahash_request_cast(crypto_dequeue_request(queue)); 69 return ahash_request_cast(crypto_dequeue_request(queue));
64} 70}
65 71
66static inline void *ahash_request_ctx(struct ahash_request *req)
67{
68 return req->__ctx;
69}
70
71static inline int ahash_tfm_in_queue(struct crypto_queue *queue, 72static inline int ahash_tfm_in_queue(struct crypto_queue *queue,
72 struct crypto_ahash *tfm) 73 struct crypto_ahash *tfm)
73{ 74{
74 return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm)); 75 return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm));
75} 76}
76 77
78static inline void *crypto_shash_ctx(struct crypto_shash *tfm)
79{
80 return crypto_tfm_ctx(&tfm->base);
81}
82
77#endif /* _CRYPTO_INTERNAL_HASH_H */ 83#endif /* _CRYPTO_INTERNAL_HASH_H */
78 84
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
new file mode 100644
index 000000000000..843f872a4b63
--- /dev/null
+++ b/include/keys/keyring-type.h
@@ -0,0 +1,31 @@
1/* Keyring key type
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_KEYRING_TYPE_H
13#define _KEYS_KEYRING_TYPE_H
14
15#include <linux/key.h>
16#include <linux/rcupdate.h>
17
18/*
19 * the keyring payload contains a list of the keys to which the keyring is
20 * subscribed
21 */
22struct keyring_list {
23 struct rcu_head rcu; /* RCU deletion hook */
24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key *keys[0];
28};
29
30
31#endif /* _KEYS_KEYRING_TYPE_H */
diff --git a/include/linux/atm.h b/include/linux/atm.h
index c791ddd96939..d3b292174aeb 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -231,10 +231,21 @@ static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
231 */ 231 */
232 232
233struct atmif_sioc { 233struct atmif_sioc {
234 int number; 234 int number;
235 int length; 235 int length;
236 void __user *arg; 236 void __user *arg;
237}; 237};
238 238
239#ifdef __KERNEL__
240#ifdef CONFIG_COMPAT
241#include <linux/compat.h>
242struct compat_atmif_sioc {
243 int number;
244 int length;
245 compat_uptr_t arg;
246};
247#endif
248#endif
249
239typedef unsigned short atm_backend_t; 250typedef unsigned short atm_backend_t;
240#endif 251#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index a3d07c29d16c..086e5c362d3a 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -100,6 +100,10 @@ struct atm_dev_stats {
100 /* use backend to make new if */ 100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */ 102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
103#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
104 /* drop party from p2mp call */ 108 /* drop party from p2mp call */
105 109
@@ -224,6 +228,13 @@ struct atm_cirange {
224extern struct proc_dir_entry *atm_proc_root; 228extern struct proc_dir_entry *atm_proc_root;
225#endif 229#endif
226 230
231#ifdef CONFIG_COMPAT
232#include <linux/compat.h>
233struct compat_atm_iobuf {
234 int length;
235 compat_uptr_t buffer;
236};
237#endif
227 238
228struct k_atm_aal_stats { 239struct k_atm_aal_stats {
229#define __HANDLE_ITEM(i) atomic_t i 240#define __HANDLE_ITEM(i) atomic_t i
@@ -379,6 +390,10 @@ struct atmdev_ops { /* only send is required */
379 int (*open)(struct atm_vcc *vcc); 390 int (*open)(struct atm_vcc *vcc);
380 void (*close)(struct atm_vcc *vcc); 391 void (*close)(struct atm_vcc *vcc);
381 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); 392 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
393#ifdef CONFIG_COMPAT
394 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
395 void __user *arg);
396#endif
382 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
383 void __user *optval,int optlen); 398 void __user *optval,int optlen);
384 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8f0672d13eb1..26c4f6f65a46 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -99,6 +99,8 @@
99#define AUDIT_OBJ_PID 1318 /* ptrace target */ 99#define AUDIT_OBJ_PID 1318 /* ptrace target */
100#define AUDIT_TTY 1319 /* Input on an administrative TTY */ 100#define AUDIT_TTY 1319 /* Input on an administrative TTY */
101#define AUDIT_EOE 1320 /* End of multi-record event */ 101#define AUDIT_EOE 1320 /* End of multi-record event */
102#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
103#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
102 104
103#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 105#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
104#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 106#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -453,6 +455,10 @@ extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_pr
453extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); 455extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout);
454extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); 456extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification);
455extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 457extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
458extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
459 const struct cred *new,
460 const struct cred *old);
461extern int __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
456 462
457static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 463static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
458{ 464{
@@ -502,6 +508,24 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
502 return __audit_mq_getsetattr(mqdes, mqstat); 508 return __audit_mq_getsetattr(mqdes, mqstat);
503 return 0; 509 return 0;
504} 510}
511
512static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
513 const struct cred *new,
514 const struct cred *old)
515{
516 if (unlikely(!audit_dummy_context()))
517 return __audit_log_bprm_fcaps(bprm, new, old);
518 return 0;
519}
520
521static inline int audit_log_capset(pid_t pid, const struct cred *new,
522 const struct cred *old)
523{
524 if (unlikely(!audit_dummy_context()))
525 return __audit_log_capset(pid, new, old);
526 return 0;
527}
528
505extern int audit_n_rules; 529extern int audit_n_rules;
506extern int audit_signals; 530extern int audit_signals;
507#else 531#else
@@ -534,6 +558,8 @@ extern int audit_signals;
534#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 558#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
535#define audit_mq_notify(d,n) ({ 0; }) 559#define audit_mq_notify(d,n) ({ 0; })
536#define audit_mq_getsetattr(d,s) ({ 0; }) 560#define audit_mq_getsetattr(d,s) ({ 0; })
561#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
562#define audit_log_capset(pid, ncr, ocr) ({ 0; })
537#define audit_ptrace(t) ((void)0) 563#define audit_ptrace(t) ((void)0)
538#define audit_n_rules 0 564#define audit_n_rules 0
539#define audit_signals 0 565#define audit_signals 0
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 7394b5b349ff..6cbfbe297180 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -35,16 +35,20 @@ struct linux_binprm{
35 struct mm_struct *mm; 35 struct mm_struct *mm;
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 unsigned int sh_bang:1, 37 unsigned int sh_bang:1,
38 misc_bang:1; 38 misc_bang:1,
39 cred_prepared:1,/* true if creds already prepared (multiple
40 * preps happen for interpreters) */
41 cap_effective:1;/* true if has elevated effective capabilities,
42 * false if not; except for init which inherits
43 * its parent's caps anyway */
39#ifdef __alpha__ 44#ifdef __alpha__
40 unsigned int taso:1; 45 unsigned int taso:1;
41#endif 46#endif
42 unsigned int recursion_depth; 47 unsigned int recursion_depth;
43 struct file * file; 48 struct file * file;
44 int e_uid, e_gid; 49 struct cred *cred; /* new credentials */
45 kernel_cap_t cap_post_exec_permitted; 50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
46 bool cap_effective; 51 unsigned int per_clear; /* bits to clear in current->personality */
47 void *security;
48 int argc, envc; 52 int argc, envc;
49 char * filename; /* Name of binary as seen by procps */ 53 char * filename; /* Name of binary as seen by procps */
50 char * interp; /* Name of the binary really executed. Most 54 char * interp; /* Name of the binary really executed. Most
@@ -101,7 +105,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
101 int executable_stack); 105 int executable_stack);
102extern int bprm_mm_init(struct linux_binprm *bprm); 106extern int bprm_mm_init(struct linux_binprm *bprm);
103extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 107extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
104extern void compute_creds(struct linux_binprm *binprm); 108extern void install_exec_creds(struct linux_binprm *bprm);
105extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 109extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
106extern int set_binfmt(struct linux_binfmt *new); 110extern int set_binfmt(struct linux_binfmt *new);
107extern void free_bprm(struct linux_binprm *); 111extern void free_bprm(struct linux_binprm *);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index bdf505d33e77..1dba3493d520 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -160,7 +160,6 @@ struct blk_trace {
160 160
161extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 161extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
162extern void blk_trace_shutdown(struct request_queue *); 162extern void blk_trace_shutdown(struct request_queue *);
163extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
164extern int do_blk_trace_setup(struct request_queue *q, 163extern int do_blk_trace_setup(struct request_queue *q,
165 char *name, dev_t dev, struct blk_user_trace_setup *buts); 164 char *name, dev_t dev, struct blk_user_trace_setup *buts);
166extern void __trace_note_message(struct blk_trace *, const char *fmt, ...); 165extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
@@ -186,168 +185,8 @@ extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
186 } while (0) 185 } while (0)
187#define BLK_TN_MAX_MSG 128 186#define BLK_TN_MAX_MSG 128
188 187
189/** 188extern void blk_add_driver_data(struct request_queue *q, struct request *rq,
190 * blk_add_trace_rq - Add a trace for a request oriented action 189 void *data, size_t len);
191 * @q: queue the io is for
192 * @rq: the source request
193 * @what: the action
194 *
195 * Description:
196 * Records an action against a request. Will log the bio offset + size.
197 *
198 **/
199static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
200 u32 what)
201{
202 struct blk_trace *bt = q->blk_trace;
203 int rw = rq->cmd_flags & 0x03;
204
205 if (likely(!bt))
206 return;
207
208 if (blk_discard_rq(rq))
209 rw |= (1 << BIO_RW_DISCARD);
210
211 if (blk_pc_request(rq)) {
212 what |= BLK_TC_ACT(BLK_TC_PC);
213 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
214 } else {
215 what |= BLK_TC_ACT(BLK_TC_FS);
216 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, rw, what, rq->errors, 0, NULL);
217 }
218}
219
220/**
221 * blk_add_trace_bio - Add a trace for a bio oriented action
222 * @q: queue the io is for
223 * @bio: the source bio
224 * @what: the action
225 *
226 * Description:
227 * Records an action against a bio. Will log the bio offset + size.
228 *
229 **/
230static inline void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
231 u32 what)
232{
233 struct blk_trace *bt = q->blk_trace;
234
235 if (likely(!bt))
236 return;
237
238 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), 0, NULL);
239}
240
241/**
242 * blk_add_trace_generic - Add a trace for a generic action
243 * @q: queue the io is for
244 * @bio: the source bio
245 * @rw: the data direction
246 * @what: the action
247 *
248 * Description:
249 * Records a simple trace
250 *
251 **/
252static inline void blk_add_trace_generic(struct request_queue *q,
253 struct bio *bio, int rw, u32 what)
254{
255 struct blk_trace *bt = q->blk_trace;
256
257 if (likely(!bt))
258 return;
259
260 if (bio)
261 blk_add_trace_bio(q, bio, what);
262 else
263 __blk_add_trace(bt, 0, 0, rw, what, 0, 0, NULL);
264}
265
266/**
267 * blk_add_trace_pdu_int - Add a trace for a bio with an integer payload
268 * @q: queue the io is for
269 * @what: the action
270 * @bio: the source bio
271 * @pdu: the integer payload
272 *
273 * Description:
274 * Adds a trace with some integer payload. This might be an unplug
275 * option given as the action, with the depth at unplug time given
276 * as the payload
277 *
278 **/
279static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what,
280 struct bio *bio, unsigned int pdu)
281{
282 struct blk_trace *bt = q->blk_trace;
283 __be64 rpdu = cpu_to_be64(pdu);
284
285 if (likely(!bt))
286 return;
287
288 if (bio)
289 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), sizeof(rpdu), &rpdu);
290 else
291 __blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu);
292}
293
294/**
295 * blk_add_trace_remap - Add a trace for a remap operation
296 * @q: queue the io is for
297 * @bio: the source bio
298 * @dev: target device
299 * @from: source sector
300 * @to: target sector
301 *
302 * Description:
303 * Device mapper or raid target sometimes need to split a bio because
304 * it spans a stripe (or similar). Add a trace for that action.
305 *
306 **/
307static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
308 dev_t dev, sector_t from, sector_t to)
309{
310 struct blk_trace *bt = q->blk_trace;
311 struct blk_io_trace_remap r;
312
313 if (likely(!bt))
314 return;
315
316 r.device = cpu_to_be32(dev);
317 r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
318 r.sector = cpu_to_be64(to);
319
320 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
321}
322
323/**
324 * blk_add_driver_data - Add binary message with driver-specific data
325 * @q: queue the io is for
326 * @rq: io request
327 * @data: driver-specific data
328 * @len: length of driver-specific data
329 *
330 * Description:
331 * Some drivers might want to write driver-specific data per request.
332 *
333 **/
334static inline void blk_add_driver_data(struct request_queue *q,
335 struct request *rq,
336 void *data, size_t len)
337{
338 struct blk_trace *bt = q->blk_trace;
339
340 if (likely(!bt))
341 return;
342
343 if (blk_pc_request(rq))
344 __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA,
345 rq->errors, len, data);
346 else
347 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9,
348 0, BLK_TA_DRV_DATA, rq->errors, len, data);
349}
350
351extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, 190extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
352 char __user *arg); 191 char __user *arg);
353extern int blk_trace_startstop(struct request_queue *q, int start); 192extern int blk_trace_startstop(struct request_queue *q, int start);
@@ -356,13 +195,8 @@ extern int blk_trace_remove(struct request_queue *q);
356#else /* !CONFIG_BLK_DEV_IO_TRACE */ 195#else /* !CONFIG_BLK_DEV_IO_TRACE */
357#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 196#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
358#define blk_trace_shutdown(q) do { } while (0) 197#define blk_trace_shutdown(q) do { } while (0)
359#define blk_add_trace_rq(q, rq, what) do { } while (0)
360#define blk_add_trace_bio(q, rq, what) do { } while (0)
361#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
362#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
363#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
364#define blk_add_driver_data(q, rq, data, len) do {} while (0)
365#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) 198#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
199#define blk_add_driver_data(q, rq, data, len) do {} while (0)
366#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 200#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
367#define blk_trace_startstop(q, start) (-ENOTTY) 201#define blk_trace_startstop(q, start) (-ENOTTY)
368#define blk_trace_remove(q) (-ENOTTY) 202#define blk_trace_remove(q) (-ENOTTY)
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 9d1fe30b6f6c..e22f48c2a46f 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -53,6 +53,7 @@ typedef struct __user_cap_data_struct {
53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54 54
55#define VFS_CAP_REVISION_MASK 0xFF000000 55#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_REVISION_SHIFT 24
56#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 57#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
57#define VFS_CAP_FLAGS_EFFECTIVE 0x000001 58#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
58 59
@@ -68,6 +69,9 @@ typedef struct __user_cap_data_struct {
68#define VFS_CAP_U32 VFS_CAP_U32_2 69#define VFS_CAP_U32 VFS_CAP_U32_2
69#define VFS_CAP_REVISION VFS_CAP_REVISION_2 70#define VFS_CAP_REVISION VFS_CAP_REVISION_2
70 71
72#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
73extern int file_caps_enabled;
74#endif
71 75
72struct vfs_cap_data { 76struct vfs_cap_data {
73 __le32 magic_etc; /* Little endian */ 77 __le32 magic_etc; /* Little endian */
@@ -96,6 +100,13 @@ typedef struct kernel_cap_struct {
96 __u32 cap[_KERNEL_CAPABILITY_U32S]; 100 __u32 cap[_KERNEL_CAPABILITY_U32S];
97} kernel_cap_t; 101} kernel_cap_t;
98 102
103/* exact same as vfs_cap_data but in cpu endian and always filled completely */
104struct cpu_vfs_cap_data {
105 __u32 magic_etc;
106 kernel_cap_t permitted;
107 kernel_cap_t inheritable;
108};
109
99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 110#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
100#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 111#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
101 112
@@ -454,6 +465,13 @@ static inline int cap_isclear(const kernel_cap_t a)
454 return 1; 465 return 1;
455} 466}
456 467
468/*
469 * Check if "a" is a subset of "set".
470 * return 1 if ALL of the capabilities in "a" are also in "set"
471 * cap_issubset(0101, 1111) will return 1
472 * return 0 if ANY of the capabilities in "a" are not in "set"
473 * cap_issubset(1111, 0101) will return 0
474 */
457static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) 475static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
458{ 476{
459 kernel_cap_t dest; 477 kernel_cap_t dest;
@@ -501,8 +519,6 @@ extern const kernel_cap_t __cap_empty_set;
501extern const kernel_cap_t __cap_full_set; 519extern const kernel_cap_t __cap_full_set;
502extern const kernel_cap_t __cap_init_eff_set; 520extern const kernel_cap_t __cap_init_eff_set;
503 521
504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
505
506/** 522/**
507 * has_capability - Determine if a task has a superior capability available 523 * has_capability - Determine if a task has a superior capability available
508 * @t: The task in question 524 * @t: The task in question
@@ -514,9 +530,14 @@ kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
514 * Note that this does not set PF_SUPERPRIV on the task. 530 * Note that this does not set PF_SUPERPRIV on the task.
515 */ 531 */
516#define has_capability(t, cap) (security_capable((t), (cap)) == 0) 532#define has_capability(t, cap) (security_capable((t), (cap)) == 0)
533#define has_capability_noaudit(t, cap) (security_capable_noaudit((t), (cap)) == 0)
517 534
518extern int capable(int cap); 535extern int capable(int cap);
519 536
537/* audit system wants to get cap info from files as well */
538struct dentry;
539extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
540
520#endif /* __KERNEL__ */ 541#endif /* __KERNEL__ */
521 542
522#endif /* !_LINUX_CAPABILITY_H */ 543#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 9c22396e8b50..9c8d31bacf46 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -54,3 +54,9 @@ SUBSYS(freezer)
54#endif 54#endif
55 55
56/* */ 56/* */
57
58#ifdef CONFIG_NET_CLS_CGROUP
59SUBSYS(net_cls)
60#endif
61
62/* */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 98115d9d04da..ea7c6be354b7 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -59,8 +59,88 @@ extern void __chk_io_ptr(const volatile void __iomem *);
59 * specific implementations come from the above header files 59 * specific implementations come from the above header files
60 */ 60 */
61 61
62#define likely(x) __builtin_expect(!!(x), 1) 62struct ftrace_branch_data {
63#define unlikely(x) __builtin_expect(!!(x), 0) 63 const char *func;
64 const char *file;
65 unsigned line;
66 union {
67 struct {
68 unsigned long correct;
69 unsigned long incorrect;
70 };
71 struct {
72 unsigned long miss;
73 unsigned long hit;
74 };
75 };
76};
77
78/*
79 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
80 * to disable branch tracing on a per file basis.
81 */
82#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
83void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
84
85#define likely_notrace(x) __builtin_expect(!!(x), 1)
86#define unlikely_notrace(x) __builtin_expect(!!(x), 0)
87
88#define __branch_check__(x, expect) ({ \
89 int ______r; \
90 static struct ftrace_branch_data \
91 __attribute__((__aligned__(4))) \
92 __attribute__((section("_ftrace_annotated_branch"))) \
93 ______f = { \
94 .func = __func__, \
95 .file = __FILE__, \
96 .line = __LINE__, \
97 }; \
98 ______r = likely_notrace(x); \
99 ftrace_likely_update(&______f, ______r, expect); \
100 ______r; \
101 })
102
103/*
104 * Using __builtin_constant_p(x) to ignore cases where the return
105 * value is always the same. This idea is taken from a similar patch
106 * written by Daniel Walker.
107 */
108# ifndef likely
109# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
110# endif
111# ifndef unlikely
112# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
113# endif
114
115#ifdef CONFIG_PROFILE_ALL_BRANCHES
116/*
117 * "Define 'is'", Bill Clinton
118 * "Define 'if'", Steven Rostedt
119 */
120#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \
121 ({ \
122 int ______r; \
123 static struct ftrace_branch_data \
124 __attribute__((__aligned__(4))) \
125 __attribute__((section("_ftrace_branch"))) \
126 ______f = { \
127 .func = __func__, \
128 .file = __FILE__, \
129 .line = __LINE__, \
130 }; \
131 ______r = !!(cond); \
132 if (______r) \
133 ______f.hit++; \
134 else \
135 ______f.miss++; \
136 ______r; \
137 }))
138#endif /* CONFIG_PROFILE_ALL_BRANCHES */
139
140#else
141# define likely(x) __builtin_expect(!!(x), 1)
142# define unlikely(x) __builtin_expect(!!(x), 0)
143#endif
64 144
65/* Optimization barrier */ 145/* Optimization barrier */
66#ifndef barrier 146#ifndef barrier
diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h
index 508f512e5a2f..bd8b44d96bdc 100644
--- a/include/linux/crc32c.h
+++ b/include/linux/crc32c.h
@@ -3,9 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern u32 crc32c_le(u32 crc, unsigned char const *address, size_t length); 6extern u32 crc32c(u32 crc, const void *address, unsigned int length);
7extern u32 crc32c_be(u32 crc, unsigned char const *address, size_t length);
8 7
9#define crc32c(seed, data, length) crc32c_le(seed, (unsigned char const *)data, length) 8/* This macro exists for backwards-compatibility. */
9#define crc32c_le crc32c
10 10
11#endif /* _LINUX_CRC32C_H */ 11#endif /* _LINUX_CRC32C_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index b69222cc1fd2..3282ee4318e7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -1,4 +1,4 @@
1/* Credentials management 1/* Credentials management - see Documentation/credentials.txt
2 * 2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -12,39 +12,335 @@
12#ifndef _LINUX_CRED_H 12#ifndef _LINUX_CRED_H
13#define _LINUX_CRED_H 13#define _LINUX_CRED_H
14 14
15#define get_current_user() (get_uid(current->user)) 15#include <linux/capability.h>
16#include <linux/key.h>
17#include <asm/atomic.h>
16 18
17#define task_uid(task) ((task)->uid) 19struct user_struct;
18#define task_gid(task) ((task)->gid) 20struct cred;
19#define task_euid(task) ((task)->euid) 21struct inode;
20#define task_egid(task) ((task)->egid)
21 22
22#define current_uid() (current->uid) 23/*
23#define current_gid() (current->gid) 24 * COW Supplementary groups list
24#define current_euid() (current->euid) 25 */
25#define current_egid() (current->egid) 26#define NGROUPS_SMALL 32
26#define current_suid() (current->suid) 27#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
27#define current_sgid() (current->sgid) 28
28#define current_fsuid() (current->fsuid) 29struct group_info {
29#define current_fsgid() (current->fsgid) 30 atomic_t usage;
30#define current_cap() (current->cap_effective) 31 int ngroups;
32 int nblocks;
33 gid_t small_block[NGROUPS_SMALL];
34 gid_t *blocks[0];
35};
36
37/**
38 * get_group_info - Get a reference to a group info structure
39 * @group_info: The group info to reference
40 *
41 * This gets a reference to a set of supplementary groups.
42 *
43 * If the caller is accessing a task's credentials, they must hold the RCU read
44 * lock when reading.
45 */
46static inline struct group_info *get_group_info(struct group_info *gi)
47{
48 atomic_inc(&gi->usage);
49 return gi;
50}
51
52/**
53 * put_group_info - Release a reference to a group info structure
54 * @group_info: The group info to release
55 */
56#define put_group_info(group_info) \
57do { \
58 if (atomic_dec_and_test(&(group_info)->usage)) \
59 groups_free(group_info); \
60} while (0)
61
62extern struct group_info *groups_alloc(int);
63extern struct group_info init_groups;
64extern void groups_free(struct group_info *);
65extern int set_current_groups(struct group_info *);
66extern int set_groups(struct cred *, struct group_info *);
67extern int groups_search(const struct group_info *, gid_t);
68
69/* access the groups "array" with this macro */
70#define GROUP_AT(gi, i) \
71 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
72
73extern int in_group_p(gid_t);
74extern int in_egroup_p(gid_t);
75
76/*
77 * The common credentials for a thread group
78 * - shared by CLONE_THREAD
79 */
80#ifdef CONFIG_KEYS
81struct thread_group_cred {
82 atomic_t usage;
83 pid_t tgid; /* thread group process ID */
84 spinlock_t lock;
85 struct key *session_keyring; /* keyring inherited over fork */
86 struct key *process_keyring; /* keyring private to this process */
87 struct rcu_head rcu; /* RCU deletion hook */
88};
89#endif
90
91/*
92 * The security context of a task
93 *
94 * The parts of the context break down into two categories:
95 *
96 * (1) The objective context of a task. These parts are used when some other
97 * task is attempting to affect this one.
98 *
99 * (2) The subjective context. These details are used when the task is acting
100 * upon another object, be that a file, a task, a key or whatever.
101 *
102 * Note that some members of this structure belong to both categories - the
103 * LSM security pointer for instance.
104 *
105 * A task has two security pointers. task->real_cred points to the objective
106 * context that defines that task's actual details. The objective part of this
107 * context is used whenever that task is acted upon.
108 *
109 * task->cred points to the subjective context that defines the details of how
110 * that task is going to act upon another object. This may be overridden
111 * temporarily to point to another security context, but normally points to the
112 * same context as task->real_cred.
113 */
114struct cred {
115 atomic_t usage;
116 uid_t uid; /* real UID of the task */
117 gid_t gid; /* real GID of the task */
118 uid_t suid; /* saved UID of the task */
119 gid_t sgid; /* saved GID of the task */
120 uid_t euid; /* effective UID of the task */
121 gid_t egid; /* effective GID of the task */
122 uid_t fsuid; /* UID for VFS ops */
123 gid_t fsgid; /* GID for VFS ops */
124 unsigned securebits; /* SUID-less security management */
125 kernel_cap_t cap_inheritable; /* caps our children can inherit */
126 kernel_cap_t cap_permitted; /* caps we're permitted */
127 kernel_cap_t cap_effective; /* caps we can actually use */
128 kernel_cap_t cap_bset; /* capability bounding set */
129#ifdef CONFIG_KEYS
130 unsigned char jit_keyring; /* default keyring to attach requested
131 * keys to */
132 struct key *thread_keyring; /* keyring private to this thread */
133 struct key *request_key_auth; /* assumed request_key authority */
134 struct thread_group_cred *tgcred; /* thread-group shared credentials */
135#endif
136#ifdef CONFIG_SECURITY
137 void *security; /* subjective LSM security */
138#endif
139 struct user_struct *user; /* real user ID subscription */
140 struct group_info *group_info; /* supplementary groups for euid/fsgid */
141 struct rcu_head rcu; /* RCU deletion hook */
142};
143
144extern void __put_cred(struct cred *);
145extern int copy_creds(struct task_struct *, unsigned long);
146extern struct cred *prepare_creds(void);
147extern struct cred *prepare_exec_creds(void);
148extern struct cred *prepare_usermodehelper_creds(void);
149extern int commit_creds(struct cred *);
150extern void abort_creds(struct cred *);
151extern const struct cred *override_creds(const struct cred *);
152extern void revert_creds(const struct cred *);
153extern struct cred *prepare_kernel_cred(struct task_struct *);
154extern int change_create_files_as(struct cred *, struct inode *);
155extern int set_security_override(struct cred *, u32);
156extern int set_security_override_from_ctx(struct cred *, const char *);
157extern int set_create_files_as(struct cred *, struct inode *);
158extern void __init cred_init(void);
159
160/**
161 * get_new_cred - Get a reference on a new set of credentials
162 * @cred: The new credentials to reference
163 *
164 * Get a reference on the specified set of new credentials. The caller must
165 * release the reference.
166 */
167static inline struct cred *get_new_cred(struct cred *cred)
168{
169 atomic_inc(&cred->usage);
170 return cred;
171}
172
173/**
174 * get_cred - Get a reference on a set of credentials
175 * @cred: The credentials to reference
176 *
177 * Get a reference on the specified set of credentials. The caller must
178 * release the reference.
179 *
180 * This is used to deal with a committed set of credentials. Although the
181 * pointer is const, this will temporarily discard the const and increment the
182 * usage count. The purpose of this is to attempt to catch at compile time the
183 * accidental alteration of a set of credentials that should be considered
184 * immutable.
185 */
186static inline const struct cred *get_cred(const struct cred *cred)
187{
188 return get_new_cred((struct cred *) cred);
189}
190
191/**
192 * put_cred - Release a reference to a set of credentials
193 * @cred: The credentials to release
194 *
195 * Release a reference to a set of credentials, deleting them when the last ref
196 * is released.
197 *
198 * This takes a const pointer to a set of credentials because the credentials
199 * on task_struct are attached by const pointers to prevent accidental
200 * alteration of otherwise immutable credential sets.
201 */
202static inline void put_cred(const struct cred *_cred)
203{
204 struct cred *cred = (struct cred *) _cred;
205
206 BUG_ON(atomic_read(&(cred)->usage) <= 0);
207 if (atomic_dec_and_test(&(cred)->usage))
208 __put_cred(cred);
209}
210
211/**
212 * current_cred - Access the current task's subjective credentials
213 *
214 * Access the subjective credentials of the current task.
215 */
216#define current_cred() \
217 (current->cred)
218
219/**
220 * __task_cred - Access a task's objective credentials
221 * @task: The task to query
222 *
223 * Access the objective credentials of a task. The caller must hold the RCU
224 * readlock.
225 *
226 * The caller must make sure task doesn't go away, either by holding a ref on
227 * task or by holding tasklist_lock to prevent it from being unlinked.
228 */
229#define __task_cred(task) \
230 ((const struct cred *)(rcu_dereference((task)->real_cred)))
231
232/**
233 * get_task_cred - Get another task's objective credentials
234 * @task: The task to query
235 *
236 * Get the objective credentials of a task, pinning them so that they can't go
237 * away. Accessing a task's credentials directly is not permitted.
238 *
239 * The caller must make sure task doesn't go away, either by holding a ref on
240 * task or by holding tasklist_lock to prevent it from being unlinked.
241 */
242#define get_task_cred(task) \
243({ \
244 struct cred *__cred; \
245 rcu_read_lock(); \
246 __cred = (struct cred *) __task_cred((task)); \
247 get_cred(__cred); \
248 rcu_read_unlock(); \
249 __cred; \
250})
251
252/**
253 * get_current_cred - Get the current task's subjective credentials
254 *
255 * Get the subjective credentials of the current task, pinning them so that
256 * they can't go away. Accessing the current task's credentials directly is
257 * not permitted.
258 */
259#define get_current_cred() \
260 (get_cred(current_cred()))
261
262/**
263 * get_current_user - Get the current task's user_struct
264 *
265 * Get the user record of the current task, pinning it so that it can't go
266 * away.
267 */
268#define get_current_user() \
269({ \
270 struct user_struct *__u; \
271 struct cred *__cred; \
272 __cred = (struct cred *) current_cred(); \
273 __u = get_uid(__cred->user); \
274 __u; \
275})
276
277/**
278 * get_current_groups - Get the current task's supplementary group list
279 *
280 * Get the supplementary group list of the current task, pinning it so that it
281 * can't go away.
282 */
283#define get_current_groups() \
284({ \
285 struct group_info *__groups; \
286 struct cred *__cred; \
287 __cred = (struct cred *) current_cred(); \
288 __groups = get_group_info(__cred->group_info); \
289 __groups; \
290})
291
292#define task_cred_xxx(task, xxx) \
293({ \
294 __typeof__(((struct cred *)NULL)->xxx) ___val; \
295 rcu_read_lock(); \
296 ___val = __task_cred((task))->xxx; \
297 rcu_read_unlock(); \
298 ___val; \
299})
300
301#define task_uid(task) (task_cred_xxx((task), uid))
302#define task_euid(task) (task_cred_xxx((task), euid))
303
304#define current_cred_xxx(xxx) \
305({ \
306 current->cred->xxx; \
307})
308
309#define current_uid() (current_cred_xxx(uid))
310#define current_gid() (current_cred_xxx(gid))
311#define current_euid() (current_cred_xxx(euid))
312#define current_egid() (current_cred_xxx(egid))
313#define current_suid() (current_cred_xxx(suid))
314#define current_sgid() (current_cred_xxx(sgid))
315#define current_fsuid() (current_cred_xxx(fsuid))
316#define current_fsgid() (current_cred_xxx(fsgid))
317#define current_cap() (current_cred_xxx(cap_effective))
318#define current_user() (current_cred_xxx(user))
319#define current_user_ns() (current_cred_xxx(user)->user_ns)
320#define current_security() (current_cred_xxx(security))
31 321
32#define current_uid_gid(_uid, _gid) \ 322#define current_uid_gid(_uid, _gid) \
33do { \ 323do { \
34 *(_uid) = current->uid; \ 324 const struct cred *__cred; \
35 *(_gid) = current->gid; \ 325 __cred = current_cred(); \
326 *(_uid) = __cred->uid; \
327 *(_gid) = __cred->gid; \
36} while(0) 328} while(0)
37 329
38#define current_euid_egid(_uid, _gid) \ 330#define current_euid_egid(_euid, _egid) \
39do { \ 331do { \
40 *(_uid) = current->euid; \ 332 const struct cred *__cred; \
41 *(_gid) = current->egid; \ 333 __cred = current_cred(); \
334 *(_euid) = __cred->euid; \
335 *(_egid) = __cred->egid; \
42} while(0) 336} while(0)
43 337
44#define current_fsuid_fsgid(_uid, _gid) \ 338#define current_fsuid_fsgid(_fsuid, _fsgid) \
45do { \ 339do { \
46 *(_uid) = current->fsuid; \ 340 const struct cred *__cred; \
47 *(_gid) = current->fsgid; \ 341 __cred = current_cred(); \
342 *(_fsuid) = __cred->fsuid; \
343 *(_fsgid) = __cred->fsgid; \
48} while(0) 344} while(0)
49 345
50#endif /* _LINUX_CRED_H */ 346#endif /* _LINUX_CRED_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3d2317e4af2e..3bacd71509fb 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -36,7 +36,8 @@
36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_HASH 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000008
40#define CRYPTO_ALG_TYPE_SHASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
41#define CRYPTO_ALG_TYPE_RNG 0x0000000c 42#define CRYPTO_ALG_TYPE_RNG 0x0000000c
42 43
@@ -220,6 +221,7 @@ struct ablkcipher_alg {
220 221
221struct ahash_alg { 222struct ahash_alg {
222 int (*init)(struct ahash_request *req); 223 int (*init)(struct ahash_request *req);
224 int (*reinit)(struct ahash_request *req);
223 int (*update)(struct ahash_request *req); 225 int (*update)(struct ahash_request *req);
224 int (*final)(struct ahash_request *req); 226 int (*final)(struct ahash_request *req);
225 int (*digest)(struct ahash_request *req); 227 int (*digest)(struct ahash_request *req);
@@ -480,6 +482,8 @@ struct crypto_tfm {
480 struct compress_tfm compress; 482 struct compress_tfm compress;
481 struct rng_tfm rng; 483 struct rng_tfm rng;
482 } crt_u; 484 } crt_u;
485
486 void (*exit)(struct crypto_tfm *tfm);
483 487
484 struct crypto_alg *__crt_alg; 488 struct crypto_alg *__crt_alg;
485 489
@@ -544,7 +548,9 @@ struct crypto_attr_u32 {
544 * Transform user interface. 548 * Transform user interface.
545 */ 549 */
546 550
547struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 551struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
552 const struct crypto_type *frontend,
553 u32 type, u32 mask);
548struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 554struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
549void crypto_free_tfm(struct crypto_tfm *tfm); 555void crypto_free_tfm(struct crypto_tfm *tfm);
550 556
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
new file mode 100644
index 000000000000..b0ef274e0031
--- /dev/null
+++ b/include/linux/dcbnl.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__
22
23#define DCB_PROTO_VERSION 1
24
25struct dcbmsg {
26 unsigned char dcb_family;
27 __u8 cmd;
28 __u16 dcb_pad;
29};
30
31/**
32 * enum dcbnl_commands - supported DCB commands
33 *
34 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35 * @DCB_CMD_GSTATE: request the state of DCB in the device
36 * @DCB_CMD_SSTATE: set the state of DCB in the device
37 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45 * device. Only useful when using bonding.
46 * @DCB_CMD_GCAP: request the DCB capabilities of the device
47 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48 * @DCB_CMD_SNUMTCS: set the number of traffic classes
49 * @DCB_CMD_GBCN: set backward congestion notification configuration
50 * @DCB_CMD_SBCN: get backward congestion notification configration.
51 */
52enum dcbnl_commands {
53 DCB_CMD_UNDEFINED,
54
55 DCB_CMD_GSTATE,
56 DCB_CMD_SSTATE,
57
58 DCB_CMD_PGTX_GCFG,
59 DCB_CMD_PGTX_SCFG,
60 DCB_CMD_PGRX_GCFG,
61 DCB_CMD_PGRX_SCFG,
62
63 DCB_CMD_PFC_GCFG,
64 DCB_CMD_PFC_SCFG,
65
66 DCB_CMD_SET_ALL,
67
68 DCB_CMD_GPERM_HWADDR,
69
70 DCB_CMD_GCAP,
71
72 DCB_CMD_GNUMTCS,
73 DCB_CMD_SNUMTCS,
74
75 DCB_CMD_PFC_GSTATE,
76 DCB_CMD_PFC_SSTATE,
77
78 DCB_CMD_BCN_GCFG,
79 DCB_CMD_BCN_SCFG,
80
81 __DCB_CMD_ENUM_MAX,
82 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
83};
84
85/**
86 * enum dcbnl_attrs - DCB top-level netlink attributes
87 *
88 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
89 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
90 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
91 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
92 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
93 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
94 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
95 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
96 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
97 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
98 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
99 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
100 */
101enum dcbnl_attrs {
102 DCB_ATTR_UNDEFINED,
103
104 DCB_ATTR_IFNAME,
105 DCB_ATTR_STATE,
106 DCB_ATTR_PFC_STATE,
107 DCB_ATTR_PFC_CFG,
108 DCB_ATTR_NUM_TC,
109 DCB_ATTR_PG_CFG,
110 DCB_ATTR_SET_ALL,
111 DCB_ATTR_PERM_HWADDR,
112 DCB_ATTR_CAP,
113 DCB_ATTR_NUMTCS,
114 DCB_ATTR_BCN,
115
116 __DCB_ATTR_ENUM_MAX,
117 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
118};
119
120/**
121 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
122 *
123 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
124 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
125 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
126 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
127 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
128 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
129 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
130 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
131 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
132 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
133 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
134 *
135 */
136enum dcbnl_pfc_up_attrs {
137 DCB_PFC_UP_ATTR_UNDEFINED,
138
139 DCB_PFC_UP_ATTR_0,
140 DCB_PFC_UP_ATTR_1,
141 DCB_PFC_UP_ATTR_2,
142 DCB_PFC_UP_ATTR_3,
143 DCB_PFC_UP_ATTR_4,
144 DCB_PFC_UP_ATTR_5,
145 DCB_PFC_UP_ATTR_6,
146 DCB_PFC_UP_ATTR_7,
147 DCB_PFC_UP_ATTR_ALL,
148
149 __DCB_PFC_UP_ATTR_ENUM_MAX,
150 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
151};
152
153/**
154 * enum dcbnl_pg_attrs - DCB Priority Group attributes
155 *
156 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
157 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
158 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
159 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
160 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
161 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
162 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
163 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
164 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
165 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
166 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
167 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
168 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
169 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
170 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
171 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
172 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
173 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
174 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
175 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
176 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
177 *
178 */
179enum dcbnl_pg_attrs {
180 DCB_PG_ATTR_UNDEFINED,
181
182 DCB_PG_ATTR_TC_0,
183 DCB_PG_ATTR_TC_1,
184 DCB_PG_ATTR_TC_2,
185 DCB_PG_ATTR_TC_3,
186 DCB_PG_ATTR_TC_4,
187 DCB_PG_ATTR_TC_5,
188 DCB_PG_ATTR_TC_6,
189 DCB_PG_ATTR_TC_7,
190 DCB_PG_ATTR_TC_MAX,
191 DCB_PG_ATTR_TC_ALL,
192
193 DCB_PG_ATTR_BW_ID_0,
194 DCB_PG_ATTR_BW_ID_1,
195 DCB_PG_ATTR_BW_ID_2,
196 DCB_PG_ATTR_BW_ID_3,
197 DCB_PG_ATTR_BW_ID_4,
198 DCB_PG_ATTR_BW_ID_5,
199 DCB_PG_ATTR_BW_ID_6,
200 DCB_PG_ATTR_BW_ID_7,
201 DCB_PG_ATTR_BW_ID_MAX,
202 DCB_PG_ATTR_BW_ID_ALL,
203
204 __DCB_PG_ATTR_ENUM_MAX,
205 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
206};
207
208/**
209 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
210 *
211 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
212 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
213 * Valid values are: 0-7
214 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
215 * Some devices may not support changing the
216 * user priority map of a TC.
217 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
218 * 0 - none
219 * 1 - group strict
220 * 2 - link strict
221 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
222 * not configured to use link strict priority,
223 * this is the percentage of bandwidth of the
224 * priority group this traffic class belongs to
225 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
226 *
227 */
228enum dcbnl_tc_attrs {
229 DCB_TC_ATTR_PARAM_UNDEFINED,
230
231 DCB_TC_ATTR_PARAM_PGID,
232 DCB_TC_ATTR_PARAM_UP_MAPPING,
233 DCB_TC_ATTR_PARAM_STRICT_PRIO,
234 DCB_TC_ATTR_PARAM_BW_PCT,
235 DCB_TC_ATTR_PARAM_ALL,
236
237 __DCB_TC_ATTR_PARAM_ENUM_MAX,
238 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
239};
240
241/**
242 * enum dcbnl_cap_attrs - DCB Capability attributes
243 *
244 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
245 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
246 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
247 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
248 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
249 * traffic class mapping
250 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
251 * number of traffic classes the device
252 * can be configured to use for Priority Groups
253 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
254 * number of traffic classes the device can be
255 * configured to use for Priority Flow Control
256 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
257 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
258 * Notification
259 */
260enum dcbnl_cap_attrs {
261 DCB_CAP_ATTR_UNDEFINED,
262 DCB_CAP_ATTR_ALL,
263 DCB_CAP_ATTR_PG,
264 DCB_CAP_ATTR_PFC,
265 DCB_CAP_ATTR_UP2TC,
266 DCB_CAP_ATTR_PG_TCS,
267 DCB_CAP_ATTR_PFC_TCS,
268 DCB_CAP_ATTR_GSP,
269 DCB_CAP_ATTR_BCN,
270
271 __DCB_CAP_ATTR_ENUM_MAX,
272 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
273};
274
275/**
276 * enum dcbnl_numtcs_attrs - number of traffic classes
277 *
278 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
279 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
280 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
281 * priority groups
282 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
283 * support priority flow control
284 */
285enum dcbnl_numtcs_attrs {
286 DCB_NUMTCS_ATTR_UNDEFINED,
287 DCB_NUMTCS_ATTR_ALL,
288 DCB_NUMTCS_ATTR_PG,
289 DCB_NUMTCS_ATTR_PFC,
290
291 __DCB_NUMTCS_ATTR_ENUM_MAX,
292 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
293};
294
295enum dcbnl_bcn_attrs{
296 DCB_BCN_ATTR_UNDEFINED = 0,
297
298 DCB_BCN_ATTR_RP_0,
299 DCB_BCN_ATTR_RP_1,
300 DCB_BCN_ATTR_RP_2,
301 DCB_BCN_ATTR_RP_3,
302 DCB_BCN_ATTR_RP_4,
303 DCB_BCN_ATTR_RP_5,
304 DCB_BCN_ATTR_RP_6,
305 DCB_BCN_ATTR_RP_7,
306 DCB_BCN_ATTR_RP_ALL,
307
308 DCB_BCN_ATTR_BCNA_0,
309 DCB_BCN_ATTR_BCNA_1,
310 DCB_BCN_ATTR_ALPHA,
311 DCB_BCN_ATTR_BETA,
312 DCB_BCN_ATTR_GD,
313 DCB_BCN_ATTR_GI,
314 DCB_BCN_ATTR_TMAX,
315 DCB_BCN_ATTR_TD,
316 DCB_BCN_ATTR_RMIN,
317 DCB_BCN_ATTR_W,
318 DCB_BCN_ATTR_RD,
319 DCB_BCN_ATTR_RU,
320 DCB_BCN_ATTR_WRTT,
321 DCB_BCN_ATTR_RI,
322 DCB_BCN_ATTR_C,
323 DCB_BCN_ATTR_ALL,
324
325 __DCB_BCN_ATTR_ENUM_MAX,
326 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
327};
328
329/**
330 * enum dcb_general_attr_values - general DCB attribute values
331 *
332 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
333 *
334 */
335enum dcb_general_attr_values {
336 DCB_ATTR_VALUE_UNDEFINED = 0xff
337};
338
339
340#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 6080449fbec9..61734e27abb7 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -168,6 +168,8 @@ enum {
168 DCCPO_MIN_CCID_SPECIFIC = 128, 168 DCCPO_MIN_CCID_SPECIFIC = 128,
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
172#define DCCP_SINGLE_OPT_MAXLEN 253
171 173
172/* DCCP CCIDS */ 174/* DCCP CCIDS */
173enum { 175enum {
@@ -176,29 +178,23 @@ enum {
176}; 178};
177 179
178/* DCCP features (RFC 4340 section 6.4) */ 180/* DCCP features (RFC 4340 section 6.4) */
179enum { 181enum dccp_feature_numbers {
180 DCCPF_RESERVED = 0, 182 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 183 DCCPF_CCID = 1,
182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ 184 DCCPF_SHORT_SEQNOS = 2,
183 DCCPF_SEQUENCE_WINDOW = 3, 185 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ 186 DCCPF_ECN_INCAPABLE = 4,
185 DCCPF_ACK_RATIO = 5, 187 DCCPF_ACK_RATIO = 5,
186 DCCPF_SEND_ACK_VECTOR = 6, 188 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_SEND_NDP_COUNT = 7, 189 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MIN_CSUM_COVER = 8, 190 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ 191 DCCPF_DATA_CHECKSUM = 9,
190 /* 10-127 reserved */ 192 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128, 193 DCCPF_MIN_CCID_SPECIFIC = 128,
194 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
192 DCCPF_MAX_CCID_SPECIFIC = 255, 195 DCCPF_MAX_CCID_SPECIFIC = 255,
193}; 196};
194 197
195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
196struct dccp_so_feat {
197 __u8 dccpsf_feat;
198 __u8 __user *dccpsf_val;
199 __u8 dccpsf_len;
200};
201
202/* DCCP socket options */ 198/* DCCP socket options */
203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ 199#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
204#define DCCP_SOCKOPT_SERVICE 2 200#define DCCP_SOCKOPT_SERVICE 2
@@ -208,6 +204,10 @@ struct dccp_so_feat {
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 204#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
209#define DCCP_SOCKOPT_SEND_CSCOV 10 205#define DCCP_SOCKOPT_SEND_CSCOV 10
210#define DCCP_SOCKOPT_RECV_CSCOV 11 206#define DCCP_SOCKOPT_RECV_CSCOV 11
207#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
208#define DCCP_SOCKOPT_CCID 13
209#define DCCP_SOCKOPT_TX_CCID 14
210#define DCCP_SOCKOPT_RX_CCID 15
211#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
212#define DCCP_SOCKOPT_CCID_TX_INFO 192 212#define DCCP_SOCKOPT_CCID_TX_INFO 192
213 213
@@ -360,7 +360,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2 361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2 362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
364/* FIXME: for now we're default to 1 but it should really be 0 */ 363/* FIXME: for now we're default to 1 but it should really be 0 */
365#define DCCPF_INITIAL_SEND_NDP_COUNT 1 364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366 365
@@ -370,20 +369,11 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
370 * Will be used to pass the state from dccp_request_sock to dccp_sock. 369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
371 * 370 *
372 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2) 371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
373 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
374 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
375 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
376 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
377 * @dccpms_pending - List of features being negotiated 372 * @dccpms_pending - List of features being negotiated
378 * @dccpms_conf - 373 * @dccpms_conf -
379 */ 374 */
380struct dccp_minisock { 375struct dccp_minisock {
381 __u64 dccpms_sequence_window; 376 __u64 dccpms_sequence_window;
382 __u8 dccpms_rx_ccid;
383 __u8 dccpms_tx_ccid;
384 __u8 dccpms_send_ack_vector;
385 __u8 dccpms_send_ndp_count;
386 __u8 dccpms_ack_ratio;
387 struct list_head dccpms_pending; 377 struct list_head dccpms_pending;
388 struct list_head dccpms_conf; 378 struct list_head dccpms_conf;
389}; 379};
@@ -411,6 +401,7 @@ extern void dccp_minisock_init(struct dccp_minisock *dmsk);
411 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 401 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
412 * @dreq_isr: initial sequence number received on the Request 402 * @dreq_isr: initial sequence number received on the Request
413 * @dreq_service: service code present on the Request (there is just one) 403 * @dreq_service: service code present on the Request (there is just one)
404 * @dreq_featneg: feature negotiation options for this connection
414 * The following two fields are analogous to the ones in dccp_sock: 405 * The following two fields are analogous to the ones in dccp_sock:
415 * @dreq_timestamp_echo: last received timestamp to echo (13.1) 406 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
416 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo 407 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
@@ -420,6 +411,7 @@ struct dccp_request_sock {
420 __u64 dreq_iss; 411 __u64 dreq_iss;
421 __u64 dreq_isr; 412 __u64 dreq_isr;
422 __be32 dreq_service; 413 __be32 dreq_service;
414 struct list_head dreq_featneg;
423 __u32 dreq_timestamp_echo; 415 __u32 dreq_timestamp_echo;
424 __u32 dreq_timestamp_time; 416 __u32 dreq_timestamp_time;
425}; 417};
@@ -493,10 +485,12 @@ struct dccp_ackvec;
493 * @dccps_r_ack_ratio - feature-remote Ack Ratio 485 * @dccps_r_ack_ratio - feature-remote Ack Ratio
494 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 486 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
495 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
496 * @dccps_ndp_count - number of Non Data Packets since last data packet 489 * @dccps_ndp_count - number of Non Data Packets since last data packet
497 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
498 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
499 * @dccps_minisock - associated minisock (accessed via dccp_msk) 492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
500 * @dccps_hc_rx_ackvec - rx half connection ack vector 494 * @dccps_hc_rx_ackvec - rx half connection ack vector
501 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
502 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) 496 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
@@ -529,11 +523,13 @@ struct dccp_sock {
529 __u32 dccps_timestamp_time; 523 __u32 dccps_timestamp_time;
530 __u16 dccps_l_ack_ratio; 524 __u16 dccps_l_ack_ratio;
531 __u16 dccps_r_ack_ratio; 525 __u16 dccps_r_ack_ratio;
532 __u16 dccps_pcslen; 526 __u8 dccps_pcslen:4;
533 __u16 dccps_pcrlen; 527 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1;
534 __u64 dccps_ndp_count:48; 529 __u64 dccps_ndp_count:48;
535 unsigned long dccps_rate_last; 530 unsigned long dccps_rate_last;
536 struct dccp_minisock dccps_minisock; 531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg;
537 struct dccp_ackvec *dccps_hc_rx_ackvec; 533 struct dccp_ackvec *dccps_hc_rx_ackvec;
538 struct ccid *dccps_hc_rx_ccid; 534 struct ccid *dccps_hc_rx_ccid;
539 struct ccid *dccps_hc_tx_ccid; 535 struct ccid *dccps_hc_tx_ccid;
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index e5084eb5943a..2bfda178f274 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -44,6 +44,7 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
44extern void dmi_scan_machine(void); 44extern void dmi_scan_machine(void);
45extern int dmi_get_year(int field); 45extern int dmi_get_year(int field);
46extern int dmi_name_in_vendors(const char *str); 46extern int dmi_name_in_vendors(const char *str);
47extern int dmi_name_in_serial(const char *str);
47extern int dmi_available; 48extern int dmi_available;
48extern int dmi_walk(void (*decode)(const struct dmi_header *)); 49extern int dmi_walk(void (*decode)(const struct dmi_header *));
49 50
@@ -56,6 +57,7 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
56static inline void dmi_scan_machine(void) { return; } 57static inline void dmi_scan_machine(void) { return; }
57static inline int dmi_get_year(int year) { return 0; } 58static inline int dmi_get_year(int year) { return 0; }
58static inline int dmi_name_in_vendors(const char *s) { return 0; } 59static inline int dmi_name_in_vendors(const char *s) { return 0; }
60static inline int dmi_name_in_serial(const char *s) { return 0; }
59#define dmi_available 0 61#define dmi_available 0
60static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 62static inline int dmi_walk(void (*decode)(const struct dmi_header *))
61 { return -1; } 63 { return -1; }
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 25d62e6e3290..1cb0f0b90926 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
29#include <linux/random.h> 29#include <linux/random.h>
30#include <asm/unaligned.h>
30 31
31#ifdef __KERNEL__ 32#ifdef __KERNEL__
32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
@@ -41,6 +42,10 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev, 43 const struct net_device *dev,
43 const unsigned char *haddr); 44 const unsigned char *haddr);
45extern int eth_mac_addr(struct net_device *dev, void *p);
46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
47extern int eth_validate_addr(struct net_device *dev);
48
44 49
45 50
46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 51extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
@@ -136,6 +141,47 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
136 BUILD_BUG_ON(ETH_ALEN != 6); 141 BUILD_BUG_ON(ETH_ALEN != 6);
137 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 142 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
138} 143}
144
145static inline unsigned long zap_last_2bytes(unsigned long value)
146{
147#ifdef __BIG_ENDIAN
148 return value >> 16;
149#else
150 return value << 16;
151#endif
152}
153
154/**
155 * compare_ether_addr_64bits - Compare two Ethernet addresses
156 * @addr1: Pointer to an array of 8 bytes
157 * @addr2: Pointer to an other array of 8 bytes
158 *
159 * Compare two ethernet addresses, returns 0 if equal.
160 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional
161 * branches, and possibly long word memory accesses on CPU allowing cheap
162 * unaligned memory reads.
163 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2}
164 *
165 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits.
166 */
167
168static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
169 const u8 addr2[6+2])
170{
171#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
172 unsigned long fold = ((*(unsigned long *)addr1) ^
173 (*(unsigned long *)addr2));
174
175 if (sizeof(fold) == 8)
176 return zap_last_2bytes(fold) != 0;
177
178 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
179 (*(unsigned long *)(addr2 + 4)));
180 return fold != 0;
181#else
182 return compare_ether_addr(addr1, addr2);
183#endif
184}
139#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
140 186
141#endif /* _LINUX_ETHERDEVICE_H */ 187#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b4b038b89ee6..27c67a542235 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -467,6 +467,8 @@ struct ethtool_ops {
467 467
468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
470 472
471/* compatibility with older code */ 473/* compatibility with older code */
472#define SPARC_ETH_GSET ETHTOOL_GSET 474#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 75a81eaf3430..1ee63df5be92 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -888,7 +888,7 @@ struct fb_info {
888#define fb_writeq sbus_writeq 888#define fb_writeq sbus_writeq
889#define fb_memset sbus_memset_io 889#define fb_memset sbus_memset_io
890 890
891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__) || defined(__avr32__) 891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__)
892 892
893#define fb_readb __raw_readb 893#define fb_readb __raw_readb
894#define fb_readw __raw_readw 894#define fb_readw __raw_readw
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index e61e42dfd317..155bafd9e886 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -27,6 +27,7 @@
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 31extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 32#endif
32 33
diff --git a/include/linux/filter.h b/include/linux/filter.h
index b6ea9aa9e853..1354aaf6abbe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -122,7 +122,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
122#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
123#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
124#define SKF_AD_NLATTR 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16 125#define SKF_AD_NLATTR_NEST 16
126#define SKF_AD_MAX 20
126#define SKF_NET_OFF (-0x100000) 127#define SKF_NET_OFF (-0x100000)
127#define SKF_LL_OFF (-0x200000) 128#define SKF_LL_OFF (-0x200000)
128 129
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4a853ef6fd35..195a8cb2a749 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -316,6 +316,7 @@ struct poll_table_struct;
316struct kstatfs; 316struct kstatfs;
317struct vm_area_struct; 317struct vm_area_struct;
318struct vfsmount; 318struct vfsmount;
319struct cred;
319 320
320extern void __init inode_init(void); 321extern void __init inode_init(void);
321extern void __init inode_init_early(void); 322extern void __init inode_init_early(void);
@@ -827,7 +828,7 @@ struct file {
827 fmode_t f_mode; 828 fmode_t f_mode;
828 loff_t f_pos; 829 loff_t f_pos;
829 struct fown_struct f_owner; 830 struct fown_struct f_owner;
830 unsigned int f_uid, f_gid; 831 const struct cred *f_cred;
831 struct file_ra_state f_ra; 832 struct file_ra_state f_ra;
832 833
833 u64 f_version; 834 u64 f_version;
@@ -1194,7 +1195,7 @@ enum {
1194#define has_fs_excl() atomic_read(&current->fs_excl) 1195#define has_fs_excl() atomic_read(&current->fs_excl)
1195 1196
1196#define is_owner_or_cap(inode) \ 1197#define is_owner_or_cap(inode) \
1197 ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER)) 1198 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER))
1198 1199
1199/* not quite ready to be deprecated, but... */ 1200/* not quite ready to be deprecated, but... */
1200extern void lock_super(struct super_block *); 1201extern void lock_super(struct super_block *);
@@ -1674,7 +1675,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1674extern long do_sys_open(int dfd, const char __user *filename, int flags, 1675extern long do_sys_open(int dfd, const char __user *filename, int flags,
1675 int mode); 1676 int mode);
1676extern struct file *filp_open(const char *, int, int); 1677extern struct file *filp_open(const char *, int, int);
1677extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1678extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1679 const struct cred *);
1678extern int filp_close(struct file *, fl_owner_t id); 1680extern int filp_close(struct file *, fl_owner_t id);
1679extern char * getname(const char __user *); 1681extern char * getname(const char __user *);
1680 1682
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 708bab58d8d0..d9051d717d27 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -47,12 +47,7 @@
47struct gianfar_platform_data { 47struct gianfar_platform_data {
48 /* device specific information */ 48 /* device specific information */
49 u32 device_flags; 49 u32 device_flags;
50 /* board specific information */ 50 char bus_id[BUS_ID_SIZE];
51 u32 board_flags;
52 int mdio_bus; /* Bus controlled by us */
53 char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */
54 u32 phy_id;
55 u8 mac_addr[6];
56 phy_interface_t interface; 51 phy_interface_t interface;
57}; 52};
58 53
@@ -61,17 +56,6 @@ struct gianfar_mdio_data {
61 int irq[32]; 56 int irq[32];
62}; 57};
63 58
64/* Flags related to gianfar device features */
65#define FSL_GIANFAR_DEV_HAS_GIGABIT 0x00000001
66#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
67#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
68#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
69#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
70#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
71#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
72#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
73#define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100
74
75/* Flags in gianfar_platform_data */ 59/* Flags in gianfar_platform_data */
76#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ 60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
77#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ 61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9c5bc6be2b09..677432b9cb7e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -8,6 +8,8 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kallsyms.h> 10#include <linux/kallsyms.h>
11#include <linux/bitops.h>
12#include <linux/sched.h>
11 13
12#ifdef CONFIG_FUNCTION_TRACER 14#ifdef CONFIG_FUNCTION_TRACER
13 15
@@ -24,6 +26,45 @@ struct ftrace_ops {
24 struct ftrace_ops *next; 26 struct ftrace_ops *next;
25}; 27};
26 28
29extern int function_trace_stop;
30
31/*
32 * Type of the current tracing.
33 */
34enum ftrace_tracing_type_t {
35 FTRACE_TYPE_ENTER = 0, /* Hook the call of the function */
36 FTRACE_TYPE_RETURN, /* Hook the return of the function */
37};
38
39/* Current tracing type, default is FTRACE_TYPE_ENTER */
40extern enum ftrace_tracing_type_t ftrace_tracing_type;
41
42/**
43 * ftrace_stop - stop function tracer.
44 *
45 * A quick way to stop the function tracer. Note this an on off switch,
46 * it is not something that is recursive like preempt_disable.
47 * This does not disable the calling of mcount, it only stops the
48 * calling of functions from mcount.
49 */
50static inline void ftrace_stop(void)
51{
52 function_trace_stop = 1;
53}
54
55/**
56 * ftrace_start - start the function tracer.
57 *
58 * This function is the inverse of ftrace_stop. This does not enable
59 * the function tracing if the function tracer is disabled. This only
60 * sets the function tracer flag to continue calling the functions
61 * from mcount.
62 */
63static inline void ftrace_start(void)
64{
65 function_trace_stop = 0;
66}
67
27/* 68/*
28 * The ftrace_ops must be a static and should also 69 * The ftrace_ops must be a static and should also
29 * be read_mostly. These functions do modify read_mostly variables 70 * be read_mostly. These functions do modify read_mostly variables
@@ -42,9 +83,21 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1);
42# define unregister_ftrace_function(ops) do { } while (0) 83# define unregister_ftrace_function(ops) do { } while (0)
43# define clear_ftrace_function(ops) do { } while (0) 84# define clear_ftrace_function(ops) do { } while (0)
44static inline void ftrace_kill(void) { } 85static inline void ftrace_kill(void) { }
86static inline void ftrace_stop(void) { }
87static inline void ftrace_start(void) { }
45#endif /* CONFIG_FUNCTION_TRACER */ 88#endif /* CONFIG_FUNCTION_TRACER */
46 89
90#ifdef CONFIG_STACK_TRACER
91extern int stack_tracer_enabled;
92int
93stack_trace_sysctl(struct ctl_table *table, int write,
94 struct file *file, void __user *buffer, size_t *lenp,
95 loff_t *ppos);
96#endif
97
47#ifdef CONFIG_DYNAMIC_FTRACE 98#ifdef CONFIG_DYNAMIC_FTRACE
99/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */
100#include <asm/ftrace.h>
48 101
49enum { 102enum {
50 FTRACE_FL_FREE = (1 << 0), 103 FTRACE_FL_FREE = (1 << 0),
@@ -60,6 +113,7 @@ struct dyn_ftrace {
60 struct list_head list; 113 struct list_head list;
61 unsigned long ip; /* address of mcount call-site */ 114 unsigned long ip; /* address of mcount call-site */
62 unsigned long flags; 115 unsigned long flags;
116 struct dyn_arch_ftrace arch;
63}; 117};
64 118
65int ftrace_force_update(void); 119int ftrace_force_update(void);
@@ -67,19 +121,48 @@ void ftrace_set_filter(unsigned char *buf, int len, int reset);
67 121
68/* defined in arch */ 122/* defined in arch */
69extern int ftrace_ip_converted(unsigned long ip); 123extern int ftrace_ip_converted(unsigned long ip);
70extern unsigned char *ftrace_nop_replace(void);
71extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
72extern int ftrace_dyn_arch_init(void *data); 124extern int ftrace_dyn_arch_init(void *data);
73extern int ftrace_update_ftrace_func(ftrace_func_t func); 125extern int ftrace_update_ftrace_func(ftrace_func_t func);
74extern void ftrace_caller(void); 126extern void ftrace_caller(void);
75extern void ftrace_call(void); 127extern void ftrace_call(void);
76extern void mcount_call(void); 128extern void mcount_call(void);
129#ifdef CONFIG_FUNCTION_GRAPH_TRACER
130extern void ftrace_graph_caller(void);
131extern int ftrace_enable_ftrace_graph_caller(void);
132extern int ftrace_disable_ftrace_graph_caller(void);
133#else
134static inline int ftrace_enable_ftrace_graph_caller(void) { return 0; }
135static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
136#endif
137
138/**
139 * ftrace_make_nop - convert code into top
140 * @mod: module structure if called by module load initialization
141 * @rec: the mcount call site record
142 * @addr: the address that the call site should be calling
143 *
144 * This is a very sensitive operation and great care needs
145 * to be taken by the arch. The operation should carefully
146 * read the location, check to see if what is read is indeed
147 * what we expect it to be, and then on success of the compare,
148 * it should write to the location.
149 *
150 * The code segment at @rec->ip should be a caller to @addr
151 *
152 * Return must be:
153 * 0 on success
154 * -EFAULT on error reading the location
155 * -EINVAL on a failed compare of the contents
156 * -EPERM on error writing to the location
157 * Any other value will be considered a failure.
158 */
159extern int ftrace_make_nop(struct module *mod,
160 struct dyn_ftrace *rec, unsigned long addr);
77 161
78/** 162/**
79 * ftrace_modify_code - modify code segment 163 * ftrace_make_call - convert a nop call site into a call to addr
80 * @ip: the address of the code segment 164 * @rec: the mcount call site record
81 * @old_code: the contents of what is expected to be there 165 * @addr: the address that the call site should call
82 * @new_code: the code to patch in
83 * 166 *
84 * This is a very sensitive operation and great care needs 167 * This is a very sensitive operation and great care needs
85 * to be taken by the arch. The operation should carefully 168 * to be taken by the arch. The operation should carefully
@@ -87,6 +170,8 @@ extern void mcount_call(void);
87 * what we expect it to be, and then on success of the compare, 170 * what we expect it to be, and then on success of the compare,
88 * it should write to the location. 171 * it should write to the location.
89 * 172 *
173 * The code segment at @rec->ip should be a nop
174 *
90 * Return must be: 175 * Return must be:
91 * 0 on success 176 * 0 on success
92 * -EFAULT on error reading the location 177 * -EFAULT on error reading the location
@@ -94,8 +179,11 @@ extern void mcount_call(void);
94 * -EPERM on error writing to the location 179 * -EPERM on error writing to the location
95 * Any other value will be considered a failure. 180 * Any other value will be considered a failure.
96 */ 181 */
97extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, 182extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
98 unsigned char *new_code); 183
184
185/* May be defined in arch */
186extern int ftrace_arch_read_dyn_info(char *buf, int size);
99 187
100extern int skip_trace(unsigned long ip); 188extern int skip_trace(unsigned long ip);
101 189
@@ -103,7 +191,6 @@ extern void ftrace_release(void *start, unsigned long size);
103 191
104extern void ftrace_disable_daemon(void); 192extern void ftrace_disable_daemon(void);
105extern void ftrace_enable_daemon(void); 193extern void ftrace_enable_daemon(void);
106
107#else 194#else
108# define skip_trace(ip) ({ 0; }) 195# define skip_trace(ip) ({ 0; })
109# define ftrace_force_update() ({ 0; }) 196# define ftrace_force_update() ({ 0; })
@@ -182,6 +269,12 @@ static inline void __ftrace_enabled_restore(int enabled)
182#endif 269#endif
183 270
184#ifdef CONFIG_TRACING 271#ifdef CONFIG_TRACING
272extern int ftrace_dump_on_oops;
273
274extern void tracing_start(void);
275extern void tracing_stop(void);
276extern void ftrace_off_permanent(void);
277
185extern void 278extern void
186ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); 279ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
187 280
@@ -210,8 +303,11 @@ extern void ftrace_dump(void);
210static inline void 303static inline void
211ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 304ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
212static inline int 305static inline int
213ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); 306ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
214 307
308static inline void tracing_start(void) { }
309static inline void tracing_stop(void) { }
310static inline void ftrace_off_permanent(void) { }
215static inline int 311static inline int
216ftrace_printk(const char *fmt, ...) 312ftrace_printk(const char *fmt, ...)
217{ 313{
@@ -222,33 +318,178 @@ static inline void ftrace_dump(void) { }
222 318
223#ifdef CONFIG_FTRACE_MCOUNT_RECORD 319#ifdef CONFIG_FTRACE_MCOUNT_RECORD
224extern void ftrace_init(void); 320extern void ftrace_init(void);
225extern void ftrace_init_module(unsigned long *start, unsigned long *end); 321extern void ftrace_init_module(struct module *mod,
322 unsigned long *start, unsigned long *end);
226#else 323#else
227static inline void ftrace_init(void) { } 324static inline void ftrace_init(void) { }
228static inline void 325static inline void
229ftrace_init_module(unsigned long *start, unsigned long *end) { } 326ftrace_init_module(struct module *mod,
327 unsigned long *start, unsigned long *end) { }
328#endif
329
330enum {
331 POWER_NONE = 0,
332 POWER_CSTATE = 1,
333 POWER_PSTATE = 2,
334};
335
336struct power_trace {
337#ifdef CONFIG_POWER_TRACER
338 ktime_t stamp;
339 ktime_t end;
340 int type;
341 int state;
230#endif 342#endif
343};
231 344
345#ifdef CONFIG_POWER_TRACER
346extern void trace_power_start(struct power_trace *it, unsigned int type,
347 unsigned int state);
348extern void trace_power_mark(struct power_trace *it, unsigned int type,
349 unsigned int state);
350extern void trace_power_end(struct power_trace *it);
351#else
352static inline void trace_power_start(struct power_trace *it, unsigned int type,
353 unsigned int state) { }
354static inline void trace_power_mark(struct power_trace *it, unsigned int type,
355 unsigned int state) { }
356static inline void trace_power_end(struct power_trace *it) { }
357#endif
358
359
360/*
361 * Structure that defines an entry function trace.
362 */
363struct ftrace_graph_ent {
364 unsigned long func; /* Current function */
365 int depth;
366};
232 367
233struct boot_trace { 368/*
234 pid_t caller; 369 * Structure that defines a return function trace.
235 char func[KSYM_SYMBOL_LEN]; 370 */
236 int result; 371struct ftrace_graph_ret {
237 unsigned long long duration; /* usecs */ 372 unsigned long func; /* Current function */
238 ktime_t calltime; 373 unsigned long long calltime;
239 ktime_t rettime; 374 unsigned long long rettime;
375 /* Number of functions that overran the depth limit for current task */
376 unsigned long overrun;
377 int depth;
240}; 378};
241 379
242#ifdef CONFIG_BOOT_TRACER 380#ifdef CONFIG_FUNCTION_GRAPH_TRACER
243extern void trace_boot(struct boot_trace *it, initcall_t fn); 381
244extern void start_boot_trace(void); 382/*
245extern void stop_boot_trace(void); 383 * Sometimes we don't want to trace a function with the function
384 * graph tracer but we want them to keep traced by the usual function
385 * tracer if the function graph tracer is not configured.
386 */
387#define __notrace_funcgraph notrace
388
389/*
390 * We want to which function is an entrypoint of a hardirq.
391 * That will help us to put a signal on output.
392 */
393#define __irq_entry __attribute__((__section__(".irqentry.text")))
394
395/* Limits of hardirq entrypoints */
396extern char __irqentry_text_start[];
397extern char __irqentry_text_end[];
398
399#define FTRACE_RETFUNC_DEPTH 50
400#define FTRACE_RETSTACK_ALLOC_SIZE 32
401/* Type of the callback handlers for tracing function graph*/
402typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
403typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
404
405extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
406 trace_func_graph_ent_t entryfunc);
407
408extern void ftrace_graph_stop(void);
409
410/* The current handlers in use */
411extern trace_func_graph_ret_t ftrace_graph_return;
412extern trace_func_graph_ent_t ftrace_graph_entry;
413
414extern void unregister_ftrace_graph(void);
415
416extern void ftrace_graph_init_task(struct task_struct *t);
417extern void ftrace_graph_exit_task(struct task_struct *t);
418
419static inline int task_curr_ret_stack(struct task_struct *t)
420{
421 return t->curr_ret_stack;
422}
423
424static inline void pause_graph_tracing(void)
425{
426 atomic_inc(&current->tracing_graph_pause);
427}
428
429static inline void unpause_graph_tracing(void)
430{
431 atomic_dec(&current->tracing_graph_pause);
432}
246#else 433#else
247static inline void trace_boot(struct boot_trace *it, initcall_t fn) { } 434
248static inline void start_boot_trace(void) { } 435#define __notrace_funcgraph
249static inline void stop_boot_trace(void) { } 436#define __irq_entry
437
438static inline void ftrace_graph_init_task(struct task_struct *t) { }
439static inline void ftrace_graph_exit_task(struct task_struct *t) { }
440
441static inline int task_curr_ret_stack(struct task_struct *tsk)
442{
443 return -1;
444}
445
446static inline void pause_graph_tracing(void) { }
447static inline void unpause_graph_tracing(void) { }
250#endif 448#endif
251 449
450#ifdef CONFIG_TRACING
451#include <linux/sched.h>
452
453/* flags for current->trace */
454enum {
455 TSK_TRACE_FL_TRACE_BIT = 0,
456 TSK_TRACE_FL_GRAPH_BIT = 1,
457};
458enum {
459 TSK_TRACE_FL_TRACE = 1 << TSK_TRACE_FL_TRACE_BIT,
460 TSK_TRACE_FL_GRAPH = 1 << TSK_TRACE_FL_GRAPH_BIT,
461};
462
463static inline void set_tsk_trace_trace(struct task_struct *tsk)
464{
465 set_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace);
466}
467
468static inline void clear_tsk_trace_trace(struct task_struct *tsk)
469{
470 clear_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace);
471}
472
473static inline int test_tsk_trace_trace(struct task_struct *tsk)
474{
475 return tsk->trace & TSK_TRACE_FL_TRACE;
476}
477
478static inline void set_tsk_trace_graph(struct task_struct *tsk)
479{
480 set_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace);
481}
482
483static inline void clear_tsk_trace_graph(struct task_struct *tsk)
484{
485 clear_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace);
486}
487
488static inline int test_tsk_trace_graph(struct task_struct *tsk)
489{
490 return tsk->trace & TSK_TRACE_FL_GRAPH;
491}
252 492
493#endif /* CONFIG_TRACING */
253 494
254#endif /* _LINUX_FTRACE_H */ 495#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h
new file mode 100644
index 000000000000..366a054d0b05
--- /dev/null
+++ b/include/linux/ftrace_irq.h
@@ -0,0 +1,13 @@
1#ifndef _LINUX_FTRACE_IRQ_H
2#define _LINUX_FTRACE_IRQ_H
3
4
5#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER)
6extern void ftrace_nmi_enter(void);
7extern void ftrace_nmi_exit(void);
8#else
9static inline void ftrace_nmi_enter(void) { }
10static inline void ftrace_nmi_exit(void) { }
11#endif
12
13#endif /* _LINUX_FTRACE_IRQ_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 181006cc94a0..89a56d79e4c6 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -4,6 +4,7 @@
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/smp_lock.h> 5#include <linux/smp_lock.h>
6#include <linux/lockdep.h> 6#include <linux/lockdep.h>
7#include <linux/ftrace_irq.h>
7#include <asm/hardirq.h> 8#include <asm/hardirq.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
@@ -161,7 +162,17 @@ extern void irq_enter(void);
161 */ 162 */
162extern void irq_exit(void); 163extern void irq_exit(void);
163 164
164#define nmi_enter() do { lockdep_off(); __irq_enter(); } while (0) 165#define nmi_enter() \
165#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0) 166 do { \
167 ftrace_nmi_enter(); \
168 lockdep_off(); \
169 __irq_enter(); \
170 } while (0)
171#define nmi_exit() \
172 do { \
173 __irq_exit(); \
174 lockdep_on(); \
175 ftrace_nmi_exit(); \
176 } while (0)
166 177
167#endif /* LINUX_HARDIRQ_H */ 178#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index c59769693bee..fd47a151665e 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,7 +43,7 @@ struct hdlc_proto {
43}; 43};
44 44
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by netdev_priv(dev) */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
49 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
@@ -80,7 +80,7 @@ struct net_device *alloc_hdlcdev(void *priv);
80 80
81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) 81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
82{ 82{
83 return dev->priv; 83 return netdev_priv(dev);
84} 84}
85 85
86static __inline__ void debug_frame(const struct sk_buff *skb) 86static __inline__ void debug_frame(const struct sk_buff *skb)
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index bab303dafd6e..f148e4908410 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -32,7 +32,9 @@ struct hippi_cb {
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35 35extern int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
36extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38extern struct net_device *alloc_hippi_dev(int sizeof_priv);
37#endif 39#endif
38 40
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc36641..c4e6ca1a6306 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#ifndef IEEE80211_H 15#ifndef LINUX_IEEE80211_H
16#define IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
@@ -97,7 +97,10 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100
100#define IEEE80211_MAX_MESH_ID_LEN 32 101#define IEEE80211_MAX_MESH_ID_LEN 32
102#define IEEE80211_MESH_CONFIG_LEN 19
103
101#define IEEE80211_QOS_CTL_LEN 2 104#define IEEE80211_QOS_CTL_LEN 2
102#define IEEE80211_QOS_CTL_TID_MASK 0x000F 105#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 106#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +669,13 @@ struct ieee80211_cts {
666 u8 ra[6]; 669 u8 ra[6];
667} __attribute__ ((packed)); 670} __attribute__ ((packed));
668 671
672struct ieee80211_pspoll {
673 __le16 frame_control;
674 __le16 aid;
675 u8 bssid[6];
676 u8 ta[6];
677} __attribute__ ((packed));
678
669/** 679/**
670 * struct ieee80211_bar - HT Block Ack Request 680 * struct ieee80211_bar - HT Block Ack Request
671 * 681 *
@@ -685,28 +695,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 695#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 696#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 697
698
699#define IEEE80211_HT_MCS_MASK_LEN 10
700
701/**
702 * struct ieee80211_mcs_info - MCS information
703 * @rx_mask: RX mask
704 * @rx_highest: highest supported RX rate
705 * @tx_params: TX parameters
706 */
707struct ieee80211_mcs_info {
708 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
709 __le16 rx_highest;
710 u8 tx_params;
711 u8 reserved[3];
712} __attribute__((packed));
713
714/* 802.11n HT capability MSC set */
715#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
716#define IEEE80211_HT_MCS_TX_DEFINED 0x01
717#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
718/* value 0 == 1 stream etc */
719#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
720#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
721#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
722#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
723
724/*
725 * 802.11n D5.0 20.3.5 / 20.6 says:
726 * - indices 0 to 7 and 32 are single spatial stream
727 * - 8 to 31 are multiple spatial streams using equal modulation
728 * [8..15 for two streams, 16..23 for three and 24..31 for four]
729 * - remainder are multiple spatial streams using unequal modulation
730 */
731#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
732#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
733 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
734
688/** 735/**
689 * struct ieee80211_ht_cap - HT capabilities 736 * struct ieee80211_ht_cap - HT capabilities
690 * 737 *
691 * This structure refers to "HT capabilities element" as 738 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 739 * described in 802.11n D5.0 7.3.2.57
693 */ 740 */
694struct ieee80211_ht_cap { 741struct ieee80211_ht_cap {
695 __le16 cap_info; 742 __le16 cap_info;
696 u8 ampdu_params_info; 743 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 744
745 /* 16 bytes MCS information */
746 struct ieee80211_mcs_info mcs;
747
698 __le16 extended_ht_cap_info; 748 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 749 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 750 u8 antenna_selection_info;
701} __attribute__ ((packed)); 751} __attribute__ ((packed));
702 752
753/* 802.11n HT capabilities masks (for cap_info) */
754#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
755#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
756#define IEEE80211_HT_CAP_SM_PS 0x000C
757#define IEEE80211_HT_CAP_GRN_FLD 0x0010
758#define IEEE80211_HT_CAP_SGI_20 0x0020
759#define IEEE80211_HT_CAP_SGI_40 0x0040
760#define IEEE80211_HT_CAP_TX_STBC 0x0080
761#define IEEE80211_HT_CAP_RX_STBC 0x0300
762#define IEEE80211_HT_CAP_DELAY_BA 0x0400
763#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
764#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
765#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
766#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
767#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
768
769/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
770#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
771#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
772
703/** 773/**
704 * struct ieee80211_ht_cap - HT additional information 774 * struct ieee80211_ht_info - HT information
705 * 775 *
706 * This structure refers to "HT information element" as 776 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 777 * described in 802.11n D5.0 7.3.2.58
708 */ 778 */
709struct ieee80211_ht_addt_info { 779struct ieee80211_ht_info {
710 u8 control_chan; 780 u8 control_chan;
711 u8 ht_param; 781 u8 ht_param;
712 __le16 operation_mode; 782 __le16 operation_mode;
@@ -714,36 +784,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 784 u8 basic_set[16];
715} __attribute__ ((packed)); 785} __attribute__ ((packed));
716 786
717/* 802.11n HT capabilities masks */ 787/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 788#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 789#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 790#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 791#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 792#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 793#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 794#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 795#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 796
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 797/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 798#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 799#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 800#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 801#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 802#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 803#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 804#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 805
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 806/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 807#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 808#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 809#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 810#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 811#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 812#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 813
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 814
748/* block-ack parameters */ 815/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 816#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -769,7 +836,6 @@ struct ieee80211_ht_addt_info {
769/* Authentication algorithms */ 836/* Authentication algorithms */
770#define WLAN_AUTH_OPEN 0 837#define WLAN_AUTH_OPEN 0
771#define WLAN_AUTH_SHARED_KEY 1 838#define WLAN_AUTH_SHARED_KEY 1
772#define WLAN_AUTH_FAST_BSS_TRANSITION 2
773#define WLAN_AUTH_LEAP 128 839#define WLAN_AUTH_LEAP 128
774 840
775#define WLAN_AUTH_CHALLENGE_LEN 128 841#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -949,7 +1015,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1015 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1016 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1017 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1018 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1019 /* 802.11i */
954 WLAN_EID_RSN = 48, 1020 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1021 WLAN_EID_WPA = 221,
@@ -976,6 +1042,68 @@ enum ieee80211_spectrum_mgmt_actioncode {
976 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1042 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
977}; 1043};
978 1044
1045/*
1046 * IEEE 802.11-2007 7.3.2.9 Country information element
1047 *
1048 * Minimum length is 8 octets, ie len must be evenly
1049 * divisible by 2
1050 */
1051
1052/* Although the spec says 8 I'm seeing 6 in practice */
1053#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1054
1055/*
1056 * For regulatory extension stuff see IEEE 802.11-2007
1057 * Annex I (page 1141) and Annex J (page 1147). Also
1058 * review 7.3.2.9.
1059 *
1060 * When dot11RegulatoryClassesRequired is true and the
1061 * first_channel/reg_extension_id is >= 201 then the IE
1062 * compromises of the 'ext' struct represented below:
1063 *
1064 * - Regulatory extension ID - when generating IE this just needs
1065 * to be monotonically increasing for each triplet passed in
1066 * the IE
1067 * - Regulatory class - index into set of rules
1068 * - Coverage class - index into air propagation time (Table 7-27),
1069 * in microseconds, you can compute the air propagation time from
1070 * the index by multiplying by 3, so index 10 yields a propagation
1071 * of 10 us. Valid values are 0-31, values 32-255 are not defined
1072 * yet. A value of 0 inicates air propagation of <= 1 us.
1073 *
1074 * See also Table I.2 for Emission limit sets and table
1075 * I.3 for Behavior limit sets. Table J.1 indicates how to map
1076 * a reg_class to an emission limit set and behavior limit set.
1077 */
1078#define IEEE80211_COUNTRY_EXTENSION_ID 201
1079
1080/*
1081 * Channels numbers in the IE must be monotonically increasing
1082 * if dot11RegulatoryClassesRequired is not true.
1083 *
1084 * If dot11RegulatoryClassesRequired is true consecutive
1085 * subband triplets following a regulatory triplet shall
1086 * have monotonically increasing first_channel number fields.
1087 *
1088 * Channel numbers shall not overlap.
1089 *
1090 * Note that max_power is signed.
1091 */
1092struct ieee80211_country_ie_triplet {
1093 union {
1094 struct {
1095 u8 first_channel;
1096 u8 num_channels;
1097 s8 max_power;
1098 } __attribute__ ((packed)) chans;
1099 struct {
1100 u8 reg_extension_id;
1101 u8 reg_class;
1102 u8 coverage_class;
1103 } __attribute__ ((packed)) ext;
1104 };
1105} __attribute__ ((packed));
1106
979/* BACK action code */ 1107/* BACK action code */
980enum ieee80211_back_actioncode { 1108enum ieee80211_back_actioncode {
981 WLAN_ACTION_ADDBA_REQ = 0, 1109 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1057,4 +1185,4 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1057 return hdr->addr1; 1185 return hdr->addr1;
1058} 1186}
1059 1187
1060#endif /* IEEE80211_H */ 1188#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 65246846c844..2a6e29620a96 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
65#define IFF_BONDING 0x20 /* bonding master or slave */ 65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
68 69
69#define IF_GET_IFACE 0x0001 /* for querying only */ 70#define IF_GET_IFACE 0x0001 /* for querying only */
70#define IF_GET_PROTO 0x0002 71#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 4d3401812e6c..5ff89809a581 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,9 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89 89
90#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
92
90#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 93#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
91#define ARPHRD_NONE 0xFFFE /* zero header length */ 94#define ARPHRD_NONE 0xFFFE /* zero header length */
92 95
diff --git a/include/linux/in.h b/include/linux/in.h
index db458beef19d..d60122a3a088 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -80,6 +80,10 @@ struct in_addr {
80/* BSD compatibility */ 80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
82 82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
83/* IP_MTU_DISCOVER values */ 87/* IP_MTU_DISCOVER values */
84#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 88#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
85#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 89#define IP_PMTUDISC_WANT 1 /* Use per route hints */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 23fd8909b9e5..959f5522d10a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -57,7 +57,6 @@ extern struct nsproxy init_nsproxy;
57 .mnt_ns = NULL, \ 57 .mnt_ns = NULL, \
58 INIT_NET_NS(net_ns) \ 58 INIT_NET_NS(net_ns) \
59 INIT_IPC_NS(ipc_ns) \ 59 INIT_IPC_NS(ipc_ns) \
60 .user_ns = &init_user_ns, \
61} 60}
62 61
63#define INIT_SIGHAND(sighand) { \ 62#define INIT_SIGHAND(sighand) { \
@@ -113,6 +112,8 @@ extern struct group_info init_groups;
113# define CAP_INIT_BSET CAP_INIT_EFF_SET 112# define CAP_INIT_BSET CAP_INIT_EFF_SET
114#endif 113#endif
115 114
115extern struct cred init_cred;
116
116/* 117/*
117 * INIT_TASK is used to set up the first task table, touch at 118 * INIT_TASK is used to set up the first task table, touch at
118 * your own risk!. Base=0, limit=0x1fffff (=2MB) 119 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -147,13 +148,10 @@ extern struct group_info init_groups;
147 .children = LIST_HEAD_INIT(tsk.children), \ 148 .children = LIST_HEAD_INIT(tsk.children), \
148 .sibling = LIST_HEAD_INIT(tsk.sibling), \ 149 .sibling = LIST_HEAD_INIT(tsk.sibling), \
149 .group_leader = &tsk, \ 150 .group_leader = &tsk, \
150 .group_info = &init_groups, \ 151 .real_cred = &init_cred, \
151 .cap_effective = CAP_INIT_EFF_SET, \ 152 .cred = &init_cred, \
152 .cap_inheritable = CAP_INIT_INH_SET, \ 153 .cred_exec_mutex = \
153 .cap_permitted = CAP_FULL_SET, \ 154 __MUTEX_INITIALIZER(tsk.cred_exec_mutex), \
154 .cap_bset = CAP_INIT_BSET, \
155 .securebits = SECUREBITS_DEFAULT, \
156 .user = INIT_USER, \
157 .comm = "swapper", \ 155 .comm = "swapper", \
158 .thread = INIT_THREAD, \ 156 .thread = INIT_THREAD, \
159 .fs = &init_fs, \ 157 .fs = &init_fs, \
diff --git a/include/linux/input.h b/include/linux/input.h
index 5341e8251f8c..9a6355f74db2 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -659,6 +659,8 @@ struct input_absinfo {
659#define SW_RADIO SW_RFKILL_ALL /* deprecated */ 659#define SW_RADIO SW_RFKILL_ALL /* deprecated */
660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ 660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
661#define SW_DOCK 0x05 /* set = plugged into dock */ 661#define SW_DOCK 0x05 /* set = plugged into dock */
662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
662#define SW_MAX 0x0f 664#define SW_MAX 0x0f
663#define SW_CNT (SW_MAX+1) 665#define SW_CNT (SW_MAX+1)
664 666
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 641e026eee8f..0b816cae533e 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -278,6 +278,7 @@ struct ipv6_pinfo {
278 struct in6_addr saddr; 278 struct in6_addr saddr;
279 struct in6_addr rcv_saddr; 279 struct in6_addr rcv_saddr;
280 struct in6_addr daddr; 280 struct in6_addr daddr;
281 struct in6_pktinfo sticky_pktinfo;
281 struct in6_addr *daddr_cache; 282 struct in6_addr *daddr_cache;
282#ifdef CONFIG_IPV6_SUBTREES 283#ifdef CONFIG_IPV6_SUBTREES
283 struct in6_addr *saddr_cache; 284 struct in6_addr *saddr_cache;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index dc7e0d0a6474..6002ae76785c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -361,18 +361,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
361 ((unsigned char *)&addr)[3] 361 ((unsigned char *)&addr)[3]
362#define NIPQUAD_FMT "%u.%u.%u.%u" 362#define NIPQUAD_FMT "%u.%u.%u.%u"
363 363
364#define NIP6(addr) \
365 ntohs((addr).s6_addr16[0]), \
366 ntohs((addr).s6_addr16[1]), \
367 ntohs((addr).s6_addr16[2]), \
368 ntohs((addr).s6_addr16[3]), \
369 ntohs((addr).s6_addr16[4]), \
370 ntohs((addr).s6_addr16[5]), \
371 ntohs((addr).s6_addr16[6]), \
372 ntohs((addr).s6_addr16[7])
373#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
374#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
375
376#if defined(__LITTLE_ENDIAN) 364#if defined(__LITTLE_ENDIAN)
377#define HIPQUAD(addr) \ 365#define HIPQUAD(addr) \
378 ((unsigned char *)&addr)[3], \ 366 ((unsigned char *)&addr)[3], \
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 17f76fc05173..adc34f2c6eff 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -100,6 +100,10 @@ struct kimage {
100#define KEXEC_TYPE_DEFAULT 0 100#define KEXEC_TYPE_DEFAULT 0
101#define KEXEC_TYPE_CRASH 1 101#define KEXEC_TYPE_CRASH 1
102 unsigned int preserve_context : 1; 102 unsigned int preserve_context : 1;
103
104#ifdef ARCH_HAS_KIMAGE_ARCH
105 struct kimage_arch arch;
106#endif
103}; 107};
104 108
105 109
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h
deleted file mode 100644
index e8b8a7a5c496..000000000000
--- a/include/linux/key-ui.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* key-ui.h: key userspace interface stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_KEY_UI_H
13#define _LINUX_KEY_UI_H
14
15#include <linux/key.h>
16
17/* the key tree */
18extern struct rb_root key_serial_tree;
19extern spinlock_t key_serial_lock;
20
21/* required permissions */
22#define KEY_VIEW 0x01 /* require permission to view attributes */
23#define KEY_READ 0x02 /* require permission to read content */
24#define KEY_WRITE 0x04 /* require permission to update / modify */
25#define KEY_SEARCH 0x08 /* require permission to search (keyring) or find (key) */
26#define KEY_LINK 0x10 /* require permission to link */
27#define KEY_SETATTR 0x20 /* require permission to change attributes */
28#define KEY_ALL 0x3f /* all the above permissions */
29
30/*
31 * the keyring payload contains a list of the keys to which the keyring is
32 * subscribed
33 */
34struct keyring_list {
35 struct rcu_head rcu; /* RCU deletion hook */
36 unsigned short maxkeys; /* max keys this list can hold */
37 unsigned short nkeys; /* number of keys currently held */
38 unsigned short delkey; /* key to be unlinked by RCU */
39 struct key *keys[0];
40};
41
42/*
43 * check to see whether permission is granted to use a key in the desired way
44 */
45extern int key_task_permission(const key_ref_t key_ref,
46 struct task_struct *context,
47 key_perm_t perm);
48
49static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
50{
51 return key_task_permission(key_ref, current, perm);
52}
53
54extern key_ref_t lookup_user_key(struct task_struct *context,
55 key_serial_t id, int create, int partial,
56 key_perm_t perm);
57
58extern long join_session_keyring(const char *name);
59
60extern struct key_type *key_type_lookup(const char *type);
61extern void key_type_put(struct key_type *ktype);
62
63#define key_negative_timeout 60 /* default timeout on a negative key's existence */
64
65
66#endif /* _LINUX_KEY_UI_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 1b70e35a71e3..21d32a142c00 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -73,6 +73,7 @@ struct key;
73struct seq_file; 73struct seq_file;
74struct user_struct; 74struct user_struct;
75struct signal_struct; 75struct signal_struct;
76struct cred;
76 77
77struct key_type; 78struct key_type;
78struct key_owner; 79struct key_owner;
@@ -181,7 +182,7 @@ struct key {
181extern struct key *key_alloc(struct key_type *type, 182extern struct key *key_alloc(struct key_type *type,
182 const char *desc, 183 const char *desc,
183 uid_t uid, gid_t gid, 184 uid_t uid, gid_t gid,
184 struct task_struct *ctx, 185 const struct cred *cred,
185 key_perm_t perm, 186 key_perm_t perm,
186 unsigned long flags); 187 unsigned long flags);
187 188
@@ -249,7 +250,7 @@ extern int key_unlink(struct key *keyring,
249 struct key *key); 250 struct key *key);
250 251
251extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 252extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
252 struct task_struct *ctx, 253 const struct cred *cred,
253 unsigned long flags, 254 unsigned long flags,
254 struct key *dest); 255 struct key *dest);
255 256
@@ -276,24 +277,11 @@ extern ctl_table key_sysctls[];
276/* 277/*
277 * the userspace interface 278 * the userspace interface
278 */ 279 */
279extern void switch_uid_keyring(struct user_struct *new_user); 280extern int install_thread_keyring_to_cred(struct cred *cred);
280extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
281extern int copy_thread_group_keys(struct task_struct *tsk);
282extern void exit_keys(struct task_struct *tsk);
283extern void exit_thread_group_keys(struct signal_struct *tg);
284extern int suid_keys(struct task_struct *tsk);
285extern int exec_keys(struct task_struct *tsk);
286extern void key_fsuid_changed(struct task_struct *tsk); 281extern void key_fsuid_changed(struct task_struct *tsk);
287extern void key_fsgid_changed(struct task_struct *tsk); 282extern void key_fsgid_changed(struct task_struct *tsk);
288extern void key_init(void); 283extern void key_init(void);
289 284
290#define __install_session_keyring(tsk, keyring) \
291({ \
292 struct key *old_session = tsk->signal->session_keyring; \
293 tsk->signal->session_keyring = keyring; \
294 old_session; \
295})
296
297#else /* CONFIG_KEYS */ 285#else /* CONFIG_KEYS */
298 286
299#define key_validate(k) 0 287#define key_validate(k) 0
@@ -302,17 +290,9 @@ extern void key_init(void);
302#define key_revoke(k) do { } while(0) 290#define key_revoke(k) do { } while(0)
303#define key_put(k) do { } while(0) 291#define key_put(k) do { } while(0)
304#define key_ref_put(k) do { } while(0) 292#define key_ref_put(k) do { } while(0)
305#define make_key_ref(k, p) ({ NULL; }) 293#define make_key_ref(k, p) NULL
306#define key_ref_to_ptr(k) ({ NULL; }) 294#define key_ref_to_ptr(k) NULL
307#define is_key_possessed(k) 0 295#define is_key_possessed(k) 0
308#define switch_uid_keyring(u) do { } while(0)
309#define __install_session_keyring(t, k) ({ NULL; })
310#define copy_keys(f,t) 0
311#define copy_thread_group_keys(t) 0
312#define exit_keys(t) do { } while(0)
313#define exit_thread_group_keys(tg) do { } while(0)
314#define suid_keys(t) do { } while(0)
315#define exec_keys(t) do { } while(0)
316#define key_fsuid_changed(t) do { } while(0) 296#define key_fsuid_changed(t) do { } while(0)
317#define key_fsgid_changed(t) do { } while(0) 297#define key_fsgid_changed(t) do { } while(0)
318#define key_init() do { } while(0) 298#define key_init() do { } while(0)
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 656ee6b77a4a..c0688eb72093 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -1,6 +1,6 @@
1/* keyctl.h: keyctl command IDs 1/* keyctl.h: keyctl command IDs
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ 22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
23#define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */
23 24
24/* request-key default keyrings */ 25/* request-key default keyrings */
25#define KEY_REQKEY_DEFL_NO_CHANGE -1 26#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -30,6 +31,7 @@
30#define KEY_REQKEY_DEFL_USER_KEYRING 4 31#define KEY_REQKEY_DEFL_USER_KEYRING 4
31#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 32#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5
32#define KEY_REQKEY_DEFL_GROUP_KEYRING 6 33#define KEY_REQKEY_DEFL_GROUP_KEYRING 6
34#define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7
33 35
34/* keyctl commands */ 36/* keyctl commands */
35#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ 37#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 9fd1f859021b..fee9e59649c1 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -64,14 +64,6 @@
64 name: 64 name:
65#endif 65#endif
66 66
67#define KPROBE_ENTRY(name) \
68 .pushsection .kprobes.text, "ax"; \
69 ENTRY(name)
70
71#define KPROBE_END(name) \
72 END(name); \
73 .popsection
74
75#ifndef END 67#ifndef END
76#define END(name) \ 68#define END(name) \
77 .size name, .-name 69 .size name, .-name
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
new file mode 100644
index 000000000000..93150ecf3ea4
--- /dev/null
+++ b/include/linux/list_nulls.h
@@ -0,0 +1,94 @@
1#ifndef _LINUX_LIST_NULLS_H
2#define _LINUX_LIST_NULLS_H
3
4/*
5 * Special version of lists, where end of list is not a NULL pointer,
6 * but a 'nulls' marker, which can have many different values.
7 * (up to 2^31 different values guaranteed on all platforms)
8 *
9 * In the standard hlist, termination of a list is the NULL pointer.
10 * In this special 'nulls' variant, we use the fact that objects stored in
11 * a list are aligned on a word (4 or 8 bytes alignment).
12 * We therefore use the last significant bit of 'ptr' :
13 * Set to 1 : This is a 'nulls' end-of-list marker (ptr >> 1)
14 * Set to 0 : This is a pointer to some object (ptr)
15 */
16
17struct hlist_nulls_head {
18 struct hlist_nulls_node *first;
19};
20
21struct hlist_nulls_node {
22 struct hlist_nulls_node *next, **pprev;
23};
24#define INIT_HLIST_NULLS_HEAD(ptr, nulls) \
25 ((ptr)->first = (struct hlist_nulls_node *) (1UL | (((long)nulls) << 1)))
26
27#define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
28/**
29 * ptr_is_a_nulls - Test if a ptr is a nulls
30 * @ptr: ptr to be tested
31 *
32 */
33static inline int is_a_nulls(const struct hlist_nulls_node *ptr)
34{
35 return ((unsigned long)ptr & 1);
36}
37
38/**
39 * get_nulls_value - Get the 'nulls' value of the end of chain
40 * @ptr: end of chain
41 *
42 * Should be called only if is_a_nulls(ptr);
43 */
44static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr)
45{
46 return ((unsigned long)ptr) >> 1;
47}
48
49static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
50{
51 return !h->pprev;
52}
53
54static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
55{
56 return is_a_nulls(h->first);
57}
58
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{
61 struct hlist_nulls_node *next = n->next;
62 struct hlist_nulls_node **pprev = n->pprev;
63 *pprev = next;
64 if (!is_a_nulls(next))
65 next->pprev = pprev;
66}
67
68/**
69 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor.
71 * @pos: the &struct hlist_node to use as a loop cursor.
72 * @head: the head for your list.
73 * @member: the name of the hlist_node within the struct.
74 *
75 */
76#define hlist_nulls_for_each_entry(tpos, pos, head, member) \
77 for (pos = (head)->first; \
78 (!is_a_nulls(pos)) && \
79 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
80 pos = pos->next)
81
82/**
83 * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from current point
84 * @tpos: the type * to use as a loop cursor.
85 * @pos: the &struct hlist_node to use as a loop cursor.
86 * @member: the name of the hlist_node within the struct.
87 *
88 */
89#define hlist_nulls_for_each_entry_from(tpos, pos, member) \
90 for (; (!is_a_nulls(pos)) && \
91 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
92 pos = pos->next)
93
94#endif
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 889196c7fbb1..b85e74ca782f 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -12,6 +12,7 @@
12 * See the file COPYING for more details. 12 * See the file COPYING for more details.
13 */ 13 */
14 14
15#include <stdarg.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17struct module; 18struct module;
@@ -48,10 +49,28 @@ struct marker {
48 void (*call)(const struct marker *mdata, void *call_private, ...); 49 void (*call)(const struct marker *mdata, void *call_private, ...);
49 struct marker_probe_closure single; 50 struct marker_probe_closure single;
50 struct marker_probe_closure *multi; 51 struct marker_probe_closure *multi;
52 const char *tp_name; /* Optional tracepoint name */
53 void *tp_cb; /* Optional tracepoint callback */
51} __attribute__((aligned(8))); 54} __attribute__((aligned(8)));
52 55
53#ifdef CONFIG_MARKERS 56#ifdef CONFIG_MARKERS
54 57
58#define _DEFINE_MARKER(name, tp_name_str, tp_cb, format) \
59 static const char __mstrtab_##name[] \
60 __attribute__((section("__markers_strings"))) \
61 = #name "\0" format; \
62 static struct marker __mark_##name \
63 __attribute__((section("__markers"), aligned(8))) = \
64 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
65 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\
66 NULL, tp_name_str, tp_cb }
67
68#define DEFINE_MARKER(name, format) \
69 _DEFINE_MARKER(name, NULL, NULL, format)
70
71#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
72 _DEFINE_MARKER(name, #tp_name, tp_cb, format)
73
55/* 74/*
56 * Note : the empty asm volatile with read constraint is used here instead of a 75 * Note : the empty asm volatile with read constraint is used here instead of a
57 * "used" attribute to fix a gcc 4.1.x bug. 76 * "used" attribute to fix a gcc 4.1.x bug.
@@ -65,14 +84,7 @@ struct marker {
65 */ 84 */
66#define __trace_mark(generic, name, call_private, format, args...) \ 85#define __trace_mark(generic, name, call_private, format, args...) \
67 do { \ 86 do { \
68 static const char __mstrtab_##name[] \ 87 DEFINE_MARKER(name, format); \
69 __attribute__((section("__markers_strings"))) \
70 = #name "\0" format; \
71 static struct marker __mark_##name \
72 __attribute__((section("__markers"), aligned(8))) = \
73 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
74 0, 0, marker_probe_cb, \
75 { __mark_empty_function, NULL}, NULL }; \
76 __mark_check_format(format, ## args); \ 88 __mark_check_format(format, ## args); \
77 if (unlikely(__mark_##name.state)) { \ 89 if (unlikely(__mark_##name.state)) { \
78 (*__mark_##name.call) \ 90 (*__mark_##name.call) \
@@ -80,14 +92,39 @@ struct marker {
80 } \ 92 } \
81 } while (0) 93 } while (0)
82 94
95#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
96 do { \
97 void __check_tp_type(void) \
98 { \
99 register_trace_##tp_name(tp_cb); \
100 } \
101 DEFINE_MARKER_TP(name, tp_name, tp_cb, format); \
102 __mark_check_format(format, ## args); \
103 (*__mark_##name.call)(&__mark_##name, call_private, \
104 ## args); \
105 } while (0)
106
83extern void marker_update_probe_range(struct marker *begin, 107extern void marker_update_probe_range(struct marker *begin,
84 struct marker *end); 108 struct marker *end);
109
110#define GET_MARKER(name) (__mark_##name)
111
85#else /* !CONFIG_MARKERS */ 112#else /* !CONFIG_MARKERS */
113#define DEFINE_MARKER(name, tp_name, tp_cb, format)
86#define __trace_mark(generic, name, call_private, format, args...) \ 114#define __trace_mark(generic, name, call_private, format, args...) \
87 __mark_check_format(format, ## args) 115 __mark_check_format(format, ## args)
116#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
117 do { \
118 void __check_tp_type(void) \
119 { \
120 register_trace_##tp_name(tp_cb); \
121 } \
122 __mark_check_format(format, ## args); \
123 } while (0)
88static inline void marker_update_probe_range(struct marker *begin, 124static inline void marker_update_probe_range(struct marker *begin,
89 struct marker *end) 125 struct marker *end)
90{ } 126{ }
127#define GET_MARKER(name)
91#endif /* CONFIG_MARKERS */ 128#endif /* CONFIG_MARKERS */
92 129
93/** 130/**
@@ -117,6 +154,20 @@ static inline void marker_update_probe_range(struct marker *begin,
117 __trace_mark(1, name, NULL, format, ## args) 154 __trace_mark(1, name, NULL, format, ## args)
118 155
119/** 156/**
157 * trace_mark_tp - Marker in a tracepoint callback
158 * @name: marker name, not quoted.
159 * @tp_name: tracepoint name, not quoted.
160 * @tp_cb: tracepoint callback. Should have an associated global symbol so it
161 * is not optimized away by the compiler (should not be static).
162 * @format: format string
163 * @args...: variable argument list
164 *
165 * Places a marker in a tracepoint callback.
166 */
167#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \
168 __trace_mark_tp(name, NULL, tp_name, tp_cb, format, ## args)
169
170/**
120 * MARK_NOARGS - Format string for a marker with no argument. 171 * MARK_NOARGS - Format string for a marker with no argument.
121 */ 172 */
122#define MARK_NOARGS " " 173#define MARK_NOARGS " "
@@ -136,8 +187,6 @@ extern marker_probe_func __mark_empty_function;
136 187
137extern void marker_probe_cb(const struct marker *mdata, 188extern void marker_probe_cb(const struct marker *mdata,
138 void *call_private, ...); 189 void *call_private, ...);
139extern void marker_probe_cb_noarg(const struct marker *mdata,
140 void *call_private, ...);
141 190
142/* 191/*
143 * Connect a probe to a marker. 192 * Connect a probe to a marker.
@@ -162,8 +211,10 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
162 211
163/* 212/*
164 * marker_synchronize_unregister must be called between the last marker probe 213 * marker_synchronize_unregister must be called between the last marker probe
165 * unregistration and the end of module exit to make sure there is no caller 214 * unregistration and the first one of
166 * executing a probe when it is freed. 215 * - the end of module exit function
216 * - the free of any resource used by the probes
217 * to ensure the code and data are valid for any possibly running probes.
167 */ 218 */
168#define marker_synchronize_unregister() synchronize_sched() 219#define marker_synchronize_unregister() synchronize_sched()
169 220
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 000000000000..e9d3fdfe41d7
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,25 @@
1/*
2 * MDIO-GPIO bus platform data structures
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MDIO_GPIO_H
12#define __LINUX_MDIO_GPIO_H
13
14#include <linux/mdio-bitbang.h>
15
16struct mdio_gpio_platform_data {
17 /* GPIO numbers for bus pins */
18 unsigned int mdc;
19 unsigned int mdio;
20
21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR];
23};
24
25#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index 217bb22ebb8e..af95a1d2f3a1 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC 2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC
3 * 3 *
4 * Copyright 2007 Wolfson Microelectronics PLC 4 * Copyright 2007, 2008 Wolfson Microelectronics PLC
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -70,9 +70,9 @@
70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ 70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
71 71
72#define WM8350_VMID_OFF 0 72#define WM8350_VMID_OFF 0
73#define WM8350_VMID_500K 1 73#define WM8350_VMID_300K 1
74#define WM8350_VMID_100K 2 74#define WM8350_VMID_50K 2
75#define WM8350_VMID_10K 3 75#define WM8350_VMID_5K 3
76 76
77/* 77/*
78 * R40 (0x28) - Clock Control 1 78 * R40 (0x28) - Clock Control 1
@@ -591,8 +591,38 @@
591#define WM8350_IRQ_CODEC_MICSCD 41 591#define WM8350_IRQ_CODEC_MICSCD 41
592#define WM8350_IRQ_CODEC_MICD 42 592#define WM8350_IRQ_CODEC_MICD 42
593 593
594/*
595 * WM8350 Platform data.
596 *
597 * This must be initialised per platform for best audio performance.
598 * Please see WM8350 datasheet for information.
599 */
600struct wm8350_audio_platform_data {
601 int vmid_discharge_msecs; /* VMID --> OFF discharge time */
602 int drain_msecs; /* OFF drain time */
603 int cap_discharge_msecs; /* Cap ON (from OFF) discharge time */
604 int vmid_charge_msecs; /* vmid power up time */
605 u32 vmid_s_curve:2; /* vmid enable s curve speed */
606 u32 dis_out4:2; /* out4 discharge speed */
607 u32 dis_out3:2; /* out3 discharge speed */
608 u32 dis_out2:2; /* out2 discharge speed */
609 u32 dis_out1:2; /* out1 discharge speed */
610 u32 vroi_out4:1; /* out4 tie off */
611 u32 vroi_out3:1; /* out3 tie off */
612 u32 vroi_out2:1; /* out2 tie off */
613 u32 vroi_out1:1; /* out1 tie off */
614 u32 vroi_enable:1; /* enable tie off */
615 u32 codec_current_on:2; /* current level ON */
616 u32 codec_current_standby:2; /* current level STANDBY */
617 u32 codec_current_charge:2; /* codec current @ vmid charge */
618};
619
620struct snd_soc_codec;
621
594struct wm8350_codec { 622struct wm8350_codec {
595 struct platform_device *pdev; 623 struct platform_device *pdev;
624 struct snd_soc_codec *codec;
625 struct wm8350_audio_platform_data *platform_data;
596}; 626};
597 627
598#endif 628#endif
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 151b7e0182c7..ad748588faf1 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -135,6 +135,10 @@
135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ 135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ 136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
137 137
138/* Flow control flags */
139#define FLOW_CTRL_TX 0x01
140#define FLOW_CTRL_RX 0x02
141
138/* This structure is used in all SIOCxMIIxxx ioctl calls */ 142/* This structure is used in all SIOCxMIIxxx ioctl calls */
139struct mii_ioctl_data { 143struct mii_ioctl_data {
140 __u16 phy_id; 144 __u16 phy_id;
@@ -235,5 +239,34 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
235 return 0; 239 return 0;
236} 240}
237 241
242/**
243 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register
246 *
247 * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
248 */
249static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{
251 u8 cap = 0;
252
253 if (lcladv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) {
255 if (rmtadv & LPA_PAUSE_CAP)
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
257 else if (rmtadv & LPA_PAUSE_ASYM)
258 cap = FLOW_CTRL_RX;
259 } else {
260 if (rmtadv & LPA_PAUSE_CAP)
261 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
262 }
263 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
264 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
265 cap = FLOW_CTRL_TX;
266 }
267
268 return cap;
269}
270
238#endif /* __KERNEL__ */ 271#endif /* __KERNEL__ */
239#endif /* __LINUX_MII_H__ */ 272#endif /* __LINUX_MII_H__ */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 371086fd946f..8f659cc29960 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -206,6 +206,7 @@ struct mlx4_caps {
206 int reserved_cqs; 206 int reserved_cqs;
207 int num_eqs; 207 int num_eqs;
208 int reserved_eqs; 208 int reserved_eqs;
209 int num_comp_vectors;
209 int num_mpts; 210 int num_mpts;
210 int num_mtt_segs; 211 int num_mtt_segs;
211 int fmr_reserved_mtts; 212 int fmr_reserved_mtts;
@@ -328,6 +329,7 @@ struct mlx4_cq {
328 int arm_sn; 329 int arm_sn;
329 330
330 int cqn; 331 int cqn;
332 unsigned vector;
331 333
332 atomic_t refcount; 334 atomic_t refcount;
333 struct completion free; 335 struct completion free;
@@ -437,7 +439,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
437 439
438int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 440int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
439 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 441 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
440 int collapsed); 442 unsigned vector, int collapsed);
441void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 443void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
442 444
443int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 445int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ffee2f743418..aaa8b843be28 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -145,6 +145,23 @@ extern pgprot_t protection_map[16];
145#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 145#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
146#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 146#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
147 147
148/*
149 * This interface is used by x86 PAT code to identify a pfn mapping that is
150 * linear over entire vma. This is to optimize PAT code that deals with
151 * marking the physical region with a particular prot. This is not for generic
152 * mm use. Note also that this check will not work if the pfn mapping is
153 * linear for a vma starting at physical address 0. In which case PAT code
154 * falls back to slow path of reserving physical range page by page.
155 */
156static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
157{
158 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff);
159}
160
161static inline int is_pfn_mapping(struct vm_area_struct *vma)
162{
163 return (vma->vm_flags & VM_PFNMAP);
164}
148 165
149/* 166/*
150 * vm_fault is filled by the the pagefault handler and passed to the vma's 167 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -781,6 +798,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
781 struct vm_area_struct *vma); 798 struct vm_area_struct *vma);
782void unmap_mapping_range(struct address_space *mapping, 799void unmap_mapping_range(struct address_space *mapping,
783 loff_t const holebegin, loff_t const holelen, int even_cows); 800 loff_t const holebegin, loff_t const holelen, int even_cows);
801int follow_phys(struct vm_area_struct *vma, unsigned long address,
802 unsigned int flags, unsigned long *prot, resource_size_t *phys);
784int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 803int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
785 void *buf, int len, int write); 804 void *buf, int len, int write);
786 805
@@ -1286,5 +1305,7 @@ int vmemmap_populate_basepages(struct page *start_page,
1286int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1305int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1287void vmemmap_populate_print_last(void); 1306void vmemmap_populate_print_last(void);
1288 1307
1308extern void *alloc_locked_buffer(size_t size);
1309extern void free_locked_buffer(void *buffer, size_t size);
1289#endif /* __KERNEL__ */ 1310#endif /* __KERNEL__ */
1290#endif /* _LINUX_MM_H */ 1311#endif /* _LINUX_MM_H */
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6f4c180179e2..5375faca1f72 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -117,6 +117,7 @@ struct sioc_mif_req6
117 117
118#include <linux/pim.h> 118#include <linux/pim.h>
119#include <linux/skbuff.h> /* for struct sk_buff_head */ 119#include <linux/skbuff.h> /* for struct sk_buff_head */
120#include <net/net_namespace.h>
120 121
121#ifdef CONFIG_IPV6_MROUTE 122#ifdef CONFIG_IPV6_MROUTE
122static inline int ip6_mroute_opt(int opt) 123static inline int ip6_mroute_opt(int opt)
@@ -187,6 +188,9 @@ struct mif_device
187struct mfc6_cache 188struct mfc6_cache
188{ 189{
189 struct mfc6_cache *next; /* Next entry on cache line */ 190 struct mfc6_cache *next; /* Next entry on cache line */
191#ifdef CONFIG_NET_NS
192 struct net *mfc6_net;
193#endif
190 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 194 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
191 struct in6_addr mf6c_origin; /* Source of packet */ 195 struct in6_addr mf6c_origin; /* Source of packet */
192 mifi_t mf6c_parent; /* Source interface */ 196 mifi_t mf6c_parent; /* Source interface */
@@ -209,6 +213,18 @@ struct mfc6_cache
209 } mfc_un; 213 } mfc_un;
210}; 214};
211 215
216static inline
217struct net *mfc6_net(const struct mfc6_cache *mfc)
218{
219 return read_pnet(&mfc->mfc6_net);
220}
221
222static inline
223void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
224{
225 write_pnet(&mfc->mfc6_net, hold_net(net));
226}
227
212#define MFC_STATIC 1 228#define MFC_STATIC 1
213#define MFC_NOTIFY 2 229#define MFC_NOTIFY 2
214 230
@@ -229,13 +245,17 @@ struct mfc6_cache
229 245
230#ifdef __KERNEL__ 246#ifdef __KERNEL__
231struct rtmsg; 247struct rtmsg;
232extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 248extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
249 struct rtmsg *rtm, int nowait);
233 250
234#ifdef CONFIG_IPV6_MROUTE 251#ifdef CONFIG_IPV6_MROUTE
235extern struct sock *mroute6_socket; 252static inline struct sock *mroute6_socket(struct net *net)
253{
254 return net->ipv6.mroute6_sk;
255}
236extern int ip6mr_sk_done(struct sock *sk); 256extern int ip6mr_sk_done(struct sock *sk);
237#else 257#else
238#define mroute6_socket NULL 258static inline struct sock *mroute6_socket(struct net *net) { return NULL; }
239static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 259static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
240#endif 260#endif
241#endif 261#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9d77b1d7dca8..41e1224651cf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,9 @@
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h> 45#include <net/dsa.h>
46#ifdef CONFIG_DCB
47#include <net/dcbnl.h>
48#endif
46 49
47struct vlan_group; 50struct vlan_group;
48struct ethtool_ops; 51struct ethtool_ops;
@@ -311,14 +314,16 @@ struct napi_struct {
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
313 struct net_device *dev; 316 struct net_device *dev;
314 struct list_head dev_list;
315#endif 317#endif
318 struct list_head dev_list;
319 struct sk_buff *gro_list;
316}; 320};
317 321
318enum 322enum
319{ 323{
320 NAPI_STATE_SCHED, /* Poll is scheduled */ 324 NAPI_STATE_SCHED, /* Poll is scheduled */
321 NAPI_STATE_DISABLE, /* Disable pending */ 325 NAPI_STATE_DISABLE, /* Disable pending */
326 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
322}; 327};
323 328
324extern void __napi_schedule(struct napi_struct *n); 329extern void __napi_schedule(struct napi_struct *n);
@@ -372,22 +377,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
372 * 377 *
373 * Mark NAPI processing as complete. 378 * Mark NAPI processing as complete.
374 */ 379 */
375static inline void __napi_complete(struct napi_struct *n) 380extern void __napi_complete(struct napi_struct *n);
376{ 381extern void napi_complete(struct napi_struct *n);
377 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
378 list_del(&n->poll_list);
379 smp_mb__before_clear_bit();
380 clear_bit(NAPI_STATE_SCHED, &n->state);
381}
382
383static inline void napi_complete(struct napi_struct *n)
384{
385 unsigned long flags;
386
387 local_irq_save(flags);
388 __napi_complete(n);
389 local_irq_restore(flags);
390}
391 382
392/** 383/**
393 * napi_disable - prevent NAPI from scheduling 384 * napi_disable - prevent NAPI from scheduling
@@ -451,6 +442,147 @@ struct netdev_queue {
451 struct Qdisc *qdisc_sleeping; 442 struct Qdisc *qdisc_sleeping;
452} ____cacheline_aligned_in_smp; 443} ____cacheline_aligned_in_smp;
453 444
445
446/*
447 * This structure defines the management hooks for network devices.
448 * The following hooks can be defined; unless noted otherwise, they are
449 * optional and can be filled with a null pointer.
450 *
451 * int (*ndo_init)(struct net_device *dev);
452 * This function is called once when network device is registered.
453 * The network device can use this to any late stage initializaton
454 * or semantic validattion. It can fail with an error code which will
455 * be propogated back to register_netdev
456 *
457 * void (*ndo_uninit)(struct net_device *dev);
458 * This function is called when device is unregistered or when registration
459 * fails. It is not called if init fails.
460 *
461 * int (*ndo_open)(struct net_device *dev);
462 * This function is called when network device transistions to the up
463 * state.
464 *
465 * int (*ndo_stop)(struct net_device *dev);
466 * This function is called when network device transistions to the down
467 * state.
468 *
469 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
470 * Called when a packet needs to be transmitted.
471 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
472 * Required can not be NULL.
473 *
474 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
475 * Called to decide which queue to when device supports multiple
476 * transmit queues.
477 *
478 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
479 * This function is called to allow device receiver to make
480 * changes to configuration when multicast or promiscious is enabled.
481 *
482 * void (*ndo_set_rx_mode)(struct net_device *dev);
483 * This function is called device changes address list filtering.
484 *
485 * void (*ndo_set_multicast_list)(struct net_device *dev);
486 * This function is called when the multicast address list changes.
487 *
488 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
489 * This function is called when the Media Access Control address
490 * needs to be changed. If not this interface is not defined, the
491 * mac address can not be changed.
492 *
493 * int (*ndo_validate_addr)(struct net_device *dev);
494 * Test if Media Access Control address is valid for the device.
495 *
496 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
497 * Called when a user request an ioctl which can't be handled by
498 * the generic interface code. If not defined ioctl's return
499 * not supported error code.
500 *
501 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
502 * Used to set network devices bus interface parameters. This interface
503 * is retained for legacy reason, new devices should use the bus
504 * interface (PCI) for low level management.
505 *
506 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
507 * Called when a user wants to change the Maximum Transfer Unit
508 * of a device. If not defined, any request to change MTU will
509 * will return an error.
510 *
511 * void (*ndo_tx_timeout)(struct net_device *dev);
512 * Callback uses when the transmitter has not made any progress
513 * for dev->watchdog ticks.
514 *
515 * struct net_device_stats* (*get_stats)(struct net_device *dev);
516 * Called when a user wants to get the network device usage
517 * statistics. If not defined, the counters in dev->stats will
518 * be used.
519 *
520 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
521 * If device support VLAN receive accleration
522 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
523 * when vlan groups for the device changes. Note: grp is NULL
524 * if no vlan's groups are being used.
525 *
526 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
527 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
528 * this function is called when a VLAN id is registered.
529 *
530 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
531 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
532 * this function is called when a VLAN id is unregistered.
533 *
534 * void (*ndo_poll_controller)(struct net_device *dev);
535 */
536#define HAVE_NET_DEVICE_OPS
537struct net_device_ops {
538 int (*ndo_init)(struct net_device *dev);
539 void (*ndo_uninit)(struct net_device *dev);
540 int (*ndo_open)(struct net_device *dev);
541 int (*ndo_stop)(struct net_device *dev);
542 int (*ndo_start_xmit) (struct sk_buff *skb,
543 struct net_device *dev);
544 u16 (*ndo_select_queue)(struct net_device *dev,
545 struct sk_buff *skb);
546#define HAVE_CHANGE_RX_FLAGS
547 void (*ndo_change_rx_flags)(struct net_device *dev,
548 int flags);
549#define HAVE_SET_RX_MODE
550 void (*ndo_set_rx_mode)(struct net_device *dev);
551#define HAVE_MULTICAST
552 void (*ndo_set_multicast_list)(struct net_device *dev);
553#define HAVE_SET_MAC_ADDR
554 int (*ndo_set_mac_address)(struct net_device *dev,
555 void *addr);
556#define HAVE_VALIDATE_ADDR
557 int (*ndo_validate_addr)(struct net_device *dev);
558#define HAVE_PRIVATE_IOCTL
559 int (*ndo_do_ioctl)(struct net_device *dev,
560 struct ifreq *ifr, int cmd);
561#define HAVE_SET_CONFIG
562 int (*ndo_set_config)(struct net_device *dev,
563 struct ifmap *map);
564#define HAVE_CHANGE_MTU
565 int (*ndo_change_mtu)(struct net_device *dev,
566 int new_mtu);
567 int (*ndo_neigh_setup)(struct net_device *dev,
568 struct neigh_parms *);
569#define HAVE_TX_TIMEOUT
570 void (*ndo_tx_timeout) (struct net_device *dev);
571
572 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
573
574 void (*ndo_vlan_rx_register)(struct net_device *dev,
575 struct vlan_group *grp);
576 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
577 unsigned short vid);
578 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
579 unsigned short vid);
580#ifdef CONFIG_NET_POLL_CONTROLLER
581#define HAVE_NETDEV_POLL
582 void (*ndo_poll_controller)(struct net_device *dev);
583#endif
584};
585
454/* 586/*
455 * The DEVICE structure. 587 * The DEVICE structure.
456 * Actually, this whole structure is a big mistake. It mixes I/O 588 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -495,14 +627,7 @@ struct net_device
495 unsigned long state; 627 unsigned long state;
496 628
497 struct list_head dev_list; 629 struct list_head dev_list;
498#ifdef CONFIG_NETPOLL
499 struct list_head napi_list; 630 struct list_head napi_list;
500#endif
501
502 /* The device initialization function. Called only once. */
503 int (*init)(struct net_device *dev);
504
505 /* ------- Fields preinitialized in Space.c finish here ------- */
506 631
507 /* Net device features */ 632 /* Net device features */
508 unsigned long features; 633 unsigned long features;
@@ -521,6 +646,7 @@ struct net_device
521#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 646#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
522 /* do not use LLTX in new drivers */ 647 /* do not use LLTX in new drivers */
523#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 648#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
649#define NETIF_F_GRO 16384 /* Generic receive offload */
524#define NETIF_F_LRO 32768 /* large receive offload */ 650#define NETIF_F_LRO 32768 /* large receive offload */
525 651
526 /* Segmentation offload features */ 652 /* Segmentation offload features */
@@ -546,15 +672,13 @@ struct net_device
546 * for all in netdev_increment_features. 672 * for all in netdev_increment_features.
547 */ 673 */
548#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 674#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
549 NETIF_F_SG | NETIF_F_HIGHDMA | \ 675 NETIF_F_SG | NETIF_F_HIGHDMA | \
550 NETIF_F_FRAGLIST) 676 NETIF_F_FRAGLIST)
551 677
552 /* Interface index. Unique device identifier */ 678 /* Interface index. Unique device identifier */
553 int ifindex; 679 int ifindex;
554 int iflink; 680 int iflink;
555 681
556
557 struct net_device_stats* (*get_stats)(struct net_device *dev);
558 struct net_device_stats stats; 682 struct net_device_stats stats;
559 683
560#ifdef CONFIG_WIRELESS_EXT 684#ifdef CONFIG_WIRELESS_EXT
@@ -564,18 +688,13 @@ struct net_device
564 /* Instance data managed by the core of Wireless Extensions. */ 688 /* Instance data managed by the core of Wireless Extensions. */
565 struct iw_public_data * wireless_data; 689 struct iw_public_data * wireless_data;
566#endif 690#endif
691 /* Management operations */
692 const struct net_device_ops *netdev_ops;
567 const struct ethtool_ops *ethtool_ops; 693 const struct ethtool_ops *ethtool_ops;
568 694
569 /* Hardware header description */ 695 /* Hardware header description */
570 const struct header_ops *header_ops; 696 const struct header_ops *header_ops;
571 697
572 /*
573 * This marks the end of the "visible" part of the structure. All
574 * fields hereafter are internal to the system, and may change at
575 * will (read: may be cleaned up at will).
576 */
577
578
579 unsigned int flags; /* interface flags (a la BSD) */ 698 unsigned int flags; /* interface flags (a la BSD) */
580 unsigned short gflags; 699 unsigned short gflags;
581 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 700 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -634,7 +753,7 @@ struct net_device
634 unsigned long last_rx; /* Time of last Rx */ 753 unsigned long last_rx; /* Time of last Rx */
635 /* Interface address info used in eth_type_trans() */ 754 /* Interface address info used in eth_type_trans() */
636 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 755 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
637 because most packets are unicast) */ 756 because most packets are unicast) */
638 757
639 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 758 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
640 759
@@ -653,18 +772,12 @@ struct net_device
653/* 772/*
654 * One part is mostly used on xmit path (device) 773 * One part is mostly used on xmit path (device)
655 */ 774 */
656 void *priv; /* pointer to private data */
657 int (*hard_start_xmit) (struct sk_buff *skb,
658 struct net_device *dev);
659 /* These may be needed for future network-power-down code. */ 775 /* These may be needed for future network-power-down code. */
660 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 776 unsigned long trans_start; /* Time (in jiffies) of last Tx */
661 777
662 int watchdog_timeo; /* used by dev_watchdog() */ 778 int watchdog_timeo; /* used by dev_watchdog() */
663 struct timer_list watchdog_timer; 779 struct timer_list watchdog_timer;
664 780
665/*
666 * refcnt is a very hot point, so align it on SMP
667 */
668 /* Number of references to this device */ 781 /* Number of references to this device */
669 atomic_t refcnt ____cacheline_aligned_in_smp; 782 atomic_t refcnt ____cacheline_aligned_in_smp;
670 783
@@ -683,56 +796,12 @@ struct net_device
683 NETREG_RELEASED, /* called free_netdev */ 796 NETREG_RELEASED, /* called free_netdev */
684 } reg_state; 797 } reg_state;
685 798
686 /* Called after device is detached from network. */ 799 /* Called from unregister, can be used to call free_netdev */
687 void (*uninit)(struct net_device *dev); 800 void (*destructor)(struct net_device *dev);
688 /* Called after last user reference disappears. */
689 void (*destructor)(struct net_device *dev);
690 801
691 /* Pointers to interface service routines. */
692 int (*open)(struct net_device *dev);
693 int (*stop)(struct net_device *dev);
694#define HAVE_NETDEV_POLL
695#define HAVE_CHANGE_RX_FLAGS
696 void (*change_rx_flags)(struct net_device *dev,
697 int flags);
698#define HAVE_SET_RX_MODE
699 void (*set_rx_mode)(struct net_device *dev);
700#define HAVE_MULTICAST
701 void (*set_multicast_list)(struct net_device *dev);
702#define HAVE_SET_MAC_ADDR
703 int (*set_mac_address)(struct net_device *dev,
704 void *addr);
705#define HAVE_VALIDATE_ADDR
706 int (*validate_addr)(struct net_device *dev);
707#define HAVE_PRIVATE_IOCTL
708 int (*do_ioctl)(struct net_device *dev,
709 struct ifreq *ifr, int cmd);
710#define HAVE_SET_CONFIG
711 int (*set_config)(struct net_device *dev,
712 struct ifmap *map);
713#define HAVE_CHANGE_MTU
714 int (*change_mtu)(struct net_device *dev, int new_mtu);
715
716#define HAVE_TX_TIMEOUT
717 void (*tx_timeout) (struct net_device *dev);
718
719 void (*vlan_rx_register)(struct net_device *dev,
720 struct vlan_group *grp);
721 void (*vlan_rx_add_vid)(struct net_device *dev,
722 unsigned short vid);
723 void (*vlan_rx_kill_vid)(struct net_device *dev,
724 unsigned short vid);
725
726 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
727#ifdef CONFIG_NETPOLL 802#ifdef CONFIG_NETPOLL
728 struct netpoll_info *npinfo; 803 struct netpoll_info *npinfo;
729#endif 804#endif
730#ifdef CONFIG_NET_POLL_CONTROLLER
731 void (*poll_controller)(struct net_device *dev);
732#endif
733
734 u16 (*select_queue)(struct net_device *dev,
735 struct sk_buff *skb);
736 805
737#ifdef CONFIG_NET_NS 806#ifdef CONFIG_NET_NS
738 /* Network namespace this network device is inside */ 807 /* Network namespace this network device is inside */
@@ -763,6 +832,49 @@ struct net_device
763 /* for setting kernel sock attribute on TCP connection setup */ 832 /* for setting kernel sock attribute on TCP connection setup */
764#define GSO_MAX_SIZE 65536 833#define GSO_MAX_SIZE 65536
765 unsigned int gso_max_size; 834 unsigned int gso_max_size;
835
836#ifdef CONFIG_DCB
837 /* Data Center Bridging netlink ops */
838 struct dcbnl_rtnl_ops *dcbnl_ops;
839#endif
840
841#ifdef CONFIG_COMPAT_NET_DEV_OPS
842 struct {
843 int (*init)(struct net_device *dev);
844 void (*uninit)(struct net_device *dev);
845 int (*open)(struct net_device *dev);
846 int (*stop)(struct net_device *dev);
847 int (*hard_start_xmit) (struct sk_buff *skb,
848 struct net_device *dev);
849 u16 (*select_queue)(struct net_device *dev,
850 struct sk_buff *skb);
851 void (*change_rx_flags)(struct net_device *dev,
852 int flags);
853 void (*set_rx_mode)(struct net_device *dev);
854 void (*set_multicast_list)(struct net_device *dev);
855 int (*set_mac_address)(struct net_device *dev,
856 void *addr);
857 int (*validate_addr)(struct net_device *dev);
858 int (*do_ioctl)(struct net_device *dev,
859 struct ifreq *ifr, int cmd);
860 int (*set_config)(struct net_device *dev,
861 struct ifmap *map);
862 int (*change_mtu)(struct net_device *dev, int new_mtu);
863 int (*neigh_setup)(struct net_device *dev,
864 struct neigh_parms *);
865 void (*tx_timeout) (struct net_device *dev);
866 struct net_device_stats* (*get_stats)(struct net_device *dev);
867 void (*vlan_rx_register)(struct net_device *dev,
868 struct vlan_group *grp);
869 void (*vlan_rx_add_vid)(struct net_device *dev,
870 unsigned short vid);
871 void (*vlan_rx_kill_vid)(struct net_device *dev,
872 unsigned short vid);
873#ifdef CONFIG_NET_POLL_CONTROLLER
874 void (*poll_controller)(struct net_device *dev);
875#endif
876 };
877#endif
766}; 878};
767#define to_net_dev(d) container_of(d, struct net_device, dev) 879#define to_net_dev(d) container_of(d, struct net_device, dev)
768 880
@@ -858,22 +970,8 @@ static inline void *netdev_priv(const struct net_device *dev)
858 * netif_napi_add() must be used to initialize a napi context prior to calling 970 * netif_napi_add() must be used to initialize a napi context prior to calling
859 * *any* of the other napi related functions. 971 * *any* of the other napi related functions.
860 */ 972 */
861static inline void netif_napi_add(struct net_device *dev, 973void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
862 struct napi_struct *napi, 974 int (*poll)(struct napi_struct *, int), int weight);
863 int (*poll)(struct napi_struct *, int),
864 int weight)
865{
866 INIT_LIST_HEAD(&napi->poll_list);
867 napi->poll = poll;
868 napi->weight = weight;
869#ifdef CONFIG_NETPOLL
870 napi->dev = dev;
871 list_add(&napi->dev_list, &dev->napi_list);
872 spin_lock_init(&napi->poll_lock);
873 napi->poll_owner = -1;
874#endif
875 set_bit(NAPI_STATE_SCHED, &napi->state);
876}
877 975
878/** 976/**
879 * netif_napi_del - remove a napi context 977 * netif_napi_del - remove a napi context
@@ -881,12 +979,20 @@ static inline void netif_napi_add(struct net_device *dev,
881 * 979 *
882 * netif_napi_del() removes a napi context from the network device napi list 980 * netif_napi_del() removes a napi context from the network device napi list
883 */ 981 */
884static inline void netif_napi_del(struct napi_struct *napi) 982void netif_napi_del(struct napi_struct *napi);
885{ 983
886#ifdef CONFIG_NETPOLL 984struct napi_gro_cb {
887 list_del(&napi->dev_list); 985 /* This is non-zero if the packet may be of the same flow. */
888#endif 986 int same_flow;
889} 987
988 /* This is non-zero if the packet cannot be merged with the new skb. */
989 int flush;
990
991 /* Number of segments aggregated. */
992 int count;
993};
994
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
890 996
891struct packet_type { 997struct packet_type {
892 __be16 type; /* This is really htons(ether_type). */ 998 __be16 type; /* This is really htons(ether_type). */
@@ -898,6 +1004,9 @@ struct packet_type {
898 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1004 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
899 int features); 1005 int features);
900 int (*gso_send_check)(struct sk_buff *skb); 1006 int (*gso_send_check)(struct sk_buff *skb);
1007 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1008 struct sk_buff *skb);
1009 int (*gro_complete)(struct sk_buff *skb);
901 void *af_packet_priv; 1010 void *af_packet_priv;
902 struct list_head list; 1011 struct list_head list;
903}; 1012};
@@ -1251,6 +1360,9 @@ extern int netif_rx(struct sk_buff *skb);
1251extern int netif_rx_ni(struct sk_buff *skb); 1360extern int netif_rx_ni(struct sk_buff *skb);
1252#define HAVE_NETIF_RECEIVE_SKB 1 1361#define HAVE_NETIF_RECEIVE_SKB 1
1253extern int netif_receive_skb(struct sk_buff *skb); 1362extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb);
1254extern void netif_nit_deliver(struct sk_buff *skb); 1366extern void netif_nit_deliver(struct sk_buff *skb);
1255extern int dev_valid_name(const char *name); 1367extern int dev_valid_name(const char *name);
1256extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1443,8 +1555,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1443} 1555}
1444 1556
1445/* Test if receive needs to be scheduled but only if up */ 1557/* Test if receive needs to be scheduled but only if up */
1446static inline int netif_rx_schedule_prep(struct net_device *dev, 1558static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1447 struct napi_struct *napi)
1448{ 1559{
1449 return napi_schedule_prep(napi); 1560 return napi_schedule_prep(napi);
1450} 1561}
@@ -1452,27 +1563,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1452/* Add interface to tail of rx poll list. This assumes that _prep has 1563/* Add interface to tail of rx poll list. This assumes that _prep has
1453 * already been called and returned 1. 1564 * already been called and returned 1.
1454 */ 1565 */
1455static inline void __netif_rx_schedule(struct net_device *dev, 1566static inline void __netif_rx_schedule(struct napi_struct *napi)
1456 struct napi_struct *napi)
1457{ 1567{
1458 __napi_schedule(napi); 1568 __napi_schedule(napi);
1459} 1569}
1460 1570
1461/* Try to reschedule poll. Called by irq handler. */ 1571/* Try to reschedule poll. Called by irq handler. */
1462 1572
1463static inline void netif_rx_schedule(struct net_device *dev, 1573static inline void netif_rx_schedule(struct napi_struct *napi)
1464 struct napi_struct *napi)
1465{ 1574{
1466 if (netif_rx_schedule_prep(dev, napi)) 1575 if (netif_rx_schedule_prep(napi))
1467 __netif_rx_schedule(dev, napi); 1576 __netif_rx_schedule(napi);
1468} 1577}
1469 1578
1470/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1579/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1471static inline int netif_rx_reschedule(struct net_device *dev, 1580static inline int netif_rx_reschedule(struct napi_struct *napi)
1472 struct napi_struct *napi)
1473{ 1581{
1474 if (napi_schedule_prep(napi)) { 1582 if (napi_schedule_prep(napi)) {
1475 __netif_rx_schedule(dev, napi); 1583 __netif_rx_schedule(napi);
1476 return 1; 1584 return 1;
1477 } 1585 }
1478 return 0; 1586 return 0;
@@ -1481,8 +1589,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1481/* same as netif_rx_complete, except that local_irq_save(flags) 1589/* same as netif_rx_complete, except that local_irq_save(flags)
1482 * has already been issued 1590 * has already been issued
1483 */ 1591 */
1484static inline void __netif_rx_complete(struct net_device *dev, 1592static inline void __netif_rx_complete(struct napi_struct *napi)
1485 struct napi_struct *napi)
1486{ 1593{
1487 __napi_complete(napi); 1594 __napi_complete(napi);
1488} 1595}
@@ -1492,14 +1599,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
1492 * it completes the work. The device cannot be out of poll list at this 1599 * it completes the work. The device cannot be out of poll list at this
1493 * moment, it is BUG(). 1600 * moment, it is BUG().
1494 */ 1601 */
1495static inline void netif_rx_complete(struct net_device *dev, 1602static inline void netif_rx_complete(struct napi_struct *napi)
1496 struct napi_struct *napi)
1497{ 1603{
1498 unsigned long flags; 1604 napi_complete(napi);
1499
1500 local_irq_save(flags);
1501 __netif_rx_complete(dev, napi);
1502 local_irq_restore(flags);
1503} 1605}
1504 1606
1505static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1607static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1676,6 +1778,8 @@ extern void netdev_features_change(struct net_device *dev);
1676/* Load a device via the kmod */ 1778/* Load a device via the kmod */
1677extern void dev_load(struct net *net, const char *name); 1779extern void dev_load(struct net *net, const char *name);
1678extern void dev_mcast_init(void); 1780extern void dev_mcast_init(void);
1781extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1782
1679extern int netdev_max_backlog; 1783extern int netdev_max_backlog;
1680extern int weight_p; 1784extern int weight_p;
1681extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1785extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1724,6 +1828,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1724{ 1828{
1725 return skb_is_gso(skb) && 1829 return skb_is_gso(skb) &&
1726 (!skb_gso_ok(skb, dev->features) || 1830 (!skb_gso_ok(skb, dev->features) ||
1831 (skb_shinfo(skb)->frag_list &&
1832 !(dev->features & NETIF_F_FRAGLIST)) ||
1727 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1833 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1728} 1834}
1729 1835
@@ -1742,26 +1848,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1742 struct net_device *dev = skb->dev; 1848 struct net_device *dev = skb->dev;
1743 struct net_device *master = dev->master; 1849 struct net_device *master = dev->master;
1744 1850
1745 if (master && 1851 if (master) {
1746 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1852 if (master->priv_flags & IFF_MASTER_ARPMON)
1747 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1853 dev->last_rx = jiffies;
1748 skb->protocol == __constant_htons(ETH_P_ARP))
1749 return 0;
1750 1854
1751 if (master->priv_flags & IFF_MASTER_ALB) { 1855 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1752 if (skb->pkt_type != PACKET_BROADCAST && 1856 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1753 skb->pkt_type != PACKET_MULTICAST) 1857 skb->protocol == __constant_htons(ETH_P_ARP))
1754 return 0; 1858 return 0;
1755 }
1756 if (master->priv_flags & IFF_MASTER_8023AD &&
1757 skb->protocol == __constant_htons(ETH_P_SLOW))
1758 return 0;
1759 1859
1760 return 1; 1860 if (master->priv_flags & IFF_MASTER_ALB) {
1861 if (skb->pkt_type != PACKET_BROADCAST &&
1862 skb->pkt_type != PACKET_MULTICAST)
1863 return 0;
1864 }
1865 if (master->priv_flags & IFF_MASTER_8023AD &&
1866 skb->protocol == __constant_htons(ETH_P_SLOW))
1867 return 0;
1868
1869 return 1;
1870 }
1761 } 1871 }
1762 return 0; 1872 return 0;
1763} 1873}
1764 1874
1875extern struct pernet_operations __net_initdata loopback_net_ops;
1765#endif /* __KERNEL__ */ 1876#endif /* __KERNEL__ */
1766 1877
1767#endif /* _LINUX_DEV_H */ 1878#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index c19595c89304..29fe9ea1d346 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -141,6 +141,7 @@ enum ctattr_protonat {
141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) 141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
142 142
143enum ctattr_natseq { 143enum ctattr_natseq {
144 CTA_NAT_SEQ_UNSPEC,
144 CTA_NAT_SEQ_CORRECTION_POS, 145 CTA_NAT_SEQ_CORRECTION_POS,
145 CTA_NAT_SEQ_OFFSET_BEFORE, 146 CTA_NAT_SEQ_OFFSET_BEFORE,
146 CTA_NAT_SEQ_OFFSET_AFTER, 147 CTA_NAT_SEQ_OFFSET_AFTER,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index d45e29cd1cfb..e40ddb94b1af 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -300,7 +300,8 @@ struct ebt_table
300 300
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern int ebt_register_table(struct ebt_table *table); 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table);
304extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
306 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index b9478a255301..1037fb2cd206 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ipt_policy_flags */ 8/* ipt_policy_flags */
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 6bab3163d2fb..b1c449d7ec89 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ip6t_policy_flags */ 8/* ip6t_policy_flags */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 9ff1b54908f3..51b09a1f46c3 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -242,7 +242,8 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
242 nlh->nlmsg_flags = flags; 242 nlh->nlmsg_flags = flags;
243 nlh->nlmsg_pid = pid; 243 nlh->nlmsg_pid = pid;
244 nlh->nlmsg_seq = seq; 244 nlh->nlmsg_seq = seq;
245 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); 245 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
246 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
246 return nlh; 247 return nlh;
247} 248}
248 249
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e3d79593fb3a..e38d3c9dccda 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -94,11 +94,6 @@ static inline void netpoll_poll_unlock(void *have)
94 rcu_read_unlock(); 94 rcu_read_unlock();
95} 95}
96 96
97static inline void netpoll_netdev_init(struct net_device *dev)
98{
99 INIT_LIST_HEAD(&dev->napi_list);
100}
101
102#else 97#else
103static inline int netpoll_rx(struct sk_buff *skb) 98static inline int netpoll_rx(struct sk_buff *skb)
104{ 99{
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9bad65400fba..e86ed59f9ad5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -3,7 +3,26 @@
3/* 3/*
4 * 802.11 netlink interface public header 4 * 802.11 netlink interface public header
5 * 5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 *
14 * Permission to use, copy, modify, and/or distribute this software for any
15 * purpose with or without fee is hereby granted, provided that the above
16 * copyright notice and this permission notice appear in all copies.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
19 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
21 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
24 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 *
7 */ 26 */
8 27
9/** 28/**
@@ -25,8 +44,10 @@
25 * 44 *
26 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request 45 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
27 * to get a list of all present wiphys. 46 * to get a list of all present wiphys.
28 * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
29 * %NL80211_ATTR_WIPHY_NAME. 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET.
30 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
31 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
32 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -106,6 +127,12 @@
106 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 127 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
107 * store this as a valid request and then query userspace for it. 128 * store this as a valid request and then query userspace for it.
108 * 129 *
130 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
131 * interface identified by %NL80211_ATTR_IFINDEX
132 *
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX
135 *
109 * @NL80211_CMD_MAX: highest used command number 136 * @NL80211_CMD_MAX: highest used command number
110 * @__NL80211_CMD_AFTER_LAST: internal use 137 * @__NL80211_CMD_AFTER_LAST: internal use
111 */ 138 */
@@ -148,6 +175,9 @@ enum nl80211_commands {
148 NL80211_CMD_SET_REG, 175 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG, 176 NL80211_CMD_REQ_SET_REG,
150 177
178 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS,
180
151 /* add new commands above here */ 181 /* add new commands above here */
152 182
153 /* used to define NL80211_CMD_MAX below */ 183 /* used to define NL80211_CMD_MAX below */
@@ -169,6 +199,15 @@ enum nl80211_commands {
169 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. 199 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
170 * /sys/class/ieee80211/<phyname>/index 200 * /sys/class/ieee80211/<phyname>/index
171 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) 201 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
202 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
203 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz
204 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
205 * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included):
206 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
207 * this attribute)
208 * NL80211_CHAN_HT20 = HT20 only
209 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
210 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
172 * 211 *
173 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 212 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
174 * @NL80211_ATTR_IFNAME: network interface name 213 * @NL80211_ATTR_IFNAME: network interface name
@@ -234,6 +273,9 @@ enum nl80211_commands {
234 * (u8, 0 or 1) 273 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled 274 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1) 275 * (u8, 0 or 1)
276 * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
277 * rates in format defined by IEEE 802.11 7.3.2.2 but without the length
278 * restriction (at most %NL80211_MAX_SUPP_RATES).
237 * 279 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from 280 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION) 281 * association request when used with NL80211_CMD_NEW_STATION)
@@ -296,6 +338,14 @@ enum nl80211_attrs {
296 NL80211_ATTR_REG_ALPHA2, 338 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES, 339 NL80211_ATTR_REG_RULES,
298 340
341 NL80211_ATTR_MESH_PARAMS,
342
343 NL80211_ATTR_BSS_BASIC_RATES,
344
345 NL80211_ATTR_WIPHY_TXQ_PARAMS,
346 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348
299 /* add attributes here, update the policy in nl80211.c */ 349 /* add attributes here, update the policy in nl80211.c */
300 350
301 __NL80211_ATTR_AFTER_LAST, 351 __NL80211_ATTR_AFTER_LAST,
@@ -307,6 +357,10 @@ enum nl80211_attrs {
307 * here 357 * here
308 */ 358 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 359#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET
310 364
311#define NL80211_MAX_SUPP_RATES 32 365#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32 366#define NL80211_MAX_SUPP_REG_RULES 32
@@ -371,6 +425,32 @@ enum nl80211_sta_flags {
371}; 425};
372 426
373/** 427/**
428 * enum nl80211_rate_info - bitrate information
429 *
430 * These attribute types are used with %NL80211_STA_INFO_TXRATE
431 * when getting information about the bitrate of a station.
432 *
433 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
434 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
435 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
436 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
437 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
438 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
439 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
440 */
441enum nl80211_rate_info {
442 __NL80211_RATE_INFO_INVALID,
443 NL80211_RATE_INFO_BITRATE,
444 NL80211_RATE_INFO_MCS,
445 NL80211_RATE_INFO_40_MHZ_WIDTH,
446 NL80211_RATE_INFO_SHORT_GI,
447
448 /* keep last */
449 __NL80211_RATE_INFO_AFTER_LAST,
450 NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
451};
452
453/**
374 * enum nl80211_sta_info - station information 454 * enum nl80211_sta_info - station information
375 * 455 *
376 * These attribute types are used with %NL80211_ATTR_STA_INFO 456 * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -382,6 +462,9 @@ enum nl80211_sta_flags {
382 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 462 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
383 * @__NL80211_STA_INFO_AFTER_LAST: internal 463 * @__NL80211_STA_INFO_AFTER_LAST: internal
384 * @NL80211_STA_INFO_MAX: highest possible station info attribute 464 * @NL80211_STA_INFO_MAX: highest possible station info attribute
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate.
385 */ 468 */
386enum nl80211_sta_info { 469enum nl80211_sta_info {
387 __NL80211_STA_INFO_INVALID, 470 __NL80211_STA_INFO_INVALID,
@@ -391,6 +474,8 @@ enum nl80211_sta_info {
391 NL80211_STA_INFO_LLID, 474 NL80211_STA_INFO_LLID,
392 NL80211_STA_INFO_PLID, 475 NL80211_STA_INFO_PLID,
393 NL80211_STA_INFO_PLINK_STATE, 476 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE,
394 479
395 /* keep last */ 480 /* keep last */
396 __NL80211_STA_INFO_AFTER_LAST, 481 __NL80211_STA_INFO_AFTER_LAST,
@@ -452,17 +537,29 @@ enum nl80211_mpath_info {
452 * an array of nested frequency attributes 537 * an array of nested frequency attributes
453 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, 538 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
454 * an array of nested bitrate attributes 539 * an array of nested bitrate attributes
540 * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
541 * defined in 802.11n
542 * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
543 * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
544 * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
455 */ 545 */
456enum nl80211_band_attr { 546enum nl80211_band_attr {
457 __NL80211_BAND_ATTR_INVALID, 547 __NL80211_BAND_ATTR_INVALID,
458 NL80211_BAND_ATTR_FREQS, 548 NL80211_BAND_ATTR_FREQS,
459 NL80211_BAND_ATTR_RATES, 549 NL80211_BAND_ATTR_RATES,
460 550
551 NL80211_BAND_ATTR_HT_MCS_SET,
552 NL80211_BAND_ATTR_HT_CAPA,
553 NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
554 NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
555
461 /* keep last */ 556 /* keep last */
462 __NL80211_BAND_ATTR_AFTER_LAST, 557 __NL80211_BAND_ATTR_AFTER_LAST,
463 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 558 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
464}; 559};
465 560
561#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
562
466/** 563/**
467 * enum nl80211_frequency_attr - frequency attributes 564 * enum nl80211_frequency_attr - frequency attributes
468 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz 565 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -474,6 +571,8 @@ enum nl80211_band_attr {
474 * on this channel in current regulatory domain. 571 * on this channel in current regulatory domain.
475 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory 572 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
476 * on this channel in current regulatory domain. 573 * on this channel in current regulatory domain.
574 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
575 * (100 * dBm).
477 */ 576 */
478enum nl80211_frequency_attr { 577enum nl80211_frequency_attr {
479 __NL80211_FREQUENCY_ATTR_INVALID, 578 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -482,12 +581,15 @@ enum nl80211_frequency_attr {
482 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, 581 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
483 NL80211_FREQUENCY_ATTR_NO_IBSS, 582 NL80211_FREQUENCY_ATTR_NO_IBSS,
484 NL80211_FREQUENCY_ATTR_RADAR, 583 NL80211_FREQUENCY_ATTR_RADAR,
584 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
485 585
486 /* keep last */ 586 /* keep last */
487 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 587 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
488 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 588 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
489}; 589};
490 590
591#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
592
491/** 593/**
492 * enum nl80211_bitrate_attr - bitrate attributes 594 * enum nl80211_bitrate_attr - bitrate attributes
493 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps 595 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
@@ -594,4 +696,119 @@ enum nl80211_mntr_flags {
594 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 696 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
595}; 697};
596 698
699/**
700 * enum nl80211_meshconf_params - mesh configuration parameters
701 *
702 * Mesh configuration parameters
703 *
704 * @__NL80211_MESHCONF_INVALID: internal use
705 *
706 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
707 * millisecond units, used by the Peer Link Open message
708 *
709 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
710 * millisecond units, used by the peer link management to close a peer link
711 *
712 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
713 * millisecond units
714 *
715 * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
716 * on this mesh interface
717 *
718 * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
719 * open retries that can be sent to establish a new peer link instance in a
720 * mesh
721 *
722 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
723 * point.
724 *
725 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
726 * open peer links when we detect compatible mesh peers.
727 *
728 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
729 * containing a PREQ that an MP can send to a particular destination (path
730 * target)
731 *
732 * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
733 * (in milliseconds)
734 *
735 * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
736 * until giving up on a path discovery (in milliseconds)
737 *
738 * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
739 * points receiving a PREQ shall consider the forwarding information from the
740 * root to be valid. (TU = time unit)
741 *
742 * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
743 * TUs) during which an MP can send only one action frame containing a PREQ
744 * reference element
745 *
746 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
747 * that it takes for an HWMP information element to propagate across the mesh
748 *
749 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
750 *
751 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
752 */
753enum nl80211_meshconf_params {
754 __NL80211_MESHCONF_INVALID,
755 NL80211_MESHCONF_RETRY_TIMEOUT,
756 NL80211_MESHCONF_CONFIRM_TIMEOUT,
757 NL80211_MESHCONF_HOLDING_TIMEOUT,
758 NL80211_MESHCONF_MAX_PEER_LINKS,
759 NL80211_MESHCONF_MAX_RETRIES,
760 NL80211_MESHCONF_TTL,
761 NL80211_MESHCONF_AUTO_OPEN_PLINKS,
762 NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
763 NL80211_MESHCONF_PATH_REFRESH_TIME,
764 NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
765 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
766 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
767 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
768
769 /* keep last */
770 __NL80211_MESHCONF_ATTR_AFTER_LAST,
771 NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
772};
773
774/**
775 * enum nl80211_txq_attr - TX queue parameter attributes
776 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
777 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
778 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
779 * disabled
780 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
781 * 2^n-1 in the range 1..32767]
782 * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
783 * 2^n-1 in the range 1..32767]
784 * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
785 * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
786 * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number
787 */
788enum nl80211_txq_attr {
789 __NL80211_TXQ_ATTR_INVALID,
790 NL80211_TXQ_ATTR_QUEUE,
791 NL80211_TXQ_ATTR_TXOP,
792 NL80211_TXQ_ATTR_CWMIN,
793 NL80211_TXQ_ATTR_CWMAX,
794 NL80211_TXQ_ATTR_AIFS,
795
796 /* keep last */
797 __NL80211_TXQ_ATTR_AFTER_LAST,
798 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
799};
800
801enum nl80211_txq_q {
802 NL80211_TXQ_Q_VO,
803 NL80211_TXQ_Q_VI,
804 NL80211_TXQ_Q_BE,
805 NL80211_TXQ_Q_BK
806};
807
808enum nl80211_channel_type {
809 NL80211_CHAN_NO_HT,
810 NL80211_CHAN_HT20,
811 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS
813};
597#endif /* __LINUX_NL80211_H */ 814#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index c8a768e59640..afad7dec1b36 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -27,7 +27,6 @@ struct nsproxy {
27 struct ipc_namespace *ipc_ns; 27 struct ipc_namespace *ipc_ns;
28 struct mnt_namespace *mnt_ns; 28 struct mnt_namespace *mnt_ns;
29 struct pid_namespace *pid_ns; 29 struct pid_namespace *pid_ns;
30 struct user_namespace *user_ns;
31 struct net *net_ns; 30 struct net *net_ns;
32}; 31};
33extern struct nsproxy init_nsproxy; 32extern struct nsproxy init_nsproxy;
diff --git a/include/linux/of.h b/include/linux/of.h
index e2488f5e7cb2..6a7efa242f5e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -57,6 +57,12 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
57 for (child = of_get_next_child(parent, NULL); child != NULL; \ 57 for (child = of_get_next_child(parent, NULL); child != NULL; \
58 child = of_get_next_child(parent, child)) 58 child = of_get_next_child(parent, child))
59 59
60extern struct device_node *of_find_node_with_property(
61 struct device_node *from, const char *prop_name);
62#define for_each_node_with_property(dn, prop_name) \
63 for (dn = of_find_node_with_property(NULL, prop_name); dn; \
64 dn = of_find_node_with_property(dn, prop_name))
65
60extern struct property *of_find_property(const struct device_node *np, 66extern struct property *of_find_property(const struct device_node *np,
61 const char *name, 67 const char *name,
62 int *lenp); 68 int *lenp);
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 67db101d0eb8..fc2472c3c254 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -14,9 +14,22 @@
14#ifndef __LINUX_OF_GPIO_H 14#ifndef __LINUX_OF_GPIO_H
15#define __LINUX_OF_GPIO_H 15#define __LINUX_OF_GPIO_H
16 16
17#include <linux/compiler.h>
18#include <linux/kernel.h>
17#include <linux/errno.h> 19#include <linux/errno.h>
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19 21
22struct device_node;
23
24/*
25 * This is Linux-specific flags. By default controllers' and Linux' mapping
26 * match, but GPIO controllers are free to translate their own flags to
27 * Linux-specific in their .xlate callback. Though, 1:1 mapping is recommended.
28 */
29enum of_gpio_flags {
30 OF_GPIO_ACTIVE_LOW = 0x1,
31};
32
20#ifdef CONFIG_OF_GPIO 33#ifdef CONFIG_OF_GPIO
21 34
22/* 35/*
@@ -26,7 +39,7 @@ struct of_gpio_chip {
26 struct gpio_chip gc; 39 struct gpio_chip gc;
27 int gpio_cells; 40 int gpio_cells;
28 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np, 41 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
29 const void *gpio_spec); 42 const void *gpio_spec, enum of_gpio_flags *flags);
30}; 43};
31 44
32static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc) 45static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
@@ -50,20 +63,43 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50 return container_of(of_gc, struct of_mm_gpio_chip, of_gc); 63 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
51} 64}
52 65
53extern int of_get_gpio(struct device_node *np, int index); 66extern int of_get_gpio_flags(struct device_node *np, int index,
67 enum of_gpio_flags *flags);
68extern unsigned int of_gpio_count(struct device_node *np);
69
54extern int of_mm_gpiochip_add(struct device_node *np, 70extern int of_mm_gpiochip_add(struct device_node *np,
55 struct of_mm_gpio_chip *mm_gc); 71 struct of_mm_gpio_chip *mm_gc);
56extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, 72extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
57 struct device_node *np, 73 struct device_node *np,
58 const void *gpio_spec); 74 const void *gpio_spec,
75 enum of_gpio_flags *flags);
59#else 76#else
60 77
61/* Drivers may not strictly depend on the GPIO support, so let them link. */ 78/* Drivers may not strictly depend on the GPIO support, so let them link. */
62static inline int of_get_gpio(struct device_node *np, int index) 79static inline int of_get_gpio_flags(struct device_node *np, int index,
80 enum of_gpio_flags *flags)
63{ 81{
64 return -ENOSYS; 82 return -ENOSYS;
65} 83}
66 84
85static inline unsigned int of_gpio_count(struct device_node *np)
86{
87 return 0;
88}
89
67#endif /* CONFIG_OF_GPIO */ 90#endif /* CONFIG_OF_GPIO */
68 91
92/**
93 * of_get_gpio - Get a GPIO number to use with GPIO API
94 * @np: device node to get GPIO from
95 * @index: index of the GPIO
96 *
97 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
98 * value on the error condition.
99 */
100static inline int of_get_gpio(struct device_node *np, int index)
101{
102 return of_get_gpio_flags(np, index, NULL);
103}
104
69#endif /* __LINUX_OF_GPIO_H */ 105#endif /* __LINUX_OF_GPIO_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index feb4657bb043..03b0b8c3c81b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -134,6 +134,11 @@ enum pci_dev_flags {
134 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 134 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
135}; 135};
136 136
137enum pci_irq_reroute_variant {
138 INTEL_IRQ_REROUTE_VARIANT = 1,
139 MAX_IRQ_REROUTE_VARIANTS = 3
140};
141
137typedef unsigned short __bitwise pci_bus_flags_t; 142typedef unsigned short __bitwise pci_bus_flags_t;
138enum pci_bus_flags { 143enum pci_bus_flags {
139 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 144 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -218,6 +223,7 @@ struct pci_dev {
218 unsigned int no_msi:1; /* device may not use msi */ 223 unsigned int no_msi:1; /* device may not use msi */
219 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 224 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
220 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 225 unsigned int broken_parity_status:1; /* Device generates false positive parity */
226 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
221 unsigned int msi_enabled:1; 227 unsigned int msi_enabled:1;
222 unsigned int msix_enabled:1; 228 unsigned int msix_enabled:1;
223 unsigned int ari_enabled:1; /* ARI forwarding */ 229 unsigned int ari_enabled:1; /* ARI forwarding */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1800f1d6e40d..b6e694454280 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2304,6 +2304,10 @@
2304#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 2304#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329
2305#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A 2305#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A
2306#define PCI_DEVICE_ID_INTEL_PXHV 0x032C 2306#define PCI_DEVICE_ID_INTEL_PXHV 0x032C
2307#define PCI_DEVICE_ID_INTEL_80332_0 0x0330
2308#define PCI_DEVICE_ID_INTEL_80332_1 0x0332
2309#define PCI_DEVICE_ID_INTEL_80333_0 0x0370
2310#define PCI_DEVICE_ID_INTEL_80333_1 0x0372
2307#define PCI_DEVICE_ID_INTEL_82375 0x0482 2311#define PCI_DEVICE_ID_INTEL_82375 0x0482
2308#define PCI_DEVICE_ID_INTEL_82424 0x0483 2312#define PCI_DEVICE_ID_INTEL_82424 0x0483
2309#define PCI_DEVICE_ID_INTEL_82378 0x0484 2313#define PCI_DEVICE_ID_INTEL_82378 0x0484
@@ -2376,6 +2380,7 @@
2376#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 2380#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4
2377#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 2381#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
2378#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab 2382#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab
2383#define PCI_DEVICE_ID_INTEL_ESB_10 0x25ac
2379#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 2384#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500
2380#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 2385#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
2381#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 2386#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c4ed60b982..d7e54d98869f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -467,6 +467,8 @@ int genphy_restart_aneg(struct phy_device *phydev);
467int genphy_config_aneg(struct phy_device *phydev); 467int genphy_config_aneg(struct phy_device *phydev);
468int genphy_update_link(struct phy_device *phydev); 468int genphy_update_link(struct phy_device *phydev);
469int genphy_read_status(struct phy_device *phydev); 469int genphy_read_status(struct phy_device *phydev);
470int genphy_suspend(struct phy_device *phydev);
471int genphy_resume(struct phy_device *phydev);
470void phy_driver_unregister(struct phy_driver *drv); 472void phy_driver_unregister(struct phy_driver *drv);
471int phy_driver_register(struct phy_driver *new_driver); 473int phy_driver_register(struct phy_driver *new_driver);
472void phy_prepare_link(struct phy_device *phydev, 474void phy_prepare_link(struct phy_device *phydev,
diff --git a/include/linux/pid.h b/include/linux/pid.h
index d7e98ff8021e..bb206c56d1f0 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -147,9 +147,9 @@ pid_t pid_vnr(struct pid *pid);
147#define do_each_pid_task(pid, type, task) \ 147#define do_each_pid_task(pid, type, task) \
148 do { \ 148 do { \
149 struct hlist_node *pos___; \ 149 struct hlist_node *pos___; \
150 if (pid != NULL) \ 150 if ((pid) != NULL) \
151 hlist_for_each_entry_rcu((task), pos___, \ 151 hlist_for_each_entry_rcu((task), pos___, \
152 &pid->tasks[type], pids[type].node) { 152 &(pid)->tasks[type], pids[type].node) {
153 153
154 /* 154 /*
155 * Both old and new leaders may be attached to 155 * Both old and new leaders may be attached to
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 7cf7824df778..e6aa8482ad7a 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -394,6 +394,20 @@ enum
394 394
395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) 395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
396 396
397
398/* Cgroup classifier */
399
400enum
401{
402 TCA_CGROUP_UNSPEC,
403 TCA_CGROUP_ACT,
404 TCA_CGROUP_POLICE,
405 TCA_CGROUP_EMATCHES,
406 __TCA_CGROUP_MAX,
407};
408
409#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
410
397/* Extended Matches */ 411/* Extended Matches */
398 412
399struct tcf_ematch_tree_hdr 413struct tcf_ematch_tree_hdr
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 5d921fa91a5b..e3f133adba78 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -500,4 +500,20 @@ struct tc_netem_corrupt
500 500
501#define NETEM_DIST_SCALE 8192 501#define NETEM_DIST_SCALE 8192
502 502
503/* DRR */
504
505enum
506{
507 TCA_DRR_UNSPEC,
508 TCA_DRR_QUANTUM,
509 __TCA_DRR_MAX
510};
511
512#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
513
514struct tc_drr_stats
515{
516 u32 deficit;
517};
518
503#endif 519#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 22641d5d45df..98b93ca4db06 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
97#define PTRACE_MODE_READ 1 98#define PTRACE_MODE_READ 1
98#define PTRACE_MODE_ATTACH 2 99#define PTRACE_MODE_ATTACH 2
99/* Returns 0 on success, -errno on denial. */ 100/* Returns 0 on success, -errno on denial. */
@@ -313,6 +314,27 @@ static inline void user_enable_block_step(struct task_struct *task)
313#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
314#endif 315#endif
315 316
317#ifndef arch_ptrace_untrace
318/*
319 * Do machine-specific work before untracing child.
320 *
321 * This is called for a normal detach as well as from ptrace_exit()
322 * when the tracing task dies.
323 *
324 * Called with write_lock(&tasklist_lock) held.
325 */
326#define arch_ptrace_untrace(task) do { } while (0)
327#endif
328
329#ifndef arch_ptrace_fork
330/*
331 * Do machine-specific work to initialize a new task.
332 *
333 * This is called from copy_process().
334 */
335#define arch_ptrace_fork(child, clone_flags) do { } while (0)
336#endif
337
316extern int task_current_syscall(struct task_struct *target, long *callno, 338extern int task_current_syscall(struct task_struct *target, long *callno,
317 unsigned long args[6], unsigned int maxargs, 339 unsigned long args[6], unsigned int maxargs,
318 unsigned long *sp, unsigned long *pc); 340 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
new file mode 100644
index 000000000000..f9ddd03961a8
--- /dev/null
+++ b/include/linux/rculist_nulls.h
@@ -0,0 +1,110 @@
1#ifndef _LINUX_RCULIST_NULLS_H
2#define _LINUX_RCULIST_NULLS_H
3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
9#include <linux/list_nulls.h>
10#include <linux/rcupdate.h>
11
12/**
13 * hlist_nulls_del_init_rcu - deletes entry from hash list with re-initialization
14 * @n: the element to delete from the hash list.
15 *
16 * Note: hlist_nulls_unhashed() on the node return true after this. It is
17 * useful for RCU based read lockfree traversal if the writer side
18 * must know if the list entry is still hashed or already unhashed.
19 *
20 * In particular, it means that we can not poison the forward pointers
21 * that may still be used for walking the hash list and we can only
22 * zero the pprev pointer so list_unhashed() will return true after
23 * this.
24 *
25 * The caller must take whatever precautions are necessary (such as
26 * holding appropriate locks) to avoid racing with another
27 * list-mutation primitive, such as hlist_nulls_add_head_rcu() or
28 * hlist_nulls_del_rcu(), running on this same list. However, it is
29 * perfectly legal to run concurrently with the _rcu list-traversal
30 * primitives, such as hlist_nulls_for_each_entry_rcu().
31 */
32static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
33{
34 if (!hlist_nulls_unhashed(n)) {
35 __hlist_nulls_del(n);
36 n->pprev = NULL;
37 }
38}
39
40/**
41 * hlist_nulls_del_rcu - deletes entry from hash list without re-initialization
42 * @n: the element to delete from the hash list.
43 *
44 * Note: hlist_nulls_unhashed() on entry does not return true after this,
45 * the entry is in an undefined state. It is useful for RCU based
46 * lockfree traversal.
47 *
48 * In particular, it means that we can not poison the forward
49 * pointers that may still be used for walking the hash list.
50 *
51 * The caller must take whatever precautions are necessary
52 * (such as holding appropriate locks) to avoid racing
53 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
54 * or hlist_nulls_del_rcu(), running on this same list.
55 * However, it is perfectly legal to run concurrently with
56 * the _rcu list-traversal primitives, such as
57 * hlist_nulls_for_each_entry().
58 */
59static inline void hlist_nulls_del_rcu(struct hlist_nulls_node *n)
60{
61 __hlist_nulls_del(n);
62 n->pprev = LIST_POISON2;
63}
64
65/**
66 * hlist_nulls_add_head_rcu
67 * @n: the element to add to the hash list.
68 * @h: the list to add to.
69 *
70 * Description:
71 * Adds the specified element to the specified hlist_nulls,
72 * while permitting racing traversals.
73 *
74 * The caller must take whatever precautions are necessary
75 * (such as holding appropriate locks) to avoid racing
76 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
77 * or hlist_nulls_del_rcu(), running on this same list.
78 * However, it is perfectly legal to run concurrently with
79 * the _rcu list-traversal primitives, such as
80 * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency
81 * problems on Alpha CPUs. Regardless of the type of CPU, the
82 * list-traversal primitive must be guarded by rcu_read_lock().
83 */
84static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
85 struct hlist_nulls_head *h)
86{
87 struct hlist_nulls_node *first = h->first;
88
89 n->next = first;
90 n->pprev = &h->first;
91 rcu_assign_pointer(h->first, n);
92 if (!is_a_nulls(first))
93 first->pprev = &n->next;
94}
95/**
96 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
97 * @tpos: the type * to use as a loop cursor.
98 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
99 * @head: the head for your list.
100 * @member: the name of the hlist_nulls_node within the struct.
101 *
102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next))
108
109#endif
110#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 86f1f5e43e33..895dc9c1088c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -142,6 +142,7 @@ struct rcu_head {
142 * on the write-side to insure proper synchronization. 142 * on the write-side to insure proper synchronization.
143 */ 143 */
144#define rcu_read_lock_sched() preempt_disable() 144#define rcu_read_lock_sched() preempt_disable()
145#define rcu_read_lock_sched_notrace() preempt_disable_notrace()
145 146
146/* 147/*
147 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section 148 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
@@ -149,6 +150,7 @@ struct rcu_head {
149 * See rcu_read_lock_sched for more information. 150 * See rcu_read_lock_sched for more information.
150 */ 151 */
151#define rcu_read_unlock_sched() preempt_enable() 152#define rcu_read_unlock_sched() preempt_enable()
153#define rcu_read_unlock_sched_notrace() preempt_enable_notrace()
152 154
153 155
154 156
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 4cd64b0d9825..164332cbb77c 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -108,6 +108,7 @@ struct rfkill {
108 108
109 struct device dev; 109 struct device dev;
110 struct list_head node; 110 struct list_head node;
111 enum rfkill_state state_for_resume;
111}; 112};
112#define to_rfkill(d) container_of(d, struct rfkill, dev) 113#define to_rfkill(d) container_of(d, struct rfkill, dev)
113 114
@@ -148,11 +149,4 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill)
148#endif 149#endif
149} 150}
150 151
151/* rfkill notification chain */
152#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
153 switch has changed */
154
155int register_rfkill_notifier(struct notifier_block *nb);
156int unregister_rfkill_notifier(struct notifier_block *nb);
157
158#endif /* RFKILL_H */ 152#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index e097c2e6b6dc..d363467c8f13 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -28,17 +28,19 @@ struct ring_buffer_event {
28 * size = 8 bytes 28 * size = 8 bytes
29 * 29 *
30 * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock 30 * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock
31 * array[0] = tv_nsec 31 * array[0] = tv_nsec
32 * array[1] = tv_sec 32 * array[1..2] = tv_sec
33 * size = 16 bytes 33 * size = 16 bytes
34 * 34 *
35 * @RINGBUF_TYPE_DATA: Data record 35 * @RINGBUF_TYPE_DATA: Data record
36 * If len is zero: 36 * If len is zero:
37 * array[0] holds the actual length 37 * array[0] holds the actual length
38 * array[1..(length+3)/4-1] holds data 38 * array[1..(length+3)/4] holds data
39 * size = 4 + 4 + length (bytes)
39 * else 40 * else
40 * length = len << 2 41 * length = len << 2
41 * array[0..(length+3)/4] holds data 42 * array[0..(length+3)/4-1] holds data
43 * size = 4 + length (bytes)
42 */ 44 */
43enum ring_buffer_type { 45enum ring_buffer_type {
44 RINGBUF_TYPE_PADDING, 46 RINGBUF_TYPE_PADDING,
@@ -122,6 +124,12 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
122 124
123void tracing_on(void); 125void tracing_on(void);
124void tracing_off(void); 126void tracing_off(void);
127void tracing_off_permanent(void);
128
129void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
130void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);
131int ring_buffer_read_page(struct ring_buffer *buffer,
132 void **data_page, int cpu, int full);
125 133
126enum ring_buffer_flags { 134enum ring_buffer_flags {
127 RB_FL_OVERWRITE = 1 << 0, 135 RB_FL_OVERWRITE = 1 << 0,
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 90987b7bcc1b..32c0547ffafc 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -427,9 +427,9 @@ void rio_dev_put(struct rio_dev *);
427 * Get the unique RIO device identifier. Returns the device 427 * Get the unique RIO device identifier. Returns the device
428 * identifier string. 428 * identifier string.
429 */ 429 */
430static inline char *rio_name(struct rio_dev *rdev) 430static inline const char *rio_name(struct rio_dev *rdev)
431{ 431{
432 return rdev->dev.bus_id; 432 return dev_name(&rdev->dev);
433} 433}
434 434
435/** 435/**
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2b3d51c6ec9c..e88f7058b3a1 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -107,6 +107,11 @@ enum {
107 RTM_GETADDRLABEL, 107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL 108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109 109
110 RTM_GETDCB = 78,
111#define RTM_GETDCB RTM_GETDCB
112 RTM_SETDCB,
113#define RTM_SETDCB RTM_SETDCB
114
110 __RTM_MAX, 115 __RTM_MAX,
111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 116#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
112}; 117};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 55e30d114477..8395e715809d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -96,6 +96,7 @@ struct exec_domain;
96struct futex_pi_state; 96struct futex_pi_state;
97struct robust_list_head; 97struct robust_list_head;
98struct bio; 98struct bio;
99struct bts_tracer;
99 100
100/* 101/*
101 * List of flags we want to share for kernel threads, 102 * List of flags we want to share for kernel threads,
@@ -259,8 +260,6 @@ static inline int select_nohz_load_balancer(int cpu)
259} 260}
260#endif 261#endif
261 262
262extern unsigned long rt_needs_cpu(int cpu);
263
264/* 263/*
265 * Only dump TASK_* tasks. (0 for all tasks) 264 * Only dump TASK_* tasks. (0 for all tasks)
266 */ 265 */
@@ -572,12 +571,6 @@ struct signal_struct {
572 */ 571 */
573 struct rlimit rlim[RLIM_NLIMITS]; 572 struct rlimit rlim[RLIM_NLIMITS];
574 573
575 /* keep the process-shared keyrings here so that they do the right
576 * thing in threads created with CLONE_THREAD */
577#ifdef CONFIG_KEYS
578 struct key *session_keyring; /* keyring inherited over fork */
579 struct key *process_keyring; /* keyring private to this process */
580#endif
581#ifdef CONFIG_BSD_PROCESS_ACCT 574#ifdef CONFIG_BSD_PROCESS_ACCT
582 struct pacct_struct pacct; /* per-process accounting information */ 575 struct pacct_struct pacct; /* per-process accounting information */
583#endif 576#endif
@@ -648,6 +641,7 @@ struct user_struct {
648 /* Hash table maintenance information */ 641 /* Hash table maintenance information */
649 struct hlist_node uidhash_node; 642 struct hlist_node uidhash_node;
650 uid_t uid; 643 uid_t uid;
644 struct user_namespace *user_ns;
651 645
652#ifdef CONFIG_USER_SCHED 646#ifdef CONFIG_USER_SCHED
653 struct task_group *tg; 647 struct task_group *tg;
@@ -665,6 +659,7 @@ extern struct user_struct *find_user(uid_t);
665extern struct user_struct root_user; 659extern struct user_struct root_user;
666#define INIT_USER (&root_user) 660#define INIT_USER (&root_user)
667 661
662
668struct backing_dev_info; 663struct backing_dev_info;
669struct reclaim_state; 664struct reclaim_state;
670 665
@@ -672,8 +667,7 @@ struct reclaim_state;
672struct sched_info { 667struct sched_info {
673 /* cumulative counters */ 668 /* cumulative counters */
674 unsigned long pcount; /* # of times run on this cpu */ 669 unsigned long pcount; /* # of times run on this cpu */
675 unsigned long long cpu_time, /* time spent on the cpu */ 670 unsigned long long run_delay; /* time spent waiting on a runqueue */
676 run_delay; /* time spent waiting on a runqueue */
677 671
678 /* timestamps */ 672 /* timestamps */
679 unsigned long long last_arrival,/* when we last ran on a cpu */ 673 unsigned long long last_arrival,/* when we last ran on a cpu */
@@ -888,38 +882,7 @@ partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
888#endif /* !CONFIG_SMP */ 882#endif /* !CONFIG_SMP */
889 883
890struct io_context; /* See blkdev.h */ 884struct io_context; /* See blkdev.h */
891#define NGROUPS_SMALL 32
892#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
893struct group_info {
894 int ngroups;
895 atomic_t usage;
896 gid_t small_block[NGROUPS_SMALL];
897 int nblocks;
898 gid_t *blocks[0];
899};
900
901/*
902 * get_group_info() must be called with the owning task locked (via task_lock())
903 * when task != current. The reason being that the vast majority of callers are
904 * looking at current->group_info, which can not be changed except by the
905 * current task. Changing current->group_info requires the task lock, too.
906 */
907#define get_group_info(group_info) do { \
908 atomic_inc(&(group_info)->usage); \
909} while (0)
910 885
911#define put_group_info(group_info) do { \
912 if (atomic_dec_and_test(&(group_info)->usage)) \
913 groups_free(group_info); \
914} while (0)
915
916extern struct group_info *groups_alloc(int gidsetsize);
917extern void groups_free(struct group_info *group_info);
918extern int set_current_groups(struct group_info *group_info);
919extern int groups_search(struct group_info *group_info, gid_t grp);
920/* access the groups "array" with this macro */
921#define GROUP_AT(gi, i) \
922 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
923 886
924#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK 887#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
925extern void prefetch_stack(struct task_struct *t); 888extern void prefetch_stack(struct task_struct *t);
@@ -1165,6 +1128,19 @@ struct task_struct {
1165 struct list_head ptraced; 1128 struct list_head ptraced;
1166 struct list_head ptrace_entry; 1129 struct list_head ptrace_entry;
1167 1130
1131#ifdef CONFIG_X86_PTRACE_BTS
1132 /*
1133 * This is the tracer handle for the ptrace BTS extension.
1134 * This field actually belongs to the ptracer task.
1135 */
1136 struct bts_tracer *bts;
1137 /*
1138 * The buffer to hold the BTS data.
1139 */
1140 void *bts_buffer;
1141 size_t bts_size;
1142#endif /* CONFIG_X86_PTRACE_BTS */
1143
1168 /* PID/PID hash table linkage. */ 1144 /* PID/PID hash table linkage. */
1169 struct pid_link pids[PIDTYPE_MAX]; 1145 struct pid_link pids[PIDTYPE_MAX];
1170 struct list_head thread_group; 1146 struct list_head thread_group;
@@ -1186,17 +1162,12 @@ struct task_struct {
1186 struct list_head cpu_timers[3]; 1162 struct list_head cpu_timers[3];
1187 1163
1188/* process credentials */ 1164/* process credentials */
1189 uid_t uid,euid,suid,fsuid; 1165 const struct cred *real_cred; /* objective and real subjective task
1190 gid_t gid,egid,sgid,fsgid; 1166 * credentials (COW) */
1191 struct group_info *group_info; 1167 const struct cred *cred; /* effective (overridable) subjective task
1192 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1168 * credentials (COW) */
1193 struct user_struct *user; 1169 struct mutex cred_exec_mutex; /* execve vs ptrace cred calculation mutex */
1194 unsigned securebits; 1170
1195#ifdef CONFIG_KEYS
1196 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1197 struct key *request_key_auth; /* assumed request_key authority */
1198 struct key *thread_keyring; /* keyring private to this thread */
1199#endif
1200 char comm[TASK_COMM_LEN]; /* executable name excluding path 1171 char comm[TASK_COMM_LEN]; /* executable name excluding path
1201 - access with [gs]et_task_comm (which lock 1172 - access with [gs]et_task_comm (which lock
1202 it with task_lock()) 1173 it with task_lock())
@@ -1233,9 +1204,6 @@ struct task_struct {
1233 int (*notifier)(void *priv); 1204 int (*notifier)(void *priv);
1234 void *notifier_data; 1205 void *notifier_data;
1235 sigset_t *notifier_mask; 1206 sigset_t *notifier_mask;
1236#ifdef CONFIG_SECURITY
1237 void *security;
1238#endif
1239 struct audit_context *audit_context; 1207 struct audit_context *audit_context;
1240#ifdef CONFIG_AUDITSYSCALL 1208#ifdef CONFIG_AUDITSYSCALL
1241 uid_t loginuid; 1209 uid_t loginuid;
@@ -1356,6 +1324,23 @@ struct task_struct {
1356 unsigned long default_timer_slack_ns; 1324 unsigned long default_timer_slack_ns;
1357 1325
1358 struct list_head *scm_work_list; 1326 struct list_head *scm_work_list;
1327#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1328 /* Index of current stored adress in ret_stack */
1329 int curr_ret_stack;
1330 /* Stack of return addresses for return function tracing */
1331 struct ftrace_ret_stack *ret_stack;
1332 /*
1333 * Number of functions that haven't been traced
1334 * because of depth overrun.
1335 */
1336 atomic_t trace_overrun;
1337 /* Pause for the tracing */
1338 atomic_t tracing_graph_pause;
1339#endif
1340#ifdef CONFIG_TRACING
1341 /* state flags for use by tracers */
1342 unsigned long trace;
1343#endif
1359}; 1344};
1360 1345
1361/* 1346/*
@@ -1775,7 +1760,6 @@ static inline struct user_struct *get_uid(struct user_struct *u)
1775 return u; 1760 return u;
1776} 1761}
1777extern void free_uid(struct user_struct *); 1762extern void free_uid(struct user_struct *);
1778extern void switch_uid(struct user_struct *);
1779extern void release_uids(struct user_namespace *ns); 1763extern void release_uids(struct user_namespace *ns);
1780 1764
1781#include <asm/current.h> 1765#include <asm/current.h>
@@ -1794,9 +1778,6 @@ extern void wake_up_new_task(struct task_struct *tsk,
1794extern void sched_fork(struct task_struct *p, int clone_flags); 1778extern void sched_fork(struct task_struct *p, int clone_flags);
1795extern void sched_dead(struct task_struct *p); 1779extern void sched_dead(struct task_struct *p);
1796 1780
1797extern int in_group_p(gid_t);
1798extern int in_egroup_p(gid_t);
1799
1800extern void proc_caches_init(void); 1781extern void proc_caches_init(void);
1801extern void flush_signals(struct task_struct *); 1782extern void flush_signals(struct task_struct *);
1802extern void ignore_signals(struct task_struct *); 1783extern void ignore_signals(struct task_struct *);
@@ -1928,6 +1909,8 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
1928#define for_each_process(p) \ 1909#define for_each_process(p) \
1929 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 1910 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
1930 1911
1912extern bool is_single_threaded(struct task_struct *);
1913
1931/* 1914/*
1932 * Careful: do_each_thread/while_each_thread is a double loop so 1915 * Careful: do_each_thread/while_each_thread is a double loop so
1933 * 'break' will not work as expected - use goto instead. 1916 * 'break' will not work as expected - use goto instead.
@@ -2224,6 +2207,7 @@ extern void normalize_rt_tasks(void);
2224extern struct task_group init_task_group; 2207extern struct task_group init_task_group;
2225#ifdef CONFIG_USER_SCHED 2208#ifdef CONFIG_USER_SCHED
2226extern struct task_group root_task_group; 2209extern struct task_group root_task_group;
2210extern void set_tg_uid(struct user_struct *user);
2227#endif 2211#endif
2228 2212
2229extern struct task_group *sched_create_group(struct task_group *parent); 2213extern struct task_group *sched_create_group(struct task_group *parent);
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 92f09bdf1175..d2c5ed845bcc 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -32,7 +32,7 @@
32 setting is locked or not. A setting which is locked cannot be 32 setting is locked or not. A setting which is locked cannot be
33 changed from user-level. */ 33 changed from user-level. */
34#define issecure_mask(X) (1 << (X)) 34#define issecure_mask(X) (1 << (X))
35#define issecure(X) (issecure_mask(X) & current->securebits) 35#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits))
36 36
37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ 37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \ 38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
diff --git a/include/linux/security.h b/include/linux/security.h
index e3d4ecda2673..3416cb85e77b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -37,6 +37,10 @@
37/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
38#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
39 39
40/* If capable should audit the security request */
41#define SECURITY_CAP_NOAUDIT 0
42#define SECURITY_CAP_AUDIT 1
43
40struct ctl_table; 44struct ctl_table;
41struct audit_krule; 45struct audit_krule;
42 46
@@ -44,25 +48,25 @@ struct audit_krule;
44 * These functions are in security/capability.c and are used 48 * These functions are in security/capability.c and are used
45 * as the default capabilities functions 49 * as the default capabilities functions
46 */ 50 */
47extern int cap_capable(struct task_struct *tsk, int cap); 51extern int cap_capable(struct task_struct *tsk, int cap, int audit);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 52extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 53extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
50extern int cap_ptrace_traceme(struct task_struct *parent); 54extern int cap_ptrace_traceme(struct task_struct *parent);
51extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 55extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 56extern int cap_capset(struct cred *new, const struct cred *old,
53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 57 const kernel_cap_t *effective,
54extern int cap_bprm_set_security(struct linux_binprm *bprm); 58 const kernel_cap_t *inheritable,
55extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); 59 const kernel_cap_t *permitted);
60extern int cap_bprm_set_creds(struct linux_binprm *bprm);
56extern int cap_bprm_secureexec(struct linux_binprm *bprm); 61extern int cap_bprm_secureexec(struct linux_binprm *bprm);
57extern int cap_inode_setxattr(struct dentry *dentry, const char *name, 62extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
58 const void *value, size_t size, int flags); 63 const void *value, size_t size, int flags);
59extern int cap_inode_removexattr(struct dentry *dentry, const char *name); 64extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
60extern int cap_inode_need_killpriv(struct dentry *dentry); 65extern int cap_inode_need_killpriv(struct dentry *dentry);
61extern int cap_inode_killpriv(struct dentry *dentry); 66extern int cap_inode_killpriv(struct dentry *dentry);
62extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 67extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
63extern void cap_task_reparent_to_init(struct task_struct *p);
64extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 68extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
65 unsigned long arg4, unsigned long arg5, long *rc_p); 69 unsigned long arg4, unsigned long arg5);
66extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 70extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
67extern int cap_task_setioprio(struct task_struct *p, int ioprio); 71extern int cap_task_setioprio(struct task_struct *p, int ioprio);
68extern int cap_task_setnice(struct task_struct *p, int nice); 72extern int cap_task_setnice(struct task_struct *p, int nice);
@@ -105,7 +109,7 @@ extern unsigned long mmap_min_addr;
105struct sched_param; 109struct sched_param;
106struct request_sock; 110struct request_sock;
107 111
108/* bprm_apply_creds unsafe reasons */ 112/* bprm->unsafe reasons */
109#define LSM_UNSAFE_SHARE 1 113#define LSM_UNSAFE_SHARE 1
110#define LSM_UNSAFE_PTRACE 2 114#define LSM_UNSAFE_PTRACE 2
111#define LSM_UNSAFE_PTRACE_CAP 4 115#define LSM_UNSAFE_PTRACE_CAP 4
@@ -149,36 +153,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
149 * 153 *
150 * Security hooks for program execution operations. 154 * Security hooks for program execution operations.
151 * 155 *
152 * @bprm_alloc_security: 156 * @bprm_set_creds:
153 * Allocate and attach a security structure to the @bprm->security field.
154 * The security field is initialized to NULL when the bprm structure is
155 * allocated.
156 * @bprm contains the linux_binprm structure to be modified.
157 * Return 0 if operation was successful.
158 * @bprm_free_security:
159 * @bprm contains the linux_binprm structure to be modified.
160 * Deallocate and clear the @bprm->security field.
161 * @bprm_apply_creds:
162 * Compute and set the security attributes of a process being transformed
163 * by an execve operation based on the old attributes (current->security)
164 * and the information saved in @bprm->security by the set_security hook.
165 * Since this hook function (and its caller) are void, this hook can not
166 * return an error. However, it can leave the security attributes of the
167 * process unchanged if an access failure occurs at this point.
168 * bprm_apply_creds is called under task_lock. @unsafe indicates various
169 * reasons why it may be unsafe to change security state.
170 * @bprm contains the linux_binprm structure.
171 * @bprm_post_apply_creds:
172 * Runs after bprm_apply_creds with the task_lock dropped, so that
173 * functions which cannot be called safely under the task_lock can
174 * be used. This hook is a good place to perform state changes on
175 * the process such as closing open file descriptors to which access
176 * is no longer granted if the attributes were changed.
177 * Note that a security module might need to save state between
178 * bprm_apply_creds and bprm_post_apply_creds to store the decision
179 * on whether the process may proceed.
180 * @bprm contains the linux_binprm structure.
181 * @bprm_set_security:
182 * Save security information in the bprm->security field, typically based 157 * Save security information in the bprm->security field, typically based
183 * on information about the bprm->file, for later use by the apply_creds 158 * on information about the bprm->file, for later use by the apply_creds
184 * hook. This hook may also optionally check permissions (e.g. for 159 * hook. This hook may also optionally check permissions (e.g. for
@@ -191,15 +166,30 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
191 * @bprm contains the linux_binprm structure. 166 * @bprm contains the linux_binprm structure.
192 * Return 0 if the hook is successful and permission is granted. 167 * Return 0 if the hook is successful and permission is granted.
193 * @bprm_check_security: 168 * @bprm_check_security:
194 * This hook mediates the point when a search for a binary handler will 169 * This hook mediates the point when a search for a binary handler will
195 * begin. It allows a check the @bprm->security value which is set in 170 * begin. It allows a check the @bprm->security value which is set in the
196 * the preceding set_security call. The primary difference from 171 * preceding set_creds call. The primary difference from set_creds is
197 * set_security is that the argv list and envp list are reliably 172 * that the argv list and envp list are reliably available in @bprm. This
198 * available in @bprm. This hook may be called multiple times 173 * hook may be called multiple times during a single execve; and in each
199 * during a single execve; and in each pass set_security is called 174 * pass set_creds is called first.
200 * first.
201 * @bprm contains the linux_binprm structure. 175 * @bprm contains the linux_binprm structure.
202 * Return 0 if the hook is successful and permission is granted. 176 * Return 0 if the hook is successful and permission is granted.
177 * @bprm_committing_creds:
178 * Prepare to install the new security attributes of a process being
179 * transformed by an execve operation, based on the old credentials
180 * pointed to by @current->cred and the information set in @bprm->cred by
181 * the bprm_set_creds hook. @bprm points to the linux_binprm structure.
182 * This hook is a good place to perform state changes on the process such
183 * as closing open file descriptors to which access will no longer be
184 * granted when the attributes are changed. This is called immediately
185 * before commit_creds().
186 * @bprm_committed_creds:
187 * Tidy up after the installation of the new security attributes of a
188 * process being transformed by an execve operation. The new credentials
189 * have, by this point, been set to @current->cred. @bprm points to the
190 * linux_binprm structure. This hook is a good place to perform state
191 * changes on the process such as clearing out non-inheritable signal
192 * state. This is called immediately after commit_creds().
203 * @bprm_secureexec: 193 * @bprm_secureexec:
204 * Return a boolean value (0 or 1) indicating whether a "secure exec" 194 * Return a boolean value (0 or 1) indicating whether a "secure exec"
205 * is required. The flag is passed in the auxiliary table 195 * is required. The flag is passed in the auxiliary table
@@ -585,15 +575,31 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
585 * manual page for definitions of the @clone_flags. 575 * manual page for definitions of the @clone_flags.
586 * @clone_flags contains the flags indicating what should be shared. 576 * @clone_flags contains the flags indicating what should be shared.
587 * Return 0 if permission is granted. 577 * Return 0 if permission is granted.
588 * @task_alloc_security: 578 * @cred_free:
589 * @p contains the task_struct for child process. 579 * @cred points to the credentials.
590 * Allocate and attach a security structure to the p->security field. The 580 * Deallocate and clear the cred->security field in a set of credentials.
591 * security field is initialized to NULL when the task structure is 581 * @cred_prepare:
592 * allocated. 582 * @new points to the new credentials.
593 * Return 0 if operation was successful. 583 * @old points to the original credentials.
594 * @task_free_security: 584 * @gfp indicates the atomicity of any memory allocations.
595 * @p contains the task_struct for process. 585 * Prepare a new set of credentials by copying the data from the old set.
596 * Deallocate and clear the p->security field. 586 * @cred_commit:
587 * @new points to the new credentials.
588 * @old points to the original credentials.
589 * Install a new set of credentials.
590 * @kernel_act_as:
591 * Set the credentials for a kernel service to act as (subjective context).
592 * @new points to the credentials to be modified.
593 * @secid specifies the security ID to be set
594 * The current task must be the one that nominated @secid.
595 * Return 0 if successful.
596 * @kernel_create_files_as:
597 * Set the file creation context in a set of credentials to be the same as
598 * the objective context of the specified inode.
599 * @new points to the credentials to be modified.
600 * @inode points to the inode to use as a reference.
601 * The current task must be the one that nominated @inode.
602 * Return 0 if successful.
597 * @task_setuid: 603 * @task_setuid:
598 * Check permission before setting one or more of the user identity 604 * Check permission before setting one or more of the user identity
599 * attributes of the current process. The @flags parameter indicates 605 * attributes of the current process. The @flags parameter indicates
@@ -606,15 +612,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * @id2 contains a uid. 612 * @id2 contains a uid.
607 * @flags contains one of the LSM_SETID_* values. 613 * @flags contains one of the LSM_SETID_* values.
608 * Return 0 if permission is granted. 614 * Return 0 if permission is granted.
609 * @task_post_setuid: 615 * @task_fix_setuid:
610 * Update the module's state after setting one or more of the user 616 * Update the module's state after setting one or more of the user
611 * identity attributes of the current process. The @flags parameter 617 * identity attributes of the current process. The @flags parameter
612 * indicates which of the set*uid system calls invoked this hook. If 618 * indicates which of the set*uid system calls invoked this hook. If
613 * @flags is LSM_SETID_FS, then @old_ruid is the old fs uid and the other 619 * @new is the set of credentials that will be installed. Modifications
614 * parameters are not used. 620 * should be made to this rather than to @current->cred.
615 * @old_ruid contains the old real uid (or fs uid if LSM_SETID_FS). 621 * @old is the set of credentials that are being replaces
616 * @old_euid contains the old effective uid (or -1 if LSM_SETID_FS).
617 * @old_suid contains the old saved uid (or -1 if LSM_SETID_FS).
618 * @flags contains one of the LSM_SETID_* values. 622 * @flags contains one of the LSM_SETID_* values.
619 * Return 0 on success. 623 * Return 0 on success.
620 * @task_setgid: 624 * @task_setgid:
@@ -717,13 +721,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
717 * @arg3 contains a argument. 721 * @arg3 contains a argument.
718 * @arg4 contains a argument. 722 * @arg4 contains a argument.
719 * @arg5 contains a argument. 723 * @arg5 contains a argument.
720 * @rc_p contains a pointer to communicate back the forced return code 724 * Return -ENOSYS if no-one wanted to handle this op, any other value to
721 * Return 0 if permission is granted, and non-zero if the security module 725 * cause prctl() to return immediately with that value.
722 * has taken responsibility (setting *rc_p) for the prctl call.
723 * @task_reparent_to_init:
724 * Set the security attributes in @p->security for a kernel thread that
725 * is being reparented to the init task.
726 * @p contains the task_struct for the kernel thread.
727 * @task_to_inode: 726 * @task_to_inode:
728 * Set the security attributes for an inode based on an associated task's 727 * Set the security attributes for an inode based on an associated task's
729 * security attributes, e.g. for /proc/pid inodes. 728 * security attributes, e.g. for /proc/pid inodes.
@@ -1000,7 +999,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1000 * See whether a specific operational right is granted to a process on a 999 * See whether a specific operational right is granted to a process on a
1001 * key. 1000 * key.
1002 * @key_ref refers to the key (key pointer + possession attribute bit). 1001 * @key_ref refers to the key (key pointer + possession attribute bit).
1003 * @context points to the process to provide the context against which to 1002 * @cred points to the credentials to provide the context against which to
1004 * evaluate the security data on the key. 1003 * evaluate the security data on the key.
1005 * @perm describes the combination of permissions required of this key. 1004 * @perm describes the combination of permissions required of this key.
1006 * Return 1 if permission granted, 0 if permission denied and -ve it the 1005 * Return 1 if permission granted, 0 if permission denied and -ve it the
@@ -1162,6 +1161,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1162 * @child process. 1161 * @child process.
1163 * Security modules may also want to perform a process tracing check 1162 * Security modules may also want to perform a process tracing check
1164 * during an execve in the set_security or apply_creds hooks of 1163 * during an execve in the set_security or apply_creds hooks of
1164 * tracing check during an execve in the bprm_set_creds hook of
1165 * binprm_security_ops if the process is being traced and its security 1165 * binprm_security_ops if the process is being traced and its security
1166 * attributes would be changed by the execve. 1166 * attributes would be changed by the execve.
1167 * @child contains the task_struct structure for the target process. 1167 * @child contains the task_struct structure for the target process.
@@ -1185,29 +1185,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1185 * @inheritable contains the inheritable capability set. 1185 * @inheritable contains the inheritable capability set.
1186 * @permitted contains the permitted capability set. 1186 * @permitted contains the permitted capability set.
1187 * Return 0 if the capability sets were successfully obtained. 1187 * Return 0 if the capability sets were successfully obtained.
1188 * @capset_check: 1188 * @capset:
1189 * Check permission before setting the @effective, @inheritable, and
1190 * @permitted capability sets for the @target process.
1191 * Caveat: @target is also set to current if a set of processes is
1192 * specified (i.e. all processes other than current and init or a
1193 * particular process group). Hence, the capset_set hook may need to
1194 * revalidate permission to the actual target process.
1195 * @target contains the task_struct structure for target process.
1196 * @effective contains the effective capability set.
1197 * @inheritable contains the inheritable capability set.
1198 * @permitted contains the permitted capability set.
1199 * Return 0 if permission is granted.
1200 * @capset_set:
1201 * Set the @effective, @inheritable, and @permitted capability sets for 1189 * Set the @effective, @inheritable, and @permitted capability sets for
1202 * the @target process. Since capset_check cannot always check permission 1190 * the current process.
1203 * to the real @target process, this hook may also perform permission 1191 * @new contains the new credentials structure for target process.
1204 * checking to determine if the current process is allowed to set the 1192 * @old contains the current credentials structure for target process.
1205 * capability sets of the @target process. However, this hook has no way
1206 * of returning an error due to the structure of the sys_capset code.
1207 * @target contains the task_struct structure for target process.
1208 * @effective contains the effective capability set. 1193 * @effective contains the effective capability set.
1209 * @inheritable contains the inheritable capability set. 1194 * @inheritable contains the inheritable capability set.
1210 * @permitted contains the permitted capability set. 1195 * @permitted contains the permitted capability set.
1196 * Return 0 and update @new if permission is granted.
1211 * @capable: 1197 * @capable:
1212 * Check whether the @tsk process has the @cap capability. 1198 * Check whether the @tsk process has the @cap capability.
1213 * @tsk contains the task_struct for the process. 1199 * @tsk contains the task_struct for the process.
@@ -1299,15 +1285,12 @@ struct security_operations {
1299 int (*capget) (struct task_struct *target, 1285 int (*capget) (struct task_struct *target,
1300 kernel_cap_t *effective, 1286 kernel_cap_t *effective,
1301 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1287 kernel_cap_t *inheritable, kernel_cap_t *permitted);
1302 int (*capset_check) (struct task_struct *target, 1288 int (*capset) (struct cred *new,
1303 kernel_cap_t *effective, 1289 const struct cred *old,
1304 kernel_cap_t *inheritable, 1290 const kernel_cap_t *effective,
1305 kernel_cap_t *permitted); 1291 const kernel_cap_t *inheritable,
1306 void (*capset_set) (struct task_struct *target, 1292 const kernel_cap_t *permitted);
1307 kernel_cap_t *effective, 1293 int (*capable) (struct task_struct *tsk, int cap, int audit);
1308 kernel_cap_t *inheritable,
1309 kernel_cap_t *permitted);
1310 int (*capable) (struct task_struct *tsk, int cap);
1311 int (*acct) (struct file *file); 1294 int (*acct) (struct file *file);
1312 int (*sysctl) (struct ctl_table *table, int op); 1295 int (*sysctl) (struct ctl_table *table, int op);
1313 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1296 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
@@ -1316,18 +1299,16 @@ struct security_operations {
1316 int (*settime) (struct timespec *ts, struct timezone *tz); 1299 int (*settime) (struct timespec *ts, struct timezone *tz);
1317 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1300 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1318 1301
1319 int (*bprm_alloc_security) (struct linux_binprm *bprm); 1302 int (*bprm_set_creds) (struct linux_binprm *bprm);
1320 void (*bprm_free_security) (struct linux_binprm *bprm);
1321 void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe);
1322 void (*bprm_post_apply_creds) (struct linux_binprm *bprm);
1323 int (*bprm_set_security) (struct linux_binprm *bprm);
1324 int (*bprm_check_security) (struct linux_binprm *bprm); 1303 int (*bprm_check_security) (struct linux_binprm *bprm);
1325 int (*bprm_secureexec) (struct linux_binprm *bprm); 1304 int (*bprm_secureexec) (struct linux_binprm *bprm);
1305 void (*bprm_committing_creds) (struct linux_binprm *bprm);
1306 void (*bprm_committed_creds) (struct linux_binprm *bprm);
1326 1307
1327 int (*sb_alloc_security) (struct super_block *sb); 1308 int (*sb_alloc_security) (struct super_block *sb);
1328 void (*sb_free_security) (struct super_block *sb); 1309 void (*sb_free_security) (struct super_block *sb);
1329 int (*sb_copy_data) (char *orig, char *copy); 1310 int (*sb_copy_data) (char *orig, char *copy);
1330 int (*sb_kern_mount) (struct super_block *sb, void *data); 1311 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1331 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1312 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1332 int (*sb_statfs) (struct dentry *dentry); 1313 int (*sb_statfs) (struct dentry *dentry);
1333 int (*sb_mount) (char *dev_name, struct path *path, 1314 int (*sb_mount) (char *dev_name, struct path *path,
@@ -1406,14 +1387,18 @@ struct security_operations {
1406 int (*file_send_sigiotask) (struct task_struct *tsk, 1387 int (*file_send_sigiotask) (struct task_struct *tsk,
1407 struct fown_struct *fown, int sig); 1388 struct fown_struct *fown, int sig);
1408 int (*file_receive) (struct file *file); 1389 int (*file_receive) (struct file *file);
1409 int (*dentry_open) (struct file *file); 1390 int (*dentry_open) (struct file *file, const struct cred *cred);
1410 1391
1411 int (*task_create) (unsigned long clone_flags); 1392 int (*task_create) (unsigned long clone_flags);
1412 int (*task_alloc_security) (struct task_struct *p); 1393 void (*cred_free) (struct cred *cred);
1413 void (*task_free_security) (struct task_struct *p); 1394 int (*cred_prepare)(struct cred *new, const struct cred *old,
1395 gfp_t gfp);
1396 void (*cred_commit)(struct cred *new, const struct cred *old);
1397 int (*kernel_act_as)(struct cred *new, u32 secid);
1398 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1414 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1399 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1415 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , 1400 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1416 uid_t old_euid, uid_t old_suid, int flags); 1401 int flags);
1417 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); 1402 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1418 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1403 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1419 int (*task_getpgid) (struct task_struct *p); 1404 int (*task_getpgid) (struct task_struct *p);
@@ -1433,8 +1418,7 @@ struct security_operations {
1433 int (*task_wait) (struct task_struct *p); 1418 int (*task_wait) (struct task_struct *p);
1434 int (*task_prctl) (int option, unsigned long arg2, 1419 int (*task_prctl) (int option, unsigned long arg2,
1435 unsigned long arg3, unsigned long arg4, 1420 unsigned long arg3, unsigned long arg4,
1436 unsigned long arg5, long *rc_p); 1421 unsigned long arg5);
1437 void (*task_reparent_to_init) (struct task_struct *p);
1438 void (*task_to_inode) (struct task_struct *p, struct inode *inode); 1422 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1439 1423
1440 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag); 1424 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
@@ -1539,10 +1523,10 @@ struct security_operations {
1539 1523
1540 /* key management security hooks */ 1524 /* key management security hooks */
1541#ifdef CONFIG_KEYS 1525#ifdef CONFIG_KEYS
1542 int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags); 1526 int (*key_alloc) (struct key *key, const struct cred *cred, unsigned long flags);
1543 void (*key_free) (struct key *key); 1527 void (*key_free) (struct key *key);
1544 int (*key_permission) (key_ref_t key_ref, 1528 int (*key_permission) (key_ref_t key_ref,
1545 struct task_struct *context, 1529 const struct cred *cred,
1546 key_perm_t perm); 1530 key_perm_t perm);
1547 int (*key_getsecurity)(struct key *key, char **_buffer); 1531 int (*key_getsecurity)(struct key *key, char **_buffer);
1548#endif /* CONFIG_KEYS */ 1532#endif /* CONFIG_KEYS */
@@ -1568,15 +1552,12 @@ int security_capget(struct task_struct *target,
1568 kernel_cap_t *effective, 1552 kernel_cap_t *effective,
1569 kernel_cap_t *inheritable, 1553 kernel_cap_t *inheritable,
1570 kernel_cap_t *permitted); 1554 kernel_cap_t *permitted);
1571int security_capset_check(struct task_struct *target, 1555int security_capset(struct cred *new, const struct cred *old,
1572 kernel_cap_t *effective, 1556 const kernel_cap_t *effective,
1573 kernel_cap_t *inheritable, 1557 const kernel_cap_t *inheritable,
1574 kernel_cap_t *permitted); 1558 const kernel_cap_t *permitted);
1575void security_capset_set(struct task_struct *target,
1576 kernel_cap_t *effective,
1577 kernel_cap_t *inheritable,
1578 kernel_cap_t *permitted);
1579int security_capable(struct task_struct *tsk, int cap); 1559int security_capable(struct task_struct *tsk, int cap);
1560int security_capable_noaudit(struct task_struct *tsk, int cap);
1580int security_acct(struct file *file); 1561int security_acct(struct file *file);
1581int security_sysctl(struct ctl_table *table, int op); 1562int security_sysctl(struct ctl_table *table, int op);
1582int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1563int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1586,17 +1567,15 @@ int security_settime(struct timespec *ts, struct timezone *tz);
1586int security_vm_enough_memory(long pages); 1567int security_vm_enough_memory(long pages);
1587int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1568int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1588int security_vm_enough_memory_kern(long pages); 1569int security_vm_enough_memory_kern(long pages);
1589int security_bprm_alloc(struct linux_binprm *bprm); 1570int security_bprm_set_creds(struct linux_binprm *bprm);
1590void security_bprm_free(struct linux_binprm *bprm);
1591void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
1592void security_bprm_post_apply_creds(struct linux_binprm *bprm);
1593int security_bprm_set(struct linux_binprm *bprm);
1594int security_bprm_check(struct linux_binprm *bprm); 1571int security_bprm_check(struct linux_binprm *bprm);
1572void security_bprm_committing_creds(struct linux_binprm *bprm);
1573void security_bprm_committed_creds(struct linux_binprm *bprm);
1595int security_bprm_secureexec(struct linux_binprm *bprm); 1574int security_bprm_secureexec(struct linux_binprm *bprm);
1596int security_sb_alloc(struct super_block *sb); 1575int security_sb_alloc(struct super_block *sb);
1597void security_sb_free(struct super_block *sb); 1576void security_sb_free(struct super_block *sb);
1598int security_sb_copy_data(char *orig, char *copy); 1577int security_sb_copy_data(char *orig, char *copy);
1599int security_sb_kern_mount(struct super_block *sb, void *data); 1578int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1600int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1579int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1601int security_sb_statfs(struct dentry *dentry); 1580int security_sb_statfs(struct dentry *dentry);
1602int security_sb_mount(char *dev_name, struct path *path, 1581int security_sb_mount(char *dev_name, struct path *path,
@@ -1663,13 +1642,16 @@ int security_file_set_fowner(struct file *file);
1663int security_file_send_sigiotask(struct task_struct *tsk, 1642int security_file_send_sigiotask(struct task_struct *tsk,
1664 struct fown_struct *fown, int sig); 1643 struct fown_struct *fown, int sig);
1665int security_file_receive(struct file *file); 1644int security_file_receive(struct file *file);
1666int security_dentry_open(struct file *file); 1645int security_dentry_open(struct file *file, const struct cred *cred);
1667int security_task_create(unsigned long clone_flags); 1646int security_task_create(unsigned long clone_flags);
1668int security_task_alloc(struct task_struct *p); 1647void security_cred_free(struct cred *cred);
1669void security_task_free(struct task_struct *p); 1648int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1649void security_commit_creds(struct cred *new, const struct cred *old);
1650int security_kernel_act_as(struct cred *new, u32 secid);
1651int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1670int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1652int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1671int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 1653int security_task_fix_setuid(struct cred *new, const struct cred *old,
1672 uid_t old_suid, int flags); 1654 int flags);
1673int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); 1655int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1674int security_task_setpgid(struct task_struct *p, pid_t pgid); 1656int security_task_setpgid(struct task_struct *p, pid_t pgid);
1675int security_task_getpgid(struct task_struct *p); 1657int security_task_getpgid(struct task_struct *p);
@@ -1688,8 +1670,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1688 int sig, u32 secid); 1670 int sig, u32 secid);
1689int security_task_wait(struct task_struct *p); 1671int security_task_wait(struct task_struct *p);
1690int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1672int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1691 unsigned long arg4, unsigned long arg5, long *rc_p); 1673 unsigned long arg4, unsigned long arg5);
1692void security_task_reparent_to_init(struct task_struct *p);
1693void security_task_to_inode(struct task_struct *p, struct inode *inode); 1674void security_task_to_inode(struct task_struct *p, struct inode *inode);
1694int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1675int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1695void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); 1676void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
@@ -1764,25 +1745,23 @@ static inline int security_capget(struct task_struct *target,
1764 return cap_capget(target, effective, inheritable, permitted); 1745 return cap_capget(target, effective, inheritable, permitted);
1765} 1746}
1766 1747
1767static inline int security_capset_check(struct task_struct *target, 1748static inline int security_capset(struct cred *new,
1768 kernel_cap_t *effective, 1749 const struct cred *old,
1769 kernel_cap_t *inheritable, 1750 const kernel_cap_t *effective,
1770 kernel_cap_t *permitted) 1751 const kernel_cap_t *inheritable,
1752 const kernel_cap_t *permitted)
1771{ 1753{
1772 return cap_capset_check(target, effective, inheritable, permitted); 1754 return cap_capset(new, old, effective, inheritable, permitted);
1773} 1755}
1774 1756
1775static inline void security_capset_set(struct task_struct *target, 1757static inline int security_capable(struct task_struct *tsk, int cap)
1776 kernel_cap_t *effective,
1777 kernel_cap_t *inheritable,
1778 kernel_cap_t *permitted)
1779{ 1758{
1780 cap_capset_set(target, effective, inheritable, permitted); 1759 return cap_capable(tsk, cap, SECURITY_CAP_AUDIT);
1781} 1760}
1782 1761
1783static inline int security_capable(struct task_struct *tsk, int cap) 1762static inline int security_capable_noaudit(struct task_struct *tsk, int cap)
1784{ 1763{
1785 return cap_capable(tsk, cap); 1764 return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT);
1786} 1765}
1787 1766
1788static inline int security_acct(struct file *file) 1767static inline int security_acct(struct file *file)
@@ -1835,32 +1814,22 @@ static inline int security_vm_enough_memory_kern(long pages)
1835 return cap_vm_enough_memory(current->mm, pages); 1814 return cap_vm_enough_memory(current->mm, pages);
1836} 1815}
1837 1816
1838static inline int security_bprm_alloc(struct linux_binprm *bprm) 1817static inline int security_bprm_set_creds(struct linux_binprm *bprm)
1839{
1840 return 0;
1841}
1842
1843static inline void security_bprm_free(struct linux_binprm *bprm)
1844{ }
1845
1846static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
1847{ 1818{
1848 cap_bprm_apply_creds(bprm, unsafe); 1819 return cap_bprm_set_creds(bprm);
1849} 1820}
1850 1821
1851static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm) 1822static inline int security_bprm_check(struct linux_binprm *bprm)
1852{ 1823{
1853 return; 1824 return 0;
1854} 1825}
1855 1826
1856static inline int security_bprm_set(struct linux_binprm *bprm) 1827static inline void security_bprm_committing_creds(struct linux_binprm *bprm)
1857{ 1828{
1858 return cap_bprm_set_security(bprm);
1859} 1829}
1860 1830
1861static inline int security_bprm_check(struct linux_binprm *bprm) 1831static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
1862{ 1832{
1863 return 0;
1864} 1833}
1865 1834
1866static inline int security_bprm_secureexec(struct linux_binprm *bprm) 1835static inline int security_bprm_secureexec(struct linux_binprm *bprm)
@@ -1881,7 +1850,7 @@ static inline int security_sb_copy_data(char *orig, char *copy)
1881 return 0; 1850 return 0;
1882} 1851}
1883 1852
1884static inline int security_sb_kern_mount(struct super_block *sb, void *data) 1853static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1885{ 1854{
1886 return 0; 1855 return 0;
1887} 1856}
@@ -2177,7 +2146,8 @@ static inline int security_file_receive(struct file *file)
2177 return 0; 2146 return 0;
2178} 2147}
2179 2148
2180static inline int security_dentry_open(struct file *file) 2149static inline int security_dentry_open(struct file *file,
2150 const struct cred *cred)
2181{ 2151{
2182 return 0; 2152 return 0;
2183} 2153}
@@ -2187,13 +2157,31 @@ static inline int security_task_create(unsigned long clone_flags)
2187 return 0; 2157 return 0;
2188} 2158}
2189 2159
2190static inline int security_task_alloc(struct task_struct *p) 2160static inline void security_cred_free(struct cred *cred)
2161{ }
2162
2163static inline int security_prepare_creds(struct cred *new,
2164 const struct cred *old,
2165 gfp_t gfp)
2191{ 2166{
2192 return 0; 2167 return 0;
2193} 2168}
2194 2169
2195static inline void security_task_free(struct task_struct *p) 2170static inline void security_commit_creds(struct cred *new,
2196{ } 2171 const struct cred *old)
2172{
2173}
2174
2175static inline int security_kernel_act_as(struct cred *cred, u32 secid)
2176{
2177 return 0;
2178}
2179
2180static inline int security_kernel_create_files_as(struct cred *cred,
2181 struct inode *inode)
2182{
2183 return 0;
2184}
2197 2185
2198static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, 2186static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2199 int flags) 2187 int flags)
@@ -2201,10 +2189,11 @@ static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2201 return 0; 2189 return 0;
2202} 2190}
2203 2191
2204static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 2192static inline int security_task_fix_setuid(struct cred *new,
2205 uid_t old_suid, int flags) 2193 const struct cred *old,
2194 int flags)
2206{ 2195{
2207 return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags); 2196 return cap_task_fix_setuid(new, old, flags);
2208} 2197}
2209 2198
2210static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, 2199static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
@@ -2291,14 +2280,9 @@ static inline int security_task_wait(struct task_struct *p)
2291static inline int security_task_prctl(int option, unsigned long arg2, 2280static inline int security_task_prctl(int option, unsigned long arg2,
2292 unsigned long arg3, 2281 unsigned long arg3,
2293 unsigned long arg4, 2282 unsigned long arg4,
2294 unsigned long arg5, long *rc_p) 2283 unsigned long arg5)
2295{
2296 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p);
2297}
2298
2299static inline void security_task_reparent_to_init(struct task_struct *p)
2300{ 2284{
2301 cap_task_reparent_to_init(p); 2285 return cap_task_prctl(option, arg2, arg3, arg3, arg5);
2302} 2286}
2303 2287
2304static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) 2288static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
@@ -2724,16 +2708,16 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2724#ifdef CONFIG_KEYS 2708#ifdef CONFIG_KEYS
2725#ifdef CONFIG_SECURITY 2709#ifdef CONFIG_SECURITY
2726 2710
2727int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags); 2711int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
2728void security_key_free(struct key *key); 2712void security_key_free(struct key *key);
2729int security_key_permission(key_ref_t key_ref, 2713int security_key_permission(key_ref_t key_ref,
2730 struct task_struct *context, key_perm_t perm); 2714 const struct cred *cred, key_perm_t perm);
2731int security_key_getsecurity(struct key *key, char **_buffer); 2715int security_key_getsecurity(struct key *key, char **_buffer);
2732 2716
2733#else 2717#else
2734 2718
2735static inline int security_key_alloc(struct key *key, 2719static inline int security_key_alloc(struct key *key,
2736 struct task_struct *tsk, 2720 const struct cred *cred,
2737 unsigned long flags) 2721 unsigned long flags)
2738{ 2722{
2739 return 0; 2723 return 0;
@@ -2744,7 +2728,7 @@ static inline void security_key_free(struct key *key)
2744} 2728}
2745 2729
2746static inline int security_key_permission(key_ref_t key_ref, 2730static inline int security_key_permission(key_ref_t key_ref,
2747 struct task_struct *context, 2731 const struct cred *cred,
2748 key_perm_t perm) 2732 key_perm_t perm)
2749{ 2733{
2750 return 0; 2734 return 0;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index dc50bcc282a8..b3dfa72f13b9 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -34,6 +34,7 @@ struct seq_operations {
34 34
35#define SEQ_SKIP 1 35#define SEQ_SKIP 1
36 36
37char *mangle_path(char *s, char *p, char *esc);
37int seq_open(struct file *, const struct seq_operations *); 38int seq_open(struct file *, const struct seq_operations *);
38ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 39ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
39loff_t seq_lseek(struct file *, loff_t, int); 40loff_t seq_lseek(struct file *, loff_t, int);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2725f4e5a9bf..cf2cb50f77d1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -250,6 +250,9 @@ typedef unsigned char *sk_buff_data_t;
250 * @tc_verd: traffic control verdict 250 * @tc_verd: traffic control verdict
251 * @ndisc_nodetype: router type (from link layer) 251 * @ndisc_nodetype: router type (from link layer)
252 * @do_not_encrypt: set to prevent encryption of this frame 252 * @do_not_encrypt: set to prevent encryption of this frame
253 * @requeue: set to indicate that the wireless core should attempt
254 * a software retry on this frame if we failed to
255 * receive an ACK for it
253 * @dma_cookie: a cookie to one of several possible DMA operations 256 * @dma_cookie: a cookie to one of several possible DMA operations
254 * done by skb DMA functions 257 * done by skb DMA functions
255 * @secmark: security marking 258 * @secmark: security marking
@@ -269,8 +272,9 @@ struct sk_buff {
269 struct dst_entry *dst; 272 struct dst_entry *dst;
270 struct rtable *rtable; 273 struct rtable *rtable;
271 }; 274 };
275#ifdef CONFIG_XFRM
272 struct sec_path *sp; 276 struct sec_path *sp;
273 277#endif
274 /* 278 /*
275 * This is the control buffer. It is free to use for every 279 * This is the control buffer. It is free to use for every
276 * layer. Please put your private variables there. If you 280 * layer. Please put your private variables there. If you
@@ -325,6 +329,7 @@ struct sk_buff {
325#endif 329#endif
326#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 330#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
327 __u8 do_not_encrypt:1; 331 __u8 do_not_encrypt:1;
332 __u8 requeue:1;
328#endif 333#endif
329 /* 0/13/14 bit hole */ 334 /* 0/13/14 bit hole */
330 335
@@ -488,6 +493,19 @@ static inline bool skb_queue_is_last(const struct sk_buff_head *list,
488} 493}
489 494
490/** 495/**
496 * skb_queue_is_first - check if skb is the first entry in the queue
497 * @list: queue head
498 * @skb: buffer
499 *
500 * Returns true if @skb is the first buffer on the list.
501 */
502static inline bool skb_queue_is_first(const struct sk_buff_head *list,
503 const struct sk_buff *skb)
504{
505 return (skb->prev == (struct sk_buff *) list);
506}
507
508/**
491 * skb_queue_next - return the next packet in the queue 509 * skb_queue_next - return the next packet in the queue
492 * @list: queue head 510 * @list: queue head
493 * @skb: current buffer 511 * @skb: current buffer
@@ -506,6 +524,24 @@ static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
506} 524}
507 525
508/** 526/**
527 * skb_queue_prev - return the prev packet in the queue
528 * @list: queue head
529 * @skb: current buffer
530 *
531 * Return the prev packet in @list before @skb. It is only valid to
532 * call this if skb_queue_is_first() evaluates to false.
533 */
534static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
535 const struct sk_buff *skb)
536{
537 /* This BUG_ON may seem severe, but if we just return then we
538 * are going to dereference garbage.
539 */
540 BUG_ON(skb_queue_is_first(list, skb));
541 return skb->prev;
542}
543
544/**
509 * skb_get - reference buffer 545 * skb_get - reference buffer
510 * @skb: buffer to reference 546 * @skb: buffer to reference
511 * 547 *
@@ -1647,8 +1683,12 @@ extern int skb_splice_bits(struct sk_buff *skb,
1647extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1683extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1648extern void skb_split(struct sk_buff *skb, 1684extern void skb_split(struct sk_buff *skb,
1649 struct sk_buff *skb1, const u32 len); 1685 struct sk_buff *skb1, const u32 len);
1686extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1687 int shiftlen);
1650 1688
1651extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1689extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1690extern int skb_gro_receive(struct sk_buff **head,
1691 struct sk_buff *skb);
1652 1692
1653static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1693static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1654 int len, void *buffer) 1694 int len, void *buffer)
@@ -1864,6 +1904,18 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1864 to->queue_mapping = from->queue_mapping; 1904 to->queue_mapping = from->queue_mapping;
1865} 1905}
1866 1906
1907#ifdef CONFIG_XFRM
1908static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1909{
1910 return skb->sp;
1911}
1912#else
1913static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1914{
1915 return NULL;
1916}
1917#endif
1918
1867static inline int skb_is_gso(const struct sk_buff *skb) 1919static inline int skb_is_gso(const struct sk_buff *skb)
1868{ 1920{
1869 return skb_shinfo(skb)->gso_size; 1921 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 0d5770c2e43a..2f85f3b04bc4 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -149,6 +149,8 @@ static inline void smp_send_reschedule(int cpu) { }
149}) 149})
150#define smp_call_function_mask(mask, func, info, wait) \ 150#define smp_call_function_mask(mask, func, info, wait) \
151 (up_smp_call_function(func, info)) 151 (up_smp_call_function(func, info))
152#define smp_call_function_many(mask, func, info, wait) \
153 (up_smp_call_function(func, info))
152static inline void init_call_single_data(void) 154static inline void init_call_single_data(void)
153{ 155{
154} 156}
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
new file mode 100644
index 000000000000..1cbf0313adde
--- /dev/null
+++ b/include/linux/smsc911x.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 *
3 * Copyright (C) 2004-2008 SMSC
4 * Copyright (C) 2005-2008 ARM
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 ***************************************************************************/
21#ifndef __LINUX_SMSC911X_H__
22#define __LINUX_SMSC911X_H__
23
24#include <linux/phy.h>
25
26/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */
28struct smsc911x_platform_config {
29 unsigned int irq_polarity;
30 unsigned int irq_type;
31 unsigned int flags;
32 phy_interface_t phy_interface;
33};
34
35/* Constants for platform_device irq polarity configuration */
36#define SMSC911X_IRQ_POLARITY_ACTIVE_LOW 0
37#define SMSC911X_IRQ_POLARITY_ACTIVE_HIGH 1
38
39/* Constants for platform_device irq type configuration */
40#define SMSC911X_IRQ_TYPE_OPEN_DRAIN 0
41#define SMSC911X_IRQ_TYPE_PUSH_PULL 1
42
43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1))
46
47#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 7a6e6bba4a71..aee3f1e1d1ce 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -216,6 +216,9 @@ enum
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ 217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ 218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
219 LINUX_MIB_SACKSHIFTED,
220 LINUX_MIB_SACKMERGED,
221 LINUX_MIB_SACKSHIFTFALLBACK,
219 __LINUX_MIB_MAX 222 __LINUX_MIB_MAX
220}; 223};
221 224
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index b106fd8e0d5c..1a8cecc4f38c 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -15,9 +15,17 @@ extern void save_stack_trace_tsk(struct task_struct *tsk,
15 struct stack_trace *trace); 15 struct stack_trace *trace);
16 16
17extern void print_stack_trace(struct stack_trace *trace, int spaces); 17extern void print_stack_trace(struct stack_trace *trace, int spaces);
18
19#ifdef CONFIG_USER_STACKTRACE_SUPPORT
20extern void save_stack_trace_user(struct stack_trace *trace);
21#else
22# define save_stack_trace_user(trace) do { } while (0)
23#endif
24
18#else 25#else
19# define save_stack_trace(trace) do { } while (0) 26# define save_stack_trace(trace) do { } while (0)
20# define save_stack_trace_tsk(tsk, trace) do { } while (0) 27# define save_stack_trace_tsk(tsk, trace) do { } while (0)
28# define save_stack_trace_user(trace) do { } while (0)
21# define print_stack_trace(trace, spaces) do { } while (0) 29# define print_stack_trace(trace, spaces) do { } while (0)
22#endif 30#endif
23 31
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 6fd7b016517f..0127daca4354 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -139,14 +139,14 @@ static inline char *__svc_print_addr(struct sockaddr *addr,
139{ 139{
140 switch (addr->sa_family) { 140 switch (addr->sa_family) {
141 case AF_INET: 141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u", 142 snprintf(buf, len, "%pI4, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), 143 &((struct sockaddr_in *)addr)->sin_addr,
144 ntohs(((struct sockaddr_in *) addr)->sin_port)); 144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 145 break;
146 146
147 case AF_INET6: 147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", 148 snprintf(buf, len, "%pI6, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), 149 &((struct sockaddr_in6 *)addr)->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break; 151 break;
152 152
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 117f1b7405cf..0c5b5ac36d8e 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -49,7 +49,7 @@
49 for_each_online_node(node) \ 49 for_each_online_node(node) \
50 if (nr_cpus_node(node)) 50 if (nr_cpus_node(node))
51 51
52void arch_update_cpu_topology(void); 52int arch_update_cpu_topology(void);
53 53
54/* Conform to ACPI 2.0 SLIT distance definitions */ 54/* Conform to ACPI 2.0 SLIT distance definitions */
55#define LOCAL_DISTANCE 10 55#define LOCAL_DISTANCE 10
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c5bb39c7a770..757005458366 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -24,8 +24,12 @@ struct tracepoint {
24 const char *name; /* Tracepoint name */ 24 const char *name; /* Tracepoint name */
25 int state; /* State. */ 25 int state; /* State. */
26 void **funcs; 26 void **funcs;
27} __attribute__((aligned(8))); 27} __attribute__((aligned(32))); /*
28 28 * Aligned on 32 bytes because it is
29 * globally visible and gcc happily
30 * align these on the structure size.
31 * Keep in sync with vmlinux.lds.h.
32 */
29 33
30#define TPPROTO(args...) args 34#define TPPROTO(args...) args
31#define TPARGS(args...) args 35#define TPARGS(args...) args
@@ -40,14 +44,14 @@ struct tracepoint {
40 do { \ 44 do { \
41 void **it_func; \ 45 void **it_func; \
42 \ 46 \
43 rcu_read_lock_sched(); \ 47 rcu_read_lock_sched_notrace(); \
44 it_func = rcu_dereference((tp)->funcs); \ 48 it_func = rcu_dereference((tp)->funcs); \
45 if (it_func) { \ 49 if (it_func) { \
46 do { \ 50 do { \
47 ((void(*)(proto))(*it_func))(args); \ 51 ((void(*)(proto))(*it_func))(args); \
48 } while (*(++it_func)); \ 52 } while (*(++it_func)); \
49 } \ 53 } \
50 rcu_read_unlock_sched(); \ 54 rcu_read_unlock_sched_notrace(); \
51 } while (0) 55 } while (0)
52 56
53/* 57/*
@@ -55,35 +59,40 @@ struct tracepoint {
55 * not add unwanted padding between the beginning of the section and the 59 * not add unwanted padding between the beginning of the section and the
56 * structure. Force alignment to the same alignment as the section start. 60 * structure. Force alignment to the same alignment as the section start.
57 */ 61 */
58#define DEFINE_TRACE(name, proto, args) \ 62#define DECLARE_TRACE(name, proto, args) \
63 extern struct tracepoint __tracepoint_##name; \
59 static inline void trace_##name(proto) \ 64 static inline void trace_##name(proto) \
60 { \ 65 { \
61 static const char __tpstrtab_##name[] \
62 __attribute__((section("__tracepoints_strings"))) \
63 = #name ":" #proto; \
64 static struct tracepoint __tracepoint_##name \
65 __attribute__((section("__tracepoints"), aligned(8))) = \
66 { __tpstrtab_##name, 0, NULL }; \
67 if (unlikely(__tracepoint_##name.state)) \ 66 if (unlikely(__tracepoint_##name.state)) \
68 __DO_TRACE(&__tracepoint_##name, \ 67 __DO_TRACE(&__tracepoint_##name, \
69 TPPROTO(proto), TPARGS(args)); \ 68 TPPROTO(proto), TPARGS(args)); \
70 } \ 69 } \
71 static inline int register_trace_##name(void (*probe)(proto)) \ 70 static inline int register_trace_##name(void (*probe)(proto)) \
72 { \ 71 { \
73 return tracepoint_probe_register(#name ":" #proto, \ 72 return tracepoint_probe_register(#name, (void *)probe); \
74 (void *)probe); \
75 } \ 73 } \
76 static inline void unregister_trace_##name(void (*probe)(proto))\ 74 static inline int unregister_trace_##name(void (*probe)(proto)) \
77 { \ 75 { \
78 tracepoint_probe_unregister(#name ":" #proto, \ 76 return tracepoint_probe_unregister(#name, (void *)probe);\
79 (void *)probe); \
80 } 77 }
81 78
79#define DEFINE_TRACE(name) \
80 static const char __tpstrtab_##name[] \
81 __attribute__((section("__tracepoints_strings"))) = #name; \
82 struct tracepoint __tracepoint_##name \
83 __attribute__((section("__tracepoints"), aligned(32))) = \
84 { __tpstrtab_##name, 0, NULL }
85
86#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
87 EXPORT_SYMBOL_GPL(__tracepoint_##name)
88#define EXPORT_TRACEPOINT_SYMBOL(name) \
89 EXPORT_SYMBOL(__tracepoint_##name)
90
82extern void tracepoint_update_probe_range(struct tracepoint *begin, 91extern void tracepoint_update_probe_range(struct tracepoint *begin,
83 struct tracepoint *end); 92 struct tracepoint *end);
84 93
85#else /* !CONFIG_TRACEPOINTS */ 94#else /* !CONFIG_TRACEPOINTS */
86#define DEFINE_TRACE(name, proto, args) \ 95#define DECLARE_TRACE(name, proto, args) \
87 static inline void _do_trace_##name(struct tracepoint *tp, proto) \ 96 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
88 { } \ 97 { } \
89 static inline void trace_##name(proto) \ 98 static inline void trace_##name(proto) \
@@ -92,8 +101,14 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
92 { \ 101 { \
93 return -ENOSYS; \ 102 return -ENOSYS; \
94 } \ 103 } \
95 static inline void unregister_trace_##name(void (*probe)(proto))\ 104 static inline int unregister_trace_##name(void (*probe)(proto)) \
96 { } 105 { \
106 return -ENOSYS; \
107 }
108
109#define DEFINE_TRACE(name)
110#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
111#define EXPORT_TRACEPOINT_SYMBOL(name)
97 112
98static inline void tracepoint_update_probe_range(struct tracepoint *begin, 113static inline void tracepoint_update_probe_range(struct tracepoint *begin,
99 struct tracepoint *end) 114 struct tracepoint *end)
@@ -112,6 +127,10 @@ extern int tracepoint_probe_register(const char *name, void *probe);
112 */ 127 */
113extern int tracepoint_probe_unregister(const char *name, void *probe); 128extern int tracepoint_probe_unregister(const char *name, void *probe);
114 129
130extern int tracepoint_probe_register_noupdate(const char *name, void *probe);
131extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe);
132extern void tracepoint_probe_update_all(void);
133
115struct tracepoint_iter { 134struct tracepoint_iter {
116 struct module *module; 135 struct module *module;
117 struct tracepoint *tracepoint; 136 struct tracepoint *tracepoint;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 3b8121d4e36f..3f4954c55e53 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -325,7 +325,7 @@ extern struct class *tty_class;
325 * go away 325 * go away
326 */ 326 */
327 327
328extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty) 328static inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
329{ 329{
330 if (tty) 330 if (tty)
331 kref_get(&tty->kref); 331 kref_get(&tty->kref);
@@ -442,6 +442,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
442 size_t size); 442 size_t size);
443extern void tty_audit_exit(void); 443extern void tty_audit_exit(void);
444extern void tty_audit_fork(struct signal_struct *sig); 444extern void tty_audit_fork(struct signal_struct *sig);
445extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
445extern void tty_audit_push(struct tty_struct *tty); 446extern void tty_audit_push(struct tty_struct *tty);
446extern void tty_audit_push_task(struct task_struct *tsk, 447extern void tty_audit_push_task(struct task_struct *tsk,
447 uid_t loginuid, u32 sessionid); 448 uid_t loginuid, u32 sessionid);
@@ -450,6 +451,9 @@ static inline void tty_audit_add_data(struct tty_struct *tty,
450 unsigned char *data, size_t size) 451 unsigned char *data, size_t size)
451{ 452{
452} 453}
454static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
455{
456}
453static inline void tty_audit_exit(void) 457static inline void tty_audit_exit(void)
454{ 458{
455} 459}
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 73a2f4eb1f7a..9b42baed3900 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -158,8 +158,12 @@ struct usb_ctrlrequest {
158 * (rarely) accepted by SET_DESCRIPTOR. 158 * (rarely) accepted by SET_DESCRIPTOR.
159 * 159 *
160 * Note that all multi-byte values here are encoded in little endian 160 * Note that all multi-byte values here are encoded in little endian
161 * byte order "on the wire". But when exposed through Linux-USB APIs, 161 * byte order "on the wire". Within the kernel and when exposed
162 * they've been converted to cpu byte order. 162 * through the Linux-USB APIs, they are not converted to cpu byte
163 * order; it is the responsibility of the client code to do this.
164 * The single exception is when device and configuration descriptors (but
165 * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
166 * in this case the fields are converted to host endianness by the kernel.
163 */ 167 */
164 168
165/* 169/*
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b5f41d4c2eec..315bcd375224 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -12,7 +12,7 @@
12struct user_namespace { 12struct user_namespace {
13 struct kref kref; 13 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user; 15 struct user_struct *creator;
16}; 16};
17 17
18extern struct user_namespace init_user_ns; 18extern struct user_namespace init_user_ns;
@@ -26,8 +26,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
26 return ns; 26 return ns;
27} 27}
28 28
29extern struct user_namespace *copy_user_ns(int flags, 29extern int create_user_ns(struct cred *new);
30 struct user_namespace *old_ns);
31extern void free_user_ns(struct kref *kref); 30extern void free_user_ns(struct kref *kref);
32 31
33static inline void put_user_ns(struct user_namespace *ns) 32static inline void put_user_ns(struct user_namespace *ns)
@@ -43,13 +42,9 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
43 return &init_user_ns; 42 return &init_user_ns;
44} 43}
45 44
46static inline struct user_namespace *copy_user_ns(int flags, 45static inline int create_user_ns(struct cred *new)
47 struct user_namespace *old_ns)
48{ 46{
49 if (flags & CLONE_NEWUSER) 47 return -EINVAL;
50 return ERR_PTR(-EINVAL);
51
52 return old_ns;
53} 48}
54 49
55static inline void put_user_ns(struct user_namespace *ns) 50static inline void put_user_ns(struct user_namespace *ns)
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 5e33761b9b8a..5cdd0aa8bde9 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -20,6 +20,7 @@
20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ 20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
23#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
23 24
24struct virtio_net_config 25struct virtio_net_config
25{ 26{
@@ -44,4 +45,12 @@ struct virtio_net_hdr
44 __u16 csum_start; /* Position to start checksumming from */ 45 __u16 csum_start; /* Position to start checksumming from */
45 __u16 csum_offset; /* Offset after that to place checksum */ 46 __u16 csum_offset; /* Offset after that to place checksum */
46}; 47};
48
49/* This is the version of the header to use when the MRG_RXBUF
50 * feature has been negotiated. */
51struct virtio_net_hdr_mrg_rxbuf {
52 struct virtio_net_hdr hdr;
53 __u16 num_buffers; /* Number of merged rx buffers */
54};
55
47#endif /* _LINUX_VIRTIO_NET_H */ 56#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 4bc1e6b86cb2..52f3abd453a1 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -199,6 +199,9 @@ enum {
199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
200 XFRM_MSG_GETSPDINFO, 200 XFRM_MSG_GETSPDINFO,
201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
202
203 XFRM_MSG_MAPPING,
204#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
202 __XFRM_MSG_MAX 205 __XFRM_MSG_MAX
203}; 206};
204#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 207#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -438,6 +441,15 @@ struct xfrm_user_migrate {
438 __u16 new_family; 441 __u16 new_family;
439}; 442};
440 443
444struct xfrm_user_mapping {
445 struct xfrm_usersa_id id;
446 __u32 reqid;
447 xfrm_address_t old_saddr;
448 xfrm_address_t new_saddr;
449 __be16 old_sport;
450 __be16 new_sport;
451};
452
441#ifndef __KERNEL__ 453#ifndef __KERNEL__
442/* backwards compatibility for userspace */ 454/* backwards compatibility for userspace */
443#define XFRMGRP_ACQUIRE 1 455#define XFRMGRP_ACQUIRE 1
@@ -464,6 +476,8 @@ enum xfrm_nlgroups {
464#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 476#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
465 XFRMNLGRP_MIGRATE, 477 XFRMNLGRP_MIGRATE,
466#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 478#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
479 XFRMNLGRP_MAPPING,
480#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING
467 __XFRMNLGRP_MAX 481 __XFRMNLGRP_MAX
468}; 482};
469#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 483#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 996d12df7594..a04f8463ac7e 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -54,8 +54,8 @@
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg) 57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
59 59
60/* Connection and socket states */ 60/* Connection and socket states */
61enum { 61enum {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3cc294919312..3645139e68c7 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -54,7 +54,7 @@
54 54
55/* HCI device quirks */ 55/* HCI device quirks */
56enum { 56enum {
57 HCI_QUIRK_RESET_ON_INIT, 57 HCI_QUIRK_NO_RESET,
58 HCI_QUIRK_RAW_DEVICE, 58 HCI_QUIRK_RAW_DEVICE,
59 HCI_QUIRK_FIXUP_BUFFER_SIZE 59 HCI_QUIRK_FIXUP_BUFFER_SIZE
60}; 60};
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0e85ec39b638..23c0ab74ded6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5,6 +5,8 @@
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <net/genetlink.h> 7#include <net/genetlink.h>
8/* remove once we remove the wext stuff */
9#include <net/iw_handler.h>
8 10
9/* 11/*
10 * 802.11 configuration in-kernel interface 12 * 802.11 configuration in-kernel interface
@@ -167,6 +169,9 @@ struct station_parameters {
167 * @STATION_INFO_LLID: @llid filled 169 * @STATION_INFO_LLID: @llid filled
168 * @STATION_INFO_PLID: @plid filled 170 * @STATION_INFO_PLID: @plid filled
169 * @STATION_INFO_PLINK_STATE: @plink_state filled 171 * @STATION_INFO_PLINK_STATE: @plink_state filled
172 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
170 */ 175 */
171enum station_info_flags { 176enum station_info_flags {
172 STATION_INFO_INACTIVE_TIME = 1<<0, 177 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -175,6 +180,39 @@ enum station_info_flags {
175 STATION_INFO_LLID = 1<<3, 180 STATION_INFO_LLID = 1<<3,
176 STATION_INFO_PLID = 1<<4, 181 STATION_INFO_PLID = 1<<4,
177 STATION_INFO_PLINK_STATE = 1<<5, 182 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7,
185};
186
187/**
188 * enum station_info_rate_flags - bitrate info flags
189 *
190 * Used by the driver to indicate the specific rate transmission
191 * type for 802.11n transmissions.
192 *
193 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
194 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
195 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
196 */
197enum rate_info_flags {
198 RATE_INFO_FLAGS_MCS = 1<<0,
199 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
200 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
201};
202
203/**
204 * struct rate_info - bitrate information
205 *
206 * Information about a receiving or transmitting bitrate
207 *
208 * @flags: bitflag of flags from &enum rate_info_flags
209 * @mcs: mcs index if struct describes a 802.11n bitrate
210 * @legacy: bitrate in 100kbit/s for 802.11abg
211 */
212struct rate_info {
213 u8 flags;
214 u8 mcs;
215 u16 legacy;
178}; 216};
179 217
180/** 218/**
@@ -189,6 +227,8 @@ enum station_info_flags {
189 * @llid: mesh local link id 227 * @llid: mesh local link id
190 * @plid: mesh peer link id 228 * @plid: mesh peer link id
191 * @plink_state: mesh peer link state 229 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station
192 */ 232 */
193struct station_info { 233struct station_info {
194 u32 filled; 234 u32 filled;
@@ -198,6 +238,8 @@ struct station_info {
198 u16 llid; 238 u16 llid;
199 u16 plid; 239 u16 plid;
200 u8 plink_state; 240 u8 plink_state;
241 s8 signal;
242 struct rate_info txrate;
201}; 243};
202 244
203/** 245/**
@@ -280,11 +322,16 @@ struct mpath_info {
280 * (0 = no, 1 = yes, -1 = do not change) 322 * (0 = no, 1 = yes, -1 = do not change)
281 * @use_short_slot_time: Whether the use of short slot time is allowed 323 * @use_short_slot_time: Whether the use of short slot time is allowed
282 * (0 = no, 1 = yes, -1 = do not change) 324 * (0 = no, 1 = yes, -1 = do not change)
325 * @basic_rates: basic rates in IEEE 802.11 format
326 * (or NULL for no change)
327 * @basic_rates_len: number of basic rates
283 */ 328 */
284struct bss_parameters { 329struct bss_parameters {
285 int use_cts_prot; 330 int use_cts_prot;
286 int use_short_preamble; 331 int use_short_preamble;
287 int use_short_slot_time; 332 int use_short_slot_time;
333 u8 *basic_rates;
334 u8 basic_rates_len;
288}; 335};
289 336
290/** 337/**
@@ -331,25 +378,65 @@ struct ieee80211_regdomain {
331 struct ieee80211_reg_rule reg_rules[]; 378 struct ieee80211_reg_rule reg_rules[];
332}; 379};
333 380
334#define MHZ_TO_KHZ(freq) (freq * 1000) 381#define MHZ_TO_KHZ(freq) ((freq) * 1000)
335#define KHZ_TO_MHZ(freq) (freq / 1000) 382#define KHZ_TO_MHZ(freq) ((freq) / 1000)
336#define DBI_TO_MBI(gain) (gain * 100) 383#define DBI_TO_MBI(gain) ((gain) * 100)
337#define MBI_TO_DBI(gain) (gain / 100) 384#define MBI_TO_DBI(gain) ((gain) / 100)
338#define DBM_TO_MBM(gain) (gain * 100) 385#define DBM_TO_MBM(gain) ((gain) * 100)
339#define MBM_TO_DBM(gain) (gain / 100) 386#define MBM_TO_DBM(gain) ((gain) / 100)
340 387
341#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 388#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
342 .freq_range.start_freq_khz = (start) * 1000, \ 389 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
343 .freq_range.end_freq_khz = (end) * 1000, \ 390 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
344 .freq_range.max_bandwidth_khz = (bw) * 1000, \ 391 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
345 .power_rule.max_antenna_gain = (gain) * 100, \ 392 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
346 .power_rule.max_eirp = (eirp) * 100, \ 393 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
347 .flags = reg_flags, \ 394 .flags = reg_flags, \
348 } 395 }
349 396
397struct mesh_config {
398 /* Timeouts in ms */
399 /* Mesh plink management parameters */
400 u16 dot11MeshRetryTimeout;
401 u16 dot11MeshConfirmTimeout;
402 u16 dot11MeshHoldingTimeout;
403 u16 dot11MeshMaxPeerLinks;
404 u8 dot11MeshMaxRetries;
405 u8 dot11MeshTTL;
406 bool auto_open_plinks;
407 /* HWMP parameters */
408 u8 dot11MeshHWMPmaxPREQretries;
409 u32 path_refresh_time;
410 u16 min_discovery_timeout;
411 u32 dot11MeshHWMPactivePathTimeout;
412 u16 dot11MeshHWMPpreqMinInterval;
413 u16 dot11MeshHWMPnetDiameterTraversalTime;
414};
415
416/**
417 * struct ieee80211_txq_params - TX queue parameters
418 * @queue: TX queue identifier (NL80211_TXQ_Q_*)
419 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
420 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
421 * 1..32767]
422 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
423 * 1..32767]
424 * @aifs: Arbitration interframe space [0..255]
425 */
426struct ieee80211_txq_params {
427 enum nl80211_txq_q queue;
428 u16 txop;
429 u16 cwmin;
430 u16 cwmax;
431 u8 aifs;
432};
433
350/* from net/wireless.h */ 434/* from net/wireless.h */
351struct wiphy; 435struct wiphy;
352 436
437/* from net/ieee80211.h */
438struct ieee80211_channel;
439
353/** 440/**
354 * struct cfg80211_ops - backend description for wireless configuration 441 * struct cfg80211_ops - backend description for wireless configuration
355 * 442 *
@@ -397,9 +484,19 @@ struct wiphy;
397 * 484 *
398 * @change_station: Modify a given station. 485 * @change_station: Modify a given station.
399 * 486 *
487 * @get_mesh_params: Put the current mesh parameters into *params
488 *
489 * @set_mesh_params: Set mesh parameters.
490 * The mask is a bitfield which tells us which parameters to
491 * set, and which to leave alone.
492 *
400 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 493 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
401 * 494 *
402 * @change_bss: Modify parameters for a given BSS. 495 * @change_bss: Modify parameters for a given BSS.
496 *
497 * @set_txq_params: Set TX queue parameters
498 *
499 * @set_channel: Set channel
403 */ 500 */
404struct cfg80211_ops { 501struct cfg80211_ops {
405 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -452,9 +549,30 @@ struct cfg80211_ops {
452 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 549 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
453 int idx, u8 *dst, u8 *next_hop, 550 int idx, u8 *dst, u8 *next_hop,
454 struct mpath_info *pinfo); 551 struct mpath_info *pinfo);
455 552 int (*get_mesh_params)(struct wiphy *wiphy,
553 struct net_device *dev,
554 struct mesh_config *conf);
555 int (*set_mesh_params)(struct wiphy *wiphy,
556 struct net_device *dev,
557 const struct mesh_config *nconf, u32 mask);
456 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 558 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
457 struct bss_parameters *params); 559 struct bss_parameters *params);
560
561 int (*set_txq_params)(struct wiphy *wiphy,
562 struct ieee80211_txq_params *params);
563
564 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type);
458}; 567};
459 568
569/* temporary wext handlers */
570int cfg80211_wext_giwname(struct net_device *dev,
571 struct iw_request_info *info,
572 char *name, char *extra);
573int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra);
577
460#endif /* __NET_CFG80211_H */ 578#endif /* __NET_CFG80211_H */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 07602b7fa218..ba55d8b8c87c 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -98,7 +98,7 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
98{ 98{
99 __be32 diff[] = { ~from, to }; 99 __be32 diff[] = { ~from, to };
100 100
101 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); 101 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
102} 102}
103 103
104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
new file mode 100644
index 000000000000..775cfc8055be
--- /dev/null
+++ b/include/net/dcbnl.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
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,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __NET_DCBNL_H__
21#define __NET_DCBNL_H__
22
23/*
24 * Ops struct for the netlink callbacks. Used by DCB-enabled drivers through
25 * the netdevice struct.
26 */
27struct dcbnl_rtnl_ops {
28 u8 (*getstate)(struct net_device *);
29 u8 (*setstate)(struct net_device *, u8);
30 void (*getpermhwaddr)(struct net_device *, u8 *);
31 void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8);
32 void (*setpgbwgcfgtx)(struct net_device *, int, u8);
33 void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8);
34 void (*setpgbwgcfgrx)(struct net_device *, int, u8);
35 void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
36 void (*getpgbwgcfgtx)(struct net_device *, int, u8 *);
37 void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
38 void (*getpgbwgcfgrx)(struct net_device *, int, u8 *);
39 void (*setpfccfg)(struct net_device *, int, u8);
40 void (*getpfccfg)(struct net_device *, int, u8 *);
41 u8 (*setall)(struct net_device *);
42 u8 (*getcap)(struct net_device *, int, u8 *);
43 u8 (*getnumtcs)(struct net_device *, int, u8 *);
44 u8 (*setnumtcs)(struct net_device *, int, u8);
45 u8 (*getpfcstate)(struct net_device *);
46 void (*setpfcstate)(struct net_device *, u8);
47 void (*getbcncfg)(struct net_device *, int, u32 *);
48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8);
51};
52
53#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dn.h b/include/net/dn.h
index 627778384c84..e5469f7b67a3 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -4,9 +4,7 @@
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <asm/byteorder.h> 6#include <asm/byteorder.h>
7 7#include <asm/unaligned.h>
8#define dn_ntohs(x) le16_to_cpu(x)
9#define dn_htons(x) cpu_to_le16(x)
10 8
11struct dn_scp /* Session Control Port */ 9struct dn_scp /* Session Control Port */
12{ 10{
@@ -175,7 +173,7 @@ struct dn_skb_cb {
175 173
176static inline __le16 dn_eth2dn(unsigned char *ethaddr) 174static inline __le16 dn_eth2dn(unsigned char *ethaddr)
177{ 175{
178 return dn_htons(ethaddr[4] | (ethaddr[5] << 8)); 176 return get_unaligned((__le16 *)(ethaddr + 4));
179} 177}
180 178
181static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) 179static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
@@ -185,7 +183,7 @@ static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
185 183
186static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) 184static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
187{ 185{
188 __u16 a = dn_ntohs(addr); 186 __u16 a = le16_to_cpu(addr);
189 ethaddr[0] = 0xAA; 187 ethaddr[0] = 0xAA;
190 ethaddr[1] = 0x00; 188 ethaddr[1] = 0x00;
191 ethaddr[2] = 0x04; 189 ethaddr[2] = 0x04;
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 30125119c950..c378be7bf960 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -181,9 +181,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res)
181 181
182static inline __le16 dnet_make_mask(int n) 182static inline __le16 dnet_make_mask(int n)
183{ 183{
184 if (n) 184 if (n)
185 return dn_htons(~((1<<(16-n))-1)); 185 return cpu_to_le16(~((1 << (16 - n)) - 1));
186 return 0; 186 return cpu_to_le16(0);
187} 187}
188 188
189#endif /* _NET_DN_FIB_H */ 189#endif /* _NET_DN_FIB_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 8a8b71e5f3f1..6be3b082a070 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -59,8 +59,11 @@ struct dst_entry
59 59
60 struct neighbour *neighbour; 60 struct neighbour *neighbour;
61 struct hh_cache *hh; 61 struct hh_cache *hh;
62#ifdef CONFIG_XFRM
62 struct xfrm_state *xfrm; 63 struct xfrm_state *xfrm;
63 64#else
65 void *__pad1;
66#endif
64 int (*input)(struct sk_buff*); 67 int (*input)(struct sk_buff*);
65 int (*output)(struct sk_buff*); 68 int (*output)(struct sk_buff*);
66 69
@@ -70,8 +73,20 @@ struct dst_entry
70 73
71#ifdef CONFIG_NET_CLS_ROUTE 74#ifdef CONFIG_NET_CLS_ROUTE
72 __u32 tclassid; 75 __u32 tclassid;
76#else
77 __u32 __pad2;
73#endif 78#endif
74 79
80
81 /*
82 * Align __refcnt to a 64 bytes alignment
83 * (L1_CACHE_SIZE would be too much)
84 */
85#ifdef CONFIG_64BIT
86 long __pad_to_align_refcnt[2];
87#else
88 long __pad_to_align_refcnt[1];
89#endif
75 /* 90 /*
76 * __refcnt wants to be on a different cache line from 91 * __refcnt wants to be on a different cache line from
77 * input/output/ops or performance tanks badly 92 * input/output/ops or performance tanks badly
@@ -103,7 +118,6 @@ struct dst_ops
103 void (*link_failure)(struct sk_buff *); 118 void (*link_failure)(struct sk_buff *);
104 void (*update_pmtu)(struct dst_entry *dst, u32 mtu); 119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
105 int (*local_out)(struct sk_buff *skb); 120 int (*local_out)(struct sk_buff *skb);
106 int entry_size;
107 121
108 atomic_t entries; 122 atomic_t entries;
109 struct kmem_cache *kmem_cachep; 123 struct kmem_cache *kmem_cachep;
@@ -157,6 +171,11 @@ dst_metric_locked(struct dst_entry *dst, int metric)
157 171
158static inline void dst_hold(struct dst_entry * dst) 172static inline void dst_hold(struct dst_entry * dst)
159{ 173{
174 /*
175 * If your kernel compilation stops here, please check
176 * __pad_to_align_refcnt declaration in struct dst_entry
177 */
178 BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
160 atomic_inc(&dst->__refcnt); 179 atomic_inc(&dst->__refcnt);
161} 180}
162 181
@@ -272,21 +291,21 @@ enum {
272 291
273struct flowi; 292struct flowi;
274#ifndef CONFIG_XFRM 293#ifndef CONFIG_XFRM
275static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 294static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
276 struct sock *sk, int flags) 295 struct flowi *fl, struct sock *sk, int flags)
277{ 296{
278 return 0; 297 return 0;
279} 298}
280static inline int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 299static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
281 struct sock *sk, int flags) 300 struct flowi *fl, struct sock *sk, int flags)
282{ 301{
283 return 0; 302 return 0;
284} 303}
285#else 304#else
286extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 305extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
287 struct sock *sk, int flags); 306 struct flowi *fl, struct sock *sk, int flags);
288extern int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 307extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
289 struct sock *sk, int flags); 308 struct flowi *fl, struct sock *sk, int flags);
290#endif 309#endif
291#endif 310#endif
292 311
diff --git a/include/net/flow.h b/include/net/flow.h
index b45a5e4fcadd..809970b7dfee 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,12 +84,13 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87struct net;
87struct sock; 88struct sock;
88typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family,
89 void **objp, atomic_t **obj_refp); 90 u8 dir, void **objp, atomic_t **obj_refp);
90 91
91extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
92 flow_resolve_t resolver); 93 u8 dir, flow_resolve_t resolver);
93extern void flow_cache_flush(void); 94extern void flow_cache_flush(void);
94extern atomic_t flow_cache_genid; 95extern atomic_t flow_cache_genid;
95 96
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index 8cd8185fa2ed..d136b5240ef2 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -45,5 +45,6 @@ extern void gen_kill_estimator(struct gnet_stats_basic *bstats,
45extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48 48extern bool gen_estimator_active(const struct gnet_stats_basic *bstats,
49 const struct gnet_stats_rate_est *rate_est);
49#endif 50#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 93a56de3594b..adb7cf31f781 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -28,6 +28,9 @@
28#include <linux/if_ether.h> /* ETH_ALEN */ 28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */ 29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h> 30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
31 34
32#define IEEE80211_VERSION "git-1.1.13" 35#define IEEE80211_VERSION "git-1.1.13"
33 36
@@ -127,10 +130,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level)
127} 130}
128#endif /* CONFIG_IEEE80211_DEBUG */ 131#endif /* CONFIG_IEEE80211_DEBUG */
129 132
130/* escape_essid() is intended to be used in debug (and possibly error)
131 * messages. It should never be used for passing essid to user space. */
132const char *escape_essid(const char *essid, u8 essid_len);
133
134/* 133/*
135 * To use the debug system: 134 * To use the debug system:
136 * 135 *
@@ -218,94 +217,6 @@ struct ieee80211_snap_hdr {
218#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) 217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
219#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) 218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
220 219
221/* Authentication algorithms */
222#define WLAN_AUTH_OPEN 0
223#define WLAN_AUTH_SHARED_KEY 1
224#define WLAN_AUTH_LEAP 2
225
226#define WLAN_AUTH_CHALLENGE_LEN 128
227
228#define WLAN_CAPABILITY_ESS (1<<0)
229#define WLAN_CAPABILITY_IBSS (1<<1)
230#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
231#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
232#define WLAN_CAPABILITY_PRIVACY (1<<4)
233#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
234#define WLAN_CAPABILITY_PBCC (1<<6)
235#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
236#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
237#define WLAN_CAPABILITY_QOS (1<<9)
238#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
239#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
240
241/* 802.11g ERP information element */
242#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
243#define WLAN_ERP_USE_PROTECTION (1<<1)
244#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
245
246/* Status codes */
247enum ieee80211_statuscode {
248 WLAN_STATUS_SUCCESS = 0,
249 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
250 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
251 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
252 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
253 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
254 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
255 WLAN_STATUS_CHALLENGE_FAIL = 15,
256 WLAN_STATUS_AUTH_TIMEOUT = 16,
257 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
258 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
259 /* 802.11b */
260 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
261 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
262 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
263 /* 802.11h */
264 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
265 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
266 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
267 /* 802.11g */
268 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
269 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
270 /* 802.11i */
271 WLAN_STATUS_INVALID_IE = 40,
272 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
273 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
274 WLAN_STATUS_INVALID_AKMP = 43,
275 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
276 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
277 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
278};
279
280/* Reason codes */
281enum ieee80211_reasoncode {
282 WLAN_REASON_UNSPECIFIED = 1,
283 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
284 WLAN_REASON_DEAUTH_LEAVING = 3,
285 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
286 WLAN_REASON_DISASSOC_AP_BUSY = 5,
287 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
288 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
289 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
290 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
291 /* 802.11h */
292 WLAN_REASON_DISASSOC_BAD_POWER = 10,
293 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
294 /* 802.11i */
295 WLAN_REASON_INVALID_IE = 13,
296 WLAN_REASON_MIC_FAILURE = 14,
297 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
298 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
299 WLAN_REASON_IE_DIFFERENT = 17,
300 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
301 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
302 WLAN_REASON_INVALID_AKMP = 20,
303 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
304 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
305 WLAN_REASON_IEEE8021X_FAILED = 23,
306 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
307};
308
309/* Action categories - 802.11h */ 220/* Action categories - 802.11h */
310enum ieee80211_actioncategories { 221enum ieee80211_actioncategories {
311 WLAN_ACTION_SPECTRUM_MGMT = 0, 222 WLAN_ACTION_SPECTRUM_MGMT = 0,
@@ -446,8 +357,6 @@ struct ieee80211_stats {
446 357
447struct ieee80211_device; 358struct ieee80211_device;
448 359
449#include "ieee80211_crypt.h"
450
451#define SEC_KEY_1 (1<<0) 360#define SEC_KEY_1 (1<<0)
452#define SEC_KEY_2 (1<<1) 361#define SEC_KEY_2 (1<<1)
453#define SEC_KEY_3 (1<<2) 362#define SEC_KEY_3 (1<<2)
@@ -476,9 +385,8 @@ struct ieee80211_device;
476#define SCM_TEMPORAL_KEY_LENGTH 16 385#define SCM_TEMPORAL_KEY_LENGTH 16
477 386
478struct ieee80211_security { 387struct ieee80211_security {
479 u16 active_key:2, 388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
480 enabled:1, 389 u8 auth_mode;
481 auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1;
482 u8 encode_alg[WEP_KEYS]; 390 u8 encode_alg[WEP_KEYS];
483 u8 key_sizes[WEP_KEYS]; 391 u8 key_sizes[WEP_KEYS];
484 u8 keys[WEP_KEYS][SCM_KEY_LEN]; 392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
@@ -534,15 +442,6 @@ enum ieee80211_mfie {
534 MFIE_TYPE_QOS_PARAMETER = 222, 442 MFIE_TYPE_QOS_PARAMETER = 222,
535}; 443};
536 444
537/* Minimal header; can be used for passing 802.11 frames with sufficient
538 * information to determine what type of underlying data type is actually
539 * stored in the data. */
540struct ieee80211_hdr {
541 __le16 frame_ctl;
542 __le16 duration_id;
543 u8 payload[0];
544} __attribute__ ((packed));
545
546struct ieee80211_hdr_1addr { 445struct ieee80211_hdr_1addr {
547 __le16 frame_ctl; 446 __le16 frame_ctl;
548 __le16 duration_id; 447 __le16 duration_id;
@@ -590,18 +489,6 @@ struct ieee80211_hdr_3addrqos {
590 __le16 qos_ctl; 489 __le16 qos_ctl;
591} __attribute__ ((packed)); 490} __attribute__ ((packed));
592 491
593struct ieee80211_hdr_4addrqos {
594 __le16 frame_ctl;
595 __le16 duration_id;
596 u8 addr1[ETH_ALEN];
597 u8 addr2[ETH_ALEN];
598 u8 addr3[ETH_ALEN];
599 __le16 seq_ctl;
600 u8 addr4[ETH_ALEN];
601 u8 payload[0];
602 __le16 qos_ctl;
603} __attribute__ ((packed));
604
605struct ieee80211_info_element { 492struct ieee80211_info_element {
606 u8 id; 493 u8 id;
607 u8 len; 494 u8 len;
@@ -733,7 +620,6 @@ struct ieee80211_txb {
733 620
734#define MAX_WPA_IE_LEN 64 621#define MAX_WPA_IE_LEN 64
735 622
736#define NETWORK_EMPTY_ESSID (1<<0)
737#define NETWORK_HAS_OFDM (1<<1) 623#define NETWORK_HAS_OFDM (1<<1)
738#define NETWORK_HAS_CCK (1<<2) 624#define NETWORK_HAS_CCK (1<<2)
739 625
@@ -1050,11 +936,7 @@ struct ieee80211_device {
1050 size_t wpa_ie_len; 936 size_t wpa_ie_len;
1051 u8 *wpa_ie; 937 u8 *wpa_ie;
1052 938
1053 struct list_head crypt_deinit_list; 939 struct lib80211_crypt_info crypt_info;
1054 struct ieee80211_crypt_data *crypt[WEP_KEYS];
1055 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
1056 struct timer_list crypt_deinit_timer;
1057 int crypt_quiesced;
1058 940
1059 int bcrx_sta_key; /* use individual keys to override default keys even 941 int bcrx_sta_key; /* use individual keys to override default keys even
1060 * with RX of broad/multicast frames */ 942 * with RX of broad/multicast frames */
@@ -1135,22 +1017,6 @@ static inline void *ieee80211_priv(struct net_device *dev)
1135 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1136} 1018}
1137 1019
1138static inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
1139{
1140 /* Single white space is for Linksys APs */
1141 if (essid_len == 1 && essid[0] == ' ')
1142 return 1;
1143
1144 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1145 while (essid_len) {
1146 essid_len--;
1147 if (essid[essid_len] != '\0')
1148 return 0;
1149 }
1150
1151 return 1;
1152}
1153
1154static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, 1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1155 int mode) 1021 int mode)
1156{ 1022{
@@ -1208,7 +1074,7 @@ static inline int ieee80211_get_hdrlen(u16 fc)
1208 1074
1209static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) 1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1210{ 1076{
1211 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { 1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1212 case IEEE80211_1ADDR_LEN: 1078 case IEEE80211_1ADDR_LEN:
1213 return ((struct ieee80211_hdr_1addr *)hdr)->payload; 1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1214 case IEEE80211_2ADDR_LEN: 1080 case IEEE80211_2ADDR_LEN:
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index d364fd594ea4..384698cb773a 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -1,7 +1,4 @@
1/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ 1/*
2/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */
3
4/*-
5 * Copyright (c) 2003, 2004 David Young. All rights reserved. 2 * Copyright (c) 2003, 2004 David Young. All rights reserved.
6 * 3 *
7 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
@@ -42,8 +39,6 @@
42#include <linux/kernel.h> 39#include <linux/kernel.h>
43#include <asm/unaligned.h> 40#include <asm/unaligned.h>
44 41
45/* Radiotap header version (from official NetBSD feed) */
46#define IEEE80211RADIOTAP_VERSION "1.5"
47/* Base version of the radiotap packet header data */ 42/* Base version of the radiotap packet header data */
48#define PKTHDR_RADIOTAP_VERSION 0 43#define PKTHDR_RADIOTAP_VERSION 0
49 44
@@ -62,12 +57,8 @@
62 * readers. 57 * readers.
63 */ 58 */
64 59
65/* XXX tcpdump/libpcap do not tolerate variable-length headers, 60/*
66 * yet, so we pad every radiotap header to 64 bytes. Ugh. 61 * The radio capture header precedes the 802.11 header.
67 */
68#define IEEE80211_RADIOTAP_HDRLEN 64
69
70/* The radio capture header precedes the 802.11 header.
71 * All data in the header is little endian on all platforms. 62 * All data in the header is little endian on all platforms.
72 */ 63 */
73struct ieee80211_radiotap_header { 64struct ieee80211_radiotap_header {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 5cc182f9ecae..f44bb5c77a70 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -41,8 +41,8 @@
41 * I'll experiment with dynamic table growth later. 41 * I'll experiment with dynamic table growth later.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_head twchain; 45 struct hlist_nulls_head twchain;
46}; 46};
47 47
48/* There are a few simple rules, which allow for local port reuse by 48/* There are a few simple rules, which allow for local port reuse by
@@ -77,13 +77,20 @@ struct inet_ehash_bucket {
77 * ports are created in O(1) time? I thought so. ;-) -DaveM 77 * ports are created in O(1) time? I thought so. ;-) -DaveM
78 */ 78 */
79struct inet_bind_bucket { 79struct inet_bind_bucket {
80#ifdef CONFIG_NET_NS
80 struct net *ib_net; 81 struct net *ib_net;
82#endif
81 unsigned short port; 83 unsigned short port;
82 signed short fastreuse; 84 signed short fastreuse;
83 struct hlist_node node; 85 struct hlist_node node;
84 struct hlist_head owners; 86 struct hlist_head owners;
85}; 87};
86 88
89static inline struct net *ib_net(struct inet_bind_bucket *ib)
90{
91 return read_pnet(&ib->ib_net);
92}
93
87#define inet_bind_bucket_for_each(tb, node, head) \ 94#define inet_bind_bucket_for_each(tb, node, head) \
88 hlist_for_each_entry(tb, node, head, node) 95 hlist_for_each_entry(tb, node, head, node)
89 96
@@ -92,6 +99,18 @@ struct inet_bind_hashbucket {
92 struct hlist_head chain; 99 struct hlist_head chain;
93}; 100};
94 101
102/*
103 * Sockets can be hashed in established or listening table
104 * We must use different 'nulls' end-of-chain value for listening
105 * hash table, or we might find a socket that was closed and
106 * reallocated/inserted into established hash table
107 */
108#define LISTENING_NULLS_BASE (1U << 29)
109struct inet_listen_hashbucket {
110 spinlock_t lock;
111 struct hlist_nulls_head head;
112};
113
95/* This is for listening sockets, thus all sockets which possess wildcards. */ 114/* This is for listening sockets, thus all sockets which possess wildcards. */
96#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */ 115#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
97 116
@@ -104,7 +123,7 @@ struct inet_hashinfo {
104 * TIME_WAIT sockets use a separate chain (twchain). 123 * TIME_WAIT sockets use a separate chain (twchain).
105 */ 124 */
106 struct inet_ehash_bucket *ehash; 125 struct inet_ehash_bucket *ehash;
107 rwlock_t *ehash_locks; 126 spinlock_t *ehash_locks;
108 unsigned int ehash_size; 127 unsigned int ehash_size;
109 unsigned int ehash_locks_mask; 128 unsigned int ehash_locks_mask;
110 129
@@ -116,22 +135,21 @@ struct inet_hashinfo {
116 unsigned int bhash_size; 135 unsigned int bhash_size;
117 /* Note : 4 bytes padding on 64 bit arches */ 136 /* Note : 4 bytes padding on 64 bit arches */
118 137
119 /* All sockets in TCP_LISTEN state will be in here. This is the only 138 struct kmem_cache *bind_bucket_cachep;
120 * table where wildcard'd TCP sockets can exist. Hash function here
121 * is just local port number.
122 */
123 struct hlist_head listening_hash[INET_LHTABLE_SIZE];
124 139
125 /* All the above members are written once at bootup and 140 /* All the above members are written once at bootup and
126 * never written again _or_ are predominantly read-access. 141 * never written again _or_ are predominantly read-access.
127 * 142 *
128 * Now align to a new cache line as all the following members 143 * Now align to a new cache line as all the following members
129 * are often dirty. 144 * might be often dirty.
130 */ 145 */
131 rwlock_t lhash_lock ____cacheline_aligned; 146 /* All sockets in TCP_LISTEN state will be in here. This is the only
132 atomic_t lhash_users; 147 * table where wildcard'd TCP sockets can exist. Hash function here
133 wait_queue_head_t lhash_wait; 148 * is just local port number.
134 struct kmem_cache *bind_bucket_cachep; 149 */
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp;
152
135}; 153};
136 154
137static inline struct inet_ehash_bucket *inet_ehash_bucket( 155static inline struct inet_ehash_bucket *inet_ehash_bucket(
@@ -141,7 +159,7 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
141 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 159 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
142} 160}
143 161
144static inline rwlock_t *inet_ehash_lockp( 162static inline spinlock_t *inet_ehash_lockp(
145 struct inet_hashinfo *hashinfo, 163 struct inet_hashinfo *hashinfo,
146 unsigned int hash) 164 unsigned int hash)
147{ 165{
@@ -166,16 +184,16 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
166 size = 4096; 184 size = 4096;
167 if (sizeof(rwlock_t) != 0) { 185 if (sizeof(rwlock_t) != 0) {
168#ifdef CONFIG_NUMA 186#ifdef CONFIG_NUMA
169 if (size * sizeof(rwlock_t) > PAGE_SIZE) 187 if (size * sizeof(spinlock_t) > PAGE_SIZE)
170 hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); 188 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
171 else 189 else
172#endif 190#endif
173 hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), 191 hashinfo->ehash_locks = kmalloc(size * sizeof(spinlock_t),
174 GFP_KERNEL); 192 GFP_KERNEL);
175 if (!hashinfo->ehash_locks) 193 if (!hashinfo->ehash_locks)
176 return ENOMEM; 194 return ENOMEM;
177 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
178 rwlock_init(&hashinfo->ehash_locks[i]); 196 spin_lock_init(&hashinfo->ehash_locks[i]);
179 } 197 }
180 hashinfo->ehash_locks_mask = size - 1; 198 hashinfo->ehash_locks_mask = size - 1;
181 return 0; 199 return 0;
@@ -186,7 +204,7 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
186 if (hashinfo->ehash_locks) { 204 if (hashinfo->ehash_locks) {
187#ifdef CONFIG_NUMA 205#ifdef CONFIG_NUMA
188 unsigned int size = (hashinfo->ehash_locks_mask + 1) * 206 unsigned int size = (hashinfo->ehash_locks_mask + 1) *
189 sizeof(rwlock_t); 207 sizeof(spinlock_t);
190 if (size > PAGE_SIZE) 208 if (size > PAGE_SIZE)
191 vfree(hashinfo->ehash_locks); 209 vfree(hashinfo->ehash_locks);
192 else 210 else
@@ -229,26 +247,7 @@ extern void __inet_inherit_port(struct sock *sk, struct sock *child);
229 247
230extern void inet_put_port(struct sock *sk); 248extern void inet_put_port(struct sock *sk);
231 249
232extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 250void inet_hashinfo_init(struct inet_hashinfo *h);
233
234/*
235 * - We may sleep inside this lock.
236 * - If sleeping is not required (or called from BH),
237 * use plain read_(un)lock(&inet_hashinfo.lhash_lock).
238 */
239static inline void inet_listen_lock(struct inet_hashinfo *hashinfo)
240{
241 /* read_lock synchronizes to candidates to writers */
242 read_lock(&hashinfo->lhash_lock);
243 atomic_inc(&hashinfo->lhash_users);
244 read_unlock(&hashinfo->lhash_lock);
245}
246
247static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
248{
249 if (atomic_dec_and_test(&hashinfo->lhash_users))
250 wake_up(&hashinfo->lhash_wait);
251}
252 251
253extern void __inet_hash_nolisten(struct sock *sk); 252extern void __inet_hash_nolisten(struct sock *sk);
254extern void inet_hash(struct sock *sk); 253extern void inet_hash(struct sock *sk);
@@ -299,25 +298,25 @@ typedef __u64 __bitwise __addrpair;
299 ((__force __u64)(__be32)(__saddr))); 298 ((__force __u64)(__be32)(__saddr)));
300#endif /* __BIG_ENDIAN */ 299#endif /* __BIG_ENDIAN */
301#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 300#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
302 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 301 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
303 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 302 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
304 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 303 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
305 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 304 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
306#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 305#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
307 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 306 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
308 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 307 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
309 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 308 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
310 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 309 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
311#else /* 32-bit arch */ 310#else /* 32-bit arch */
312#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 311#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
313#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 312#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
314 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 313 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
315 (inet_sk(__sk)->daddr == (__saddr)) && \ 314 (inet_sk(__sk)->daddr == (__saddr)) && \
316 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 315 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
317 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 316 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
318 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 317 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
319#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 318#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
320 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 319 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
321 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 320 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
322 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 321 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
323 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 322 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 80e4977631b8..4b8ece22b8e9 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -110,7 +110,7 @@ struct inet_timewait_sock {
110#define tw_state __tw_common.skc_state 110#define tw_state __tw_common.skc_state
111#define tw_reuse __tw_common.skc_reuse 111#define tw_reuse __tw_common.skc_reuse
112#define tw_bound_dev_if __tw_common.skc_bound_dev_if 112#define tw_bound_dev_if __tw_common.skc_bound_dev_if
113#define tw_node __tw_common.skc_node 113#define tw_node __tw_common.skc_nulls_node
114#define tw_bind_node __tw_common.skc_bind_node 114#define tw_bind_node __tw_common.skc_bind_node
115#define tw_refcnt __tw_common.skc_refcnt 115#define tw_refcnt __tw_common.skc_refcnt
116#define tw_hash __tw_common.skc_hash 116#define tw_hash __tw_common.skc_hash
@@ -137,10 +137,10 @@ struct inet_timewait_sock {
137 struct hlist_node tw_death_node; 137 struct hlist_node tw_death_node;
138}; 138};
139 139
140static inline void inet_twsk_add_node(struct inet_timewait_sock *tw, 140static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
141 struct hlist_head *list) 141 struct hlist_nulls_head *list)
142{ 142{
143 hlist_add_head(&tw->tw_node, list); 143 hlist_nulls_add_head_rcu(&tw->tw_node, list);
144} 144}
145 145
146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, 146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
@@ -175,7 +175,7 @@ static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
175} 175}
176 176
177#define inet_twsk_for_each(tw, node, head) \ 177#define inet_twsk_for_each(tw, node, head) \
178 hlist_for_each_entry(tw, node, head, tw_node) 178 hlist_nulls_for_each_entry(tw, node, head, tw_node)
179 179
180#define inet_twsk_for_each_inmate(tw, node, jail) \ 180#define inet_twsk_for_each_inmate(tw, node, jail) \
181 hlist_for_each_entry(tw, node, jail, tw_death_node) 181 hlist_for_each_entry(tw, node, jail, tw_death_node)
diff --git a/include/net/ip.h b/include/net/ip.h
index bc026ecb513f..10868139e656 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -110,7 +110,7 @@ extern int ip_append_data(struct sock *sk,
110 int odd, struct sk_buff *skb), 110 int odd, struct sk_buff *skb),
111 void *from, int len, int protolen, 111 void *from, int len, int protolen,
112 struct ipcm_cookie *ipc, 112 struct ipcm_cookie *ipc,
113 struct rtable *rt, 113 struct rtable **rt,
114 unsigned int flags); 114 unsigned int flags);
115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
116extern ssize_t ip_append_page(struct sock *sk, struct page *page, 116extern ssize_t ip_append_page(struct sock *sk, struct page *page,
@@ -187,6 +187,7 @@ extern void inet_get_local_port_range(int *low, int *high);
187extern int sysctl_ip_default_ttl; 187extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 188extern int sysctl_ip_nonlocal_bind;
189 189
190extern struct ctl_path net_core_path[];
190extern struct ctl_path net_ipv4_ctl_path[]; 191extern struct ctl_path net_ipv4_ctl_path[];
191 192
192/* From inetpeer.c */ 193/* From inetpeer.c */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fe9fcf73c85e..ab9b003ab671 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -87,12 +87,12 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
87 int len; 87 int len;
88#ifdef CONFIG_IP_VS_IPV6 88#ifdef CONFIG_IP_VS_IPV6
89 if (af == AF_INET6) 89 if (af == AF_INET6)
90 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]", 90 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]",
91 NIP6(addr->in6)) + 1; 91 &addr->in6) + 1;
92 else 92 else
93#endif 93#endif
94 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT, 94 len = snprintf(&buf[*idx], buf_len - *idx, "%pI4",
95 NIPQUAD(addr->ip)) + 1; 95 &addr->ip) + 1;
96 96
97 *idx += len; 97 *idx += len;
98 BUG_ON(*idx > buf_len + 1); 98 BUG_ON(*idx > buf_len + 1);
@@ -503,9 +503,6 @@ struct ip_vs_scheduler {
503 char *name; /* scheduler name */ 503 char *name; /* scheduler name */
504 atomic_t refcnt; /* reference counter */ 504 atomic_t refcnt; /* reference counter */
505 struct module *module; /* THIS_MODULE/NULL */ 505 struct module *module; /* THIS_MODULE/NULL */
506#ifdef CONFIG_IP_VS_IPV6
507 int supports_ipv6; /* scheduler has IPv6 support */
508#endif
509 506
510 /* scheduler initializing service */ 507 /* scheduler initializing service */
511 int (*init_service)(struct ip_vs_service *svc); 508 int (*init_service)(struct ip_vs_service *svc);
@@ -916,7 +913,7 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
916{ 913{
917 __be32 diff[2] = { ~old, new }; 914 __be32 diff[2] = { ~old, new };
918 915
919 return csum_partial((char *) diff, sizeof(diff), oldsum); 916 return csum_partial(diff, sizeof(diff), oldsum);
920} 917}
921 918
922#ifdef CONFIG_IP_VS_IPV6 919#ifdef CONFIG_IP_VS_IPV6
@@ -926,7 +923,7 @@ static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
926 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0], 923 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
927 new[3], new[2], new[1], new[0] }; 924 new[3], new[2], new[1], new[0] };
928 925
929 return csum_partial((char *) diff, sizeof(diff), oldsum); 926 return csum_partial(diff, sizeof(diff), oldsum);
930} 927}
931#endif 928#endif
932 929
@@ -934,7 +931,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
934{ 931{
935 __be16 diff[2] = { ~old, new }; 932 __be16 diff[2] = { ~old, new };
936 933
937 return csum_partial((char *) diff, sizeof(diff), oldsum); 934 return csum_partial(diff, sizeof(diff), oldsum);
938} 935}
939 936
940#endif /* __KERNEL__ */ 937#endif /* __KERNEL__ */
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 3025ae17ddbe..94c852d47d0f 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -135,9 +135,11 @@ struct dongle_reg {
135 135
136/* 136/*
137 * Per-packet information we need to hide inside sk_buff 137 * Per-packet information we need to hide inside sk_buff
138 * (must not exceed 48 bytes, check with struct sk_buff) 138 * (must not exceed 48 bytes, check with struct sk_buff)
139 * The default_qdisc_pad field is a temporary hack.
139 */ 140 */
140struct irda_skb_cb { 141struct irda_skb_cb {
142 unsigned int default_qdisc_pad;
141 magic_t magic; /* Be sure that we can trust the information */ 143 magic_t magic; /* Be sure that we can trust the information */
142 __u32 next_speed; /* The Speed to be set *after* this frame */ 144 __u32 next_speed; /* The Speed to be set *after* this frame */
143 __u16 mtt; /* Minimum turn around time */ 145 __u16 mtt; /* Minimum turn around time */
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index fd70adbb3566..5e310c8d8e2f 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -337,12 +337,35 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
337 * established paths. This function will deal with RMDATA messages 337 * established paths. This function will deal with RMDATA messages
338 * embedded in struct iucv_message as well. 338 * embedded in struct iucv_message as well.
339 * 339 *
340 * Locking: local_bh_enable/local_bh_disable
341 *
340 * Returns the result from the CP IUCV call. 342 * Returns the result from the CP IUCV call.
341 */ 343 */
342int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, 344int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
343 u8 flags, void *buffer, size_t size, size_t *residual); 345 u8 flags, void *buffer, size_t size, size_t *residual);
344 346
345/** 347/**
348 * __iucv_message_receive
349 * @path: address of iucv path structure
350 * @msg: address of iucv msg structure
351 * @flags: flags that affect how the message is received (IUCV_IPBUFLST)
352 * @buffer: address of data buffer or address of struct iucv_array
353 * @size: length of data buffer
354 * @residual:
355 *
356 * This function receives messages that are being sent to you over
357 * established paths. This function will deal with RMDATA messages
358 * embedded in struct iucv_message as well.
359 *
360 * Locking: no locking.
361 *
362 * Returns the result from the CP IUCV call.
363 */
364int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
365 u8 flags, void *buffer, size_t size,
366 size_t *residual);
367
368/**
346 * iucv_message_reject 369 * iucv_message_reject
347 * @path: address of iucv path structure 370 * @path: address of iucv path structure
348 * @msg: address of iucv msg structure 371 * @msg: address of iucv msg structure
@@ -386,12 +409,34 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
386 * transmitted is in a buffer and this is a one-way message and the 409 * transmitted is in a buffer and this is a one-way message and the
387 * receiver will not reply to the message. 410 * receiver will not reply to the message.
388 * 411 *
412 * Locking: local_bh_enable/local_bh_disable
413 *
389 * Returns the result from the CP IUCV call. 414 * Returns the result from the CP IUCV call.
390 */ 415 */
391int iucv_message_send(struct iucv_path *path, struct iucv_message *msg, 416int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
392 u8 flags, u32 srccls, void *buffer, size_t size); 417 u8 flags, u32 srccls, void *buffer, size_t size);
393 418
394/** 419/**
420 * __iucv_message_send
421 * @path: address of iucv path structure
422 * @msg: address of iucv msg structure
423 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
424 * @srccls: source class of message
425 * @buffer: address of data buffer or address of struct iucv_array
426 * @size: length of send buffer
427 *
428 * This function transmits data to another application. Data to be
429 * transmitted is in a buffer and this is a one-way message and the
430 * receiver will not reply to the message.
431 *
432 * Locking: no locking.
433 *
434 * Returns the result from the CP IUCV call.
435 */
436int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
437 u8 flags, u32 srccls, void *buffer, size_t size);
438
439/**
395 * iucv_message_send2way 440 * iucv_message_send2way
396 * @path: address of iucv path structure 441 * @path: address of iucv path structure
397 * @msg: address of iucv msg structure 442 * @msg: address of iucv msg structure
diff --git a/include/net/ieee80211_crypt.h b/include/net/lib80211.h
index b3d65e0bedd3..fb4e2784857d 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/lib80211.h
@@ -1,4 +1,11 @@
1/* 1/*
2 * lib80211.h -- common bits for IEEE802.11 wireless drivers
3 *
4 * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
5 *
6 * Some bits copied from old ieee80211 component, w/ original copyright
7 * notices below:
8 *
2 * Original code based on Host AP (software wireless LAN access point) driver 9 * Original code based on Host AP (software wireless LAN access point) driver
3 * for Intersil Prism2/2.5/3. 10 * for Intersil Prism2/2.5/3.
4 * 11 *
@@ -11,31 +18,31 @@
11 * 18 *
12 * Copyright (c) 2004, Intel Corporation 19 * Copyright (c) 2004, Intel Corporation
13 * 20 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. See README and COPYING for
17 * more details.
18 */ 21 */
19 22
20/* 23#ifndef LIB80211_H
21 * This file defines the interface to the ieee80211 crypto module. 24#define LIB80211_H
22 */
23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/ieee80211.h> 28#include <linux/module.h>
29#include <asm/atomic.h> 29#include <asm/atomic.h>
30#include <linux/if.h>
31#include <linux/skbuff.h>
32#include <linux/ieee80211.h>
33#include <linux/timer.h>
34/* print_ssid() is intended to be used in debug (and possibly error)
35 * messages. It should never be used for passing ssid to user space. */
36const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
37#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
38
39#define NUM_WEP_KEYS 4
30 40
31enum { 41enum {
32 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 42 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
33}; 43};
34 44
35struct sk_buff; 45struct lib80211_crypto_ops {
36struct module;
37
38struct ieee80211_crypto_ops {
39 const char *name; 46 const char *name;
40 struct list_head list; 47 struct list_head list;
41 48
@@ -87,22 +94,36 @@ struct ieee80211_crypto_ops {
87 struct module *owner; 94 struct module *owner;
88}; 95};
89 96
90struct ieee80211_crypt_data { 97struct lib80211_crypt_data {
91 struct list_head list; /* delayed deletion list */ 98 struct list_head list; /* delayed deletion list */
92 struct ieee80211_crypto_ops *ops; 99 struct lib80211_crypto_ops *ops;
93 void *priv; 100 void *priv;
94 atomic_t refcnt; 101 atomic_t refcnt;
95}; 102};
96 103
97struct ieee80211_device; 104struct lib80211_crypt_info {
98 105 char *name;
99int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 106 /* Most clients will already have a lock,
100int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 107 so just point to that. */
101struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 108 spinlock_t *lock;
102void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); 109
103void ieee80211_crypt_deinit_handler(unsigned long); 110 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
104void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 111 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
105 struct ieee80211_crypt_data **crypt); 112 struct list_head crypt_deinit_list;
106void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); 113 struct timer_list crypt_deinit_timer;
114 int crypt_quiesced;
115};
107 116
108#endif 117int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
118 spinlock_t *lock);
119void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
120int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
121int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
122struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
123void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *, int);
124void lib80211_crypt_deinit_handler(unsigned long);
125void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
126 struct lib80211_crypt_data **crypt);
127void lib80211_crypt_quiescing(struct lib80211_crypt_info *info);
128
129#endif /* LIB80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 73d81bc6aa75..b3bd00a9d992 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -107,7 +107,7 @@ enum ieee80211_max_queues {
107 * The information provided in this structure is required for QoS 107 * The information provided in this structure is required for QoS
108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. 108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
109 * 109 *
110 * @aifs: arbitration interface space [0..255] 110 * @aifs: arbitration interframe space [0..255]
111 * @cw_min: minimum contention window [a value of the form 111 * @cw_min: minimum contention window [a value of the form
112 * 2^n-1 in the range 1..32767] 112 * 2^n-1 in the range 1..32767]
113 * @cw_max: maximum contention window [like @cw_min] 113 * @cw_max: maximum contention window [like @cw_min]
@@ -164,6 +164,14 @@ enum ieee80211_bss_change {
164}; 164};
165 165
166/** 166/**
167 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration
168 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
169 */
170struct ieee80211_bss_ht_conf {
171 u16 operation_mode;
172};
173
174/**
167 * struct ieee80211_bss_conf - holds the BSS's changing parameters 175 * struct ieee80211_bss_conf - holds the BSS's changing parameters
168 * 176 *
169 * This structure keeps information about a BSS (and an association 177 * This structure keeps information about a BSS (and an association
@@ -172,15 +180,17 @@ enum ieee80211_bss_change {
172 * @assoc: association status 180 * @assoc: association status
173 * @aid: association ID number, valid only when @assoc is true 181 * @aid: association ID number, valid only when @assoc is true
174 * @use_cts_prot: use CTS protection 182 * @use_cts_prot: use CTS protection
175 * @use_short_preamble: use 802.11b short preamble 183 * @use_short_preamble: use 802.11b short preamble;
176 * @use_short_slot: use short slot time (only relevant for ERP) 184 * if the hardware cannot handle this it must set the
185 * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
186 * @use_short_slot: use short slot time (only relevant for ERP);
187 * if the hardware cannot handle this it must set the
188 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
177 * @dtim_period: num of beacons before the next DTIM, for PSM 189 * @dtim_period: num of beacons before the next DTIM, for PSM
178 * @timestamp: beacon timestamp 190 * @timestamp: beacon timestamp
179 * @beacon_int: beacon interval 191 * @beacon_int: beacon interval
180 * @assoc_capability: capabilities taken from assoc resp 192 * @assoc_capability: capabilities taken from assoc resp
181 * @assoc_ht: association in HT mode 193 * @ht: BSS's HT configuration
182 * @ht_conf: ht capabilities
183 * @ht_bss_conf: ht extended capabilities
184 * @basic_rates: bitmap of basic rates, each bit stands for an 194 * @basic_rates: bitmap of basic rates, each bit stands for an
185 * index into the rate table configured by the driver in 195 * index into the rate table configured by the driver in
186 * the current band. 196 * the current band.
@@ -198,10 +208,7 @@ struct ieee80211_bss_conf {
198 u16 assoc_capability; 208 u16 assoc_capability;
199 u64 timestamp; 209 u64 timestamp;
200 u64 basic_rates; 210 u64 basic_rates;
201 /* ht related data */ 211 struct ieee80211_bss_ht_conf ht;
202 bool assoc_ht;
203 struct ieee80211_ht_info *ht_conf;
204 struct ieee80211_ht_bss_info *ht_bss_conf;
205}; 212};
206 213
207/** 214/**
@@ -210,29 +217,24 @@ struct ieee80211_bss_conf {
210 * These flags are used with the @flags member of &ieee80211_tx_info. 217 * These flags are used with the @flags member of &ieee80211_tx_info.
211 * 218 *
212 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 219 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
213 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame 220 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
214 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 221 * number to this frame, taking care of not overwriting the fragment
215 * for combined 802.11g / 802.11b networks) 222 * number and increasing the sequence number only when the
223 * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
224 * assign sequence numbers to QoS-data frames but cannot do so correctly
225 * for non-QoS-data and management frames because beacons need them from
226 * that counter as well and mac80211 cannot guarantee proper sequencing.
227 * If this flag is set, the driver should instruct the hardware to
228 * assign a sequence number to the frame or assign one itself. Cf. IEEE
229 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
230 * beacons and always be clear for frames without a sequence number field.
216 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack 231 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
217 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: TBD
218 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination 232 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
219 * station 233 * station
220 * @IEEE80211_TX_CTL_REQUEUE: TBD
221 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame 234 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
222 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
223 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
224 * through set_retry_limit configured long retry value
225 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 235 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
226 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 236 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
227 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 237 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
228 * of streams when this flag is on can be extracted from antenna_sel_tx,
229 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
230 * antennas marked use MIMO_n.
231 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
232 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
233 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
234 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
235 * @IEEE80211_TX_CTL_INJECTED: TBD
236 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 238 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
237 * because the destination STA was in powersave mode. 239 * because the destination STA was in powersave mode.
238 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 240 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
@@ -240,63 +242,67 @@ struct ieee80211_bss_conf {
240 * is for the whole aggregation. 242 * is for the whole aggregation.
241 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, 243 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
242 * so consider using block ack request (BAR). 244 * so consider using block ack request (BAR).
243 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence 245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
244 * number to this frame, taking care of not overwriting the fragment 246 * set by rate control algorithms to indicate probe rate, will
245 * number and increasing the sequence number only when the 247 * be cleared for fragmented frames (except on the last fragment)
246 * IEEE80211_TX_CTL_FIRST_FRAGMENT flags is set. mac80211 will properly
247 * assign sequence numbers to QoS-data frames but cannot do so correctly
248 * for non-QoS-data and management frames because beacons need them from
249 * that counter as well and mac80211 cannot guarantee proper sequencing.
250 * If this flag is set, the driver should instruct the hardware to
251 * assign a sequence number to the frame or assign one itself. Cf. IEEE
252 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
253 * beacons always be clear for frames without a sequence number field.
254 */ 248 */
255enum mac80211_tx_control_flags { 249enum mac80211_tx_control_flags {
256 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
257 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), 251 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
258 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), 252 IEEE80211_TX_CTL_NO_ACK = BIT(2),
259 IEEE80211_TX_CTL_NO_ACK = BIT(4), 253 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3),
260 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5), 254 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4),
261 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6), 255 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5),
262 IEEE80211_TX_CTL_REQUEUE = BIT(7), 256 IEEE80211_TX_CTL_AMPDU = BIT(6),
263 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), 257 IEEE80211_TX_CTL_INJECTED = BIT(7),
264 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), 258 IEEE80211_TX_STAT_TX_FILTERED = BIT(8),
265 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), 259 IEEE80211_TX_STAT_ACK = BIT(9),
266 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), 260 IEEE80211_TX_STAT_AMPDU = BIT(10),
267 IEEE80211_TX_CTL_AMPDU = BIT(13), 261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
268 IEEE80211_TX_CTL_OFDM_HT = BIT(14), 262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
269 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15), 263};
270 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16), 264
271 IEEE80211_TX_CTL_DUP_DATA = BIT(17), 265enum mac80211_rate_control_flags {
272 IEEE80211_TX_CTL_SHORT_GI = BIT(18), 266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
273 IEEE80211_TX_CTL_INJECTED = BIT(19), 267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
274 IEEE80211_TX_STAT_TX_FILTERED = BIT(20), 268 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
275 IEEE80211_TX_STAT_ACK = BIT(21), 269
276 IEEE80211_TX_STAT_AMPDU = BIT(22), 270 /* rate index is an MCS rate number instead of an index */
277 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(23), 271 IEEE80211_TX_RC_MCS = BIT(3),
278 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(24), 272 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
273 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
274 IEEE80211_TX_RC_DUP_DATA = BIT(6),
275 IEEE80211_TX_RC_SHORT_GI = BIT(7),
279}; 276};
280 277
281 278
282#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \ 279/* there are 40 bytes if you don't need the rateset to be kept */
283 (sizeof(((struct sk_buff *)0)->cb) - 8) 280#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
284#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
285 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
286 281
287/* maximum number of alternate rate retry stages */ 282/* if you do need the rateset, then you have less space */
288#define IEEE80211_TX_MAX_ALTRATE 3 283#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
284
285/* maximum number of rate stages */
286#define IEEE80211_TX_MAX_RATES 5
289 287
290/** 288/**
291 * struct ieee80211_tx_altrate - alternate rate selection/status 289 * struct ieee80211_tx_rate - rate selection/status
290 *
291 * @idx: rate index to attempt to send with
292 * @flags: rate control flags (&enum mac80211_rate_control_flags)
293 * @count: number of tries in this rate before going to the next rate
292 * 294 *
293 * @rate_idx: rate index to attempt to send with 295 * A value of -1 for @idx indicates an invalid rate and, if used
294 * @limit: number of retries before fallback 296 * in an array of retry rates, that no more rates should be tried.
297 *
298 * When used for transmit status reporting, the driver should
299 * always report the rate along with the flags it used.
295 */ 300 */
296struct ieee80211_tx_altrate { 301struct ieee80211_tx_rate {
297 s8 rate_idx; 302 s8 idx;
298 u8 limit; 303 u8 count;
299}; 304 u8 flags;
305} __attribute__((packed));
300 306
301/** 307/**
302 * struct ieee80211_tx_info - skb transmit information 308 * struct ieee80211_tx_info - skb transmit information
@@ -310,15 +316,13 @@ struct ieee80211_tx_altrate {
310 * it may be NULL. 316 * it may be NULL.
311 * 317 *
312 * @flags: transmit info flags, defined above 318 * @flags: transmit info flags, defined above
313 * @band: TBD 319 * @band: the band to transmit on (use for checking for races)
314 * @tx_rate_idx: TBD 320 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
315 * @antenna_sel_tx: TBD 321 * @pad: padding, ignore
316 * @control: union for control data 322 * @control: union for control data
317 * @status: union for status data 323 * @status: union for status data
318 * @driver_data: array of driver_data pointers 324 * @driver_data: array of driver_data pointers
319 * @retry_count: number of retries 325 * @retry_count: number of retries
320 * @excessive_retries: set to 1 if the frame was retried many times
321 * but not acknowledged
322 * @ampdu_ack_len: number of aggregated frames. 326 * @ampdu_ack_len: number of aggregated frames.
323 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 327 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
324 * @ampdu_ack_map: block ack bit map for the aggregation. 328 * @ampdu_ack_map: block ack bit map for the aggregation.
@@ -329,31 +333,44 @@ struct ieee80211_tx_info {
329 /* common information */ 333 /* common information */
330 u32 flags; 334 u32 flags;
331 u8 band; 335 u8 band;
332 s8 tx_rate_idx; 336
333 u8 antenna_sel_tx; 337 u8 antenna_sel_tx;
334 338
335 /* 1 byte hole */ 339 /* 2 byte hole */
340 u8 pad[2];
336 341
337 union { 342 union {
338 struct { 343 struct {
344 union {
345 /* rate control */
346 struct {
347 struct ieee80211_tx_rate rates[
348 IEEE80211_TX_MAX_RATES];
349 s8 rts_cts_rate_idx;
350 };
351 /* only needed before rate control */
352 unsigned long jiffies;
353 };
339 /* NB: vif can be NULL for injected frames */ 354 /* NB: vif can be NULL for injected frames */
340 struct ieee80211_vif *vif; 355 struct ieee80211_vif *vif;
341 struct ieee80211_key_conf *hw_key; 356 struct ieee80211_key_conf *hw_key;
342 struct ieee80211_sta *sta; 357 struct ieee80211_sta *sta;
343 unsigned long jiffies;
344 s8 rts_cts_rate_idx;
345 u8 retry_limit;
346 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
347 } control; 358 } control;
348 struct { 359 struct {
360 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
361 u8 ampdu_ack_len;
349 u64 ampdu_ack_map; 362 u64 ampdu_ack_map;
350 int ack_signal; 363 int ack_signal;
351 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1]; 364 /* 8 bytes free */
352 u8 retry_count;
353 bool excessive_retries;
354 u8 ampdu_ack_len;
355 } status; 365 } status;
356 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS]; 366 struct {
367 struct ieee80211_tx_rate driver_rates[
368 IEEE80211_TX_MAX_RATES];
369 void *rate_driver_data[
370 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
371 };
372 void *driver_data[
373 IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
357 }; 374 };
358}; 375};
359 376
@@ -362,6 +379,41 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
362 return (struct ieee80211_tx_info *)skb->cb; 379 return (struct ieee80211_tx_info *)skb->cb;
363} 380}
364 381
382/**
383 * ieee80211_tx_info_clear_status - clear TX status
384 *
385 * @info: The &struct ieee80211_tx_info to be cleared.
386 *
387 * When the driver passes an skb back to mac80211, it must report
388 * a number of things in TX status. This function clears everything
389 * in the TX status but the rate control information (it does clear
390 * the count since you need to fill that in anyway).
391 *
392 * NOTE: You can only use this function if you do NOT use
393 * info->driver_data! Use info->rate_driver_data
394 * instead if you need only the less space that allows.
395 */
396static inline void
397ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
398{
399 int i;
400
401 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
402 offsetof(struct ieee80211_tx_info, control.rates));
403 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
404 offsetof(struct ieee80211_tx_info, driver_rates));
405 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
406 /* clear the rate counts */
407 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
408 info->status.rates[i].count = 0;
409
410 BUILD_BUG_ON(
411 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23);
412 memset(&info->status.ampdu_ack_len, 0,
413 sizeof(struct ieee80211_tx_info) -
414 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
415}
416
365 417
366/** 418/**
367 * enum mac80211_rx_flags - receive flags 419 * enum mac80211_rx_flags - receive flags
@@ -384,6 +436,9 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
384 * is valid. This is useful in monitor mode and necessary for beacon frames 436 * is valid. This is useful in monitor mode and necessary for beacon frames
385 * to enable IBSS merging. 437 * to enable IBSS merging.
386 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 438 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
439 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
440 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
441 * @RX_FLAG_SHORT_GI: Short guard interval was used
387 */ 442 */
388enum mac80211_rx_flags { 443enum mac80211_rx_flags {
389 RX_FLAG_MMIC_ERROR = 1<<0, 444 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -394,7 +449,10 @@ enum mac80211_rx_flags {
394 RX_FLAG_FAILED_FCS_CRC = 1<<5, 449 RX_FLAG_FAILED_FCS_CRC = 1<<5,
395 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 450 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
396 RX_FLAG_TSFT = 1<<7, 451 RX_FLAG_TSFT = 1<<7,
397 RX_FLAG_SHORTPRE = 1<<8 452 RX_FLAG_SHORTPRE = 1<<8,
453 RX_FLAG_HT = 1<<9,
454 RX_FLAG_40MHZ = 1<<10,
455 RX_FLAG_SHORT_GI = 1<<11,
398}; 456};
399 457
400/** 458/**
@@ -414,7 +472,8 @@ enum mac80211_rx_flags {
414 * @noise: noise when receiving this frame, in dBm. 472 * @noise: noise when receiving this frame, in dBm.
415 * @qual: overall signal quality indication, in percent (0-100). 473 * @qual: overall signal quality indication, in percent (0-100).
416 * @antenna: antenna used 474 * @antenna: antenna used
417 * @rate_idx: index of data rate into band's supported rates 475 * @rate_idx: index of data rate into band's supported rates or MCS index if
476 * HT rates are use (RX_FLAG_HT)
418 * @flag: %RX_FLAG_* 477 * @flag: %RX_FLAG_*
419 */ 478 */
420struct ieee80211_rx_status { 479struct ieee80211_rx_status {
@@ -434,21 +493,49 @@ struct ieee80211_rx_status {
434 * 493 *
435 * Flags to define PHY configuration options 494 * Flags to define PHY configuration options
436 * 495 *
437 * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
438 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 496 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
439 * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
440 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 497 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
441 */ 498 */
442enum ieee80211_conf_flags { 499enum ieee80211_conf_flags {
443 /* 500 IEEE80211_CONF_RADIOTAP = (1<<0),
444 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers 501 IEEE80211_CONF_PS = (1<<1),
445 * have been converted to use bss_info_changed() for slot time 502};
446 * configuration 503
447 */ 504/* XXX: remove all this once drivers stop trying to use it */
448 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 505static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
449 IEEE80211_CONF_RADIOTAP = (1<<1), 506{
450 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 507 return 0;
451 IEEE80211_CONF_PS = (1<<3), 508}
509#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
510
511struct ieee80211_ht_conf {
512 bool enabled;
513 enum nl80211_channel_type channel_type;
514};
515
516/**
517 * enum ieee80211_conf_changed - denotes which configuration changed
518 *
519 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
520 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
521 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
522 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
523 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
524 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
525 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
526 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
527 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
528 */
529enum ieee80211_conf_changed {
530 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
531 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
532 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
533 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
534 IEEE80211_CONF_CHANGE_PS = BIT(4),
535 IEEE80211_CONF_CHANGE_POWER = BIT(5),
536 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
537 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
538 IEEE80211_CONF_CHANGE_HT = BIT(8),
452}; 539};
453 540
454/** 541/**
@@ -457,34 +544,31 @@ enum ieee80211_conf_flags {
457 * This struct indicates how the driver shall configure the hardware. 544 * This struct indicates how the driver shall configure the hardware.
458 * 545 *
459 * @radio_enabled: when zero, driver is required to switch off the radio. 546 * @radio_enabled: when zero, driver is required to switch off the radio.
460 * TODO make a flag
461 * @beacon_int: beacon interval (TODO make interface config) 547 * @beacon_int: beacon interval (TODO make interface config)
462 * @listen_interval: listen interval in units of beacon interval 548 * @listen_interval: listen interval in units of beacon interval
463 * @flags: configuration flags defined above 549 * @flags: configuration flags defined above
464 * @power_level: requested transmit power (in dBm) 550 * @power_level: requested transmit power (in dBm)
465 * @max_antenna_gain: maximum antenna gain (in dBi)
466 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
467 * 1/2: antenna 0/1
468 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
469 * @ht_conf: describes current self configuration of 802.11n HT capabilies
470 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
471 * @channel: the channel to tune to 551 * @channel: the channel to tune to
552 * @ht: the HT configuration for the device
553 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
554 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
555 * but actually means the number of transmissions not the number of retries
556 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
557 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
558 * number of transmissions not the number of retries
472 */ 559 */
473struct ieee80211_conf { 560struct ieee80211_conf {
474 int radio_enabled;
475
476 int beacon_int; 561 int beacon_int;
477 u16 listen_interval;
478 u32 flags; 562 u32 flags;
479 int power_level; 563 int power_level;
480 int max_antenna_gain;
481 u8 antenna_sel_tx;
482 u8 antenna_sel_rx;
483 564
484 struct ieee80211_channel *channel; 565 u16 listen_interval;
566 bool radio_enabled;
567
568 u8 long_frame_max_tx_count, short_frame_max_tx_count;
485 569
486 struct ieee80211_ht_info ht_conf; 570 struct ieee80211_channel *channel;
487 struct ieee80211_ht_bss_info ht_bss_conf; 571 struct ieee80211_ht_conf ht;
488}; 572};
489 573
490/** 574/**
@@ -494,11 +578,14 @@ struct ieee80211_conf {
494 * use during the life of a virtual interface. 578 * use during the life of a virtual interface.
495 * 579 *
496 * @type: type of this virtual interface 580 * @type: type of this virtual interface
581 * @bss_conf: BSS configuration for this interface, either our own
582 * or the BSS we're associated to
497 * @drv_priv: data area for driver use, will always be aligned to 583 * @drv_priv: data area for driver use, will always be aligned to
498 * sizeof(void *). 584 * sizeof(void *).
499 */ 585 */
500struct ieee80211_vif { 586struct ieee80211_vif {
501 enum nl80211_iftype type; 587 enum nl80211_iftype type;
588 struct ieee80211_bss_conf bss_conf;
502 /* must be last */ 589 /* must be last */
503 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 590 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
504}; 591};
@@ -542,14 +629,12 @@ struct ieee80211_if_init_conf {
542 * enum ieee80211_if_conf_change - interface config change flags 629 * enum ieee80211_if_conf_change - interface config change flags
543 * 630 *
544 * @IEEE80211_IFCC_BSSID: The BSSID changed. 631 * @IEEE80211_IFCC_BSSID: The BSSID changed.
545 * @IEEE80211_IFCC_SSID: The SSID changed.
546 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 632 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
547 * (currently AP and MESH only), use ieee80211_beacon_get(). 633 * (currently AP and MESH only), use ieee80211_beacon_get().
548 */ 634 */
549enum ieee80211_if_conf_change { 635enum ieee80211_if_conf_change {
550 IEEE80211_IFCC_BSSID = BIT(0), 636 IEEE80211_IFCC_BSSID = BIT(0),
551 IEEE80211_IFCC_SSID = BIT(1), 637 IEEE80211_IFCC_BEACON = BIT(1),
552 IEEE80211_IFCC_BEACON = BIT(2),
553}; 638};
554 639
555/** 640/**
@@ -557,11 +642,6 @@ enum ieee80211_if_conf_change {
557 * 642 *
558 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 643 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
559 * @bssid: BSSID of the network we are associated to/creating. 644 * @bssid: BSSID of the network we are associated to/creating.
560 * @ssid: used (together with @ssid_len) by drivers for hardware that
561 * generate beacons independently. The pointer is valid only during the
562 * config_interface() call, so copy the value somewhere if you need
563 * it.
564 * @ssid_len: length of the @ssid field.
565 * 645 *
566 * This structure is passed to the config_interface() callback of 646 * This structure is passed to the config_interface() callback of
567 * &struct ieee80211_hw. 647 * &struct ieee80211_hw.
@@ -569,8 +649,6 @@ enum ieee80211_if_conf_change {
569struct ieee80211_if_conf { 649struct ieee80211_if_conf {
570 u32 changed; 650 u32 changed;
571 u8 *bssid; 651 u8 *bssid;
572 u8 *ssid;
573 size_t ssid_len;
574}; 652};
575 653
576/** 654/**
@@ -677,7 +755,7 @@ enum set_key_cmd {
677 * @addr: MAC address 755 * @addr: MAC address
678 * @aid: AID we assigned to the station if we're an AP 756 * @aid: AID we assigned to the station if we're an AP
679 * @supp_rates: Bitmap of supported rates (per band) 757 * @supp_rates: Bitmap of supported rates (per band)
680 * @ht_info: HT capabilities of this STA 758 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
681 * @drv_priv: data area for driver use, will always be aligned to 759 * @drv_priv: data area for driver use, will always be aligned to
682 * sizeof(void *), size is determined in hw information. 760 * sizeof(void *), size is determined in hw information.
683 */ 761 */
@@ -685,7 +763,7 @@ struct ieee80211_sta {
685 u64 supp_rates[IEEE80211_NUM_BANDS]; 763 u64 supp_rates[IEEE80211_NUM_BANDS];
686 u8 addr[ETH_ALEN]; 764 u8 addr[ETH_ALEN];
687 u16 aid; 765 u16 aid;
688 struct ieee80211_ht_info ht_info; 766 struct ieee80211_sta_ht_cap ht_cap;
689 767
690 /* must be last */ 768 /* must be last */
691 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 769 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
@@ -695,13 +773,17 @@ struct ieee80211_sta {
695 * enum sta_notify_cmd - sta notify command 773 * enum sta_notify_cmd - sta notify command
696 * 774 *
697 * Used with the sta_notify() callback in &struct ieee80211_ops, this 775 * Used with the sta_notify() callback in &struct ieee80211_ops, this
698 * indicates addition and removal of a station to station table. 776 * indicates addition and removal of a station to station table,
777 * or if a associated station made a power state transition.
699 * 778 *
700 * @STA_NOTIFY_ADD: a station was added to the station table 779 * @STA_NOTIFY_ADD: a station was added to the station table
701 * @STA_NOTIFY_REMOVE: a station being removed from the station table 780 * @STA_NOTIFY_REMOVE: a station being removed from the station table
781 * @STA_NOTIFY_SLEEP: a station is now sleeping
782 * @STA_NOTIFY_AWAKE: a sleeping station woke up
702 */ 783 */
703enum sta_notify_cmd { 784enum sta_notify_cmd {
704 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE 785 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE,
786 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
705}; 787};
706 788
707/** 789/**
@@ -769,6 +851,14 @@ enum ieee80211_tkip_key_type {
769 * @IEEE80211_HW_SPECTRUM_MGMT: 851 * @IEEE80211_HW_SPECTRUM_MGMT:
770 * Hardware supports spectrum management defined in 802.11h 852 * Hardware supports spectrum management defined in 802.11h
771 * Measurement, Channel Switch, Quieting, TPC 853 * Measurement, Channel Switch, Quieting, TPC
854 *
855 * @IEEE80211_HW_AMPDU_AGGREGATION:
856 * Hardware supports 11n A-MPDU aggregation.
857 *
858 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS:
859 * Hardware which has dynamic power save support, meaning
860 * that power save is enabled in idle periods, and don't need support
861 * from stack.
772 */ 862 */
773enum ieee80211_hw_flags { 863enum ieee80211_hw_flags {
774 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 864 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -780,6 +870,8 @@ enum ieee80211_hw_flags {
780 IEEE80211_HW_SIGNAL_DBM = 1<<7, 870 IEEE80211_HW_SIGNAL_DBM = 1<<7,
781 IEEE80211_HW_NOISE_DBM = 1<<8, 871 IEEE80211_HW_NOISE_DBM = 1<<8,
782 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 872 IEEE80211_HW_SPECTRUM_MGMT = 1<<9,
873 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10,
874 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11,
783}; 875};
784 876
785/** 877/**
@@ -838,8 +930,8 @@ enum ieee80211_hw_flags {
838 * @sta_data_size: size (in bytes) of the drv_priv data area 930 * @sta_data_size: size (in bytes) of the drv_priv data area
839 * within &struct ieee80211_sta. 931 * within &struct ieee80211_sta.
840 * 932 *
841 * @max_altrates: maximum number of alternate rate retry stages 933 * @max_rates: maximum number of alternate rate retry stages
842 * @max_altrate_tries: maximum number of tries for each stage 934 * @max_rate_tries: maximum number of tries for each stage
843 */ 935 */
844struct ieee80211_hw { 936struct ieee80211_hw {
845 struct ieee80211_conf conf; 937 struct ieee80211_conf conf;
@@ -856,12 +948,10 @@ struct ieee80211_hw {
856 u16 ampdu_queues; 948 u16 ampdu_queues;
857 u16 max_listen_interval; 949 u16 max_listen_interval;
858 s8 max_signal; 950 s8 max_signal;
859 u8 max_altrates; 951 u8 max_rates;
860 u8 max_altrate_tries; 952 u8 max_rate_tries;
861}; 953};
862 954
863struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
864
865/** 955/**
866 * SET_IEEE80211_DEV - set device for 802.11 hardware 956 * SET_IEEE80211_DEV - set device for 802.11 hardware
867 * 957 *
@@ -874,7 +964,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev
874} 964}
875 965
876/** 966/**
877 * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware 967 * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
878 * 968 *
879 * @hw: the &struct ieee80211_hw to set the MAC address for 969 * @hw: the &struct ieee80211_hw to set the MAC address for
880 * @addr: the address to set 970 * @addr: the address to set
@@ -898,9 +988,9 @@ static inline struct ieee80211_rate *
898ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 988ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
899 const struct ieee80211_tx_info *c) 989 const struct ieee80211_tx_info *c)
900{ 990{
901 if (WARN_ON(c->tx_rate_idx < 0)) 991 if (WARN_ON(c->control.rates[0].idx < 0))
902 return NULL; 992 return NULL;
903 return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx]; 993 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
904} 994}
905 995
906static inline struct ieee80211_rate * 996static inline struct ieee80211_rate *
@@ -916,9 +1006,9 @@ static inline struct ieee80211_rate *
916ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 1006ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
917 const struct ieee80211_tx_info *c, int idx) 1007 const struct ieee80211_tx_info *c, int idx)
918{ 1008{
919 if (c->control.retries[idx].rate_idx < 0) 1009 if (c->control.rates[idx + 1].idx < 0)
920 return NULL; 1010 return NULL;
921 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx]; 1011 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
922} 1012}
923 1013
924/** 1014/**
@@ -967,7 +1057,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
967 * This happens everytime the iv16 wraps around (every 65536 packets). The 1057 * This happens everytime the iv16 wraps around (every 65536 packets). The
968 * set_key() call will happen only once for each key (unless the AP did 1058 * set_key() call will happen only once for each key (unless the AP did
969 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 1059 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
970 * provided by udpate_tkip_key only. The trigger that makes mac80211 call this 1060 * provided by update_tkip_key only. The trigger that makes mac80211 call this
971 * handler is software decryption with wrap around of iv16. 1061 * handler is software decryption with wrap around of iv16.
972 */ 1062 */
973 1063
@@ -1060,12 +1150,14 @@ enum ieee80211_filter_flags {
1060 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1150 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1061 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1151 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1062 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1152 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1153 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation
1063 */ 1154 */
1064enum ieee80211_ampdu_mlme_action { 1155enum ieee80211_ampdu_mlme_action {
1065 IEEE80211_AMPDU_RX_START, 1156 IEEE80211_AMPDU_RX_START,
1066 IEEE80211_AMPDU_RX_STOP, 1157 IEEE80211_AMPDU_RX_STOP,
1067 IEEE80211_AMPDU_TX_START, 1158 IEEE80211_AMPDU_TX_START,
1068 IEEE80211_AMPDU_TX_STOP, 1159 IEEE80211_AMPDU_TX_STOP,
1160 IEEE80211_AMPDU_TX_RESUME,
1069}; 1161};
1070 1162
1071/** 1163/**
@@ -1101,7 +1193,7 @@ enum ieee80211_ampdu_mlme_action {
1101 * Must be implemented. 1193 * Must be implemented.
1102 * 1194 *
1103 * @add_interface: Called when a netdevice attached to the hardware is 1195 * @add_interface: Called when a netdevice attached to the hardware is
1104 * enabled. Because it is not called for monitor mode devices, @open 1196 * enabled. Because it is not called for monitor mode devices, @start
1105 * and @stop must be implemented. 1197 * and @stop must be implemented.
1106 * The driver should perform any initialization it needs before 1198 * The driver should perform any initialization it needs before
1107 * the device can be enabled. The initial configuration for the 1199 * the device can be enabled. The initial configuration for the
@@ -1163,14 +1255,9 @@ enum ieee80211_ampdu_mlme_action {
1163 * 1255 *
1164 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1256 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1165 * 1257 *
1166 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if 1258 * @sta_notify: Notifies low level driver about addition, removal or power
1167 * the device does fragmentation by itself; if this method is assigned then 1259 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc.
1168 * the stack will not do fragmentation. 1260 * Must be atomic.
1169 *
1170 * @set_retry_limit: Configuration of retry limits (if device needs it)
1171 *
1172 * @sta_notify: Notifies low level driver about addition or removal
1173 * of assocaited station or AP.
1174 * 1261 *
1175 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1262 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1176 * bursting) for a hardware TX queue. 1263 * bursting) for a hardware TX queue.
@@ -1194,8 +1281,6 @@ enum ieee80211_ampdu_mlme_action {
1194 * This is needed only for IBSS mode and the result of this function is 1281 * This is needed only for IBSS mode and the result of this function is
1195 * used to determine whether to reply to Probe Requests. 1282 * used to determine whether to reply to Probe Requests.
1196 * 1283 *
1197 * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.
1198 *
1199 * @ampdu_action: Perform a certain A-MPDU action 1284 * @ampdu_action: Perform a certain A-MPDU action
1200 * The RA/TID combination determines the destination and TID we want 1285 * The RA/TID combination determines the destination and TID we want
1201 * the ampdu action to be performed for. The action is defined through 1286 * the ampdu action to be performed for. The action is defined through
@@ -1211,7 +1296,7 @@ struct ieee80211_ops {
1211 struct ieee80211_if_init_conf *conf); 1296 struct ieee80211_if_init_conf *conf);
1212 void (*remove_interface)(struct ieee80211_hw *hw, 1297 void (*remove_interface)(struct ieee80211_hw *hw,
1213 struct ieee80211_if_init_conf *conf); 1298 struct ieee80211_if_init_conf *conf);
1214 int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); 1299 int (*config)(struct ieee80211_hw *hw, u32 changed);
1215 int (*config_interface)(struct ieee80211_hw *hw, 1300 int (*config_interface)(struct ieee80211_hw *hw,
1216 struct ieee80211_vif *vif, 1301 struct ieee80211_vif *vif,
1217 struct ieee80211_if_conf *conf); 1302 struct ieee80211_if_conf *conf);
@@ -1237,9 +1322,6 @@ struct ieee80211_ops {
1237 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1322 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1238 u32 *iv32, u16 *iv16); 1323 u32 *iv32, u16 *iv16);
1239 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1324 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1240 int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
1241 int (*set_retry_limit)(struct ieee80211_hw *hw,
1242 u32 short_retry, u32 long_retr);
1243 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1325 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1244 enum sta_notify_cmd, struct ieee80211_sta *sta); 1326 enum sta_notify_cmd, struct ieee80211_sta *sta);
1245 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1327 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
@@ -1472,7 +1554,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1472 * the next beacon frame from the 802.11 code. The low-level is responsible 1554 * the next beacon frame from the 802.11 code. The low-level is responsible
1473 * for calling this function before beacon data is needed (e.g., based on 1555 * for calling this function before beacon data is needed (e.g., based on
1474 * hardware interrupt). Returned skb is used only once and low-level driver 1556 * hardware interrupt). Returned skb is used only once and low-level driver
1475 * is responsible of freeing it. 1557 * is responsible for freeing it.
1476 */ 1558 */
1477struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1559struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1478 struct ieee80211_vif *vif); 1560 struct ieee80211_vif *vif);
@@ -1803,24 +1885,38 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1803 1885
1804 1886
1805/* Rate control API */ 1887/* Rate control API */
1888
1806/** 1889/**
1807 * struct rate_selection - rate information for/from rate control algorithms 1890 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1808 * 1891 *
1809 * @rate_idx: selected transmission rate index 1892 * @hw: The hardware the algorithm is invoked for.
1810 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used 1893 * @sband: The band this frame is being transmitted on.
1811 * @probe_idx: rate for probing (or -1) 1894 * @bss_conf: the current BSS configuration
1812 * @max_rate_idx: maximum rate index that can be used, this is 1895 * @reported_rate: The rate control algorithm can fill this in to indicate
1813 * input to the algorithm and will be enforced 1896 * which rate should be reported to userspace as the current rate and
1814 */ 1897 * used for rate calculations in the mesh network.
1815struct rate_selection { 1898 * @rts: whether RTS will be used for this frame because it is longer than the
1816 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; 1899 * RTS threshold
1900 * @short_preamble: whether mac80211 will request short-preamble transmission
1901 * if the selected rate supports it
1902 * @max_rate_idx: user-requested maximum rate (not MCS for now)
1903 * @skb: the skb that will be transmitted, the control information in it needs
1904 * to be filled in
1905 */
1906struct ieee80211_tx_rate_control {
1907 struct ieee80211_hw *hw;
1908 struct ieee80211_supported_band *sband;
1909 struct ieee80211_bss_conf *bss_conf;
1910 struct sk_buff *skb;
1911 struct ieee80211_tx_rate reported_rate;
1912 bool rts, short_preamble;
1913 u8 max_rate_idx;
1817}; 1914};
1818 1915
1819struct rate_control_ops { 1916struct rate_control_ops {
1820 struct module *module; 1917 struct module *module;
1821 const char *name; 1918 const char *name;
1822 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 1919 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1823 void (*clear)(void *priv);
1824 void (*free)(void *priv); 1920 void (*free)(void *priv);
1825 1921
1826 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 1922 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
@@ -1832,10 +1928,8 @@ struct rate_control_ops {
1832 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, 1928 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1833 struct ieee80211_sta *sta, void *priv_sta, 1929 struct ieee80211_sta *sta, void *priv_sta,
1834 struct sk_buff *skb); 1930 struct sk_buff *skb);
1835 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, 1931 void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1836 struct ieee80211_sta *sta, void *priv_sta, 1932 struct ieee80211_tx_rate_control *txrc);
1837 struct sk_buff *skb,
1838 struct rate_selection *sel);
1839 1933
1840 void (*add_sta_debugfs)(void *priv, void *priv_sta, 1934 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1841 struct dentry *dir); 1935 struct dentry *dir);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 11dd0137c6a5..ce532f2222ce 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -108,6 +108,20 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
108 108
109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); 109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
110 110
111extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
112 const struct in6_addr *daddr,
113 const struct in6_addr *saddr,
114 struct icmp6hdr *icmp6h,
115 const struct in6_addr *target,
116 int llinfo);
117
118extern void ndisc_send_skb(struct sk_buff *skb,
119 struct net_device *dev,
120 struct neighbour *neigh,
121 const struct in6_addr *daddr,
122 const struct in6_addr *saddr,
123 struct icmp6hdr *icmp6h);
124
111 125
112 126
113/* 127/*
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index aa4b708654a4..d8d790e56d3d 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -180,9 +180,6 @@ struct neigh_table
180 __u32 hash_rnd; 180 __u32 hash_rnd;
181 unsigned int hash_chain_gc; 181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183#ifdef CONFIG_PROC_FS
184 struct proc_dir_entry *pde;
185#endif
186}; 183};
187 184
188/* flags for neigh_update() */ 185/* flags for neigh_update() */
@@ -223,11 +220,7 @@ extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *p
223static inline 220static inline
224struct net *neigh_parms_net(const struct neigh_parms *parms) 221struct net *neigh_parms_net(const struct neigh_parms *parms)
225{ 222{
226#ifdef CONFIG_NET_NS 223 return read_pnet(&parms->net);
227 return parms->net;
228#else
229 return &init_net;
230#endif
231} 224}
232 225
233extern unsigned long neigh_rand_reach_time(unsigned long base); 226extern unsigned long neigh_rand_reach_time(unsigned long base);
@@ -244,11 +237,7 @@ extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void
244static inline 237static inline
245struct net *pneigh_net(const struct pneigh_entry *pneigh) 238struct net *pneigh_net(const struct pneigh_entry *pneigh)
246{ 239{
247#ifdef CONFIG_NET_NS 240 return read_pnet(&pneigh->net);
248 return pneigh->net;
249#else
250 return &init_net;
251#endif
252} 241}
253 242
254extern void neigh_app_ns(struct neighbour *n); 243extern void neigh_app_ns(struct neighbour *n);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 700c53a3c6fa..6fc13d905c5f 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -19,6 +19,7 @@
19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
20#include <net/netns/conntrack.h> 20#include <net/netns/conntrack.h>
21#endif 21#endif
22#include <net/netns/xfrm.h>
22 23
23struct proc_dir_entry; 24struct proc_dir_entry;
24struct net_device; 25struct net_device;
@@ -74,6 +75,9 @@ struct net {
74 struct netns_ct ct; 75 struct netns_ct ct;
75#endif 76#endif
76#endif 77#endif
78#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm;
80#endif
77 struct net_generic *gen; 81 struct net_generic *gen;
78}; 82};
79 83
@@ -192,6 +196,24 @@ static inline void release_net(struct net *net)
192} 196}
193#endif 197#endif
194 198
199#ifdef CONFIG_NET_NS
200
201static inline void write_pnet(struct net **pnet, struct net *net)
202{
203 *pnet = net;
204}
205
206static inline struct net *read_pnet(struct net * const *pnet)
207{
208 return *pnet;
209}
210
211#else
212
213#define write_pnet(pnet, net) do { (void)(net);} while (0)
214#define read_pnet(pnet) (&init_net)
215
216#endif
195 217
196#define for_each_net(VAR) \ 218#define for_each_net(VAR) \
197 list_for_each_entry(VAR, &net_namespace_list, list) 219 list_for_each_entry(VAR, &net_namespace_list, list)
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b76a8685b5b5..2e0c53641cbe 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -199,7 +199,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
199 199
200extern void nf_conntrack_hash_insert(struct nf_conn *ct); 200extern void nf_conntrack_hash_insert(struct nf_conn *ct);
201 201
202extern void nf_conntrack_flush(struct net *net); 202extern void nf_conntrack_flush(struct net *net, u32 pid, int report);
203 203
204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
205 unsigned int nhoff, u_int16_t l3num, 205 unsigned int nhoff, u_int16_t l3num,
@@ -298,5 +298,8 @@ do { \
298 local_bh_enable(); \ 298 local_bh_enable(); \
299} while (0) 299} while (0)
300 300
301#define MODULE_ALIAS_NFCT_HELPER(helper) \
302 MODULE_ALIAS("nfct-helper-" helper)
303
301#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
302#endif /* _NF_CONNTRACK_H */ 305#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 1285ff26a014..0ff0dc69ca4a 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,6 +17,13 @@ struct nf_conntrack_ecache {
17 unsigned int events; 17 unsigned int events;
18}; 18};
19 19
20/* This structure is passed to event handler */
21struct nf_ct_event {
22 struct nf_conn *ct;
23 u32 pid;
24 int report;
25};
26
20extern struct atomic_notifier_head nf_conntrack_chain; 27extern struct atomic_notifier_head nf_conntrack_chain;
21extern int nf_conntrack_register_notifier(struct notifier_block *nb); 28extern int nf_conntrack_register_notifier(struct notifier_block *nb);
22extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); 29extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
@@ -39,22 +46,56 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
39 local_bh_enable(); 46 local_bh_enable();
40} 47}
41 48
42static inline void nf_conntrack_event(enum ip_conntrack_events event, 49static inline void
43 struct nf_conn *ct) 50nf_conntrack_event_report(enum ip_conntrack_events event,
51 struct nf_conn *ct,
52 u32 pid,
53 int report)
44{ 54{
55 struct nf_ct_event item = {
56 .ct = ct,
57 .pid = pid,
58 .report = report
59 };
45 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
46 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
47} 62}
48 63
64static inline void
65nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
66{
67 nf_conntrack_event_report(event, ct, 0, 0);
68}
69
70struct nf_exp_event {
71 struct nf_conntrack_expect *exp;
72 u32 pid;
73 int report;
74};
75
49extern struct atomic_notifier_head nf_ct_expect_chain; 76extern struct atomic_notifier_head nf_ct_expect_chain;
50extern int nf_ct_expect_register_notifier(struct notifier_block *nb); 77extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
51extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); 78extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
52 79
53static inline void 80static inline void
81nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
82 struct nf_conntrack_expect *exp,
83 u32 pid,
84 int report)
85{
86 struct nf_exp_event item = {
87 .exp = exp,
88 .pid = pid,
89 .report = report
90 };
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item);
92}
93
94static inline void
54nf_ct_expect_event(enum ip_conntrack_expect_events event, 95nf_ct_expect_event(enum ip_conntrack_expect_events event,
55 struct nf_conntrack_expect *exp) 96 struct nf_conntrack_expect *exp)
56{ 97{
57 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); 98 nf_ct_expect_event_report(event, exp, 0, 0);
58} 99}
59 100
60extern int nf_conntrack_ecache_init(struct net *net); 101extern int nf_conntrack_ecache_init(struct net *net);
@@ -66,9 +107,17 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
66 struct nf_conn *ct) {} 107 struct nf_conn *ct) {}
67static inline void nf_conntrack_event(enum ip_conntrack_events event, 108static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct) {} 109 struct nf_conn *ct) {}
110static inline void nf_conntrack_event_report(enum ip_conntrack_events event,
111 struct nf_conn *ct,
112 u32 pid,
113 int report) {}
69static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 114static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
70static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 115static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
71 struct nf_conntrack_expect *exp) {} 116 struct nf_conntrack_expect *exp) {}
117static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp,
119 u32 pid,
120 int report) {}
72static inline void nf_ct_event_cache_flush(struct net *net) {} 121static inline void nf_ct_event_cache_flush(struct net *net) {}
73 122
74static inline int nf_conntrack_ecache_init(struct net *net) 123static inline int nf_conntrack_ecache_init(struct net *net)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 37a7fc1164b0..ab17a159ac66 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -100,6 +100,8 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
100 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
101void nf_ct_expect_put(struct nf_conntrack_expect *exp); 101void nf_ct_expect_put(struct nf_conntrack_expect *exp);
102int nf_ct_expect_related(struct nf_conntrack_expect *expect); 102int nf_ct_expect_related(struct nf_conntrack_expect *expect);
103int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
104 u32 pid, int report);
103 105
104#endif /*_NF_CONNTRACK_EXPECT_H*/ 106#endif /*_NF_CONNTRACK_EXPECT_H*/
105 107
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f8060ab5a083..66d65a7caa39 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -39,9 +39,6 @@ struct nf_conntrack_helper
39}; 39};
40 40
41extern struct nf_conntrack_helper * 41extern struct nf_conntrack_helper *
42__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
43
44extern struct nf_conntrack_helper *
45__nf_conntrack_helper_find_byname(const char *name); 42__nf_conntrack_helper_find_byname(const char *name);
46 43
47extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 44extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
@@ -49,6 +46,8 @@ extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
49 46
50extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 47extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
51 48
49extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
50
52static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 51static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
53{ 52{
54 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 53 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 7f2f43c77284..debdaf75cecf 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -129,7 +129,7 @@ extern const struct nla_policy nf_ct_port_nla_policy[];
129 && net_ratelimit()) 129 && net_ratelimit())
130#endif 130#endif
131#else 131#else
132#define LOG_INVALID(net, proto) 0 132static inline int LOG_INVALID(struct net *net, int proto) { return 0; }
133#endif /* CONFIG_SYSCTL */ 133#endif /* CONFIG_SYSCTL */
134 134
135#endif /*_NF_CONNTRACK_PROTOCOL_H*/ 135#endif /*_NF_CONNTRACK_PROTOCOL_H*/
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index a6874ba22d54..f2f6aa73dc10 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -112,20 +112,20 @@ struct nf_conntrack_tuple_mask
112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) 112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
113{ 113{
114#ifdef DEBUG 114#ifdef DEBUG
115 printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n", 115 printk("tuple %p: %u %pI4:%hu -> %pI4:%hu\n",
116 t, t->dst.protonum, 116 t, t->dst.protonum,
117 NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all), 117 &t->src.u3.ip, ntohs(t->src.u.all),
118 NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all)); 118 &t->dst.u3.ip, ntohs(t->dst.u.all));
119#endif 119#endif
120} 120}
121 121
122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) 122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t)
123{ 123{
124#ifdef DEBUG 124#ifdef DEBUG
125 printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", 125 printk("tuple %p: %u %pI6 %hu -> %pI6 %hu\n",
126 t, t->dst.protonum, 126 t, t->dst.protonum,
127 NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all), 127 t->src.u3.all, ntohs(t->src.u.all),
128 NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all)); 128 t->dst.u3.all, ntohs(t->dst.u.all));
129#endif 129#endif
130} 130}
131 131
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
new file mode 100644
index 000000000000..b0569ff0775e
--- /dev/null
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -0,0 +1,14 @@
1#ifndef _KER_NFNETLINK_LOG_H
2#define _KER_NFNETLINK_LOG_H
3
4void
5nfulnl_log_packet(u_int8_t pf,
6 unsigned int hooknum,
7 const struct sk_buff *skb,
8 const struct net_device *in,
9 const struct net_device *out,
10 const struct nf_loginfo *li_user,
11 const char *prefix);
12
13#endif /* _KER_NFNETLINK_LOG_H */
14
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 3643bbb8e585..8a6150a3f4c7 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -233,7 +233,7 @@ extern int nla_parse(struct nlattr *tb[], int maxtype,
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 235 size_t dstsize);
236extern int nla_memcpy(void *dest, struct nlattr *src, int count); 236extern int nla_memcpy(void *dest, const struct nlattr *src, int count);
237extern int nla_memcmp(const struct nlattr *nla, const void *data, 237extern int nla_memcmp(const struct nlattr *nla, const void *data,
238 size_t size); 238 size_t size);
239extern int nla_strcmp(const struct nlattr *nla, const char *str); 239extern int nla_strcmp(const struct nlattr *nla, const char *str);
@@ -332,7 +332,7 @@ static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen)
332 */ 332 */
333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining) 333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
334{ 334{
335 return (remaining >= sizeof(struct nlmsghdr) && 335 return (remaining >= (int) sizeof(struct nlmsghdr) &&
336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) && 336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
337 nlh->nlmsg_len <= remaining); 337 nlh->nlmsg_len <= remaining);
338} 338}
@@ -741,7 +741,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
741 * See nla_parse() 741 * See nla_parse()
742 */ 742 */
743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
744 struct nlattr *nla, 744 const struct nlattr *nla,
745 const struct nla_policy *policy) 745 const struct nla_policy *policy)
746{ 746{
747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); 747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
@@ -875,7 +875,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
875 * nla_get_u32 - return payload of u32 attribute 875 * nla_get_u32 - return payload of u32 attribute
876 * @nla: u32 netlink attribute 876 * @nla: u32 netlink attribute
877 */ 877 */
878static inline u32 nla_get_u32(struct nlattr *nla) 878static inline u32 nla_get_u32(const struct nlattr *nla)
879{ 879{
880 return *(u32 *) nla_data(nla); 880 return *(u32 *) nla_data(nla);
881} 881}
@@ -884,7 +884,7 @@ static inline u32 nla_get_u32(struct nlattr *nla)
884 * nla_get_be32 - return payload of __be32 attribute 884 * nla_get_be32 - return payload of __be32 attribute
885 * @nla: __be32 netlink attribute 885 * @nla: __be32 netlink attribute
886 */ 886 */
887static inline __be32 nla_get_be32(struct nlattr *nla) 887static inline __be32 nla_get_be32(const struct nlattr *nla)
888{ 888{
889 return *(__be32 *) nla_data(nla); 889 return *(__be32 *) nla_data(nla);
890} 890}
@@ -893,7 +893,7 @@ static inline __be32 nla_get_be32(struct nlattr *nla)
893 * nla_get_u16 - return payload of u16 attribute 893 * nla_get_u16 - return payload of u16 attribute
894 * @nla: u16 netlink attribute 894 * @nla: u16 netlink attribute
895 */ 895 */
896static inline u16 nla_get_u16(struct nlattr *nla) 896static inline u16 nla_get_u16(const struct nlattr *nla)
897{ 897{
898 return *(u16 *) nla_data(nla); 898 return *(u16 *) nla_data(nla);
899} 899}
@@ -902,7 +902,7 @@ static inline u16 nla_get_u16(struct nlattr *nla)
902 * nla_get_be16 - return payload of __be16 attribute 902 * nla_get_be16 - return payload of __be16 attribute
903 * @nla: __be16 netlink attribute 903 * @nla: __be16 netlink attribute
904 */ 904 */
905static inline __be16 nla_get_be16(struct nlattr *nla) 905static inline __be16 nla_get_be16(const struct nlattr *nla)
906{ 906{
907 return *(__be16 *) nla_data(nla); 907 return *(__be16 *) nla_data(nla);
908} 908}
@@ -911,7 +911,7 @@ static inline __be16 nla_get_be16(struct nlattr *nla)
911 * nla_get_le16 - return payload of __le16 attribute 911 * nla_get_le16 - return payload of __le16 attribute
912 * @nla: __le16 netlink attribute 912 * @nla: __le16 netlink attribute
913 */ 913 */
914static inline __le16 nla_get_le16(struct nlattr *nla) 914static inline __le16 nla_get_le16(const struct nlattr *nla)
915{ 915{
916 return *(__le16 *) nla_data(nla); 916 return *(__le16 *) nla_data(nla);
917} 917}
@@ -920,7 +920,7 @@ static inline __le16 nla_get_le16(struct nlattr *nla)
920 * nla_get_u8 - return payload of u8 attribute 920 * nla_get_u8 - return payload of u8 attribute
921 * @nla: u8 netlink attribute 921 * @nla: u8 netlink attribute
922 */ 922 */
923static inline u8 nla_get_u8(struct nlattr *nla) 923static inline u8 nla_get_u8(const struct nlattr *nla)
924{ 924{
925 return *(u8 *) nla_data(nla); 925 return *(u8 *) nla_data(nla);
926} 926}
@@ -929,7 +929,7 @@ static inline u8 nla_get_u8(struct nlattr *nla)
929 * nla_get_u64 - return payload of u64 attribute 929 * nla_get_u64 - return payload of u64 attribute
930 * @nla: u64 netlink attribute 930 * @nla: u64 netlink attribute
931 */ 931 */
932static inline u64 nla_get_u64(struct nlattr *nla) 932static inline u64 nla_get_u64(const struct nlattr *nla)
933{ 933{
934 u64 tmp; 934 u64 tmp;
935 935
@@ -942,7 +942,7 @@ static inline u64 nla_get_u64(struct nlattr *nla)
942 * nla_get_flag - return payload of flag attribute 942 * nla_get_flag - return payload of flag attribute
943 * @nla: flag netlink attribute 943 * @nla: flag netlink attribute
944 */ 944 */
945static inline int nla_get_flag(struct nlattr *nla) 945static inline int nla_get_flag(const struct nlattr *nla)
946{ 946{
947 return !!nla; 947 return !!nla;
948} 948}
@@ -953,7 +953,7 @@ static inline int nla_get_flag(struct nlattr *nla)
953 * 953 *
954 * Returns the number of milliseconds in jiffies. 954 * Returns the number of milliseconds in jiffies.
955 */ 955 */
956static inline unsigned long nla_get_msecs(struct nlattr *nla) 956static inline unsigned long nla_get_msecs(const struct nlattr *nla)
957{ 957{
958 u64 msecs = nla_get_u64(nla); 958 u64 msecs = nla_get_u64(nla);
959 959
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ece1c926b5d1..977f482d97a9 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -49,6 +49,8 @@ struct netns_ipv4 {
49 int sysctl_icmp_ratelimit; 49 int sysctl_icmp_ratelimit;
50 int sysctl_icmp_ratemask; 50 int sysctl_icmp_ratemask;
51 int sysctl_icmp_errors_use_inbound_ifaddr; 51 int sysctl_icmp_errors_use_inbound_ifaddr;
52 int sysctl_rt_cache_rebuild_count;
53 int current_rt_cache_rebuild_count;
52 54
53 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
54 atomic_t rt_genid; 56 atomic_t rt_genid;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 2932721180c0..afab4e4cbac7 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -55,5 +55,17 @@ struct netns_ipv6 {
55 struct sock *ndisc_sk; 55 struct sock *ndisc_sk;
56 struct sock *tcp_sk; 56 struct sock *tcp_sk;
57 struct sock *igmp_sk; 57 struct sock *igmp_sk;
58#ifdef CONFIG_IPV6_MROUTE
59 struct sock *mroute6_sk;
60 struct mfc6_cache **mfc6_cache_array;
61 struct mif_device *vif6_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#ifdef CONFIG_IPV6_PIMSM_V2
67 int mroute_reg_vif_num;
68#endif
69#endif
58}; 70};
59#endif 71#endif
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 10cb7c336de5..0b44112e2366 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -20,6 +20,9 @@ struct netns_mib {
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
22#endif 22#endif
23#ifdef CONFIG_XFRM_STATISTICS
24 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics);
25#endif
23}; 26};
24 27
25#endif 28#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index b8093971ccb4..9554a644a8f8 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -4,7 +4,12 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6 6
7struct ebt_table;
8
7struct netns_xt { 9struct netns_xt {
8 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat;
9}; 14};
10#endif 15#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
new file mode 100644
index 000000000000..1ba912749caa
--- /dev/null
+++ b/include/net/netns/xfrm.h
@@ -0,0 +1,56 @@
1#ifndef __NETNS_XFRM_H
2#define __NETNS_XFRM_H
3
4#include <linux/list.h>
5#include <linux/wait.h>
6#include <linux/workqueue.h>
7#include <linux/xfrm.h>
8
9struct ctl_table_header;
10
11struct xfrm_policy_hash {
12 struct hlist_head *table;
13 unsigned int hmask;
14};
15
16struct netns_xfrm {
17 struct list_head state_all;
18 /*
19 * Hash table to find appropriate SA towards given target (endpoint of
20 * tunnel or destination of transport mode) allowed by selector.
21 *
22 * Main use is finding SA after policy selected tunnel or transport
23 * mode. Also, it can be used by ah/esp icmp error handler to find
24 * offending SA.
25 */
26 struct hlist_head *state_bydst;
27 struct hlist_head *state_bysrc;
28 struct hlist_head *state_byspi;
29 unsigned int state_hmask;
30 unsigned int state_num;
31 struct work_struct state_hash_work;
32 struct hlist_head state_gc_list;
33 struct work_struct state_gc_work;
34
35 wait_queue_head_t km_waitq;
36
37 struct list_head policy_all;
38 struct hlist_head *policy_byidx;
39 unsigned int policy_idx_hmask;
40 struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
41 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
42 unsigned int policy_count[XFRM_POLICY_MAX * 2];
43 struct work_struct policy_hash_work;
44
45 struct sock *nlsk;
46
47 u32 sysctl_aevent_etime;
48 u32 sysctl_aevent_rseqth;
49 int sysctl_larval_drop;
50 u32 sysctl_acq_expires;
51#ifdef CONFIG_SYSCTL
52 struct ctl_table_header *sysctl_hdr;
53#endif
54};
55
56#endif
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index fcd793030e4d..4c61cdce4e5f 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -35,12 +35,12 @@ struct pep_sock {
35 struct sock *listener; 35 struct sock *listener;
36 struct sk_buff_head ctrlreq_queue; 36 struct sk_buff_head ctrlreq_queue;
37#define PNPIPE_CTRLREQ_MAX 10 37#define PNPIPE_CTRLREQ_MAX 10
38 atomic_t tx_credits;
38 int ifindex; 39 int ifindex;
39 u16 peer_type; /* peer type/subtype */ 40 u16 peer_type; /* peer type/subtype */
40 u8 pipe_handle; 41 u8 pipe_handle;
41 42
42 u8 rx_credits; 43 u8 rx_credits;
43 u8 tx_credits;
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index c6a245184460..057b0a8a2885 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -46,7 +46,7 @@ static inline struct pn_sock *pn_sk(struct sock *sk)
46 46
47extern const struct proto_ops phonet_dgram_ops; 47extern const struct proto_ops phonet_dgram_ops;
48 48
49struct sock *pn_find_sock_by_sa(const struct sockaddr_pn *sa); 49struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
50void phonet_get_local_port_range(int *min, int *max); 50void phonet_get_local_port_range(int *min, int *max);
51void pn_sock_hash(struct sock *sk); 51void pn_sock_hash(struct sock *sk);
52void pn_sock_unhash(struct sock *sk); 52void pn_sock_unhash(struct sock *sk);
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index bbd2a836e04c..aa1c59a1d33f 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -43,7 +43,7 @@ struct net_device *phonet_device_get(struct net *net);
43int phonet_address_add(struct net_device *dev, u8 addr); 43int phonet_address_add(struct net_device *dev, u8 addr);
44int phonet_address_del(struct net_device *dev, u8 addr); 44int phonet_address_del(struct net_device *dev, u8 addr);
45u8 phonet_address_get(struct net_device *dev, u8 addr); 45u8 phonet_address_get(struct net_device *dev, u8 addr);
46int phonet_address_lookup(u8 addr); 46int phonet_address_lookup(struct net *net, u8 addr);
47 47
48#define PN_NO_ADDR 0xff 48#define PN_NO_ADDR 0xff
49 49
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index aa9e282db485..d1ca31444644 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -246,7 +246,7 @@ struct tcf_ematch_ops
246}; 246};
247 247
248extern int tcf_em_register(struct tcf_ematch_ops *); 248extern int tcf_em_register(struct tcf_ematch_ops *);
249extern int tcf_em_unregister(struct tcf_ematch_ops *); 249extern void tcf_em_unregister(struct tcf_ematch_ops *);
250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, 250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
251 struct tcf_ematch_tree *); 251 struct tcf_ematch_tree *);
252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); 252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 8d024d7cb741..cb2965aa1b62 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -39,6 +39,9 @@ struct net_protocol {
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 int features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb);
42 unsigned int no_policy:1, 45 unsigned int no_policy:1,
43 netns_ok:1; 46 netns_ok:1;
44}; 47};
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3fe49d808957..f8c47429044a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -53,7 +53,6 @@ struct Qdisc
53 atomic_t refcnt; 53 atomic_t refcnt;
54 unsigned long state; 54 unsigned long state;
55 struct sk_buff *gso_skb; 55 struct sk_buff *gso_skb;
56 struct sk_buff_head requeue;
57 struct sk_buff_head q; 56 struct sk_buff_head q;
58 struct netdev_queue *dev_queue; 57 struct netdev_queue *dev_queue;
59 struct Qdisc *next_sched; 58 struct Qdisc *next_sched;
@@ -111,7 +110,7 @@ struct Qdisc_ops
111 110
112 int (*enqueue)(struct sk_buff *, struct Qdisc *); 111 int (*enqueue)(struct sk_buff *, struct Qdisc *);
113 struct sk_buff * (*dequeue)(struct Qdisc *); 112 struct sk_buff * (*dequeue)(struct Qdisc *);
114 int (*requeue)(struct sk_buff *, struct Qdisc *); 113 struct sk_buff * (*peek)(struct Qdisc *);
115 unsigned int (*drop)(struct Qdisc *); 114 unsigned int (*drop)(struct Qdisc *);
116 115
117 int (*init)(struct Qdisc *, struct nlattr *arg); 116 int (*init)(struct Qdisc *, struct nlattr *arg);
@@ -432,19 +431,38 @@ static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch)
432 return __qdisc_dequeue_tail(sch, &sch->q); 431 return __qdisc_dequeue_tail(sch, &sch->q);
433} 432}
434 433
435static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, 434static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
436 struct sk_buff_head *list)
437{ 435{
438 __skb_queue_head(list, skb); 436 return skb_peek(&sch->q);
439 sch->qstats.backlog += qdisc_pkt_len(skb); 437}
440 sch->qstats.requeues++;
441 438
442 return NET_XMIT_SUCCESS; 439/* generic pseudo peek method for non-work-conserving qdisc */
440static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
441{
442 /* we can reuse ->gso_skb because peek isn't called for root qdiscs */
443 if (!sch->gso_skb) {
444 sch->gso_skb = sch->dequeue(sch);
445 if (sch->gso_skb)
446 /* it's still part of the queue */
447 sch->q.qlen++;
448 }
449
450 return sch->gso_skb;
443} 451}
444 452
445static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) 453/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */
454static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
446{ 455{
447 return __qdisc_requeue(skb, sch, &sch->q); 456 struct sk_buff *skb = sch->gso_skb;
457
458 if (skb) {
459 sch->gso_skb = NULL;
460 sch->q.qlen--;
461 } else {
462 skb = sch->dequeue(sch);
463 }
464
465 return skb;
448} 466}
449 467
450static inline void __qdisc_reset_queue(struct Qdisc *sch, 468static inline void __qdisc_reset_queue(struct Qdisc *sch,
diff --git a/include/net/scm.h b/include/net/scm.h
index 33e9986beb86..f45bb6eca7d4 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -55,8 +55,8 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
55 struct scm_cookie *scm) 55 struct scm_cookie *scm)
56{ 56{
57 struct task_struct *p = current; 57 struct task_struct *p = current;
58 scm->creds.uid = p->uid; 58 scm->creds.uid = current_uid();
59 scm->creds.gid = p->gid; 59 scm->creds.gid = current_gid();
60 scm->creds.pid = task_tgid_vnr(p); 60 scm->creds.pid = task_tgid_vnr(p);
61 scm->fp = NULL; 61 scm->fp = NULL;
62 scm->seq = 0; 62 scm->seq = 0;
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ed71b110edf7..bbb7742195b0 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -138,6 +138,7 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 138unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 139 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 140void sctp_sock_rfree(struct sk_buff *skb);
141extern struct percpu_counter sctp_sockets_allocated;
141 142
142/* 143/*
143 * sctp/primitive.c 144 * sctp/primitive.c
@@ -285,15 +286,15 @@ extern int sctp_debug_flag;
285 if (sctp_debug_flag) { \ 286 if (sctp_debug_flag) { \
286 if (saddr->sa.sa_family == AF_INET6) { \ 287 if (saddr->sa.sa_family == AF_INET6) { \
287 printk(KERN_DEBUG \ 288 printk(KERN_DEBUG \
288 lead NIP6_FMT trail, \ 289 lead "%pI6" trail, \
289 leadparm, \ 290 leadparm, \
290 NIP6(saddr->v6.sin6_addr), \ 291 &saddr->v6.sin6_addr, \
291 otherparms); \ 292 otherparms); \
292 } else { \ 293 } else { \
293 printk(KERN_DEBUG \ 294 printk(KERN_DEBUG \
294 lead NIPQUAD_FMT trail, \ 295 lead "%pI4" trail, \
295 leadparm, \ 296 leadparm, \
296 NIPQUAD(saddr->v4.sin_addr.s_addr), \ 297 &saddr->v4.sin_addr.s_addr, \
297 otherparms); \ 298 otherparms); \
298 } \ 299 } \
299 } 300 }
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f205b10f0ab9..b259fc5798fb 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -118,6 +118,8 @@ enum sctp_optname {
118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS 118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ 119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS 120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
121 SCTP_GET_ASSOC_NUMBER, /* Read only */
122#define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER
121 123
122 124
123 /* Internal Socket Options. Some of the sctp library functions are 125 /* Internal Socket Options. Some of the sctp library functions are
diff --git a/include/net/sock.h b/include/net/sock.h
index 2f47107f6d0f..5a3a151bd730 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -42,6 +42,7 @@
42 42
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/list.h> 44#include <linux/list.h>
45#include <linux/list_nulls.h>
45#include <linux/timer.h> 46#include <linux/timer.h>
46#include <linux/cache.h> 47#include <linux/cache.h>
47#include <linux/module.h> 48#include <linux/module.h>
@@ -52,6 +53,7 @@
52#include <linux/security.h> 53#include <linux/security.h>
53 54
54#include <linux/filter.h> 55#include <linux/filter.h>
56#include <linux/rculist_nulls.h>
55 57
56#include <asm/atomic.h> 58#include <asm/atomic.h>
57#include <net/dst.h> 59#include <net/dst.h>
@@ -106,6 +108,7 @@ struct net;
106 * @skc_reuse: %SO_REUSEADDR setting 108 * @skc_reuse: %SO_REUSEADDR setting
107 * @skc_bound_dev_if: bound device index if != 0 109 * @skc_bound_dev_if: bound device index if != 0
108 * @skc_node: main hash linkage for various protocol lookup tables 110 * @skc_node: main hash linkage for various protocol lookup tables
111 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
109 * @skc_bind_node: bind hash linkage for various protocol lookup tables 112 * @skc_bind_node: bind hash linkage for various protocol lookup tables
110 * @skc_refcnt: reference count 113 * @skc_refcnt: reference count
111 * @skc_hash: hash value used with various protocol lookup tables 114 * @skc_hash: hash value used with various protocol lookup tables
@@ -120,7 +123,10 @@ struct sock_common {
120 volatile unsigned char skc_state; 123 volatile unsigned char skc_state;
121 unsigned char skc_reuse; 124 unsigned char skc_reuse;
122 int skc_bound_dev_if; 125 int skc_bound_dev_if;
123 struct hlist_node skc_node; 126 union {
127 struct hlist_node skc_node;
128 struct hlist_nulls_node skc_nulls_node;
129 };
124 struct hlist_node skc_bind_node; 130 struct hlist_node skc_bind_node;
125 atomic_t skc_refcnt; 131 atomic_t skc_refcnt;
126 unsigned int skc_hash; 132 unsigned int skc_hash;
@@ -206,6 +212,7 @@ struct sock {
206#define sk_reuse __sk_common.skc_reuse 212#define sk_reuse __sk_common.skc_reuse
207#define sk_bound_dev_if __sk_common.skc_bound_dev_if 213#define sk_bound_dev_if __sk_common.skc_bound_dev_if
208#define sk_node __sk_common.skc_node 214#define sk_node __sk_common.skc_node
215#define sk_nulls_node __sk_common.skc_nulls_node
209#define sk_bind_node __sk_common.skc_bind_node 216#define sk_bind_node __sk_common.skc_bind_node
210#define sk_refcnt __sk_common.skc_refcnt 217#define sk_refcnt __sk_common.skc_refcnt
211#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
@@ -229,7 +236,9 @@ struct sock {
229 } sk_backlog; 236 } sk_backlog;
230 wait_queue_head_t *sk_sleep; 237 wait_queue_head_t *sk_sleep;
231 struct dst_entry *sk_dst_cache; 238 struct dst_entry *sk_dst_cache;
239#ifdef CONFIG_XFRM
232 struct xfrm_policy *sk_policy[2]; 240 struct xfrm_policy *sk_policy[2];
241#endif
233 rwlock_t sk_dst_lock; 242 rwlock_t sk_dst_lock;
234 atomic_t sk_rmem_alloc; 243 atomic_t sk_rmem_alloc;
235 atomic_t sk_wmem_alloc; 244 atomic_t sk_wmem_alloc;
@@ -237,7 +246,9 @@ struct sock {
237 int sk_sndbuf; 246 int sk_sndbuf;
238 struct sk_buff_head sk_receive_queue; 247 struct sk_buff_head sk_receive_queue;
239 struct sk_buff_head sk_write_queue; 248 struct sk_buff_head sk_write_queue;
249#ifdef CONFIG_NET_DMA
240 struct sk_buff_head sk_async_wait_queue; 250 struct sk_buff_head sk_async_wait_queue;
251#endif
241 int sk_wmem_queued; 252 int sk_wmem_queued;
242 int sk_forward_alloc; 253 int sk_forward_alloc;
243 gfp_t sk_allocation; 254 gfp_t sk_allocation;
@@ -269,7 +280,9 @@ struct sock {
269 struct sk_buff *sk_send_head; 280 struct sk_buff *sk_send_head;
270 __u32 sk_sndmsg_off; 281 __u32 sk_sndmsg_off;
271 int sk_write_pending; 282 int sk_write_pending;
283#ifdef CONFIG_SECURITY
272 void *sk_security; 284 void *sk_security;
285#endif
273 __u32 sk_mark; 286 __u32 sk_mark;
274 /* XXX 4 bytes hole on 64 bit */ 287 /* XXX 4 bytes hole on 64 bit */
275 void (*sk_state_change)(struct sock *sk); 288 void (*sk_state_change)(struct sock *sk);
@@ -294,12 +307,30 @@ static inline struct sock *sk_head(const struct hlist_head *head)
294 return hlist_empty(head) ? NULL : __sk_head(head); 307 return hlist_empty(head) ? NULL : __sk_head(head);
295} 308}
296 309
310static inline struct sock *__sk_nulls_head(const struct hlist_nulls_head *head)
311{
312 return hlist_nulls_entry(head->first, struct sock, sk_nulls_node);
313}
314
315static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
316{
317 return hlist_nulls_empty(head) ? NULL : __sk_nulls_head(head);
318}
319
297static inline struct sock *sk_next(const struct sock *sk) 320static inline struct sock *sk_next(const struct sock *sk)
298{ 321{
299 return sk->sk_node.next ? 322 return sk->sk_node.next ?
300 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL; 323 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
301} 324}
302 325
326static inline struct sock *sk_nulls_next(const struct sock *sk)
327{
328 return (!is_a_nulls(sk->sk_nulls_node.next)) ?
329 hlist_nulls_entry(sk->sk_nulls_node.next,
330 struct sock, sk_nulls_node) :
331 NULL;
332}
333
303static inline int sk_unhashed(const struct sock *sk) 334static inline int sk_unhashed(const struct sock *sk)
304{ 335{
305 return hlist_unhashed(&sk->sk_node); 336 return hlist_unhashed(&sk->sk_node);
@@ -315,6 +346,11 @@ static __inline__ void sk_node_init(struct hlist_node *node)
315 node->pprev = NULL; 346 node->pprev = NULL;
316} 347}
317 348
349static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node)
350{
351 node->pprev = NULL;
352}
353
318static __inline__ void __sk_del_node(struct sock *sk) 354static __inline__ void __sk_del_node(struct sock *sk)
319{ 355{
320 __hlist_del(&sk->sk_node); 356 __hlist_del(&sk->sk_node);
@@ -361,6 +397,27 @@ static __inline__ int sk_del_node_init(struct sock *sk)
361 return rc; 397 return rc;
362} 398}
363 399
400static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
401{
402 if (sk_hashed(sk)) {
403 hlist_nulls_del_init_rcu(&sk->sk_nulls_node);
404 return 1;
405 }
406 return 0;
407}
408
409static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk)
410{
411 int rc = __sk_nulls_del_node_init_rcu(sk);
412
413 if (rc) {
414 /* paranoid for a while -acme */
415 WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
416 __sock_put(sk);
417 }
418 return rc;
419}
420
364static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 421static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list)
365{ 422{
366 hlist_add_head(&sk->sk_node, list); 423 hlist_add_head(&sk->sk_node, list);
@@ -372,6 +429,17 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
372 __sk_add_node(sk, list); 429 __sk_add_node(sk, list);
373} 430}
374 431
432static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
433{
434 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
435}
436
437static __inline__ void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
438{
439 sock_hold(sk);
440 __sk_nulls_add_node_rcu(sk, list);
441}
442
375static __inline__ void __sk_del_bind_node(struct sock *sk) 443static __inline__ void __sk_del_bind_node(struct sock *sk)
376{ 444{
377 __hlist_del(&sk->sk_bind_node); 445 __hlist_del(&sk->sk_bind_node);
@@ -385,9 +453,16 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
385 453
386#define sk_for_each(__sk, node, list) \ 454#define sk_for_each(__sk, node, list) \
387 hlist_for_each_entry(__sk, node, list, sk_node) 455 hlist_for_each_entry(__sk, node, list, sk_node)
456#define sk_nulls_for_each(__sk, node, list) \
457 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
458#define sk_nulls_for_each_rcu(__sk, node, list) \
459 hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)
388#define sk_for_each_from(__sk, node) \ 460#define sk_for_each_from(__sk, node) \
389 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 461 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
390 hlist_for_each_entry_from(__sk, node, sk_node) 462 hlist_for_each_entry_from(__sk, node, sk_node)
463#define sk_nulls_for_each_from(__sk, node) \
464 if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
465 hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)
391#define sk_for_each_continue(__sk, node) \ 466#define sk_for_each_continue(__sk, node) \
392 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 467 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
393 hlist_for_each_entry_continue(__sk, node, sk_node) 468 hlist_for_each_entry_continue(__sk, node, sk_node)
@@ -574,7 +649,7 @@ struct proto {
574 /* Memory pressure */ 649 /* Memory pressure */
575 void (*enter_memory_pressure)(struct sock *sk); 650 void (*enter_memory_pressure)(struct sock *sk);
576 atomic_t *memory_allocated; /* Current allocated memory. */ 651 atomic_t *memory_allocated; /* Current allocated memory. */
577 atomic_t *sockets_allocated; /* Current number of sockets. */ 652 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
578 /* 653 /*
579 * Pressure flag: try to collapse. 654 * Pressure flag: try to collapse.
580 * Technical note: it is used by multiple contexts non atomically. 655 * Technical note: it is used by multiple contexts non atomically.
@@ -587,17 +662,18 @@ struct proto {
587 int *sysctl_rmem; 662 int *sysctl_rmem;
588 int max_header; 663 int max_header;
589 664
590 struct kmem_cache *slab; 665 struct kmem_cache *slab;
591 unsigned int obj_size; 666 unsigned int obj_size;
667 int slab_flags;
592 668
593 atomic_t *orphan_count; 669 struct percpu_counter *orphan_count;
594 670
595 struct request_sock_ops *rsk_prot; 671 struct request_sock_ops *rsk_prot;
596 struct timewait_sock_ops *twsk_prot; 672 struct timewait_sock_ops *twsk_prot;
597 673
598 union { 674 union {
599 struct inet_hashinfo *hashinfo; 675 struct inet_hashinfo *hashinfo;
600 struct hlist_head *udp_hash; 676 struct udp_table *udp_table;
601 struct raw_hashinfo *raw_hash; 677 struct raw_hashinfo *raw_hash;
602 } h; 678 } h;
603 679
diff --git a/include/net/syncppp.h b/include/net/syncppp.h
deleted file mode 100644
index 9e306f7f579a..000000000000
--- a/include/net/syncppp.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Defines for synchronous PPP/Cisco link level subroutines.
3 *
4 * Copyright (C) 1994 Cronyx Ltd.
5 * Author: Serge Vakulenko, <vak@zebub.msk.su>
6 *
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * Authors grant any other persons or organizations permission to use
11 * or modify this software as long as this message is kept with the software,
12 * all derivative works or modified versions.
13 *
14 * Version 1.7, Wed Jun 7 22:12:02 MSD 1995
15 *
16 *
17 *
18 */
19
20#ifndef _SYNCPPP_H_
21#define _SYNCPPP_H_ 1
22
23#ifdef __KERNEL__
24struct slcp {
25 u16 state; /* state machine */
26 u32 magic; /* local magic number */
27 u_char echoid; /* id of last keepalive echo request */
28 u_char confid; /* id of last configuration request */
29};
30
31struct sipcp {
32 u16 state; /* state machine */
33 u_char confid; /* id of last configuration request */
34};
35
36struct sppp
37{
38 struct sppp * pp_next; /* next interface in keepalive list */
39 u32 pp_flags; /* use Cisco protocol instead of PPP */
40 u16 pp_alivecnt; /* keepalive packets counter */
41 u16 pp_loopcnt; /* loopback detection counter */
42 u32 pp_seq; /* local sequence number */
43 u32 pp_rseq; /* remote sequence number */
44 struct slcp lcp; /* LCP params */
45 struct sipcp ipcp; /* IPCP params */
46 struct timer_list pp_timer;
47 struct net_device *pp_if;
48 char pp_link_state; /* Link status */
49 spinlock_t lock;
50};
51
52struct ppp_device
53{
54 struct net_device *dev; /* Network device pointer */
55 struct sppp sppp; /* Synchronous PPP */
56};
57
58static inline struct sppp *sppp_of(struct net_device *dev)
59{
60 struct ppp_device **ppp = dev->ml_priv;
61 BUG_ON((*ppp)->dev != dev);
62 return &(*ppp)->sppp;
63}
64
65#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
66#define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
67#define PP_TIMO 0x04 /* cp_timeout routine active */
68#define PP_DEBUG 0x08
69
70#define PPP_MTU 1500 /* max. transmit unit */
71
72#define LCP_STATE_CLOSED 0 /* LCP state: closed (conf-req sent) */
73#define LCP_STATE_ACK_RCVD 1 /* LCP state: conf-ack received */
74#define LCP_STATE_ACK_SENT 2 /* LCP state: conf-ack sent */
75#define LCP_STATE_OPENED 3 /* LCP state: opened */
76
77#define IPCP_STATE_CLOSED 0 /* IPCP state: closed (conf-req sent) */
78#define IPCP_STATE_ACK_RCVD 1 /* IPCP state: conf-ack received */
79#define IPCP_STATE_ACK_SENT 2 /* IPCP state: conf-ack sent */
80#define IPCP_STATE_OPENED 3 /* IPCP state: opened */
81
82#define SPPP_LINK_DOWN 0 /* link down - no keepalive */
83#define SPPP_LINK_UP 1 /* link is up - keepalive ok */
84
85void sppp_attach (struct ppp_device *pd);
86void sppp_detach (struct net_device *dev);
87int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
88struct sk_buff *sppp_dequeue (struct net_device *dev);
89int sppp_isempty (struct net_device *dev);
90void sppp_flush (struct net_device *dev);
91int sppp_open (struct net_device *dev);
92int sppp_reopen (struct net_device *dev);
93int sppp_close (struct net_device *dev);
94#endif
95
96#define SPPPIOCCISCO (SIOCDEVPRIVATE)
97#define SPPPIOCPPP (SIOCDEVPRIVATE+1)
98#define SPPPIOCDEBUG (SIOCDEVPRIVATE+2)
99#define SPPPIOCSFLAGS (SIOCDEVPRIVATE+3)
100#define SPPPIOCGFLAGS (SIOCDEVPRIVATE+4)
101
102#endif /* _SYNCPPP_H_ */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 438014d57610..218235de8963 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -46,7 +46,7 @@
46 46
47extern struct inet_hashinfo tcp_hashinfo; 47extern struct inet_hashinfo tcp_hashinfo;
48 48
49extern atomic_t tcp_orphan_count; 49extern struct percpu_counter tcp_orphan_count;
50extern void tcp_time_wait(struct sock *sk, int state, int timeo); 50extern void tcp_time_wait(struct sock *sk, int state, int timeo);
51 51
52#define MAX_TCP_HEADER (128 + MAX_HEADER) 52#define MAX_TCP_HEADER (128 + MAX_HEADER)
@@ -238,7 +238,7 @@ extern int sysctl_tcp_slow_start_after_idle;
238extern int sysctl_tcp_max_ssthresh; 238extern int sysctl_tcp_max_ssthresh;
239 239
240extern atomic_t tcp_memory_allocated; 240extern atomic_t tcp_memory_allocated;
241extern atomic_t tcp_sockets_allocated; 241extern struct percpu_counter tcp_sockets_allocated;
242extern int tcp_memory_pressure; 242extern int tcp_memory_pressure;
243 243
244/* 244/*
@@ -472,8 +472,6 @@ extern void tcp_send_delayed_ack(struct sock *sk);
472 472
473/* tcp_input.c */ 473/* tcp_input.c */
474extern void tcp_cwnd_application_limited(struct sock *sk); 474extern void tcp_cwnd_application_limited(struct sock *sk);
475extern void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp,
476 struct sk_buff *skb);
477 475
478/* tcp_timer.c */ 476/* tcp_timer.c */
479extern void tcp_init_xmit_timers(struct sock *); 477extern void tcp_init_xmit_timers(struct sock *);
@@ -590,7 +588,6 @@ struct tcp_skb_cb {
590#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 588#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
591#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 589#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
592 590
593 __u16 urg_ptr; /* Valid w/URG flags is set. */
594 __u32 ack_seq; /* Sequence number ACK'd */ 591 __u32 ack_seq; /* Sequence number ACK'd */
595}; 592};
596 593
@@ -764,8 +761,6 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
764 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 761 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
765} 762}
766 763
767extern int tcp_limit_reno_sacked(struct tcp_sock *tp);
768
769/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 764/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
770 * The exception is rate halving phase, when cwnd is decreasing towards 765 * The exception is rate halving phase, when cwnd is decreasing towards
771 * ssthresh. 766 * ssthresh.
@@ -1195,6 +1190,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu
1195 return skb_queue_next(&sk->sk_write_queue, skb); 1190 return skb_queue_next(&sk->sk_write_queue, skb);
1196} 1191}
1197 1192
1193static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_buff *skb)
1194{
1195 return skb_queue_prev(&sk->sk_write_queue, skb);
1196}
1197
1198#define tcp_for_write_queue(skb, sk) \ 1198#define tcp_for_write_queue(skb, sk) \
1199 skb_queue_walk(&(sk)->sk_write_queue, skb) 1199 skb_queue_walk(&(sk)->sk_write_queue, skb)
1200 1200
@@ -1358,6 +1358,12 @@ extern void tcp_v4_destroy_sock(struct sock *sk);
1358 1358
1359extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1359extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
1361extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1362 struct sk_buff *skb);
1363extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1364 struct sk_buff *skb);
1365extern int tcp_gro_complete(struct sk_buff *skb);
1366extern int tcp4_gro_complete(struct sk_buff *skb);
1361 1367
1362#ifdef CONFIG_PROC_FS 1368#ifdef CONFIG_PROC_FS
1363extern int tcp4_proc_init(void); 1369extern int tcp4_proc_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index 1e205095ea68..90e6ce56be65 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -50,8 +50,15 @@ struct udp_skb_cb {
50}; 50};
51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb)) 51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb))
52 52
53extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 53struct udp_hslot {
54extern rwlock_t udp_hash_lock; 54 struct hlist_nulls_head head;
55 spinlock_t lock;
56} __attribute__((aligned(2 * sizeof(long))));
57struct udp_table {
58 struct udp_hslot hash[UDP_HTABLE_SIZE];
59};
60extern struct udp_table udp_table;
61extern void udp_table_init(struct udp_table *);
55 62
56 63
57/* Note: this must match 'valbool' in sock_setsockopt */ 64/* Note: this must match 'valbool' in sock_setsockopt */
@@ -110,15 +117,7 @@ static inline void udp_lib_hash(struct sock *sk)
110 BUG(); 117 BUG();
111} 118}
112 119
113static inline void udp_lib_unhash(struct sock *sk) 120extern void udp_lib_unhash(struct sock *sk);
114{
115 write_lock_bh(&udp_hash_lock);
116 if (sk_del_node_init(sk)) {
117 inet_sk(sk)->num = 0;
118 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
119 }
120 write_unlock_bh(&udp_hash_lock);
121}
122 121
123static inline void udp_lib_close(struct sock *sk, long timeout) 122static inline void udp_lib_close(struct sock *sk, long timeout)
124{ 123{
@@ -187,7 +186,7 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
187struct udp_seq_afinfo { 186struct udp_seq_afinfo {
188 char *name; 187 char *name;
189 sa_family_t family; 188 sa_family_t family;
190 struct hlist_head *hashtable; 189 struct udp_table *udp_table;
191 struct file_operations seq_fops; 190 struct file_operations seq_fops;
192 struct seq_operations seq_ops; 191 struct seq_operations seq_ops;
193}; 192};
@@ -196,7 +195,7 @@ struct udp_iter_state {
196 struct seq_net_private p; 195 struct seq_net_private p;
197 sa_family_t family; 196 sa_family_t family;
198 int bucket; 197 int bucket;
199 struct hlist_head *hashtable; 198 struct udp_table *udp_table;
200}; 199};
201 200
202#ifdef CONFIG_PROC_FS 201#ifdef CONFIG_PROC_FS
diff --git a/include/net/udplite.h b/include/net/udplite.h
index b76b2e377af4..afdffe607b24 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -11,7 +11,7 @@
11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ 11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
12 12
13extern struct proto udplite_prot; 13extern struct proto udplite_prot;
14extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; 14extern struct udp_table udplite_table;
15 15
16/* 16/*
17 * Checksum computation is all in software, hence simpler getfrag. 17 * Checksum computation is all in software, hence simpler getfrag.
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 721efb363db7..21c5d966142d 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -10,6 +10,7 @@
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/ieee80211.h>
13#include <net/cfg80211.h> 14#include <net/cfg80211.h>
14 15
15/** 16/**
@@ -133,23 +134,23 @@ struct ieee80211_rate {
133}; 134};
134 135
135/** 136/**
136 * struct ieee80211_ht_info - describing STA's HT capabilities 137 * struct ieee80211_sta_ht_cap - STA's HT capabilities
137 * 138 *
138 * This structure describes most essential parameters needed 139 * This structure describes most essential parameters needed
139 * to describe 802.11n HT capabilities for an STA. 140 * to describe 802.11n HT capabilities for an STA.
140 * 141 *
141 * @ht_supported: is HT supported by STA, 0: no, 1: yes 142 * @ht_supported: is HT supported by the STA
142 * @cap: HT capabilities map as described in 802.11n spec 143 * @cap: HT capabilities map as described in 802.11n spec
143 * @ampdu_factor: Maximum A-MPDU length factor 144 * @ampdu_factor: Maximum A-MPDU length factor
144 * @ampdu_density: Minimum A-MPDU spacing 145 * @ampdu_density: Minimum A-MPDU spacing
145 * @supp_mcs_set: Supported MCS set as described in 802.11n spec 146 * @mcs: Supported MCS rates
146 */ 147 */
147struct ieee80211_ht_info { 148struct ieee80211_sta_ht_cap {
148 u16 cap; /* use IEEE80211_HT_CAP_ */ 149 u16 cap; /* use IEEE80211_HT_CAP_ */
149 u8 ht_supported; 150 bool ht_supported;
150 u8 ampdu_factor; 151 u8 ampdu_factor;
151 u8 ampdu_density; 152 u8 ampdu_density;
152 u8 supp_mcs_set[16]; 153 struct ieee80211_mcs_info mcs;
153}; 154};
154 155
155/** 156/**
@@ -173,13 +174,18 @@ struct ieee80211_supported_band {
173 enum ieee80211_band band; 174 enum ieee80211_band band;
174 int n_channels; 175 int n_channels;
175 int n_bitrates; 176 int n_bitrates;
176 struct ieee80211_ht_info ht_info; 177 struct ieee80211_sta_ht_cap ht_cap;
177}; 178};
178 179
179/** 180/**
180 * struct wiphy - wireless hardware description 181 * struct wiphy - wireless hardware description
181 * @idx: the wiphy index assigned to this item 182 * @idx: the wiphy index assigned to this item
182 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device
185 * has its own regulatory solution and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE).
183 * @reg_notifier: the driver's regulatory notification callback 189 * @reg_notifier: the driver's regulatory notification callback
184 */ 190 */
185struct wiphy { 191struct wiphy {
@@ -191,6 +197,8 @@ struct wiphy {
191 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
192 u16 interface_modes; 198 u16 interface_modes;
193 199
200 bool fw_handles_regulatory;
201
194 /* If multiple wiphys are registered and you're handed e.g. 202 /* If multiple wiphys are registered and you're handed e.g.
195 * a regular netdev with assigned ieee80211_ptr, you won't 203 * a regular netdev with assigned ieee80211_ptr, you won't
196 * know whether it points to a wiphy your driver has registered 204 * know whether it points to a wiphy your driver has registered
@@ -262,9 +270,9 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
262/** 270/**
263 * wiphy_name - get wiphy name 271 * wiphy_name - get wiphy name
264 */ 272 */
265static inline char *wiphy_name(struct wiphy *wiphy) 273static inline const char *wiphy_name(struct wiphy *wiphy)
266{ 274{
267 return wiphy->dev.bus_id; 275 return dev_name(&wiphy->dev);
268} 276}
269 277
270/** 278/**
@@ -340,55 +348,51 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
340} 348}
341 349
342/** 350/**
343 * __regulatory_hint - hint to the wireless core a regulatory domain 351 * ieee80211_get_response_rate - get basic rate for a given rate
344 * @wiphy: if a driver is providing the hint this is the driver's very
345 * own &struct wiphy
346 * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
347 * should be in. If @rd is set this should be NULL
348 * @rd: a complete regulatory domain, if passed the caller need not worry
349 * about freeing it
350 *
351 * The Wireless subsystem can use this function to hint to the wireless core
352 * what it believes should be the current regulatory domain by
353 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
354 * domain should be in or by providing a completely build regulatory domain.
355 * 352 *
356 * Returns -EALREADY if *a regulatory domain* has already been set. Note that 353 * @sband: the band to look for rates in
357 * this could be by another driver. It is safe for drivers to continue if 354 * @basic_rates: bitmap of basic rates
358 * -EALREADY is returned, if drivers are not capable of world roaming they 355 * @bitrate: the bitrate for which to find the basic rate
359 * should not register more channels than they support. Right now we only
360 * support listening to the first driver hint. If the driver is capable
361 * of world roaming but wants to respect its own EEPROM mappings for
362 * specific regulatory domains it should register the @reg_notifier callback
363 * on the &struct wiphy. Returns 0 if the hint went through fine or through an
364 * intersection operation. Otherwise a standard error code is returned.
365 * 356 *
357 * This function returns the basic rate corresponding to a given
358 * bitrate, that is the next lower bitrate contained in the basic
359 * rate map, which is, for this function, given as a bitmap of
360 * indices of rates in the band's bitrate table.
366 */ 361 */
367extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, 362struct ieee80211_rate *
368 const char *alpha2, struct ieee80211_regdomain *rd); 363ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate);
365
369/** 366/**
370 * regulatory_hint - driver hint to the wireless core a regulatory domain 367 * regulatory_hint - driver hint to the wireless core a regulatory domain
371 * @wiphy: the driver's very own &struct wiphy 368 * @wiphy: the wireless device giving the hint (used only for reporting
369 * conflicts)
372 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 370 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
373 * should be in. If @rd is set this should be NULL. Note that if you 371 * should be in. If @rd is set this should be NULL. Note that if you
374 * set this to NULL you should still set rd->alpha2 to some accepted 372 * set this to NULL you should still set rd->alpha2 to some accepted
375 * alpha2. 373 * alpha2.
376 * @rd: a complete regulatory domain provided by the driver. If passed
377 * the driver does not need to worry about freeing it.
378 * 374 *
379 * Wireless drivers can use this function to hint to the wireless core 375 * Wireless drivers can use this function to hint to the wireless core
380 * what it believes should be the current regulatory domain by 376 * what it believes should be the current regulatory domain by
381 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 377 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
382 * domain should be in or by providing a completely build regulatory domain. 378 * domain should be in or by providing a completely build regulatory domain.
383 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
384 * for a regulatory domain structure for the respective country. If 380 * for a regulatory domain structure for the respective country.
385 * a regulatory domain is build and passed you should set the alpha2 381 */
386 * if possible, otherwise set it to the special value of "99" which tells 382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
387 * the wireless core it is unknown. If you pass a built regulatory domain 383
388 * and we return non zero you are in charge of kfree()'ing the structure. 384/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain
386 * @wiphy: the wireless device giving the hint (used only for reporting
387 * conflicts)
388 * @country_ie: pointer to the country IE
389 * @country_ie_len: length of the country IE
389 * 390 *
390 * See __regulatory_hint() documentation for possible return values. 391 * We will intersect the rd with the what CRDA tells us should apply
392 * for the alpha2 this country IE belongs to, this prevents APs from
393 * sending us incorrect or outdated information against a country.
391 */ 394 */
392extern int regulatory_hint(struct wiphy *wiphy, 395extern void regulatory_hint_11d(struct wiphy *wiphy,
393 const char *alpha2, struct ieee80211_regdomain *rd); 396 u8 *country_ie,
397 u8 country_ie_len);
394#endif /* __NET_WIRELESS_H */ 398#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 11c890ad8ebb..2e9f5c0018ae 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -38,22 +38,15 @@
38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) 38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto))
39 39
40#ifdef CONFIG_XFRM_STATISTICS 40#ifdef CONFIG_XFRM_STATISTICS
41DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); 41#define XFRM_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.xfrm_statistics, field)
42#define XFRM_INC_STATS(field) SNMP_INC_STATS(xfrm_statistics, field) 42#define XFRM_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.xfrm_statistics, field)
43#define XFRM_INC_STATS_BH(field) SNMP_INC_STATS_BH(xfrm_statistics, field) 43#define XFRM_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)-mib.xfrm_statistics, field)
44#define XFRM_INC_STATS_USER(field) SNMP_INC_STATS_USER(xfrm_statistics, field)
45#else 44#else
46#define XFRM_INC_STATS(field) 45#define XFRM_INC_STATS(net, field) ((void)(net))
47#define XFRM_INC_STATS_BH(field) 46#define XFRM_INC_STATS_BH(net, field) ((void)(net))
48#define XFRM_INC_STATS_USER(field) 47#define XFRM_INC_STATS_USER(net, field) ((void)(net))
49#endif 48#endif
50 49
51extern struct sock *xfrm_nl;
52extern u32 sysctl_xfrm_aevent_etime;
53extern u32 sysctl_xfrm_aevent_rseqth;
54extern int sysctl_xfrm_larval_drop;
55extern u32 sysctl_xfrm_acq_expires;
56
57extern struct mutex xfrm_cfg_mutex; 50extern struct mutex xfrm_cfg_mutex;
58 51
59/* Organization of SPD aka "XFRM rules" 52/* Organization of SPD aka "XFRM rules"
@@ -130,6 +123,9 @@ struct xfrm_state_walk {
130/* Full description of state of transformer. */ 123/* Full description of state of transformer. */
131struct xfrm_state 124struct xfrm_state
132{ 125{
126#ifdef CONFIG_NET_NS
127 struct net *xs_net;
128#endif
133 union { 129 union {
134 struct hlist_node gclist; 130 struct hlist_node gclist;
135 struct hlist_node bydst; 131 struct hlist_node bydst;
@@ -223,6 +219,11 @@ struct xfrm_state
223 void *data; 219 void *data;
224}; 220};
225 221
222static inline struct net *xs_net(struct xfrm_state *x)
223{
224 return read_pnet(&x->xs_net);
225}
226
226/* xflags - make enum if more show up */ 227/* xflags - make enum if more show up */
227#define XFRM_TIME_DEFER 1 228#define XFRM_TIME_DEFER 1
228 229
@@ -249,6 +250,7 @@ struct km_event
249 u32 seq; 250 u32 seq;
250 u32 pid; 251 u32 pid;
251 u32 event; 252 u32 event;
253 struct net *net;
252}; 254};
253 255
254struct net_device; 256struct net_device;
@@ -257,10 +259,11 @@ struct xfrm_dst;
257struct xfrm_policy_afinfo { 259struct xfrm_policy_afinfo {
258 unsigned short family; 260 unsigned short family;
259 struct dst_ops *dst_ops; 261 struct dst_ops *dst_ops;
260 void (*garbage_collect)(void); 262 void (*garbage_collect)(struct net *net);
261 struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, 263 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
264 xfrm_address_t *saddr,
262 xfrm_address_t *daddr); 265 xfrm_address_t *daddr);
263 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); 266 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
264 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); 267 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
265 void (*decode_session)(struct sk_buff *skb, 268 void (*decode_session)(struct sk_buff *skb,
266 struct flowi *fl, 269 struct flowi *fl,
@@ -467,7 +470,9 @@ struct xfrm_policy_walk {
467 470
468struct xfrm_policy 471struct xfrm_policy
469{ 472{
470 struct xfrm_policy *next; 473#ifdef CONFIG_NET_NS
474 struct net *xp_net;
475#endif
471 struct hlist_node bydst; 476 struct hlist_node bydst;
472 struct hlist_node byidx; 477 struct hlist_node byidx;
473 478
@@ -492,6 +497,11 @@ struct xfrm_policy
492 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 497 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
493}; 498};
494 499
500static inline struct net *xp_net(struct xfrm_policy *xp)
501{
502 return read_pnet(&xp->xp_net);
503}
504
495struct xfrm_kmaddress { 505struct xfrm_kmaddress {
496 xfrm_address_t local; 506 xfrm_address_t local;
497 xfrm_address_t remote; 507 xfrm_address_t remote;
@@ -537,15 +547,13 @@ struct xfrm_mgr
537 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 547 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
538 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 548 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
539 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 549 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
540 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 550 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
541 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); 551 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
542}; 552};
543 553
544extern int xfrm_register_km(struct xfrm_mgr *km); 554extern int xfrm_register_km(struct xfrm_mgr *km);
545extern int xfrm_unregister_km(struct xfrm_mgr *km); 555extern int xfrm_unregister_km(struct xfrm_mgr *km);
546 556
547extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
548
549/* 557/*
550 * This structure is used for the duration where packets are being 558 * This structure is used for the duration where packets are being
551 * transformed by IPsec. As soon as the packet leaves IPsec the 559 * transformed by IPsec. As soon as the packet leaves IPsec the
@@ -882,6 +890,7 @@ struct xfrm_dst
882 u32 path_cookie; 890 u32 path_cookie;
883}; 891};
884 892
893#ifdef CONFIG_XFRM
885static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 894static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
886{ 895{
887 dst_release(xdst->route); 896 dst_release(xdst->route);
@@ -894,6 +903,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
894 xdst->partner = NULL; 903 xdst->partner = NULL;
895#endif 904#endif
896} 905}
906#endif
897 907
898extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 908extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
899 909
@@ -977,12 +987,13 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,
977 struct sk_buff *skb, 987 struct sk_buff *skb,
978 unsigned int family, int reverse) 988 unsigned int family, int reverse)
979{ 989{
990 struct net *net = dev_net(skb->dev);
980 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0); 991 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0);
981 992
982 if (sk && sk->sk_policy[XFRM_POLICY_IN]) 993 if (sk && sk->sk_policy[XFRM_POLICY_IN])
983 return __xfrm_policy_check(sk, ndir, skb, family); 994 return __xfrm_policy_check(sk, ndir, skb, family);
984 995
985 return (!xfrm_policy_count[dir] && !skb->sp) || 996 return (!net->xfrm.policy_count[dir] && !skb->sp) ||
986 (skb->dst->flags & DST_NOPOLICY) || 997 (skb->dst->flags & DST_NOPOLICY) ||
987 __xfrm_policy_check(sk, ndir, skb, family); 998 __xfrm_policy_check(sk, ndir, skb, family);
988} 999}
@@ -1034,7 +1045,9 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
1034 1045
1035static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 1046static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1036{ 1047{
1037 return !xfrm_policy_count[XFRM_POLICY_OUT] || 1048 struct net *net = dev_net(skb->dev);
1049
1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
1038 (skb->dst->flags & DST_NOXFRM) || 1051 (skb->dst->flags & DST_NOXFRM) ||
1039 __xfrm_route_forward(skb, family); 1052 __xfrm_route_forward(skb, family);
1040} 1053}
@@ -1268,7 +1281,8 @@ struct xfrm6_tunnel {
1268 1281
1269extern void xfrm_init(void); 1282extern void xfrm_init(void);
1270extern void xfrm4_init(void); 1283extern void xfrm4_init(void);
1271extern void xfrm_state_init(void); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net);
1272extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);
1273#ifdef CONFIG_XFRM 1287#ifdef CONFIG_XFRM
1274extern int xfrm6_init(void); 1288extern int xfrm6_init(void);
@@ -1287,19 +1301,30 @@ static inline void xfrm6_fini(void)
1287#endif 1301#endif
1288 1302
1289#ifdef CONFIG_XFRM_STATISTICS 1303#ifdef CONFIG_XFRM_STATISTICS
1290extern int xfrm_proc_init(void); 1304extern int xfrm_proc_init(struct net *net);
1305extern void xfrm_proc_fini(struct net *net);
1306#endif
1307
1308extern int xfrm_sysctl_init(struct net *net);
1309#ifdef CONFIG_SYSCTL
1310extern void xfrm_sysctl_fini(struct net *net);
1311#else
1312static inline void xfrm_sysctl_fini(struct net *net)
1313{
1314}
1291#endif 1315#endif
1292 1316
1293extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1317extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1294extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1318extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1295 int (*func)(struct xfrm_state *, int, void*), void *); 1319 int (*func)(struct xfrm_state *, int, void*), void *);
1296extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1320extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1297extern struct xfrm_state *xfrm_state_alloc(void); 1321extern struct xfrm_state *xfrm_state_alloc(struct net *net);
1298extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1322extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
1299 struct flowi *fl, struct xfrm_tmpl *tmpl, 1323 struct flowi *fl, struct xfrm_tmpl *tmpl,
1300 struct xfrm_policy *pol, int *err, 1324 struct xfrm_policy *pol, int *err,
1301 unsigned short family); 1325 unsigned short family);
1302extern struct xfrm_state * xfrm_stateonly_find(xfrm_address_t *daddr, 1326extern struct xfrm_state * xfrm_stateonly_find(struct net *net,
1327 xfrm_address_t *daddr,
1303 xfrm_address_t *saddr, 1328 xfrm_address_t *saddr,
1304 unsigned short family, 1329 unsigned short family,
1305 u8 mode, u8 proto, u32 reqid); 1330 u8 mode, u8 proto, u32 reqid);
@@ -1307,8 +1332,8 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1307extern void xfrm_state_insert(struct xfrm_state *x); 1332extern void xfrm_state_insert(struct xfrm_state *x);
1308extern int xfrm_state_add(struct xfrm_state *x); 1333extern int xfrm_state_add(struct xfrm_state *x);
1309extern int xfrm_state_update(struct xfrm_state *x); 1334extern int xfrm_state_update(struct xfrm_state *x);
1310extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1335extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family);
1311extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1336extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family);
1312#ifdef CONFIG_XFRM_SUB_POLICY 1337#ifdef CONFIG_XFRM_SUB_POLICY
1313extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1338extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1314 int n, unsigned short family); 1339 int n, unsigned short family);
@@ -1345,9 +1370,9 @@ struct xfrmk_spdinfo {
1345 u32 spdhmcnt; 1370 u32 spdhmcnt;
1346}; 1371};
1347 1372
1348extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 1373extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq);
1349extern int xfrm_state_delete(struct xfrm_state *x); 1374extern int xfrm_state_delete(struct xfrm_state *x);
1350extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 1375extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1351extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 1376extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
1352extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); 1377extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
1353extern int xfrm_replay_check(struct xfrm_state *x, 1378extern int xfrm_replay_check(struct xfrm_state *x,
@@ -1415,22 +1440,22 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1415} 1440}
1416#endif 1441#endif
1417 1442
1418struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1443struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
1419 1444
1420extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); 1445extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1421extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, 1446extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1422 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1447 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1423extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1448extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1424int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1449int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1425struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1450struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir,
1426 struct xfrm_selector *sel, 1451 struct xfrm_selector *sel,
1427 struct xfrm_sec_ctx *ctx, int delete, 1452 struct xfrm_sec_ctx *ctx, int delete,
1428 int *err); 1453 int *err);
1429struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); 1454struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err);
1430int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1455int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1431u32 xfrm_get_acqseq(void); 1456u32 xfrm_get_acqseq(void);
1432extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1457extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1433struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 1458struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto,
1434 xfrm_address_t *daddr, xfrm_address_t *saddr, 1459 xfrm_address_t *daddr, xfrm_address_t *saddr,
1435 int create, unsigned short family); 1460 int create, unsigned short family);
1436extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1461extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
@@ -1449,10 +1474,9 @@ extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1449 struct xfrm_kmaddress *k); 1474 struct xfrm_kmaddress *k);
1450#endif 1475#endif
1451 1476
1452extern wait_queue_head_t km_waitq;
1453extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1477extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1454extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1478extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1455extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1479extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1456 1480
1457extern void xfrm_input_init(void); 1481extern void xfrm_input_init(void);
1458extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1482extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
@@ -1497,18 +1521,20 @@ static inline int xfrm_policy_id2dir(u32 index)
1497 return index & 7; 1521 return index & 7;
1498} 1522}
1499 1523
1500static inline int xfrm_aevent_is_on(void) 1524#ifdef CONFIG_XFRM
1525static inline int xfrm_aevent_is_on(struct net *net)
1501{ 1526{
1502 struct sock *nlsk; 1527 struct sock *nlsk;
1503 int ret = 0; 1528 int ret = 0;
1504 1529
1505 rcu_read_lock(); 1530 rcu_read_lock();
1506 nlsk = rcu_dereference(xfrm_nl); 1531 nlsk = rcu_dereference(net->xfrm.nlsk);
1507 if (nlsk) 1532 if (nlsk)
1508 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS); 1533 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS);
1509 rcu_read_unlock(); 1534 rcu_read_unlock();
1510 return ret; 1535 return ret;
1511} 1536}
1537#endif
1512 1538
1513static inline int xfrm_alg_len(struct xfrm_algo *alg) 1539static inline int xfrm_alg_len(struct xfrm_algo *alg)
1514{ 1540{
@@ -1536,9 +1562,11 @@ static inline void xfrm_states_delete(struct xfrm_state **states, int n)
1536} 1562}
1537#endif 1563#endif
1538 1564
1565#ifdef CONFIG_XFRM
1539static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) 1566static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1540{ 1567{
1541 return skb->sp->xvec[skb->sp->len - 1]; 1568 return skb->sp->xvec[skb->sp->len - 1];
1542} 1569}
1570#endif
1543 1571
1544#endif /* _NET_XFRM_H */ 1572#endif /* _NET_XFRM_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 9c309daf492b..251fc1cd5002 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -281,10 +281,12 @@
281/* specific - Analog Devices */ 281/* specific - Analog Devices */
282#define AC97_AD_TEST 0x5a /* test register */ 282#define AC97_AD_TEST 0x5a /* test register */
283#define AC97_AD_TEST2 0x5c /* undocumented test register 2 */ 283#define AC97_AD_TEST2 0x5c /* undocumented test register 2 */
284#define AC97_AD_HPFD_SHIFT 12 /* High Pass Filter Disable */
284#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */ 285#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */
285#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */ 286#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */
286#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */ 287#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */
287#define AC97_AD_MISC 0x76 /* Misc Control Bits */ 288#define AC97_AD_MISC 0x76 /* Misc Control Bits */
289#define AC97_AD_VREFD_SHIFT 2 /* V_REFOUT Disable (AD1888) */
288 290
289/* specific - Cirrus Logic */ 291/* specific - Cirrus Logic */
290#define AC97_CSR_ACMODE 0x5e /* AC Mode Register */ 292#define AC97_CSR_ACMODE 0x5e /* AC Mode Register */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 2c4dc908a54a..1c02ed1d7c4a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -575,6 +575,7 @@ enum {
575#define SNDRV_TIMER_GLOBAL_SYSTEM 0 575#define SNDRV_TIMER_GLOBAL_SYSTEM 0
576#define SNDRV_TIMER_GLOBAL_RTC 1 576#define SNDRV_TIMER_GLOBAL_RTC 1
577#define SNDRV_TIMER_GLOBAL_HPET 2 577#define SNDRV_TIMER_GLOBAL_HPET 2
578#define SNDRV_TIMER_GLOBAL_HRTIMER 3
578 579
579/* info flags */ 580/* info flags */
580#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 581#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
diff --git a/include/sound/core.h b/include/sound/core.h
index 1508c4ec1ba9..f632484bc743 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -353,7 +353,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
353 * snd_printk - printk wrapper 353 * snd_printk - printk wrapper
354 * @fmt: format string 354 * @fmt: format string
355 * 355 *
356 * Works like print() but prints the file and the line of the caller 356 * Works like printk() but prints the file and the line of the caller
357 * when configured with CONFIG_SND_VERBOSE_PRINTK. 357 * when configured with CONFIG_SND_VERBOSE_PRINTK.
358 */ 358 */
359#define snd_printk(fmt, args...) \ 359#define snd_printk(fmt, args...) \
@@ -380,18 +380,40 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
380 printk(fmt ,##args) 380 printk(fmt ,##args)
381#endif 381#endif
382 382
383/**
384 * snd_BUG - give a BUG warning message and stack trace
385 *
386 * Calls WARN() if CONFIG_SND_DEBUG is set.
387 * Ignored when CONFIG_SND_DEBUG is not set.
388 */
383#define snd_BUG() WARN(1, "BUG?\n") 389#define snd_BUG() WARN(1, "BUG?\n")
390
391/**
392 * snd_BUG_ON - debugging check macro
393 * @cond: condition to evaluate
394 *
395 * When CONFIG_SND_DEBUG is set, this macro evaluates the given condition,
396 * and call WARN() and returns the value if it's non-zero.
397 *
398 * When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
399 * condition is ignored.
400 *
401 * NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n.
402 * Thus, don't put any statement that influences on the code behavior,
403 * such as pre/post increment, to the argument of this macro.
404 * If you want to evaluate and give a warning, use standard WARN_ON().
405 */
384#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond)) 406#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
385 407
386#else /* !CONFIG_SND_DEBUG */ 408#else /* !CONFIG_SND_DEBUG */
387 409
388#define snd_printd(fmt, args...) do { } while (0) 410#define snd_printd(fmt, args...) do { } while (0)
389#define snd_BUG() do { } while (0) 411#define snd_BUG() do { } while (0)
390static inline int __snd_bug_on(void) 412static inline int __snd_bug_on(int cond)
391{ 413{
392 return 0; 414 return 0;
393} 415}
394#define snd_BUG_ON(cond) __snd_bug_on() /* always false */ 416#define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */
395 417
396#endif /* CONFIG_SND_DEBUG */ 418#endif /* CONFIG_SND_DEBUG */
397 419
diff --git a/include/sound/info.h b/include/sound/info.h
index 8ae72e74f898..7c2ee1a21b00 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -40,30 +40,34 @@ struct snd_info_buffer {
40struct snd_info_entry; 40struct snd_info_entry;
41 41
42struct snd_info_entry_text { 42struct snd_info_entry_text {
43 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 43 void (*read)(struct snd_info_entry *entry,
44 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer); 44 struct snd_info_buffer *buffer);
45 void (*write)(struct snd_info_entry *entry,
46 struct snd_info_buffer *buffer);
45}; 47};
46 48
47struct snd_info_entry_ops { 49struct snd_info_entry_ops {
48 int (*open) (struct snd_info_entry *entry, 50 int (*open)(struct snd_info_entry *entry,
49 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
50 int (*release) (struct snd_info_entry * entry, 52 int (*release)(struct snd_info_entry *entry,
51 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
52 long (*read) (struct snd_info_entry *entry, void *file_private_data, 54 long (*read)(struct snd_info_entry *entry, void *file_private_data,
53 struct file * file, char __user *buf, 55 struct file *file, char __user *buf,
56 unsigned long count, unsigned long pos);
57 long (*write)(struct snd_info_entry *entry, void *file_private_data,
58 struct file *file, const char __user *buf,
54 unsigned long count, unsigned long pos); 59 unsigned long count, unsigned long pos);
55 long (*write) (struct snd_info_entry *entry, void *file_private_data, 60 long long (*llseek)(struct snd_info_entry *entry,
56 struct file * file, const char __user *buf, 61 void *file_private_data, struct file *file,
57 unsigned long count, unsigned long pos); 62 long long offset, int orig);
58 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data, 63 unsigned int(*poll)(struct snd_info_entry *entry,
59 struct file * file, long long offset, int orig); 64 void *file_private_data, struct file *file,
60 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data, 65 poll_table *wait);
61 struct file * file, poll_table * wait); 66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
62 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data, 67 struct file *file, unsigned int cmd, unsigned long arg);
63 struct file * file, unsigned int cmd, unsigned long arg); 68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data,
64 int (*mmap) (struct snd_info_entry *entry, void *file_private_data, 69 struct inode *inode, struct file *file,
65 struct inode * inode, struct file * file, 70 struct vm_area_struct *vma);
66 struct vm_area_struct * vma);
67}; 71};
68 72
69struct snd_info_entry { 73struct snd_info_entry {
@@ -106,34 +110,37 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer);
106static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} 110static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
107#endif 111#endif
108 112
109int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 113int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \
114 __attribute__ ((format (printf, 2, 3)));
110int snd_info_init(void); 115int snd_info_init(void);
111int snd_info_done(void); 116int snd_info_done(void);
112 117
113int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len); 118int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len);
114char *snd_info_get_str(char *dest, char *src, int len); 119char *snd_info_get_str(char *dest, char *src, int len);
115struct snd_info_entry *snd_info_create_module_entry(struct module * module, 120struct snd_info_entry *snd_info_create_module_entry(struct module *module,
116 const char *name, 121 const char *name,
117 struct snd_info_entry * parent); 122 struct snd_info_entry *parent);
118struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, 123struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
119 const char *name, 124 const char *name,
120 struct snd_info_entry * parent); 125 struct snd_info_entry *parent);
121void snd_info_free_entry(struct snd_info_entry * entry); 126void snd_info_free_entry(struct snd_info_entry *entry);
122int snd_info_store_text(struct snd_info_entry * entry); 127int snd_info_store_text(struct snd_info_entry *entry);
123int snd_info_restore_text(struct snd_info_entry * entry); 128int snd_info_restore_text(struct snd_info_entry *entry);
124 129
125int snd_info_card_create(struct snd_card * card); 130int snd_info_card_create(struct snd_card *card);
126int snd_info_card_register(struct snd_card * card); 131int snd_info_card_register(struct snd_card *card);
127int snd_info_card_free(struct snd_card * card); 132int snd_info_card_free(struct snd_card *card);
128void snd_info_card_disconnect(struct snd_card * card); 133void snd_info_card_disconnect(struct snd_card *card);
129int snd_info_register(struct snd_info_entry * entry); 134void snd_info_card_id_change(struct snd_card *card);
135int snd_info_register(struct snd_info_entry *entry);
130 136
131/* for card drivers */ 137/* for card drivers */
132int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); 138int snd_card_proc_new(struct snd_card *card, const char *name,
139 struct snd_info_entry **entryp);
133 140
134static inline void snd_info_set_text_ops(struct snd_info_entry *entry, 141static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
135 void *private_data, 142 void *private_data,
136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) 143 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
137{ 144{
138 entry->private_data = private_data; 145 entry->private_data = private_data;
139 entry->c.text.read = read; 146 entry->c.text.read = read;
@@ -146,21 +153,22 @@ int snd_info_check_reserved_words(const char *str);
146#define snd_seq_root NULL 153#define snd_seq_root NULL
147#define snd_oss_root NULL 154#define snd_oss_root NULL
148 155
149static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; } 156static inline int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) { return 0; }
150static inline int snd_info_init(void) { return 0; } 157static inline int snd_info_init(void) { return 0; }
151static inline int snd_info_done(void) { return 0; } 158static inline int snd_info_done(void) { return 0; }
152 159
153static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; } 160static inline int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) { return 0; }
154static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } 161static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
155static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; } 162static inline struct snd_info_entry *snd_info_create_module_entry(struct module *module, const char *name, struct snd_info_entry *parent) { return NULL; }
156static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; } 163static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, const char *name, struct snd_info_entry *parent) { return NULL; }
157static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; } 164static inline void snd_info_free_entry(struct snd_info_entry *entry) { ; }
158 165
159static inline int snd_info_card_create(struct snd_card * card) { return 0; } 166static inline int snd_info_card_create(struct snd_card *card) { return 0; }
160static inline int snd_info_card_register(struct snd_card * card) { return 0; } 167static inline int snd_info_card_register(struct snd_card *card) { return 0; }
161static inline int snd_info_card_free(struct snd_card * card) { return 0; } 168static inline int snd_info_card_free(struct snd_card *card) { return 0; }
162static inline void snd_info_card_disconnect(struct snd_card * card) { } 169static inline void snd_info_card_disconnect(struct snd_card *card) { }
163static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } 170static inline void snd_info_card_id_change(struct snd_card *card) { }
171static inline int snd_info_register(struct snd_info_entry *entry) { return 0; }
164 172
165static inline int snd_card_proc_new(struct snd_card *card, const char *name, 173static inline int snd_card_proc_new(struct snd_card *card, const char *name,
166 struct snd_info_entry **entryp) { return -EINVAL; } 174 struct snd_info_entry **entryp) { return -EINVAL; }
diff --git a/include/sound/jack.h b/include/sound/jack.h
index b1b2b8b59adb..2e0315cdd0d6 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -35,6 +35,8 @@ enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001, 35 SND_JACK_HEADPHONE = 0x0001,
36 SND_JACK_MICROPHONE = 0x0002, 36 SND_JACK_MICROPHONE = 0x0002,
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, 37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38 SND_JACK_LINEOUT = 0x0004,
39 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
38}; 40};
39 41
40struct snd_jack { 42struct snd_jack {
diff --git a/include/sound/l3.h b/include/sound/l3.h
new file mode 100644
index 000000000000..423a08f0f1b0
--- /dev/null
+++ b/include/sound/l3.h
@@ -0,0 +1,18 @@
1#ifndef _L3_H_
2#define _L3_H_ 1
3
4struct l3_pins {
5 void (*setdat)(int);
6 void (*setclk)(int);
7 void (*setmode)(int);
8 int data_hold;
9 int data_setup;
10 int clock_high;
11 int mode_hold;
12 int mode;
13 int mode_setup;
14};
15
16int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len);
17
18#endif
diff --git a/include/sound/s3c24xx_uda134x.h b/include/sound/s3c24xx_uda134x.h
new file mode 100644
index 000000000000..33df4cb909d3
--- /dev/null
+++ b/include/sound/s3c24xx_uda134x.h
@@ -0,0 +1,14 @@
1#ifndef _S3C24XX_UDA134X_H_
2#define _S3C24XX_UDA134X_H_ 1
3
4#include <sound/uda134x.h>
5
6struct s3c24xx_uda134x_platform_data {
7 int l3_clk;
8 int l3_mode;
9 int l3_data;
10 void (*power) (int);
11 int model;
12};
13
14#endif
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
new file mode 100644
index 000000000000..24247f763608
--- /dev/null
+++ b/include/sound/soc-dai.h
@@ -0,0 +1,231 @@
1/*
2 * linux/sound/soc-dai.h -- ALSA SoC Layer
3 *
4 * Copyright: 2005-2008 Wolfson Microelectronics. PLC.
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 * Digital Audio Interface (DAI) API.
11 */
12
13#ifndef __LINUX_SND_SOC_DAI_H
14#define __LINUX_SND_SOC_DAI_H
15
16
17#include <linux/list.h>
18
19struct snd_pcm_substream;
20
21/*
22 * DAI hardware audio formats.
23 *
24 * Describes the physical PCM data formating and clocking. Add new formats
25 * to the end.
26 */
27#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
28#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */
29#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
30#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM LRC */
31#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM LRC */
32#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
33
34/* left and right justified also known as MSB and LSB respectively */
35#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
36#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
37
38/*
39 * DAI Clock gating.
40 *
41 * DAI bit clocks can be be gated (disabled) when not the DAI is not
42 * sending or receiving PCM data in a frame. This can be used to save power.
43 */
44#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */
46
47/*
48 * DAI Left/Right Clocks.
49 *
50 * Specifies whether the DAI can support different samples for similtanious
51 * playback and capture. This usually requires a seperate physical frame
52 * clock for playback and capture.
53 */
54#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
55#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
56
57/*
58 * TDM
59 *
60 * Time Division Multiplexing. Allows PCM data to be multplexed with other
61 * data on the DAI.
62 */
63#define SND_SOC_DAIFMT_TDM (1 << 6)
64
65/*
66 * DAI hardware signal inversions.
67 *
68 * Specifies whether the DAI can also support inverted clocks for the specified
69 * format.
70 */
71#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
72#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
73#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
74#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
75
76/*
77 * DAI hardware clock masters.
78 *
79 * This is wrt the codec, the inverse is true for the interface
80 * i.e. if the codec is clk and frm master then the interface is
81 * clk and frame slave.
82 */
83#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
84#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
85#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
86#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
87
88#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
89#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
90#define SND_SOC_DAIFMT_INV_MASK 0x0f00
91#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
92
93/*
94 * Master Clock Directions
95 */
96#define SND_SOC_CLOCK_IN 0
97#define SND_SOC_CLOCK_OUT 1
98
99struct snd_soc_dai_ops;
100struct snd_soc_dai;
101struct snd_ac97_bus_ops;
102
103/* Digital Audio Interface registration */
104int snd_soc_register_dai(struct snd_soc_dai *dai);
105void snd_soc_unregister_dai(struct snd_soc_dai *dai);
106int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count);
107void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count);
108
109/* Digital Audio Interface clocking API.*/
110int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
111 unsigned int freq, int dir);
112
113int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
114 int div_id, int div);
115
116int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
117 int pll_id, unsigned int freq_in, unsigned int freq_out);
118
119/* Digital Audio interface formatting */
120int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
121
122int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
123 unsigned int mask, int slots);
124
125int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
126
127/* Digital Audio Interface mute */
128int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
129
130/*
131 * Digital Audio Interface.
132 *
133 * Describes the Digital Audio Interface in terms of it's ALSA, DAI and AC97
134 * operations an capabilities. Codec and platfom drivers will register a this
135 * structure for every DAI they have.
136 *
137 * This structure covers the clocking, formating and ALSA operations for each
138 * interface a
139 */
140struct snd_soc_dai_ops {
141 /*
142 * DAI clocking configuration, all optional.
143 * Called by soc_card drivers, normally in their hw_params.
144 */
145 int (*set_sysclk)(struct snd_soc_dai *dai,
146 int clk_id, unsigned int freq, int dir);
147 int (*set_pll)(struct snd_soc_dai *dai,
148 int pll_id, unsigned int freq_in, unsigned int freq_out);
149 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
150
151 /*
152 * DAI format configuration
153 * Called by soc_card drivers, normally in their hw_params.
154 */
155 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
156 int (*set_tdm_slot)(struct snd_soc_dai *dai,
157 unsigned int mask, int slots);
158 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
159
160 /*
161 * DAI digital mute - optional.
162 * Called by soc-core to minimise any pops.
163 */
164 int (*digital_mute)(struct snd_soc_dai *dai, int mute);
165
166 /*
167 * ALSA PCM audio operations - all optional.
168 * Called by soc-core during audio PCM operations.
169 */
170 int (*startup)(struct snd_pcm_substream *,
171 struct snd_soc_dai *);
172 void (*shutdown)(struct snd_pcm_substream *,
173 struct snd_soc_dai *);
174 int (*hw_params)(struct snd_pcm_substream *,
175 struct snd_pcm_hw_params *, struct snd_soc_dai *);
176 int (*hw_free)(struct snd_pcm_substream *,
177 struct snd_soc_dai *);
178 int (*prepare)(struct snd_pcm_substream *,
179 struct snd_soc_dai *);
180 int (*trigger)(struct snd_pcm_substream *, int,
181 struct snd_soc_dai *);
182};
183
184/*
185 * Digital Audio Interface runtime data.
186 *
187 * Holds runtime data for a DAI.
188 */
189struct snd_soc_dai {
190 /* DAI description */
191 char *name;
192 unsigned int id;
193 int ac97_control;
194
195 struct device *dev;
196
197 /* DAI callbacks */
198 int (*probe)(struct platform_device *pdev,
199 struct snd_soc_dai *dai);
200 void (*remove)(struct platform_device *pdev,
201 struct snd_soc_dai *dai);
202 int (*suspend)(struct snd_soc_dai *dai);
203 int (*resume)(struct snd_soc_dai *dai);
204
205 /* ops */
206 struct snd_soc_dai_ops ops;
207
208 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture;
210 struct snd_soc_pcm_stream playback;
211
212 /* DAI runtime info */
213 struct snd_pcm_runtime *runtime;
214 struct snd_soc_codec *codec;
215 unsigned int active;
216 unsigned char pop_wait:1;
217 void *dma_data;
218
219 /* DAI private data */
220 void *private_data;
221
222 /* parent codec/platform */
223 union {
224 struct snd_soc_codec *codec;
225 struct snd_soc_platform *platform;
226 };
227
228 struct list_head list;
229};
230
231#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ca699a3017f3..7ee2f70ca42e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -221,8 +221,6 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
221 int num); 221 int num);
222 222
223/* dapm path setup */ 223/* dapm path setup */
224int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec,
225 const char *sink_name, const char *control_name, const char *src_name);
226int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 224int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
227void snd_soc_dapm_free(struct snd_soc_device *socdev); 225void snd_soc_dapm_free(struct snd_soc_device *socdev);
228int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 226int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5e0189876afd..f86e455d3828 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -21,8 +21,6 @@
21#include <sound/control.h> 21#include <sound/control.h>
22#include <sound/ac97_codec.h> 22#include <sound/ac97_codec.h>
23 23
24#define SND_SOC_VERSION "0.13.2"
25
26/* 24/*
27 * Convenience kcontrol builders 25 * Convenience kcontrol builders
28 */ 26 */
@@ -145,105 +143,31 @@ enum snd_soc_bias_level {
145 SND_SOC_BIAS_OFF, 143 SND_SOC_BIAS_OFF,
146}; 144};
147 145
148/*
149 * Digital Audio Interface (DAI) types
150 */
151#define SND_SOC_DAI_AC97 0x1
152#define SND_SOC_DAI_I2S 0x2
153#define SND_SOC_DAI_PCM 0x4
154#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */
155
156/*
157 * DAI hardware audio formats
158 */
159#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
160#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right justified mode */
161#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
162#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM or LRC */
163#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM or LRC */
164#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
165
166#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
167#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
168
169/*
170 * DAI Gating
171 */
172#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
173#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
174
175/*
176 * DAI Sync
177 * Synchronous LR (Left Right) clocks and Frame signals.
178 */
179#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
180#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
181
182/*
183 * TDM
184 */
185#define SND_SOC_DAIFMT_TDM (1 << 6)
186
187/*
188 * DAI hardware signal inversions
189 */
190#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
191#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
192#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
193#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
194
195/*
196 * DAI hardware clock masters
197 * This is wrt the codec, the inverse is true for the interface
198 * i.e. if the codec is clk and frm master then the interface is
199 * clk and frame slave.
200 */
201#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
202#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
203#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
204#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
205
206#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
207#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
208#define SND_SOC_DAIFMT_INV_MASK 0x0f00
209#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
210
211
212/*
213 * Master Clock Directions
214 */
215#define SND_SOC_CLOCK_IN 0
216#define SND_SOC_CLOCK_OUT 1
217
218/*
219 * AC97 codec ID's bitmask
220 */
221#define SND_SOC_DAI_AC97_ID0 (1 << 0)
222#define SND_SOC_DAI_AC97_ID1 (1 << 1)
223#define SND_SOC_DAI_AC97_ID2 (1 << 2)
224#define SND_SOC_DAI_AC97_ID3 (1 << 3)
225
226struct snd_soc_device; 146struct snd_soc_device;
227struct snd_soc_pcm_stream; 147struct snd_soc_pcm_stream;
228struct snd_soc_ops; 148struct snd_soc_ops;
229struct snd_soc_dai_mode; 149struct snd_soc_dai_mode;
230struct snd_soc_pcm_runtime; 150struct snd_soc_pcm_runtime;
231struct snd_soc_dai; 151struct snd_soc_dai;
152struct snd_soc_platform;
232struct snd_soc_codec; 153struct snd_soc_codec;
233struct snd_soc_machine_config;
234struct soc_enum; 154struct soc_enum;
235struct snd_soc_ac97_ops; 155struct snd_soc_ac97_ops;
236struct snd_soc_clock_info;
237 156
238typedef int (*hw_write_t)(void *,const char* ,int); 157typedef int (*hw_write_t)(void *,const char* ,int);
239typedef int (*hw_read_t)(void *,char* ,int); 158typedef int (*hw_read_t)(void *,char* ,int);
240 159
241extern struct snd_ac97_bus_ops soc_ac97_ops; 160extern struct snd_ac97_bus_ops soc_ac97_ops;
242 161
162int snd_soc_register_platform(struct snd_soc_platform *platform);
163void snd_soc_unregister_platform(struct snd_soc_platform *platform);
164int snd_soc_register_codec(struct snd_soc_codec *codec);
165void snd_soc_unregister_codec(struct snd_soc_codec *codec);
166
243/* pcm <-> DAI connect */ 167/* pcm <-> DAI connect */
244void snd_soc_free_pcms(struct snd_soc_device *socdev); 168void snd_soc_free_pcms(struct snd_soc_device *socdev);
245int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); 169int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
246int snd_soc_register_card(struct snd_soc_device *socdev); 170int snd_soc_init_card(struct snd_soc_device *socdev);
247 171
248/* set runtime hw params */ 172/* set runtime hw params */
249int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 173int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
@@ -263,27 +187,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
263 struct snd_ac97_bus_ops *ops, int num); 187 struct snd_ac97_bus_ops *ops, int num);
264void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 188void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
265 189
266/* Digital Audio Interface clocking API.*/
267int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
268 unsigned int freq, int dir);
269
270int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
271 int div_id, int div);
272
273int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
274 int pll_id, unsigned int freq_in, unsigned int freq_out);
275
276/* Digital Audio interface formatting */
277int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
278
279int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
280 unsigned int mask, int slots);
281
282int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
283
284/* Digital Audio Interface mute */
285int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
286
287/* 190/*
288 *Controls 191 *Controls
289 */ 192 */
@@ -341,66 +244,14 @@ struct snd_soc_ops {
341 int (*trigger)(struct snd_pcm_substream *, int); 244 int (*trigger)(struct snd_pcm_substream *, int);
342}; 245};
343 246
344/* ASoC DAI ops */
345struct snd_soc_dai_ops {
346 /* DAI clocking configuration */
347 int (*set_sysclk)(struct snd_soc_dai *dai,
348 int clk_id, unsigned int freq, int dir);
349 int (*set_pll)(struct snd_soc_dai *dai,
350 int pll_id, unsigned int freq_in, unsigned int freq_out);
351 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
352
353 /* DAI format configuration */
354 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
355 int (*set_tdm_slot)(struct snd_soc_dai *dai,
356 unsigned int mask, int slots);
357 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
358
359 /* digital mute */
360 int (*digital_mute)(struct snd_soc_dai *dai, int mute);
361};
362
363/* SoC DAI (Digital Audio Interface) */
364struct snd_soc_dai {
365 /* DAI description */
366 char *name;
367 unsigned int id;
368 unsigned char type;
369
370 /* DAI callbacks */
371 int (*probe)(struct platform_device *pdev,
372 struct snd_soc_dai *dai);
373 void (*remove)(struct platform_device *pdev,
374 struct snd_soc_dai *dai);
375 int (*suspend)(struct platform_device *pdev,
376 struct snd_soc_dai *dai);
377 int (*resume)(struct platform_device *pdev,
378 struct snd_soc_dai *dai);
379
380 /* ops */
381 struct snd_soc_ops ops;
382 struct snd_soc_dai_ops dai_ops;
383
384 /* DAI capabilities */
385 struct snd_soc_pcm_stream capture;
386 struct snd_soc_pcm_stream playback;
387
388 /* DAI runtime info */
389 struct snd_pcm_runtime *runtime;
390 struct snd_soc_codec *codec;
391 unsigned int active;
392 unsigned char pop_wait:1;
393 void *dma_data;
394
395 /* DAI private data */
396 void *private_data;
397};
398
399/* SoC Audio Codec */ 247/* SoC Audio Codec */
400struct snd_soc_codec { 248struct snd_soc_codec {
401 char *name; 249 char *name;
402 struct module *owner; 250 struct module *owner;
403 struct mutex mutex; 251 struct mutex mutex;
252 struct device *dev;
253
254 struct list_head list;
404 255
405 /* callbacks */ 256 /* callbacks */
406 int (*set_bias_level)(struct snd_soc_codec *, 257 int (*set_bias_level)(struct snd_soc_codec *,
@@ -426,6 +277,7 @@ struct snd_soc_codec {
426 short reg_cache_step; 277 short reg_cache_step;
427 278
428 /* dapm */ 279 /* dapm */
280 u32 pop_time;
429 struct list_head dapm_widgets; 281 struct list_head dapm_widgets;
430 struct list_head dapm_paths; 282 struct list_head dapm_paths;
431 enum snd_soc_bias_level bias_level; 283 enum snd_soc_bias_level bias_level;
@@ -435,6 +287,11 @@ struct snd_soc_codec {
435 /* codec DAI's */ 287 /* codec DAI's */
436 struct snd_soc_dai *dai; 288 struct snd_soc_dai *dai;
437 unsigned int num_dai; 289 unsigned int num_dai;
290
291#ifdef CONFIG_DEBUG_FS
292 struct dentry *debugfs_reg;
293 struct dentry *debugfs_pop_time;
294#endif
438}; 295};
439 296
440/* codec device */ 297/* codec device */
@@ -448,13 +305,12 @@ struct snd_soc_codec_device {
448/* SoC platform interface */ 305/* SoC platform interface */
449struct snd_soc_platform { 306struct snd_soc_platform {
450 char *name; 307 char *name;
308 struct list_head list;
451 309
452 int (*probe)(struct platform_device *pdev); 310 int (*probe)(struct platform_device *pdev);
453 int (*remove)(struct platform_device *pdev); 311 int (*remove)(struct platform_device *pdev);
454 int (*suspend)(struct platform_device *pdev, 312 int (*suspend)(struct snd_soc_dai *dai);
455 struct snd_soc_dai *dai); 313 int (*resume)(struct snd_soc_dai *dai);
456 int (*resume)(struct platform_device *pdev,
457 struct snd_soc_dai *dai);
458 314
459 /* pcm creation and destruction */ 315 /* pcm creation and destruction */
460 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 316 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
@@ -484,9 +340,14 @@ struct snd_soc_dai_link {
484 struct snd_pcm *pcm; 340 struct snd_pcm *pcm;
485}; 341};
486 342
487/* SoC machine */ 343/* SoC card */
488struct snd_soc_machine { 344struct snd_soc_card {
489 char *name; 345 char *name;
346 struct device *dev;
347
348 struct list_head list;
349
350 int instantiated;
490 351
491 int (*probe)(struct platform_device *pdev); 352 int (*probe)(struct platform_device *pdev);
492 int (*remove)(struct platform_device *pdev); 353 int (*remove)(struct platform_device *pdev);
@@ -499,23 +360,26 @@ struct snd_soc_machine {
499 int (*resume_post)(struct platform_device *pdev); 360 int (*resume_post)(struct platform_device *pdev);
500 361
501 /* callbacks */ 362 /* callbacks */
502 int (*set_bias_level)(struct snd_soc_machine *, 363 int (*set_bias_level)(struct snd_soc_card *,
503 enum snd_soc_bias_level level); 364 enum snd_soc_bias_level level);
504 365
505 /* CPU <--> Codec DAI links */ 366 /* CPU <--> Codec DAI links */
506 struct snd_soc_dai_link *dai_link; 367 struct snd_soc_dai_link *dai_link;
507 int num_links; 368 int num_links;
369
370 struct snd_soc_device *socdev;
371
372 struct snd_soc_platform *platform;
373 struct delayed_work delayed_work;
374 struct work_struct deferred_resume_work;
508}; 375};
509 376
510/* SoC Device - the audio subsystem */ 377/* SoC Device - the audio subsystem */
511struct snd_soc_device { 378struct snd_soc_device {
512 struct device *dev; 379 struct device *dev;
513 struct snd_soc_machine *machine; 380 struct snd_soc_card *card;
514 struct snd_soc_platform *platform;
515 struct snd_soc_codec *codec; 381 struct snd_soc_codec *codec;
516 struct snd_soc_codec_device *codec_dev; 382 struct snd_soc_codec_device *codec_dev;
517 struct delayed_work delayed_work;
518 struct work_struct deferred_resume_work;
519 void *codec_data; 383 void *codec_data;
520}; 384};
521 385
@@ -542,4 +406,6 @@ struct soc_enum {
542 void *dapm; 406 void *dapm;
543}; 407};
544 408
409#include <sound/soc-dai.h>
410
545#endif 411#endif
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
new file mode 100644
index 000000000000..475ef8bb7dcd
--- /dev/null
+++ b/include/sound/uda134x.h
@@ -0,0 +1,26 @@
1/*
2 * uda134x.h -- UDA134x ALSA SoC Codec driver
3 *
4 * Copyright 2007 Dension Audio Systems Ltd.
5 * Author: Zoltan Devai
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 _UDA134X_H
13#define _UDA134X_H
14
15#include <sound/l3.h>
16
17struct uda134x_platform_data {
18 struct l3_pins l3;
19 void (*power) (int);
20 int model;
21#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3
24};
25
26#endif /* _UDA134X_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index 4aafeda88634..2b48237e23bf 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.18rc3" 2#define CONFIG_SND_VERSION "1.0.18a"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/trace/block.h b/include/trace/block.h
new file mode 100644
index 000000000000..25c6a1fd5b77
--- /dev/null
+++ b/include/trace/block.h
@@ -0,0 +1,76 @@
1#ifndef _TRACE_BLOCK_H
2#define _TRACE_BLOCK_H
3
4#include <linux/blkdev.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(block_rq_abort,
8 TPPROTO(struct request_queue *q, struct request *rq),
9 TPARGS(q, rq));
10
11DECLARE_TRACE(block_rq_insert,
12 TPPROTO(struct request_queue *q, struct request *rq),
13 TPARGS(q, rq));
14
15DECLARE_TRACE(block_rq_issue,
16 TPPROTO(struct request_queue *q, struct request *rq),
17 TPARGS(q, rq));
18
19DECLARE_TRACE(block_rq_requeue,
20 TPPROTO(struct request_queue *q, struct request *rq),
21 TPARGS(q, rq));
22
23DECLARE_TRACE(block_rq_complete,
24 TPPROTO(struct request_queue *q, struct request *rq),
25 TPARGS(q, rq));
26
27DECLARE_TRACE(block_bio_bounce,
28 TPPROTO(struct request_queue *q, struct bio *bio),
29 TPARGS(q, bio));
30
31DECLARE_TRACE(block_bio_complete,
32 TPPROTO(struct request_queue *q, struct bio *bio),
33 TPARGS(q, bio));
34
35DECLARE_TRACE(block_bio_backmerge,
36 TPPROTO(struct request_queue *q, struct bio *bio),
37 TPARGS(q, bio));
38
39DECLARE_TRACE(block_bio_frontmerge,
40 TPPROTO(struct request_queue *q, struct bio *bio),
41 TPARGS(q, bio));
42
43DECLARE_TRACE(block_bio_queue,
44 TPPROTO(struct request_queue *q, struct bio *bio),
45 TPARGS(q, bio));
46
47DECLARE_TRACE(block_getrq,
48 TPPROTO(struct request_queue *q, struct bio *bio, int rw),
49 TPARGS(q, bio, rw));
50
51DECLARE_TRACE(block_sleeprq,
52 TPPROTO(struct request_queue *q, struct bio *bio, int rw),
53 TPARGS(q, bio, rw));
54
55DECLARE_TRACE(block_plug,
56 TPPROTO(struct request_queue *q),
57 TPARGS(q));
58
59DECLARE_TRACE(block_unplug_timer,
60 TPPROTO(struct request_queue *q),
61 TPARGS(q));
62
63DECLARE_TRACE(block_unplug_io,
64 TPPROTO(struct request_queue *q),
65 TPARGS(q));
66
67DECLARE_TRACE(block_split,
68 TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
69 TPARGS(q, bio, pdu));
70
71DECLARE_TRACE(block_remap,
72 TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev,
73 sector_t from, sector_t to),
74 TPARGS(q, bio, dev, from, to));
75
76#endif
diff --git a/include/trace/boot.h b/include/trace/boot.h
new file mode 100644
index 000000000000..088ea089e31d
--- /dev/null
+++ b/include/trace/boot.h
@@ -0,0 +1,60 @@
1#ifndef _LINUX_TRACE_BOOT_H
2#define _LINUX_TRACE_BOOT_H
3
4#include <linux/module.h>
5#include <linux/kallsyms.h>
6#include <linux/init.h>
7
8/*
9 * Structure which defines the trace of an initcall
10 * while it is called.
11 * You don't have to fill the func field since it is
12 * only used internally by the tracer.
13 */
14struct boot_trace_call {
15 pid_t caller;
16 char func[KSYM_SYMBOL_LEN];
17};
18
19/*
20 * Structure which defines the trace of an initcall
21 * while it returns.
22 */
23struct boot_trace_ret {
24 char func[KSYM_SYMBOL_LEN];
25 int result;
26 unsigned long long duration; /* nsecs */
27};
28
29#ifdef CONFIG_BOOT_TRACER
30/* Append the traces on the ring-buffer */
31extern void trace_boot_call(struct boot_trace_call *bt, initcall_t fn);
32extern void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn);
33
34/* Tells the tracer that smp_pre_initcall is finished.
35 * So we can start the tracing
36 */
37extern void start_boot_trace(void);
38
39/* Resume the tracing of other necessary events
40 * such as sched switches
41 */
42extern void enable_boot_trace(void);
43
44/* Suspend this tracing. Actually, only sched_switches tracing have
45 * to be suspended. Initcalls doesn't need it.)
46 */
47extern void disable_boot_trace(void);
48#else
49static inline
50void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) { }
51
52static inline
53void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) { }
54
55static inline void start_boot_trace(void) { }
56static inline void enable_boot_trace(void) { }
57static inline void disable_boot_trace(void) { }
58#endif /* CONFIG_BOOT_TRACER */
59
60#endif /* __LINUX_TRACE_BOOT_H */
diff --git a/include/trace/sched.h b/include/trace/sched.h
index ad47369d01b5..0d81098ee9fc 100644
--- a/include/trace/sched.h
+++ b/include/trace/sched.h
@@ -4,52 +4,52 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/tracepoint.h> 5#include <linux/tracepoint.h>
6 6
7DEFINE_TRACE(sched_kthread_stop, 7DECLARE_TRACE(sched_kthread_stop,
8 TPPROTO(struct task_struct *t), 8 TPPROTO(struct task_struct *t),
9 TPARGS(t)); 9 TPARGS(t));
10 10
11DEFINE_TRACE(sched_kthread_stop_ret, 11DECLARE_TRACE(sched_kthread_stop_ret,
12 TPPROTO(int ret), 12 TPPROTO(int ret),
13 TPARGS(ret)); 13 TPARGS(ret));
14 14
15DEFINE_TRACE(sched_wait_task, 15DECLARE_TRACE(sched_wait_task,
16 TPPROTO(struct rq *rq, struct task_struct *p), 16 TPPROTO(struct rq *rq, struct task_struct *p),
17 TPARGS(rq, p)); 17 TPARGS(rq, p));
18 18
19DEFINE_TRACE(sched_wakeup, 19DECLARE_TRACE(sched_wakeup,
20 TPPROTO(struct rq *rq, struct task_struct *p), 20 TPPROTO(struct rq *rq, struct task_struct *p, int success),
21 TPARGS(rq, p)); 21 TPARGS(rq, p, success));
22 22
23DEFINE_TRACE(sched_wakeup_new, 23DECLARE_TRACE(sched_wakeup_new,
24 TPPROTO(struct rq *rq, struct task_struct *p), 24 TPPROTO(struct rq *rq, struct task_struct *p, int success),
25 TPARGS(rq, p)); 25 TPARGS(rq, p, success));
26 26
27DEFINE_TRACE(sched_switch, 27DECLARE_TRACE(sched_switch,
28 TPPROTO(struct rq *rq, struct task_struct *prev, 28 TPPROTO(struct rq *rq, struct task_struct *prev,
29 struct task_struct *next), 29 struct task_struct *next),
30 TPARGS(rq, prev, next)); 30 TPARGS(rq, prev, next));
31 31
32DEFINE_TRACE(sched_migrate_task, 32DECLARE_TRACE(sched_migrate_task,
33 TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu), 33 TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
34 TPARGS(rq, p, dest_cpu)); 34 TPARGS(p, orig_cpu, dest_cpu));
35 35
36DEFINE_TRACE(sched_process_free, 36DECLARE_TRACE(sched_process_free,
37 TPPROTO(struct task_struct *p), 37 TPPROTO(struct task_struct *p),
38 TPARGS(p)); 38 TPARGS(p));
39 39
40DEFINE_TRACE(sched_process_exit, 40DECLARE_TRACE(sched_process_exit,
41 TPPROTO(struct task_struct *p), 41 TPPROTO(struct task_struct *p),
42 TPARGS(p)); 42 TPARGS(p));
43 43
44DEFINE_TRACE(sched_process_wait, 44DECLARE_TRACE(sched_process_wait,
45 TPPROTO(struct pid *pid), 45 TPPROTO(struct pid *pid),
46 TPARGS(pid)); 46 TPARGS(pid));
47 47
48DEFINE_TRACE(sched_process_fork, 48DECLARE_TRACE(sched_process_fork,
49 TPPROTO(struct task_struct *parent, struct task_struct *child), 49 TPPROTO(struct task_struct *parent, struct task_struct *child),
50 TPARGS(parent, child)); 50 TPARGS(parent, child));
51 51
52DEFINE_TRACE(sched_signal_send, 52DECLARE_TRACE(sched_signal_send,
53 TPPROTO(int sig, struct task_struct *p), 53 TPPROTO(int sig, struct task_struct *p),
54 TPARGS(sig, p)); 54 TPARGS(sig, p));
55 55
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 1a4bc6ada606..25144ab22b95 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -37,6 +37,7 @@ enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
37struct sh_mobile_lcdc_sys_bus_cfg { 37struct sh_mobile_lcdc_sys_bus_cfg {
38 unsigned long ldmt2r; 38 unsigned long ldmt2r;
39 unsigned long ldmt3r; 39 unsigned long ldmt3r;
40 unsigned long deferred_io_msec;
40}; 41};
41 42
42struct sh_mobile_lcdc_sys_bus_ops { 43struct sh_mobile_lcdc_sys_bus_ops {
diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h
index 919b5bdcb2bd..2090881c3650 100644
--- a/include/xen/interface/event_channel.h
+++ b/include/xen/interface/event_channel.h
@@ -9,6 +9,8 @@
9#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__ 9#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
10#define __XEN_PUBLIC_EVENT_CHANNEL_H__ 10#define __XEN_PUBLIC_EVENT_CHANNEL_H__
11 11
12#include <xen/interface/xen.h>
13
12typedef uint32_t evtchn_port_t; 14typedef uint32_t evtchn_port_t;
13DEFINE_GUEST_HANDLE(evtchn_port_t); 15DEFINE_GUEST_HANDLE(evtchn_port_t);
14 16