aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-17 07:06:17 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-17 07:06:17 -0400
commita3d06cc6aa3e765dc2bf98626f87272dcf641dca (patch)
treeaa3e49b58f08d6c0ea55cdca4fb5e6c8ba6ae333 /include
parent0990b1c65729012a63e0eeca93aaaafea4e9a064 (diff)
parent65795efbd380a832ae508b04dba8f8e53f0b84d9 (diff)
Merge branch 'linus' into perfcounters/core
Conflicts: arch/x86/include/asm/kmap_types.h include/linux/mm.h include/asm-generic/kmap_types.h Merge reason: We crossed changes with kmap_types.h cleanups in mainline. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h9
-rw-r--r--include/acpi/actypes.h20
-rw-r--r--include/acpi/platform/acgcc.h4
-rw-r--r--include/acpi/platform/aclinux.h63
-rw-r--r--include/asm-generic/atomic64.h42
-rw-r--r--include/asm-generic/errno.h2
-rw-r--r--include/asm-generic/kmap_types.h7
-rw-r--r--include/asm-generic/vmlinux.lds.h241
-rw-r--r--include/drm/drm_pciids.h8
-rw-r--r--include/drm/radeon_drm.h130
-rw-r--r--include/drm/ttm/ttm_bo_api.h618
-rw-r--r--include/drm/ttm/ttm_bo_driver.h867
-rw-r--r--include/drm/ttm/ttm_memory.h153
-rw-r--r--include/drm/ttm/ttm_module.h58
-rw-r--r--include/drm/ttm/ttm_placement.h92
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/amba/pl022.h264
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/bio.h5
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/bug.h12
-rw-r--r--include/linux/c2port.h3
-rw-r--r--include/linux/can/Kbuild1
-rw-r--r--include/linux/can/dev.h70
-rw-r--r--include/linux/can/netlink.h113
-rw-r--r--include/linux/can/platform/sja1000.h35
-rw-r--r--include/linux/cb710.h231
-rw-r--r--include/linux/clk.h13
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/cpuset.h13
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/eisa.h4
-rw-r--r--include/linux/etherdevice.h27
-rw-r--r--include/linux/ethtool.h23
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/firewire.h358
-rw-r--r--include/linux/firmware-map.h12
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/fs.h10
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h164
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/highmem.h4
-rw-r--r--include/linux/hrtimer.h7
-rw-r--r--include/linux/hugetlb.h7
-rw-r--r--include/linux/i2c-ocores.h2
-rw-r--r--include/linux/ieee80211.h61
-rw-r--r--include/linux/if.h3
-rw-r--r--include/linux/if_arp.h2
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_packet.h21
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/init.h9
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/interrupt.h14
-rw-r--r--include/linux/ipv6.h6
-rw-r--r--include/linux/isdn/capilli.h2
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/keyboard.h1
-rw-r--r--include/linux/kmemcheck.h153
-rw-r--r--include/linux/linux_logo.h16
-rw-r--r--include/linux/lis3lv02d.h39
-rw-r--r--include/linux/list_nulls.h18
-rw-r--r--include/linux/mISDNdsp.h4
-rw-r--r--include/linux/mISDNhw.h12
-rw-r--r--include/linux/mISDNif.h19
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/mdio.h356
-rw-r--r--include/linux/memcontrol.h7
-rw-r--r--include/linux/mfd/tmio.h7
-rw-r--r--include/linux/mg_disk.h45
-rw-r--r--include/linux/mii.h34
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/linux/mm.h33
-rw-r--r--include/linux/mm_types.h10
-rw-r--r--include/linux/mmc/sdio_ids.h10
-rw-r--r--include/linux/mmzone.h36
-rw-r--r--include/linux/module.h17
-rw-r--r--include/linux/net_dropmon.h8
-rw-r--r--include/linux/netdevice.h232
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h69
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h3
-rw-r--r--include/linux/netfilter/nfnetlink.h5
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter/x_tables.h6
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h5
-rw-r--r--include/linux/netfilter/xt_osf.h133
-rw-r--r--include/linux/netfilter/xt_socket.h12
-rw-r--r--include/linux/nl80211.h178
-rw-r--r--include/linux/nl802154.h119
-rw-r--r--include/linux/nls.h35
-rw-r--r--include/linux/nodemask.h19
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/of.h3
-rw-r--r--include/linux/of_mdio.h22
-rw-r--r--include/linux/page-flags.h16
-rw-r--r--include/linux/pagemap.h12
-rw-r--r--include/linux/pci.h8
-rw-r--r--include/linux/pci_ids.h48
-rw-r--r--include/linux/phy.h10
-rw-r--r--include/linux/platform_device.h4
-rw-r--r--include/linux/poll.h3
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/regulator/lp3971.h51
-rw-r--r--include/linux/regulator/max1586.h63
-rw-r--r--include/linux/regulator/userspace-consumer.h25
-rw-r--r--include/linux/rfkill.h387
-rw-r--r--include/linux/ring_buffer.h4
-rw-r--r--include/linux/rmap.h12
-rw-r--r--include/linux/sched.h30
-rw-r--r--include/linux/sctp.h20
-rw-r--r--include/linux/section-names.h6
-rw-r--r--include/linux/skbuff.h71
-rw-r--r--include/linux/slab.h7
-rw-r--r--include/linux/slab_def.h81
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/smsc911x.h10
-rw-r--r--include/linux/snmp.h10
-rw-r--r--include/linux/socket.h11
-rw-r--r--include/linux/spi/libertas_spi.h3
-rw-r--r--include/linux/spi/wl12xx.h31
-rw-r--r--include/linux/stacktrace.h3
-rw-r--r--include/linux/swap.h42
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/tcp.h4
-rw-r--r--include/linux/tick.h3
-rw-r--r--include/linux/timer.h3
-rw-r--r--include/linux/timex.h45
-rw-r--r--include/linux/tracepoint.h4
-rw-r--r--include/linux/ultrasound.h2
-rw-r--r--include/linux/usb.h37
-rw-r--r--include/linux/usb/audio.h265
-rw-r--r--include/linux/usb/ch9.h17
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/langwell_otg.h177
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/otg.h4
-rw-r--r--include/linux/usb/r8a66597.h44
-rw-r--r--include/linux/usb/serial.h32
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/utsname.h12
-rw-r--r--include/linux/videodev2.h3
-rw-r--r--include/linux/vlynq.h161
-rw-r--r--include/linux/vmstat.h5
-rw-r--r--include/linux/wimax.h7
-rw-r--r--include/linux/wimax/i2400m.h2
-rw-r--r--include/media/adv7343.h23
-rw-r--r--include/media/ir-kbd-i2c.h10
-rw-r--r--include/media/soc_camera.h10
-rw-r--r--include/media/tuner.h2
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-device.h23
-rw-r--r--include/media/v4l2-subdev.h5
-rw-r--r--include/net/bluetooth/bluetooth.h15
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bluetooth/l2cap.h71
-rw-r--r--include/net/cfg80211.h1059
-rw-r--r--include/net/dst.h12
-rw-r--r--include/net/fib_rules.h2
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/ieee802154/af_ieee802154.h60
-rw-r--r--include/net/ieee802154/mac_def.h160
-rw-r--r--include/net/ieee802154/netdevice.h115
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_hashtables.h2
-rw-r--r--include/net/inet_sock.h17
-rw-r--r--include/net/inet_timewait_sock.h5
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ipip.h7
-rw-r--r--include/net/ipv6.h15
-rw-r--r--include/net/iucv/af_iucv.h9
-rw-r--r--include/net/mac80211.h264
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_icmp.h11
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_icmpv6.h7
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h206
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h4
-rw-r--r--include/net/netlink.h9
-rw-r--r--include/net/netns/conntrack.h7
-rw-r--r--include/net/pkt_sched.h11
-rw-r--r--include/net/regulatory.h101
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/snmp.h19
-rw-r--r--include/net/sock.h8
-rw-r--r--include/net/tcp.h59
-rw-r--r--include/net/wimax.h8
-rw-r--r--include/net/wireless.h472
-rw-r--r--include/net/xfrm.h4
-rw-r--r--include/scsi/libfcoe.h2
-rw-r--r--include/trace/events/napi.h11
-rw-r--r--include/video/pxa168fb.h127
-rw-r--r--include/video/s1d13xxxfb.h9
207 files changed, 9132 insertions, 1622 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 4db89e98535d..82ec6a3c0500 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20090320 50#define ACPI_CA_VERSION 0x20090521
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -201,6 +201,8 @@ acpi_evaluate_object_typed(acpi_handle object,
201acpi_status 201acpi_status
202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
203 203
204acpi_status acpi_install_method(u8 *buffer);
205
204acpi_status 206acpi_status
205acpi_get_next_object(acpi_object_type type, 207acpi_get_next_object(acpi_object_type type,
206 acpi_handle parent, 208 acpi_handle parent,
@@ -375,7 +377,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
375acpi_status acpi_leave_sleep_state(u8 sleep_state); 377acpi_status acpi_leave_sleep_state(u8 sleep_state);
376 378
377/* 379/*
378 * Debug output 380 * Error/Warning output
379 */ 381 */
380void ACPI_INTERNAL_VAR_XFACE 382void ACPI_INTERNAL_VAR_XFACE
381acpi_error(const char *module_name, 383acpi_error(const char *module_name,
@@ -394,6 +396,9 @@ void ACPI_INTERNAL_VAR_XFACE
394acpi_info(const char *module_name, 396acpi_info(const char *module_name,
395 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 397 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
396 398
399/*
400 * Debug output
401 */
397#ifdef ACPI_DEBUG_OUTPUT 402#ifdef ACPI_DEBUG_OUTPUT
398 403
399void ACPI_INTERNAL_VAR_XFACE 404void ACPI_INTERNAL_VAR_XFACE
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index f555d927f7c0..37ba576d06e8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -429,20 +429,12 @@ typedef unsigned long long acpi_integer;
429 429
430/* Data manipulation */ 430/* Data manipulation */
431 431
432#define ACPI_LOWORD(l) ((u16)(u32)(l)) 432#define ACPI_LOBYTE(integer) ((u8) (u16)(integer))
433#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) 433#define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8))
434#define ACPI_LOBYTE(l) ((u8)(u16)(l)) 434#define ACPI_LOWORD(integer) ((u16) (u32)(integer))
435#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) 435#define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16))
436 436#define ACPI_LODWORD(integer64) ((u32) (u64)(integer64))
437/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ 437#define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32))
438
439struct acpi_integer_overlay {
440 u32 lo_dword;
441 u32 hi_dword;
442};
443
444#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
445#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
446 438
447#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 439#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
448#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 440#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 8e2cdc57b197..935c5d7fc86e 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -62,4 +62,8 @@
62 */ 62 */
63#define ACPI_UNUSED_VAR __attribute__ ((unused)) 63#define ACPI_UNUSED_VAR __attribute__ ((unused))
64 64
65#ifdef _ANSI
66#define inline
67#endif
68
65#endif /* __ACGCC_H__ */ 69#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 6d49b2a498c4..fcb8e4b159b1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: aclinux.h - OS specific defines, etc. 3 * Name: aclinux.h - OS specific defines, etc. for Linux
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,10 +44,13 @@
44#ifndef __ACLINUX_H__ 44#ifndef __ACLINUX_H__
45#define __ACLINUX_H__ 45#define __ACLINUX_H__
46 46
47/* Common (in-kernel/user-space) ACPICA configuration */
48
47#define ACPI_USE_SYSTEM_CLIBRARY 49#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
50 52
53
51#ifdef __KERNEL__ 54#ifdef __KERNEL__
52 55
53#include <linux/string.h> 56#include <linux/string.h>
@@ -63,15 +66,18 @@
63#include <linux/spinlock_types.h> 66#include <linux/spinlock_types.h>
64#include <asm/current.h> 67#include <asm/current.h>
65 68
66/* Host-dependent types and defines */ 69/* Host-dependent types and defines for in-kernel ACPICA */
67 70
68#define ACPI_MACHINE_WIDTH BITS_PER_LONG 71#define ACPI_MACHINE_WIDTH BITS_PER_LONG
69#define acpi_cache_t struct kmem_cache
70#define acpi_spinlock spinlock_t *
71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 72#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
72#define strtoul simple_strtoul 73#define strtoul simple_strtoul
73 74
74#else /* !__KERNEL__ */ 75#define acpi_cache_t struct kmem_cache
76#define acpi_spinlock spinlock_t *
77#define acpi_cpu_flags unsigned long
78#define acpi_thread_id struct task_struct *
79
80#else /* !__KERNEL__ */
75 81
76#include <stdarg.h> 82#include <stdarg.h>
77#include <string.h> 83#include <string.h>
@@ -79,6 +85,11 @@
79#include <ctype.h> 85#include <ctype.h>
80#include <unistd.h> 86#include <unistd.h>
81 87
88/* Host-dependent types and defines for user-space ACPICA */
89
90#define ACPI_FLUSH_CPU_CACHE()
91#define acpi_thread_id pthread_t
92
82#if defined(__ia64__) || defined(__x86_64__) 93#if defined(__ia64__) || defined(__x86_64__)
83#define ACPI_MACHINE_WIDTH 64 94#define ACPI_MACHINE_WIDTH 64
84#define COMPILER_DEPENDENT_INT64 long 95#define COMPILER_DEPENDENT_INT64 long
@@ -94,17 +105,17 @@
94#define __cdecl 105#define __cdecl
95#endif 106#endif
96 107
97#define ACPI_FLUSH_CPU_CACHE() 108#endif /* __KERNEL__ */
98#endif /* __KERNEL__ */
99 109
100/* Linux uses GCC */ 110/* Linux uses GCC */
101 111
102#include "acgcc.h" 112#include "acgcc.h"
103 113
104#define acpi_cpu_flags unsigned long
105
106#define acpi_thread_id struct task_struct *
107 114
115#ifdef __KERNEL__
116/*
117 * Overrides for in-kernel ACPICA
118 */
108static inline acpi_thread_id acpi_os_get_thread_id(void) 119static inline acpi_thread_id acpi_os_get_thread_id(void)
109{ 120{
110 return current; 121 return current;
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
119#include <acpi/actypes.h> 130#include <acpi/actypes.h>
120static inline void *acpi_os_allocate(acpi_size size) 131static inline void *acpi_os_allocate(acpi_size size)
121{ 132{
122 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 133 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
123} 134}
135
124static inline void *acpi_os_allocate_zeroed(acpi_size size) 136static inline void *acpi_os_allocate_zeroed(acpi_size size)
125{ 137{
126 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 138 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
127} 139}
128 140
129static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 141static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
130{ 142{
131 return kmem_cache_zalloc(cache, 143 return kmem_cache_zalloc(cache,
132 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 144 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
133} 145}
134 146
135#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 147#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
136#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
137#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
138 150
139/* 151/* Used within ACPICA to show where it is safe to preempt execution */
140 * We need to show where it is safe to preempt execution of ACPICA 152
141 */ 153#define ACPI_PREEMPTION_POINT() \
142#define ACPI_PREEMPTION_POINT() \ 154 do { \
143 do { \ 155 if (!irqs_disabled()) \
144 if (!irqs_disabled()) \ 156 cond_resched(); \
145 cond_resched(); \
146 } while (0) 157 } while (0)
147 158
148#endif /* __ACLINUX_H__ */ 159#endif /* __KERNEL__ */
160
161#endif /* __ACLINUX_H__ */
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h
new file mode 100644
index 000000000000..b18ce4f9ee3d
--- /dev/null
+++ b/include/asm-generic/atomic64.h
@@ -0,0 +1,42 @@
1/*
2 * Generic implementation of 64-bit atomics using spinlocks,
3 * useful on processors that don't have 64-bit atomic instructions.
4 *
5 * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef _ASM_GENERIC_ATOMIC64_H
13#define _ASM_GENERIC_ATOMIC64_H
14
15typedef struct {
16 long long counter;
17} atomic64_t;
18
19#define ATOMIC64_INIT(i) { (i) }
20
21extern long long atomic64_read(const atomic64_t *v);
22extern void atomic64_set(atomic64_t *v, long long i);
23extern void atomic64_add(long long a, atomic64_t *v);
24extern long long atomic64_add_return(long long a, atomic64_t *v);
25extern void atomic64_sub(long long a, atomic64_t *v);
26extern long long atomic64_sub_return(long long a, atomic64_t *v);
27extern long long atomic64_dec_if_positive(atomic64_t *v);
28extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n);
29extern long long atomic64_xchg(atomic64_t *v, long long new);
30extern int atomic64_add_unless(atomic64_t *v, long long a, long long u);
31
32#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
33#define atomic64_inc(v) atomic64_add(1LL, (v))
34#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
35#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
36#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
37#define atomic64_dec(v) atomic64_sub(1LL, (v))
38#define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
39#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
40#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
41
42#endif /* _ASM_GENERIC_ATOMIC64_H */
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h
index e8852c092fea..28cc03bf19e6 100644
--- a/include/asm-generic/errno.h
+++ b/include/asm-generic/errno.h
@@ -106,4 +106,6 @@
106#define EOWNERDEAD 130 /* Owner died */ 106#define EOWNERDEAD 130 /* Owner died */
107#define ENOTRECOVERABLE 131 /* State not recoverable */ 107#define ENOTRECOVERABLE 131 /* State not recoverable */
108 108
109#define ERFKILL 132 /* Operation not possible due to RF-kill */
110
109#endif 111#endif
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index 58c33055c304..eddbce0f9fb9 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_GENERIC_KMAP_TYPES_H 1#ifndef _ASM_GENERIC_KMAP_TYPES_H
2#define _ASM_GENERIC_KMAP_TYPES_H 2#define _ASM_GENERIC_KMAP_TYPES_H
3 3
4#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef __WITH_KM_FENCE
5# define D(n) __KM_FENCE_##n , 5# define D(n) __KM_FENCE_##n ,
6#else 6#else
7# define D(n) 7# define D(n)
@@ -24,7 +24,10 @@ D(12) KM_SOFTIRQ1,
24D(13) KM_SYNC_ICACHE, 24D(13) KM_SYNC_ICACHE,
25D(14) KM_SYNC_DCACHE, 25D(14) KM_SYNC_DCACHE,
26D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */ 26D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
27D(16) KM_TYPE_NR 27D(16) KM_IRQ_PTE,
28D(17) KM_NMI,
29D(18) KM_NMI_PTE,
30D(19) KM_TYPE_NR
28}; 31};
29 32
30#undef D 33#undef D
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f1736ca7922c..6bdba10fef4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1,4 +1,57 @@
1#include <linux/section-names.h> 1/*
2 * Helper macros to support writing architecture specific
3 * linker scripts.
4 *
5 * A minimal linker scripts has following content:
6 * [This is a sample, architectures may have special requiriements]
7 *
8 * OUTPUT_FORMAT(...)
9 * OUTPUT_ARCH(...)
10 * ENTRY(...)
11 * SECTIONS
12 * {
13 * . = START;
14 * __init_begin = .;
15 * HEAD_TEXT_SECTION
16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...)
18 * PERCPU(PAGE_SIZE)
19 * __init_end = .;
20 *
21 * _stext = .;
22 * TEXT_SECTION = 0
23 * _etext = .;
24 *
25 * _sdata = .;
26 * RO_DATA_SECTION(PAGE_SIZE)
27 * RW_DATA_SECTION(...)
28 * _edata = .;
29 *
30 * EXCEPTION_TABLE(...)
31 * NOTES
32 *
33 * __bss_start = .;
34 * BSS_SECTION(0, 0)
35 * __bss_stop = .;
36 * _end = .;
37 *
38 * /DISCARD/ : {
39 * EXIT_TEXT
40 * EXIT_DATA
41 * EXIT_CALL
42 * }
43 * STABS_DEBUG
44 * DWARF_DEBUG
45 * }
46 *
47 * [__init_begin, __init_end] is the init section that may be freed after init
48 * [_stext, _etext] is the text section
49 * [_sdata, _edata] is the data section
50 *
51 * Some of the included output section have their own set of constants.
52 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
53 * [__nosave_begin, __nosave_end] for the nosave data
54 */
2 55
3#ifndef LOAD_OFFSET 56#ifndef LOAD_OFFSET
4#define LOAD_OFFSET 0 57#define LOAD_OFFSET 0
@@ -116,7 +169,36 @@
116 FTRACE_EVENTS() \ 169 FTRACE_EVENTS() \
117 TRACE_SYSCALLS() 170 TRACE_SYSCALLS()
118 171
119#define RO_DATA(align) \ 172/*
173 * Data section helpers
174 */
175#define NOSAVE_DATA \
176 . = ALIGN(PAGE_SIZE); \
177 VMLINUX_SYMBOL(__nosave_begin) = .; \
178 *(.data.nosave) \
179 . = ALIGN(PAGE_SIZE); \
180 VMLINUX_SYMBOL(__nosave_end) = .;
181
182#define PAGE_ALIGNED_DATA(page_align) \
183 . = ALIGN(page_align); \
184 *(.data.page_aligned)
185
186#define READ_MOSTLY_DATA(align) \
187 . = ALIGN(align); \
188 *(.data.read_mostly)
189
190#define CACHELINE_ALIGNED_DATA(align) \
191 . = ALIGN(align); \
192 *(.data.cacheline_aligned)
193
194#define INIT_TASK(align) \
195 . = ALIGN(align); \
196 *(.data.init_task)
197
198/*
199 * Read only Data
200 */
201#define RO_DATA_SECTION(align) \
120 . = ALIGN((align)); \ 202 . = ALIGN((align)); \
121 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 203 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
122 VMLINUX_SYMBOL(__start_rodata) = .; \ 204 VMLINUX_SYMBOL(__start_rodata) = .; \
@@ -270,9 +352,10 @@
270 } \ 352 } \
271 . = ALIGN((align)); 353 . = ALIGN((align));
272 354
273/* RODATA provided for backward compatibility. 355/* RODATA & RO_DATA provided for backward compatibility.
274 * All archs are supposed to use RO_DATA() */ 356 * All archs are supposed to use RO_DATA() */
275#define RODATA RO_DATA(4096) 357#define RODATA RO_DATA_SECTION(4096)
358#define RO_DATA(align) RO_DATA_SECTION(align)
276 359
277#define SECURITY_INIT \ 360#define SECURITY_INIT \
278 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 361 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@@ -330,16 +413,42 @@
330#endif 413#endif
331 414
332/* Section used for early init (in .S files) */ 415/* Section used for early init (in .S files) */
333#define HEAD_TEXT *(HEAD_TEXT_SECTION) 416#define HEAD_TEXT *(.head.text)
417
418#define HEAD_TEXT_SECTION \
419 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
420 HEAD_TEXT \
421 }
422
423/*
424 * Exception table
425 */
426#define EXCEPTION_TABLE(align) \
427 . = ALIGN(align); \
428 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
429 VMLINUX_SYMBOL(__start___ex_table) = .; \
430 *(__ex_table) \
431 VMLINUX_SYMBOL(__stop___ex_table) = .; \
432 }
433
434/*
435 * Init task
436 */
437#define INIT_TASK_DATA(align) \
438 . = ALIGN(align); \
439 .data.init_task : { \
440 INIT_TASK \
441 }
334 442
335/* init and exit section handling */ 443/* init and exit section handling */
336#define INIT_DATA \ 444#define INIT_DATA \
337 *(.init.data) \ 445 *(.init.data) \
338 DEV_DISCARD(init.data) \ 446 DEV_DISCARD(init.data) \
339 DEV_DISCARD(init.rodata) \
340 CPU_DISCARD(init.data) \ 447 CPU_DISCARD(init.data) \
341 CPU_DISCARD(init.rodata) \
342 MEM_DISCARD(init.data) \ 448 MEM_DISCARD(init.data) \
449 *(.init.rodata) \
450 DEV_DISCARD(init.rodata) \
451 CPU_DISCARD(init.rodata) \
343 MEM_DISCARD(init.rodata) 452 MEM_DISCARD(init.rodata)
344 453
345#define INIT_TEXT \ 454#define INIT_TEXT \
@@ -363,9 +472,35 @@
363 CPU_DISCARD(exit.text) \ 472 CPU_DISCARD(exit.text) \
364 MEM_DISCARD(exit.text) 473 MEM_DISCARD(exit.text)
365 474
366 /* DWARF debug sections. 475#define EXIT_CALL \
367 Symbols in the DWARF debugging sections are relative to 476 *(.exitcall.exit)
368 the beginning of the section so we begin them at 0. */ 477
478/*
479 * bss (Block Started by Symbol) - uninitialized data
480 * zeroed during startup
481 */
482#define SBSS \
483 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
484 *(.sbss) \
485 *(.scommon) \
486 }
487
488#define BSS(bss_align) \
489 . = ALIGN(bss_align); \
490 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
491 VMLINUX_SYMBOL(__bss_start) = .; \
492 *(.bss.page_aligned) \
493 *(.dynbss) \
494 *(.bss) \
495 *(COMMON) \
496 VMLINUX_SYMBOL(__bss_stop) = .; \
497 }
498
499/*
500 * DWARF debug sections.
501 * Symbols in the DWARF debugging sections are relative to
502 * the beginning of the section so we begin them at 0.
503 */
369#define DWARF_DEBUG \ 504#define DWARF_DEBUG \
370 /* DWARF 1 */ \ 505 /* DWARF 1 */ \
371 .debug 0 : { *(.debug) } \ 506 .debug 0 : { *(.debug) } \
@@ -432,6 +567,12 @@
432 VMLINUX_SYMBOL(__stop_notes) = .; \ 567 VMLINUX_SYMBOL(__stop_notes) = .; \
433 } 568 }
434 569
570#define INIT_SETUP(initsetup_align) \
571 . = ALIGN(initsetup_align); \
572 VMLINUX_SYMBOL(__setup_start) = .; \
573 *(.init.setup) \
574 VMLINUX_SYMBOL(__setup_end) = .;
575
435#define INITCALLS \ 576#define INITCALLS \
436 *(.initcallearly.init) \ 577 *(.initcallearly.init) \
437 VMLINUX_SYMBOL(__early_initcall_end) = .; \ 578 VMLINUX_SYMBOL(__early_initcall_end) = .; \
@@ -453,6 +594,31 @@
453 *(.initcall7.init) \ 594 *(.initcall7.init) \
454 *(.initcall7s.init) 595 *(.initcall7s.init)
455 596
597#define INIT_CALLS \
598 VMLINUX_SYMBOL(__initcall_start) = .; \
599 INITCALLS \
600 VMLINUX_SYMBOL(__initcall_end) = .;
601
602#define CON_INITCALL \
603 VMLINUX_SYMBOL(__con_initcall_start) = .; \
604 *(.con_initcall.init) \
605 VMLINUX_SYMBOL(__con_initcall_end) = .;
606
607#define SECURITY_INITCALL \
608 VMLINUX_SYMBOL(__security_initcall_start) = .; \
609 *(.security_initcall.init) \
610 VMLINUX_SYMBOL(__security_initcall_end) = .;
611
612#ifdef CONFIG_BLK_DEV_INITRD
613#define INIT_RAM_FS \
614 . = ALIGN(PAGE_SIZE); \
615 VMLINUX_SYMBOL(__initramfs_start) = .; \
616 *(.init.ramfs) \
617 VMLINUX_SYMBOL(__initramfs_end) = .;
618#else
619#define INITRAMFS
620#endif
621
456/** 622/**
457 * PERCPU_VADDR - define output section for percpu area 623 * PERCPU_VADDR - define output section for percpu area
458 * @vaddr: explicit base address (optional) 624 * @vaddr: explicit base address (optional)
@@ -509,3 +675,58 @@
509 *(.data.percpu.shared_aligned) \ 675 *(.data.percpu.shared_aligned) \
510 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 676 VMLINUX_SYMBOL(__per_cpu_end) = .; \
511 } 677 }
678
679
680/*
681 * Definition of the high level *_SECTION macros
682 * They will fit only a subset of the architectures
683 */
684
685
686/*
687 * Writeable data.
688 * All sections are combined in a single .data section.
689 * The sections following CONSTRUCTORS are arranged so their
690 * typical alignment matches.
691 * A cacheline is typical/always less than a PAGE_SIZE so
692 * the sections that has this restriction (or similar)
693 * is located before the ones requiring PAGE_SIZE alignment.
694 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
695 * matches the requirment of PAGE_ALIGNED_DATA.
696 *
697 * use 0 as page_align if page_aligned data is not used */
698#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \
699 . = ALIGN(PAGE_SIZE); \
700 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
701 INIT_TASK(inittask) \
702 CACHELINE_ALIGNED_DATA(cacheline) \
703 READ_MOSTLY_DATA(cacheline) \
704 DATA_DATA \
705 CONSTRUCTORS \
706 NOSAVE_DATA(nosave) \
707 PAGE_ALIGNED_DATA(pagealigned) \
708 }
709
710#define INIT_TEXT_SECTION(inittext_align) \
711 . = ALIGN(inittext_align); \
712 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
713 VMLINUX_SYMBOL(_sinittext) = .; \
714 INIT_TEXT \
715 VMLINUX_SYMBOL(_einittext) = .; \
716 }
717
718#define INIT_DATA_SECTION(initsetup_align) \
719 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
720 INIT_DATA \
721 INIT_SETUP(initsetup_align) \
722 INIT_CALLS \
723 CON_INITCALL \
724 SECURITY_INITCALL \
725 INIT_RAM_FS \
726 }
727
728#define BSS_SECTION(sbss_align, bss_align) \
729 SBSS \
730 BSS(bss_align) \
731 . = ALIGN(4);
732
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index f8634ab53b8f..45c18672b093 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -254,8 +254,8 @@
254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 257 {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 258 {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 259 {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 260 {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
@@ -273,8 +273,8 @@
273 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 273 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 274 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 275 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 276 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
278 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 278 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
279 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 279 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
280 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 280 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index fe3e3a4b4aed..41862e9a4c20 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -496,6 +496,16 @@ typedef struct {
496#define DRM_RADEON_SETPARAM 0x19 496#define DRM_RADEON_SETPARAM 0x19
497#define DRM_RADEON_SURF_ALLOC 0x1a 497#define DRM_RADEON_SURF_ALLOC 0x1a
498#define DRM_RADEON_SURF_FREE 0x1b 498#define DRM_RADEON_SURF_FREE 0x1b
499/* KMS ioctl */
500#define DRM_RADEON_GEM_INFO 0x1c
501#define DRM_RADEON_GEM_CREATE 0x1d
502#define DRM_RADEON_GEM_MMAP 0x1e
503#define DRM_RADEON_GEM_PREAD 0x21
504#define DRM_RADEON_GEM_PWRITE 0x22
505#define DRM_RADEON_GEM_SET_DOMAIN 0x23
506#define DRM_RADEON_GEM_WAIT_IDLE 0x24
507#define DRM_RADEON_CS 0x26
508#define DRM_RADEON_INFO 0x27
499 509
500#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 510#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
501#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 511#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -524,6 +534,17 @@ typedef struct {
524#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) 534#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
525#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) 535#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
526#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) 536#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
537/* KMS */
538#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
539#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
540#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
541#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
542#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
543#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
544#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
545#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
546#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
547
527 548
528typedef struct drm_radeon_init { 549typedef struct drm_radeon_init {
529 enum { 550 enum {
@@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect {
682#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 703#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
683#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 704#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
684#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 705#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
706#define RADEON_PARAM_DEVICE_ID 16
685 707
686typedef struct drm_radeon_getparam { 708typedef struct drm_radeon_getparam {
687 int param; 709 int param;
@@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free {
751#define DRM_RADEON_VBLANK_CRTC1 1 773#define DRM_RADEON_VBLANK_CRTC1 1
752#define DRM_RADEON_VBLANK_CRTC2 2 774#define DRM_RADEON_VBLANK_CRTC2 2
753 775
776/*
777 * Kernel modesetting world below.
778 */
779#define RADEON_GEM_DOMAIN_CPU 0x1
780#define RADEON_GEM_DOMAIN_GTT 0x2
781#define RADEON_GEM_DOMAIN_VRAM 0x4
782
783struct drm_radeon_gem_info {
784 uint64_t gart_size;
785 uint64_t vram_size;
786 uint64_t vram_visible;
787};
788
789#define RADEON_GEM_NO_BACKING_STORE 1
790
791struct drm_radeon_gem_create {
792 uint64_t size;
793 uint64_t alignment;
794 uint32_t handle;
795 uint32_t initial_domain;
796 uint32_t flags;
797};
798
799struct drm_radeon_gem_mmap {
800 uint32_t handle;
801 uint32_t pad;
802 uint64_t offset;
803 uint64_t size;
804 uint64_t addr_ptr;
805};
806
807struct drm_radeon_gem_set_domain {
808 uint32_t handle;
809 uint32_t read_domains;
810 uint32_t write_domain;
811};
812
813struct drm_radeon_gem_wait_idle {
814 uint32_t handle;
815 uint32_t pad;
816};
817
818struct drm_radeon_gem_busy {
819 uint32_t handle;
820 uint32_t busy;
821};
822
823struct drm_radeon_gem_pread {
824 /** Handle for the object being read. */
825 uint32_t handle;
826 uint32_t pad;
827 /** Offset into the object to read from */
828 uint64_t offset;
829 /** Length of data to read */
830 uint64_t size;
831 /** Pointer to write the data into. */
832 /* void *, but pointers are not 32/64 compatible */
833 uint64_t data_ptr;
834};
835
836struct drm_radeon_gem_pwrite {
837 /** Handle for the object being written to. */
838 uint32_t handle;
839 uint32_t pad;
840 /** Offset into the object to write to */
841 uint64_t offset;
842 /** Length of data to write */
843 uint64_t size;
844 /** Pointer to read the data from. */
845 /* void *, but pointers are not 32/64 compatible */
846 uint64_t data_ptr;
847};
848
849#define RADEON_CHUNK_ID_RELOCS 0x01
850#define RADEON_CHUNK_ID_IB 0x02
851
852struct drm_radeon_cs_chunk {
853 uint32_t chunk_id;
854 uint32_t length_dw;
855 uint64_t chunk_data;
856};
857
858struct drm_radeon_cs_reloc {
859 uint32_t handle;
860 uint32_t read_domains;
861 uint32_t write_domain;
862 uint32_t flags;
863};
864
865struct drm_radeon_cs {
866 uint32_t num_chunks;
867 uint32_t cs_id;
868 /* this points to uint64_t * which point to cs chunks */
869 uint64_t chunks;
870 /* updates to the limits after this CS ioctl */
871 uint64_t gart_limit;
872 uint64_t vram_limit;
873};
874
875#define RADEON_INFO_DEVICE_ID 0x00
876#define RADEON_INFO_NUM_GB_PIPES 0x01
877
878struct drm_radeon_info {
879 uint32_t request;
880 uint32_t pad;
881 uint64_t value;
882};
883
754#endif 884#endif
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
new file mode 100644
index 000000000000..cd22ab4b495c
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -0,0 +1,618 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_BO_API_H_
32#define _TTM_BO_API_H_
33
34#include "drm_hashtab.h"
35#include <linux/kref.h>
36#include <linux/list.h>
37#include <linux/wait.h>
38#include <linux/mutex.h>
39#include <linux/mm.h>
40#include <linux/rbtree.h>
41#include <linux/bitmap.h>
42
43struct ttm_bo_device;
44
45struct drm_mm_node;
46
47/**
48 * struct ttm_mem_reg
49 *
50 * @mm_node: Memory manager node.
51 * @size: Requested size of memory region.
52 * @num_pages: Actual size of memory region in pages.
53 * @page_alignment: Page alignment.
54 * @placement: Placement flags.
55 *
56 * Structure indicating the placement and space resources used by a
57 * buffer object.
58 */
59
60struct ttm_mem_reg {
61 struct drm_mm_node *mm_node;
62 unsigned long size;
63 unsigned long num_pages;
64 uint32_t page_alignment;
65 uint32_t mem_type;
66 uint32_t placement;
67};
68
69/**
70 * enum ttm_bo_type
71 *
72 * @ttm_bo_type_device: These are 'normal' buffers that can
73 * be mmapped by user space. Each of these bos occupy a slot in the
74 * device address space, that can be used for normal vm operations.
75 *
76 * @ttm_bo_type_user: These are user-space memory areas that are made
77 * available to the GPU by mapping the buffer pages into the GPU aperture
78 * space. These buffers cannot be mmaped from the device address space.
79 *
80 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
81 * but they cannot be accessed from user-space. For kernel-only use.
82 */
83
84enum ttm_bo_type {
85 ttm_bo_type_device,
86 ttm_bo_type_user,
87 ttm_bo_type_kernel
88};
89
90struct ttm_tt;
91
92/**
93 * struct ttm_buffer_object
94 *
95 * @bdev: Pointer to the buffer object device structure.
96 * @buffer_start: The virtual user-space start address of ttm_bo_type_user
97 * buffers.
98 * @type: The bo type.
99 * @destroy: Destruction function. If NULL, kfree is used.
100 * @num_pages: Actual number of pages.
101 * @addr_space_offset: Address space offset.
102 * @acc_size: Accounted size for this object.
103 * @kref: Reference count of this buffer object. When this refcount reaches
104 * zero, the object is put on the delayed delete list.
105 * @list_kref: List reference count of this buffer object. This member is
106 * used to avoid destruction while the buffer object is still on a list.
107 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
108 * keeps one refcount. When this refcount reaches zero,
109 * the object is destroyed.
110 * @event_queue: Queue for processes waiting on buffer object status change.
111 * @lock: spinlock protecting mostly synchronization members.
112 * @proposed_placement: Proposed placement for the buffer. Changed only by the
113 * creator prior to validation as opposed to bo->mem.proposed_flags which is
114 * changed by the implementation prior to a buffer move if it wants to outsmart
115 * the buffer creator / user. This latter happens, for example, at eviction.
116 * @mem: structure describing current placement.
117 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
118 * pinned in physical memory. If this behaviour is not desired, this member
119 * holds a pointer to a persistant shmem object.
120 * @ttm: TTM structure holding system pages.
121 * @evicted: Whether the object was evicted without user-space knowing.
122 * @cpu_writes: For synchronization. Number of cpu writers.
123 * @lru: List head for the lru list.
124 * @ddestroy: List head for the delayed destroy list.
125 * @swap: List head for swap LRU list.
126 * @val_seq: Sequence of the validation holding the @reserved lock.
127 * Used to avoid starvation when many processes compete to validate the
128 * buffer. This member is protected by the bo_device::lru_lock.
129 * @seq_valid: The value of @val_seq is valid. This value is protected by
130 * the bo_device::lru_lock.
131 * @reserved: Deadlock-free lock used for synchronization state transitions.
132 * @sync_obj_arg: Opaque argument to synchronization object function.
133 * @sync_obj: Pointer to a synchronization object.
134 * @priv_flags: Flags describing buffer object internal state.
135 * @vm_rb: Rb node for the vm rb tree.
136 * @vm_node: Address space manager node.
137 * @offset: The current GPU offset, which can have different meanings
138 * depending on the memory type. For SYSTEM type memory, it should be 0.
139 * @cur_placement: Hint of current placement.
140 *
141 * Base class for TTM buffer object, that deals with data placement and CPU
142 * mappings. GPU mappings are really up to the driver, but for simpler GPUs
143 * the driver can usually use the placement offset @offset directly as the
144 * GPU virtual address. For drivers implementing multiple
145 * GPU memory manager contexts, the driver should manage the address space
146 * in these contexts separately and use these objects to get the correct
147 * placement and caching for these GPU maps. This makes it possible to use
148 * these objects for even quite elaborate memory management schemes.
149 * The destroy member, the API visibility of this object makes it possible
150 * to derive driver specific types.
151 */
152
153struct ttm_buffer_object {
154 /**
155 * Members constant at init.
156 */
157
158 struct ttm_bo_device *bdev;
159 unsigned long buffer_start;
160 enum ttm_bo_type type;
161 void (*destroy) (struct ttm_buffer_object *);
162 unsigned long num_pages;
163 uint64_t addr_space_offset;
164 size_t acc_size;
165
166 /**
167 * Members not needing protection.
168 */
169
170 struct kref kref;
171 struct kref list_kref;
172 wait_queue_head_t event_queue;
173 spinlock_t lock;
174
175 /**
176 * Members protected by the bo::reserved lock.
177 */
178
179 uint32_t proposed_placement;
180 struct ttm_mem_reg mem;
181 struct file *persistant_swap_storage;
182 struct ttm_tt *ttm;
183 bool evicted;
184
185 /**
186 * Members protected by the bo::reserved lock only when written to.
187 */
188
189 atomic_t cpu_writers;
190
191 /**
192 * Members protected by the bdev::lru_lock.
193 */
194
195 struct list_head lru;
196 struct list_head ddestroy;
197 struct list_head swap;
198 uint32_t val_seq;
199 bool seq_valid;
200
201 /**
202 * Members protected by the bdev::lru_lock
203 * only when written to.
204 */
205
206 atomic_t reserved;
207
208
209 /**
210 * Members protected by the bo::lock
211 */
212
213 void *sync_obj_arg;
214 void *sync_obj;
215 unsigned long priv_flags;
216
217 /**
218 * Members protected by the bdev::vm_lock
219 */
220
221 struct rb_node vm_rb;
222 struct drm_mm_node *vm_node;
223
224
225 /**
226 * Special members that are protected by the reserve lock
227 * and the bo::lock when written to. Can be read with
228 * either of these locks held.
229 */
230
231 unsigned long offset;
232 uint32_t cur_placement;
233};
234
235/**
236 * struct ttm_bo_kmap_obj
237 *
238 * @virtual: The current kernel virtual address.
239 * @page: The page when kmap'ing a single page.
240 * @bo_kmap_type: Type of bo_kmap.
241 *
242 * Object describing a kernel mapping. Since a TTM bo may be located
243 * in various memory types with various caching policies, the
244 * mapping can either be an ioremap, a vmap, a kmap or part of a
245 * premapped region.
246 */
247
248struct ttm_bo_kmap_obj {
249 void *virtual;
250 struct page *page;
251 enum {
252 ttm_bo_map_iomap,
253 ttm_bo_map_vmap,
254 ttm_bo_map_kmap,
255 ttm_bo_map_premapped,
256 } bo_kmap_type;
257};
258
259/**
260 * ttm_bo_reference - reference a struct ttm_buffer_object
261 *
262 * @bo: The buffer object.
263 *
264 * Returns a refcounted pointer to a buffer object.
265 */
266
267static inline struct ttm_buffer_object *
268ttm_bo_reference(struct ttm_buffer_object *bo)
269{
270 kref_get(&bo->kref);
271 return bo;
272}
273
274/**
275 * ttm_bo_wait - wait for buffer idle.
276 *
277 * @bo: The buffer object.
278 * @interruptible: Use interruptible wait.
279 * @no_wait: Return immediately if buffer is busy.
280 *
281 * This function must be called with the bo::mutex held, and makes
282 * sure any previous rendering to the buffer is completed.
283 * Note: It might be necessary to block validations before the
284 * wait by reserving the buffer.
285 * Returns -EBUSY if no_wait is true and the buffer is busy.
286 * Returns -ERESTART if interrupted by a signal.
287 */
288extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
289 bool interruptible, bool no_wait);
290/**
291 * ttm_buffer_object_validate
292 *
293 * @bo: The buffer object.
294 * @proposed_placement: Proposed_placement for the buffer object.
295 * @interruptible: Sleep interruptible if sleeping.
296 * @no_wait: Return immediately if the buffer is busy.
297 *
298 * Changes placement and caching policy of the buffer object
299 * according to bo::proposed_flags.
300 * Returns
301 * -EINVAL on invalid proposed_flags.
302 * -ENOMEM on out-of-memory condition.
303 * -EBUSY if no_wait is true and buffer busy.
304 * -ERESTART if interrupted by a signal.
305 */
306extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
307 uint32_t proposed_placement,
308 bool interruptible, bool no_wait);
309/**
310 * ttm_bo_unref
311 *
312 * @bo: The buffer object.
313 *
314 * Unreference and clear a pointer to a buffer object.
315 */
316extern void ttm_bo_unref(struct ttm_buffer_object **bo);
317
318/**
319 * ttm_bo_synccpu_write_grab
320 *
321 * @bo: The buffer object:
322 * @no_wait: Return immediately if buffer is busy.
323 *
324 * Synchronizes a buffer object for CPU RW access. This means
325 * blocking command submission that affects the buffer and
326 * waiting for buffer idle. This lock is recursive.
327 * Returns
328 * -EBUSY if the buffer is busy and no_wait is true.
329 * -ERESTART if interrupted by a signal.
330 */
331
332extern int
333ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
334/**
335 * ttm_bo_synccpu_write_release:
336 *
337 * @bo : The buffer object.
338 *
339 * Releases a synccpu lock.
340 */
341extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
342
343/**
344 * ttm_buffer_object_init
345 *
346 * @bdev: Pointer to a ttm_bo_device struct.
347 * @bo: Pointer to a ttm_buffer_object to be initialized.
348 * @size: Requested size of buffer object.
349 * @type: Requested type of buffer object.
350 * @flags: Initial placement flags.
351 * @page_alignment: Data alignment in pages.
352 * @buffer_start: Virtual address of user space data backing a
353 * user buffer object.
354 * @interruptible: If needing to sleep to wait for GPU resources,
355 * sleep interruptible.
356 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
357 * pinned in physical memory. If this behaviour is not desired, this member
358 * holds a pointer to a persistant shmem object. Typically, this would
359 * point to the shmem object backing a GEM object if TTM is used to back a
360 * GEM user interface.
361 * @acc_size: Accounted size for this object.
362 * @destroy: Destroy function. Use NULL for kfree().
363 *
364 * This function initializes a pre-allocated struct ttm_buffer_object.
365 * As this object may be part of a larger structure, this function,
366 * together with the @destroy function,
367 * enables driver-specific objects derived from a ttm_buffer_object.
368 * On successful return, the object kref and list_kref are set to 1.
369 * Returns
370 * -ENOMEM: Out of memory.
371 * -EINVAL: Invalid placement flags.
372 * -ERESTART: Interrupted by signal while sleeping waiting for resources.
373 */
374
375extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
376 struct ttm_buffer_object *bo,
377 unsigned long size,
378 enum ttm_bo_type type,
379 uint32_t flags,
380 uint32_t page_alignment,
381 unsigned long buffer_start,
382 bool interrubtible,
383 struct file *persistant_swap_storage,
384 size_t acc_size,
385 void (*destroy) (struct ttm_buffer_object *));
386/**
387 * ttm_bo_synccpu_object_init
388 *
389 * @bdev: Pointer to a ttm_bo_device struct.
390 * @bo: Pointer to a ttm_buffer_object to be initialized.
391 * @size: Requested size of buffer object.
392 * @type: Requested type of buffer object.
393 * @flags: Initial placement flags.
394 * @page_alignment: Data alignment in pages.
395 * @buffer_start: Virtual address of user space data backing a
396 * user buffer object.
397 * @interruptible: If needing to sleep while waiting for GPU resources,
398 * sleep interruptible.
399 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
400 * pinned in physical memory. If this behaviour is not desired, this member
401 * holds a pointer to a persistant shmem object. Typically, this would
402 * point to the shmem object backing a GEM object if TTM is used to back a
403 * GEM user interface.
404 * @p_bo: On successful completion *p_bo points to the created object.
405 *
406 * This function allocates a ttm_buffer_object, and then calls
407 * ttm_buffer_object_init on that object.
408 * The destroy function is set to kfree().
409 * Returns
410 * -ENOMEM: Out of memory.
411 * -EINVAL: Invalid placement flags.
412 * -ERESTART: Interrupted by signal while waiting for resources.
413 */
414
415extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
416 unsigned long size,
417 enum ttm_bo_type type,
418 uint32_t flags,
419 uint32_t page_alignment,
420 unsigned long buffer_start,
421 bool interruptible,
422 struct file *persistant_swap_storage,
423 struct ttm_buffer_object **p_bo);
424
425/**
426 * ttm_bo_check_placement
427 *
428 * @bo: the buffer object.
429 * @set_flags: placement flags to set.
430 * @clr_flags: placement flags to clear.
431 *
432 * Performs minimal validity checking on an intended change of
433 * placement flags.
434 * Returns
435 * -EINVAL: Intended change is invalid or not allowed.
436 */
437
438extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
439 uint32_t set_flags, uint32_t clr_flags);
440
441/**
442 * ttm_bo_init_mm
443 *
444 * @bdev: Pointer to a ttm_bo_device struct.
445 * @mem_type: The memory type.
446 * @p_offset: offset for managed area in pages.
447 * @p_size: size managed area in pages.
448 *
449 * Initialize a manager for a given memory type.
450 * Note: if part of driver firstopen, it must be protected from a
451 * potentially racing lastclose.
452 * Returns:
453 * -EINVAL: invalid size or memory type.
454 * -ENOMEM: Not enough memory.
455 * May also return driver-specified errors.
456 */
457
458extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
459 unsigned long p_offset, unsigned long p_size);
460/**
461 * ttm_bo_clean_mm
462 *
463 * @bdev: Pointer to a ttm_bo_device struct.
464 * @mem_type: The memory type.
465 *
466 * Take down a manager for a given memory type after first walking
467 * the LRU list to evict any buffers left alive.
468 *
469 * Normally, this function is part of lastclose() or unload(), and at that
470 * point there shouldn't be any buffers left created by user-space, since
471 * there should've been removed by the file descriptor release() method.
472 * However, before this function is run, make sure to signal all sync objects,
473 * and verify that the delayed delete queue is empty. The driver must also
474 * make sure that there are no NO_EVICT buffers present in this memory type
475 * when the call is made.
476 *
477 * If this function is part of a VT switch, the caller must make sure that
478 * there are no appications currently validating buffers before this
479 * function is called. The caller can do that by first taking the
480 * struct ttm_bo_device::ttm_lock in write mode.
481 *
482 * Returns:
483 * -EINVAL: invalid or uninitialized memory type.
484 * -EBUSY: There are still buffers left in this memory type.
485 */
486
487extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
488
489/**
490 * ttm_bo_evict_mm
491 *
492 * @bdev: Pointer to a ttm_bo_device struct.
493 * @mem_type: The memory type.
494 *
495 * Evicts all buffers on the lru list of the memory type.
496 * This is normally part of a VT switch or an
497 * out-of-memory-space-due-to-fragmentation handler.
498 * The caller must make sure that there are no other processes
499 * currently validating buffers, and can do that by taking the
500 * struct ttm_bo_device::ttm_lock in write mode.
501 *
502 * Returns:
503 * -EINVAL: Invalid or uninitialized memory type.
504 * -ERESTART: The call was interrupted by a signal while waiting to
505 * evict a buffer.
506 */
507
508extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
509
510/**
511 * ttm_kmap_obj_virtual
512 *
513 * @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
514 * @is_iomem: Pointer to an integer that on return indicates 1 if the
515 * virtual map is io memory, 0 if normal memory.
516 *
517 * Returns the virtual address of a buffer object area mapped by ttm_bo_kmap.
518 * If *is_iomem is 1 on return, the virtual address points to an io memory area,
519 * that should strictly be accessed by the iowriteXX() and similar functions.
520 */
521
522static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
523 bool *is_iomem)
524{
525 *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap ||
526 map->bo_kmap_type == ttm_bo_map_premapped);
527 return map->virtual;
528}
529
530/**
531 * ttm_bo_kmap
532 *
533 * @bo: The buffer object.
534 * @start_page: The first page to map.
535 * @num_pages: Number of pages to map.
536 * @map: pointer to a struct ttm_bo_kmap_obj representing the map.
537 *
538 * Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the
539 * data in the buffer object. The ttm_kmap_obj_virtual function can then be
540 * used to obtain a virtual address to the data.
541 *
542 * Returns
543 * -ENOMEM: Out of memory.
544 * -EINVAL: Invalid range.
545 */
546
547extern int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
548 unsigned long num_pages, struct ttm_bo_kmap_obj *map);
549
550/**
551 * ttm_bo_kunmap
552 *
553 * @map: Object describing the map to unmap.
554 *
555 * Unmaps a kernel map set up by ttm_bo_kmap.
556 */
557
558extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
559
560#if 0
561#endif
562
563/**
564 * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object.
565 *
566 * @vma: vma as input from the fbdev mmap method.
567 * @bo: The bo backing the address space. The address space will
568 * have the same size as the bo, and start at offset 0.
569 *
570 * This function is intended to be called by the fbdev mmap method
571 * if the fbdev address space is to be backed by a bo.
572 */
573
574extern int ttm_fbdev_mmap(struct vm_area_struct *vma,
575 struct ttm_buffer_object *bo);
576
577/**
578 * ttm_bo_mmap - mmap out of the ttm device address space.
579 *
580 * @filp: filp as input from the mmap method.
581 * @vma: vma as input from the mmap method.
582 * @bdev: Pointer to the ttm_bo_device with the address space manager.
583 *
584 * This function is intended to be called by the device mmap method.
585 * if the device address space is to be backed by the bo manager.
586 */
587
588extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
589 struct ttm_bo_device *bdev);
590
591/**
592 * ttm_bo_io
593 *
594 * @bdev: Pointer to the struct ttm_bo_device.
595 * @filp: Pointer to the struct file attempting to read / write.
596 * @wbuf: User-space pointer to address of buffer to write. NULL on read.
597 * @rbuf: User-space pointer to address of buffer to read into.
598 * Null on write.
599 * @count: Number of bytes to read / write.
600 * @f_pos: Pointer to current file position.
601 * @write: 1 for read, 0 for write.
602 *
603 * This function implements read / write into ttm buffer objects, and is
604 * intended to
605 * be called from the fops::read and fops::write method.
606 * Returns:
607 * See man (2) write, man(2) read. In particular,
608 * the function may return -EINTR if
609 * interrupted by a signal.
610 */
611
612extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
613 const char __user *wbuf, char __user *rbuf,
614 size_t count, loff_t *f_pos, bool write);
615
616extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
617
618#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
new file mode 100644
index 000000000000..62ed733c52a2
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -0,0 +1,867 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30#ifndef _TTM_BO_DRIVER_H_
31#define _TTM_BO_DRIVER_H_
32
33#include "ttm/ttm_bo_api.h"
34#include "ttm/ttm_memory.h"
35#include "drm_mm.h"
36#include "linux/workqueue.h"
37#include "linux/fs.h"
38#include "linux/spinlock.h"
39
40struct ttm_backend;
41
42struct ttm_backend_func {
43 /**
44 * struct ttm_backend_func member populate
45 *
46 * @backend: Pointer to a struct ttm_backend.
47 * @num_pages: Number of pages to populate.
48 * @pages: Array of pointers to ttm pages.
49 * @dummy_read_page: Page to be used instead of NULL pages in the
50 * array @pages.
51 *
52 * Populate the backend with ttm pages. Depending on the backend,
53 * it may or may not copy the @pages array.
54 */
55 int (*populate) (struct ttm_backend *backend,
56 unsigned long num_pages, struct page **pages,
57 struct page *dummy_read_page);
58 /**
59 * struct ttm_backend_func member clear
60 *
61 * @backend: Pointer to a struct ttm_backend.
62 *
63 * This is an "unpopulate" function. Release all resources
64 * allocated with populate.
65 */
66 void (*clear) (struct ttm_backend *backend);
67
68 /**
69 * struct ttm_backend_func member bind
70 *
71 * @backend: Pointer to a struct ttm_backend.
72 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
73 * memory type and location for binding.
74 *
75 * Bind the backend pages into the aperture in the location
76 * indicated by @bo_mem. This function should be able to handle
77 * differences between aperture- and system page sizes.
78 */
79 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem);
80
81 /**
82 * struct ttm_backend_func member unbind
83 *
84 * @backend: Pointer to a struct ttm_backend.
85 *
86 * Unbind previously bound backend pages. This function should be
87 * able to handle differences between aperture- and system page sizes.
88 */
89 int (*unbind) (struct ttm_backend *backend);
90
91 /**
92 * struct ttm_backend_func member destroy
93 *
94 * @backend: Pointer to a struct ttm_backend.
95 *
96 * Destroy the backend.
97 */
98 void (*destroy) (struct ttm_backend *backend);
99};
100
101/**
102 * struct ttm_backend
103 *
104 * @bdev: Pointer to a struct ttm_bo_device.
105 * @flags: For driver use.
106 * @func: Pointer to a struct ttm_backend_func that describes
107 * the backend methods.
108 *
109 */
110
111struct ttm_backend {
112 struct ttm_bo_device *bdev;
113 uint32_t flags;
114 struct ttm_backend_func *func;
115};
116
117#define TTM_PAGE_FLAG_VMALLOC (1 << 0)
118#define TTM_PAGE_FLAG_USER (1 << 1)
119#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
120#define TTM_PAGE_FLAG_WRITE (1 << 3)
121#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
122#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
123#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
124
125enum ttm_caching_state {
126 tt_uncached,
127 tt_wc,
128 tt_cached
129};
130
131/**
132 * struct ttm_tt
133 *
134 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
135 * pointer.
136 * @pages: Array of pages backing the data.
137 * @first_himem_page: Himem pages are put last in the page array, which
138 * enables us to run caching attribute changes on only the first part
139 * of the page array containing lomem pages. This is the index of the
140 * first himem page.
141 * @last_lomem_page: Index of the last lomem page in the page array.
142 * @num_pages: Number of pages in the page array.
143 * @bdev: Pointer to the current struct ttm_bo_device.
144 * @be: Pointer to the ttm backend.
145 * @tsk: The task for user ttm.
146 * @start: virtual address for user ttm.
147 * @swap_storage: Pointer to shmem struct file for swap storage.
148 * @caching_state: The current caching state of the pages.
149 * @state: The current binding state of the pages.
150 *
151 * This is a structure holding the pages, caching- and aperture binding
152 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
153 * memory.
154 */
155
156struct ttm_tt {
157 struct page *dummy_read_page;
158 struct page **pages;
159 long first_himem_page;
160 long last_lomem_page;
161 uint32_t page_flags;
162 unsigned long num_pages;
163 struct ttm_bo_device *bdev;
164 struct ttm_backend *be;
165 struct task_struct *tsk;
166 unsigned long start;
167 struct file *swap_storage;
168 enum ttm_caching_state caching_state;
169 enum {
170 tt_bound,
171 tt_unbound,
172 tt_unpopulated,
173 } state;
174};
175
176#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
177#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
178#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
179 before kernel access. */
180#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
181
182/**
183 * struct ttm_mem_type_manager
184 *
185 * @has_type: The memory type has been initialized.
186 * @use_type: The memory type is enabled.
187 * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
188 * managed by this memory type.
189 * @gpu_offset: If used, the GPU offset of the first managed page of
190 * fixed memory or the first managed location in an aperture.
191 * @io_offset: The io_offset of the first managed page of IO memory or
192 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
193 * memory, this should be set to NULL.
194 * @io_size: The size of a managed IO region (fixed memory or aperture).
195 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
196 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
197 * @io_addr should be set to NULL.
198 * @size: Size of the managed region.
199 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
200 * as defined in ttm_placement_common.h
201 * @default_caching: The default caching policy used for a buffer object
202 * placed in this memory type if the user doesn't provide one.
203 * @manager: The range manager used for this memory type. FIXME: If the aperture
204 * has a page size different from the underlying system, the granularity
205 * of this manager should take care of this. But the range allocating code
206 * in ttm_bo.c needs to be modified for this.
207 * @lru: The lru list for this memory type.
208 *
209 * This structure is used to identify and manage memory types for a device.
210 * It's set up by the ttm_bo_driver::init_mem_type method.
211 */
212
213struct ttm_mem_type_manager {
214
215 /*
216 * No protection. Constant from start.
217 */
218
219 bool has_type;
220 bool use_type;
221 uint32_t flags;
222 unsigned long gpu_offset;
223 unsigned long io_offset;
224 unsigned long io_size;
225 void *io_addr;
226 uint64_t size;
227 uint32_t available_caching;
228 uint32_t default_caching;
229
230 /*
231 * Protected by the bdev->lru_lock.
232 * TODO: Consider one lru_lock per ttm_mem_type_manager.
233 * Plays ill with list removal, though.
234 */
235
236 struct drm_mm manager;
237 struct list_head lru;
238};
239
240/**
241 * struct ttm_bo_driver
242 *
243 * @mem_type_prio: Priority array of memory types to place a buffer object in
244 * if it fits without evicting buffers from any of these memory types.
245 * @mem_busy_prio: Priority array of memory types to place a buffer object in
246 * if it needs to evict buffers to make room.
247 * @num_mem_type_prio: Number of elements in the @mem_type_prio array.
248 * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array.
249 * @create_ttm_backend_entry: Callback to create a struct ttm_backend.
250 * @invalidate_caches: Callback to invalidate read caches when a buffer object
251 * has been evicted.
252 * @init_mem_type: Callback to initialize a struct ttm_mem_type_manager
253 * structure.
254 * @evict_flags: Callback to obtain placement flags when a buffer is evicted.
255 * @move: Callback for a driver to hook in accelerated functions to
256 * move a buffer.
257 * If set to NULL, a potentially slow memcpy() move is used.
258 * @sync_obj_signaled: See ttm_fence_api.h
259 * @sync_obj_wait: See ttm_fence_api.h
260 * @sync_obj_flush: See ttm_fence_api.h
261 * @sync_obj_unref: See ttm_fence_api.h
262 * @sync_obj_ref: See ttm_fence_api.h
263 */
264
265struct ttm_bo_driver {
266 const uint32_t *mem_type_prio;
267 const uint32_t *mem_busy_prio;
268 uint32_t num_mem_type_prio;
269 uint32_t num_mem_busy_prio;
270
271 /**
272 * struct ttm_bo_driver member create_ttm_backend_entry
273 *
274 * @bdev: The buffer object device.
275 *
276 * Create a driver specific struct ttm_backend.
277 */
278
279 struct ttm_backend *(*create_ttm_backend_entry)
280 (struct ttm_bo_device *bdev);
281
282 /**
283 * struct ttm_bo_driver member invalidate_caches
284 *
285 * @bdev: the buffer object device.
286 * @flags: new placement of the rebound buffer object.
287 *
288 * A previosly evicted buffer has been rebound in a
289 * potentially new location. Tell the driver that it might
290 * consider invalidating read (texture) caches on the next command
291 * submission as a consequence.
292 */
293
294 int (*invalidate_caches) (struct ttm_bo_device *bdev, uint32_t flags);
295 int (*init_mem_type) (struct ttm_bo_device *bdev, uint32_t type,
296 struct ttm_mem_type_manager *man);
297 /**
298 * struct ttm_bo_driver member evict_flags:
299 *
300 * @bo: the buffer object to be evicted
301 *
302 * Return the bo flags for a buffer which is not mapped to the hardware.
303 * These will be placed in proposed_flags so that when the move is
304 * finished, they'll end up in bo->mem.flags
305 */
306
307 uint32_t(*evict_flags) (struct ttm_buffer_object *bo);
308 /**
309 * struct ttm_bo_driver member move:
310 *
311 * @bo: the buffer to move
312 * @evict: whether this motion is evicting the buffer from
313 * the graphics address space
314 * @interruptible: Use interruptible sleeps if possible when sleeping.
315 * @no_wait: whether this should give up and return -EBUSY
316 * if this move would require sleeping
317 * @new_mem: the new memory region receiving the buffer
318 *
319 * Move a buffer between two memory regions.
320 */
321 int (*move) (struct ttm_buffer_object *bo,
322 bool evict, bool interruptible,
323 bool no_wait, struct ttm_mem_reg *new_mem);
324
325 /**
326 * struct ttm_bo_driver_member verify_access
327 *
328 * @bo: Pointer to a buffer object.
329 * @filp: Pointer to a struct file trying to access the object.
330 *
331 * Called from the map / write / read methods to verify that the
332 * caller is permitted to access the buffer object.
333 * This member may be set to NULL, which will refuse this kind of
334 * access for all buffer objects.
335 * This function should return 0 if access is granted, -EPERM otherwise.
336 */
337 int (*verify_access) (struct ttm_buffer_object *bo,
338 struct file *filp);
339
340 /**
341 * In case a driver writer dislikes the TTM fence objects,
342 * the driver writer can replace those with sync objects of
343 * his / her own. If it turns out that no driver writer is
344 * using these. I suggest we remove these hooks and plug in
345 * fences directly. The bo driver needs the following functionality:
346 * See the corresponding functions in the fence object API
347 * documentation.
348 */
349
350 bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg);
351 int (*sync_obj_wait) (void *sync_obj, void *sync_arg,
352 bool lazy, bool interruptible);
353 int (*sync_obj_flush) (void *sync_obj, void *sync_arg);
354 void (*sync_obj_unref) (void **sync_obj);
355 void *(*sync_obj_ref) (void *sync_obj);
356};
357
358#define TTM_NUM_MEM_TYPES 8
359
360#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
361 idling before CPU mapping */
362#define TTM_BO_PRIV_FLAG_MAX 1
363/**
364 * struct ttm_bo_device - Buffer object driver device-specific data.
365 *
366 * @mem_glob: Pointer to a struct ttm_mem_global object for accounting.
367 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
368 * @count: Current number of buffer object.
369 * @pages: Current number of pinned pages.
370 * @dummy_read_page: Pointer to a dummy page used for mapping requests
371 * of unpopulated pages.
372 * @shrink: A shrink callback object used for buffre object swap.
373 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
374 * used by a buffer object. This is excluding page arrays and backing pages.
375 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
376 * @man: An array of mem_type_managers.
377 * @addr_space_mm: Range manager for the device address space.
378 * lru_lock: Spinlock that protects the buffer+device lru lists and
379 * ddestroy lists.
380 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
381 * If a GPU lockup has been detected, this is forced to 0.
382 * @dev_mapping: A pointer to the struct address_space representing the
383 * device address space.
384 * @wq: Work queue structure for the delayed delete workqueue.
385 *
386 */
387
388struct ttm_bo_device {
389
390 /*
391 * Constant after bo device init / atomic.
392 */
393
394 struct ttm_mem_global *mem_glob;
395 struct ttm_bo_driver *driver;
396 struct page *dummy_read_page;
397 struct ttm_mem_shrink shrink;
398
399 size_t ttm_bo_extra_size;
400 size_t ttm_bo_size;
401
402 rwlock_t vm_lock;
403 /*
404 * Protected by the vm lock.
405 */
406 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
407 struct rb_root addr_space_rb;
408 struct drm_mm addr_space_mm;
409
410 /*
411 * Might want to change this to one lock per manager.
412 */
413 spinlock_t lru_lock;
414 /*
415 * Protected by the lru lock.
416 */
417 struct list_head ddestroy;
418 struct list_head swap_lru;
419
420 /*
421 * Protected by load / firstopen / lastclose /unload sync.
422 */
423
424 bool nice_mode;
425 struct address_space *dev_mapping;
426
427 /*
428 * Internal protection.
429 */
430
431 struct delayed_work wq;
432};
433
434/**
435 * ttm_flag_masked
436 *
437 * @old: Pointer to the result and original value.
438 * @new: New value of bits.
439 * @mask: Mask of bits to change.
440 *
441 * Convenience function to change a number of bits identified by a mask.
442 */
443
444static inline uint32_t
445ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
446{
447 *old ^= (*old ^ new) & mask;
448 return *old;
449}
450
451/**
452 * ttm_tt_create
453 *
454 * @bdev: pointer to a struct ttm_bo_device:
455 * @size: Size of the data needed backing.
456 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
457 * @dummy_read_page: See struct ttm_bo_device.
458 *
459 * Create a struct ttm_tt to back data with system memory pages.
460 * No pages are actually allocated.
461 * Returns:
462 * NULL: Out of memory.
463 */
464extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev,
465 unsigned long size,
466 uint32_t page_flags,
467 struct page *dummy_read_page);
468
469/**
470 * ttm_tt_set_user:
471 *
472 * @ttm: The struct ttm_tt to populate.
473 * @tsk: A struct task_struct for which @start is a valid user-space address.
474 * @start: A valid user-space address.
475 * @num_pages: Size in pages of the user memory area.
476 *
477 * Populate a struct ttm_tt with a user-space memory area after first pinning
478 * the pages backing it.
479 * Returns:
480 * !0: Error.
481 */
482
483extern int ttm_tt_set_user(struct ttm_tt *ttm,
484 struct task_struct *tsk,
485 unsigned long start, unsigned long num_pages);
486
487/**
488 * ttm_ttm_bind:
489 *
490 * @ttm: The struct ttm_tt containing backing pages.
491 * @bo_mem: The struct ttm_mem_reg identifying the binding location.
492 *
493 * Bind the pages of @ttm to an aperture location identified by @bo_mem
494 */
495extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
496
497/**
498 * ttm_ttm_destroy:
499 *
500 * @ttm: The struct ttm_tt.
501 *
502 * Unbind, unpopulate and destroy a struct ttm_tt.
503 */
504extern void ttm_tt_destroy(struct ttm_tt *ttm);
505
506/**
507 * ttm_ttm_unbind:
508 *
509 * @ttm: The struct ttm_tt.
510 *
511 * Unbind a struct ttm_tt.
512 */
513extern void ttm_tt_unbind(struct ttm_tt *ttm);
514
515/**
516 * ttm_ttm_destroy:
517 *
518 * @ttm: The struct ttm_tt.
519 * @index: Index of the desired page.
520 *
521 * Return a pointer to the struct page backing @ttm at page
522 * index @index. If the page is unpopulated, one will be allocated to
523 * populate that index.
524 *
525 * Returns:
526 * NULL on OOM.
527 */
528extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index);
529
530/**
531 * ttm_tt_cache_flush:
532 *
533 * @pages: An array of pointers to struct page:s to flush.
534 * @num_pages: Number of pages to flush.
535 *
536 * Flush the data of the indicated pages from the cpu caches.
537 * This is used when changing caching attributes of the pages from
538 * cache-coherent.
539 */
540extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
541
542/**
543 * ttm_tt_set_placement_caching:
544 *
545 * @ttm A struct ttm_tt the backing pages of which will change caching policy.
546 * @placement: Flag indicating the desired caching policy.
547 *
548 * This function will change caching policy of any default kernel mappings of
549 * the pages backing @ttm. If changing from cached to uncached or
550 * write-combined,
551 * all CPU caches will first be flushed to make sure the data of the pages
552 * hit RAM. This function may be very costly as it involves global TLB
553 * and cache flushes and potential page splitting / combining.
554 */
555extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
556extern int ttm_tt_swapout(struct ttm_tt *ttm,
557 struct file *persistant_swap_storage);
558
559/*
560 * ttm_bo.c
561 */
562
563/**
564 * ttm_mem_reg_is_pci
565 *
566 * @bdev: Pointer to a struct ttm_bo_device.
567 * @mem: A valid struct ttm_mem_reg.
568 *
569 * Returns true if the memory described by @mem is PCI memory,
570 * false otherwise.
571 */
572extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
573 struct ttm_mem_reg *mem);
574
575/**
576 * ttm_bo_mem_space
577 *
578 * @bo: Pointer to a struct ttm_buffer_object. the data of which
579 * we want to allocate space for.
580 * @proposed_placement: Proposed new placement for the buffer object.
581 * @mem: A struct ttm_mem_reg.
582 * @interruptible: Sleep interruptible when sliping.
583 * @no_wait: Don't sleep waiting for space to become available.
584 *
585 * Allocate memory space for the buffer object pointed to by @bo, using
586 * the placement flags in @mem, potentially evicting other idle buffer objects.
587 * This function may sleep while waiting for space to become available.
588 * Returns:
589 * -EBUSY: No space available (only if no_wait == 1).
590 * -ENOMEM: Could not allocate memory for the buffer object, either due to
591 * fragmentation or concurrent allocators.
592 * -ERESTART: An interruptible sleep was interrupted by a signal.
593 */
594extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
595 uint32_t proposed_placement,
596 struct ttm_mem_reg *mem,
597 bool interruptible, bool no_wait);
598/**
599 * ttm_bo_wait_for_cpu
600 *
601 * @bo: Pointer to a struct ttm_buffer_object.
602 * @no_wait: Don't sleep while waiting.
603 *
604 * Wait until a buffer object is no longer sync'ed for CPU access.
605 * Returns:
606 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
607 * -ERESTART: An interruptible sleep was interrupted by a signal.
608 */
609
610extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
611
612/**
613 * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory.
614 *
615 * @bo Pointer to a struct ttm_buffer_object.
616 * @bus_base On return the base of the PCI region
617 * @bus_offset On return the byte offset into the PCI region
618 * @bus_size On return the byte size of the buffer object or zero if
619 * the buffer object memory is not accessible through a PCI region.
620 *
621 * Returns:
622 * -EINVAL if the buffer object is currently not mappable.
623 * 0 otherwise.
624 */
625
626extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
627 struct ttm_mem_reg *mem,
628 unsigned long *bus_base,
629 unsigned long *bus_offset,
630 unsigned long *bus_size);
631
632extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
633
634/**
635 * ttm_bo_device_init
636 *
637 * @bdev: A pointer to a struct ttm_bo_device to initialize.
638 * @mem_global: A pointer to an initialized struct ttm_mem_global.
639 * @driver: A pointer to a struct ttm_bo_driver set up by the caller.
640 * @file_page_offset: Offset into the device address space that is available
641 * for buffer data. This ensures compatibility with other users of the
642 * address space.
643 *
644 * Initializes a struct ttm_bo_device:
645 * Returns:
646 * !0: Failure.
647 */
648extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
649 struct ttm_mem_global *mem_glob,
650 struct ttm_bo_driver *driver,
651 uint64_t file_page_offset);
652
653/**
654 * ttm_bo_reserve:
655 *
656 * @bo: A pointer to a struct ttm_buffer_object.
657 * @interruptible: Sleep interruptible if waiting.
658 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
659 * @use_sequence: If @bo is already reserved, Only sleep waiting for
660 * it to become unreserved if @sequence < (@bo)->sequence.
661 *
662 * Locks a buffer object for validation. (Or prevents other processes from
663 * locking it for validation) and removes it from lru lists, while taking
664 * a number of measures to prevent deadlocks.
665 *
666 * Deadlocks may occur when two processes try to reserve multiple buffers in
667 * different order, either by will or as a result of a buffer being evicted
668 * to make room for a buffer already reserved. (Buffers are reserved before
669 * they are evicted). The following algorithm prevents such deadlocks from
670 * occuring:
671 * 1) Buffers are reserved with the lru spinlock held. Upon successful
672 * reservation they are removed from the lru list. This stops a reserved buffer
673 * from being evicted. However the lru spinlock is released between the time
674 * a buffer is selected for eviction and the time it is reserved.
675 * Therefore a check is made when a buffer is reserved for eviction, that it
676 * is still the first buffer in the lru list, before it is removed from the
677 * list. @check_lru == 1 forces this check. If it fails, the function returns
678 * -EINVAL, and the caller should then choose a new buffer to evict and repeat
679 * the procedure.
680 * 2) Processes attempting to reserve multiple buffers other than for eviction,
681 * (typically execbuf), should first obtain a unique 32-bit
682 * validation sequence number,
683 * and call this function with @use_sequence == 1 and @sequence == the unique
684 * sequence number. If upon call of this function, the buffer object is already
685 * reserved, the validation sequence is checked against the validation
686 * sequence of the process currently reserving the buffer,
687 * and if the current validation sequence is greater than that of the process
688 * holding the reservation, the function returns -EAGAIN. Otherwise it sleeps
689 * waiting for the buffer to become unreserved, after which it retries
690 * reserving.
691 * The caller should, when receiving an -EAGAIN error
692 * release all its buffer reservations, wait for @bo to become unreserved, and
693 * then rerun the validation with the same validation sequence. This procedure
694 * will always guarantee that the process with the lowest validation sequence
695 * will eventually succeed, preventing both deadlocks and starvation.
696 *
697 * Returns:
698 * -EAGAIN: The reservation may cause a deadlock.
699 * Release all buffer reservations, wait for @bo to become unreserved and
700 * try again. (only if use_sequence == 1).
701 * -ERESTART: A wait for the buffer to become unreserved was interrupted by
702 * a signal. Release all buffer reservations and return to user-space.
703 */
704extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
705 bool interruptible,
706 bool no_wait, bool use_sequence, uint32_t sequence);
707
708/**
709 * ttm_bo_unreserve
710 *
711 * @bo: A pointer to a struct ttm_buffer_object.
712 *
713 * Unreserve a previous reservation of @bo.
714 */
715extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
716
717/**
718 * ttm_bo_wait_unreserved
719 *
720 * @bo: A pointer to a struct ttm_buffer_object.
721 *
722 * Wait for a struct ttm_buffer_object to become unreserved.
723 * This is typically used in the execbuf code to relax cpu-usage when
724 * a potential deadlock condition backoff.
725 */
726extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
727 bool interruptible);
728
729/**
730 * ttm_bo_block_reservation
731 *
732 * @bo: A pointer to a struct ttm_buffer_object.
733 * @interruptible: Use interruptible sleep when waiting.
734 * @no_wait: Don't sleep, but rather return -EBUSY.
735 *
736 * Block reservation for validation by simply reserving the buffer.
737 * This is intended for single buffer use only without eviction,
738 * and thus needs no deadlock protection.
739 *
740 * Returns:
741 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
742 * -ERESTART: If interruptible == 1 and the process received a signal
743 * while sleeping.
744 */
745extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
746 bool interruptible, bool no_wait);
747
748/**
749 * ttm_bo_unblock_reservation
750 *
751 * @bo: A pointer to a struct ttm_buffer_object.
752 *
753 * Unblocks reservation leaving lru lists untouched.
754 */
755extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
756
757/*
758 * ttm_bo_util.c
759 */
760
761/**
762 * ttm_bo_move_ttm
763 *
764 * @bo: A pointer to a struct ttm_buffer_object.
765 * @evict: 1: This is an eviction. Don't try to pipeline.
766 * @no_wait: Never sleep, but rather return with -EBUSY.
767 * @new_mem: struct ttm_mem_reg indicating where to move.
768 *
769 * Optimized move function for a buffer object with both old and
770 * new placement backed by a TTM. The function will, if successful,
771 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
772 * and update the (@bo)->mem placement flags. If unsuccessful, the old
773 * data remains untouched, and it's up to the caller to free the
774 * memory space indicated by @new_mem.
775 * Returns:
776 * !0: Failure.
777 */
778
779extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
780 bool evict, bool no_wait,
781 struct ttm_mem_reg *new_mem);
782
783/**
784 * ttm_bo_move_memcpy
785 *
786 * @bo: A pointer to a struct ttm_buffer_object.
787 * @evict: 1: This is an eviction. Don't try to pipeline.
788 * @no_wait: Never sleep, but rather return with -EBUSY.
789 * @new_mem: struct ttm_mem_reg indicating where to move.
790 *
791 * Fallback move function for a mappable buffer object in mappable memory.
792 * The function will, if successful,
793 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
794 * and update the (@bo)->mem placement flags. If unsuccessful, the old
795 * data remains untouched, and it's up to the caller to free the
796 * memory space indicated by @new_mem.
797 * Returns:
798 * !0: Failure.
799 */
800
801extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
802 bool evict,
803 bool no_wait, struct ttm_mem_reg *new_mem);
804
805/**
806 * ttm_bo_free_old_node
807 *
808 * @bo: A pointer to a struct ttm_buffer_object.
809 *
810 * Utility function to free an old placement after a successful move.
811 */
812extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
813
814/**
815 * ttm_bo_move_accel_cleanup.
816 *
817 * @bo: A pointer to a struct ttm_buffer_object.
818 * @sync_obj: A sync object that signals when moving is complete.
819 * @sync_obj_arg: An argument to pass to the sync object idle / wait
820 * functions.
821 * @evict: This is an evict move. Don't return until the buffer is idle.
822 * @no_wait: Never sleep, but rather return with -EBUSY.
823 * @new_mem: struct ttm_mem_reg indicating where to move.
824 *
825 * Accelerated move function to be called when an accelerated move
826 * has been scheduled. The function will create a new temporary buffer object
827 * representing the old placement, and put the sync object on both buffer
828 * objects. After that the newly created buffer object is unref'd to be
829 * destroyed when the move is complete. This will help pipeline
830 * buffer moves.
831 */
832
833extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
834 void *sync_obj,
835 void *sync_obj_arg,
836 bool evict, bool no_wait,
837 struct ttm_mem_reg *new_mem);
838/**
839 * ttm_io_prot
840 *
841 * @c_state: Caching state.
842 * @tmp: Page protection flag for a normal, cached mapping.
843 *
844 * Utility function that returns the pgprot_t that should be used for
845 * setting up a PTE with the caching model indicated by @c_state.
846 */
847extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp);
848
849#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
850#define TTM_HAS_AGP
851#include <linux/agp_backend.h>
852
853/**
854 * ttm_agp_backend_init
855 *
856 * @bdev: Pointer to a struct ttm_bo_device.
857 * @bridge: The agp bridge this device is sitting on.
858 *
859 * Create a TTM backend that uses the indicated AGP bridge as an aperture
860 * for TT memory. This function uses the linux agpgart interface to
861 * bind and unbind memory backing a ttm_tt.
862 */
863extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev,
864 struct agp_bridge_data *bridge);
865#endif
866
867#endif
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
new file mode 100644
index 000000000000..d8b8f042c4f1
--- /dev/null
+++ b/include/drm/ttm/ttm_memory.h
@@ -0,0 +1,153 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#ifndef TTM_MEMORY_H
29#define TTM_MEMORY_H
30
31#include <linux/workqueue.h>
32#include <linux/spinlock.h>
33#include <linux/wait.h>
34#include <linux/errno.h>
35
36/**
37 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
38 *
39 * @do_shrink: The callback function.
40 *
41 * Arguments to the do_shrink functions are intended to be passed using
42 * inheritance. That is, the argument class derives from struct ttm_mem_srink,
43 * and can be accessed using container_of().
44 */
45
46struct ttm_mem_shrink {
47 int (*do_shrink) (struct ttm_mem_shrink *);
48};
49
50/**
51 * struct ttm_mem_global - Global memory accounting structure.
52 *
53 * @shrink: A single callback to shrink TTM memory usage. Extend this
54 * to a linked list to be able to handle multiple callbacks when needed.
55 * @swap_queue: A workqueue to handle shrinking in low memory situations. We
56 * need a separate workqueue since it will spend a lot of time waiting
57 * for the GPU, and this will otherwise block other workqueue tasks(?)
58 * At this point we use only a single-threaded workqueue.
59 * @work: The workqueue callback for the shrink queue.
60 * @queue: Wait queue for processes suspended waiting for memory.
61 * @lock: Lock to protect the @shrink - and the memory accounting members,
62 * that is, essentially the whole structure with some exceptions.
63 * @emer_memory: Lowmem memory limit available for root.
64 * @max_memory: Lowmem memory limit available for non-root.
65 * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in.
66 * @used_memory: Currently used lowmem memory.
67 * @used_total_memory: Currently used total (lowmem + highmem) memory.
68 * @total_memory_swap_limit: Total memory limit where the shrink workqueue
69 * kicks in.
70 * @max_total_memory: Total memory available to non-root processes.
71 * @emer_total_memory: Total memory available to root processes.
72 *
73 * Note that this structure is not per device. It should be global for all
74 * graphics devices.
75 */
76
77struct ttm_mem_global {
78 struct ttm_mem_shrink *shrink;
79 struct workqueue_struct *swap_queue;
80 struct work_struct work;
81 wait_queue_head_t queue;
82 spinlock_t lock;
83 uint64_t emer_memory;
84 uint64_t max_memory;
85 uint64_t swap_limit;
86 uint64_t used_memory;
87 uint64_t used_total_memory;
88 uint64_t total_memory_swap_limit;
89 uint64_t max_total_memory;
90 uint64_t emer_total_memory;
91};
92
93/**
94 * ttm_mem_init_shrink - initialize a struct ttm_mem_shrink object
95 *
96 * @shrink: The object to initialize.
97 * @func: The callback function.
98 */
99
100static inline void ttm_mem_init_shrink(struct ttm_mem_shrink *shrink,
101 int (*func) (struct ttm_mem_shrink *))
102{
103 shrink->do_shrink = func;
104}
105
106/**
107 * ttm_mem_register_shrink - register a struct ttm_mem_shrink object.
108 *
109 * @glob: The struct ttm_mem_global object to register with.
110 * @shrink: An initialized struct ttm_mem_shrink object to register.
111 *
112 * Returns:
113 * -EBUSY: There's already a callback registered. (May change).
114 */
115
116static inline int ttm_mem_register_shrink(struct ttm_mem_global *glob,
117 struct ttm_mem_shrink *shrink)
118{
119 spin_lock(&glob->lock);
120 if (glob->shrink != NULL) {
121 spin_unlock(&glob->lock);
122 return -EBUSY;
123 }
124 glob->shrink = shrink;
125 spin_unlock(&glob->lock);
126 return 0;
127}
128
129/**
130 * ttm_mem_unregister_shrink - unregister a struct ttm_mem_shrink object.
131 *
132 * @glob: The struct ttm_mem_global object to unregister from.
133 * @shrink: A previously registert struct ttm_mem_shrink object.
134 *
135 */
136
137static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
138 struct ttm_mem_shrink *shrink)
139{
140 spin_lock(&glob->lock);
141 BUG_ON(glob->shrink != shrink);
142 glob->shrink = NULL;
143 spin_unlock(&glob->lock);
144}
145
146extern int ttm_mem_global_init(struct ttm_mem_global *glob);
147extern void ttm_mem_global_release(struct ttm_mem_global *glob);
148extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
149 bool no_wait, bool interruptible, bool himem);
150extern void ttm_mem_global_free(struct ttm_mem_global *glob,
151 uint64_t amount, bool himem);
152extern size_t ttm_round_pot(size_t size);
153#endif
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
new file mode 100644
index 000000000000..889a4c7958ae
--- /dev/null
+++ b/include/drm/ttm/ttm_module.h
@@ -0,0 +1,58 @@
1/**************************************************************************
2 *
3 * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_MODULE_H_
32#define _TTM_MODULE_H_
33
34#include <linux/kernel.h>
35
36#define TTM_PFX "[TTM]"
37
38enum ttm_global_types {
39 TTM_GLOBAL_TTM_MEM = 0,
40 TTM_GLOBAL_TTM_BO,
41 TTM_GLOBAL_TTM_OBJECT,
42 TTM_GLOBAL_NUM
43};
44
45struct ttm_global_reference {
46 enum ttm_global_types global_type;
47 size_t size;
48 void *object;
49 int (*init) (struct ttm_global_reference *);
50 void (*release) (struct ttm_global_reference *);
51};
52
53extern void ttm_global_init(void);
54extern void ttm_global_release(void);
55extern int ttm_global_item_ref(struct ttm_global_reference *ref);
56extern void ttm_global_item_unref(struct ttm_global_reference *ref);
57
58#endif /* _TTM_MODULE_H_ */
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
new file mode 100644
index 000000000000..c84ff153a564
--- /dev/null
+++ b/include/drm/ttm/ttm_placement.h
@@ -0,0 +1,92 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_PLACEMENT_H_
32#define _TTM_PLACEMENT_H_
33/*
34 * Memory regions for data placement.
35 */
36
37#define TTM_PL_SYSTEM 0
38#define TTM_PL_TT 1
39#define TTM_PL_VRAM 2
40#define TTM_PL_PRIV0 3
41#define TTM_PL_PRIV1 4
42#define TTM_PL_PRIV2 5
43#define TTM_PL_PRIV3 6
44#define TTM_PL_PRIV4 7
45#define TTM_PL_PRIV5 8
46#define TTM_PL_SWAPPED 15
47
48#define TTM_PL_FLAG_SYSTEM (1 << TTM_PL_SYSTEM)
49#define TTM_PL_FLAG_TT (1 << TTM_PL_TT)
50#define TTM_PL_FLAG_VRAM (1 << TTM_PL_VRAM)
51#define TTM_PL_FLAG_PRIV0 (1 << TTM_PL_PRIV0)
52#define TTM_PL_FLAG_PRIV1 (1 << TTM_PL_PRIV1)
53#define TTM_PL_FLAG_PRIV2 (1 << TTM_PL_PRIV2)
54#define TTM_PL_FLAG_PRIV3 (1 << TTM_PL_PRIV3)
55#define TTM_PL_FLAG_PRIV4 (1 << TTM_PL_PRIV4)
56#define TTM_PL_FLAG_PRIV5 (1 << TTM_PL_PRIV5)
57#define TTM_PL_FLAG_SWAPPED (1 << TTM_PL_SWAPPED)
58#define TTM_PL_MASK_MEM 0x0000FFFF
59
60/*
61 * Other flags that affects data placement.
62 * TTM_PL_FLAG_CACHED indicates cache-coherent mappings
63 * if available.
64 * TTM_PL_FLAG_SHARED means that another application may
65 * reference the buffer.
66 * TTM_PL_FLAG_NO_EVICT means that the buffer may never
67 * be evicted to make room for other buffers.
68 */
69
70#define TTM_PL_FLAG_CACHED (1 << 16)
71#define TTM_PL_FLAG_UNCACHED (1 << 17)
72#define TTM_PL_FLAG_WC (1 << 18)
73#define TTM_PL_FLAG_SHARED (1 << 20)
74#define TTM_PL_FLAG_NO_EVICT (1 << 21)
75
76#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \
77 TTM_PL_FLAG_UNCACHED | \
78 TTM_PL_FLAG_WC)
79
80#define TTM_PL_MASK_MEMTYPE (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
81
82/*
83 * Access flags to be used for CPU- and GPU- mappings.
84 * The idea is that the TTM synchronization mechanism will
85 * allow concurrent READ access and exclusive write access.
86 * Currently GPU- and CPU accesses are exclusive.
87 */
88
89#define TTM_ACCESS_READ (1 << 0)
90#define TTM_ACCESS_WRITE (1 << 1)
91
92#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b3afd2219ad2..a2df7030d49d 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -311,6 +311,7 @@ unifdef-y += ppp-comp.h
311unifdef-y += ptrace.h 311unifdef-y += ptrace.h
312unifdef-y += quota.h 312unifdef-y += quota.h
313unifdef-y += random.h 313unifdef-y += random.h
314unifdef-y += rfkill.h
314unifdef-y += irqnr.h 315unifdef-y += irqnr.h
315unifdef-y += reboot.h 316unifdef-y += reboot.h
316unifdef-y += reiserfs_fs.h 317unifdef-y += reiserfs_fs.h
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
new file mode 100644
index 000000000000..dcad0ffd1755
--- /dev/null
+++ b/include/linux/amba/pl022.h
@@ -0,0 +1,264 @@
1/*
2 * include/linux/amba/pl022.h
3 *
4 * Copyright (C) 2008-2009 ST-Ericsson AB
5 * Copyright (C) 2006 STMicroelectronics Pvt. Ltd.
6 *
7 * Author: Linus Walleij <linus.walleij@stericsson.com>
8 *
9 * Initial version inspired by:
10 * linux-2.6.17-rc3-mm1/drivers/spi/pxa2xx_spi.c
11 * Initial adoption to PL022 by:
12 * Sachin Verma <sachin.verma@st.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 */
24
25#ifndef _SSP_PL022_H
26#define _SSP_PL022_H
27
28#include <linux/device.h>
29
30/**
31 * whether SSP is in loopback mode or not
32 */
33enum ssp_loopback {
34 LOOPBACK_DISABLED,
35 LOOPBACK_ENABLED
36};
37
38/**
39 * enum ssp_interface - interfaces allowed for this SSP Controller
40 * @SSP_INTERFACE_MOTOROLA_SPI: Motorola Interface
41 * @SSP_INTERFACE_TI_SYNC_SERIAL: Texas Instrument Synchronous Serial
42 * interface
43 * @SSP_INTERFACE_NATIONAL_MICROWIRE: National Semiconductor Microwire
44 * interface
45 * @SSP_INTERFACE_UNIDIRECTIONAL: Unidirectional interface (STn8810
46 * &STn8815 only)
47 */
48enum ssp_interface {
49 SSP_INTERFACE_MOTOROLA_SPI,
50 SSP_INTERFACE_TI_SYNC_SERIAL,
51 SSP_INTERFACE_NATIONAL_MICROWIRE,
52 SSP_INTERFACE_UNIDIRECTIONAL
53};
54
55/**
56 * enum ssp_hierarchy - whether SSP is configured as Master or Slave
57 */
58enum ssp_hierarchy {
59 SSP_MASTER,
60 SSP_SLAVE
61};
62
63/**
64 * enum ssp_clock_params - clock parameters, to set SSP clock at a
65 * desired freq
66 */
67struct ssp_clock_params {
68 u8 cpsdvsr; /* value from 2 to 254 (even only!) */
69 u8 scr; /* value from 0 to 255 */
70};
71
72/**
73 * enum ssp_rx_endian - endianess of Rx FIFO Data
74 */
75enum ssp_rx_endian {
76 SSP_RX_MSB,
77 SSP_RX_LSB
78};
79
80/**
81 * enum ssp_tx_endian - endianess of Tx FIFO Data
82 */
83enum ssp_tx_endian {
84 SSP_TX_MSB,
85 SSP_TX_LSB
86};
87
88/**
89 * enum ssp_data_size - number of bits in one data element
90 */
91enum ssp_data_size {
92 SSP_DATA_BITS_4 = 0x03, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
93 SSP_DATA_BITS_7, SSP_DATA_BITS_8, SSP_DATA_BITS_9,
94 SSP_DATA_BITS_10, SSP_DATA_BITS_11, SSP_DATA_BITS_12,
95 SSP_DATA_BITS_13, SSP_DATA_BITS_14, SSP_DATA_BITS_15,
96 SSP_DATA_BITS_16, SSP_DATA_BITS_17, SSP_DATA_BITS_18,
97 SSP_DATA_BITS_19, SSP_DATA_BITS_20, SSP_DATA_BITS_21,
98 SSP_DATA_BITS_22, SSP_DATA_BITS_23, SSP_DATA_BITS_24,
99 SSP_DATA_BITS_25, SSP_DATA_BITS_26, SSP_DATA_BITS_27,
100 SSP_DATA_BITS_28, SSP_DATA_BITS_29, SSP_DATA_BITS_30,
101 SSP_DATA_BITS_31, SSP_DATA_BITS_32
102};
103
104/**
105 * enum ssp_mode - SSP mode of operation (Communication modes)
106 */
107enum ssp_mode {
108 INTERRUPT_TRANSFER,
109 POLLING_TRANSFER,
110 DMA_TRANSFER
111};
112
113/**
114 * enum ssp_rx_level_trig - receive FIFO watermark level which triggers
115 * IT: Interrupt fires when _N_ or more elements in RX FIFO.
116 */
117enum ssp_rx_level_trig {
118 SSP_RX_1_OR_MORE_ELEM,
119 SSP_RX_4_OR_MORE_ELEM,
120 SSP_RX_8_OR_MORE_ELEM,
121 SSP_RX_16_OR_MORE_ELEM,
122 SSP_RX_32_OR_MORE_ELEM
123};
124
125/**
126 * Transmit FIFO watermark level which triggers (IT Interrupt fires
127 * when _N_ or more empty locations in TX FIFO)
128 */
129enum ssp_tx_level_trig {
130 SSP_TX_1_OR_MORE_EMPTY_LOC,
131 SSP_TX_4_OR_MORE_EMPTY_LOC,
132 SSP_TX_8_OR_MORE_EMPTY_LOC,
133 SSP_TX_16_OR_MORE_EMPTY_LOC,
134 SSP_TX_32_OR_MORE_EMPTY_LOC
135};
136
137/**
138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139 * @SSP_CLK_RISING_EDGE: Receive data on rising edge
140 * @SSP_CLK_FALLING_EDGE: Receive data on falling edge
141 */
142enum ssp_spi_clk_phase {
143 SSP_CLK_RISING_EDGE,
144 SSP_CLK_FALLING_EDGE
145};
146
147/**
148 * enum SPI Clock Polarity - clock polarity (Motorola SPI interface only)
149 * @SSP_CLK_POL_IDLE_LOW: Low inactive level
150 * @SSP_CLK_POL_IDLE_HIGH: High inactive level
151 */
152enum ssp_spi_clk_pol {
153 SSP_CLK_POL_IDLE_LOW,
154 SSP_CLK_POL_IDLE_HIGH
155};
156
157/**
158 * Microwire Conrol Lengths Command size in microwire format
159 */
160enum ssp_microwire_ctrl_len {
161 SSP_BITS_4 = 0x03, SSP_BITS_5, SSP_BITS_6,
162 SSP_BITS_7, SSP_BITS_8, SSP_BITS_9,
163 SSP_BITS_10, SSP_BITS_11, SSP_BITS_12,
164 SSP_BITS_13, SSP_BITS_14, SSP_BITS_15,
165 SSP_BITS_16, SSP_BITS_17, SSP_BITS_18,
166 SSP_BITS_19, SSP_BITS_20, SSP_BITS_21,
167 SSP_BITS_22, SSP_BITS_23, SSP_BITS_24,
168 SSP_BITS_25, SSP_BITS_26, SSP_BITS_27,
169 SSP_BITS_28, SSP_BITS_29, SSP_BITS_30,
170 SSP_BITS_31, SSP_BITS_32
171};
172
173/**
174 * enum Microwire Wait State
175 * @SSP_MWIRE_WAIT_ZERO: No wait state inserted after last command bit
176 * @SSP_MWIRE_WAIT_ONE: One wait state inserted after last command bit
177 */
178enum ssp_microwire_wait_state {
179 SSP_MWIRE_WAIT_ZERO,
180 SSP_MWIRE_WAIT_ONE
181};
182
183/**
184 * enum Microwire - whether Full/Half Duplex
185 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
186 * SSPRXD not used
187 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
188 * an input.
189 */
190enum ssp_duplex {
191 SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
192 SSP_MICROWIRE_CHANNEL_HALF_DUPLEX
193};
194
195/**
196 * CHIP select/deselect commands
197 */
198enum ssp_chip_select {
199 SSP_CHIP_SELECT,
200 SSP_CHIP_DESELECT
201};
202
203
204/**
205 * struct pl022_ssp_master - device.platform_data for SPI controller devices.
206 * @num_chipselect: chipselects are used to distinguish individual
207 * SPI slaves, and are numbered from zero to num_chipselects - 1.
208 * each slave has a chipselect signal, but it's common that not
209 * every chipselect is connected to a slave.
210 * @enable_dma: if true enables DMA driven transfers.
211 */
212struct pl022_ssp_controller {
213 u16 bus_id;
214 u8 num_chipselect;
215 u8 enable_dma:1;
216};
217
218/**
219 * struct ssp_config_chip - spi_board_info.controller_data for SPI
220 * slave devices, copied to spi_device.controller_data.
221 *
222 * @lbm: used for test purpose to internally connect RX and TX
223 * @iface: Interface type(Motorola, TI, Microwire, Universal)
224 * @hierarchy: sets whether interface is master or slave
225 * @slave_tx_disable: SSPTXD is disconnected (in slave mode only)
226 * @clk_freq: Tune freq parameters of SSP(when in master mode)
227 * @endian_rx: Endianess of Data in Rx FIFO
228 * @endian_tx: Endianess of Data in Tx FIFO
229 * @data_size: Width of data element(4 to 32 bits)
230 * @com_mode: communication mode: polling, Interrupt or DMA
231 * @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode)
232 * @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode)
233 * @clk_phase: Motorola SPI interface Clock phase
234 * @clk_pol: Motorola SPI interface Clock polarity
235 * @ctrl_len: Microwire interface: Control length
236 * @wait_state: Microwire interface: Wait state
237 * @duplex: Microwire interface: Full/Half duplex
238 * @cs_control: function pointer to board-specific function to
239 * assert/deassert I/O port to control HW generation of devices chip-select.
240 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
241 * @dma_config: DMA configuration for SSP controller and peripheral
242 */
243struct pl022_config_chip {
244 struct device *dev;
245 enum ssp_loopback lbm;
246 enum ssp_interface iface;
247 enum ssp_hierarchy hierarchy;
248 bool slave_tx_disable;
249 struct ssp_clock_params clk_freq;
250 enum ssp_rx_endian endian_rx;
251 enum ssp_tx_endian endian_tx;
252 enum ssp_data_size data_size;
253 enum ssp_mode com_mode;
254 enum ssp_rx_level_trig rx_lev_trig;
255 enum ssp_tx_level_trig tx_lev_trig;
256 enum ssp_spi_clk_phase clk_phase;
257 enum ssp_spi_clk_pol clk_pol;
258 enum ssp_microwire_ctrl_len ctrl_len;
259 enum ssp_microwire_wait_state wait_state;
260 enum ssp_duplex duplex;
261 void (*cs_control) (u32 control);
262};
263
264#endif /* _SSP_PL022_H */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 64a982ea5d5f..5a5a7fd62490 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -114,6 +114,9 @@
114#define UART011_IFLS_TX4_8 (2 << 0) 114#define UART011_IFLS_TX4_8 (2 << 0)
115#define UART011_IFLS_TX6_8 (3 << 0) 115#define UART011_IFLS_TX6_8 (3 << 0)
116#define UART011_IFLS_TX7_8 (4 << 0) 116#define UART011_IFLS_TX7_8 (4 << 0)
117/* special values for ST vendor with deeper fifo */
118#define UART011_IFLS_RX_HALF (5 << 3)
119#define UART011_IFLS_TX_HALF (5 << 0)
117 120
118#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */ 121#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
119#define UART011_BEIM (1 << 9) /* break error interrupt mask */ 122#define UART011_BEIM (1 << 9) /* break error interrupt mask */
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 2f1f95737acb..57b1846a3c87 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -10,6 +10,7 @@
10 * @bus_width: Number of data lines wired up the slot 10 * @bus_width: Number of data lines wired up the slot
11 * @detect_pin: GPIO pin wired to the card detect switch 11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor 12 * @wp_pin: GPIO pin wired to the write protect sensor
13 * @detect_is_active_high: The state of the detect pin when it is active
13 * 14 *
14 * If a given slot is not present on the board, @bus_width should be 15 * If a given slot is not present on the board, @bus_width should be
15 * set to 0. The other fields are ignored in this case. 16 * set to 0. The other fields are ignored in this case.
@@ -24,6 +25,7 @@ struct mci_slot_pdata {
24 unsigned int bus_width; 25 unsigned int bus_width;
25 int detect_pin; 26 int detect_pin;
26 int wp_pin; 27 int wp_pin;
28 bool detect_is_active_high;
27}; 29};
28 30
29/** 31/**
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 12737be58601..2a04eb54c0dd 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
590 bl->head = bl2->head; 590 bl->head = bl2->head;
591} 591}
592 592
593static inline struct bio *bio_list_peek(struct bio_list *bl)
594{
595 return bl->head;
596}
597
593static inline struct bio *bio_list_pop(struct bio_list *bl) 598static inline struct bio *bio_list_pop(struct bio_list *bl)
594{ 599{
595 struct bio *bio = bl->head; 600 struct bio *bio = bl->head;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0b1a6cae9de1..8963d9149b5f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -926,6 +926,7 @@ extern void blk_queue_alignment_offset(struct request_queue *q,
926 unsigned int alignment); 926 unsigned int alignment);
927extern void blk_queue_io_min(struct request_queue *q, unsigned int min); 927extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
928extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 928extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
929extern void blk_set_default_limits(struct queue_limits *lim);
929extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 930extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
930 sector_t offset); 931 sector_t offset);
931extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, 932extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 54398d2c6d8d..d276b5510c83 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_BUG_H 1#ifndef _LINUX_BUG_H
2#define _LINUX_BUG_H 2#define _LINUX_BUG_H
3 3
4#include <linux/module.h>
5#include <asm/bug.h> 4#include <asm/bug.h>
6 5
7enum bug_trap_type { 6enum bug_trap_type {
@@ -24,10 +23,6 @@ const struct bug_entry *find_bug(unsigned long bugaddr);
24 23
25enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); 24enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
26 25
27int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
28 struct module *);
29void module_bug_cleanup(struct module *);
30
31/* These are defined by the architecture */ 26/* These are defined by the architecture */
32int is_valid_bugaddr(unsigned long addr); 27int is_valid_bugaddr(unsigned long addr);
33 28
@@ -38,13 +33,6 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
38{ 33{
39 return BUG_TRAP_TYPE_BUG; 34 return BUG_TRAP_TYPE_BUG;
40} 35}
41static inline int module_bug_finalize(const Elf_Ehdr *hdr,
42 const Elf_Shdr *sechdrs,
43 struct module *mod)
44{
45 return 0;
46}
47static inline void module_bug_cleanup(struct module *mod) {}
48 36
49#endif /* CONFIG_GENERIC_BUG */ 37#endif /* CONFIG_GENERIC_BUG */
50#endif /* _LINUX_BUG_H */ 38#endif /* _LINUX_BUG_H */
diff --git a/include/linux/c2port.h b/include/linux/c2port.h
index 7b5a2388ba67..2a5cd867c365 100644
--- a/include/linux/c2port.h
+++ b/include/linux/c2port.h
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/kmemcheck.h>
13 14
14#define C2PORT_NAME_LEN 32 15#define C2PORT_NAME_LEN 32
15 16
@@ -20,8 +21,10 @@
20/* Main struct */ 21/* Main struct */
21struct c2port_ops; 22struct c2port_ops;
22struct c2port_device { 23struct c2port_device {
24 kmemcheck_bitfield_begin(flags);
23 unsigned int access:1; 25 unsigned int access:1;
24 unsigned int flash_access:1; 26 unsigned int flash_access:1;
27 kmemcheck_bitfield_end(flags);
25 28
26 int id; 29 int id;
27 char name[C2PORT_NAME_LEN]; 30 char name[C2PORT_NAME_LEN];
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
index eff898aac02b..8cb05aae661c 100644
--- a/include/linux/can/Kbuild
+++ b/include/linux/can/Kbuild
@@ -1,3 +1,4 @@
1header-y += raw.h 1header-y += raw.h
2header-y += bcm.h 2header-y += bcm.h
3header-y += error.h 3header-y += error.h
4header-y += netlink.h
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
new file mode 100644
index 000000000000..4a37a56f6cdd
--- /dev/null
+++ b/include/linux/can/dev.h
@@ -0,0 +1,70 @@
1/*
2 * linux/can/dev.h
3 *
4 * Definitions for the CAN network device driver interface
5 *
6 * Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
7 * Varma Electronics Oy
8 *
9 * Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 */
13
14#ifndef CAN_DEV_H
15#define CAN_DEV_H
16
17#include <linux/can/netlink.h>
18#include <linux/can/error.h>
19
20/*
21 * CAN mode
22 */
23enum can_mode {
24 CAN_MODE_STOP = 0,
25 CAN_MODE_START,
26 CAN_MODE_SLEEP
27};
28
29/*
30 * CAN common private data
31 */
32#define CAN_ECHO_SKB_MAX 4
33
34struct can_priv {
35 struct can_device_stats can_stats;
36
37 struct can_bittiming bittiming;
38 struct can_bittiming_const *bittiming_const;
39 struct can_clock clock;
40
41 enum can_state state;
42 u32 ctrlmode;
43
44 int restart_ms;
45 struct timer_list restart_timer;
46
47 struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX];
48
49 int (*do_set_bittiming)(struct net_device *dev);
50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
51 int (*do_get_state)(const struct net_device *dev,
52 enum can_state *state);
53};
54
55struct net_device *alloc_candev(int sizeof_priv);
56void free_candev(struct net_device *dev);
57
58int open_candev(struct net_device *dev);
59void close_candev(struct net_device *dev);
60
61int register_candev(struct net_device *dev);
62void unregister_candev(struct net_device *dev);
63
64int can_restart_now(struct net_device *dev);
65void can_bus_off(struct net_device *dev);
66
67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
68void can_get_echo_skb(struct net_device *dev, int idx);
69
70#endif /* CAN_DEV_H */
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
new file mode 100644
index 000000000000..9ecbb7871c0e
--- /dev/null
+++ b/include/linux/can/netlink.h
@@ -0,0 +1,113 @@
1/*
2 * linux/can/netlink.h
3 *
4 * Definitions for the CAN netlink interface
5 *
6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
7 *
8 * Send feedback to <socketcan-users@lists.berlios.de>
9 *
10 */
11
12#ifndef CAN_NETLINK_H
13#define CAN_NETLINK_H
14
15#include <linux/types.h>
16
17/*
18 * CAN bit-timing parameters
19 *
20 * For futher information, please read chapter "8 BIT TIMING
21 * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
22 * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
23 */
24struct can_bittiming {
25 __u32 bitrate; /* Bit-rate in bits/second */
26 __u32 sample_point; /* Sample point in one-tenth of a percent */
27 __u32 tq; /* Time quanta (TQ) in nanoseconds */
28 __u32 prop_seg; /* Propagation segment in TQs */
29 __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
30 __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
31 __u32 sjw; /* Synchronisation jump width in TQs */
32 __u32 brp; /* Bit-rate prescaler */
33};
34
35/*
36 * CAN harware-dependent bit-timing constant
37 *
38 * Used for calculating and checking bit-timing parameters
39 */
40struct can_bittiming_const {
41 char name[16]; /* Name of the CAN controller hardware */
42 __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
43 __u32 tseg1_max;
44 __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
45 __u32 tseg2_max;
46 __u32 sjw_max; /* Synchronisation jump width */
47 __u32 brp_min; /* Bit-rate prescaler */
48 __u32 brp_max;
49 __u32 brp_inc;
50};
51
52/*
53 * CAN clock parameters
54 */
55struct can_clock {
56 __u32 freq; /* CAN system clock frequency in Hz */
57};
58
59/*
60 * CAN operational and error states
61 */
62enum can_state {
63 CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
64 CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
65 CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
66 CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
67 CAN_STATE_STOPPED, /* Device is stopped */
68 CAN_STATE_SLEEPING, /* Device is sleeping */
69 CAN_STATE_MAX
70};
71
72/*
73 * CAN controller mode
74 */
75struct can_ctrlmode {
76 __u32 mask;
77 __u32 flags;
78};
79
80#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
81#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
82#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
83
84/*
85 * CAN device statistics
86 */
87struct can_device_stats {
88 __u32 bus_error; /* Bus errors */
89 __u32 error_warning; /* Changes to error warning state */
90 __u32 error_passive; /* Changes to error passive state */
91 __u32 bus_off; /* Changes to bus off state */
92 __u32 arbitration_lost; /* Arbitration lost errors */
93 __u32 restarts; /* CAN controller re-starts */
94};
95
96/*
97 * CAN netlink interface
98 */
99enum {
100 IFLA_CAN_UNSPEC,
101 IFLA_CAN_BITTIMING,
102 IFLA_CAN_BITTIMING_CONST,
103 IFLA_CAN_CLOCK,
104 IFLA_CAN_STATE,
105 IFLA_CAN_CTRLMODE,
106 IFLA_CAN_RESTART_MS,
107 IFLA_CAN_RESTART,
108 __IFLA_CAN_MAX
109};
110
111#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
112
113#endif /* CAN_NETLINK_H */
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
new file mode 100644
index 000000000000..01ee2aeb048d
--- /dev/null
+++ b/include/linux/can/platform/sja1000.h
@@ -0,0 +1,35 @@
1#ifndef _CAN_PLATFORM_SJA1000_H_
2#define _CAN_PLATFORM_SJA1000_H_
3
4/* clock divider register */
5#define CDR_CLKOUT_MASK 0x07
6#define CDR_CLK_OFF 0x08 /* Clock off (CLKOUT pin) */
7#define CDR_RXINPEN 0x20 /* TX1 output is RX irq output */
8#define CDR_CBP 0x40 /* CAN input comparator bypass */
9#define CDR_PELICAN 0x80 /* PeliCAN mode */
10
11/* output control register */
12#define OCR_MODE_BIPHASE 0x00
13#define OCR_MODE_TEST 0x01
14#define OCR_MODE_NORMAL 0x02
15#define OCR_MODE_CLOCK 0x03
16#define OCR_MODE_MASK 0x07
17#define OCR_TX0_INVERT 0x04
18#define OCR_TX0_PULLDOWN 0x08
19#define OCR_TX0_PULLUP 0x10
20#define OCR_TX0_PUSHPULL 0x18
21#define OCR_TX1_INVERT 0x20
22#define OCR_TX1_PULLDOWN 0x40
23#define OCR_TX1_PULLUP 0x80
24#define OCR_TX1_PUSHPULL 0xc0
25#define OCR_TX_MASK 0xfc
26#define OCR_TX_SHIFT 2
27
28struct sja1000_platform_data {
29 u32 clock; /* CAN bus oscillator frequency in Hz */
30
31 u8 ocr; /* output control register */
32 u8 cdr; /* clock divider register */
33};
34
35#endif /* !_CAN_PLATFORM_SJA1000_H_ */
diff --git a/include/linux/cb710.h b/include/linux/cb710.h
new file mode 100644
index 000000000000..63bc9a4d2926
--- /dev/null
+++ b/include/linux/cb710.h
@@ -0,0 +1,231 @@
1/*
2 * cb710/cb710.h
3 *
4 * Copyright by Michał Mirosław, 2008-2009
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#ifndef LINUX_CB710_DRIVER_H
11#define LINUX_CB710_DRIVER_H
12
13#include <linux/io.h>
14#include <linux/interrupt.h>
15#include <linux/spinlock.h>
16#include <linux/pci.h>
17#include <linux/platform_device.h>
18#include <linux/mmc/host.h>
19
20struct cb710_slot;
21
22typedef int (*cb710_irq_handler_t)(struct cb710_slot *);
23
24/* per-virtual-slot structure */
25struct cb710_slot {
26 struct platform_device pdev;
27 void __iomem *iobase;
28 cb710_irq_handler_t irq_handler;
29};
30
31/* per-device structure */
32struct cb710_chip {
33 struct pci_dev *pdev;
34 void __iomem *iobase;
35 unsigned platform_id;
36#ifdef CONFIG_CB710_DEBUG_ASSUMPTIONS
37 atomic_t slot_refs_count;
38#endif
39 unsigned slot_mask;
40 unsigned slots;
41 spinlock_t irq_lock;
42 struct cb710_slot slot[0];
43};
44
45/* NOTE: cb710_chip.slots is modified only during device init/exit and
46 * they are all serialized wrt themselves */
47
48/* cb710_chip.slot_mask values */
49#define CB710_SLOT_MMC 1
50#define CB710_SLOT_MS 2
51#define CB710_SLOT_SM 4
52
53/* slot port accessors - so the logic is more clear in the code */
54#define CB710_PORT_ACCESSORS(t) \
55static inline void cb710_write_port_##t(struct cb710_slot *slot, \
56 unsigned port, u##t value) \
57{ \
58 iowrite##t(value, slot->iobase + port); \
59} \
60 \
61static inline u##t cb710_read_port_##t(struct cb710_slot *slot, \
62 unsigned port) \
63{ \
64 return ioread##t(slot->iobase + port); \
65} \
66 \
67static inline void cb710_modify_port_##t(struct cb710_slot *slot, \
68 unsigned port, u##t set, u##t clear) \
69{ \
70 iowrite##t( \
71 (ioread##t(slot->iobase + port) & ~clear)|set, \
72 slot->iobase + port); \
73}
74
75CB710_PORT_ACCESSORS(8)
76CB710_PORT_ACCESSORS(16)
77CB710_PORT_ACCESSORS(32)
78
79void cb710_pci_update_config_reg(struct pci_dev *pdev,
80 int reg, uint32_t and, uint32_t xor);
81void cb710_set_irq_handler(struct cb710_slot *slot,
82 cb710_irq_handler_t handler);
83
84/* some device struct walking */
85
86static inline struct cb710_slot *cb710_pdev_to_slot(
87 struct platform_device *pdev)
88{
89 return container_of(pdev, struct cb710_slot, pdev);
90}
91
92static inline struct cb710_chip *cb710_slot_to_chip(struct cb710_slot *slot)
93{
94 return dev_get_drvdata(slot->pdev.dev.parent);
95}
96
97static inline struct device *cb710_slot_dev(struct cb710_slot *slot)
98{
99 return &slot->pdev.dev;
100}
101
102static inline struct device *cb710_chip_dev(struct cb710_chip *chip)
103{
104 return &chip->pdev->dev;
105}
106
107/* debugging aids */
108
109#ifdef CONFIG_CB710_DEBUG
110void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
111#else
112#define cb710_dump_regs(c, d) do {} while (0)
113#endif
114
115#define CB710_DUMP_REGS_MMC 0x0F
116#define CB710_DUMP_REGS_MS 0x30
117#define CB710_DUMP_REGS_SM 0xC0
118#define CB710_DUMP_REGS_ALL 0xFF
119#define CB710_DUMP_REGS_MASK 0xFF
120
121#define CB710_DUMP_ACCESS_8 0x100
122#define CB710_DUMP_ACCESS_16 0x200
123#define CB710_DUMP_ACCESS_32 0x400
124#define CB710_DUMP_ACCESS_ALL 0x700
125#define CB710_DUMP_ACCESS_MASK 0x700
126
127#endif /* LINUX_CB710_DRIVER_H */
128/*
129 * cb710/sgbuf2.h
130 *
131 * Copyright by Michał Mirosław, 2008-2009
132 *
133 * This program is free software; you can redistribute it and/or modify
134 * it under the terms of the GNU General Public License version 2 as
135 * published by the Free Software Foundation.
136 */
137#ifndef LINUX_CB710_SG_H
138#define LINUX_CB710_SG_H
139
140#include <linux/highmem.h>
141#include <linux/scatterlist.h>
142
143/**
144 * cb710_sg_miter_stop_writing - stop mapping iteration after writing
145 * @miter: sg mapping iter to be stopped
146 *
147 * Description:
148 * Stops mapping iterator @miter. @miter should have been started
149 * started using sg_miter_start(). A stopped iteration can be
150 * resumed by calling sg_miter_next() on it. This is useful when
151 * resources (kmap) need to be released during iteration.
152 *
153 * This is a convenience wrapper that will be optimized out for arches
154 * that don't need flush_kernel_dcache_page().
155 *
156 * Context:
157 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
158 */
159static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
160{
161 if (miter->page)
162 flush_kernel_dcache_page(miter->page);
163 sg_miter_stop(miter);
164}
165
166/*
167 * 32-bit PIO mapping sg iterator
168 *
169 * Hides scatterlist access issues - fragment boundaries, alignment, page
170 * mapping - for drivers using 32-bit-word-at-a-time-PIO (ie. PCI devices
171 * without DMA support).
172 *
173 * Best-case reading (transfer from device):
174 * sg_miter_start();
175 * cb710_sg_dwiter_write_from_io();
176 * cb710_sg_miter_stop_writing();
177 *
178 * Best-case writing (transfer to device):
179 * sg_miter_start();
180 * cb710_sg_dwiter_read_to_io();
181 * sg_miter_stop();
182 */
183
184uint32_t cb710_sg_dwiter_read_next_block(struct sg_mapping_iter *miter);
185void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t data);
186
187/**
188 * cb710_sg_dwiter_write_from_io - transfer data to mapped buffer from 32-bit IO port
189 * @miter: sg mapping iter
190 * @port: PIO port - IO or MMIO address
191 * @count: number of 32-bit words to transfer
192 *
193 * Description:
194 * Reads @count 32-bit words from register @port and stores it in
195 * buffer iterated by @miter. Data that would overflow the buffer
196 * is silently ignored. Iterator is advanced by 4*@count bytes
197 * or to the buffer's end whichever is closer.
198 *
199 * Context:
200 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
201 */
202static inline void cb710_sg_dwiter_write_from_io(struct sg_mapping_iter *miter,
203 void __iomem *port, size_t count)
204{
205 while (count-- > 0)
206 cb710_sg_dwiter_write_next_block(miter, ioread32(port));
207}
208
209/**
210 * cb710_sg_dwiter_read_to_io - transfer data to 32-bit IO port from mapped buffer
211 * @miter: sg mapping iter
212 * @port: PIO port - IO or MMIO address
213 * @count: number of 32-bit words to transfer
214 *
215 * Description:
216 * Writes @count 32-bit words to register @port from buffer iterated
217 * through @miter. If buffer ends before @count words are written
218 * missing data is replaced by zeroes. @miter is advanced by 4*@count
219 * bytes or to the buffer's end whichever is closer.
220 *
221 * Context:
222 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
223 */
224static inline void cb710_sg_dwiter_read_to_io(struct sg_mapping_iter *miter,
225 void __iomem *port, size_t count)
226{
227 while (count-- > 0)
228 iowrite32(cb710_sg_dwiter_read_next_block(miter), port);
229}
230
231#endif /* LINUX_CB710_SG_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1db9bbf444a3..1d37f42ac294 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
142 */ 142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id); 143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144 144
145/**
146 * clk_add_alias - add a new clock alias
147 * @alias: name for clock alias
148 * @alias_dev_name: device name
149 * @id: platform specific clock name
150 * @dev: device
151 *
152 * Allows using generic clock names for drivers by adding a new alias.
153 * Assumes clkdev, see clkdev.h for more info.
154 */
155int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
156 struct device *dev);
157
145#endif 158#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 3a1dbba4d3ae..20a100fe2b4f 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -143,3 +143,12 @@ extern void clockevents_notify(unsigned long reason, void *arg);
143#endif 143#endif
144 144
145#endif 145#endif
146
147#ifdef CONFIG_GENERIC_CLOCKEVENTS
148extern ktime_t clockevents_get_next_event(int cpu);
149#else
150static inline ktime_t clockevents_get_next_event(int cpu)
151{
152 return (ktime_t) { .tv64 = KTIME_MAX };
153}
154#endif
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 05ea1dd7d681..a5740fc4d04b 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -18,7 +18,6 @@
18 18
19extern int number_of_cpusets; /* How many cpusets are defined in system? */ 19extern int number_of_cpusets; /* How many cpusets are defined in system? */
20 20
21extern int cpuset_init_early(void);
22extern int cpuset_init(void); 21extern int cpuset_init(void);
23extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
@@ -27,7 +26,6 @@ extern void cpuset_cpus_allowed_locked(struct task_struct *p,
27extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
28#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
29void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
30void cpuset_update_task_memory_state(void);
31int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
32 30
33extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); 31extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
@@ -92,9 +90,13 @@ extern void rebuild_sched_domains(void);
92 90
93extern void cpuset_print_task_mems_allowed(struct task_struct *p); 91extern void cpuset_print_task_mems_allowed(struct task_struct *p);
94 92
93static inline void set_mems_allowed(nodemask_t nodemask)
94{
95 current->mems_allowed = nodemask;
96}
97
95#else /* !CONFIG_CPUSETS */ 98#else /* !CONFIG_CPUSETS */
96 99
97static inline int cpuset_init_early(void) { return 0; }
98static inline int cpuset_init(void) { return 0; } 100static inline int cpuset_init(void) { return 0; }
99static inline void cpuset_init_smp(void) {} 101static inline void cpuset_init_smp(void) {}
100 102
@@ -116,7 +118,6 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
116 118
117#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) 119#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
118static inline void cpuset_init_current_mems_allowed(void) {} 120static inline void cpuset_init_current_mems_allowed(void) {}
119static inline void cpuset_update_task_memory_state(void) {}
120 121
121static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) 122static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
122{ 123{
@@ -188,6 +189,10 @@ static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
188{ 189{
189} 190}
190 191
192static inline void set_mems_allowed(nodemask_t nodemask)
193{
194}
195
191#endif /* !CONFIG_CPUSETS */ 196#endif /* !CONFIG_CPUSETS */
192 197
193#endif /* _LINUX_CPUSET_H */ 198#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index a4a7b10aaa48..ed4e39f2c423 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
114#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 114#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
116 unbound */ 116 unbound */
117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound
118 from the device */
117 119
118extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
119extern struct klist *bus_get_device_klist(struct bus_type *bus); 121extern struct klist *bus_get_device_klist(struct bus_type *bus);
@@ -192,6 +194,7 @@ struct class {
192 struct kobject *dev_kobj; 194 struct kobject *dev_kobj;
193 195
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 196 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
197 char *(*nodename)(struct device *dev);
195 198
196 void (*class_release)(struct class *class); 199 void (*class_release)(struct class *class);
197 void (*dev_release)(struct device *dev); 200 void (*dev_release)(struct device *dev);
@@ -287,6 +290,7 @@ struct device_type {
287 const char *name; 290 const char *name;
288 struct attribute_group **groups; 291 struct attribute_group **groups;
289 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 292 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
293 char *(*nodename)(struct device *dev);
290 void (*release)(struct device *dev); 294 void (*release)(struct device *dev);
291 295
292 struct dev_pm_ops *pm; 296 struct dev_pm_ops *pm;
@@ -486,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data,
486extern int device_rename(struct device *dev, char *new_name); 490extern int device_rename(struct device *dev, char *new_name);
487extern int device_move(struct device *dev, struct device *new_parent, 491extern int device_move(struct device *dev, struct device *new_parent,
488 enum dpm_order dpm_order); 492 enum dpm_order dpm_order);
493extern const char *device_get_nodename(struct device *dev, const char **tmp);
489 494
490/* 495/*
491 * Root device objects for grouping under /sys/devices 496 * Root device objects for grouping under /sys/devices
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index e61c0be2a459..6925249a5ac6 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
78/* Mimics pci.h... */ 78/* Mimics pci.h... */
79static inline void *eisa_get_drvdata (struct eisa_device *edev) 79static inline void *eisa_get_drvdata (struct eisa_device *edev)
80{ 80{
81 return edev->dev.driver_data; 81 return dev_get_drvdata(&edev->dev);
82} 82}
83 83
84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) 84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
85{ 85{
86 edev->dev.driver_data = data; 86 dev_set_drvdata(&edev->dev, data);
87} 87}
88 88
89/* The EISA root device. There's rumours about machines with multiple 89/* The EISA root device. There's rumours about machines with multiple
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index a1f17abba7dc..3d7a6687d247 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -182,6 +182,33 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
182 return compare_ether_addr(addr1, addr2); 182 return compare_ether_addr(addr1, addr2);
183#endif 183#endif
184} 184}
185
186/**
187 * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
188 * @dev: Pointer to a device structure
189 * @addr: Pointer to a six-byte array containing the Ethernet address
190 *
191 * Compare passed address with all addresses of the device. Return true if the
192 * address if one of the device addresses.
193 *
194 * Note that this function calls compare_ether_addr_64bits() so take care of
195 * the right padding.
196 */
197static inline bool is_etherdev_addr(const struct net_device *dev,
198 const u8 addr[6 + 2])
199{
200 struct netdev_hw_addr *ha;
201 int res = 1;
202
203 rcu_read_lock();
204 for_each_dev_addr(dev, ha) {
205 res = compare_ether_addr_64bits(addr, ha->addr);
206 if (!res)
207 break;
208 }
209 rcu_read_unlock();
210 return !res;
211}
185#endif /* __KERNEL__ */ 212#endif /* __KERNEL__ */
186 213
187/** 214/**
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 131b127b70f8..9b660bd2e2b3 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -26,11 +26,14 @@ struct ethtool_cmd {
26 __u8 phy_address; 26 __u8 phy_address;
27 __u8 transceiver; /* Which transceiver to use */ 27 __u8 transceiver; /* Which transceiver to use */
28 __u8 autoneg; /* Enable or disable autonegotiation */ 28 __u8 autoneg; /* Enable or disable autonegotiation */
29 __u8 mdio_support;
29 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 30 __u32 maxtxpkt; /* Tx pkts before generating tx int */
30 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 31 __u32 maxrxpkt; /* Rx pkts before generating rx int */
31 __u16 speed_hi; 32 __u16 speed_hi;
32 __u16 reserved2; 33 __u8 eth_tp_mdix;
33 __u32 reserved[3]; 34 __u8 reserved2;
35 __u32 lp_advertising; /* Features the link partner advertises */
36 __u32 reserved[2];
34}; 37};
35 38
36static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 39static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
@@ -563,6 +566,11 @@ struct ethtool_ops {
563#define SUPPORTED_Pause (1 << 13) 566#define SUPPORTED_Pause (1 << 13)
564#define SUPPORTED_Asym_Pause (1 << 14) 567#define SUPPORTED_Asym_Pause (1 << 14)
565#define SUPPORTED_2500baseX_Full (1 << 15) 568#define SUPPORTED_2500baseX_Full (1 << 15)
569#define SUPPORTED_Backplane (1 << 16)
570#define SUPPORTED_1000baseKX_Full (1 << 17)
571#define SUPPORTED_10000baseKX4_Full (1 << 18)
572#define SUPPORTED_10000baseKR_Full (1 << 19)
573#define SUPPORTED_10000baseR_FEC (1 << 20)
566 574
567/* Indicates what features are advertised by the interface. */ 575/* Indicates what features are advertised by the interface. */
568#define ADVERTISED_10baseT_Half (1 << 0) 576#define ADVERTISED_10baseT_Half (1 << 0)
@@ -581,6 +589,11 @@ struct ethtool_ops {
581#define ADVERTISED_Pause (1 << 13) 589#define ADVERTISED_Pause (1 << 13)
582#define ADVERTISED_Asym_Pause (1 << 14) 590#define ADVERTISED_Asym_Pause (1 << 14)
583#define ADVERTISED_2500baseX_Full (1 << 15) 591#define ADVERTISED_2500baseX_Full (1 << 15)
592#define ADVERTISED_Backplane (1 << 16)
593#define ADVERTISED_1000baseKX_Full (1 << 17)
594#define ADVERTISED_10000baseKX4_Full (1 << 18)
595#define ADVERTISED_10000baseKR_Full (1 << 19)
596#define ADVERTISED_10000baseR_FEC (1 << 20)
584 597
585/* The following are all involved in forcing a particular link 598/* The following are all involved in forcing a particular link
586 * mode for the device for setting things. When getting the 599 * mode for the device for setting things. When getting the
@@ -605,6 +618,7 @@ struct ethtool_ops {
605#define PORT_MII 0x02 618#define PORT_MII 0x02
606#define PORT_FIBRE 0x03 619#define PORT_FIBRE 0x03
607#define PORT_BNC 0x04 620#define PORT_BNC 0x04
621#define PORT_OTHER 0xff
608 622
609/* Which transceiver to use. */ 623/* Which transceiver to use. */
610#define XCVR_INTERNAL 0x00 624#define XCVR_INTERNAL 0x00
@@ -619,6 +633,11 @@ struct ethtool_ops {
619#define AUTONEG_DISABLE 0x00 633#define AUTONEG_DISABLE 0x00
620#define AUTONEG_ENABLE 0x01 634#define AUTONEG_ENABLE 0x01
621 635
636/* Mode MDI or MDI-X */
637#define ETH_TP_MDI_INVALID 0x00
638#define ETH_TP_MDI 0x01
639#define ETH_TP_MDI_X 0x02
640
622/* Wake-On-Lan options. */ 641/* Wake-On-Lan options. */
623#define WAKE_PHY (1 << 0) 642#define WAKE_PHY (1 << 0)
624#define WAKE_UCAST (1 << 1) 643#define WAKE_UCAST (1 << 1)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 330c4b1bfcaa..dd68358996b7 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -677,6 +677,9 @@ struct fb_ops {
677 /* get capability given var */ 677 /* get capability given var */
678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, 678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
679 struct fb_var_screeninfo *var); 679 struct fb_var_screeninfo *var);
680
681 /* teardown any resources to do with this framebuffer */
682 void (*fb_destroy)(struct fb_info *info);
680}; 683};
681 684
682#ifdef CONFIG_FB_TILEBLITTING 685#ifdef CONFIG_FB_TILEBLITTING
@@ -786,6 +789,8 @@ struct fb_tile_ops {
786#define FBINFO_MISC_USEREVENT 0x10000 /* event request 789#define FBINFO_MISC_USEREVENT 0x10000 /* event request
787 from userspace */ 790 from userspace */
788#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 791#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
792#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
793 inited framebuffer */
789 794
790/* A driver may set this flag to indicate that it does want a set_par to be 795/* A driver may set this flag to indicate that it does want a set_par to be
791 * called every time when fbcon_switch is executed. The advantage is that with 796 * called every time when fbcon_switch is executed. The advantage is that with
@@ -854,7 +859,12 @@ struct fb_info {
854 u32 state; /* Hardware state i.e suspend */ 859 u32 state; /* Hardware state i.e suspend */
855 void *fbcon_par; /* fbcon use-only private area */ 860 void *fbcon_par; /* fbcon use-only private area */
856 /* From here on everything is device dependent */ 861 /* From here on everything is device dependent */
857 void *par; 862 void *par;
863 /* we need the PCI or similiar aperture base/size not
864 smem_start/size as smem_start may just be an object
865 allocated inside the aperture so may not actually overlap */
866 resource_size_t aperture_base;
867 resource_size_t aperture_size;
858}; 868};
859 869
860#ifdef MODULE 870#ifdef MODULE
@@ -893,7 +903,7 @@ struct fb_info {
893#define fb_writeq sbus_writeq 903#define fb_writeq sbus_writeq
894#define fb_memset sbus_memset_io 904#define fb_memset sbus_memset_io
895 905
896#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) 906#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
897 907
898#define fb_readb __raw_readb 908#define fb_readb __raw_readb
899#define fb_readw __raw_readw 909#define fb_readw __raw_readw
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
new file mode 100644
index 000000000000..e584b7215e8b
--- /dev/null
+++ b/include/linux/firewire.h
@@ -0,0 +1,358 @@
1#ifndef _LINUX_FIREWIRE_H
2#define _LINUX_FIREWIRE_H
3
4#include <linux/completion.h>
5#include <linux/device.h>
6#include <linux/kernel.h>
7#include <linux/kref.h>
8#include <linux/list.h>
9#include <linux/mutex.h>
10#include <linux/spinlock.h>
11#include <linux/sysfs.h>
12#include <linux/timer.h>
13#include <linux/types.h>
14#include <linux/workqueue.h>
15
16#include <asm/atomic.h>
17#include <asm/byteorder.h>
18
19#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
20#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
21
22static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
23{
24 u32 *dst = _dst;
25 __be32 *src = _src;
26 int i;
27
28 for (i = 0; i < size / 4; i++)
29 dst[i] = be32_to_cpu(src[i]);
30}
31
32static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
33{
34 fw_memcpy_from_be32(_dst, _src, size);
35}
36#define CSR_REGISTER_BASE 0xfffff0000000ULL
37
38/* register offsets are relative to CSR_REGISTER_BASE */
39#define CSR_STATE_CLEAR 0x0
40#define CSR_STATE_SET 0x4
41#define CSR_NODE_IDS 0x8
42#define CSR_RESET_START 0xc
43#define CSR_SPLIT_TIMEOUT_HI 0x18
44#define CSR_SPLIT_TIMEOUT_LO 0x1c
45#define CSR_CYCLE_TIME 0x200
46#define CSR_BUS_TIME 0x204
47#define CSR_BUSY_TIMEOUT 0x210
48#define CSR_BUS_MANAGER_ID 0x21c
49#define CSR_BANDWIDTH_AVAILABLE 0x220
50#define CSR_CHANNELS_AVAILABLE 0x224
51#define CSR_CHANNELS_AVAILABLE_HI 0x224
52#define CSR_CHANNELS_AVAILABLE_LO 0x228
53#define CSR_BROADCAST_CHANNEL 0x234
54#define CSR_CONFIG_ROM 0x400
55#define CSR_CONFIG_ROM_END 0x800
56#define CSR_FCP_COMMAND 0xB00
57#define CSR_FCP_RESPONSE 0xD00
58#define CSR_FCP_END 0xF00
59#define CSR_TOPOLOGY_MAP 0x1000
60#define CSR_TOPOLOGY_MAP_END 0x1400
61#define CSR_SPEED_MAP 0x2000
62#define CSR_SPEED_MAP_END 0x3000
63
64#define CSR_OFFSET 0x40
65#define CSR_LEAF 0x80
66#define CSR_DIRECTORY 0xc0
67
68#define CSR_DESCRIPTOR 0x01
69#define CSR_VENDOR 0x03
70#define CSR_HARDWARE_VERSION 0x04
71#define CSR_NODE_CAPABILITIES 0x0c
72#define CSR_UNIT 0x11
73#define CSR_SPECIFIER_ID 0x12
74#define CSR_VERSION 0x13
75#define CSR_DEPENDENT_INFO 0x14
76#define CSR_MODEL 0x17
77#define CSR_INSTANCE 0x18
78#define CSR_DIRECTORY_ID 0x20
79
80struct fw_csr_iterator {
81 u32 *p;
82 u32 *end;
83};
84
85void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p);
86int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
87
88extern struct bus_type fw_bus_type;
89
90struct fw_card_driver;
91struct fw_node;
92
93struct fw_card {
94 const struct fw_card_driver *driver;
95 struct device *device;
96 struct kref kref;
97 struct completion done;
98
99 int node_id;
100 int generation;
101 int current_tlabel;
102 u64 tlabel_mask;
103 struct list_head transaction_list;
104 struct timer_list flush_timer;
105 unsigned long reset_jiffies;
106
107 unsigned long long guid;
108 unsigned max_receive;
109 int link_speed;
110 int config_rom_generation;
111
112 spinlock_t lock; /* Take this lock when handling the lists in
113 * this struct. */
114 struct fw_node *local_node;
115 struct fw_node *root_node;
116 struct fw_node *irm_node;
117 u8 color; /* must be u8 to match the definition in struct fw_node */
118 int gap_count;
119 bool beta_repeaters_present;
120
121 int index;
122
123 struct list_head link;
124
125 /* Work struct for BM duties. */
126 struct delayed_work work;
127 int bm_retries;
128 int bm_generation;
129
130 bool broadcast_channel_allocated;
131 u32 broadcast_channel;
132 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
133};
134
135static inline struct fw_card *fw_card_get(struct fw_card *card)
136{
137 kref_get(&card->kref);
138
139 return card;
140}
141
142void fw_card_release(struct kref *kref);
143
144static inline void fw_card_put(struct fw_card *card)
145{
146 kref_put(&card->kref, fw_card_release);
147}
148
149struct fw_attribute_group {
150 struct attribute_group *groups[2];
151 struct attribute_group group;
152 struct attribute *attrs[12];
153};
154
155enum fw_device_state {
156 FW_DEVICE_INITIALIZING,
157 FW_DEVICE_RUNNING,
158 FW_DEVICE_GONE,
159 FW_DEVICE_SHUTDOWN,
160};
161
162/*
163 * Note, fw_device.generation always has to be read before fw_device.node_id.
164 * Use SMP memory barriers to ensure this. Otherwise requests will be sent
165 * to an outdated node_id if the generation was updated in the meantime due
166 * to a bus reset.
167 *
168 * Likewise, fw-core will take care to update .node_id before .generation so
169 * that whenever fw_device.generation is current WRT the actual bus generation,
170 * fw_device.node_id is guaranteed to be current too.
171 *
172 * The same applies to fw_device.card->node_id vs. fw_device.generation.
173 *
174 * fw_device.config_rom and fw_device.config_rom_length may be accessed during
175 * the lifetime of any fw_unit belonging to the fw_device, before device_del()
176 * was called on the last fw_unit. Alternatively, they may be accessed while
177 * holding fw_device_rwsem.
178 */
179struct fw_device {
180 atomic_t state;
181 struct fw_node *node;
182 int node_id;
183 int generation;
184 unsigned max_speed;
185 struct fw_card *card;
186 struct device device;
187
188 struct mutex client_list_mutex;
189 struct list_head client_list;
190
191 u32 *config_rom;
192 size_t config_rom_length;
193 int config_rom_retries;
194 unsigned is_local:1;
195 unsigned max_rec:4;
196 unsigned cmc:1;
197 unsigned irmc:1;
198 unsigned bc_implemented:2;
199
200 struct delayed_work work;
201 struct fw_attribute_group attribute_group;
202};
203
204static inline struct fw_device *fw_device(struct device *dev)
205{
206 return container_of(dev, struct fw_device, device);
207}
208
209static inline int fw_device_is_shutdown(struct fw_device *device)
210{
211 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
212}
213
214static inline struct fw_device *fw_device_get(struct fw_device *device)
215{
216 get_device(&device->device);
217
218 return device;
219}
220
221static inline void fw_device_put(struct fw_device *device)
222{
223 put_device(&device->device);
224}
225
226int fw_device_enable_phys_dma(struct fw_device *device);
227
228/*
229 * fw_unit.directory must not be accessed after device_del(&fw_unit.device).
230 */
231struct fw_unit {
232 struct device device;
233 u32 *directory;
234 struct fw_attribute_group attribute_group;
235};
236
237static inline struct fw_unit *fw_unit(struct device *dev)
238{
239 return container_of(dev, struct fw_unit, device);
240}
241
242static inline struct fw_unit *fw_unit_get(struct fw_unit *unit)
243{
244 get_device(&unit->device);
245
246 return unit;
247}
248
249static inline void fw_unit_put(struct fw_unit *unit)
250{
251 put_device(&unit->device);
252}
253
254static inline struct fw_device *fw_parent_device(struct fw_unit *unit)
255{
256 return fw_device(unit->device.parent);
257}
258
259struct ieee1394_device_id;
260
261struct fw_driver {
262 struct device_driver driver;
263 /* Called when the parent device sits through a bus reset. */
264 void (*update)(struct fw_unit *unit);
265 const struct ieee1394_device_id *id_table;
266};
267
268struct fw_packet;
269struct fw_request;
270
271typedef void (*fw_packet_callback_t)(struct fw_packet *packet,
272 struct fw_card *card, int status);
273typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
274 void *data, size_t length,
275 void *callback_data);
276/*
277 * Important note: The callback must guarantee that either fw_send_response()
278 * or kfree() is called on the @request.
279 */
280typedef void (*fw_address_callback_t)(struct fw_card *card,
281 struct fw_request *request,
282 int tcode, int destination, int source,
283 int generation, int speed,
284 unsigned long long offset,
285 void *data, size_t length,
286 void *callback_data);
287
288struct fw_packet {
289 int speed;
290 int generation;
291 u32 header[4];
292 size_t header_length;
293 void *payload;
294 size_t payload_length;
295 dma_addr_t payload_bus;
296 u32 timestamp;
297
298 /*
299 * This callback is called when the packet transmission has
300 * completed; for successful transmission, the status code is
301 * the ack received from the destination, otherwise it's a
302 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
303 * The callback can be called from tasklet context and thus
304 * must never block.
305 */
306 fw_packet_callback_t callback;
307 int ack;
308 struct list_head link;
309 void *driver_data;
310};
311
312struct fw_transaction {
313 int node_id; /* The generation is implied; it is always the current. */
314 int tlabel;
315 int timestamp;
316 struct list_head link;
317
318 struct fw_packet packet;
319
320 /*
321 * The data passed to the callback is valid only during the
322 * callback.
323 */
324 fw_transaction_callback_t callback;
325 void *callback_data;
326};
327
328struct fw_address_handler {
329 u64 offset;
330 size_t length;
331 fw_address_callback_t address_callback;
332 void *callback_data;
333 struct list_head link;
334};
335
336struct fw_address_region {
337 u64 start;
338 u64 end;
339};
340
341extern const struct fw_address_region fw_high_memory_region;
342
343int fw_core_add_address_handler(struct fw_address_handler *handler,
344 const struct fw_address_region *region);
345void fw_core_remove_address_handler(struct fw_address_handler *handler);
346void fw_send_response(struct fw_card *card,
347 struct fw_request *request, int rcode);
348void fw_send_request(struct fw_card *card, struct fw_transaction *t,
349 int tcode, int destination_id, int generation, int speed,
350 unsigned long long offset, void *payload, size_t length,
351 fw_transaction_callback_t callback, void *callback_data);
352int fw_cancel_transaction(struct fw_card *card,
353 struct fw_transaction *transaction);
354int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
355 int generation, int speed, unsigned long long offset,
356 void *payload, size_t length);
357
358#endif /* _LINUX_FIREWIRE_H */
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index cca686b39123..875451f1373a 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -24,21 +24,17 @@
24 */ 24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP 25#ifdef CONFIG_FIRMWARE_MEMMAP
26 26
27int firmware_map_add(resource_size_t start, resource_size_t end, 27int firmware_map_add(u64 start, u64 end, const char *type);
28 const char *type); 28int firmware_map_add_early(u64 start, u64 end, const char *type);
29int firmware_map_add_early(resource_size_t start, resource_size_t end,
30 const char *type);
31 29
32#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
33 31
34static inline int firmware_map_add(resource_size_t start, resource_size_t end, 32static inline int firmware_map_add(u64 start, u64 end, const char *type)
35 const char *type)
36{ 33{
37 return 0; 34 return 0;
38} 35}
39 36
40static inline int firmware_map_add_early(resource_size_t start, 37static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
41 resource_size_t end, const char *type)
42{ 38{
43 return 0; 39 return 0;
44} 40}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index c8ecf5b2a207..d31544628436 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -5,7 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7 7
8#define FIRMWARE_NAME_MAX 30
9#define FW_ACTION_NOHOTPLUG 0 8#define FW_ACTION_NOHOTPLUG 0
10#define FW_ACTION_HOTPLUG 1 9#define FW_ACTION_HOTPLUG 1
11 10
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ede84fa7da5d..74a57938c880 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -879,7 +879,7 @@ struct file_ra_state {
879 there are only # of pages ahead */ 879 there are only # of pages ahead */
880 880
881 unsigned int ra_pages; /* Maximum readahead window */ 881 unsigned int ra_pages; /* Maximum readahead window */
882 int mmap_miss; /* Cache miss stat for mmap accesses */ 882 unsigned int mmap_miss; /* Cache miss stat for mmap accesses */
883 loff_t prev_pos; /* Cache last read() position */ 883 loff_t prev_pos; /* Cache last read() position */
884}; 884};
885 885
@@ -1919,8 +1919,9 @@ extern void __init vfs_caches_init(unsigned long);
1919 1919
1920extern struct kmem_cache *names_cachep; 1920extern struct kmem_cache *names_cachep;
1921 1921
1922#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) 1922#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp))
1923#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 1923#define __getname() __getname_gfp(GFP_KERNEL)
1924#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
1924#ifndef CONFIG_AUDITSYSCALL 1925#ifndef CONFIG_AUDITSYSCALL
1925#define putname(name) __putname(name) 1926#define putname(name) __putname(name)
1926#else 1927#else
@@ -2036,9 +2037,6 @@ extern int __invalidate_device(struct block_device *);
2036extern int invalidate_partition(struct gendisk *, int); 2037extern int invalidate_partition(struct gendisk *, int);
2037#endif 2038#endif
2038extern int invalidate_inodes(struct super_block *); 2039extern int invalidate_inodes(struct super_block *);
2039unsigned long __invalidate_mapping_pages(struct address_space *mapping,
2040 pgoff_t start, pgoff_t end,
2041 bool be_atomic);
2042unsigned long invalidate_mapping_pages(struct address_space *mapping, 2040unsigned long invalidate_mapping_pages(struct address_space *mapping,
2043 pgoff_t start, pgoff_t end); 2041 pgoff_t start, pgoff_t end);
2044 2042
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 8300cab30f9a..51b793466ff3 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -17,6 +17,7 @@
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/of_mdio.h>
20#include <asm/types.h> 21#include <asm/types.h>
21 22
22#define FS_ENET_NAME "fs_enet" 23#define FS_ENET_NAME "fs_enet"
@@ -130,10 +131,7 @@ struct fs_platform_info {
130 131
131 u32 device_flags; 132 u32 device_flags;
132 133
133 int phy_addr; /* the phy address (-1 no phy) */ 134 struct device_node *phy_node;
134 char bus_id[16];
135 int phy_irq; /* the phy irq (if it exists) */
136
137 const struct fs_mii_bus_info *bus_info; 135 const struct fs_mii_bus_info *bus_info;
138 136
139 int rx_ring, tx_ring; /* number of buffers on rx */ 137 int rx_ring, tx_ring; /* number of buffers on rx */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7cbd38d363a2..45fc320a53c6 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -142,7 +142,7 @@ struct gendisk {
142 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
143 143
144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145 145 char *(*nodename)(struct gendisk *gd);
146 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3760e7c5de02..cfdb35d71bca 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/topology.h> 7#include <linux/topology.h>
8#include <linux/mmdebug.h>
8 9
9struct vm_area_struct; 10struct vm_area_struct;
10 11
@@ -20,7 +21,8 @@ struct vm_area_struct;
20#define __GFP_DMA ((__force gfp_t)0x01u) 21#define __GFP_DMA ((__force gfp_t)0x01u)
21#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 22#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
22#define __GFP_DMA32 ((__force gfp_t)0x04u) 23#define __GFP_DMA32 ((__force gfp_t)0x04u)
23 24#define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */
25#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
24/* 26/*
25 * Action modifiers - doesn't change the zoning 27 * Action modifiers - doesn't change the zoning
26 * 28 *
@@ -50,9 +52,20 @@ struct vm_area_struct;
50#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 52#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
51#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ 53#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
52#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ 54#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */
53#define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */
54 55
55#define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */ 56#ifdef CONFIG_KMEMCHECK
57#define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */
58#else
59#define __GFP_NOTRACK ((__force gfp_t)0)
60#endif
61
62/*
63 * This may seem redundant, but it's a way of annotating false positives vs.
64 * allocations that simply cannot be supported (e.g. page tables).
65 */
66#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
67
68#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */
56#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 69#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
57 70
58/* This equals 0, but use constants in case they ever change */ 71/* This equals 0, but use constants in case they ever change */
@@ -115,24 +128,105 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
115 ((gfp_flags & __GFP_RECLAIMABLE) != 0); 128 ((gfp_flags & __GFP_RECLAIMABLE) != 0);
116} 129}
117 130
118static inline enum zone_type gfp_zone(gfp_t flags) 131#ifdef CONFIG_HIGHMEM
119{ 132#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
133#else
134#define OPT_ZONE_HIGHMEM ZONE_NORMAL
135#endif
136
120#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
121 if (flags & __GFP_DMA) 138#define OPT_ZONE_DMA ZONE_DMA
122 return ZONE_DMA; 139#else
140#define OPT_ZONE_DMA ZONE_NORMAL
123#endif 141#endif
142
124#ifdef CONFIG_ZONE_DMA32 143#ifdef CONFIG_ZONE_DMA32
125 if (flags & __GFP_DMA32) 144#define OPT_ZONE_DMA32 ZONE_DMA32
126 return ZONE_DMA32; 145#else
146#define OPT_ZONE_DMA32 ZONE_NORMAL
127#endif 147#endif
128 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 148
129 (__GFP_HIGHMEM | __GFP_MOVABLE)) 149/*
130 return ZONE_MOVABLE; 150 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
131#ifdef CONFIG_HIGHMEM 151 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
132 if (flags & __GFP_HIGHMEM) 152 * and there are 16 of them to cover all possible combinations of
133 return ZONE_HIGHMEM; 153 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM
154 *
155 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
156 * But GFP_MOVABLE is not only a zone specifier but also an allocation
157 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
158 * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1".
159 *
160 * bit result
161 * =================
162 * 0x0 => NORMAL
163 * 0x1 => DMA or NORMAL
164 * 0x2 => HIGHMEM or NORMAL
165 * 0x3 => BAD (DMA+HIGHMEM)
166 * 0x4 => DMA32 or DMA or NORMAL
167 * 0x5 => BAD (DMA+DMA32)
168 * 0x6 => BAD (HIGHMEM+DMA32)
169 * 0x7 => BAD (HIGHMEM+DMA32+DMA)
170 * 0x8 => NORMAL (MOVABLE+0)
171 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
172 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
173 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
174 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32)
175 * 0xd => BAD (MOVABLE+DMA32+DMA)
176 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
177 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
178 *
179 * ZONES_SHIFT must be <= 2 on 32 bit platforms.
180 */
181
182#if 16 * ZONES_SHIFT > BITS_PER_LONG
183#error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
184#endif
185
186#define GFP_ZONE_TABLE ( \
187 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
188 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
189 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
191 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
192 | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \
193 | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
194 | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
195)
196
197/*
198 * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32
199 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
200 * entry starting with bit 0. Bit is set if the combination is not
201 * allowed.
202 */
203#define GFP_ZONE_BAD ( \
204 1 << (__GFP_DMA | __GFP_HIGHMEM) \
205 | 1 << (__GFP_DMA | __GFP_DMA32) \
206 | 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \
207 | 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \
208 | 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \
209 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \
210 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \
211 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\
212)
213
214static inline enum zone_type gfp_zone(gfp_t flags)
215{
216 enum zone_type z;
217 int bit = flags & GFP_ZONEMASK;
218
219 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
220 ((1 << ZONES_SHIFT) - 1);
221
222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else {
225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
134#endif 227#endif
135 return ZONE_NORMAL; 228 }
229 return z;
136} 230}
137 231
138/* 232/*
@@ -172,30 +266,19 @@ static inline void arch_alloc_page(struct page *page, int order) { }
172#endif 266#endif
173 267
174struct page * 268struct page *
175__alloc_pages_internal(gfp_t gfp_mask, unsigned int order, 269__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
176 struct zonelist *zonelist, nodemask_t *nodemask); 270 struct zonelist *zonelist, nodemask_t *nodemask);
177 271
178static inline struct page * 272static inline struct page *
179__alloc_pages(gfp_t gfp_mask, unsigned int order, 273__alloc_pages(gfp_t gfp_mask, unsigned int order,
180 struct zonelist *zonelist) 274 struct zonelist *zonelist)
181{ 275{
182 return __alloc_pages_internal(gfp_mask, order, zonelist, NULL); 276 return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL);
183} 277}
184 278
185static inline struct page *
186__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
187 struct zonelist *zonelist, nodemask_t *nodemask)
188{
189 return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
190}
191
192
193static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 279static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
194 unsigned int order) 280 unsigned int order)
195{ 281{
196 if (unlikely(order >= MAX_ORDER))
197 return NULL;
198
199 /* Unknown node is current node */ 282 /* Unknown node is current node */
200 if (nid < 0) 283 if (nid < 0)
201 nid = numa_node_id(); 284 nid = numa_node_id();
@@ -203,15 +286,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
203 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 286 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
204} 287}
205 288
289static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
290 unsigned int order)
291{
292 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
293
294 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
295}
296
206#ifdef CONFIG_NUMA 297#ifdef CONFIG_NUMA
207extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); 298extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
208 299
209static inline struct page * 300static inline struct page *
210alloc_pages(gfp_t gfp_mask, unsigned int order) 301alloc_pages(gfp_t gfp_mask, unsigned int order)
211{ 302{
212 if (unlikely(order >= MAX_ORDER))
213 return NULL;
214
215 return alloc_pages_current(gfp_mask, order); 303 return alloc_pages_current(gfp_mask, order);
216} 304}
217extern struct page *alloc_page_vma(gfp_t gfp_mask, 305extern struct page *alloc_page_vma(gfp_t gfp_mask,
@@ -248,4 +336,16 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
248void drain_all_pages(void); 336void drain_all_pages(void);
249void drain_local_pages(void *dummy); 337void drain_local_pages(void *dummy);
250 338
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
251#endif /* __LINUX_GFP_H */ 351#endif /* __LINUX_GFP_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a72876e43589..53489fd4d700 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -238,6 +238,42 @@ struct hid_item {
238#define HID_GD_RIGHT 0x00010092 238#define HID_GD_RIGHT 0x00010092
239#define HID_GD_LEFT 0x00010093 239#define HID_GD_LEFT 0x00010093
240 240
241#define HID_DG_DIGITIZER 0x000d0001
242#define HID_DG_PEN 0x000d0002
243#define HID_DG_LIGHTPEN 0x000d0003
244#define HID_DG_TOUCHSCREEN 0x000d0004
245#define HID_DG_TOUCHPAD 0x000d0005
246#define HID_DG_STYLUS 0x000d0020
247#define HID_DG_PUCK 0x000d0021
248#define HID_DG_FINGER 0x000d0022
249#define HID_DG_TIPPRESSURE 0x000d0030
250#define HID_DG_BARRELPRESSURE 0x000d0031
251#define HID_DG_INRANGE 0x000d0032
252#define HID_DG_TOUCH 0x000d0033
253#define HID_DG_UNTOUCH 0x000d0034
254#define HID_DG_TAP 0x000d0035
255#define HID_DG_TABLETFUNCTIONKEY 0x000d0039
256#define HID_DG_PROGRAMCHANGEKEY 0x000d003a
257#define HID_DG_INVERT 0x000d003c
258#define HID_DG_TIPSWITCH 0x000d0042
259#define HID_DG_TIPSWITCH2 0x000d0043
260#define HID_DG_BARRELSWITCH 0x000d0044
261#define HID_DG_ERASER 0x000d0045
262#define HID_DG_TABLETPICK 0x000d0046
263/*
264 * as of May 20, 2009 the usages below are not yet in the official USB spec
265 * but are being pushed by Microsft as described in their paper "Digitizer
266 * Drivers for Windows Touch and Pen-Based Computers"
267 */
268#define HID_DG_CONFIDENCE 0x000d0047
269#define HID_DG_WIDTH 0x000d0048
270#define HID_DG_HEIGHT 0x000d0049
271#define HID_DG_CONTACTID 0x000d0051
272#define HID_DG_INPUTMODE 0x000d0052
273#define HID_DG_DEVICEINDEX 0x000d0053
274#define HID_DG_CONTACTCOUNT 0x000d0054
275#define HID_DG_CONTACTMAX 0x000d0055
276
241/* 277/*
242 * HID report types --- Ouch! HID spec says 1 2 3! 278 * HID report types --- Ouch! HID spec says 1 2 3!
243 */ 279 */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 1fcb7126a01f..211ff4497269 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -55,7 +55,9 @@ static inline void *kmap(struct page *page)
55 return page_address(page); 55 return page_address(page);
56} 56}
57 57
58#define kunmap(page) do { (void) (page); } while (0) 58static inline void kunmap(struct page *page)
59{
60}
59 61
60static inline void *kmap_atomic(struct page *page, enum km_type idx) 62static inline void *kmap_atomic(struct page *page, enum km_type idx)
61{ 63{
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 0d2f7c8a33d6..7400900de94a 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -30,8 +30,11 @@ struct hrtimer_cpu_base;
30 * Mode arguments of xxx_hrtimer functions: 30 * Mode arguments of xxx_hrtimer functions:
31 */ 31 */
32enum hrtimer_mode { 32enum hrtimer_mode {
33 HRTIMER_MODE_ABS, /* Time value is absolute */ 33 HRTIMER_MODE_ABS = 0x0, /* Time value is absolute */
34 HRTIMER_MODE_REL, /* Time value is relative to now */ 34 HRTIMER_MODE_REL = 0x1, /* Time value is relative to now */
35 HRTIMER_MODE_PINNED = 0x02, /* Timer is bound to CPU */
36 HRTIMER_MODE_ABS_PINNED = 0x02,
37 HRTIMER_MODE_REL_PINNED = 0x03,
35}; 38};
36 39
37/* 40/*
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 03be7f29ca01..a05a5ef33391 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -11,6 +11,8 @@
11 11
12struct ctl_table; 12struct ctl_table;
13 13
14int PageHuge(struct page *page);
15
14static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 16static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
15{ 17{
16 return vma->vm_flags & VM_HUGETLB; 18 return vma->vm_flags & VM_HUGETLB;
@@ -61,6 +63,11 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
61 63
62#else /* !CONFIG_HUGETLB_PAGE */ 64#else /* !CONFIG_HUGETLB_PAGE */
63 65
66static inline int PageHuge(struct page *page)
67{
68 return 0;
69}
70
64static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 71static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
65{ 72{
66 return 0; 73 return 0;
diff --git a/include/linux/i2c-ocores.h b/include/linux/i2c-ocores.h
index 8ed591b0887e..4d5e57ff6614 100644
--- a/include/linux/i2c-ocores.h
+++ b/include/linux/i2c-ocores.h
@@ -14,6 +14,8 @@
14struct ocores_i2c_platform_data { 14struct ocores_i2c_platform_data {
15 u32 regstep; /* distance between registers */ 15 u32 regstep; /* distance between registers */
16 u32 clock_khz; /* input clock in kHz */ 16 u32 clock_khz; /* input clock in kHz */
17 u8 num_devices; /* number of devices in the devices list */
18 struct i2c_board_info const *devices; /* devices connected to the bus */
17}; 19};
18 20
19#endif /* _LINUX_I2C_OCORES_H */ 21#endif /* _LINUX_I2C_OCORES_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4b501b48ce86..a9173d5434d1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -493,6 +493,7 @@ struct ieee80211s_hdr {
493/* Mesh flags */ 493/* Mesh flags */
494#define MESH_FLAGS_AE_A4 0x1 494#define MESH_FLAGS_AE_A4 0x1
495#define MESH_FLAGS_AE_A5_A6 0x2 495#define MESH_FLAGS_AE_A5_A6 0x2
496#define MESH_FLAGS_AE 0x3
496#define MESH_FLAGS_PS_DEEP 0x4 497#define MESH_FLAGS_PS_DEEP 0x4
497 498
498/** 499/**
@@ -540,10 +541,10 @@ struct ieee80211_tim_ie {
540 u8 dtim_period; 541 u8 dtim_period;
541 u8 bitmap_ctrl; 542 u8 bitmap_ctrl;
542 /* variable size: 1 - 251 bytes */ 543 /* variable size: 1 - 251 bytes */
543 u8 virtual_map[0]; 544 u8 virtual_map[1];
544} __attribute__ ((packed)); 545} __attribute__ ((packed));
545 546
546#define WLAN_SA_QUERY_TR_ID_LEN 16 547#define WLAN_SA_QUERY_TR_ID_LEN 2
547 548
548struct ieee80211_mgmt { 549struct ieee80211_mgmt {
549 __le16 frame_control; 550 __le16 frame_control;
@@ -1068,8 +1069,12 @@ enum ieee80211_category {
1068 WLAN_CATEGORY_DLS = 2, 1069 WLAN_CATEGORY_DLS = 2,
1069 WLAN_CATEGORY_BACK = 3, 1070 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4, 1071 WLAN_CATEGORY_PUBLIC = 4,
1072 WLAN_CATEGORY_HT = 7,
1071 WLAN_CATEGORY_SA_QUERY = 8, 1073 WLAN_CATEGORY_SA_QUERY = 8,
1074 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1072 WLAN_CATEGORY_WMM = 17, 1075 WLAN_CATEGORY_WMM = 17,
1076 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1077 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1073}; 1078};
1074 1079
1075/* SPECTRUM_MGMT action code */ 1080/* SPECTRUM_MGMT action code */
@@ -1081,6 +1086,15 @@ enum ieee80211_spectrum_mgmt_actioncode {
1081 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1086 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1082}; 1087};
1083 1088
1089/* Security key length */
1090enum ieee80211_key_len {
1091 WLAN_KEY_LEN_WEP40 = 5,
1092 WLAN_KEY_LEN_WEP104 = 13,
1093 WLAN_KEY_LEN_CCMP = 16,
1094 WLAN_KEY_LEN_TKIP = 32,
1095 WLAN_KEY_LEN_AES_CMAC = 16,
1096};
1097
1084/* 1098/*
1085 * IEEE 802.11-2007 7.3.2.9 Country information element 1099 * IEEE 802.11-2007 7.3.2.9 Country information element
1086 * 1100 *
@@ -1261,7 +1275,9 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1261 if (ieee80211_has_protected(hdr->frame_control)) 1275 if (ieee80211_has_protected(hdr->frame_control))
1262 return true; 1276 return true;
1263 category = ((u8 *) hdr) + 24; 1277 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC; 1278 return *category != WLAN_CATEGORY_PUBLIC &&
1279 *category != WLAN_CATEGORY_HT &&
1280 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1265 } 1281 }
1266 1282
1267 return false; 1283 return false;
@@ -1383,4 +1399,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1383 return -1; 1399 return -1;
1384} 1400}
1385 1401
1402/**
1403 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
1404 * @tu: the TUs
1405 */
1406static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1407{
1408 return 1024 * tu;
1409}
1410
1411/**
1412 * ieee80211_check_tim - check if AID bit is set in TIM
1413 * @tim: the TIM IE
1414 * @tim_len: length of the TIM IE
1415 * @aid: the AID to look for
1416 */
1417static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1418 u8 tim_len, u16 aid)
1419{
1420 u8 mask;
1421 u8 index, indexn1, indexn2;
1422
1423 if (unlikely(!tim || tim_len < sizeof(*tim)))
1424 return false;
1425
1426 aid &= 0x3fff;
1427 index = aid / 8;
1428 mask = 1 << (aid & 7);
1429
1430 indexn1 = tim->bitmap_ctrl & 0xfe;
1431 indexn2 = tim_len + indexn1 - 4;
1432
1433 if (index < indexn1 || index > indexn2)
1434 return false;
1435
1436 index -= indexn1;
1437
1438 return !!(tim->virtual_map[index] & mask);
1439}
1440
1386#endif /* LINUX_IEEE80211_H */ 1441#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 1108f3e099e3..b9a6229f3be7 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -67,6 +67,9 @@
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#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */ 69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
70#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
71 * release skb->dst
72 */
70 73
71#define IF_GET_IFACE 0x0001 /* for querying only */ 74#define IF_GET_IFACE 0x0001 /* for querying only */
72#define IF_GET_PROTO 0x0002 75#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 5ff89809a581..b554300ef8bf 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -86,6 +86,8 @@
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ 86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
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#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_PHY 805
89 91
90#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 60e8934d10b5..ae3a1871413d 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -107,6 +107,7 @@
107#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ 107#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
108#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ 108#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
109#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 109#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
110#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
110 111
111/* 112/*
112 * This is an Ethernet frame header. 113 * This is an Ethernet frame header.
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 18db0668065a..dea7d6b7cf98 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -46,6 +46,8 @@ struct sockaddr_ll
46#define PACKET_VERSION 10 46#define PACKET_VERSION 10
47#define PACKET_HDRLEN 11 47#define PACKET_HDRLEN 11
48#define PACKET_RESERVE 12 48#define PACKET_RESERVE 12
49#define PACKET_TX_RING 13
50#define PACKET_LOSS 14
49 51
50struct tpacket_stats 52struct tpacket_stats
51{ 53{
@@ -63,14 +65,22 @@ struct tpacket_auxdata
63 __u16 tp_vlan_tci; 65 __u16 tp_vlan_tci;
64}; 66};
65 67
68/* Rx ring - header status */
69#define TP_STATUS_KERNEL 0x0
70#define TP_STATUS_USER 0x1
71#define TP_STATUS_COPY 0x2
72#define TP_STATUS_LOSING 0x4
73#define TP_STATUS_CSUMNOTREADY 0x8
74
75/* Tx ring - header status */
76#define TP_STATUS_AVAILABLE 0x0
77#define TP_STATUS_SEND_REQUEST 0x1
78#define TP_STATUS_SENDING 0x2
79#define TP_STATUS_WRONG_FORMAT 0x4
80
66struct tpacket_hdr 81struct tpacket_hdr
67{ 82{
68 unsigned long tp_status; 83 unsigned long tp_status;
69#define TP_STATUS_KERNEL 0
70#define TP_STATUS_USER 1
71#define TP_STATUS_COPY 2
72#define TP_STATUS_LOSING 4
73#define TP_STATUS_CSUMNOTREADY 8
74 unsigned int tp_len; 84 unsigned int tp_len;
75 unsigned int tp_snaplen; 85 unsigned int tp_snaplen;
76 unsigned short tp_mac; 86 unsigned short tp_mac;
@@ -135,5 +145,6 @@ struct packet_mreq
135#define PACKET_MR_MULTICAST 0 145#define PACKET_MR_MULTICAST 0
136#define PACKET_MR_PROMISC 1 146#define PACKET_MR_PROMISC 1
137#define PACKET_MR_ALLMULTI 2 147#define PACKET_MR_ALLMULTI 2
148#define PACKET_MR_UNICAST 3
138 149
139#endif 150#endif
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 049d6c9428db..915ba5789f0e 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -55,6 +55,7 @@
55#define IFF_NO_PI 0x1000 55#define IFF_NO_PI 0x1000
56#define IFF_ONE_QUEUE 0x2000 56#define IFF_ONE_QUEUE 0x2000
57#define IFF_VNET_HDR 0x4000 57#define IFF_VNET_HDR 0x4000
58#define IFF_TUN_EXCL 0x8000
58 59
59/* Features for GSO (TUNSETOFFLOAD). */ 60/* Features for GSO (TUNSETOFFLOAD). */
60#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 61#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5a9aae4adb44..5eb9b0f857e0 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -44,7 +44,7 @@ struct ip_tunnel_prl {
44 __u16 flags; 44 __u16 flags;
45 __u16 __reserved; 45 __u16 __reserved;
46 __u32 datalen; 46 __u32 datalen;
47 __u32 __reserved2; 47 __u32 rs_delay;
48 /* data follows */ 48 /* data follows */
49}; 49};
50 50
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index e1ff5b14310e..7ff9af1d0f05 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -118,8 +118,7 @@ extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb); 119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, 120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci, 121 unsigned int vlan_tci);
122 struct napi_gro_fraginfo *info);
123 122
124#else 123#else
125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 124static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -154,8 +153,7 @@ static inline int vlan_gro_receive(struct napi_struct *napi,
154} 153}
155 154
156static inline int vlan_gro_frags(struct napi_struct *napi, 155static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci, 156 struct vlan_group *grp, unsigned int vlan_tci)
158 struct napi_gro_fraginfo *info)
159{ 157{
160 return NET_RX_DROP; 158 return NET_RX_DROP;
161} 159}
diff --git a/include/linux/in.h b/include/linux/in.h
index d60122a3a088..cf196da04ec9 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -107,6 +107,7 @@ struct in_addr {
107#define MCAST_JOIN_SOURCE_GROUP 46 107#define MCAST_JOIN_SOURCE_GROUP 46
108#define MCAST_LEAVE_SOURCE_GROUP 47 108#define MCAST_LEAVE_SOURCE_GROUP 47
109#define MCAST_MSFILTER 48 109#define MCAST_MSFILTER 48
110#define IP_MULTICAST_ALL 49
110 111
111#define MCAST_EXCLUDE 0 112#define MCAST_EXCLUDE 0
112#define MCAST_INCLUDE 1 113#define MCAST_INCLUDE 1
diff --git a/include/linux/init.h b/include/linux/init.h
index 0e06c176f185..8c2c9989626d 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,8 +2,6 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/section-names.h>
6#include <linux/stringify.h>
7 5
8/* These macros are used to mark some functions or 6/* These macros are used to mark some functions or
9 * initialized data (doesn't apply to uninitialized data) 7 * initialized data (doesn't apply to uninitialized data)
@@ -31,7 +29,7 @@
31 * sign followed by value, e.g.: 29 * sign followed by value, e.g.:
32 * 30 *
33 * static int init_variable __initdata = 0; 31 * static int init_variable __initdata = 0;
34 * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; 32 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
35 * 33 *
36 * Don't forget to initialize data not at file scope, i.e. within a function, 34 * Don't forget to initialize data not at file scope, i.e. within a function,
37 * as gcc otherwise puts the data into the bss section and not into the init 35 * as gcc otherwise puts the data into the bss section and not into the init
@@ -101,7 +99,7 @@
101#define __memexitconst __section(.memexit.rodata) 99#define __memexitconst __section(.memexit.rodata)
102 100
103/* For assembly routines */ 101/* For assembly routines */
104#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax" 102#define __HEAD .section ".head.text","ax"
105#define __INIT .section ".init.text","ax" 103#define __INIT .section ".init.text","ax"
106#define __FINIT .previous 104#define __FINIT .previous
107 105
@@ -225,7 +223,8 @@ struct obs_kernel_param {
225 * obs_kernel_param "array" too far apart in .init.setup. 223 * obs_kernel_param "array" too far apart in .init.setup.
226 */ 224 */
227#define __setup_param(str, unique_id, fn, early) \ 225#define __setup_param(str, unique_id, fn, early) \
228 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 226 static const char __setup_str_##unique_id[] __initconst \
227 __aligned(1) = str; \
229 static struct obs_kernel_param __setup_##unique_id \ 228 static struct obs_kernel_param __setup_##unique_id \
230 __used __section(.init.setup) \ 229 __used __section(.init.setup) \
231 __attribute__((aligned((sizeof(long))))) \ 230 __attribute__((aligned((sizeof(long))))) \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 28b1f30601b5..5368fbdc7801 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -15,18 +15,6 @@
15extern struct files_struct init_files; 15extern struct files_struct init_files;
16extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
17 17
18#define INIT_MM(name) \
19{ \
20 .mm_rb = RB_ROOT, \
21 .pgd = swapper_pg_dir, \
22 .mm_users = ATOMIC_INIT(2), \
23 .mm_count = ATOMIC_INIT(1), \
24 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
25 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
26 .mmlist = LIST_HEAD_INIT(name.mmlist), \
27 .cpu_vm_mask = CPU_MASK_ALL, \
28}
29
30#define INIT_SIGNALS(sig) { \ 18#define INIT_SIGNALS(sig) { \
31 .count = ATOMIC_INIT(1), \ 19 .count = ATOMIC_INIT(1), \
32 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c41e812e9d5e..2721f07e9354 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -472,6 +472,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)
472 __tasklet_hi_schedule(t); 472 __tasklet_hi_schedule(t);
473} 473}
474 474
475extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
476
477/*
478 * This version avoids touching any other tasklets. Needed for kmemcheck
479 * in order not to take any page faults while enqueueing this tasklet;
480 * consider VERY carefully whether you really need this or
481 * tasklet_hi_schedule()...
482 */
483static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
484{
485 if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
486 __tasklet_hi_schedule_first(t);
487}
488
475 489
476static inline void tasklet_disable_nosync(struct tasklet_struct *t) 490static inline void tasklet_disable_nosync(struct tasklet_struct *t)
477{ 491{
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 476d9464ac82..c662efa68289 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -169,6 +169,12 @@ struct ipv6_devconf {
169 __s32 accept_dad; 169 __s32 accept_dad;
170 void *sysctl; 170 void *sysctl;
171}; 171};
172
173struct ipv6_params {
174 __s32 disable_ipv6;
175 __s32 autoconf;
176};
177extern struct ipv6_params ipv6_defaults;
172#endif 178#endif
173 179
174/* index values for the variables in ipv6_devconf */ 180/* index values for the variables in ipv6_devconf */
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h
index 35e9b0fd014b..7acb87a44872 100644
--- a/include/linux/isdn/capilli.h
+++ b/include/linux/isdn/capilli.h
@@ -79,7 +79,7 @@ int attach_capi_ctr(struct capi_ctr *);
79int detach_capi_ctr(struct capi_ctr *); 79int detach_capi_ctr(struct capi_ctr *);
80 80
81void capi_ctr_ready(struct capi_ctr * card); 81void capi_ctr_ready(struct capi_ctr * card);
82void capi_ctr_reseted(struct capi_ctr * card); 82void capi_ctr_down(struct capi_ctr * card);
83void capi_ctr_suspend_output(struct capi_ctr * card); 83void capi_ctr_suspend_output(struct capi_ctr * card);
84void capi_ctr_resume_output(struct capi_ctr * card); 84void capi_ctr_resume_output(struct capi_ctr * card);
85void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb); 85void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 883cd44ff765..c5a71c38a95f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -97,12 +97,14 @@ extern const char linux_proc_banner[];
97#define KERN_INFO "<6>" /* informational */ 97#define KERN_INFO "<6>" /* informational */
98#define KERN_DEBUG "<7>" /* debug-level messages */ 98#define KERN_DEBUG "<7>" /* debug-level messages */
99 99
100/* Use the default kernel loglevel */
101#define KERN_DEFAULT "<d>"
100/* 102/*
101 * Annotation for a "continued" line of log printout (only done after a 103 * Annotation for a "continued" line of log printout (only done after a
102 * line that had no enclosing \n). Only to be used by core/arch code 104 * line that had no enclosing \n). Only to be used by core/arch code
103 * during early bootup (a continued line is not SMP-safe otherwise). 105 * during early bootup (a continued line is not SMP-safe otherwise).
104 */ 106 */
105#define KERN_CONT "" 107#define KERN_CONT "<c>"
106 108
107extern int console_printk[]; 109extern int console_printk[];
108 110
@@ -406,7 +408,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
406 * 408 *
407 * Use tracing_on/tracing_off when you want to quickly turn on or off 409 * Use tracing_on/tracing_off when you want to quickly turn on or off
408 * tracing. It simply enables or disables the recording of the trace events. 410 * tracing. It simply enables or disables the recording of the trace events.
409 * This also corresponds to the user space debugfs/tracing/tracing_on 411 * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
410 * file, which gives a means for the kernel and userspace to interact. 412 * file, which gives a means for the kernel and userspace to interact.
411 * Place a tracing_off() in the kernel where you want tracing to end. 413 * Place a tracing_off() in the kernel where you want tracing to end.
412 * From user space, examine the trace, and then echo 1 > tracing_on 414 * From user space, examine the trace, and then echo 1 > tracing_on
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index a3c984d780f0..33a63f62d57f 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -56,6 +56,7 @@ extern int unregister_keyboard_notifier(struct notifier_block *nb);
56#define KT_ASCII 9 56#define KT_ASCII 9
57#define KT_LOCK 10 57#define KT_LOCK 10
58#define KT_SLOCK 12 58#define KT_SLOCK 12
59#define KT_DEAD2 13
59#define KT_BRL 14 60#define KT_BRL 14
60 61
61#define K(t,v) (((t)<<8)|(v)) 62#define K(t,v) (((t)<<8)|(v))
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
new file mode 100644
index 000000000000..47b39b7c7e84
--- /dev/null
+++ b/include/linux/kmemcheck.h
@@ -0,0 +1,153 @@
1#ifndef LINUX_KMEMCHECK_H
2#define LINUX_KMEMCHECK_H
3
4#include <linux/mm_types.h>
5#include <linux/types.h>
6
7#ifdef CONFIG_KMEMCHECK
8extern int kmemcheck_enabled;
9
10/* The slab-related functions. */
11void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
12void kmemcheck_free_shadow(struct page *page, int order);
13void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
14 size_t size);
15void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
16
17void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
18 gfp_t gfpflags);
19
20void kmemcheck_show_pages(struct page *p, unsigned int n);
21void kmemcheck_hide_pages(struct page *p, unsigned int n);
22
23bool kmemcheck_page_is_tracked(struct page *p);
24
25void kmemcheck_mark_unallocated(void *address, unsigned int n);
26void kmemcheck_mark_uninitialized(void *address, unsigned int n);
27void kmemcheck_mark_initialized(void *address, unsigned int n);
28void kmemcheck_mark_freed(void *address, unsigned int n);
29
30void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
31void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
32void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
33
34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address);
36
37#else
38#define kmemcheck_enabled 0
39
40static inline void
41kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
42{
43}
44
45static inline void
46kmemcheck_free_shadow(struct page *page, int order)
47{
48}
49
50static inline void
51kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
52 size_t size)
53{
54}
55
56static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
57 size_t size)
58{
59}
60
61static inline void kmemcheck_pagealloc_alloc(struct page *p,
62 unsigned int order, gfp_t gfpflags)
63{
64}
65
66static inline bool kmemcheck_page_is_tracked(struct page *p)
67{
68 return false;
69}
70
71static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
72{
73}
74
75static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
76{
77}
78
79static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
80{
81}
82
83static inline void kmemcheck_mark_freed(void *address, unsigned int n)
84{
85}
86
87static inline void kmemcheck_mark_unallocated_pages(struct page *p,
88 unsigned int n)
89{
90}
91
92static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
93 unsigned int n)
94{
95}
96
97static inline void kmemcheck_mark_initialized_pages(struct page *p,
98 unsigned int n)
99{
100}
101
102#endif /* CONFIG_KMEMCHECK */
103
104/*
105 * Bitfield annotations
106 *
107 * How to use: If you have a struct using bitfields, for example
108 *
109 * struct a {
110 * int x:8, y:8;
111 * };
112 *
113 * then this should be rewritten as
114 *
115 * struct a {
116 * kmemcheck_bitfield_begin(flags);
117 * int x:8, y:8;
118 * kmemcheck_bitfield_end(flags);
119 * };
120 *
121 * Now the "flags_begin" and "flags_end" members may be used to refer to the
122 * beginning and end, respectively, of the bitfield (and things like
123 * &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
124 * fields should be annotated:
125 *
126 * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
127 * kmemcheck_annotate_bitfield(a, flags);
128 *
129 * Note: We provide the same definitions for both kmemcheck and non-
130 * kmemcheck kernels. This makes it harder to introduce accidental errors. It
131 * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield().
132 */
133#define kmemcheck_bitfield_begin(name) \
134 int name##_begin[0];
135
136#define kmemcheck_bitfield_end(name) \
137 int name##_end[0];
138
139#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \
141 int _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \
144 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0)
147
148#define kmemcheck_annotate_variable(var) \
149 do { \
150 kmemcheck_mark_initialized(&(var), sizeof(var)); \
151 } while (0) \
152
153#endif /* LINUX_KMEMCHECK_H */
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h
index 08a92969c76e..ca5bd91d12e1 100644
--- a/include/linux/linux_logo.h
+++ b/include/linux/linux_logo.h
@@ -32,6 +32,22 @@ struct linux_logo {
32 const unsigned char *data; 32 const unsigned char *data;
33}; 33};
34 34
35extern const struct linux_logo logo_linux_mono;
36extern const struct linux_logo logo_linux_vga16;
37extern const struct linux_logo logo_linux_clut224;
38extern const struct linux_logo logo_blackfin_vga16;
39extern const struct linux_logo logo_blackfin_clut224;
40extern const struct linux_logo logo_dec_clut224;
41extern const struct linux_logo logo_mac_clut224;
42extern const struct linux_logo logo_parisc_clut224;
43extern const struct linux_logo logo_sgi_clut224;
44extern const struct linux_logo logo_sun_clut224;
45extern const struct linux_logo logo_superh_mono;
46extern const struct linux_logo logo_superh_vga16;
47extern const struct linux_logo logo_superh_clut224;
48extern const struct linux_logo logo_m32r_clut224;
49extern const struct linux_logo logo_spe_clut224;
50
35extern const struct linux_logo *fb_find_logo(int depth); 51extern const struct linux_logo *fb_find_logo(int depth);
36#ifdef CONFIG_FB_LOGO_EXTRA 52#ifdef CONFIG_FB_LOGO_EXTRA
37extern void fb_append_extra_logo(const struct linux_logo *logo, 53extern void fb_append_extra_logo(const struct linux_logo *logo,
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
new file mode 100644
index 000000000000..ad651f4e45ac
--- /dev/null
+++ b/include/linux/lis3lv02d.h
@@ -0,0 +1,39 @@
1#ifndef __LIS3LV02D_H_
2#define __LIS3LV02D_H_
3
4struct lis3lv02d_platform_data {
5 /* please note: the 'click' feature is only supported for
6 * LIS[32]02DL variants of the chip and will be ignored for
7 * others */
8#define LIS3_CLICK_SINGLE_X (1 << 0)
9#define LIS3_CLICK_DOUBLE_X (1 << 1)
10#define LIS3_CLICK_SINGLE_Y (1 << 2)
11#define LIS3_CLICK_DOUBLE_Y (1 << 3)
12#define LIS3_CLICK_SINGLE_Z (1 << 4)
13#define LIS3_CLICK_DOUBLE_Z (1 << 5)
14 unsigned char click_flags;
15 unsigned char click_thresh_x;
16 unsigned char click_thresh_y;
17 unsigned char click_thresh_z;
18 unsigned char click_time_limit;
19 unsigned char click_latency;
20 unsigned char click_window;
21
22#define LIS3_IRQ1_DISABLE (0 << 0)
23#define LIS3_IRQ1_FF_WU_1 (1 << 0)
24#define LIS3_IRQ1_FF_WU_2 (2 << 0)
25#define LIS3_IRQ1_FF_WU_12 (3 << 0)
26#define LIS3_IRQ1_DATA_READY (4 << 0)
27#define LIS3_IRQ1_CLICK (7 << 0)
28#define LIS3_IRQ2_DISABLE (0 << 3)
29#define LIS3_IRQ2_FF_WU_1 (1 << 3)
30#define LIS3_IRQ2_FF_WU_2 (2 << 3)
31#define LIS3_IRQ2_FF_WU_12 (3 << 3)
32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7)
36 unsigned char irq_cfg;
37};
38
39#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
index 93150ecf3ea4..5d10ae364b5e 100644
--- a/include/linux/list_nulls.h
+++ b/include/linux/list_nulls.h
@@ -56,6 +56,18 @@ static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
56 return is_a_nulls(h->first); 56 return is_a_nulls(h->first);
57} 57}
58 58
59static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,
60 struct hlist_nulls_head *h)
61{
62 struct hlist_nulls_node *first = h->first;
63
64 n->next = first;
65 n->pprev = &h->first;
66 h->first = n;
67 if (!is_a_nulls(first))
68 first->pprev = &n->next;
69}
70
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n) 71static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{ 72{
61 struct hlist_nulls_node *next = n->next; 73 struct hlist_nulls_node *next = n->next;
@@ -65,6 +77,12 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
65 next->pprev = pprev; 77 next->pprev = pprev;
66} 78}
67 79
80static inline void hlist_nulls_del(struct hlist_nulls_node *n)
81{
82 __hlist_nulls_del(n);
83 n->pprev = LIST_POISON2;
84}
85
68/** 86/**
69 * hlist_nulls_for_each_entry - iterate over list of given type 87 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor. 88 * @tpos: the type * to use as a loop cursor.
diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h
index 6b71d2dce508..41d1eeb9b3bd 100644
--- a/include/linux/mISDNdsp.h
+++ b/include/linux/mISDNdsp.h
@@ -12,7 +12,8 @@ struct mISDN_dsp_element {
12 void *(*new)(const char *arg); 12 void *(*new)(const char *arg);
13 void (*free)(void *p); 13 void (*free)(void *p);
14 void (*process_tx)(void *p, unsigned char *data, int len); 14 void (*process_tx)(void *p, unsigned char *data, int len);
15 void (*process_rx)(void *p, unsigned char *data, int len); 15 void (*process_rx)(void *p, unsigned char *data, int len,
16 unsigned int txlen);
16 int num_args; 17 int num_args;
17 struct mISDN_dsp_element_arg 18 struct mISDN_dsp_element_arg
18 *args; 19 *args;
@@ -24,6 +25,7 @@ extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);
24struct dsp_features { 25struct dsp_features {
25 int hfc_id; /* unique id to identify the chip (or -1) */ 26 int hfc_id; /* unique id to identify the chip (or -1) */
26 int hfc_dtmf; /* set if HFCmulti card supports dtmf */ 27 int hfc_dtmf; /* set if HFCmulti card supports dtmf */
28 int hfc_conf; /* set if HFCmulti card supports conferences */
27 int hfc_loops; /* set if card supports tone loops */ 29 int hfc_loops; /* set if card supports tone loops */
28 int hfc_echocanhw; /* set if card supports echocancelation*/ 30 int hfc_echocanhw; /* set if card supports echocancelation*/
29 int pcm_id; /* unique id to identify the pcm bus (or -1) */ 31 int pcm_id; /* unique id to identify the pcm bus (or -1) */
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 97ffdc1d3442..7f9831da847f 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -89,11 +89,6 @@ struct dchannel {
89 void (*phfunc) (struct dchannel *); 89 void (*phfunc) (struct dchannel *);
90 u_int state; 90 u_int state;
91 void *l1; 91 void *l1;
92 /* HW access */
93 u_char (*read_reg) (void *, u_char);
94 void (*write_reg) (void *, u_char, u_char);
95 void (*read_fifo) (void *, u_char *, int);
96 void (*write_fifo) (void *, u_char *, int);
97 void *hw; 92 void *hw;
98 int slot; /* multiport card channel slot */ 93 int slot; /* multiport card channel slot */
99 struct timer_list timer; 94 struct timer_list timer;
@@ -151,11 +146,6 @@ struct bchannel {
151 u_long Flags; 146 u_long Flags;
152 struct work_struct workq; 147 struct work_struct workq;
153 u_int state; 148 u_int state;
154 /* HW access */
155 u_char (*read_reg) (void *, u_char);
156 void (*write_reg) (void *, u_char, u_char);
157 void (*read_fifo) (void *, u_char *, int);
158 void (*write_fifo) (void *, u_char *, int);
159 void *hw; 149 void *hw;
160 int slot; /* multiport card channel slot */ 150 int slot; /* multiport card channel slot */
161 struct timer_list timer; 151 struct timer_list timer;
@@ -185,7 +175,7 @@ extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
185extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 175extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
186extern void recv_Dchannel(struct dchannel *); 176extern void recv_Dchannel(struct dchannel *);
187extern void recv_Echannel(struct dchannel *, struct dchannel *); 177extern void recv_Echannel(struct dchannel *, struct dchannel *);
188extern void recv_Bchannel(struct bchannel *); 178extern void recv_Bchannel(struct bchannel *, unsigned int id);
189extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 179extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
190extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 180extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
191extern void confirm_Bsend(struct bchannel *bch); 181extern void confirm_Bsend(struct bchannel *bch);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 5da3d95b27f1..45100b39a7cf 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -229,6 +229,7 @@
229#define OPTION_L2_PTP 2 229#define OPTION_L2_PTP 2
230#define OPTION_L2_FIXEDTEI 3 230#define OPTION_L2_FIXEDTEI 3
231#define OPTION_L2_CLEANUP 4 231#define OPTION_L2_CLEANUP 4
232#define OPTION_L1_HOLD 5
232 233
233/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */ 234/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
234#define MISDN_MAX_IDLEN 20 235#define MISDN_MAX_IDLEN 20
@@ -291,19 +292,19 @@ struct mISDN_devrename {
291 292
292/* MPH_INFORMATION_REQ payload */ 293/* MPH_INFORMATION_REQ payload */
293struct ph_info_ch { 294struct ph_info_ch {
294 __u32 protocol; 295 __u32 protocol;
295 __u64 Flags; 296 __u64 Flags;
296}; 297};
297 298
298struct ph_info_dch { 299struct ph_info_dch {
299 struct ph_info_ch ch; 300 struct ph_info_ch ch;
300 __u16 state; 301 __u16 state;
301 __u16 num_bch; 302 __u16 num_bch;
302}; 303};
303 304
304struct ph_info { 305struct ph_info {
305 struct ph_info_dch dch; 306 struct ph_info_dch dch;
306 struct ph_info_ch bch[]; 307 struct ph_info_ch bch[];
307}; 308};
308 309
309/* timer device ioctl */ 310/* timer device ioctl */
@@ -317,6 +318,7 @@ struct ph_info {
317#define IMCTRLREQ _IOR('I', 69, int) 318#define IMCTRLREQ _IOR('I', 69, int)
318#define IMCLEAR_L2 _IOR('I', 70, int) 319#define IMCLEAR_L2 _IOR('I', 70, int)
319#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename) 320#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
321#define IMHOLD_L1 _IOR('I', 72, int)
320 322
321static inline int 323static inline int
322test_channelmap(u_int nr, u_char *map) 324test_channelmap(u_int nr, u_char *map)
@@ -362,7 +364,8 @@ clear_channelmap(u_int nr, u_char *map)
362#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006 364#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
363#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007 365#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
364#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 366#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
365 367#define MISDN_CTRL_HFC_WD_INIT 0x4009
368#define MISDN_CTRL_HFC_WD_RESET 0x400A
366 369
367/* socket options */ 370/* socket options */
368#define MISDN_TIME_STAMP 0x0001 371#define MISDN_TIME_STAMP 0x0001
diff --git a/include/linux/major.h b/include/linux/major.h
index 058ec15dd060..6a8ca98c9a96 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -145,6 +145,7 @@
145#define UNIX98_PTY_MAJOR_COUNT 8 145#define UNIX98_PTY_MAJOR_COUNT 8
146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) 146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
147 147
148#define DRBD_MAJOR 147
148#define RTF_MAJOR 150 149#define RTF_MAJOR 150
149#define RAW_MAJOR 162 150#define RAW_MAJOR 162
150 151
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
new file mode 100644
index 000000000000..cfdf1df2875e
--- /dev/null
+++ b/include/linux/mdio.h
@@ -0,0 +1,356 @@
1/*
2 * linux/mdio.h: definitions for MDIO (clause 45) transceivers
3 * Copyright 2006-2009 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__
12
13#include <linux/mii.h>
14
15/* MDIO Manageable Devices (MMDs). */
16#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
17 * Physical Medium Dependent */
18#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
19#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
20#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
21#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
22#define MDIO_MMD_TC 6 /* Transmission Convergence */
23#define MDIO_MMD_AN 7 /* Auto-Negotiation */
24#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
25#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
26#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
27
28/* Generic MDIO registers. */
29#define MDIO_CTRL1 MII_BMCR
30#define MDIO_STAT1 MII_BMSR
31#define MDIO_DEVID1 MII_PHYSID1
32#define MDIO_DEVID2 MII_PHYSID2
33#define MDIO_SPEED 4 /* Speed ability */
34#define MDIO_DEVS1 5 /* Devices in package */
35#define MDIO_DEVS2 6
36#define MDIO_CTRL2 7 /* 10G control 2 */
37#define MDIO_STAT2 8 /* 10G status 2 */
38#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
39#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
40#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
41#define MDIO_PKGID1 14 /* Package identifier */
42#define MDIO_PKGID2 15
43#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
44#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
45#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
46
47/* Media-dependent registers. */
48#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
49#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
50#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
51 * Lanes B-D are numbered 134-136. */
52#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
53#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
54#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
55#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
56#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
57#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
58
59/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
60#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
61#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
62#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
63#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
64#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
65#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
66
67/* Control register 1. */
68/* Enable extended speed selection */
69#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
70/* All speed selection bits */
71#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
72#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
73#define MDIO_CTRL1_LPOWER BMCR_PDOWN
74#define MDIO_CTRL1_RESET BMCR_RESET
75#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
76#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
77#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
78#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
79#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
80#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
81#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
82#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
83
84/* 10 Gb/s */
85#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
86/* 10PASS-TS/2BASE-TL */
87#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
88
89/* Status register 1. */
90#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
91#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
92#define MDIO_STAT1_FAULT 0x0080 /* Fault */
93#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
94#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
95#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
96#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
97#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
98#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
99
100/* Speed register. */
101#define MDIO_SPEED_10G 0x0001 /* 10G capable */
102#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
103#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
104#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
105#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
106#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
107#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
108
109/* Device present registers. */
110#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
111#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
112#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
113#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
114#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
115#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
116#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
117#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
118#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
119
120/* Control register 2. */
121#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
122#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
123#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
124#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
125#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
126#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
127#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
128#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
129#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
130#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
131#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
132#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
133#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
134#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
135#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
136#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
137#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
138#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
139#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
140#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
141#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
142#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
143
144/* Status register 2. */
145#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
146#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
147#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
148#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
149#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
150#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
151#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
152#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
153#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
154#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
155#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
156#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
157#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
158#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
159#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
160#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
161#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
162#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
163#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
164#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
165#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
166
167/* Transmit disable register. */
168#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
169#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
170#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
171#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
172#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
173
174/* Receive signal detect register. */
175#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
176#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
177#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
178#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
179#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
180
181/* Extended abilities register. */
182#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
183#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
184#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
185#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
186#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
187#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
188#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
189#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
190#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
191
192/* PHY XGXS lane state register. */
193#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
194#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
195#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
196#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
197#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
198
199/* PMA 10GBASE-T pair swap & polarity */
200#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */
201#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */
202#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */
203#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */
204#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */
205#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */
206
207/* PMA 10GBASE-T TX power register. */
208#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
209
210/* PMA 10GBASE-T SNR registers. */
211/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
212#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
213#define MDIO_PMA_10GBT_SNR_MAX 127
214
215/* PMA 10GBASE-R FEC ability register. */
216#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
217#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
218
219/* PCS 10GBASE-R/-T status register 1. */
220#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
221
222/* PCS 10GBASE-R/-T status register 2. */
223#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
224#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
225
226/* AN 10GBASE-T control register. */
227#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
228
229/* AN 10GBASE-T status register. */
230#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
231#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
232#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
233#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
234#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
235#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
236#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
237
238/* LASI RX_ALARM control/status registers. */
239#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
240#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
241#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
242#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
243#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
244
245/* LASI TX_ALARM control/status registers. */
246#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
247#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
248#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
249#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
250#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
251#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
252
253/* LASI control/status registers. */
254#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
255#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
256#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
257
258/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
259
260#define MDIO_PHY_ID_C45 0x8000
261#define MDIO_PHY_ID_PRTAD 0x03e0
262#define MDIO_PHY_ID_DEVAD 0x001f
263#define MDIO_PHY_ID_C45_MASK \
264 (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
265
266static inline __u16 mdio_phy_id_c45(int prtad, int devad)
267{
268 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
269}
270
271static inline bool mdio_phy_id_is_c45(int phy_id)
272{
273 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
274}
275
276static inline __u16 mdio_phy_id_prtad(int phy_id)
277{
278 return (phy_id & MDIO_PHY_ID_PRTAD) >> 5;
279}
280
281static inline __u16 mdio_phy_id_devad(int phy_id)
282{
283 return phy_id & MDIO_PHY_ID_DEVAD;
284}
285
286#define MDIO_SUPPORTS_C22 1
287#define MDIO_SUPPORTS_C45 2
288
289#ifdef __KERNEL__
290
291/**
292 * struct mdio_if_info - Ethernet controller MDIO interface
293 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
294 * @mmds: Mask of MMDs expected to be present in the PHY. This must be
295 * non-zero unless @prtad = %MDIO_PRTAD_NONE.
296 * @mode_support: MDIO modes supported. If %MDIO_SUPPORTS_C22 is set then
297 * MII register access will be passed through with @devad =
298 * %MDIO_DEVAD_NONE. If %MDIO_EMULATE_C22 is set then access to
299 * commonly used clause 22 registers will be translated into
300 * clause 45 registers.
301 * @dev: Net device structure
302 * @mdio_read: Register read function; returns value or negative error code
303 * @mdio_write: Register write function; returns 0 or negative error code
304 */
305struct mdio_if_info {
306 int prtad;
307 u32 __bitwise mmds;
308 unsigned mode_support;
309
310 struct net_device *dev;
311 int (*mdio_read)(struct net_device *dev, int prtad, int devad,
312 u16 addr);
313 int (*mdio_write)(struct net_device *dev, int prtad, int devad,
314 u16 addr, u16 val);
315};
316
317#define MDIO_PRTAD_NONE (-1)
318#define MDIO_DEVAD_NONE (-1)
319#define MDIO_EMULATE_C22 4
320
321struct ethtool_cmd;
322struct ethtool_pauseparam;
323extern int mdio45_probe(struct mdio_if_info *mdio, int prtad);
324extern int mdio_set_flag(const struct mdio_if_info *mdio,
325 int prtad, int devad, u16 addr, int mask,
326 bool sense);
327extern int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmds);
328extern int mdio45_nway_restart(const struct mdio_if_info *mdio);
329extern void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
330 struct ethtool_cmd *ecmd,
331 u32 npage_adv, u32 npage_lpa);
332extern void
333mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio,
334 const struct ethtool_pauseparam *ecmd);
335
336/**
337 * mdio45_ethtool_gset - get settings for ETHTOOL_GSET
338 * @mdio: MDIO interface
339 * @ecmd: Ethtool request structure
340 *
341 * Since the CSRs for auto-negotiation using next pages are not fully
342 * standardised, this function does not attempt to decode them. Use
343 * mdio45_ethtool_gset_npage() to specify advertisement bits from next
344 * pages.
345 */
346static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
347 struct ethtool_cmd *ecmd)
348{
349 mdio45_ethtool_gset_npage(mdio, ecmd, 0, 0);
350}
351
352extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
353 struct mii_ioctl_data *mii_data, int cmd);
354
355#endif /* __KERNEL__ */
356#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 25b9ca93d232..45add35dda1b 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
95 int priority); 95 int priority);
96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
97int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
97unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 98unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
98 struct zone *zone, 99 struct zone *zone,
99 enum lru_list lru); 100 enum lru_list lru);
@@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
239 return 1; 240 return 1;
240} 241}
241 242
243static inline int
244mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
245{
246 return 1;
247}
248
242static inline unsigned long 249static inline unsigned long
243mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, 250mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
244 enum lru_list lru) 251 enum lru_list lru)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 516d955ab8a1..c377118884e6 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -19,6 +19,13 @@
19 } while (0) 19 } while (0)
20 20
21/* 21/*
22 * data for the MMC controller
23 */
24struct tmio_mmc_data {
25 unsigned int hclk;
26};
27
28/*
22 * data for the NAND controller 29 * data for the NAND controller
23 */ 30 */
24struct tmio_nand_data { 31struct tmio_nand_data {
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
new file mode 100644
index 000000000000..e11f4d9f1c2e
--- /dev/null
+++ b/include/linux/mg_disk.h
@@ -0,0 +1,45 @@
1/*
2 * include/linux/mg_disk.c
3 *
4 * Private data for mflash platform driver
5 *
6 * (c) 2008 mGine Co.,LTD
7 * (c) 2008 unsik Kim <donari75@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __MG_DISK_H__
15#define __MG_DISK_H__
16
17/* name for platform device */
18#define MG_DEV_NAME "mg_disk"
19
20/* names of GPIO resource */
21#define MG_RST_PIN "mg_rst"
22/* except MG_BOOT_DEV, reset-out pin should be assigned */
23#define MG_RSTOUT_PIN "mg_rstout"
24
25/* device attribution */
26/* use mflash as boot device */
27#define MG_BOOT_DEV (1 << 0)
28/* use mflash as storage device */
29#define MG_STORAGE_DEV (1 << 1)
30/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
31#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
32
33/* private driver data */
34struct mg_drv_data {
35 /* disk resource */
36 u32 use_polling;
37
38 /* device attribution */
39 u32 dev_attr;
40
41 /* internally used */
42 void *host;
43};
44
45#endif
diff --git a/include/linux/mii.h b/include/linux/mii.h
index ad748588faf1..359fba880274 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -240,6 +240,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 240}
241 241
242/** 242/**
243 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */
246static inline u16 mii_advertise_flowctrl(int cap)
247{
248 u16 adv = 0;
249
250 if (cap & FLOW_CTRL_RX)
251 adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
252 if (cap & FLOW_CTRL_TX)
253 adv ^= ADVERTISE_PAUSE_ASYM;
254
255 return adv;
256}
257
258/**
243 * mii_resolve_flowctrl_fdx 259 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register 260 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register 261 * @rmtadv: value of MII LPA register
@@ -250,18 +266,12 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{ 266{
251 u8 cap = 0; 267 u8 cap = 0;
252 268
253 if (lcladv & ADVERTISE_PAUSE_CAP) { 269 if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) { 270 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
255 if (rmtadv & LPA_PAUSE_CAP) 271 } else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX; 272 if (lcladv & ADVERTISE_PAUSE_CAP)
257 else if (rmtadv & LPA_PAUSE_ASYM) 273 cap = FLOW_CTRL_RX;
258 cap = FLOW_CTRL_RX; 274 else if (rmtadv & ADVERTISE_PAUSE_CAP)
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; 275 cap = FLOW_CTRL_TX;
266 } 276 }
267 277
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index beb6ec99cfef..052117744629 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,6 +41,7 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode;
44}; 45};
45 46
46extern int misc_register(struct miscdevice * misc); 47extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 3aff8a6a389e..ce7cc6c7bcbb 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -210,6 +210,7 @@ struct mlx4_caps {
210 int num_comp_vectors; 210 int num_comp_vectors;
211 int num_mpts; 211 int num_mpts;
212 int num_mtt_segs; 212 int num_mtt_segs;
213 int mtts_per_seg;
213 int fmr_reserved_mtts; 214 int fmr_reserved_mtts;
214 int reserved_mtts; 215 int reserved_mtts;
215 int reserved_mrws; 216 int reserved_mrws;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bf8f11982dae..9f29d86e5dc9 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -165,6 +165,7 @@ enum {
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4, 165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6, 167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
168 MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
168}; 169};
169 170
170struct mlx4_wqe_ctrl_seg { 171struct mlx4_wqe_ctrl_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b457bc047ab1..cf260d848eb9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -7,7 +7,6 @@
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/mmdebug.h>
11#include <linux/mmzone.h> 10#include <linux/mmzone.h>
12#include <linux/rbtree.h> 11#include <linux/rbtree.h>
13#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
@@ -725,7 +724,7 @@ static inline int shmem_lock(struct file *file, int lock,
725 return 0; 724 return 0;
726} 725}
727#endif 726#endif
728struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 727struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
729 728
730int shmem_zero_setup(struct vm_area_struct *); 729int shmem_zero_setup(struct vm_area_struct *);
731 730
@@ -793,6 +792,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
793 struct vm_area_struct *vma); 792 struct vm_area_struct *vma);
794void unmap_mapping_range(struct address_space *mapping, 793void unmap_mapping_range(struct address_space *mapping,
795 loff_t const holebegin, loff_t const holelen, int even_cows); 794 loff_t const holebegin, loff_t const holelen, int even_cows);
795int follow_pfn(struct vm_area_struct *vma, unsigned long address,
796 unsigned long *pfn);
796int follow_phys(struct vm_area_struct *vma, unsigned long address, 797int follow_phys(struct vm_area_struct *vma, unsigned long address,
797 unsigned int flags, unsigned long *prot, resource_size_t *phys); 798 unsigned int flags, unsigned long *prot, resource_size_t *phys);
798int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 799int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
@@ -824,8 +825,11 @@ static inline int handle_mm_fault(struct mm_struct *mm,
824extern int make_pages_present(unsigned long addr, unsigned long end); 825extern int make_pages_present(unsigned long addr, unsigned long end);
825extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 826extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
826 827
827int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 828int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
828 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 829 unsigned long start, int len, int write, int force,
830 struct page **pages, struct vm_area_struct **vmas);
831int get_user_pages_fast(unsigned long start, int nr_pages, int write,
832 struct page **pages);
829 833
830extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 834extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
831extern void do_invalidatepage(struct page *page, unsigned long offset); 835extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -850,19 +854,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
850 unsigned long end, unsigned long newflags); 854 unsigned long end, unsigned long newflags);
851 855
852/* 856/*
853 * get_user_pages_fast provides equivalent functionality to get_user_pages,
854 * operating on current and current->mm (force=0 and doesn't return any vmas).
855 *
856 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
857 * can be made about locking. get_user_pages_fast is to be implemented in a
858 * way that is advantageous (vs get_user_pages()) when the user memory area is
859 * already faulted in and present in ptes. However if the pages have to be
860 * faulted in, it may turn out to be slightly slower).
861 */
862int get_user_pages_fast(unsigned long start, int nr_pages, int write,
863 struct page **pages);
864
865/*
866 * doesn't attempt to fault and will return short. 857 * doesn't attempt to fault and will return short.
867 */ 858 */
868int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 859int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
@@ -1067,7 +1058,8 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1067extern void set_dma_reserve(unsigned long new_dma_reserve); 1058extern void set_dma_reserve(unsigned long new_dma_reserve);
1068extern void memmap_init_zone(unsigned long, int, unsigned long, 1059extern void memmap_init_zone(unsigned long, int, unsigned long,
1069 unsigned long, enum memmap_context); 1060 unsigned long, enum memmap_context);
1070extern void setup_per_zone_pages_min(void); 1061extern void setup_per_zone_wmarks(void);
1062extern void calculate_zone_inactive_ratio(struct zone *zone);
1071extern void mem_init(void); 1063extern void mem_init(void);
1072extern void __init mmap_init(void); 1064extern void __init mmap_init(void);
1073extern void show_mem(void); 1065extern void show_mem(void);
@@ -1184,8 +1176,6 @@ void task_dirty_inc(struct task_struct *tsk);
1184#define VM_MAX_READAHEAD 128 /* kbytes */ 1176#define VM_MAX_READAHEAD 128 /* kbytes */
1185#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ 1177#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
1186 1178
1187int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
1188 pgoff_t offset, unsigned long nr_to_read);
1189int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1179int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
1190 pgoff_t offset, unsigned long nr_to_read); 1180 pgoff_t offset, unsigned long nr_to_read);
1191 1181
@@ -1203,6 +1193,9 @@ void page_cache_async_readahead(struct address_space *mapping,
1203 unsigned long size); 1193 unsigned long size);
1204 1194
1205unsigned long max_sane_readahead(unsigned long nr); 1195unsigned long max_sane_readahead(unsigned long nr);
1196unsigned long ra_submit(struct file_ra_state *ra,
1197 struct address_space *mapping,
1198 struct file *filp);
1206 1199
1207/* Do stack extension */ 1200/* Do stack extension */
1208extern int expand_stack(struct vm_area_struct *vma, unsigned long address); 1201extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0e80e26ecf21..7acc8439d9b3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -98,6 +98,14 @@ struct page {
98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
99 unsigned long debug_flags; /* Use atomic bitops on this */ 99 unsigned long debug_flags; /* Use atomic bitops on this */
100#endif 100#endif
101
102#ifdef CONFIG_KMEMCHECK
103 /*
104 * kmemcheck wants to track the status of each byte in a page; this
105 * is a pointer to such a status block. NULL if not tracked.
106 */
107 void *shadow;
108#endif
101}; 109};
102 110
103/* 111/*
@@ -232,6 +240,8 @@ struct mm_struct {
232 240
233 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
234 242
243 s8 oom_adj; /* OOM kill score adjustment (bit shift) */
244
235 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
236 246
237 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index ea1bf5ba092f..39751c8cde9c 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -25,5 +25,15 @@
25 25
26#define SDIO_VENDOR_ID_MARVELL 0x02df 26#define SDIO_VENDOR_ID_MARVELL 0x02df
27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
28#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
29#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105
30
31#define SDIO_VENDOR_ID_SIANO 0x039a
32#define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
33#define SDIO_DEVICE_ID_SIANO_NICE 0x0202
34#define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300
35#define SDIO_DEVICE_ID_SIANO_VENICE 0x0301
36#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
37#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
28 38
29#endif 39#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a47c879e1304..889598537370 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled;
50 50
51static inline int get_pageblock_migratetype(struct page *page) 51static inline int get_pageblock_migratetype(struct page *page)
52{ 52{
53 if (unlikely(page_group_by_mobility_disabled))
54 return MIGRATE_UNMOVABLE;
55
56 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); 53 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
57} 54}
58 55
@@ -86,13 +83,8 @@ enum zone_stat_item {
86 NR_ACTIVE_ANON, /* " " " " " */ 83 NR_ACTIVE_ANON, /* " " " " " */
87 NR_INACTIVE_FILE, /* " " " " " */ 84 NR_INACTIVE_FILE, /* " " " " " */
88 NR_ACTIVE_FILE, /* " " " " " */ 85 NR_ACTIVE_FILE, /* " " " " " */
89#ifdef CONFIG_UNEVICTABLE_LRU
90 NR_UNEVICTABLE, /* " " " " " */ 86 NR_UNEVICTABLE, /* " " " " " */
91 NR_MLOCK, /* mlock()ed pages found and moved off LRU */ 87 NR_MLOCK, /* mlock()ed pages found and moved off LRU */
92#else
93 NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */
94 NR_MLOCK = NR_ACTIVE_FILE,
95#endif
96 NR_ANON_PAGES, /* Mapped anonymous pages */ 88 NR_ANON_PAGES, /* Mapped anonymous pages */
97 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 89 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
98 only modified from process context */ 90 only modified from process context */
@@ -135,11 +127,7 @@ enum lru_list {
135 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, 127 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
136 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, 128 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
137 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, 129 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
138#ifdef CONFIG_UNEVICTABLE_LRU
139 LRU_UNEVICTABLE, 130 LRU_UNEVICTABLE,
140#else
141 LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */
142#endif
143 NR_LRU_LISTS 131 NR_LRU_LISTS
144}; 132};
145 133
@@ -159,13 +147,20 @@ static inline int is_active_lru(enum lru_list l)
159 147
160static inline int is_unevictable_lru(enum lru_list l) 148static inline int is_unevictable_lru(enum lru_list l)
161{ 149{
162#ifdef CONFIG_UNEVICTABLE_LRU
163 return (l == LRU_UNEVICTABLE); 150 return (l == LRU_UNEVICTABLE);
164#else
165 return 0;
166#endif
167} 151}
168 152
153enum zone_watermarks {
154 WMARK_MIN,
155 WMARK_LOW,
156 WMARK_HIGH,
157 NR_WMARK
158};
159
160#define min_wmark_pages(z) (z->watermark[WMARK_MIN])
161#define low_wmark_pages(z) (z->watermark[WMARK_LOW])
162#define high_wmark_pages(z) (z->watermark[WMARK_HIGH])
163
169struct per_cpu_pages { 164struct per_cpu_pages {
170 int count; /* number of pages in the list */ 165 int count; /* number of pages in the list */
171 int high; /* high watermark, emptying needed */ 166 int high; /* high watermark, emptying needed */
@@ -278,7 +273,10 @@ struct zone_reclaim_stat {
278 273
279struct zone { 274struct zone {
280 /* Fields commonly accessed by the page allocator */ 275 /* Fields commonly accessed by the page allocator */
281 unsigned long pages_min, pages_low, pages_high; 276
277 /* zone watermarks, access with *_wmark_pages(zone) macros */
278 unsigned long watermark[NR_WMARK];
279
282 /* 280 /*
283 * We don't know if the memory that we're going to allocate will be freeable 281 * We don't know if the memory that we're going to allocate will be freeable
284 * or/and it will be released eventually, so to avoid totally wasting several 282 * or/and it will be released eventually, so to avoid totally wasting several
@@ -323,9 +321,9 @@ struct zone {
323 321
324 /* Fields commonly accessed by the page reclaim scanner */ 322 /* Fields commonly accessed by the page reclaim scanner */
325 spinlock_t lru_lock; 323 spinlock_t lru_lock;
326 struct { 324 struct zone_lru {
327 struct list_head list; 325 struct list_head list;
328 unsigned long nr_scan; 326 unsigned long nr_saved_scan; /* accumulated for batching */
329 } lru[NR_LRU_LISTS]; 327 } lru[NR_LRU_LISTS];
330 328
331 struct zone_reclaim_stat reclaim_stat; 329 struct zone_reclaim_stat reclaim_stat;
diff --git a/include/linux/module.h b/include/linux/module.h
index a7bc6e7b43a7..505f20dcc1c7 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -697,4 +697,21 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
697 697
698#define __MODULE_STRING(x) __stringify(x) 698#define __MODULE_STRING(x) __stringify(x)
699 699
700
701#ifdef CONFIG_GENERIC_BUG
702int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
703 struct module *);
704void module_bug_cleanup(struct module *);
705
706#else /* !CONFIG_GENERIC_BUG */
707
708static inline int module_bug_finalize(const Elf_Ehdr *hdr,
709 const Elf_Shdr *sechdrs,
710 struct module *mod)
711{
712 return 0;
713}
714static inline void module_bug_cleanup(struct module *mod) {}
715#endif /* CONFIG_GENERIC_BUG */
716
700#endif /* _LINUX_MODULE_H */ 717#endif /* _LINUX_MODULE_H */
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
index 0e2e100c44a2..3ceb0cc1bc78 100644
--- a/include/linux/net_dropmon.h
+++ b/include/linux/net_dropmon.h
@@ -3,12 +3,20 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/types.h>
6 7
7struct net_dm_drop_point { 8struct net_dm_drop_point {
8 __u8 pc[8]; 9 __u8 pc[8];
9 __u32 count; 10 __u32 count;
10}; 11};
11 12
13#define is_drop_point_hw(x) do {\
14 int ____i, ____j;\
15 for (____i = 0; ____i < 8; i ____i++)\
16 ____j |= x[____i];\
17 ____j;\
18} while (0)
19
12#define NET_DM_CFG_VERSION 0 20#define NET_DM_CFG_VERSION 0
13#define NET_DM_CFG_ALERT_COUNT 1 21#define NET_DM_CFG_ALERT_COUNT 1
14#define NET_DM_CFG_ALERT_DELAY 2 22#define NET_DM_CFG_ALERT_DELAY 2
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a96a1a406e9..9ea8d6dfe540 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -39,9 +39,11 @@
39 39
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/percpu.h> 41#include <linux/percpu.h>
42#include <linux/rculist.h>
42#include <linux/dmaengine.h> 43#include <linux/dmaengine.h>
43#include <linux/workqueue.h> 44#include <linux/workqueue.h>
44 45
46#include <linux/ethtool.h>
45#include <net/net_namespace.h> 47#include <net/net_namespace.h>
46#include <net/dsa.h> 48#include <net/dsa.h>
47#ifdef CONFIG_DCB 49#ifdef CONFIG_DCB
@@ -49,7 +51,6 @@
49#endif 51#endif
50 52
51struct vlan_group; 53struct vlan_group;
52struct ethtool_ops;
53struct netpoll_info; 54struct netpoll_info;
54/* 802.11 specific */ 55/* 802.11 specific */
55struct wireless_dev; 56struct wireless_dev;
@@ -210,6 +211,19 @@ struct dev_addr_list
210#define dmi_users da_users 211#define dmi_users da_users
211#define dmi_gusers da_gusers 212#define dmi_gusers da_gusers
212 213
214struct netdev_hw_addr {
215 struct list_head list;
216 unsigned char addr[MAX_ADDR_LEN];
217 unsigned char type;
218#define NETDEV_HW_ADDR_T_LAN 1
219#define NETDEV_HW_ADDR_T_SAN 2
220#define NETDEV_HW_ADDR_T_SLAVE 3
221#define NETDEV_HW_ADDR_T_UNICAST 4
222 int refcount;
223 bool synced;
224 struct rcu_head rcu_head;
225};
226
213struct hh_cache 227struct hh_cache
214{ 228{
215 struct hh_cache *hh_next; /* Next entry */ 229 struct hh_cache *hh_next; /* Next entry */
@@ -447,12 +461,25 @@ enum netdev_queue_state_t
447}; 461};
448 462
449struct netdev_queue { 463struct netdev_queue {
464/*
465 * read mostly part
466 */
450 struct net_device *dev; 467 struct net_device *dev;
451 struct Qdisc *qdisc; 468 struct Qdisc *qdisc;
452 unsigned long state; 469 unsigned long state;
453 spinlock_t _xmit_lock;
454 int xmit_lock_owner;
455 struct Qdisc *qdisc_sleeping; 470 struct Qdisc *qdisc_sleeping;
471/*
472 * write mostly part
473 */
474 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
475 int xmit_lock_owner;
476 /*
477 * please use this field instead of dev->trans_start
478 */
479 unsigned long trans_start;
480 unsigned long tx_bytes;
481 unsigned long tx_packets;
482 unsigned long tx_dropped;
456} ____cacheline_aligned_in_smp; 483} ____cacheline_aligned_in_smp;
457 484
458 485
@@ -670,7 +697,9 @@ struct net_device
670#define NETIF_F_GRO 16384 /* Generic receive offload */ 697#define NETIF_F_GRO 16384 /* Generic receive offload */
671#define NETIF_F_LRO 32768 /* large receive offload */ 698#define NETIF_F_LRO 32768 /* large receive offload */
672 699
700/* the GSO_MASK reserves bits 16 through 23 */
673#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 701#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
702#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
674 703
675 /* Segmentation offload features */ 704 /* Segmentation offload features */
676#define NETIF_F_GSO_SHIFT 16 705#define NETIF_F_GSO_SHIFT 16
@@ -747,10 +776,11 @@ struct net_device
747 unsigned char addr_len; /* hardware address length */ 776 unsigned char addr_len; /* hardware address length */
748 unsigned short dev_id; /* for shared network cards */ 777 unsigned short dev_id; /* for shared network cards */
749 778
750 spinlock_t addr_list_lock; 779 struct list_head uc_list; /* Secondary unicast mac
751 struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ 780 addresses */
752 int uc_count; /* Number of installed ucasts */ 781 int uc_count; /* Number of installed ucasts */
753 int uc_promisc; 782 int uc_promisc;
783 spinlock_t addr_list_lock;
754 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 784 struct dev_addr_list *mc_list; /* Multicast mac addresses */
755 int mc_count; /* Number of installed mcasts */ 785 int mc_count; /* Number of installed mcasts */
756 unsigned int promiscuity; 786 unsigned int promiscuity;
@@ -776,8 +806,11 @@ struct net_device
776 */ 806 */
777 unsigned long last_rx; /* Time of last Rx */ 807 unsigned long last_rx; /* Time of last Rx */
778 /* Interface address info used in eth_type_trans() */ 808 /* Interface address info used in eth_type_trans() */
779 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 809 unsigned char *dev_addr; /* hw address, (before bcast
780 because most packets are unicast) */ 810 because most packets are
811 unicast) */
812
813 struct list_head dev_addr_list; /* list of device hw addresses */
781 814
782 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 815 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
783 816
@@ -797,6 +830,11 @@ struct net_device
797 * One part is mostly used on xmit path (device) 830 * One part is mostly used on xmit path (device)
798 */ 831 */
799 /* These may be needed for future network-power-down code. */ 832 /* These may be needed for future network-power-down code. */
833
834 /*
835 * trans_start here is expensive for high speed devices on SMP,
836 * please use netdev_queue->trans_start instead.
837 */
800 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 838 unsigned long trans_start; /* Time (in jiffies) of last Tx */
801 839
802 int watchdog_timeo; /* used by dev_watchdog() */ 840 int watchdog_timeo; /* used by dev_watchdog() */
@@ -867,49 +905,10 @@ struct net_device
867 /* max exchange id for FCoE LRO by ddp */ 905 /* max exchange id for FCoE LRO by ddp */
868 unsigned int fcoe_ddp_xid; 906 unsigned int fcoe_ddp_xid;
869#endif 907#endif
870
871#ifdef CONFIG_COMPAT_NET_DEV_OPS
872 struct {
873 int (*init)(struct net_device *dev);
874 void (*uninit)(struct net_device *dev);
875 int (*open)(struct net_device *dev);
876 int (*stop)(struct net_device *dev);
877 int (*hard_start_xmit) (struct sk_buff *skb,
878 struct net_device *dev);
879 u16 (*select_queue)(struct net_device *dev,
880 struct sk_buff *skb);
881 void (*change_rx_flags)(struct net_device *dev,
882 int flags);
883 void (*set_rx_mode)(struct net_device *dev);
884 void (*set_multicast_list)(struct net_device *dev);
885 int (*set_mac_address)(struct net_device *dev,
886 void *addr);
887 int (*validate_addr)(struct net_device *dev);
888 int (*do_ioctl)(struct net_device *dev,
889 struct ifreq *ifr, int cmd);
890 int (*set_config)(struct net_device *dev,
891 struct ifmap *map);
892 int (*change_mtu)(struct net_device *dev, int new_mtu);
893 int (*neigh_setup)(struct net_device *dev,
894 struct neigh_parms *);
895 void (*tx_timeout) (struct net_device *dev);
896 struct net_device_stats* (*get_stats)(struct net_device *dev);
897 void (*vlan_rx_register)(struct net_device *dev,
898 struct vlan_group *grp);
899 void (*vlan_rx_add_vid)(struct net_device *dev,
900 unsigned short vid);
901 void (*vlan_rx_kill_vid)(struct net_device *dev,
902 unsigned short vid);
903#ifdef CONFIG_NET_POLL_CONTROLLER
904 void (*poll_controller)(struct net_device *dev);
905#endif
906 };
907#endif
908}; 908};
909#define to_net_dev(d) container_of(d, struct net_device, dev) 909#define to_net_dev(d) container_of(d, struct net_device, dev)
910 910
911#define NETDEV_ALIGN 32 911#define NETDEV_ALIGN 32
912#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
913 912
914static inline 913static inline
915struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 914struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
@@ -980,9 +979,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
980 */ 979 */
981static inline void *netdev_priv(const struct net_device *dev) 980static inline void *netdev_priv(const struct net_device *dev)
982{ 981{
983 return (char *)dev + ((sizeof(struct net_device) 982 return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
984 + NETDEV_ALIGN_CONST)
985 & ~NETDEV_ALIGN_CONST);
986} 983}
987 984
988/* Set the sysfs physical device reference for the network logical device 985/* Set the sysfs physical device reference for the network logical device
@@ -1012,6 +1009,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
1012void netif_napi_del(struct napi_struct *napi); 1009void netif_napi_del(struct napi_struct *napi);
1013 1010
1014struct napi_gro_cb { 1011struct napi_gro_cb {
1012 /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
1013 void *frag0;
1014
1015 /* Length of frag0. */
1016 unsigned int frag0_len;
1017
1015 /* This indicates where we are processing relative to skb->data. */ 1018 /* This indicates where we are processing relative to skb->data. */
1016 int data_offset; 1019 int data_offset;
1017 1020
@@ -1047,14 +1050,6 @@ struct packet_type {
1047 struct list_head list; 1050 struct list_head list;
1048}; 1051};
1049 1052
1050struct napi_gro_fraginfo {
1051 skb_frag_t frags[MAX_SKB_FRAGS];
1052 unsigned int nr_frags;
1053 unsigned int ip_summed;
1054 unsigned int len;
1055 __wsum csum;
1056};
1057
1058#include <linux/interrupt.h> 1053#include <linux/interrupt.h>
1059#include <linux/notifier.h> 1054#include <linux/notifier.h>
1060 1055
@@ -1119,9 +1114,9 @@ extern int dev_restart(struct net_device *dev);
1119#ifdef CONFIG_NETPOLL_TRAP 1114#ifdef CONFIG_NETPOLL_TRAP
1120extern int netpoll_trap(void); 1115extern int netpoll_trap(void);
1121#endif 1116#endif
1122extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1123extern int skb_gro_receive(struct sk_buff **head, 1117extern int skb_gro_receive(struct sk_buff **head,
1124 struct sk_buff *skb); 1118 struct sk_buff *skb);
1119extern void skb_gro_reset_offset(struct sk_buff *skb);
1125 1120
1126static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1121static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1127{ 1122{
@@ -1138,16 +1133,34 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1138 NAPI_GRO_CB(skb)->data_offset += len; 1133 NAPI_GRO_CB(skb)->data_offset += len;
1139} 1134}
1140 1135
1141static inline void skb_gro_reset_offset(struct sk_buff *skb) 1136static inline void *skb_gro_header_fast(struct sk_buff *skb,
1137 unsigned int offset)
1142{ 1138{
1143 NAPI_GRO_CB(skb)->data_offset = 0; 1139 return NAPI_GRO_CB(skb)->frag0 + offset;
1140}
1141
1142static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
1143{
1144 return NAPI_GRO_CB(skb)->frag0_len < hlen;
1145}
1146
1147static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1148 unsigned int offset)
1149{
1150 NAPI_GRO_CB(skb)->frag0 = NULL;
1151 NAPI_GRO_CB(skb)->frag0_len = 0;
1152 return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
1144} 1153}
1145 1154
1146static inline void *skb_gro_mac_header(struct sk_buff *skb) 1155static inline void *skb_gro_mac_header(struct sk_buff *skb)
1147{ 1156{
1148 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : 1157 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
1149 page_address(skb_shinfo(skb)->frags[0].page) + 1158}
1150 skb_shinfo(skb)->frags[0].page_offset; 1159
1160static inline void *skb_gro_network_header(struct sk_buff *skb)
1161{
1162 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
1163 skb_network_offset(skb);
1151} 1164}
1152 1165
1153static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1166static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
@@ -1442,12 +1455,18 @@ extern int napi_gro_receive(struct napi_struct *napi,
1442 struct sk_buff *skb); 1455 struct sk_buff *skb);
1443extern void napi_reuse_skb(struct napi_struct *napi, 1456extern void napi_reuse_skb(struct napi_struct *napi,
1444 struct sk_buff *skb); 1457 struct sk_buff *skb);
1445extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1458extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
1446 struct napi_gro_fraginfo *info);
1447extern int napi_frags_finish(struct napi_struct *napi, 1459extern int napi_frags_finish(struct napi_struct *napi,
1448 struct sk_buff *skb, int ret); 1460 struct sk_buff *skb, int ret);
1449extern int napi_gro_frags(struct napi_struct *napi, 1461extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
1450 struct napi_gro_fraginfo *info); 1462extern int napi_gro_frags(struct napi_struct *napi);
1463
1464static inline void napi_free_frags(struct napi_struct *napi)
1465{
1466 kfree_skb(napi->skb);
1467 napi->skb = NULL;
1468}
1469
1451extern void netif_nit_deliver(struct sk_buff *skb); 1470extern void netif_nit_deliver(struct sk_buff *skb);
1452extern int dev_valid_name(const char *name); 1471extern int dev_valid_name(const char *name);
1453extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1472extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1514,6 +1533,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
1514 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 1533 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
1515} 1534}
1516 1535
1536extern unsigned long dev_trans_start(struct net_device *dev);
1537
1517extern void __netdev_watchdog_up(struct net_device *dev); 1538extern void __netdev_watchdog_up(struct net_device *dev);
1518 1539
1519extern void netif_carrier_on(struct net_device *dev); 1540extern void netif_carrier_on(struct net_device *dev);
@@ -1671,6 +1692,12 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1671 spin_unlock_bh(&txq->_xmit_lock); 1692 spin_unlock_bh(&txq->_xmit_lock);
1672} 1693}
1673 1694
1695static inline void txq_trans_update(struct netdev_queue *txq)
1696{
1697 if (txq->xmit_lock_owner != -1)
1698 txq->trans_start = jiffies;
1699}
1700
1674/** 1701/**
1675 * netif_tx_lock - grab network device transmit lock 1702 * netif_tx_lock - grab network device transmit lock
1676 * @dev: network device 1703 * @dev: network device
@@ -1778,6 +1805,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
1778 spin_unlock_bh(&dev->addr_list_lock); 1805 spin_unlock_bh(&dev->addr_list_lock);
1779} 1806}
1780 1807
1808/*
1809 * dev_addr_list walker. Should be used only for read access. Call with
1810 * rcu_read_lock held.
1811 */
1812#define for_each_dev_addr(dev, ha) \
1813 list_for_each_entry_rcu(ha, &dev->dev_addr_list, list)
1814
1781/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 1815/* These functions live elsewhere (drivers/net/net_init.c, but related) */
1782 1816
1783extern void ether_setup(struct net_device *dev); 1817extern void ether_setup(struct net_device *dev);
@@ -1790,11 +1824,24 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1790 alloc_netdev_mq(sizeof_priv, name, setup, 1) 1824 alloc_netdev_mq(sizeof_priv, name, setup, 1)
1791extern int register_netdev(struct net_device *dev); 1825extern int register_netdev(struct net_device *dev);
1792extern void unregister_netdev(struct net_device *dev); 1826extern void unregister_netdev(struct net_device *dev);
1827
1828/* Functions used for device addresses handling */
1829extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1830 unsigned char addr_type);
1831extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
1832 unsigned char addr_type);
1833extern int dev_addr_add_multiple(struct net_device *to_dev,
1834 struct net_device *from_dev,
1835 unsigned char addr_type);
1836extern int dev_addr_del_multiple(struct net_device *to_dev,
1837 struct net_device *from_dev,
1838 unsigned char addr_type);
1839
1793/* Functions used for secondary unicast and multicast support */ 1840/* Functions used for secondary unicast and multicast support */
1794extern void dev_set_rx_mode(struct net_device *dev); 1841extern void dev_set_rx_mode(struct net_device *dev);
1795extern void __dev_set_rx_mode(struct net_device *dev); 1842extern void __dev_set_rx_mode(struct net_device *dev);
1796extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1843extern int dev_unicast_delete(struct net_device *dev, void *addr);
1797extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1844extern int dev_unicast_add(struct net_device *dev, void *addr);
1798extern int dev_unicast_sync(struct net_device *to, struct net_device *from); 1845extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1799extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); 1846extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1800extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1847extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
@@ -1856,15 +1903,14 @@ static inline int net_gso_ok(int features, int gso_type)
1856 1903
1857static inline int skb_gso_ok(struct sk_buff *skb, int features) 1904static inline int skb_gso_ok(struct sk_buff *skb, int features)
1858{ 1905{
1859 return net_gso_ok(features, skb_shinfo(skb)->gso_type); 1906 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
1907 (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
1860} 1908}
1861 1909
1862static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1910static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1863{ 1911{
1864 return skb_is_gso(skb) && 1912 return skb_is_gso(skb) &&
1865 (!skb_gso_ok(skb, dev->features) || 1913 (!skb_gso_ok(skb, dev->features) ||
1866 (skb_shinfo(skb)->frag_list &&
1867 !(dev->features & NETIF_F_FRAGLIST)) ||
1868 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1914 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1869} 1915}
1870 1916
@@ -1874,6 +1920,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
1874 dev->gso_max_size = size; 1920 dev->gso_max_size = size;
1875} 1921}
1876 1922
1923static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
1924 struct net_device *master)
1925{
1926 if (skb->pkt_type == PACKET_HOST) {
1927 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
1928
1929 memcpy(dest, master->dev_addr, ETH_ALEN);
1930 }
1931}
1932
1877/* On bonding slaves other than the currently active slave, suppress 1933/* On bonding slaves other than the currently active slave, suppress
1878 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1934 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1879 * ARP on active-backup slaves with arp_validate enabled. 1935 * ARP on active-backup slaves with arp_validate enabled.
@@ -1887,6 +1943,14 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1887 if (master->priv_flags & IFF_MASTER_ARPMON) 1943 if (master->priv_flags & IFF_MASTER_ARPMON)
1888 dev->last_rx = jiffies; 1944 dev->last_rx = jiffies;
1889 1945
1946 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
1947 /* Do address unmangle. The local destination address
1948 * will be always the one master has. Provides the right
1949 * functionality in a bridge.
1950 */
1951 skb_bond_set_mac_by_master(skb, master);
1952 }
1953
1890 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1954 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1891 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1955 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1892 skb->protocol == __cpu_to_be16(ETH_P_ARP)) 1956 skb->protocol == __cpu_to_be16(ETH_P_ARP))
@@ -1908,6 +1972,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1908} 1972}
1909 1973
1910extern struct pernet_operations __net_initdata loopback_net_ops; 1974extern struct pernet_operations __net_initdata loopback_net_ops;
1975
1976static inline int dev_ethtool_get_settings(struct net_device *dev,
1977 struct ethtool_cmd *cmd)
1978{
1979 if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
1980 return -EOPNOTSUPP;
1981 return dev->ethtool_ops->get_settings(dev, cmd);
1982}
1983
1984static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
1985{
1986 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
1987 return 0;
1988 return dev->ethtool_ops->get_rx_csum(dev);
1989}
1990
1991static inline u32 dev_ethtool_get_flags(struct net_device *dev)
1992{
1993 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
1994 return 0;
1995 return dev->ethtool_ops->get_flags(dev);
1996}
1911#endif /* __KERNEL__ */ 1997#endif /* __KERNEL__ */
1912 1998
1913#endif /* _LINUX_DEV_H */ 1999#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index af9d2fb97212..2aea50399c0b 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -33,6 +33,7 @@ header-y += xt_limit.h
33header-y += xt_mac.h 33header-y += xt_mac.h
34header-y += xt_mark.h 34header-y += xt_mark.h
35header-y += xt_multiport.h 35header-y += xt_multiport.h
36header-y += xt_osf.h
36header-y += xt_owner.h 37header-y += xt_owner.h
37header-y += xt_pkttype.h 38header-y += xt_pkttype.h
38header-y += xt_quota.h 39header-y += xt_quota.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 885cbe282260..a8248ee422b7 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -75,75 +75,6 @@ enum ip_conntrack_status {
75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), 75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
76}; 76};
77 77
78/* Connection tracking event bits */
79enum ip_conntrack_events
80{
81 /* New conntrack */
82 IPCT_NEW_BIT = 0,
83 IPCT_NEW = (1 << IPCT_NEW_BIT),
84
85 /* Expected connection */
86 IPCT_RELATED_BIT = 1,
87 IPCT_RELATED = (1 << IPCT_RELATED_BIT),
88
89 /* Destroyed conntrack */
90 IPCT_DESTROY_BIT = 2,
91 IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
92
93 /* Timer has been refreshed */
94 IPCT_REFRESH_BIT = 3,
95 IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
96
97 /* Status has changed */
98 IPCT_STATUS_BIT = 4,
99 IPCT_STATUS = (1 << IPCT_STATUS_BIT),
100
101 /* Update of protocol info */
102 IPCT_PROTOINFO_BIT = 5,
103 IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
104
105 /* Volatile protocol info */
106 IPCT_PROTOINFO_VOLATILE_BIT = 6,
107 IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
108
109 /* New helper for conntrack */
110 IPCT_HELPER_BIT = 7,
111 IPCT_HELPER = (1 << IPCT_HELPER_BIT),
112
113 /* Update of helper info */
114 IPCT_HELPINFO_BIT = 8,
115 IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
116
117 /* Volatile helper info */
118 IPCT_HELPINFO_VOLATILE_BIT = 9,
119 IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
120
121 /* NAT info */
122 IPCT_NATINFO_BIT = 10,
123 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
124
125 /* Counter highest bit has been set, unused */
126 IPCT_COUNTER_FILLING_BIT = 11,
127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
128
129 /* Mark is set */
130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT),
132
133 /* NAT sequence adjustment */
134 IPCT_NATSEQADJ_BIT = 13,
135 IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
136
137 /* Secmark is set */
138 IPCT_SECMARK_BIT = 14,
139 IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
140};
141
142enum ip_conntrack_expect_events {
143 IPEXP_NEW_BIT = 0,
144 IPEXP_NEW = (1 << IPEXP_NEW_BIT),
145};
146
147#ifdef __KERNEL__ 78#ifdef __KERNEL__
148struct ip_conntrack_stat 79struct ip_conntrack_stat
149{ 80{
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index b2f384d42611..4352feed2377 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -15,7 +15,8 @@ enum tcp_conntrack {
15 TCP_CONNTRACK_LAST_ACK, 15 TCP_CONNTRACK_LAST_ACK,
16 TCP_CONNTRACK_TIME_WAIT, 16 TCP_CONNTRACK_TIME_WAIT,
17 TCP_CONNTRACK_CLOSE, 17 TCP_CONNTRACK_CLOSE,
18 TCP_CONNTRACK_LISTEN, 18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
19 TCP_CONNTRACK_MAX, 20 TCP_CONNTRACK_MAX,
20 TCP_CONNTRACK_IGNORE 21 TCP_CONNTRACK_IGNORE
21}; 22};
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index c600083cbdf5..bff4d5741d98 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -46,7 +46,8 @@ struct nfgenmsg {
46#define NFNL_SUBSYS_CTNETLINK_EXP 2 46#define NFNL_SUBSYS_CTNETLINK_EXP 2
47#define NFNL_SUBSYS_QUEUE 3 47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_COUNT 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_COUNT 6
50 51
51#ifdef __KERNEL__ 52#ifdef __KERNEL__
52 53
@@ -75,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
75 76
76extern int nfnetlink_has_listeners(unsigned int group); 77extern int nfnetlink_has_listeners(unsigned int group);
77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 78extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 79 int echo, gfp_t flags);
79extern void nfnetlink_set_err(u32 pid, u32 group, int error); 80extern void nfnetlink_set_err(u32 pid, u32 group, int error);
80extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 81extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
81 82
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 1a865e48b8eb..ed4ef8d0b11b 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -101,6 +101,7 @@ enum ctattr_protoinfo_dccp {
101 CTA_PROTOINFO_DCCP_UNSPEC, 101 CTA_PROTOINFO_DCCP_UNSPEC,
102 CTA_PROTOINFO_DCCP_STATE, 102 CTA_PROTOINFO_DCCP_STATE,
103 CTA_PROTOINFO_DCCP_ROLE, 103 CTA_PROTOINFO_DCCP_ROLE,
104 CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
104 __CTA_PROTOINFO_DCCP_MAX, 105 __CTA_PROTOINFO_DCCP_MAX,
105}; 106};
106#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) 107#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index c9efe039dc57..1030b7593898 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -184,9 +184,10 @@ struct xt_counters_info
184 * @matchinfo: per-match data 184 * @matchinfo: per-match data
185 * @fragoff: packet is a fragment, this is the data offset 185 * @fragoff: packet is a fragment, this is the data offset
186 * @thoff: position of transport header relative to skb->data 186 * @thoff: position of transport header relative to skb->data
187 * @hotdrop: drop packet if we had inspection problems 187 * @hook: hook number given packet came from
188 * @family: Actual NFPROTO_* through which the function is invoked 188 * @family: Actual NFPROTO_* through which the function is invoked
189 * (helpful when match->family == NFPROTO_UNSPEC) 189 * (helpful when match->family == NFPROTO_UNSPEC)
190 * @hotdrop: drop packet if we had inspection problems
190 */ 191 */
191struct xt_match_param { 192struct xt_match_param {
192 const struct net_device *in, *out; 193 const struct net_device *in, *out;
@@ -194,8 +195,9 @@ struct xt_match_param {
194 const void *matchinfo; 195 const void *matchinfo;
195 int fragoff; 196 int fragoff;
196 unsigned int thoff; 197 unsigned int thoff;
197 bool *hotdrop; 198 unsigned int hooknum;
198 u_int8_t family; 199 u_int8_t family;
200 bool *hotdrop;
199}; 201};
200 202
201/** 203/**
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 982a89f78272..2584f4a777de 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -15,4 +15,9 @@ struct xt_NFQ_info {
15 __u16 queuenum; 15 __u16 queuenum;
16}; 16};
17 17
18struct xt_NFQ_info_v1 {
19 __u16 queuenum;
20 __u16 queues_total;
21};
22
18#endif /* _XT_NFQ_TARGET_H */ 23#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_osf.h b/include/linux/netfilter/xt_osf.h
new file mode 100644
index 000000000000..fd2272e0959a
--- /dev/null
+++ b/include/linux/netfilter/xt_osf.h
@@ -0,0 +1,133 @@
1/*
2 * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _XT_OSF_H
21#define _XT_OSF_H
22
23#define MAXGENRELEN 32
24
25#define XT_OSF_GENRE (1<<0)
26#define XT_OSF_TTL (1<<1)
27#define XT_OSF_LOG (1<<2)
28#define XT_OSF_INVERT (1<<3)
29
30#define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
31#define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
32#define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
33
34#define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
35#define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */
36#define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */
37
38struct xt_osf_info {
39 char genre[MAXGENRELEN];
40 __u32 len;
41 __u32 flags;
42 __u32 loglevel;
43 __u32 ttl;
44};
45
46/*
47 * Wildcard MSS (kind of).
48 * It is used to implement a state machine for the different wildcard values
49 * of the MSS and window sizes.
50 */
51struct xt_osf_wc {
52 __u32 wc;
53 __u32 val;
54};
55
56/*
57 * This struct represents IANA options
58 * http://www.iana.org/assignments/tcp-parameters
59 */
60struct xt_osf_opt {
61 __u16 kind, length;
62 struct xt_osf_wc wc;
63};
64
65struct xt_osf_user_finger {
66 struct xt_osf_wc wss;
67
68 __u8 ttl, df;
69 __u16 ss, mss;
70 __u16 opt_num;
71
72 char genre[MAXGENRELEN];
73 char version[MAXGENRELEN];
74 char subtype[MAXGENRELEN];
75
76 /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
77 struct xt_osf_opt opt[MAX_IPOPTLEN];
78};
79
80struct xt_osf_nlmsg {
81 struct xt_osf_user_finger f;
82 struct iphdr ip;
83 struct tcphdr tcp;
84};
85
86/* Defines for IANA option kinds */
87
88enum iana_options {
89 OSFOPT_EOL = 0, /* End of options */
90 OSFOPT_NOP, /* NOP */
91 OSFOPT_MSS, /* Maximum segment size */
92 OSFOPT_WSO, /* Window scale option */
93 OSFOPT_SACKP, /* SACK permitted */
94 OSFOPT_SACK, /* SACK */
95 OSFOPT_ECHO,
96 OSFOPT_ECHOREPLY,
97 OSFOPT_TS, /* Timestamp option */
98 OSFOPT_POCP, /* Partial Order Connection Permitted */
99 OSFOPT_POSP, /* Partial Order Service Profile */
100
101 /* Others are not used in the current OSF */
102 OSFOPT_EMPTY = 255,
103};
104
105/*
106 * Initial window size option state machine: multiple of mss, mtu or
107 * plain numeric value. Can also be made as plain numeric value which
108 * is not a multiple of specified value.
109 */
110enum xt_osf_window_size_options {
111 OSF_WSS_PLAIN = 0,
112 OSF_WSS_MSS,
113 OSF_WSS_MTU,
114 OSF_WSS_MODULO,
115 OSF_WSS_MAX,
116};
117
118/*
119 * Add/remove fingerprint from the kernel.
120 */
121enum xt_osf_msg_types {
122 OSF_MSG_ADD,
123 OSF_MSG_REMOVE,
124 OSF_MSG_MAX,
125};
126
127enum xt_osf_attr_type {
128 OSF_ATTR_UNSPEC,
129 OSF_ATTR_FINGER,
130 OSF_ATTR_MAX,
131};
132
133#endif /* _XT_OSF_H */
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
new file mode 100644
index 000000000000..6f475b8ff34b
--- /dev/null
+++ b/include/linux/netfilter/xt_socket.h
@@ -0,0 +1,12 @@
1#ifndef _XT_SOCKET_H
2#define _XT_SOCKET_H
3
4enum {
5 XT_SOCKET_TRANSPARENT = 1 << 0,
6};
7
8struct xt_socket_mtinfo1 {
9 __u8 flags;
10};
11
12#endif /* _XT_SOCKET_H */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index cbe8ce3bf486..dbea93b694e5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,7 +7,7 @@
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com> 10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 * 13 *
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#include <linux/types.h>
29
28/** 30/**
29 * DOC: Station handling 31 * DOC: Station handling
30 * 32 *
@@ -46,8 +48,10 @@
46 * to get a list of all present wiphys. 48 * to get a list of all present wiphys.
47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 49 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, 50 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or 51 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
50 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
53 * %NL80211_ATTR_WIPHY_NAME. 57 * %NL80211_ATTR_WIPHY_NAME.
@@ -75,8 +79,8 @@
75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, 79 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
76 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. 80 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 81 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER 82 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
79 * attributes. 83 * and %NL80211_ATTR_KEY_SEQ attributes.
80 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 84 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
81 * or %NL80211_ATTR_MAC. 85 * or %NL80211_ATTR_MAC.
82 * 86 *
@@ -166,6 +170,22 @@
166 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is 170 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
167 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on 171 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
168 * to (%NL80211_ATTR_REG_ALPHA2). 172 * to (%NL80211_ATTR_REG_ALPHA2).
173 * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
174 * has been found while world roaming thus enabling active scan or
175 * any mode of operation that initiates TX (beacons) on a channel
176 * where we would not have been able to do either before. As an example
177 * if you are world roaming (regulatory domain set to world or if your
178 * driver is using a custom world roaming regulatory domain) and while
179 * doing a passive scan on the 5 GHz band you find an AP there (if not
180 * on a DFS channel) you will now be able to actively scan for that AP
181 * or use AP mode on your card on that same channel. Note that this will
182 * never be used for channels 1-11 on the 2 GHz band as they are always
183 * enabled world wide. This beacon hint is only sent if your device had
184 * either disabled active scanning or beaconing on a channel. We send to
185 * userspace the wiphy on which we removed a restriction from
186 * (%NL80211_ATTR_WIPHY) and the channel on which this occurred
187 * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
188 * the beacon hint was processed.
169 * 189 *
170 * @NL80211_CMD_AUTHENTICATE: authentication request and notification. 190 * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
171 * This command is used both as a command (request to authenticate) and 191 * This command is used both as a command (request to authenticate) and
@@ -185,8 +205,12 @@
185 * frame, i.e., it was for the local STA and was received in correct 205 * frame, i.e., it was for the local STA and was received in correct
186 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the 206 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
187 * MLME SAP interface (kernel providing MLME, userspace SME). The 207 * MLME SAP interface (kernel providing MLME, userspace SME). The
188 * included NL80211_ATTR_FRAME attribute contains the management frame 208 * included %NL80211_ATTR_FRAME attribute contains the management frame
189 * (including both the header and frame body, but not FCS). 209 * (including both the header and frame body, but not FCS). This event is
210 * also used to indicate if the authentication attempt timed out. In that
211 * case the %NL80211_ATTR_FRAME attribute is replaced with a
212 * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
213 * pending authentication timed out).
190 * @NL80211_CMD_ASSOCIATE: association request and notification; like 214 * @NL80211_CMD_ASSOCIATE: association request and notification; like
191 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation 215 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
192 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, 216 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
@@ -199,6 +223,25 @@
199 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to 223 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
200 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). 224 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
201 * 225 *
226 * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
227 * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
228 * event includes %NL80211_ATTR_MAC to describe the source MAC address of
229 * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
230 * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
231 * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
232 * event matches with MLME-MICHAELMICFAILURE.indication() primitive
233 *
234 * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
235 * FREQ attribute (for the initial frequency if no peer can be found)
236 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
237 * should be fixed rather than automatically determined. Can only be
238 * executed on a network interface that is UP, and fixed BSSID/FREQ
239 * may be rejected. Another optional parameter is the beacon interval,
240 * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
241 * given defaults to 100 TU (102.4ms).
242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
243 * determined by the network interface.
244 *
202 * @NL80211_CMD_MAX: highest used command number 245 * @NL80211_CMD_MAX: highest used command number
203 * @__NL80211_CMD_AFTER_LAST: internal use 246 * @__NL80211_CMD_AFTER_LAST: internal use
204 */ 247 */
@@ -260,6 +303,13 @@ enum nl80211_commands {
260 NL80211_CMD_DEAUTHENTICATE, 303 NL80211_CMD_DEAUTHENTICATE,
261 NL80211_CMD_DISASSOCIATE, 304 NL80211_CMD_DISASSOCIATE,
262 305
306 NL80211_CMD_MICHAEL_MIC_FAILURE,
307
308 NL80211_CMD_REG_BEACON_HINT,
309
310 NL80211_CMD_JOIN_IBSS,
311 NL80211_CMD_LEAVE_IBSS,
312
263 /* add new commands above here */ 313 /* add new commands above here */
264 314
265 /* used to define NL80211_CMD_MAX below */ 315 /* used to define NL80211_CMD_MAX below */
@@ -278,6 +328,7 @@ enum nl80211_commands {
278#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE 328#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
279#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE 329#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
280#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 330#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
331#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
281 332
282/** 333/**
283 * enum nl80211_attrs - nl80211 netlink attributes 334 * enum nl80211_attrs - nl80211 netlink attributes
@@ -296,6 +347,18 @@ enum nl80211_commands {
296 * NL80211_CHAN_HT20 = HT20 only 347 * NL80211_CHAN_HT20 = HT20 only
297 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel 348 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
298 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel 349 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
350 * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
351 * less than or equal to the RTS threshold; allowed range: 1..255;
352 * dot11ShortRetryLimit; u8
353 * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is
354 * greater than the RTS threshold; allowed range: 1..255;
355 * dot11ShortLongLimit; u8
356 * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum
357 * length in octets for frames; allowed range: 256..8000, disable
358 * fragmentation with (u32)-1; dot11FragmentationThreshold; u32
359 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
360 * larger than or equal to this use RTS/CTS handshake); allowed range:
361 * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32
299 * 362 *
300 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 363 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
301 * @NL80211_ATTR_IFNAME: network interface name 364 * @NL80211_ATTR_IFNAME: network interface name
@@ -319,7 +382,7 @@ enum nl80211_commands {
319 * 382 *
320 * @NL80211_ATTR_STA_AID: Association ID for the station (u16) 383 * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
321 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of 384 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
322 * &enum nl80211_sta_flags. 385 * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2)
323 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by 386 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
324 * IEEE 802.11 7.3.1.6 (u16). 387 * IEEE 802.11 7.3.1.6 (u16).
325 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported 388 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
@@ -380,6 +443,8 @@ enum nl80211_commands {
380 * 443 *
381 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with 444 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
382 * a single scan request, a wiphy attribute. 445 * a single scan request, a wiphy attribute.
446 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
447 * that can be added to a scan request
383 * 448 *
384 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 449 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
385 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 450 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
@@ -408,6 +473,44 @@ enum nl80211_commands {
408 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and 473 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
409 * %NL80211_CMD_DISASSOCIATE, u16 474 * %NL80211_CMD_DISASSOCIATE, u16
410 * 475 *
476 * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as
477 * a u32
478 *
479 * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change
480 * due to considerations from a beacon hint. This attribute reflects
481 * the state of the channel _before_ the beacon hint processing. This
482 * attributes consists of a nested attribute containing
483 * NL80211_FREQUENCY_ATTR_*
484 * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change
485 * due to considerations from a beacon hint. This attribute reflects
486 * the state of the channel _after_ the beacon hint processing. This
487 * attributes consists of a nested attribute containing
488 * NL80211_FREQUENCY_ATTR_*
489 *
490 * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
491 * cipher suites
492 *
493 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
494 * for other networks on different channels
495 *
496 * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
497 * is used, e.g., with %NL80211_CMD_AUTHENTICATE event
498 *
499 * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
500 * used for the association (&enum nl80211_mfp, represented as a u32);
501 * this attribute can be used
502 * with %NL80211_CMD_ASSOCIATE request
503 *
504 * @NL80211_ATTR_STA_FLAGS2: Attribute containing a
505 * &struct nl80211_sta_flag_update.
506 *
507 * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls
508 * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in
509 * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE
510 * request, the driver will assume that the port is unauthorized until
511 * authorized by user space. Otherwise, port is marked authorized by
512 * default in station mode.
513 *
411 * @NL80211_ATTR_MAX: highest attribute number currently defined 514 * @NL80211_ATTR_MAX: highest attribute number currently defined
412 * @__NL80211_ATTR_AFTER_LAST: internal use 515 * @__NL80211_ATTR_AFTER_LAST: internal use
413 */ 516 */
@@ -492,6 +595,30 @@ enum nl80211_attrs {
492 NL80211_ATTR_AUTH_TYPE, 595 NL80211_ATTR_AUTH_TYPE,
493 NL80211_ATTR_REASON_CODE, 596 NL80211_ATTR_REASON_CODE,
494 597
598 NL80211_ATTR_KEY_TYPE,
599
600 NL80211_ATTR_MAX_SCAN_IE_LEN,
601 NL80211_ATTR_CIPHER_SUITES,
602
603 NL80211_ATTR_FREQ_BEFORE,
604 NL80211_ATTR_FREQ_AFTER,
605
606 NL80211_ATTR_FREQ_FIXED,
607
608
609 NL80211_ATTR_WIPHY_RETRY_SHORT,
610 NL80211_ATTR_WIPHY_RETRY_LONG,
611 NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
612 NL80211_ATTR_WIPHY_RTS_THRESHOLD,
613
614 NL80211_ATTR_TIMED_OUT,
615
616 NL80211_ATTR_USE_MFP,
617
618 NL80211_ATTR_STA_FLAGS2,
619
620 NL80211_ATTR_CONTROL_PORT,
621
495 /* add attributes here, update the policy in nl80211.c */ 622 /* add attributes here, update the policy in nl80211.c */
496 623
497 __NL80211_ATTR_AFTER_LAST, 624 __NL80211_ATTR_AFTER_LAST,
@@ -581,6 +708,18 @@ enum nl80211_sta_flags {
581}; 708};
582 709
583/** 710/**
711 * struct nl80211_sta_flag_update - station flags mask/set
712 * @mask: mask of station flags to set
713 * @set: which values to set them to
714 *
715 * Both mask and set contain bits as per &enum nl80211_sta_flags.
716 */
717struct nl80211_sta_flag_update {
718 __u32 mask;
719 __u32 set;
720} __attribute__((packed));
721
722/**
584 * enum nl80211_rate_info - bitrate information 723 * enum nl80211_rate_info - bitrate information
585 * 724 *
586 * These attribute types are used with %NL80211_STA_INFO_TXRATE 725 * These attribute types are used with %NL80211_STA_INFO_TXRATE
@@ -1062,4 +1201,27 @@ enum nl80211_auth_type {
1062 NL80211_AUTHTYPE_FT, 1201 NL80211_AUTHTYPE_FT,
1063 NL80211_AUTHTYPE_NETWORK_EAP, 1202 NL80211_AUTHTYPE_NETWORK_EAP,
1064}; 1203};
1204
1205/**
1206 * enum nl80211_key_type - Key Type
1207 * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
1208 * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
1209 * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
1210 */
1211enum nl80211_key_type {
1212 NL80211_KEYTYPE_GROUP,
1213 NL80211_KEYTYPE_PAIRWISE,
1214 NL80211_KEYTYPE_PEERKEY,
1215};
1216
1217/**
1218 * enum nl80211_mfp - Management frame protection state
1219 * @NL80211_MFP_NO: Management frame protection not used
1220 * @NL80211_MFP_REQUIRED: Management frame protection required
1221 */
1222enum nl80211_mfp {
1223 NL80211_MFP_NO,
1224 NL80211_MFP_REQUIRED,
1225};
1226
1065#endif /* __LINUX_NL80211_H */ 1227#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
new file mode 100644
index 000000000000..2cda00ccfcca
--- /dev/null
+++ b/include/linux/nl802154.h
@@ -0,0 +1,119 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef NL802154_H
22#define NL802154_H
23
24#define IEEE802154_NL_NAME "802.15.4 MAC"
25#define IEEE802154_MCAST_COORD_NAME "coordinator"
26#define IEEE802154_MCAST_BEACON_NAME "beacon"
27
28enum {
29 __IEEE802154_ATTR_INVALID,
30
31 IEEE802154_ATTR_DEV_NAME,
32 IEEE802154_ATTR_DEV_INDEX,
33
34 IEEE802154_ATTR_STATUS,
35
36 IEEE802154_ATTR_SHORT_ADDR,
37 IEEE802154_ATTR_HW_ADDR,
38 IEEE802154_ATTR_PAN_ID,
39
40 IEEE802154_ATTR_CHANNEL,
41
42 IEEE802154_ATTR_COORD_SHORT_ADDR,
43 IEEE802154_ATTR_COORD_HW_ADDR,
44 IEEE802154_ATTR_COORD_PAN_ID,
45
46 IEEE802154_ATTR_SRC_SHORT_ADDR,
47 IEEE802154_ATTR_SRC_HW_ADDR,
48 IEEE802154_ATTR_SRC_PAN_ID,
49
50 IEEE802154_ATTR_DEST_SHORT_ADDR,
51 IEEE802154_ATTR_DEST_HW_ADDR,
52 IEEE802154_ATTR_DEST_PAN_ID,
53
54 IEEE802154_ATTR_CAPABILITY,
55 IEEE802154_ATTR_REASON,
56 IEEE802154_ATTR_SCAN_TYPE,
57 IEEE802154_ATTR_CHANNELS,
58 IEEE802154_ATTR_DURATION,
59 IEEE802154_ATTR_ED_LIST,
60 IEEE802154_ATTR_BCN_ORD,
61 IEEE802154_ATTR_SF_ORD,
62 IEEE802154_ATTR_PAN_COORD,
63 IEEE802154_ATTR_BAT_EXT,
64 IEEE802154_ATTR_COORD_REALIGN,
65 IEEE802154_ATTR_SEC,
66
67 __IEEE802154_ATTR_MAX,
68};
69
70#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
71
72extern struct nla_policy ieee802154_policy[];
73
74/* commands */
75/* REQ should be responded with CONF
76 * and INDIC with RESP
77 */
78enum {
79 __IEEE802154_COMMAND_INVALID,
80
81 IEEE802154_ASSOCIATE_REQ,
82 IEEE802154_ASSOCIATE_CONF,
83 IEEE802154_DISASSOCIATE_REQ,
84 IEEE802154_DISASSOCIATE_CONF,
85 IEEE802154_GET_REQ,
86 IEEE802154_GET_CONF,
87 IEEE802154_RESET_REQ,
88 IEEE802154_RESET_CONF,
89 IEEE802154_SCAN_REQ,
90 IEEE802154_SCAN_CONF,
91 IEEE802154_SET_REQ,
92 IEEE802154_SET_CONF,
93 IEEE802154_START_REQ,
94 IEEE802154_START_CONF,
95 IEEE802154_SYNC_REQ,
96 IEEE802154_POLL_REQ,
97 IEEE802154_POLL_CONF,
98
99 IEEE802154_ASSOCIATE_INDIC,
100 IEEE802154_ASSOCIATE_RESP,
101 IEEE802154_DISASSOCIATE_INDIC,
102 IEEE802154_BEACON_NOTIFY_INDIC,
103 IEEE802154_ORPHAN_INDIC,
104 IEEE802154_ORPHAN_RESP,
105 IEEE802154_COMM_STATUS_INDIC,
106 IEEE802154_SYNC_LOSS_INDIC,
107
108 IEEE802154_GTS_REQ, /* Not supported yet */
109 IEEE802154_GTS_INDIC, /* Not supported yet */
110 IEEE802154_GTS_CONF, /* Not supported yet */
111 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
112 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
113
114 __IEEE802154_CMD_MAX,
115};
116
117#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
118
119#endif
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 52b1a76c1b43..d47beef08dfd 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -3,8 +3,23 @@
3 3
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6/* unicode character */ 6/* Unicode has changed over the years. Unicode code points no longer
7typedef __u16 wchar_t; 7 * fit into 16 bits; as of Unicode 5 valid code points range from 0
8 * to 0x10ffff (17 planes, where each plane holds 65536 code points).
9 *
10 * The original decision to represent Unicode characters as 16-bit
11 * wchar_t values is now outdated. But plane 0 still includes the
12 * most commonly used characters, so we will retain it. The newer
13 * 32-bit unicode_t type can be used when it is necessary to
14 * represent the full Unicode character set.
15 */
16
17/* Plane-0 Unicode character */
18typedef u16 wchar_t;
19#define MAX_WCHAR_T 0xffff
20
21/* Arbitrary Unicode character */
22typedef u32 unicode_t;
8 23
9struct nls_table { 24struct nls_table {
10 const char *charset; 25 const char *charset;
@@ -21,6 +36,13 @@ struct nls_table {
21/* this value hold the maximum octet of charset */ 36/* this value hold the maximum octet of charset */
22#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */ 37#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
23 38
39/* Byte order for UTF-16 strings */
40enum utf16_endian {
41 UTF16_HOST_ENDIAN,
42 UTF16_LITTLE_ENDIAN,
43 UTF16_BIG_ENDIAN
44};
45
24/* nls.c */ 46/* nls.c */
25extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
26extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
@@ -28,10 +50,11 @@ extern struct nls_table *load_nls(char *);
28extern void unload_nls(struct nls_table *); 50extern void unload_nls(struct nls_table *);
29extern struct nls_table *load_nls_default(void); 51extern struct nls_table *load_nls_default(void);
30 52
31extern int utf8_mbtowc(wchar_t *, const __u8 *, int); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
32extern int utf8_mbstowcs(wchar_t *, const __u8 *, int); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
33extern int utf8_wctomb(__u8 *, wchar_t, int); 55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs);
34extern int utf8_wcstombs(__u8 *, const wchar_t *, int); 56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen);
35 58
36static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c) 59static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
37{ 60{
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 848025cd7087..829b94b156f2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state)
408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE])
409 409
410extern int nr_node_ids; 410extern int nr_node_ids;
411extern int nr_online_nodes;
412
413static inline void node_set_online(int nid)
414{
415 node_set_state(nid, N_ONLINE);
416 nr_online_nodes = num_node_state(N_ONLINE);
417}
418
419static inline void node_set_offline(int nid)
420{
421 node_clear_state(nid, N_ONLINE);
422 nr_online_nodes = num_node_state(N_ONLINE);
423}
411#else 424#else
412 425
413static inline int node_state(int node, enum node_states state) 426static inline int node_state(int node, enum node_states state)
@@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state)
434#define first_online_node 0 447#define first_online_node 0
435#define next_online_node(nid) (MAX_NUMNODES) 448#define next_online_node(nid) (MAX_NUMNODES)
436#define nr_node_ids 1 449#define nr_node_ids 1
450#define nr_online_nodes 1
437 451
452#define node_set_online(node) node_set_state((node), N_ONLINE)
453#define node_set_offline(node) node_clear_state((node), N_ONLINE)
438#endif 454#endif
439 455
440#define node_online_map node_states[N_ONLINE] 456#define node_online_map node_states[N_ONLINE]
@@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state)
454#define node_online(node) node_state((node), N_ONLINE) 470#define node_online(node) node_state((node), N_ONLINE)
455#define node_possible(node) node_state((node), N_POSSIBLE) 471#define node_possible(node) node_state((node), N_POSSIBLE)
456 472
457#define node_set_online(node) node_set_state((node), N_ONLINE)
458#define node_set_offline(node) node_clear_state((node), N_ONLINE)
459
460#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) 473#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
461#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 474#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
462 475
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index b86fa2ffca0c..81bc252dc8ac 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -198,6 +198,7 @@ static inline int notifier_to_errno(int ret)
198#define NETDEV_CHANGENAME 0x000A 198#define NETDEV_CHANGENAME 0x000A
199#define NETDEV_FEAT_CHANGE 0x000B 199#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 200#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D
201 202
202#define SYS_DOWN 0x0001 /* Notify of system down */ 203#define SYS_DOWN 0x0001 /* Notify of system down */
203#define SYS_RESTART SYS_DOWN 204#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/of.h b/include/linux/of.h
index 6a7efa242f5e..7be2d1043c16 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -77,6 +77,9 @@ extern int of_n_size_cells(struct device_node *np);
77extern const struct of_device_id *of_match_node( 77extern const struct of_device_id *of_match_node(
78 const struct of_device_id *matches, const struct device_node *node); 78 const struct of_device_id *matches, const struct device_node *node);
79extern int of_modalias_node(struct device_node *node, char *modalias, int len); 79extern int of_modalias_node(struct device_node *node, char *modalias, int len);
80extern struct device_node *of_parse_phandle(struct device_node *np,
81 const char *phandle_name,
82 int index);
80extern int of_parse_phandles_with_args(struct device_node *np, 83extern int of_parse_phandles_with_args(struct device_node *np,
81 const char *list_name, const char *cells_name, int index, 84 const char *list_name, const char *cells_name, int index,
82 struct device_node **out_node, const void **out_args); 85 struct device_node **out_node, const void **out_args);
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
new file mode 100644
index 000000000000..c9663c690303
--- /dev/null
+++ b/include/linux/of_mdio.h
@@ -0,0 +1,22 @@
1/*
2 * OF helpers for the MDIO (Ethernet PHY) API
3 *
4 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MDIO_H
10#define __LINUX_OF_MDIO_H
11
12#include <linux/phy.h>
13#include <linux/of.h>
14
15extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
16extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
17extern struct phy_device *of_phy_connect(struct net_device *dev,
18 struct device_node *phy_np,
19 void (*hndlr)(struct net_device *),
20 u32 flags, phy_interface_t iface);
21
22#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 62214c7d2d93..d6792f88a176 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -95,9 +95,7 @@ enum pageflags {
95 PG_reclaim, /* To be reclaimed asap */ 95 PG_reclaim, /* To be reclaimed asap */
96 PG_buddy, /* Page is free, on buddy lists */ 96 PG_buddy, /* Page is free, on buddy lists */
97 PG_swapbacked, /* Page is backed by RAM/swap */ 97 PG_swapbacked, /* Page is backed by RAM/swap */
98#ifdef CONFIG_UNEVICTABLE_LRU
99 PG_unevictable, /* Page is "unevictable" */ 98 PG_unevictable, /* Page is "unevictable" */
100#endif
101#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 99#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
102 PG_mlocked, /* Page is vma mlocked */ 100 PG_mlocked, /* Page is vma mlocked */
103#endif 101#endif
@@ -248,14 +246,8 @@ PAGEFLAG_FALSE(SwapCache)
248 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache) 246 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
249#endif 247#endif
250 248
251#ifdef CONFIG_UNEVICTABLE_LRU
252PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 249PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
253 TESTCLEARFLAG(Unevictable, unevictable) 250 TESTCLEARFLAG(Unevictable, unevictable)
254#else
255PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
256 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
257 __CLEARPAGEFLAG_NOOP(Unevictable)
258#endif
259 251
260#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 252#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
261#define MLOCK_PAGES 1 253#define MLOCK_PAGES 1
@@ -382,12 +374,6 @@ static inline void __ClearPageTail(struct page *page)
382 374
383#endif /* !PAGEFLAGS_EXTENDED */ 375#endif /* !PAGEFLAGS_EXTENDED */
384 376
385#ifdef CONFIG_UNEVICTABLE_LRU
386#define __PG_UNEVICTABLE (1 << PG_unevictable)
387#else
388#define __PG_UNEVICTABLE 0
389#endif
390
391#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 377#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
392#define __PG_MLOCKED (1 << PG_mlocked) 378#define __PG_MLOCKED (1 << PG_mlocked)
393#else 379#else
@@ -403,7 +389,7 @@ static inline void __ClearPageTail(struct page *page)
403 1 << PG_private | 1 << PG_private_2 | \ 389 1 << PG_private | 1 << PG_private_2 | \
404 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 390 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
405 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 391 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
406 __PG_UNEVICTABLE | __PG_MLOCKED) 392 1 << PG_unevictable | __PG_MLOCKED)
407 393
408/* 394/*
409 * Flags checked when a page is prepped for return by the page allocator. 395 * Flags checked when a page is prepped for return by the page allocator.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 34da5230faab..aec3252afcf5 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -22,9 +22,7 @@ enum mapping_flags {
22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */ 22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
25#ifdef CONFIG_UNEVICTABLE_LRU
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 25 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27#endif
28}; 26};
29 27
30static inline void mapping_set_error(struct address_space *mapping, int error) 28static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -37,8 +35,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
37 } 35 }
38} 36}
39 37
40#ifdef CONFIG_UNEVICTABLE_LRU
41
42static inline void mapping_set_unevictable(struct address_space *mapping) 38static inline void mapping_set_unevictable(struct address_space *mapping)
43{ 39{
44 set_bit(AS_UNEVICTABLE, &mapping->flags); 40 set_bit(AS_UNEVICTABLE, &mapping->flags);
@@ -55,14 +51,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return test_bit(AS_UNEVICTABLE, &mapping->flags); 51 return test_bit(AS_UNEVICTABLE, &mapping->flags);
56 return !!mapping; 52 return !!mapping;
57} 53}
58#else
59static inline void mapping_set_unevictable(struct address_space *mapping) { }
60static inline void mapping_clear_unevictable(struct address_space *mapping) { }
61static inline int mapping_unevictable(struct address_space *mapping)
62{
63 return 0;
64}
65#endif
66 54
67static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 55static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
68{ 56{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 72698d89e767..8e366bb0705f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -124,6 +124,14 @@ typedef int __bitwise pci_power_t;
124#define PCI_UNKNOWN ((pci_power_t __force) 5) 124#define PCI_UNKNOWN ((pci_power_t __force) 5)
125#define PCI_POWER_ERROR ((pci_power_t __force) -1) 125#define PCI_POWER_ERROR ((pci_power_t __force) -1)
126 126
127/* Remember to update this when the list above changes! */
128extern const char *pci_power_names[];
129
130static inline const char *pci_power_name(pci_power_t state)
131{
132 return pci_power_names[1 + (int) state];
133}
134
127#define PCI_PM_D2_DELAY 200 135#define PCI_PM_D2_DELAY 200
128#define PCI_PM_D3_WAIT 10 136#define PCI_PM_D3_WAIT 10
129#define PCI_PM_BUS_WAIT 50 137#define PCI_PM_BUS_WAIT 50
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 19f8e6d1a4d2..a3b000365795 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -104,6 +104,7 @@
104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
107#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330
107#define PCI_CLASS_SERIAL_FIBER 0x0c04 108#define PCI_CLASS_SERIAL_FIBER 0x0c04
108#define PCI_CLASS_SERIAL_SMBUS 0x0c05 109#define PCI_CLASS_SERIAL_SMBUS 0x0c05
109 110
@@ -1067,8 +1068,6 @@
1067#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 1068#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034
1068#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 1069#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
1069#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 1070#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
1070#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
1071#define PCI_DEVICE_ID_NVIDIA_NVENET_11 0x0038
1072#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e 1071#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e
1073#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040 1072#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040
1074#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041 1073#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041
@@ -1079,21 +1078,16 @@
1079#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 1078#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053
1080#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 1079#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054
1081#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 1080#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055
1082#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
1083#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
1084#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 1081#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
1085#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d 1082#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d
1086#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 1083#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
1087#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 1084#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
1088#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
1089#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 1085#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069
1090#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a 1086#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
1091#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 1087#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084
1092#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 1088#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
1093#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086
1094#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 1089#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
1095#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a 1090#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
1096#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
1097#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e 1091#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
1098#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090 1092#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090
1099#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091 1093#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091
@@ -1109,15 +1103,12 @@
1109#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 1103#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
1110#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 1104#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4
1111#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 1105#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
1112#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
1113#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 1106#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9
1114#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da 1107#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
1115#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df
1116#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 1108#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
1117#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 1109#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3
1118#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 1110#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4
1119#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 1111#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5
1120#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1121#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1112#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1122#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1113#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1123#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 1114#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
@@ -1177,7 +1168,6 @@
1177#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 1168#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4
1178#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc 1169#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
1179#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1 1170#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1
1180#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3
1181#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 1171#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0
1182#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 1172#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200
1183#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201 1173#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201
@@ -1200,8 +1190,6 @@
1200#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E 1190#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1201#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E 1191#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
1202#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F 1192#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F
1203#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1204#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1205#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 1193#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280
1206#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 1194#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281
1207#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 1195#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282
@@ -1248,46 +1236,21 @@
1248#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 1236#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
1249#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C 1237#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
1250#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1238#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1251#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 1239#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5
1254#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6
1255#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 1240#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7
1256#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB 1241#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB
1257#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC 1242#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC
1258#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE
1259#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1260#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 1243#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1261#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 1244#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446 1245#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446
1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 1246#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448
1264#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1265#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1266#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1267#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1268#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542 1247#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542
1269#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1270#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1271#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
1272#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F
1273#define PCI_DEVICE_ID_NVIDIA_NVENET_28 0x07DC
1274#define PCI_DEVICE_ID_NVIDIA_NVENET_29 0x07DD
1275#define PCI_DEVICE_ID_NVIDIA_NVENET_30 0x07DE
1276#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF
1277#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1278#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1279#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752
1280#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1281#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760
1282#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1283#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1284#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1285#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 1252#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8
1286#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 1253#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2
1287#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1288#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1289#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
1290#define PCI_DEVICE_ID_NVIDIA_NVENET_39 0x0AB3
1291 1254
1292#define PCI_VENDOR_ID_IMS 0x10e0 1255#define PCI_VENDOR_ID_IMS 0x10e0
1293#define PCI_DEVICE_ID_IMS_TT128 0x9128 1256#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -1926,6 +1889,8 @@
1926#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540 1889#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540
1927#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550 1890#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550
1928#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 1891#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552
1892#define PCI_SUBDEVICE_ID_CCD_JHSE1 0xB553
1893#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B
1929#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560 1894#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560
1930#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562 1895#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562
1931#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563 1896#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563
@@ -2127,6 +2092,7 @@
2127#define PCI_VENDOR_ID_MAINPINE 0x1522 2092#define PCI_VENDOR_ID_MAINPINE 0x1522
2128#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 2093#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100
2129#define PCI_VENDOR_ID_ENE 0x1524 2094#define PCI_VENDOR_ID_ENE 0x1524
2095#define PCI_DEVICE_ID_ENE_CB710_FLASH 0x0510
2130#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 2096#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
2131#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 2097#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551
2132#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750 2098#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750
@@ -2288,6 +2254,8 @@
2288#define PCI_DEVICE_ID_MPC8547E 0x0018 2254#define PCI_DEVICE_ID_MPC8547E 0x0018
2289#define PCI_DEVICE_ID_MPC8545E 0x0019 2255#define PCI_DEVICE_ID_MPC8545E 0x0019
2290#define PCI_DEVICE_ID_MPC8545 0x001a 2256#define PCI_DEVICE_ID_MPC8545 0x001a
2257#define PCI_DEVICE_ID_MPC8569E 0x0061
2258#define PCI_DEVICE_ID_MPC8569 0x0060
2291#define PCI_DEVICE_ID_MPC8568E 0x0020 2259#define PCI_DEVICE_ID_MPC8568E 0x0020
2292#define PCI_DEVICE_ID_MPC8568 0x0021 2260#define PCI_DEVICE_ID_MPC8568 0x0021
2293#define PCI_DEVICE_ID_MPC8567E 0x0022 2261#define PCI_DEVICE_ID_MPC8567E 0x0022
@@ -2300,6 +2268,8 @@
2300#define PCI_DEVICE_ID_MPC8572 0x0041 2268#define PCI_DEVICE_ID_MPC8572 0x0041
2301#define PCI_DEVICE_ID_MPC8536E 0x0050 2269#define PCI_DEVICE_ID_MPC8536E 0x0050
2302#define PCI_DEVICE_ID_MPC8536 0x0051 2270#define PCI_DEVICE_ID_MPC8536 0x0051
2271#define PCI_DEVICE_ID_P2020E 0x0070
2272#define PCI_DEVICE_ID_P2020 0x0071
2303#define PCI_DEVICE_ID_MPC8641 0x7010 2273#define PCI_DEVICE_ID_MPC8641 0x7010
2304#define PCI_DEVICE_ID_MPC8641D 0x7011 2274#define PCI_DEVICE_ID_MPC8641D 0x7011
2305#define PCI_DEVICE_ID_MPC8610 0x7018 2275#define PCI_DEVICE_ID_MPC8610 0x7018
@@ -2327,6 +2297,8 @@
2327 2297
2328#define PCI_VENDOR_ID_QMI 0x1a32 2298#define PCI_VENDOR_ID_QMI 0x1a32
2329 2299
2300#define PCI_VENDOR_ID_AZWAVE 0x1a3b
2301
2330#define PCI_VENDOR_ID_TEKRAM 0x1de1 2302#define PCI_VENDOR_ID_TEKRAM 0x1de1
2331#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2303#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2332 2304
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 97e40cb6b588..b1368b8f6572 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -79,7 +79,7 @@ typedef enum {
79 * Need to be a little smaller than phydev->dev.bus_id to leave room 79 * Need to be a little smaller than phydev->dev.bus_id to leave room
80 * for the ":%02x" 80 * for the ":%02x"
81 */ 81 */
82#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3) 82#define MII_BUS_ID_SIZE (20 - 3)
83 83
84/* 84/*
85 * The Bus class for PHYs. Devices which provide access to 85 * The Bus class for PHYs. Devices which provide access to
@@ -407,7 +407,7 @@ struct phy_driver {
407/* A Structure for boards to register fixups with the PHY Lib */ 407/* A Structure for boards to register fixups with the PHY Lib */
408struct phy_fixup { 408struct phy_fixup {
409 struct list_head list; 409 struct list_head list;
410 char bus_id[BUS_ID_SIZE]; 410 char bus_id[20];
411 u32 phy_uid; 411 u32 phy_uid;
412 u32 phy_uid_mask; 412 u32 phy_uid_mask;
413 int (*run)(struct phy_device *phydev); 413 int (*run)(struct phy_device *phydev);
@@ -444,10 +444,16 @@ static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
444 444
445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
446struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 446struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
447int phy_device_register(struct phy_device *phy);
447int phy_clear_interrupt(struct phy_device *phydev); 448int phy_clear_interrupt(struct phy_device *phydev);
448int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 449int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
450int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
451 u32 flags, phy_interface_t interface);
449struct phy_device * phy_attach(struct net_device *dev, 452struct phy_device * phy_attach(struct net_device *dev,
450 const char *bus_id, u32 flags, phy_interface_t interface); 453 const char *bus_id, u32 flags, phy_interface_t interface);
454int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
455 void (*handler)(struct net_device *), u32 flags,
456 phy_interface_t interface);
451struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 457struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
452 void (*handler)(struct net_device *), u32 flags, 458 void (*handler)(struct net_device *), u32 flags,
453 phy_interface_t interface); 459 phy_interface_t interface);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index b67bb5d7b221..8dc5123b6305 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -36,8 +36,8 @@ extern struct device platform_bus;
36 36
37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
38extern int platform_get_irq(struct platform_device *, unsigned int); 38extern int platform_get_irq(struct platform_device *, unsigned int);
39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *); 39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
40extern int platform_get_irq_byname(struct platform_device *, char *); 40extern int platform_get_irq_byname(struct platform_device *, const char *);
41extern int platform_add_devices(struct platform_device **, int); 41extern int platform_add_devices(struct platform_device **, int);
42 42
43extern struct platform_device *platform_device_register_simple(const char *, int id, 43extern struct platform_device *platform_device_register_simple(const char *, int id,
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8c24ef8d9976..fa287f25138d 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -32,6 +32,7 @@ typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_
32 32
33typedef struct poll_table_struct { 33typedef struct poll_table_struct {
34 poll_queue_proc qproc; 34 poll_queue_proc qproc;
35 unsigned long key;
35} poll_table; 36} poll_table;
36 37
37static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 38static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
@@ -43,10 +44,12 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres
43static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 44static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
44{ 45{
45 pt->qproc = qproc; 46 pt->qproc = qproc;
47 pt->key = ~0UL; /* all events enabled */
46} 48}
47 49
48struct poll_table_entry { 50struct poll_table_entry {
49 struct file *filp; 51 struct file *filp;
52 unsigned long key;
50 wait_queue_t wait; 53 wait_queue_t wait;
51 wait_queue_head_t *wait_address; 54 wait_queue_head_t *wait_address;
52}; 55};
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 355f6e80db0d..c5da74918096 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items); 167 unsigned long first_index, unsigned int max_items);
168unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
169 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
170unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
171 unsigned long index, unsigned long max_scan);
170int radix_tree_preload(gfp_t gfp_mask); 172int radix_tree_preload(gfp_t gfp_mask);
171void radix_tree_init(void); 173void radix_tree_init(void);
172void *radix_tree_tag_set(struct radix_tree_root *root, 174void *radix_tree_tag_set(struct radix_tree_root *root,
diff --git a/include/linux/regulator/lp3971.h b/include/linux/regulator/lp3971.h
new file mode 100644
index 000000000000..61401649fe7d
--- /dev/null
+++ b/include/linux/regulator/lp3971.h
@@ -0,0 +1,51 @@
1/*
2 * National Semiconductors LP3971 PMIC chip client interface
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Author: Marek Szyprowski <m.szyprowski@samsung.com>
6 *
7 * Based on wm8400.h
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef __LINUX_REGULATOR_LP3971_H
25#define __LINUX_REGULATOR_LP3971_H
26
27#include <linux/regulator/machine.h>
28
29#define LP3971_LDO1 0
30#define LP3971_LDO2 1
31#define LP3971_LDO3 2
32#define LP3971_LDO4 3
33#define LP3971_LDO5 4
34
35#define LP3971_DCDC1 5
36#define LP3971_DCDC2 6
37#define LP3971_DCDC3 7
38
39#define LP3971_NUM_REGULATORS 8
40
41struct lp3971_regulator_subdev {
42 int id;
43 struct regulator_init_data *initdata;
44};
45
46struct lp3971_platform_data {
47 int num_regulators;
48 struct lp3971_regulator_subdev *regulators;
49};
50
51#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
new file mode 100644
index 000000000000..44563192bf16
--- /dev/null
+++ b/include/linux/regulator/max1586.h
@@ -0,0 +1,63 @@
1/*
2 * max1586.h -- Voltage regulation for the Maxim 1586
3 *
4 * Copyright (C) 2008 Robert Jarzmik
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (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 REGULATOR_MAX1586
22#define REGULATOR_MAX1586
23
24#include <linux/regulator/machine.h>
25
26#define MAX1586_V3 0
27#define MAX1586_V6 1
28
29/* precalculated values for v3_gain */
30#define MAX1586_GAIN_NO_R24 1000000 /* 700000 .. 1475000 mV */
31#define MAX1586_GAIN_R24_3k32 1051098 /* 735768 .. 1550369 mV */
32#define MAX1586_GAIN_R24_5k11 1078648 /* 755053 .. 1591005 mV */
33#define MAX1586_GAIN_R24_7k5 1115432 /* 780802 .. 1645262 mV */
34
35/**
36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...)
40 */
41struct max1586_subdev_data {
42 int id;
43 char *name;
44 struct regulator_init_data *platform_data;
45};
46
47/**
48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2)
50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
53 * This can be calculated as ((1 + R24/R25 + R24/185.5kOhm) * 1e6)
54 * for an external resistor configuration as described in the
55 * data sheet (R25=100kOhm).
56 */
57struct max1586_platform_data {
58 int num_subdevs;
59 struct max1586_subdev_data *subdevs;
60 int v3_gain;
61};
62
63#endif
diff --git a/include/linux/regulator/userspace-consumer.h b/include/linux/regulator/userspace-consumer.h
new file mode 100644
index 000000000000..b4554ce9d4bb
--- /dev/null
+++ b/include/linux/regulator/userspace-consumer.h
@@ -0,0 +1,25 @@
1#ifndef __REGULATOR_PLATFORM_CONSUMER_H_
2#define __REGULATOR_PLATFORM_CONSUMER_H_
3
4struct regulator_consumer_supply;
5
6/**
7 * struct regulator_userspace_consumer_data - line consumer
8 * initialisation data.
9 *
10 * @name: Name for the consumer line
11 * @num_supplies: Number of supplies feeding the line
12 * @supplies: Supplies configuration.
13 * @init_on: Set if the regulators supplying the line should be
14 * enabled during initialisation
15 */
16struct regulator_userspace_consumer_data {
17 const char *name;
18
19 int num_supplies;
20 struct regulator_bulk_data *supplies;
21
22 bool init_on;
23};
24
25#endif /* __REGULATOR_PLATFORM_CONSUMER_H_ */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 164332cbb77c..16e39c7a67fc 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -4,6 +4,7 @@
4/* 4/*
5 * Copyright (C) 2006 - 2007 Ivo van Doorn 5 * Copyright (C) 2006 - 2007 Ivo van Doorn
6 * Copyright (C) 2007 Dmitry Torokhov 6 * Copyright (C) 2007 Dmitry Torokhov
7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -22,131 +23,331 @@
22 */ 23 */
23 24
24#include <linux/types.h> 25#include <linux/types.h>
25#include <linux/kernel.h> 26
26#include <linux/list.h> 27/* define userspace visible states */
27#include <linux/mutex.h> 28#define RFKILL_STATE_SOFT_BLOCKED 0
28#include <linux/device.h> 29#define RFKILL_STATE_UNBLOCKED 1
29#include <linux/leds.h> 30#define RFKILL_STATE_HARD_BLOCKED 2
30 31
31/** 32/**
32 * enum rfkill_type - type of rfkill switch. 33 * enum rfkill_type - type of rfkill switch.
33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 34 *
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 35 * @RFKILL_TYPE_ALL: toggles all switches (userspace only)
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 36 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device. 37 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
37 * RFKILL_TYPE_WWAN: switch is on a wireless WAN device. 38 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
39 * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
40 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
41 * @NUM_RFKILL_TYPES: number of defined rfkill types
38 */ 42 */
39enum rfkill_type { 43enum rfkill_type {
40 RFKILL_TYPE_WLAN , 44 RFKILL_TYPE_ALL = 0,
45 RFKILL_TYPE_WLAN,
41 RFKILL_TYPE_BLUETOOTH, 46 RFKILL_TYPE_BLUETOOTH,
42 RFKILL_TYPE_UWB, 47 RFKILL_TYPE_UWB,
43 RFKILL_TYPE_WIMAX, 48 RFKILL_TYPE_WIMAX,
44 RFKILL_TYPE_WWAN, 49 RFKILL_TYPE_WWAN,
45 RFKILL_TYPE_MAX, 50 NUM_RFKILL_TYPES,
46}; 51};
47 52
48enum rfkill_state { 53/**
49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ 54 * enum rfkill_operation - operation types
50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ 55 * @RFKILL_OP_ADD: a device was added
51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ 56 * @RFKILL_OP_DEL: a device was removed
52 RFKILL_STATE_MAX, /* marker for last valid state */ 57 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
58 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
59 */
60enum rfkill_operation {
61 RFKILL_OP_ADD = 0,
62 RFKILL_OP_DEL,
63 RFKILL_OP_CHANGE,
64 RFKILL_OP_CHANGE_ALL,
53}; 65};
54 66
55/* 67/**
56 * These are DEPRECATED, drivers using them should be verified to 68 * struct rfkill_event - events for userspace on /dev/rfkill
57 * comply with the rfkill usage guidelines in Documentation/rfkill.txt 69 * @idx: index of dev rfkill
58 * and then converted to use the new names for rfkill_state 70 * @type: type of the rfkill struct
59 */ 71 * @op: operation code
60#define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED 72 * @hard: hard state (0/1)
61#define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED 73 * @soft: soft state (0/1)
62 74 *
63/** 75 * Structure used for userspace communication on /dev/rfkill,
64 * struct rfkill - rfkill control structure. 76 * used for events from the kernel and control to the kernel.
65 * @name: Name of the switch. 77 */
66 * @type: Radio type which the button controls, the value stored 78struct rfkill_event {
67 * here should be a value from enum rfkill_type. 79 __u32 idx;
68 * @state: State of the switch, "UNBLOCKED" means radio can operate. 80 __u8 type;
69 * @user_claim_unsupported: Whether the hardware supports exclusive 81 __u8 op;
70 * RF-kill control by userspace. Set this before registering. 82 __u8 soft, hard;
71 * @user_claim: Set when the switch is controlled exlusively by userspace. 83} __packed;
72 * @mutex: Guards switch state transitions. It serializes callbacks
73 * and also protects the state.
74 * @data: Pointer to the RF button drivers private data which will be
75 * passed along when toggling radio state.
76 * @toggle_radio(): Mandatory handler to control state of the radio.
77 * only RFKILL_STATE_SOFT_BLOCKED and RFKILL_STATE_UNBLOCKED are
78 * valid parameters.
79 * @get_state(): handler to read current radio state from hardware,
80 * may be called from atomic context, should return 0 on success.
81 * Either this handler OR judicious use of rfkill_force_state() is
82 * MANDATORY for any driver capable of RFKILL_STATE_HARD_BLOCKED.
83 * @led_trigger: A LED trigger for this button's LED.
84 * @dev: Device structure integrating the switch into device tree.
85 * @node: Used to place switch into list of all switches known to the
86 * the system.
87 *
88 * This structure represents a RF switch located on a network device.
89 */
90struct rfkill {
91 const char *name;
92 enum rfkill_type type;
93
94 bool user_claim_unsupported;
95 bool user_claim;
96
97 /* the mutex serializes callbacks and also protects
98 * the state */
99 struct mutex mutex;
100 enum rfkill_state state;
101 void *data;
102 int (*toggle_radio)(void *data, enum rfkill_state state);
103 int (*get_state)(void *data, enum rfkill_state *state);
104 84
105#ifdef CONFIG_RFKILL_LEDS 85/* ioctl for turning off rfkill-input (if present) */
106 struct led_trigger led_trigger; 86#define RFKILL_IOC_MAGIC 'R'
107#endif 87#define RFKILL_IOC_NOINPUT 1
88#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
89
90/* and that's all userspace gets */
91#ifdef __KERNEL__
92/* don't allow anyone to use these in the kernel */
93enum rfkill_user_states {
94 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
95 RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED,
96 RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED,
97};
98#undef RFKILL_STATE_SOFT_BLOCKED
99#undef RFKILL_STATE_UNBLOCKED
100#undef RFKILL_STATE_HARD_BLOCKED
101
102#include <linux/types.h>
103#include <linux/kernel.h>
104#include <linux/list.h>
105#include <linux/mutex.h>
106#include <linux/device.h>
107#include <linux/leds.h>
108#include <linux/err.h>
109
110/* this is opaque */
111struct rfkill;
108 112
109 struct device dev; 113/**
110 struct list_head node; 114 * struct rfkill_ops - rfkill driver methods
111 enum rfkill_state state_for_resume; 115 *
116 * @poll: poll the rfkill block state(s) -- only assign this method
117 * when you need polling. When called, simply call one of the
118 * rfkill_set{,_hw,_sw}_state family of functions. If the hw
119 * is getting unblocked you need to take into account the return
120 * value of those functions to make sure the software block is
121 * properly used.
122 * @query: query the rfkill block state(s) and call exactly one of the
123 * rfkill_set{,_hw,_sw}_state family of functions. Assign this
124 * method if input events can cause hardware state changes to make
125 * the rfkill core query your driver before setting a requested
126 * block.
127 * @set_block: turn the transmitter on (blocked == false) or off
128 * (blocked == true) -- ignore and return 0 when hard blocked.
129 * This callback must be assigned.
130 */
131struct rfkill_ops {
132 void (*poll)(struct rfkill *rfkill, void *data);
133 void (*query)(struct rfkill *rfkill, void *data);
134 int (*set_block)(void *data, bool blocked);
112}; 135};
113#define to_rfkill(d) container_of(d, struct rfkill, dev)
114 136
115struct rfkill * __must_check rfkill_allocate(struct device *parent, 137#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
116 enum rfkill_type type); 138/**
117void rfkill_free(struct rfkill *rfkill); 139 * rfkill_alloc - allocate rfkill structure
140 * @name: name of the struct -- the string is not copied internally
141 * @parent: device that has rf switch on it
142 * @type: type of the switch (RFKILL_TYPE_*)
143 * @ops: rfkill methods
144 * @ops_data: data passed to each method
145 *
146 * This function should be called by the transmitter driver to allocate an
147 * rfkill structure. Returns %NULL on failure.
148 */
149struct rfkill * __must_check rfkill_alloc(const char *name,
150 struct device *parent,
151 const enum rfkill_type type,
152 const struct rfkill_ops *ops,
153 void *ops_data);
154
155/**
156 * rfkill_register - Register a rfkill structure.
157 * @rfkill: rfkill structure to be registered
158 *
159 * This function should be called by the transmitter driver to register
160 * the rfkill structure. Before calling this function the driver needs
161 * to be ready to service method calls from rfkill.
162 *
163 * If the software blocked state is not set before registration,
164 * set_block will be called to initialize it to a default value.
165 *
166 * If the hardware blocked state is not set before registration,
167 * it is assumed to be unblocked.
168 */
118int __must_check rfkill_register(struct rfkill *rfkill); 169int __must_check rfkill_register(struct rfkill *rfkill);
170
171/**
172 * rfkill_pause_polling(struct rfkill *rfkill)
173 *
174 * Pause polling -- say transmitter is off for other reasons.
175 * NOTE: not necessary for suspend/resume -- in that case the
176 * core stops polling anyway
177 */
178void rfkill_pause_polling(struct rfkill *rfkill);
179
180/**
181 * rfkill_resume_polling(struct rfkill *rfkill)
182 *
183 * Pause polling -- say transmitter is off for other reasons.
184 * NOTE: not necessary for suspend/resume -- in that case the
185 * core stops polling anyway
186 */
187void rfkill_resume_polling(struct rfkill *rfkill);
188
189
190/**
191 * rfkill_unregister - Unregister a rfkill structure.
192 * @rfkill: rfkill structure to be unregistered
193 *
194 * This function should be called by the network driver during device
195 * teardown to destroy rfkill structure. Until it returns, the driver
196 * needs to be able to service method calls.
197 */
119void rfkill_unregister(struct rfkill *rfkill); 198void rfkill_unregister(struct rfkill *rfkill);
120 199
121int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); 200/**
122int rfkill_set_default(enum rfkill_type type, enum rfkill_state state); 201 * rfkill_destroy - free rfkill structure
202 * @rfkill: rfkill structure to be destroyed
203 *
204 * Destroys the rfkill structure.
205 */
206void rfkill_destroy(struct rfkill *rfkill);
207
208/**
209 * rfkill_set_hw_state - Set the internal rfkill hardware block state
210 * @rfkill: pointer to the rfkill class to modify.
211 * @state: the current hardware block state to set
212 *
213 * rfkill drivers that get events when the hard-blocked state changes
214 * use this function to notify the rfkill core (and through that also
215 * userspace) of the current state. They should also use this after
216 * resume if the state could have changed.
217 *
218 * You need not (but may) call this function if poll_state is assigned.
219 *
220 * This function can be called in any context, even from within rfkill
221 * callbacks.
222 *
223 * The function returns the combined block state (true if transmitter
224 * should be blocked) so that drivers need not keep track of the soft
225 * block state -- which they might not be able to.
226 */
227bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
228
229/**
230 * rfkill_set_sw_state - Set the internal rfkill software block state
231 * @rfkill: pointer to the rfkill class to modify.
232 * @state: the current software block state to set
233 *
234 * rfkill drivers that get events when the soft-blocked state changes
235 * (yes, some platforms directly act on input but allow changing again)
236 * use this function to notify the rfkill core (and through that also
237 * userspace) of the current state. It is not necessary to notify on
238 * resume; since hibernation can always change the soft-blocked state,
239 * the rfkill core will unconditionally restore the previous state.
240 *
241 * This function can be called in any context, even from within rfkill
242 * callbacks.
243 *
244 * The function returns the combined block state (true if transmitter
245 * should be blocked).
246 */
247bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked);
248
249/**
250 * rfkill_set_states - Set the internal rfkill block states
251 * @rfkill: pointer to the rfkill class to modify.
252 * @sw: the current software block state to set
253 * @hw: the current hardware block state to set
254 *
255 * This function can be called in any context, even from within rfkill
256 * callbacks.
257 */
258void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
123 259
124/** 260/**
125 * rfkill_state_complement - return complementar state 261 * rfkill_blocked - query rfkill block
126 * @state: state to return the complement of
127 * 262 *
128 * Returns RFKILL_STATE_SOFT_BLOCKED if @state is RFKILL_STATE_UNBLOCKED, 263 * @rfkill: rfkill struct to query
129 * returns RFKILL_STATE_UNBLOCKED otherwise.
130 */ 264 */
131static inline enum rfkill_state rfkill_state_complement(enum rfkill_state state) 265bool rfkill_blocked(struct rfkill *rfkill);
266#else /* !RFKILL */
267static inline struct rfkill * __must_check
268rfkill_alloc(const char *name,
269 struct device *parent,
270 const enum rfkill_type type,
271 const struct rfkill_ops *ops,
272 void *ops_data)
273{
274 return ERR_PTR(-ENODEV);
275}
276
277static inline int __must_check rfkill_register(struct rfkill *rfkill)
278{
279 if (rfkill == ERR_PTR(-ENODEV))
280 return 0;
281 return -EINVAL;
282}
283
284static inline void rfkill_pause_polling(struct rfkill *rfkill)
285{
286}
287
288static inline void rfkill_resume_polling(struct rfkill *rfkill)
289{
290}
291
292static inline void rfkill_unregister(struct rfkill *rfkill)
293{
294}
295
296static inline void rfkill_destroy(struct rfkill *rfkill)
297{
298}
299
300static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked)
301{
302 return blocked;
303}
304
305static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
132{ 306{
133 return (state == RFKILL_STATE_UNBLOCKED) ? 307 return blocked;
134 RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
135} 308}
136 309
310static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
311{
312}
313
314static inline bool rfkill_blocked(struct rfkill *rfkill)
315{
316 return false;
317}
318#endif /* RFKILL || RFKILL_MODULE */
319
320
321#ifdef CONFIG_RFKILL_LEDS
137/** 322/**
138 * rfkill_get_led_name - Get the LED trigger name for the button's LED. 323 * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
139 * This function might return a NULL pointer if registering of the 324 * This function might return a NULL pointer if registering of the
140 * LED trigger failed. 325 * LED trigger failed. Use this as "default_trigger" for the LED.
141 * Use this as "default_trigger" for the LED.
142 */ 326 */
143static inline char *rfkill_get_led_name(struct rfkill *rfkill) 327const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
144{ 328
145#ifdef CONFIG_RFKILL_LEDS 329/**
146 return (char *)(rfkill->led_trigger.name); 330 * rfkill_set_led_trigger_name -- set the LED trigger name
331 * @rfkill: rfkill struct
332 * @name: LED trigger name
333 *
334 * This function sets the LED trigger name of the radio LED
335 * trigger that rfkill creates. It is optional, but if called
336 * must be called before rfkill_register() to be effective.
337 */
338void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
147#else 339#else
340static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
341{
148 return NULL; 342 return NULL;
149#endif
150} 343}
151 344
345static inline void
346rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
347{
348}
349#endif
350
351#endif /* __KERNEL__ */
352
152#endif /* RFKILL_H */ 353#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 8670f1575fe1..29f8599e6bea 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_RING_BUFFER_H 1#ifndef _LINUX_RING_BUFFER_H
2#define _LINUX_RING_BUFFER_H 2#define _LINUX_RING_BUFFER_H
3 3
4#include <linux/kmemcheck.h>
4#include <linux/mm.h> 5#include <linux/mm.h>
5#include <linux/seq_file.h> 6#include <linux/seq_file.h>
6 7
@@ -11,7 +12,10 @@ struct ring_buffer_iter;
11 * Don't refer to this struct directly, use functions below. 12 * Don't refer to this struct directly, use functions below.
12 */ 13 */
13struct ring_buffer_event { 14struct ring_buffer_event {
15 kmemcheck_bitfield_begin(bitfield);
14 u32 type_len:5, time_delta:27; 16 u32 type_len:5, time_delta:27;
17 kmemcheck_bitfield_end(bitfield);
18
15 u32 array[]; 19 u32 array[];
16}; 20};
17 21
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b35bc0e19cd9..216d024f830d 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma,
83/* 83/*
84 * Called from mm/vmscan.c to handle paging out 84 * Called from mm/vmscan.c to handle paging out
85 */ 85 */
86int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt); 86int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags);
87int try_to_unmap(struct page *, int ignore_refs); 88int try_to_unmap(struct page *, int ignore_refs);
88 89
89/* 90/*
@@ -105,18 +106,11 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 */ 106 */
106int page_mkclean(struct page *); 107int page_mkclean(struct page *);
107 108
108#ifdef CONFIG_UNEVICTABLE_LRU
109/* 109/*
110 * called in munlock()/munmap() path to check for other vmas holding 110 * called in munlock()/munmap() path to check for other vmas holding
111 * the page mlocked. 111 * the page mlocked.
112 */ 112 */
113int try_to_munlock(struct page *); 113int try_to_munlock(struct page *);
114#else
115static inline int try_to_munlock(struct page *page)
116{
117 return 0; /* a.k.a. SWAP_SUCCESS */
118}
119#endif
120 114
121#else /* !CONFIG_MMU */ 115#else /* !CONFIG_MMU */
122 116
@@ -124,7 +118,7 @@ static inline int try_to_munlock(struct page *page)
124#define anon_vma_prepare(vma) (0) 118#define anon_vma_prepare(vma) (0)
125#define anon_vma_link(vma) do {} while (0) 119#define anon_vma_link(vma) do {} while (0)
126 120
127#define page_referenced(page,l,cnt) TestClearPageReferenced(page) 121#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
128#define try_to_unmap(page, refs) SWAP_FAIL 122#define try_to_unmap(page, refs) SWAP_FAIL
129 123
130static inline int page_mkclean(struct page *page) 124static inline int page_mkclean(struct page *page)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4896fdfec913..02042e7f2196 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -261,6 +261,7 @@ extern void task_rq_unlock_wait(struct task_struct *p);
261extern cpumask_var_t nohz_cpu_mask; 261extern cpumask_var_t nohz_cpu_mask;
262#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 262#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
263extern int select_nohz_load_balancer(int cpu); 263extern int select_nohz_load_balancer(int cpu);
264extern int get_nohz_load_balancer(void);
264#else 265#else
265static inline int select_nohz_load_balancer(int cpu) 266static inline int select_nohz_load_balancer(int cpu)
266{ 267{
@@ -673,7 +674,7 @@ struct user_struct {
673 struct task_group *tg; 674 struct task_group *tg;
674#ifdef CONFIG_SYSFS 675#ifdef CONFIG_SYSFS
675 struct kobject kobj; 676 struct kobject kobj;
676 struct work_struct work; 677 struct delayed_work work;
677#endif 678#endif
678#endif 679#endif
679 680
@@ -1177,7 +1178,6 @@ struct task_struct {
1177 * a short time 1178 * a short time
1178 */ 1179 */
1179 unsigned char fpu_counter; 1180 unsigned char fpu_counter;
1180 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1181#ifdef CONFIG_BLK_DEV_IO_TRACE 1181#ifdef CONFIG_BLK_DEV_IO_TRACE
1182 unsigned int btrace_seq; 1182 unsigned int btrace_seq;
1183#endif 1183#endif
@@ -1317,7 +1317,8 @@ struct task_struct {
1317/* Thread group tracking */ 1317/* Thread group tracking */
1318 u32 parent_exec_id; 1318 u32 parent_exec_id;
1319 u32 self_exec_id; 1319 u32 self_exec_id;
1320/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1320/* Protection of (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed,
1321 * mempolicy */
1321 spinlock_t alloc_lock; 1322 spinlock_t alloc_lock;
1322 1323
1323#ifdef CONFIG_GENERIC_HARDIRQS 1324#ifdef CONFIG_GENERIC_HARDIRQS
@@ -1385,8 +1386,7 @@ struct task_struct {
1385 cputime_t acct_timexpd; /* stime + utime since last update */ 1386 cputime_t acct_timexpd; /* stime + utime since last update */
1386#endif 1387#endif
1387#ifdef CONFIG_CPUSETS 1388#ifdef CONFIG_CPUSETS
1388 nodemask_t mems_allowed; 1389 nodemask_t mems_allowed; /* Protected by alloc_lock */
1389 int cpuset_mems_generation;
1390 int cpuset_mem_spread_rotor; 1390 int cpuset_mem_spread_rotor;
1391#endif 1391#endif
1392#ifdef CONFIG_CGROUPS 1392#ifdef CONFIG_CGROUPS
@@ -1409,7 +1409,7 @@ struct task_struct {
1409 struct list_head perf_counter_list; 1409 struct list_head perf_counter_list;
1410#endif 1410#endif
1411#ifdef CONFIG_NUMA 1411#ifdef CONFIG_NUMA
1412 struct mempolicy *mempolicy; 1412 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1413 short il_next; 1413 short il_next;
1414#endif 1414#endif
1415 atomic_t fs_excl; /* holding fs exclusive resources */ 1415 atomic_t fs_excl; /* holding fs exclusive resources */
@@ -1796,11 +1796,23 @@ extern unsigned int sysctl_sched_child_runs_first;
1796extern unsigned int sysctl_sched_features; 1796extern unsigned int sysctl_sched_features;
1797extern unsigned int sysctl_sched_migration_cost; 1797extern unsigned int sysctl_sched_migration_cost;
1798extern unsigned int sysctl_sched_nr_migrate; 1798extern unsigned int sysctl_sched_nr_migrate;
1799extern unsigned int sysctl_timer_migration;
1799 1800
1800int sched_nr_latency_handler(struct ctl_table *table, int write, 1801int sched_nr_latency_handler(struct ctl_table *table, int write,
1801 struct file *file, void __user *buffer, size_t *length, 1802 struct file *file, void __user *buffer, size_t *length,
1802 loff_t *ppos); 1803 loff_t *ppos);
1803#endif 1804#endif
1805#ifdef CONFIG_SCHED_DEBUG
1806static inline unsigned int get_sysctl_timer_migration(void)
1807{
1808 return sysctl_timer_migration;
1809}
1810#else
1811static inline unsigned int get_sysctl_timer_migration(void)
1812{
1813 return 1;
1814}
1815#endif
1804extern unsigned int sysctl_sched_rt_period; 1816extern unsigned int sysctl_sched_rt_period;
1805extern int sysctl_sched_rt_runtime; 1817extern int sysctl_sched_rt_runtime;
1806 1818
@@ -2212,6 +2224,12 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
2212 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); 2224 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
2213} 2225}
2214 2226
2227static inline int restart_syscall(void)
2228{
2229 set_tsk_thread_flag(current, TIF_SIGPENDING);
2230 return -ERESTARTNOINTR;
2231}
2232
2215static inline int signal_pending(struct task_struct *p) 2233static inline int signal_pending(struct task_struct *p)
2216{ 2234{
2217 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2235 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c2731bfe04d8..b464b9d3d242 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -487,17 +487,17 @@ typedef enum {
487 * 487 *
488 * Value Cause Code 488 * Value Cause Code
489 * --------- ---------------- 489 * --------- ----------------
490 * 0x0100 Request to Delete Last Remaining IP Address. 490 * 0x00A0 Request to Delete Last Remaining IP Address.
491 * 0x0101 Operation Refused Due to Resource Shortage. 491 * 0x00A1 Operation Refused Due to Resource Shortage.
492 * 0x0102 Request to Delete Source IP Address. 492 * 0x00A2 Request to Delete Source IP Address.
493 * 0x0103 Association Aborted due to illegal ASCONF-ACK 493 * 0x00A3 Association Aborted due to illegal ASCONF-ACK
494 * 0x0104 Request refused - no authorization. 494 * 0x00A4 Request refused - no authorization.
495 */ 495 */
496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x0100), 496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x00A0),
497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x0101), 497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x00A1),
498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x0102), 498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x00A2),
499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x0103), 499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x00A3),
500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x0104), 500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x00A4),
501 501
502 /* AUTH Section 4. New Error Cause 502 /* AUTH Section 4. New Error Cause
503 * 503 *
diff --git a/include/linux/section-names.h b/include/linux/section-names.h
deleted file mode 100644
index c956f4eb2adf..000000000000
--- a/include/linux/section-names.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __LINUX_SECTION_NAMES_H
2#define __LINUX_SECTION_NAMES_H
3
4#define HEAD_TEXT_SECTION .head.text
5
6#endif /* !__LINUX_SECTION_NAMES_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5fd389162f01..63ef24bc01d0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -15,6 +15,7 @@
15#define _LINUX_SKBUFF_H 15#define _LINUX_SKBUFF_H
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kmemcheck.h>
18#include <linux/compiler.h> 19#include <linux/compiler.h>
19#include <linux/time.h> 20#include <linux/time.h>
20#include <linux/cache.h> 21#include <linux/cache.h>
@@ -189,20 +190,23 @@ struct skb_shared_info {
189 atomic_t dataref; 190 atomic_t dataref;
190 unsigned short nr_frags; 191 unsigned short nr_frags;
191 unsigned short gso_size; 192 unsigned short gso_size;
193#ifdef CONFIG_HAS_DMA
194 dma_addr_t dma_head;
195#endif
192 /* Warning: this field is not always filled in (UFO)! */ 196 /* Warning: this field is not always filled in (UFO)! */
193 unsigned short gso_segs; 197 unsigned short gso_segs;
194 unsigned short gso_type; 198 unsigned short gso_type;
195 __be32 ip6_frag_id; 199 __be32 ip6_frag_id;
196 union skb_shared_tx tx_flags; 200 union skb_shared_tx tx_flags;
197#ifdef CONFIG_HAS_DMA
198 unsigned int num_dma_maps;
199#endif
200 struct sk_buff *frag_list; 201 struct sk_buff *frag_list;
201 struct skb_shared_hwtstamps hwtstamps; 202 struct skb_shared_hwtstamps hwtstamps;
202 skb_frag_t frags[MAX_SKB_FRAGS]; 203 skb_frag_t frags[MAX_SKB_FRAGS];
203#ifdef CONFIG_HAS_DMA 204#ifdef CONFIG_HAS_DMA
204 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; 205 dma_addr_t dma_maps[MAX_SKB_FRAGS];
205#endif 206#endif
207 /* Intermediate layers must ensure that destructor_arg
208 * remains valid until skb destructor */
209 void * destructor_arg;
206}; 210};
207 211
208/* We divide dataref into two halves. The higher 16 bits hold references 212/* We divide dataref into two halves. The higher 16 bits hold references
@@ -301,9 +305,6 @@ typedef unsigned char *sk_buff_data_t;
301 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
302 * @ndisc_nodetype: router type (from link layer) 306 * @ndisc_nodetype: router type (from link layer)
303 * @do_not_encrypt: set to prevent encryption of this frame 307 * @do_not_encrypt: set to prevent encryption of this frame
304 * @requeue: set to indicate that the wireless core should attempt
305 * a software retry on this frame if we failed to
306 * receive an ACK for it
307 * @dma_cookie: a cookie to one of several possible DMA operations 308 * @dma_cookie: a cookie to one of several possible DMA operations
308 * done by skb DMA functions 309 * done by skb DMA functions
309 * @secmark: security marking 310 * @secmark: security marking
@@ -319,10 +320,7 @@ struct sk_buff {
319 ktime_t tstamp; 320 ktime_t tstamp;
320 struct net_device *dev; 321 struct net_device *dev;
321 322
322 union { 323 unsigned long _skb_dst;
323 struct dst_entry *dst;
324 struct rtable *rtable;
325 };
326#ifdef CONFIG_XFRM 324#ifdef CONFIG_XFRM
327 struct sec_path *sp; 325 struct sec_path *sp;
328#endif 326#endif
@@ -346,6 +344,7 @@ struct sk_buff {
346 }; 344 };
347 }; 345 };
348 __u32 priority; 346 __u32 priority;
347 kmemcheck_bitfield_begin(flags1);
349 __u8 local_df:1, 348 __u8 local_df:1,
350 cloned:1, 349 cloned:1,
351 ip_summed:2, 350 ip_summed:2,
@@ -356,6 +355,7 @@ struct sk_buff {
356 ipvs_property:1, 355 ipvs_property:1,
357 peeked:1, 356 peeked:1,
358 nf_trace:1; 357 nf_trace:1;
358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol; 359 __be16 protocol;
360 360
361 void (*destructor)(struct sk_buff *skb); 361 void (*destructor)(struct sk_buff *skb);
@@ -375,13 +375,16 @@ struct sk_buff {
375 __u16 tc_verd; /* traffic control verdict */ 375 __u16 tc_verd; /* traffic control verdict */
376#endif 376#endif
377#endif 377#endif
378
379 kmemcheck_bitfield_begin(flags2);
378#ifdef CONFIG_IPV6_NDISC_NODETYPE 380#ifdef CONFIG_IPV6_NDISC_NODETYPE
379 __u8 ndisc_nodetype:2; 381 __u8 ndisc_nodetype:2;
380#endif 382#endif
381#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
382 __u8 do_not_encrypt:1; 384 __u8 do_not_encrypt:1;
383 __u8 requeue:1;
384#endif 385#endif
386 kmemcheck_bitfield_end(flags2);
387
385 /* 0/13/14 bit hole */ 388 /* 0/13/14 bit hole */
386 389
387#ifdef CONFIG_NET_DMA 390#ifdef CONFIG_NET_DMA
@@ -423,6 +426,21 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
423 enum dma_data_direction dir); 426 enum dma_data_direction dir);
424#endif 427#endif
425 428
429static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
430{
431 return (struct dst_entry *)skb->_skb_dst;
432}
433
434static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
435{
436 skb->_skb_dst = (unsigned long)dst;
437}
438
439static inline struct rtable *skb_rtable(const struct sk_buff *skb)
440{
441 return (struct rtable *)skb_dst(skb);
442}
443
426extern void kfree_skb(struct sk_buff *skb); 444extern void kfree_skb(struct sk_buff *skb);
427extern void consume_skb(struct sk_buff *skb); 445extern void consume_skb(struct sk_buff *skb);
428extern void __kfree_skb(struct sk_buff *skb); 446extern void __kfree_skb(struct sk_buff *skb);
@@ -1062,7 +1080,7 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1062 int off, int size); 1080 int off, int size);
1063 1081
1064#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1082#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1065#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 1083#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frags(skb))
1066#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 1084#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
1067 1085
1068#ifdef NET_SKBUFF_DATA_USES_OFFSET 1086#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -1701,6 +1719,25 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1701 skb = skb->prev) 1719 skb = skb->prev)
1702 1720
1703 1721
1722static inline bool skb_has_frags(const struct sk_buff *skb)
1723{
1724 return skb_shinfo(skb)->frag_list != NULL;
1725}
1726
1727static inline void skb_frag_list_init(struct sk_buff *skb)
1728{
1729 skb_shinfo(skb)->frag_list = NULL;
1730}
1731
1732static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
1733{
1734 frag->next = skb_shinfo(skb)->frag_list;
1735 skb_shinfo(skb)->frag_list = frag;
1736}
1737
1738#define skb_walk_frags(skb, iter) \
1739 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
1740
1704extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 1741extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
1705 int *peeked, int *err); 1742 int *peeked, int *err);
1706extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1743extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
@@ -1715,8 +1752,14 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1715 struct iovec *iov); 1752 struct iovec *iov);
1716extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 1753extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1717 int offset, 1754 int offset,
1718 struct iovec *from, 1755 const struct iovec *from,
1756 int from_offset,
1719 int len); 1757 int len);
1758extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1759 int offset,
1760 const struct iovec *to,
1761 int to_offset,
1762 int size);
1720extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1763extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1721extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1764extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1722 unsigned int flags); 1765 unsigned int flags);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 219b8fb4651d..2da8372519f5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -64,6 +64,13 @@
64 64
65#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ 65#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */
66 66
67/* Don't track use of uninitialized memory */
68#ifdef CONFIG_KMEMCHECK
69# define SLAB_NOTRACK 0x01000000UL
70#else
71# define SLAB_NOTRACK 0x00000000UL
72#endif
73
67/* The following flags affect the page allocator grouping pages by mobility */ 74/* The following flags affect the page allocator grouping pages by mobility */
68#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 75#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
69#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 76#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 713f841ecaa9..850d057500de 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -16,6 +16,87 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h> 17#include <linux/kmemtrace.h>
18 18
19/*
20 * struct kmem_cache
21 *
22 * manages a cache.
23 */
24
25struct kmem_cache {
26/* 1) per-cpu data, touched during every alloc/free */
27 struct array_cache *array[NR_CPUS];
28/* 2) Cache tunables. Protected by cache_chain_mutex */
29 unsigned int batchcount;
30 unsigned int limit;
31 unsigned int shared;
32
33 unsigned int buffer_size;
34 u32 reciprocal_buffer_size;
35/* 3) touched by every alloc & free from the backend */
36
37 unsigned int flags; /* constant flags */
38 unsigned int num; /* # of objs per slab */
39
40/* 4) cache_grow/shrink */
41 /* order of pgs per slab (2^n) */
42 unsigned int gfporder;
43
44 /* force GFP flags, e.g. GFP_DMA */
45 gfp_t gfpflags;
46
47 size_t colour; /* cache colouring range */
48 unsigned int colour_off; /* colour offset */
49 struct kmem_cache *slabp_cache;
50 unsigned int slab_size;
51 unsigned int dflags; /* dynamic flags */
52
53 /* constructor func */
54 void (*ctor)(void *obj);
55
56/* 5) cache creation/removal */
57 const char *name;
58 struct list_head next;
59
60/* 6) statistics */
61#ifdef CONFIG_DEBUG_SLAB
62 unsigned long num_active;
63 unsigned long num_allocations;
64 unsigned long high_mark;
65 unsigned long grown;
66 unsigned long reaped;
67 unsigned long errors;
68 unsigned long max_freeable;
69 unsigned long node_allocs;
70 unsigned long node_frees;
71 unsigned long node_overflow;
72 atomic_t allochit;
73 atomic_t allocmiss;
74 atomic_t freehit;
75 atomic_t freemiss;
76
77 /*
78 * If debugging is enabled, then the allocator can add additional
79 * fields and/or padding to every object. buffer_size contains the total
80 * object size including these internal fields, the following two
81 * variables contain the offset to the user object and its size.
82 */
83 int obj_offset;
84 int obj_size;
85#endif /* CONFIG_DEBUG_SLAB */
86
87 /*
88 * We put nodelists[] at the end of kmem_cache, because we want to size
89 * this array to nr_node_ids slots instead of MAX_NUMNODES
90 * (see kmem_cache_init())
91 * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache
92 * is statically defined, so we reserve the max number of nodes.
93 */
94 struct kmem_list3 *nodelists[MAX_NUMNODES];
95 /*
96 * Do not add fields after nodelists[]
97 */
98};
99
19/* Size description struct for general caches. */ 100/* Size description struct for general caches. */
20struct cache_sizes { 101struct cache_sizes {
21 size_t cs_size; 102 size_t cs_size;
diff --git a/include/linux/smp.h b/include/linux/smp.h
index a69db820eed6..9e3d8af09207 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -177,7 +177,6 @@ static inline void init_call_single_data(void)
177 177
178#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) 178#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
179#define put_cpu() preempt_enable() 179#define put_cpu() preempt_enable()
180#define put_cpu_no_resched() preempt_enable_no_resched()
181 180
182/* 181/*
183 * Callback to arch code if there's nosmp or maxcpus=0 on the 182 * Callback to arch code if there's nosmp or maxcpus=0 on the
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index b32725075d71..5241e4fb4eca 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -47,4 +47,14 @@ struct smsc911x_platform_config {
47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) 47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3))
48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) 48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4))
49 49
50/*
51 * SMSC911X_SWAP_FIFO:
52 * Enables software byte swap for fifo data. Should only be used as a
53 * "last resort" in the case of big endian mode on boards with incorrectly
54 * routed data bus to older devices such as LAN9118. Newer devices such as
55 * LAN9221 can handle this in hardware, there are registers to control
56 * this swapping but the driver doesn't currently use them.
57 */
58#define SMSC911X_SWAP_FIFO (BIT(5))
59
50#endif /* __LINUX_SMSC911X_H__ */ 60#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index aee3f1e1d1ce..0f953fe40413 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,7 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21 IPSTATS_MIB_INRECEIVES, /* InReceives */ 21 IPSTATS_MIB_INPKTS, /* InReceives */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -28,7 +28,7 @@ enum
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 28 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */ 29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ 30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTREQUESTS, /* OutRequests */ 31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,6 +42,12 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
50 IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */
45 __IPSTATS_MIB_MAX 51 __IPSTATS_MIB_MAX
46}; 52};
47 53
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 421afb4d29b0..3b461dffe244 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -194,7 +194,8 @@ struct ucred {
194#define AF_RXRPC 33 /* RxRPC sockets */ 194#define AF_RXRPC 33 /* RxRPC sockets */
195#define AF_ISDN 34 /* mISDN sockets */ 195#define AF_ISDN 34 /* mISDN sockets */
196#define AF_PHONET 35 /* Phonet sockets */ 196#define AF_PHONET 35 /* Phonet sockets */
197#define AF_MAX 36 /* For now.. */ 197#define AF_IEEE802154 36 /* IEEE802154 sockets */
198#define AF_MAX 37 /* For now.. */
198 199
199/* Protocol families, same as address families. */ 200/* Protocol families, same as address families. */
200#define PF_UNSPEC AF_UNSPEC 201#define PF_UNSPEC AF_UNSPEC
@@ -233,6 +234,7 @@ struct ucred {
233#define PF_RXRPC AF_RXRPC 234#define PF_RXRPC AF_RXRPC
234#define PF_ISDN AF_ISDN 235#define PF_ISDN AF_ISDN
235#define PF_PHONET AF_PHONET 236#define PF_PHONET AF_PHONET
237#define PF_IEEE802154 AF_IEEE802154
236#define PF_MAX AF_MAX 238#define PF_MAX AF_MAX
237 239
238/* Maximum queue length specifiable by listen. */ 240/* Maximum queue length specifiable by listen. */
@@ -303,14 +305,15 @@ struct ucred {
303#define SOL_BLUETOOTH 274 305#define SOL_BLUETOOTH 274
304#define SOL_PNPIPE 275 306#define SOL_PNPIPE 275
305#define SOL_RDS 276 307#define SOL_RDS 276
308#define SOL_IUCV 277
306 309
307/* IPX options */ 310/* IPX options */
308#define IPX_TYPE 1 311#define IPX_TYPE 1
309 312
310#ifdef __KERNEL__ 313#ifdef __KERNEL__
311extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 314extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
312extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, 315extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
313 int offset, int len); 316 int offset, int len);
314extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 317extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
315 struct iovec *iov, 318 struct iovec *iov,
316 int offset, 319 int offset,
@@ -318,6 +321,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
318 321
319extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 322extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode);
320extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 323extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
324extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
325 int offset, int len);
321extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen); 326extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen);
322extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); 327extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr);
323extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 328extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
diff --git a/include/linux/spi/libertas_spi.h b/include/linux/spi/libertas_spi.h
index 79506f5f9e67..1b5d5384fcd3 100644
--- a/include/linux/spi/libertas_spi.h
+++ b/include/linux/spi/libertas_spi.h
@@ -22,9 +22,6 @@ struct libertas_spi_platform_data {
22 * speed, you may want to use 0 here. */ 22 * speed, you may want to use 0 here. */
23 u16 use_dummy_writes; 23 u16 use_dummy_writes;
24 24
25 /* GPIO number to use as chip select */
26 u16 gpio_cs;
27
28 /* Board specific setup/teardown */ 25 /* Board specific setup/teardown */
29 int (*setup)(struct spi_device *spi); 26 int (*setup)(struct spi_device *spi);
30 int (*teardown)(struct spi_device *spi); 27 int (*teardown)(struct spi_device *spi);
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
new file mode 100644
index 000000000000..11430cab2aad
--- /dev/null
+++ b/include/linux/spi/wl12xx.h
@@ -0,0 +1,31 @@
1/*
2 * This file is part of wl12xx
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
6 * Contact: Kalle Valo <kalle.valo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef _LINUX_SPI_WL12XX_H
25#define _LINUX_SPI_WL12XX_H
26
27struct wl12xx_platform_data {
28 void (*set_power)(bool enable);
29};
30
31#endif
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 1a8cecc4f38c..51efbef38fb0 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -4,6 +4,8 @@
4struct task_struct; 4struct task_struct;
5 5
6#ifdef CONFIG_STACKTRACE 6#ifdef CONFIG_STACKTRACE
7struct task_struct;
8
7struct stack_trace { 9struct stack_trace {
8 unsigned int nr_entries, max_entries; 10 unsigned int nr_entries, max_entries;
9 unsigned long *entries; 11 unsigned long *entries;
@@ -11,6 +13,7 @@ struct stack_trace {
11}; 13};
12 14
13extern void save_stack_trace(struct stack_trace *trace); 15extern void save_stack_trace(struct stack_trace *trace);
16extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp);
14extern void save_stack_trace_tsk(struct task_struct *tsk, 17extern void save_stack_trace_tsk(struct task_struct *tsk,
15 struct stack_trace *trace); 18 struct stack_trace *trace);
16 19
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d476aad3ff57..0cedf31af0b0 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -129,9 +129,10 @@ enum {
129 129
130#define SWAP_CLUSTER_MAX 32 130#define SWAP_CLUSTER_MAX 32
131 131
132#define SWAP_MAP_MAX 0x7fff 132#define SWAP_MAP_MAX 0x7ffe
133#define SWAP_MAP_BAD 0x8000 133#define SWAP_MAP_BAD 0x7fff
134 134#define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */
135#define SWAP_COUNT_MASK (~SWAP_HAS_CACHE)
135/* 136/*
136 * The in-memory structure used to track swap areas. 137 * The in-memory structure used to track swap areas.
137 */ 138 */
@@ -235,7 +236,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
235} 236}
236#endif 237#endif
237 238
238#ifdef CONFIG_UNEVICTABLE_LRU
239extern int page_evictable(struct page *page, struct vm_area_struct *vma); 239extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 240extern void scan_mapping_unevictable_pages(struct address_space *);
241 241
@@ -244,24 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
244 void __user *, size_t *, loff_t *); 244 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 245extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 246extern void scan_unevictable_unregister_node(struct node *node);
247#else
248static inline int page_evictable(struct page *page,
249 struct vm_area_struct *vma)
250{
251 return 1;
252}
253
254static inline void scan_mapping_unevictable_pages(struct address_space *mapping)
255{
256}
257
258static inline int scan_unevictable_register_node(struct node *node)
259{
260 return 0;
261}
262
263static inline void scan_unevictable_unregister_node(struct node *node) { }
264#endif
265 247
266extern int kswapd_run(int nid); 248extern int kswapd_run(int nid);
267 249
@@ -274,7 +256,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
274 256
275#ifdef CONFIG_SWAP 257#ifdef CONFIG_SWAP
276/* linux/mm/page_io.c */ 258/* linux/mm/page_io.c */
277extern int swap_readpage(struct file *, struct page *); 259extern int swap_readpage(struct page *);
278extern int swap_writepage(struct page *page, struct writeback_control *wbc); 260extern int swap_writepage(struct page *page, struct writeback_control *wbc);
279extern void end_swap_bio_read(struct bio *bio, int err); 261extern void end_swap_bio_read(struct bio *bio, int err);
280 262
@@ -300,9 +282,11 @@ extern long total_swap_pages;
300extern void si_swapinfo(struct sysinfo *); 282extern void si_swapinfo(struct sysinfo *);
301extern swp_entry_t get_swap_page(void); 283extern swp_entry_t get_swap_page(void);
302extern swp_entry_t get_swap_page_of_type(int); 284extern swp_entry_t get_swap_page_of_type(int);
303extern int swap_duplicate(swp_entry_t); 285extern void swap_duplicate(swp_entry_t);
286extern int swapcache_prepare(swp_entry_t);
304extern int valid_swaphandles(swp_entry_t, unsigned long *); 287extern int valid_swaphandles(swp_entry_t, unsigned long *);
305extern void swap_free(swp_entry_t); 288extern void swap_free(swp_entry_t);
289extern void swapcache_free(swp_entry_t, struct page *page);
306extern int free_swap_and_cache(swp_entry_t); 290extern int free_swap_and_cache(swp_entry_t);
307extern int swap_type_of(dev_t, sector_t, struct block_device **); 291extern int swap_type_of(dev_t, sector_t, struct block_device **);
308extern unsigned int count_swap_pages(int, int); 292extern unsigned int count_swap_pages(int, int);
@@ -370,12 +354,20 @@ static inline void show_swap_cache_info(void)
370} 354}
371 355
372#define free_swap_and_cache(swp) is_migration_entry(swp) 356#define free_swap_and_cache(swp) is_migration_entry(swp)
373#define swap_duplicate(swp) is_migration_entry(swp) 357#define swapcache_prepare(swp) is_migration_entry(swp)
358
359static inline void swap_duplicate(swp_entry_t swp)
360{
361}
374 362
375static inline void swap_free(swp_entry_t swp) 363static inline void swap_free(swp_entry_t swp)
376{ 364{
377} 365}
378 366
367static inline void swapcache_free(swp_entry_t swp, struct page *page)
368{
369}
370
379static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, 371static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
380 struct vm_area_struct *vma, unsigned long addr) 372 struct vm_area_struct *vma, unsigned long addr)
381{ 373{
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 418d90f5effe..fa4242cdade8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -434,6 +434,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
434asmlinkage long sys_fcntl64(unsigned int fd, 434asmlinkage long sys_fcntl64(unsigned int fd,
435 unsigned int cmd, unsigned long arg); 435 unsigned int cmd, unsigned long arg);
436#endif 436#endif
437asmlinkage long sys_pipe(int __user *fildes);
437asmlinkage long sys_pipe2(int __user *fildes, int flags); 438asmlinkage long sys_pipe2(int __user *fildes, int flags);
438asmlinkage long sys_dup(unsigned int fildes); 439asmlinkage long sys_dup(unsigned int fildes);
439asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); 440asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
@@ -751,8 +752,6 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
751asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 752asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
752 struct timespec __user *, const sigset_t __user *, 753 struct timespec __user *, const sigset_t __user *,
753 size_t); 754 size_t);
754asmlinkage long sys_pipe2(int __user *, int);
755asmlinkage long sys_pipe(int __user *);
756 755
757int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 756int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
758 757
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 9d5078bd23a3..8afac76cd748 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -377,7 +377,7 @@ struct tcp_sock {
377 unsigned int keepalive_time; /* time before keep alive takes place */ 377 unsigned int keepalive_time; /* time before keep alive takes place */
378 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 378 unsigned int keepalive_intvl; /* time interval between keep alive probes */
379 379
380 unsigned long last_synq_overflow; 380 int linger2;
381 381
382/* Receiver side RTT estimation */ 382/* Receiver side RTT estimation */
383 struct { 383 struct {
@@ -406,8 +406,6 @@ struct tcp_sock {
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signagure Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409
410 int linger2;
411}; 409};
412 410
413static inline struct tcp_sock *tcp_sk(const struct sock *sk) 411static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 469b82d88b3b..0482229c07db 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -97,10 +97,12 @@ extern void tick_clock_notify(void);
97extern int tick_check_oneshot_change(int allow_nohz); 97extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 98extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu); 99extern void tick_check_idle(int cpu);
100extern int tick_oneshot_mode_active(void);
100# else 101# else
101static inline void tick_clock_notify(void) { } 102static inline void tick_clock_notify(void) { }
102static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 103static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
103static inline void tick_check_idle(int cpu) { } 104static inline void tick_check_idle(int cpu) { }
105static inline int tick_oneshot_mode_active(void) { return 0; }
104# endif 106# endif
105 107
106#else /* CONFIG_GENERIC_CLOCKEVENTS */ 108#else /* CONFIG_GENERIC_CLOCKEVENTS */
@@ -109,6 +111,7 @@ static inline void tick_cancel_sched_timer(int cpu) { }
109static inline void tick_clock_notify(void) { } 111static inline void tick_clock_notify(void) { }
110static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 112static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
111static inline void tick_check_idle(int cpu) { } 113static inline void tick_check_idle(int cpu) { }
114static inline int tick_oneshot_mode_active(void) { return 0; }
112#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 115#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
113 116
114# ifdef CONFIG_NO_HZ 117# ifdef CONFIG_NO_HZ
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6cdb6f3331f1..ccf882eed8f8 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -163,7 +163,10 @@ extern void add_timer_on(struct timer_list *timer, int cpu);
163extern int del_timer(struct timer_list * timer); 163extern int del_timer(struct timer_list * timer);
164extern int mod_timer(struct timer_list *timer, unsigned long expires); 164extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
166 167
168#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1
167/* 170/*
168 * The jiffies value which is added to now, when there is no timer 171 * The jiffies value which is added to now, when there is no timer
169 * in the timer wheel: 172 * in the timer wheel:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475fcff64..e6967d10d9e5 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -170,17 +170,37 @@ struct timex {
170#include <asm/timex.h> 170#include <asm/timex.h>
171 171
172/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 173 * SHIFT_PLL is used as a dampening factor to define how much we
174 * for a slightly underdamped convergence characteristic. SHIFT_KH 174 * adjust the frequency correction for a given offset in PLL mode.
175 * establishes the damping of the FLL and is chosen by wisdom and black 175 * It also used in dampening the offset correction, to define how
176 * art. 176 * much of the current value in time_offset we correct for each
177 * second. Changing this value changes the stiffness of the ntp
178 * adjustment code. A lower value makes it more flexible, reducing
179 * NTP convergence time. A higher value makes it stiffer, increasing
180 * convergence time, but making the clock more stable.
177 * 181 *
178 * MAXTC establishes the maximum time constant of the PLL. With the 182 * In David Mills' nanokernel reference implementation SHIFT_PLL is 4.
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from 183 * However this seems to increase convergence time much too long.
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, 184 *
181 * respectively. 185 * https://lists.ntp.org/pipermail/hackers/2008-January/003487.html
186 *
187 * In the above mailing list discussion, it seems the value of 4
188 * was appropriate for other Unix systems with HZ=100, and that
189 * SHIFT_PLL should be decreased as HZ increases. However, Linux's
190 * clock steering implementation is HZ independent.
191 *
192 * Through experimentation, a SHIFT_PLL value of 2 was found to allow
193 * for fast convergence (very similar to the NTPv3 code used prior to
194 * v2.6.19), with good clock stability.
195 *
196 *
197 * SHIFT_FLL is used as a dampening factor to define how much we
198 * adjust the frequency correction for a given offset in FLL mode.
199 * In David Mills' nanokernel reference implementation SHIFT_FLL is 2.
200 *
201 * MAXTC establishes the maximum time constant of the PLL.
182 */ 202 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */ 203#define SHIFT_PLL 2 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */ 204#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */ 205#define MAXTC 10 /* maximum time constant (shift) */
186 206
@@ -192,10 +212,10 @@ struct timex {
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 212#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 213#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 214#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 215#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 216 PPM_SCALE + 1)
197 217
198#define MAXPHASE 500000000l /* max phase error (ns) */ 218#define MAXPHASE 500000000L /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */ 219#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) 220#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */ 221#define MINSEC 256 /* min interval between updates (s) */
@@ -260,6 +280,9 @@ extern int do_adjtimex(struct timex *);
260 280
261int read_current_timer(unsigned long *timer_val); 281int read_current_timer(unsigned long *timer_val);
262 282
283/* The clock frequency of the i8253/i8254 PIT */
284#define PIT_TICK_RATE 1193182ul
285
263#endif /* KERNEL */ 286#endif /* KERNEL */
264 287
265#endif /* LINUX_TIMEX_H */ 288#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 14df7e635d43..b9dc4ca0246f 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -198,7 +198,7 @@ static inline void tracepoint_synchronize_unregister(void)
198 * * This is how the trace record is structured and will 198 * * This is how the trace record is structured and will
199 * * be saved into the ring buffer. These are the fields 199 * * be saved into the ring buffer. These are the fields
200 * * that will be exposed to user-space in 200 * * that will be exposed to user-space in
201 * * /debug/tracing/events/<*>/format. 201 * * /sys/kernel/debug/tracing/events/<*>/format.
202 * * 202 * *
203 * * The declared 'local variable' is called '__entry' 203 * * The declared 'local variable' is called '__entry'
204 * * 204 * *
@@ -258,7 +258,7 @@ static inline void tracepoint_synchronize_unregister(void)
258 * tracepoint callback (this is used by programmatic plugins and 258 * tracepoint callback (this is used by programmatic plugins and
259 * can also by used by generic instrumentation like SystemTap), and 259 * can also by used by generic instrumentation like SystemTap), and
260 * it is also used to expose a structured trace record in 260 * it is also used to expose a structured trace record in
261 * /debug/tracing/events/. 261 * /sys/kernel/debug/tracing/events/.
262 */ 262 */
263 263
264#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 264#define TRACE_EVENT(name, proto, args, struct, assign, print) \
diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h
index 6b7703e75cec..71339dc531c5 100644
--- a/include/linux/ultrasound.h
+++ b/include/linux/ultrasound.h
@@ -34,7 +34,7 @@
34 * _GUS_VOICEOFF - Stops voice (no parameters) 34 * _GUS_VOICEOFF - Stops voice (no parameters)
35 * _GUS_VOICEFADE - Stops the voice smoothly. 35 * _GUS_VOICEFADE - Stops the voice smoothly.
36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) 36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
37 * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) 37 * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) 38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1f8d08..84929e914034 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -36,6 +36,7 @@ struct wusb_dev;
36 * - configs have one (often) or more interfaces; 36 * - configs have one (often) or more interfaces;
37 * - interfaces have one (usually) or more settings; 37 * - interfaces have one (usually) or more settings;
38 * - each interface setting has zero or (usually) more endpoints. 38 * - each interface setting has zero or (usually) more endpoints.
39 * - a SuperSpeed endpoint has a companion descriptor
39 * 40 *
40 * And there might be other descriptors mixed in with those. 41 * And there might be other descriptors mixed in with those.
41 * 42 *
@@ -44,6 +45,19 @@ struct wusb_dev;
44 45
45struct ep_device; 46struct ep_device;
46 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
47/** 61/**
48 * struct usb_host_endpoint - host-side endpoint descriptor and queue 62 * struct usb_host_endpoint - host-side endpoint descriptor and queue
49 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
@@ -51,6 +65,7 @@ struct ep_device;
51 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
52 * with one or more transfer descriptors (TDs) per urb 66 * with one or more transfer descriptors (TDs) per urb
53 * @ep_dev: ep_device for sysfs info 67 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
54 * @extra: descriptors following this endpoint in the configuration 69 * @extra: descriptors following this endpoint in the configuration
55 * @extralen: how many bytes of "extra" are valid 70 * @extralen: how many bytes of "extra" are valid
56 * @enabled: URBs may be submitted to this endpoint 71 * @enabled: URBs may be submitted to this endpoint
@@ -63,6 +78,7 @@ struct usb_host_endpoint {
63 struct list_head urb_list; 78 struct list_head urb_list;
64 void *hcpriv; 79 void *hcpriv;
65 struct ep_device *ep_dev; /* For sysfs info */ 80 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
66 82
67 unsigned char *extra; /* Extra descriptors */ 83 unsigned char *extra; /* Extra descriptors */
68 int extralen; 84 int extralen;
@@ -336,7 +352,6 @@ struct usb_bus {
336#ifdef CONFIG_USB_DEVICEFS 352#ifdef CONFIG_USB_DEVICEFS
337 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 353 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
338#endif 354#endif
339 struct device *dev; /* device for this bus */
340 355
341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 356#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
342 struct mon_bus *mon_bus; /* non-null when associated */ 357 struct mon_bus *mon_bus; /* non-null when associated */
@@ -363,6 +378,7 @@ struct usb_tt;
363 * struct usb_device - kernel's representation of a USB device 378 * struct usb_device - kernel's representation of a USB device
364 * @devnum: device number; address on a USB bus 379 * @devnum: device number; address on a USB bus
365 * @devpath: device ID string for use in messages (e.g., /port/...) 380 * @devpath: device ID string for use in messages (e.g., /port/...)
381 * @route: tree topology hex string for use with xHCI
366 * @state: device state: configured, not attached, etc. 382 * @state: device state: configured, not attached, etc.
367 * @speed: device speed: high/full/low (or error) 383 * @speed: device speed: high/full/low (or error)
368 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub 384 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
@@ -420,6 +436,7 @@ struct usb_tt;
420 * @skip_sys_resume: skip the next system resume 436 * @skip_sys_resume: skip the next system resume
421 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 437 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
422 * specific data for the device. 438 * specific data for the device.
439 * @slot_id: Slot ID assigned by xHCI
423 * 440 *
424 * Notes: 441 * Notes:
425 * Usbcore drivers should not set usbdev->state directly. Instead use 442 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -428,6 +445,7 @@ struct usb_tt;
428struct usb_device { 445struct usb_device {
429 int devnum; 446 int devnum;
430 char devpath [16]; 447 char devpath [16];
448 u32 route;
431 enum usb_device_state state; 449 enum usb_device_state state;
432 enum usb_device_speed speed; 450 enum usb_device_speed speed;
433 451
@@ -503,6 +521,7 @@ struct usb_device {
503 unsigned skip_sys_resume:1; 521 unsigned skip_sys_resume:1;
504#endif 522#endif
505 struct wusb_dev *wusb_dev; 523 struct wusb_dev *wusb_dev;
524 int slot_id;
506}; 525};
507#define to_usb_device(d) container_of(d, struct usb_device, dev) 526#define to_usb_device(d) container_of(d, struct usb_device, dev)
508 527
@@ -869,6 +888,8 @@ struct usb_driver {
869 * struct usb_device_driver - identifies USB device driver to usbcore 888 * struct usb_device_driver - identifies USB device driver to usbcore
870 * @name: The driver name should be unique among USB drivers, 889 * @name: The driver name should be unique among USB drivers,
871 * and should normally be the same as the module name. 890 * and should normally be the same as the module name.
891 * @nodename: Callback to provide a naming hint for a possible
892 * device node to create.
872 * @probe: Called to see if the driver is willing to manage a particular 893 * @probe: Called to see if the driver is willing to manage a particular
873 * device. If it is, probe returns zero and uses dev_set_drvdata() 894 * device. If it is, probe returns zero and uses dev_set_drvdata()
874 * to associate driver-specific data with the device. If unwilling 895 * to associate driver-specific data with the device. If unwilling
@@ -912,6 +933,7 @@ extern struct bus_type usb_bus_type;
912 */ 933 */
913struct usb_class_driver { 934struct usb_class_driver {
914 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev);
915 const struct file_operations *fops; 937 const struct file_operations *fops;
916 int minor_base; 938 int minor_base;
917}; 939};
@@ -1041,7 +1063,9 @@ typedef void (*usb_complete_t)(struct urb *);
1041 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1063 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the
1042 * device driver has provided this DMA address for the setup packet. 1064 * device driver has provided this DMA address for the setup packet.
1043 * The host controller driver should use this in preference to 1065 * The host controller driver should use this in preference to
1044 * setup_packet. 1066 * setup_packet, but the HCD may chose to ignore the address if it must
1067 * copy the setup packet into internal structures. Therefore, setup_packet
1068 * must always point to a valid buffer.
1045 * @start_frame: Returns the initial frame for isochronous transfers. 1069 * @start_frame: Returns the initial frame for isochronous transfers.
1046 * @number_of_packets: Lists the number of ISO transfer buffers. 1070 * @number_of_packets: Lists the number of ISO transfer buffers.
1047 * @interval: Specifies the polling interval for interrupt or isochronous 1071 * @interval: Specifies the polling interval for interrupt or isochronous
@@ -1177,6 +1201,8 @@ struct urb {
1177 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1201 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1178 void *transfer_buffer; /* (in) associated data buffer */ 1202 void *transfer_buffer; /* (in) associated data buffer */
1179 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1203 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1204 struct usb_sg_request *sg; /* (in) scatter gather buffer list */
1205 int num_sgs; /* (in) number of entries in the sg list */
1180 u32 transfer_buffer_length; /* (in) data buffer length */ 1206 u32 transfer_buffer_length; /* (in) data buffer length */
1181 u32 actual_length; /* (return) actual transfer length */ 1207 u32 actual_length; /* (return) actual transfer length */
1182 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1208 unsigned char *setup_packet; /* (in) setup packet (control only) */
@@ -1422,8 +1448,8 @@ struct usb_sg_request {
1422 int status; 1448 int status;
1423 size_t bytes; 1449 size_t bytes;
1424 1450
1425 /* 1451 /* private:
1426 * members below are private: to usbcore, 1452 * members below are private to usbcore,
1427 * and are not provided for driver access! 1453 * and are not provided for driver access!
1428 */ 1454 */
1429 spinlock_t lock; 1455 spinlock_t lock;
@@ -1558,6 +1584,9 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1558#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1584#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1559 format "\n" , ## arg) 1585 format "\n" , ## arg)
1560 1586
1587/* debugfs stuff */
1588extern struct dentry *usb_debug_root;
1589
1561#endif /* __KERNEL__ */ 1590#endif /* __KERNEL__ */
1562 1591
1563#endif 1592#endif
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 8cb025fef634..b5744bc218ab 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,10 +24,75 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff
27 28
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/
30#define HEADER 0x01
31#define INPUT_TERMINAL 0x02
32#define OUTPUT_TERMINAL 0x03
33#define MIXER_UNIT 0x04
34#define SELECTOR_UNIT 0x05
35#define FEATURE_UNIT 0x06
36#define PROCESSING_UNIT 0x07
37#define EXTENSION_UNIT 0x08
38
39#define AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03
42
43#define EP_GENERAL 0x01
44
45#define MS_GENERAL 0x01
46#define MIDI_IN_JACK 0x02
47#define MIDI_OUT_JACK 0x03
48
49/* endpoint attributes */
50#define EP_ATTR_MASK 0x0c
51#define EP_ATTR_ASYNC 0x04
52#define EP_ATTR_ADAPTIVE 0x08
53#define EP_ATTR_SYNC 0x0c
54
55/* cs endpoint attributes */
56#define EP_CS_ATTR_SAMPLE_RATE 0x01
57#define EP_CS_ATTR_PITCH_CONTROL 0x02
58#define EP_CS_ATTR_FILL_MAX 0x80
59
60/* Audio Class specific Request Codes */
61#define USB_AUDIO_SET_INTF 0x21
62#define USB_AUDIO_SET_ENDPOINT 0x22
63#define USB_AUDIO_GET_INTF 0xa1
64#define USB_AUDIO_GET_ENDPOINT 0xa2
65
66#define SET_ 0x00
67#define GET_ 0x80
68
69#define _CUR 0x1
70#define _MIN 0x2
71#define _MAX 0x3
72#define _RES 0x4
73#define _MEM 0x5
74
75#define SET_CUR (SET_ | _CUR)
76#define GET_CUR (GET_ | _CUR)
77#define SET_MIN (SET_ | _MIN)
78#define GET_MIN (GET_ | _MIN)
79#define SET_MAX (SET_ | _MAX)
80#define GET_MAX (GET_ | _MAX)
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91
92/* Terminal Control Selectors */
28/* 4.3.2 Class-Specific AC Interface Descriptor */ 93/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor { 94struct usb_ac_header_descriptor {
30 __u8 bLength; /* 8+n */ 95 __u8 bLength; /* 8 + n */
31 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
32 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */
33 __le16 bcdADC; /* 0x0100 */ 98 __le16 bcdADC; /* 0x0100 */
@@ -36,7 +101,7 @@ struct usb_ac_header_descriptor {
36 __u8 baInterfaceNr[]; /* [n] */ 101 __u8 baInterfaceNr[]; /* [n] */
37} __attribute__ ((packed)); 102} __attribute__ ((packed));
38 103
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) 104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n))
40 105
41/* As above, but more useful for defining your own descriptors: */ 106/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
@@ -50,4 +115,200 @@ struct usb_ac_header_descriptor_##n { \
50 __u8 baInterfaceNr[n]; \ 115 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed)) 116} __attribute__ ((packed))
52 117
118/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
123 __u8 bTerminalID; /* Constant uniquely terminal ID */
124 __le16 wTerminalType; /* USB Audio Terminal Types */
125 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
126 __u8 bNrChannels; /* Number of logical output channels */
127 __le16 wChannelConfig;
128 __u8 iChannelNames;
129 __u8 iTerminal;
130} __attribute__ ((packed));
131
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12
133
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141
142/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
147 __u8 bTerminalID; /* Constant uniquely terminal ID */
148 __le16 wTerminalType; /* USB Audio Terminal Types */
149 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
150 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
151 __u8 iTerminal;
152} __attribute__ ((packed));
153
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9
155
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164
165/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167
168/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \
172 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \
174 __u8 bUnitID; \
175 __u8 bSourceID; \
176 __u8 bControlSize; \
177 __le16 bmaControls[ch + 1]; \
178 __u8 iFeature; \
179} __attribute__ ((packed))
180
181/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */
186 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
187 __u8 bDelay; /* Delay introduced by the data path */
188 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed));
190
191#define USB_DT_AS_HEADER_SIZE 7
192
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5
199
200struct usb_as_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
204 __u8 bFormatType; /* FORMAT_TYPE_1 */
205 __u8 bNrChannels; /* physical channels in the stream */
206 __u8 bSubframeSize; /* */
207 __u8 bBitResolution;
208 __u8 bSamFreqType;
209 __u8 tLowerSamFreq[3];
210 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed));
212
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214
215struct usb_as_formate_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
219 __u8 bFormatType; /* FORMAT_TYPE_1 */
220 __u8 bNrChannels; /* physical channels in the stream */
221 __u8 bSubframeSize; /* */
222 __u8 bBitResolution;
223 __u8 bSamFreqType;
224 __u8 tSamFreq[][3];
225} __attribute__ ((packed));
226
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \
230 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \
232 __u8 bFormatType; \
233 __u8 bNrChannels; \
234 __u8 bSubframeSize; \
235 __u8 bBitResolution; \
236 __u8 bSamFreqType; \
237 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed))
239
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246
247#define USB_AS_ENDPOINT_ASYNC (1 << 2)
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2)
249#define USB_AS_ENDPOINT_SYNC (3 << 2)
250
251struct usb_as_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */
255 __u8 bmAttributes;
256 __u8 bLockDelayUnits;
257 __le16 wLockDelay;
258};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7
260
261#define FU_CONTROL_UNDEFINED 0x00
262#define MUTE_CONTROL 0x01
263#define VOLUME_CONTROL 0x02
264#define BASS_CONTROL 0x03
265#define MID_CONTROL 0x04
266#define TREBLE_CONTROL 0x05
267#define GRAPHIC_EQUALIZER_CONTROL 0x06
268#define AUTOMATIC_GAIN_CONTROL 0x07
269#define DELAY_CONTROL 0x08
270#define BASS_BOOST_CONTROL 0x09
271#define LOUDNESS_CONTROL 0x0a
272
273#define FU_MUTE (1 << (MUTE_CONTROL - 1))
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1))
275#define FU_BASS (1 << (BASS_CONTROL - 1))
276#define FU_MID (1 << (MID_CONTROL - 1))
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1))
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1))
283
284struct usb_audio_control {
285 struct list_head list;
286 const char *name;
287 u8 type;
288 int data[5];
289 int (*set)(struct usb_audio_control *con, u8 cmd, int value);
290 int (*get)(struct usb_audio_control *con, u8 cmd);
291};
292
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector {
306 struct list_head list;
307 struct list_head control;
308 u8 id;
309 const char *name;
310 u8 type;
311 struct usb_descriptor_header *desc;
312};
313
53#endif /* __LINUX_USB_AUDIO_H */ 314#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index b145119a90da..93223638f702 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30
194 196
195/* Conventional codes for class-specific descriptors. The convention is 197/* Conventional codes for class-specific descriptors. The convention is
196 * defined in the USB "Common Class" Spec (3.11). Individual class specs 198 * defined in the USB "Common Class" Spec (3.11). Individual class specs
@@ -535,6 +537,20 @@ static inline int usb_endpoint_is_isoc_out(
535 537
536/*-------------------------------------------------------------------------*/ 538/*-------------------------------------------------------------------------*/
537 539
540/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
541struct usb_ss_ep_comp_descriptor {
542 __u8 bLength;
543 __u8 bDescriptorType;
544
545 __u8 bMaxBurst;
546 __u8 bmAttributes;
547 __u16 wBytesPerInterval;
548} __attribute__ ((packed));
549
550#define USB_DT_SS_EP_COMP_SIZE 6
551
552/*-------------------------------------------------------------------------*/
553
538/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ 554/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
539struct usb_qualifier_descriptor { 555struct usb_qualifier_descriptor {
540 __u8 bLength; 556 __u8 bLength;
@@ -752,6 +768,7 @@ enum usb_device_speed {
752 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 768 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
753 USB_SPEED_HIGH, /* usb 2.0 */ 769 USB_SPEED_HIGH, /* usb 2.0 */
754 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ 770 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
771 USB_SPEED_SUPER, /* usb 3.0 */
755}; 772};
756 773
757enum usb_device_state { 774enum usb_device_state {
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index acd7b0f06c8a..4f6bb3d2160e 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -124,6 +124,7 @@ struct usb_function {
124 void (*suspend)(struct usb_function *); 124 void (*suspend)(struct usb_function *);
125 void (*resume)(struct usb_function *); 125 void (*resume)(struct usb_function *);
126 126
127 /* private: */
127 /* internals */ 128 /* internals */
128 struct list_head list; 129 struct list_head list;
129}; 130};
@@ -219,6 +220,7 @@ struct usb_configuration {
219 220
220 struct usb_composite_dev *cdev; 221 struct usb_composite_dev *cdev;
221 222
223 /* private: */
222 /* internals */ 224 /* internals */
223 struct list_head list; 225 struct list_head list;
224 struct list_head functions; 226 struct list_head functions;
@@ -321,6 +323,7 @@ struct usb_composite_dev {
321 323
322 struct usb_configuration *config; 324 struct usb_configuration *config;
323 325
326 /* private: */
324 /* internals */ 327 /* internals */
325 struct usb_device_descriptor desc; 328 struct usb_device_descriptor desc;
326 struct list_head configs; 329 struct list_head configs;
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
new file mode 100644
index 000000000000..e115ae6df1da
--- /dev/null
+++ b/include/linux/usb/langwell_otg.h
@@ -0,0 +1,177 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H__
21#define __LANGWELL_OTG_H__
22
23/* notify transceiver driver about OTG events */
24extern void langwell_update_transceiver(void);
25/* HCD register bus driver */
26extern int langwell_register_host(struct pci_driver *host_driver);
27/* HCD unregister bus driver */
28extern void langwell_unregister_host(struct pci_driver *host_driver);
29/* DCD register bus driver */
30extern int langwell_register_peripheral(struct pci_driver *client_driver);
31/* DCD unregister bus driver */
32extern void langwell_unregister_peripheral(struct pci_driver *client_driver);
33/* No silent failure, output warning message */
34extern void langwell_otg_nsf_msg(unsigned long message);
35
36#define CI_USBCMD 0x30
37# define USBCMD_RST BIT(1)
38# define USBCMD_RS BIT(0)
39#define CI_USBSTS 0x34
40# define USBSTS_SLI BIT(8)
41# define USBSTS_URI BIT(6)
42# define USBSTS_PCI BIT(2)
43#define CI_PORTSC1 0x74
44# define PORTSC_PP BIT(12)
45# define PORTSC_LS (BIT(11) | BIT(10))
46# define PORTSC_SUSP BIT(7)
47# define PORTSC_CCS BIT(0)
48#define CI_HOSTPC1 0xb4
49# define HOSTPC1_PHCD BIT(22)
50#define CI_OTGSC 0xf4
51# define OTGSC_DPIE BIT(30)
52# define OTGSC_1MSE BIT(29)
53# define OTGSC_BSEIE BIT(28)
54# define OTGSC_BSVIE BIT(27)
55# define OTGSC_ASVIE BIT(26)
56# define OTGSC_AVVIE BIT(25)
57# define OTGSC_IDIE BIT(24)
58# define OTGSC_DPIS BIT(22)
59# define OTGSC_1MSS BIT(21)
60# define OTGSC_BSEIS BIT(20)
61# define OTGSC_BSVIS BIT(19)
62# define OTGSC_ASVIS BIT(18)
63# define OTGSC_AVVIS BIT(17)
64# define OTGSC_IDIS BIT(16)
65# define OTGSC_DPS BIT(14)
66# define OTGSC_1MST BIT(13)
67# define OTGSC_BSE BIT(12)
68# define OTGSC_BSV BIT(11)
69# define OTGSC_ASV BIT(10)
70# define OTGSC_AVV BIT(9)
71# define OTGSC_ID BIT(8)
72# define OTGSC_HABA BIT(7)
73# define OTGSC_HADP BIT(6)
74# define OTGSC_IDPU BIT(5)
75# define OTGSC_DP BIT(4)
76# define OTGSC_OT BIT(3)
77# define OTGSC_HAAR BIT(2)
78# define OTGSC_VC BIT(1)
79# define OTGSC_VD BIT(0)
80# define OTGSC_INTEN_MASK (0x7f << 24)
81# define OTGSC_INTSTS_MASK (0x7f << 16)
82#define CI_USBMODE 0xf8
83# define USBMODE_CM (BIT(1) | BIT(0))
84# define USBMODE_IDLE 0
85# define USBMODE_DEVICE 0x2
86# define USBMODE_HOST 0x3
87
88#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
89
90struct otg_hsm {
91 /* Input */
92 int a_bus_resume;
93 int a_bus_suspend;
94 int a_conn;
95 int a_sess_vld;
96 int a_srp_det;
97 int a_vbus_vld;
98 int b_bus_resume;
99 int b_bus_suspend;
100 int b_conn;
101 int b_se0_srp;
102 int b_sess_end;
103 int b_sess_vld;
104 int id;
105
106 /* Internal variables */
107 int a_set_b_hnp_en;
108 int b_srp_done;
109 int b_hnp_enable;
110
111 /* Timeout indicator for timers */
112 int a_wait_vrise_tmout;
113 int a_wait_bcon_tmout;
114 int a_aidl_bdis_tmout;
115 int b_ase0_brst_tmout;
116 int b_bus_suspend_tmout;
117 int b_srp_res_tmout;
118
119 /* Informative variables */
120 int a_bus_drop;
121 int a_bus_req;
122 int a_clr_err;
123 int a_suspend_req;
124 int b_bus_req;
125
126 /* Output */
127 int drv_vbus;
128 int loc_conn;
129 int loc_sof;
130
131 /* Others */
132 int b_bus_suspend_vld;
133};
134
135#define TA_WAIT_VRISE 100
136#define TA_WAIT_BCON 30000
137#define TA_AIDL_BDIS 15000
138#define TB_ASE0_BRST 5000
139#define TB_SE0_SRP 2
140#define TB_SRP_RES 100
141#define TB_BUS_SUSPEND 500
142
143struct langwell_otg_timer {
144 unsigned long expires; /* Number of count increase to timeout */
145 unsigned long count; /* Tick counter */
146 void (*function)(unsigned long); /* Timeout function */
147 unsigned long data; /* Data passed to function */
148 struct list_head list;
149};
150
151struct langwell_otg {
152 struct otg_transceiver otg;
153 struct otg_hsm hsm;
154 void __iomem *regs;
155 unsigned region;
156 struct pci_driver *host_ops;
157 struct pci_driver *client_ops;
158 struct pci_dev *pdev;
159 struct work_struct work;
160 struct workqueue_struct *qwork;
161 spinlock_t lock;
162 spinlock_t wq_lock;
163};
164
165static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg)
166{
167 return container_of(otg, struct langwell_otg, otg);
168}
169
170#ifdef DEBUG
171#define otg_dbg(fmt, args...) \
172 printk(KERN_DEBUG fmt , ## args)
173#else
174#define otg_dbg(fmt, args...) \
175 do { } while (0)
176#endif /* DEBUG */
177#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
new file mode 100644
index 000000000000..c949178a6530
--- /dev/null
+++ b/include/linux/usb/langwell_udc.h
@@ -0,0 +1,310 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1aaa826396a1..2443c0e7a80c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,10 +80,10 @@ struct otg_transceiver {
80 80
81/* for board-specific init logic */ 81/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 82extern int otg_set_transceiver(struct otg_transceiver *);
83#ifdef CONFIG_NOP_USB_XCEIV 83
84/* sometimes transceivers are accessed only through e.g. ULPI */
84extern void usb_nop_xceiv_register(void); 85extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void); 86extern void usb_nop_xceiv_unregister(void);
86#endif
87 87
88 88
89/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
new file mode 100644
index 000000000000..e9f0384fa20c
--- /dev/null
+++ b/include/linux/usb/r8a66597.h
@@ -0,0 +1,44 @@
1/*
2 * R8A66597 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#ifndef __LINUX_USB_R8A66597_H
24#define __LINUX_USB_R8A66597_H
25
26#define R8A66597_PLATDATA_XTAL_12MHZ 0x01
27#define R8A66597_PLATDATA_XTAL_24MHZ 0x02
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29
30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power);
33
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2;
36
37 /* set one = 3.3V, set zero = 1.5V */
38 unsigned vif:1;
39
40 /* set one = big endian, set zero = little endian */
41 unsigned endian:1;
42};
43#endif
44
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 8cdfed738fe4..44801d26a37a 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/sysrq.h>
18 19
19#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
20#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -26,6 +27,13 @@
26/* parity check flag */ 27/* parity check flag */
27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 28#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
28 29
30enum port_dev_state {
31 PORT_UNREGISTERED,
32 PORT_REGISTERING,
33 PORT_REGISTERED,
34 PORT_UNREGISTERING,
35};
36
29/** 37/**
30 * usb_serial_port: structure for the specific ports of a device. 38 * usb_serial_port: structure for the specific ports of a device.
31 * @serial: pointer back to the struct usb_serial owner of this port. 39 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -91,12 +99,17 @@ struct usb_serial_port {
91 int write_urb_busy; 99 int write_urb_busy;
92 __u8 bulk_out_endpointAddress; 100 __u8 bulk_out_endpointAddress;
93 101
102 int tx_bytes_flight;
103 int urbs_in_flight;
104
94 wait_queue_head_t write_wait; 105 wait_queue_head_t write_wait;
95 struct work_struct work; 106 struct work_struct work;
96 char throttled; 107 char throttled;
97 char throttle_req; 108 char throttle_req;
98 char console; 109 char console;
110 unsigned long sysrq; /* sysrq timeout */
99 struct device dev; 111 struct device dev;
112 enum port_dev_state dev_state;
100}; 113};
101#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 114#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
102 115
@@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * This will be called when the struct usb_serial structure is fully set 194 * This will be called when the struct usb_serial structure is fully set
182 * set up. Do any local initialization of the device, or any private 195 * set up. Do any local initialization of the device, or any private
183 * memory structure allocation at this point in time. 196 * memory structure allocation at this point in time.
184 * @shutdown: pointer to the driver's shutdown function. This will be 197 * @disconnect: pointer to the driver's disconnect function. This will be
185 * called when the device is removed from the system. 198 * called when the device is unplugged or unbound from the driver.
199 * @release: pointer to the driver's release function. This will be called
200 * when the usb_serial data structure is about to be destroyed.
186 * @usb_driver: pointer to the struct usb_driver that controls this 201 * @usb_driver: pointer to the struct usb_driver that controls this
187 * device. This is necessary to allow dynamic ids to be added to 202 * device. This is necessary to allow dynamic ids to be added to
188 * the driver from sysfs. 203 * the driver from sysfs.
@@ -207,12 +222,14 @@ struct usb_serial_driver {
207 struct device_driver driver; 222 struct device_driver driver;
208 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
209 struct usb_dynids dynids; 224 struct usb_dynids dynids;
225 int max_in_flight_urbs;
210 226
211 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 227 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
212 int (*attach)(struct usb_serial *serial); 228 int (*attach)(struct usb_serial *serial);
213 int (*calc_num_ports) (struct usb_serial *serial); 229 int (*calc_num_ports) (struct usb_serial *serial);
214 230
215 void (*shutdown)(struct usb_serial *serial); 231 void (*disconnect)(struct usb_serial *serial);
232 void (*release)(struct usb_serial *serial);
216 233
217 int (*port_probe)(struct usb_serial_port *port); 234 int (*port_probe)(struct usb_serial_port *port);
218 int (*port_remove)(struct usb_serial_port *port); 235 int (*port_remove)(struct usb_serial_port *port);
@@ -294,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
294extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 311extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
295extern void usb_serial_generic_throttle(struct tty_struct *tty); 312extern void usb_serial_generic_throttle(struct tty_struct *tty);
296extern void usb_serial_generic_unthrottle(struct tty_struct *tty); 313extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
297extern void usb_serial_generic_shutdown(struct usb_serial *serial); 314extern void usb_serial_generic_disconnect(struct usb_serial *serial);
315extern void usb_serial_generic_release(struct usb_serial *serial);
298extern int usb_serial_generic_register(int debug); 316extern int usb_serial_generic_register(int debug);
299extern void usb_serial_generic_deregister(void); 317extern void usb_serial_generic_deregister(void);
318extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port,
319 gfp_t mem_flags);
320extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
321 unsigned int ch);
322extern int usb_serial_handle_break(struct usb_serial_port *port);
323
300 324
301extern int usb_serial_bus_register(struct usb_serial_driver *device); 325extern int usb_serial_bus_register(struct usb_serial_driver *device);
302extern void usb_serial_bus_deregister(struct usb_serial_driver *device); 326extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 36fabb95c7d3..5d44059f6d63 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -183,6 +183,7 @@ extern void usbnet_tx_timeout (struct net_device *net);
183extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 183extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
184 184
185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
186extern int usbnet_get_ethernet_addr(struct usbnet *, int);
186extern void usbnet_defer_kevent (struct usbnet *, int); 187extern void usbnet_defer_kevent (struct usbnet *, int);
187extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 188extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
188extern void usbnet_unlink_rx_urbs(struct usbnet *); 189extern void usbnet_unlink_rx_urbs(struct usbnet *);
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 11232676bfff..3656b300de3a 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -22,12 +22,12 @@ struct old_utsname {
22}; 22};
23 23
24struct new_utsname { 24struct new_utsname {
25 char sysname[65]; 25 char sysname[__NEW_UTS_LEN + 1];
26 char nodename[65]; 26 char nodename[__NEW_UTS_LEN + 1];
27 char release[65]; 27 char release[__NEW_UTS_LEN + 1];
28 char version[65]; 28 char version[__NEW_UTS_LEN + 1];
29 char machine[65]; 29 char machine[__NEW_UTS_LEN + 1];
30 char domainname[65]; 30 char domainname[__NEW_UTS_LEN + 1];
31}; 31};
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ebb2ea6b4995..f24eceecc5a6 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -347,7 +347,8 @@ struct v4l2_pix_format {
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ 350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
351#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
351 352
352/* 353/*
353 * F O R M A T E N U M E R A T I O N 354 * F O R M A T E N U M E R A T I O N
diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h
new file mode 100644
index 000000000000..8f6a95882b09
--- /dev/null
+++ b/include/linux/vlynq.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef __VLYNQ_H__
20#define __VLYNQ_H__
21
22#include <linux/device.h>
23#include <linux/module.h>
24#include <linux/types.h>
25
26#define VLYNQ_NUM_IRQS 32
27
28struct vlynq_mapping {
29 u32 size;
30 u32 offset;
31};
32
33enum vlynq_divisor {
34 vlynq_div_auto = 0,
35 vlynq_ldiv1,
36 vlynq_ldiv2,
37 vlynq_ldiv3,
38 vlynq_ldiv4,
39 vlynq_ldiv5,
40 vlynq_ldiv6,
41 vlynq_ldiv7,
42 vlynq_ldiv8,
43 vlynq_rdiv1,
44 vlynq_rdiv2,
45 vlynq_rdiv3,
46 vlynq_rdiv4,
47 vlynq_rdiv5,
48 vlynq_rdiv6,
49 vlynq_rdiv7,
50 vlynq_rdiv8,
51 vlynq_div_external
52};
53
54struct vlynq_device_id {
55 u32 id;
56 enum vlynq_divisor divisor;
57 unsigned long driver_data;
58};
59
60struct vlynq_regs;
61struct vlynq_device {
62 u32 id, dev_id;
63 int local_irq;
64 int remote_irq;
65 enum vlynq_divisor divisor;
66 u32 regs_start, regs_end;
67 u32 mem_start, mem_end;
68 u32 irq_start, irq_end;
69 int irq;
70 int enabled;
71 struct vlynq_regs *local;
72 struct vlynq_regs *remote;
73 struct device dev;
74};
75
76struct vlynq_driver {
77 char *name;
78 struct vlynq_device_id *id_table;
79 int (*probe)(struct vlynq_device *dev, struct vlynq_device_id *id);
80 void (*remove)(struct vlynq_device *dev);
81 struct device_driver driver;
82};
83
84struct plat_vlynq_ops {
85 int (*on)(struct vlynq_device *dev);
86 void (*off)(struct vlynq_device *dev);
87};
88
89static inline struct vlynq_driver *to_vlynq_driver(struct device_driver *drv)
90{
91 return container_of(drv, struct vlynq_driver, driver);
92}
93
94static inline struct vlynq_device *to_vlynq_device(struct device *device)
95{
96 return container_of(device, struct vlynq_device, dev);
97}
98
99extern struct bus_type vlynq_bus_type;
100
101extern int __vlynq_register_driver(struct vlynq_driver *driver,
102 struct module *owner);
103
104static inline int vlynq_register_driver(struct vlynq_driver *driver)
105{
106 return __vlynq_register_driver(driver, THIS_MODULE);
107}
108
109static inline void *vlynq_get_drvdata(struct vlynq_device *dev)
110{
111 return dev_get_drvdata(&dev->dev);
112}
113
114static inline void vlynq_set_drvdata(struct vlynq_device *dev, void *data)
115{
116 dev_set_drvdata(&dev->dev, data);
117}
118
119static inline u32 vlynq_mem_start(struct vlynq_device *dev)
120{
121 return dev->mem_start;
122}
123
124static inline u32 vlynq_mem_end(struct vlynq_device *dev)
125{
126 return dev->mem_end;
127}
128
129static inline u32 vlynq_mem_len(struct vlynq_device *dev)
130{
131 return dev->mem_end - dev->mem_start + 1;
132}
133
134static inline int vlynq_virq_to_irq(struct vlynq_device *dev, int virq)
135{
136 int irq = dev->irq_start + virq;
137 if ((irq < dev->irq_start) || (irq > dev->irq_end))
138 return -EINVAL;
139
140 return irq;
141}
142
143static inline int vlynq_irq_to_virq(struct vlynq_device *dev, int irq)
144{
145 if ((irq < dev->irq_start) || (irq > dev->irq_end))
146 return -EINVAL;
147
148 return irq - dev->irq_start;
149}
150
151extern void vlynq_unregister_driver(struct vlynq_driver *driver);
152extern int vlynq_enable_device(struct vlynq_device *dev);
153extern void vlynq_disable_device(struct vlynq_device *dev);
154extern int vlynq_set_local_mapping(struct vlynq_device *dev, u32 tx_offset,
155 struct vlynq_mapping *mapping);
156extern int vlynq_set_remote_mapping(struct vlynq_device *dev, u32 tx_offset,
157 struct vlynq_mapping *mapping);
158extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq);
159extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq);
160
161#endif /* __VLYNQ_H__ */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 524cd1b28ecb..81a97cf8f0a0 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -36,12 +36,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36 FOR_ALL_ZONES(PGSTEAL), 36 FOR_ALL_ZONES(PGSTEAL),
37 FOR_ALL_ZONES(PGSCAN_KSWAPD), 37 FOR_ALL_ZONES(PGSCAN_KSWAPD),
38 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
39#ifdef CONFIG_NUMA
40 PGSCAN_ZONE_RECLAIM_FAILED,
41#endif
39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 43 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE 44#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 45 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif 46#endif
44#ifdef CONFIG_UNEVICTABLE_LRU
45 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ 47 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */
46 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ 48 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */
47 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ 49 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */
@@ -50,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
50 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 52 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
51 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 53 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
52 UNEVICTABLE_MLOCKFREED, 54 UNEVICTABLE_MLOCKFREED,
53#endif
54 NR_VM_EVENT_ITEMS 55 NR_VM_EVENT_ITEMS
55}; 56};
56 57
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
index c89de7f4e5b9..4fdcc5635518 100644
--- a/include/linux/wimax.h
+++ b/include/linux/wimax.h
@@ -59,7 +59,7 @@ enum {
59 * M - Major: change if removing or modifying an existing call. 59 * M - Major: change if removing or modifying an existing call.
60 * m - minor: change when adding a new call 60 * m - minor: change when adding a new call
61 */ 61 */
62 WIMAX_GNL_VERSION = 00, 62 WIMAX_GNL_VERSION = 01,
63 /* Generic NetLink attributes */ 63 /* Generic NetLink attributes */
64 WIMAX_GNL_ATTR_INVALID = 0x00, 64 WIMAX_GNL_ATTR_INVALID = 0x00,
65 WIMAX_GNL_ATTR_MAX = 10, 65 WIMAX_GNL_ATTR_MAX = 10,
@@ -78,6 +78,7 @@ enum {
78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ 78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */
79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ 79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */
80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ 80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */
81 WIMAX_GNL_OP_STATE_GET, /* Request for current state */
81}; 82};
82 83
83 84
@@ -113,6 +114,10 @@ enum {
113 WIMAX_GNL_RESET_IFIDX = 1, 114 WIMAX_GNL_RESET_IFIDX = 1,
114}; 115};
115 116
117/* Atributes for wimax_state_get() */
118enum {
119 WIMAX_GNL_STGET_IFIDX = 1,
120};
116 121
117/* 122/*
118 * Attributes for the Report State Change 123 * Attributes for the Report State Change
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
index d5148a7889a6..433693ef2bb0 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/linux/wimax/i2400m.h
@@ -266,7 +266,7 @@ enum i2400m_ro_type {
266 266
267/* Misc constants */ 267/* Misc constants */
268enum { 268enum {
269 I2400M_PL_PAD = 16, /* Payload data size alignment */ 269 I2400M_PL_ALIGN = 16, /* Payload data size alignment */
270 I2400M_PL_SIZE_MAX = 0x3EFF, 270 I2400M_PL_SIZE_MAX = 0x3EFF,
271 I2400M_MAX_PLS_IN_MSG = 60, 271 I2400M_MAX_PLS_IN_MSG = 60,
272 /* protocol barkers: sync sequences; for notifications they 272 /* protocol barkers: sync sequences; for notifications they
diff --git a/include/media/adv7343.h b/include/media/adv7343.h
new file mode 100644
index 000000000000..d6f8a4e1a1fc
--- /dev/null
+++ b/include/media/adv7343.h
@@ -0,0 +1,23 @@
1/*
2 * ADV7343 header file
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef ADV7343_H
17#define ADV7343_H
18
19#define ADV7343_COMPOSITE_ID (0)
20#define ADV7343_COMPONENT_ID (1)
21#define ADV7343_SVIDEO_ID (2)
22
23#endif /* End of #ifndef ADV7343_H */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 07963d705400..3ad4ed5402fb 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -7,7 +7,7 @@ struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 IR_KEYTAB_TYPE *ir_codes; 9 IR_KEYTAB_TYPE *ir_codes;
10 struct i2c_client c; 10 struct i2c_client *c;
11 struct input_dev *input; 11 struct input_dev *input;
12 struct ir_input_state ir; 12 struct ir_input_state ir;
13 13
@@ -15,7 +15,15 @@ struct IR_i2c {
15 unsigned char old; 15 unsigned char old;
16 16
17 struct delayed_work work; 17 struct delayed_work work;
18 char name[32];
18 char phys[32]; 19 char phys[32];
19 int (*get_key)(struct IR_i2c*, u32*, u32*); 20 int (*get_key)(struct IR_i2c*, u32*, u32*);
20}; 21};
22
23/* Can be passed when instantiating an ir_video i2c device */
24struct IR_i2c_init_data {
25 IR_KEYTAB_TYPE *ir_codes;
26 const char *name;
27 int (*get_key)(struct IR_i2c*, u32*, u32*);
28};
21#endif 29#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 37013688af44..23ecead35e7a 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -60,7 +60,7 @@ struct soc_camera_file {
60 60
61struct soc_camera_host { 61struct soc_camera_host {
62 struct list_head list; 62 struct list_head list;
63 struct device dev; 63 struct device *dev;
64 unsigned char nr; /* Host number */ 64 unsigned char nr; /* Host number */
65 void *priv; 65 void *priv;
66 const char *drv_name; 66 const char *drv_name;
@@ -92,11 +92,16 @@ struct soc_camera_host_ops {
92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) 92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
93#define SOCAM_SENSOR_INVERT_DATA (1 << 4) 93#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
94 94
95struct i2c_board_info;
96
95struct soc_camera_link { 97struct soc_camera_link {
96 /* Camera bus id, used to match a camera and a bus */ 98 /* Camera bus id, used to match a camera and a bus */
97 int bus_id; 99 int bus_id;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 100 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 101 unsigned long flags;
102 int i2c_adapter_id;
103 struct i2c_board_info *board_info;
104 const char *module_name;
100 /* Optional callbacks to power on or off and reset the sensor */ 105 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 106 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 107 int (*reset)(struct device *);
@@ -107,6 +112,7 @@ struct soc_camera_link {
107 */ 112 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); 113 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *); 114 unsigned long (*query_bus_param)(struct soc_camera_link *);
115 void (*free_bus)(struct soc_camera_link *);
110}; 116};
111 117
112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 118static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -116,7 +122,7 @@ static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
116 122
117static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 123static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
118{ 124{
119 return container_of(dev, struct soc_camera_host, dev); 125 return dev_get_drvdata(dev);
120} 126}
121 127
122extern int soc_camera_host_register(struct soc_camera_host *ici); 128extern int soc_camera_host_register(struct soc_camera_host *ici);
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 7d4e2db78076..cbf97f45fbec 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -124,6 +124,8 @@
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */ 124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */ 125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78 126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
127#define TUNER_PHILIPS_FM1216MK5 79
128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
127 129
128/* tv card specific */ 130/* tv card specific */
129#define TDA9887_PRESENT (1<<0) 131#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 1be461a29077..4d7e2272c42f 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -137,6 +137,12 @@ enum {
137 /* module saa7191: just ident 7191 */ 137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191, 138 V4L2_IDENT_SAA7191 = 7191,
139 139
140 /* module ths7303: just ident 7303 */
141 V4L2_IDENT_THS7303 = 7303,
142
143 /* module adv7343: just ident 7343 */
144 V4L2_IDENT_ADV7343 = 7343,
145
140 /* module wm8739: just ident 8739 */ 146 /* module wm8739: just ident 8739 */
141 V4L2_IDENT_WM8739 = 8739, 147 V4L2_IDENT_WM8739 = 8739,
142 148
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 0dd3e8e8653e..5d5d550e63ad 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -30,7 +30,7 @@
30 basic V4L2 device-level support. 30 basic V4L2 device-level support.
31 */ 31 */
32 32
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 16)
34 34
35struct v4l2_device { 35struct v4l2_device {
36 /* dev->driver_data points to this struct. 36 /* dev->driver_data points to this struct.
@@ -53,10 +53,31 @@ struct v4l2_device {
53 dev may be NULL in rare cases (ISA devices). In that case you 53 dev may be NULL in rare cases (ISA devices). In that case you
54 must fill in the v4l2_dev->name field before calling this function. */ 54 must fill in the v4l2_dev->name field before calling this function. */
55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); 55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
56
57/* Optional function to initialize the name field of struct v4l2_device using
58 the driver name and a driver-global atomic_t instance.
59 This function will increment the instance counter and returns the instance
60 value used in the name.
61
62 Example:
63
64 static atomic_t drv_instance = ATOMIC_INIT(0);
65
66 ...
67
68 instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance);
69
70 The first time this is called the name field will be set to foo0 and
71 this function returns 0. If the name ends with a digit (e.g. cx18),
72 then the name will be set to cx18-0 since cx180 looks really odd. */
73int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
74 atomic_t *instance);
75
56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. 76/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
57 Since the parent disappears this ensures that v4l2_dev doesn't have an 77 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */ 78 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); 79void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
80
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */ 81/* Unregister all sub-devices and any other resources related to v4l2_dev. */
61void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 82void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
62 83
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 17856081c809..a503e1cee78b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -230,12 +230,16 @@ struct v4l2_subdev_ops {
230 230
231#define V4L2_SUBDEV_NAME_SIZE 32 231#define V4L2_SUBDEV_NAME_SIZE 32
232 232
233/* Set this flag if this subdev is a i2c device. */
234#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
235
233/* Each instance of a subdev driver should create this struct, either 236/* Each instance of a subdev driver should create this struct, either
234 stand-alone or embedded in a larger struct. 237 stand-alone or embedded in a larger struct.
235 */ 238 */
236struct v4l2_subdev { 239struct v4l2_subdev {
237 struct list_head list; 240 struct list_head list;
238 struct module *owner; 241 struct module *owner;
242 u32 flags;
239 struct v4l2_device *v4l2_dev; 243 struct v4l2_device *v4l2_dev;
240 const struct v4l2_subdev_ops *ops; 244 const struct v4l2_subdev_ops *ops;
241 /* name must be unique */ 245 /* name must be unique */
@@ -264,6 +268,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
264 BUG_ON(!ops || !ops->core); 268 BUG_ON(!ops || !ops->core);
265 sd->ops = ops; 269 sd->ops = ops;
266 sd->v4l2_dev = NULL; 270 sd->v4l2_dev = NULL;
271 sd->flags = 0;
267 sd->name[0] = '\0'; 272 sd->name[0] = '\0';
268 sd->grp_id = 0; 273 sd->grp_id = 0;
269 sd->priv = NULL; 274 sd->priv = NULL;
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 3ad5390a4dd5..968166a45f86 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -81,12 +81,6 @@ enum {
81 BT_CLOSED 81 BT_CLOSED
82}; 82};
83 83
84/* Endianness conversions */
85#define htobs(a) __cpu_to_le16(a)
86#define htobl(a) __cpu_to_le32(a)
87#define btohs(a) __le16_to_cpu(a)
88#define btohl(a) __le32_to_cpu(a)
89
90/* BD Address */ 84/* BD Address */
91typedef struct { 85typedef struct {
92 __u8 b[6]; 86 __u8 b[6];
@@ -171,15 +165,6 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
171 return skb; 165 return skb;
172} 166}
173 167
174static inline int skb_frags_no(struct sk_buff *skb)
175{
176 register struct sk_buff *frag = skb_shinfo(skb)->frag_list;
177 register int n = 1;
178
179 for (; frag; frag=frag->next, n++);
180 return n;
181}
182
183int bt_err(__u16 code); 168int bt_err(__u16 code);
184 169
185extern int hci_sock_init(void); 170extern int hci_sock_init(void);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 73aead222b32..c4ca4228b083 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -137,6 +137,8 @@ struct hci_dev {
137 struct device *parent; 137 struct device *parent;
138 struct device dev; 138 struct device dev;
139 139
140 struct rfkill *rfkill;
141
140 struct module *owner; 142 struct module *owner;
141 143
142 int (*open)(struct hci_dev *hdev); 144 int (*open)(struct hci_dev *hdev);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index f566aa1f0a4c..e919fca1072a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -26,8 +26,13 @@
26#define __L2CAP_H 26#define __L2CAP_H
27 27
28/* L2CAP defaults */ 28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672 29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF 30#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1
32#define L2CAP_DEFAULT_MAX_RECEIVE 1
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7
31 36
32#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
33#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -64,17 +69,29 @@ struct l2cap_conninfo {
64#define L2CAP_LM_SECURE 0x0020 69#define L2CAP_LM_SECURE 0x0020
65 70
66/* L2CAP command codes */ 71/* L2CAP command codes */
67#define L2CAP_COMMAND_REJ 0x01 72#define L2CAP_COMMAND_REJ 0x01
68#define L2CAP_CONN_REQ 0x02 73#define L2CAP_CONN_REQ 0x02
69#define L2CAP_CONN_RSP 0x03 74#define L2CAP_CONN_RSP 0x03
70#define L2CAP_CONF_REQ 0x04 75#define L2CAP_CONF_REQ 0x04
71#define L2CAP_CONF_RSP 0x05 76#define L2CAP_CONF_RSP 0x05
72#define L2CAP_DISCONN_REQ 0x06 77#define L2CAP_DISCONN_REQ 0x06
73#define L2CAP_DISCONN_RSP 0x07 78#define L2CAP_DISCONN_RSP 0x07
74#define L2CAP_ECHO_REQ 0x08 79#define L2CAP_ECHO_REQ 0x08
75#define L2CAP_ECHO_RSP 0x09 80#define L2CAP_ECHO_RSP 0x09
76#define L2CAP_INFO_REQ 0x0a 81#define L2CAP_INFO_REQ 0x0a
77#define L2CAP_INFO_RSP 0x0b 82#define L2CAP_INFO_RSP 0x0b
83
84/* L2CAP feature mask */
85#define L2CAP_FEAT_FLOWCTL 0x00000001
86#define L2CAP_FEAT_RETRANS 0x00000002
87#define L2CAP_FEAT_ERTM 0x00000008
88#define L2CAP_FEAT_STREAMING 0x00000010
89#define L2CAP_FEAT_FCS 0x00000020
90#define L2CAP_FEAT_FIXED_CHAN 0x00000080
91
92/* L2CAP checksum option */
93#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01
78 95
79/* L2CAP structures */ 96/* L2CAP structures */
80struct l2cap_hdr { 97struct l2cap_hdr {
@@ -106,17 +123,23 @@ struct l2cap_conn_rsp {
106 __le16 status; 123 __le16 status;
107} __attribute__ ((packed)); 124} __attribute__ ((packed));
108 125
126/* channel indentifier */
127#define L2CAP_CID_SIGNALING 0x0001
128#define L2CAP_CID_CONN_LESS 0x0002
129#define L2CAP_CID_DYN_START 0x0040
130#define L2CAP_CID_DYN_END 0xffff
131
109/* connect result */ 132/* connect result */
110#define L2CAP_CR_SUCCESS 0x0000 133#define L2CAP_CR_SUCCESS 0x0000
111#define L2CAP_CR_PEND 0x0001 134#define L2CAP_CR_PEND 0x0001
112#define L2CAP_CR_BAD_PSM 0x0002 135#define L2CAP_CR_BAD_PSM 0x0002
113#define L2CAP_CR_SEC_BLOCK 0x0003 136#define L2CAP_CR_SEC_BLOCK 0x0003
114#define L2CAP_CR_NO_MEM 0x0004 137#define L2CAP_CR_NO_MEM 0x0004
115 138
116/* connect status */ 139/* connect status */
117#define L2CAP_CS_NO_INFO 0x0000 140#define L2CAP_CS_NO_INFO 0x0000
118#define L2CAP_CS_AUTHEN_PEND 0x0001 141#define L2CAP_CS_AUTHEN_PEND 0x0001
119#define L2CAP_CS_AUTHOR_PEND 0x0002 142#define L2CAP_CS_AUTHOR_PEND 0x0002
120 143
121struct l2cap_conf_req { 144struct l2cap_conf_req {
122 __le16 dcid; 145 __le16 dcid;
@@ -143,10 +166,14 @@ struct l2cap_conf_opt {
143} __attribute__ ((packed)); 166} __attribute__ ((packed));
144#define L2CAP_CONF_OPT_SIZE 2 167#define L2CAP_CONF_OPT_SIZE 2
145 168
169#define L2CAP_CONF_HINT 0x80
170#define L2CAP_CONF_MASK 0x7f
171
146#define L2CAP_CONF_MTU 0x01 172#define L2CAP_CONF_MTU 0x01
147#define L2CAP_CONF_FLUSH_TO 0x02 173#define L2CAP_CONF_FLUSH_TO 0x02
148#define L2CAP_CONF_QOS 0x03 174#define L2CAP_CONF_QOS 0x03
149#define L2CAP_CONF_RFC 0x04 175#define L2CAP_CONF_RFC 0x04
176#define L2CAP_CONF_FCS 0x05
150 177
151#define L2CAP_CONF_MAX_SIZE 22 178#define L2CAP_CONF_MAX_SIZE 22
152 179
@@ -162,6 +189,8 @@ struct l2cap_conf_rfc {
162#define L2CAP_MODE_BASIC 0x00 189#define L2CAP_MODE_BASIC 0x00
163#define L2CAP_MODE_RETRANS 0x01 190#define L2CAP_MODE_RETRANS 0x01
164#define L2CAP_MODE_FLOWCTL 0x02 191#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04
165 194
166struct l2cap_disconn_req { 195struct l2cap_disconn_req {
167 __le16 dcid; 196 __le16 dcid;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5389afdc1297..1a21895b732b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1,71 +1,220 @@
1#ifndef __NET_CFG80211_H 1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H 2#define __NET_CFG80211_H
3/*
4 * 802.11 device and configuration interface
5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
3 12
13#include <linux/netdevice.h>
14#include <linux/debugfs.h>
15#include <linux/list.h>
4#include <linux/netlink.h> 16#include <linux/netlink.h>
5#include <linux/skbuff.h> 17#include <linux/skbuff.h>
6#include <linux/nl80211.h> 18#include <linux/nl80211.h>
7#include <linux/if_ether.h> 19#include <linux/if_ether.h>
8#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
9#include <linux/wireless.h> 21#include <net/regulatory.h>
10#include <net/iw_handler.h> 22
11#include <net/genetlink.h>
12/* remove once we remove the wext stuff */ 23/* remove once we remove the wext stuff */
13#include <net/iw_handler.h> 24#include <net/iw_handler.h>
25#include <linux/wireless.h>
26
14 27
15/* 28/*
16 * 802.11 configuration in-kernel interface 29 * wireless hardware capability structures
30 */
31
32/**
33 * enum ieee80211_band - supported frequency bands
34 *
35 * The bands are assigned this way because the supported
36 * bitrates differ in these bands.
17 * 37 *
18 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
19 */ 40 */
41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ,
44
45 /* keep last */
46 IEEE80211_NUM_BANDS
47};
20 48
21/** 49/**
22 * struct vif_params - describes virtual interface parameters 50 * enum ieee80211_channel_flags - channel flags
23 * @mesh_id: mesh ID to use 51 *
24 * @mesh_id_len: length of the mesh ID 52 * Channel flags set by the regulatory control code.
53 *
54 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
55 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
56 * on this channel.
57 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
58 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
59 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
60 * is not permitted.
61 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
62 * is not permitted.
25 */ 63 */
26struct vif_params { 64enum ieee80211_channel_flags {
27 u8 *mesh_id; 65 IEEE80211_CHAN_DISABLED = 1<<0,
28 int mesh_id_len; 66 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
67 IEEE80211_CHAN_NO_IBSS = 1<<2,
68 IEEE80211_CHAN_RADAR = 1<<3,
69 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
70 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
29}; 71};
30 72
31/* Radiotap header iteration 73#define IEEE80211_CHAN_NO_HT40 \
32 * implemented in net/wireless/radiotap.c 74 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
33 * docs in Documentation/networking/radiotap-headers.txt 75
76/**
77 * struct ieee80211_channel - channel definition
78 *
79 * This structure describes a single channel for use
80 * with cfg80211.
81 *
82 * @center_freq: center frequency in MHz
83 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
84 * @hw_value: hardware-specific value for the channel
85 * @flags: channel flags from &enum ieee80211_channel_flags.
86 * @orig_flags: channel flags at registration time, used by regulatory
87 * code to support devices with additional restrictions
88 * @band: band this channel belongs to.
89 * @max_antenna_gain: maximum antenna gain in dBi
90 * @max_power: maximum transmission power (in dBm)
91 * @beacon_found: helper to regulatory code to indicate when a beacon
92 * has been found on this channel. Use regulatory_hint_found_beacon()
93 * to enable this, this is is useful only on 5 GHz band.
94 * @orig_mag: internal use
95 * @orig_mpwr: internal use
34 */ 96 */
97struct ieee80211_channel {
98 enum ieee80211_band band;
99 u16 center_freq;
100 u8 max_bandwidth;
101 u16 hw_value;
102 u32 flags;
103 int max_antenna_gain;
104 int max_power;
105 bool beacon_found;
106 u32 orig_flags;
107 int orig_mag, orig_mpwr;
108};
109
35/** 110/**
36 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 111 * enum ieee80211_rate_flags - rate flags
37 * @rtheader: pointer to the radiotap header we are walking through 112 *
38 * @max_length: length of radiotap header in cpu byte ordering 113 * Hardware/specification flags for rates. These are structured
39 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 114 * in a way that allows using the same bitrate structure for
40 * @this_arg: pointer to current radiotap arg 115 * different bands/PHY modes.
41 * @arg_index: internal next argument index 116 *
42 * @arg: internal next argument pointer 117 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
43 * @next_bitmap: internal pointer to next present u32 118 * preamble on this bitrate; only relevant in 2.4GHz band and
44 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 119 * with CCK rates.
120 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
121 * when used with 802.11a (on the 5 GHz band); filled by the
122 * core code when registering the wiphy.
123 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
124 * when used with 802.11b (on the 2.4 GHz band); filled by the
125 * core code when registering the wiphy.
126 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
127 * when used with 802.11g (on the 2.4 GHz band); filled by the
128 * core code when registering the wiphy.
129 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
45 */ 130 */
131enum ieee80211_rate_flags {
132 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
133 IEEE80211_RATE_MANDATORY_A = 1<<1,
134 IEEE80211_RATE_MANDATORY_B = 1<<2,
135 IEEE80211_RATE_MANDATORY_G = 1<<3,
136 IEEE80211_RATE_ERP_G = 1<<4,
137};
46 138
47struct ieee80211_radiotap_iterator { 139/**
48 struct ieee80211_radiotap_header *rtheader; 140 * struct ieee80211_rate - bitrate definition
49 int max_length; 141 *
50 int this_arg_index; 142 * This structure describes a bitrate that an 802.11 PHY can
51 u8 *this_arg; 143 * operate with. The two values @hw_value and @hw_value_short
144 * are only for driver use when pointers to this structure are
145 * passed around.
146 *
147 * @flags: rate-specific flags
148 * @bitrate: bitrate in units of 100 Kbps
149 * @hw_value: driver/hardware value for this rate
150 * @hw_value_short: driver/hardware value for this rate when
151 * short preamble is used
152 */
153struct ieee80211_rate {
154 u32 flags;
155 u16 bitrate;
156 u16 hw_value, hw_value_short;
157};
52 158
53 int arg_index; 159/**
54 u8 *arg; 160 * struct ieee80211_sta_ht_cap - STA's HT capabilities
55 __le32 *next_bitmap; 161 *
56 u32 bitmap_shifter; 162 * This structure describes most essential parameters needed
163 * to describe 802.11n HT capabilities for an STA.
164 *
165 * @ht_supported: is HT supported by the STA
166 * @cap: HT capabilities map as described in 802.11n spec
167 * @ampdu_factor: Maximum A-MPDU length factor
168 * @ampdu_density: Minimum A-MPDU spacing
169 * @mcs: Supported MCS rates
170 */
171struct ieee80211_sta_ht_cap {
172 u16 cap; /* use IEEE80211_HT_CAP_ */
173 bool ht_supported;
174 u8 ampdu_factor;
175 u8 ampdu_density;
176 struct ieee80211_mcs_info mcs;
57}; 177};
58 178
59extern int ieee80211_radiotap_iterator_init( 179/**
60 struct ieee80211_radiotap_iterator *iterator, 180 * struct ieee80211_supported_band - frequency band definition
61 struct ieee80211_radiotap_header *radiotap_header, 181 *
62 int max_length); 182 * This structure describes a frequency band a wiphy
183 * is able to operate in.
184 *
185 * @channels: Array of channels the hardware can operate in
186 * in this band.
187 * @band: the band this structure represents
188 * @n_channels: Number of channels in @channels
189 * @bitrates: Array of bitrates the hardware can operate with
190 * in this band. Must be sorted to give a valid "supported
191 * rates" IE, i.e. CCK rates first, then OFDM.
192 * @n_bitrates: Number of bitrates in @bitrates
193 */
194struct ieee80211_supported_band {
195 struct ieee80211_channel *channels;
196 struct ieee80211_rate *bitrates;
197 enum ieee80211_band band;
198 int n_channels;
199 int n_bitrates;
200 struct ieee80211_sta_ht_cap ht_cap;
201};
63 202
64extern int ieee80211_radiotap_iterator_next( 203/*
65 struct ieee80211_radiotap_iterator *iterator); 204 * Wireless hardware/device configuration structures and methods
205 */
66 206
207/**
208 * struct vif_params - describes virtual interface parameters
209 * @mesh_id: mesh ID to use
210 * @mesh_id_len: length of the mesh ID
211 */
212struct vif_params {
213 u8 *mesh_id;
214 int mesh_id_len;
215};
67 216
68 /** 217/**
69 * struct key_params - key information 218 * struct key_params - key information
70 * 219 *
71 * Information about a key 220 * Information about a key
@@ -106,27 +255,6 @@ struct beacon_parameters {
106}; 255};
107 256
108/** 257/**
109 * enum station_flags - station flags
110 *
111 * Station capability flags. Note that these must be the bits
112 * according to the nl80211 flags.
113 *
114 * @STATION_FLAG_CHANGED: station flags were changed
115 * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
117 * with short preambles
118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
120 */
121enum station_flags {
122 STATION_FLAG_CHANGED = 1<<0,
123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
127};
128
129/**
130 * enum plink_action - actions to perform in mesh peers 258 * enum plink_action - actions to perform in mesh peers
131 * 259 *
132 * @PLINK_ACTION_INVALID: action 0 is reserved 260 * @PLINK_ACTION_INVALID: action 0 is reserved
@@ -148,14 +276,17 @@ enum plink_actions {
148 * @supported_rates: supported rates in IEEE 802.11 format 276 * @supported_rates: supported rates in IEEE 802.11 format
149 * (or NULL for no change) 277 * (or NULL for no change)
150 * @supported_rates_len: number of supported rates 278 * @supported_rates_len: number of supported rates
151 * @station_flags: station flags (see &enum station_flags) 279 * @sta_flags_mask: station flags that changed
280 * (bitmask of BIT(NL80211_STA_FLAG_...))
281 * @sta_flags_set: station flags values
282 * (bitmask of BIT(NL80211_STA_FLAG_...))
152 * @listen_interval: listen interval or -1 for no change 283 * @listen_interval: listen interval or -1 for no change
153 * @aid: AID or zero for no change 284 * @aid: AID or zero for no change
154 */ 285 */
155struct station_parameters { 286struct station_parameters {
156 u8 *supported_rates; 287 u8 *supported_rates;
157 struct net_device *vlan; 288 struct net_device *vlan;
158 u32 station_flags; 289 u32 sta_flags_mask, sta_flags_set;
159 int listen_interval; 290 int listen_interval;
160 u16 aid; 291 u16 aid;
161 u8 supported_rates_len; 292 u8 supported_rates_len;
@@ -348,92 +479,6 @@ struct bss_parameters {
348 u8 basic_rates_len; 479 u8 basic_rates_len;
349}; 480};
350 481
351/**
352 * enum environment_cap - Environment parsed from country IE
353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
354 * outdoor operation.
355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
357 */
358enum environment_cap {
359 ENVIRON_ANY,
360 ENVIRON_INDOOR,
361 ENVIRON_OUTDOOR,
362};
363
364/**
365 * struct regulatory_request - used to keep track of regulatory requests
366 *
367 * @wiphy_idx: this is set if this request's initiator is
368 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
369 * can be used by the wireless core to deal with conflicts
370 * and potentially inform users of which devices specifically
371 * cased the conflicts.
372 * @initiator: indicates who sent this request, could be any of
373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
374 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
375 * regulatory domain. We have a few special codes:
376 * 00 - World regulatory domain
377 * 99 - built by driver but a specific alpha2 cannot be determined
378 * 98 - result of an intersection between two regulatory domains
379 * @intersect: indicates whether the wireless core should intersect
380 * the requested regulatory domain with the presently set regulatory
381 * domain.
382 * @country_ie_checksum: checksum of the last processed and accepted
383 * country IE
384 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
385 * indoor, or if it doesn't matter
386 * @list: used to insert into the reg_requests_list linked list
387 */
388struct regulatory_request {
389 int wiphy_idx;
390 enum nl80211_reg_initiator initiator;
391 char alpha2[2];
392 bool intersect;
393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
396};
397
398struct ieee80211_freq_range {
399 u32 start_freq_khz;
400 u32 end_freq_khz;
401 u32 max_bandwidth_khz;
402};
403
404struct ieee80211_power_rule {
405 u32 max_antenna_gain;
406 u32 max_eirp;
407};
408
409struct ieee80211_reg_rule {
410 struct ieee80211_freq_range freq_range;
411 struct ieee80211_power_rule power_rule;
412 u32 flags;
413};
414
415struct ieee80211_regdomain {
416 u32 n_reg_rules;
417 char alpha2[2];
418 struct ieee80211_reg_rule reg_rules[];
419};
420
421#define MHZ_TO_KHZ(freq) ((freq) * 1000)
422#define KHZ_TO_MHZ(freq) ((freq) / 1000)
423#define DBI_TO_MBI(gain) ((gain) * 100)
424#define MBI_TO_DBI(gain) ((gain) / 100)
425#define DBM_TO_MBM(gain) ((gain) * 100)
426#define MBM_TO_DBM(gain) ((gain) / 100)
427
428#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
429 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
430 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
431 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
432 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
433 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
434 .flags = reg_flags, \
435 }
436
437struct mesh_config { 482struct mesh_config {
438 /* Timeouts in ms */ 483 /* Timeouts in ms */
439 /* Mesh plink management parameters */ 484 /* Mesh plink management parameters */
@@ -504,7 +549,7 @@ struct cfg80211_scan_request {
504 int n_ssids; 549 int n_ssids;
505 struct ieee80211_channel **channels; 550 struct ieee80211_channel **channels;
506 u32 n_channels; 551 u32 n_channels;
507 u8 *ie; 552 const u8 *ie;
508 size_t ie_len; 553 size_t ie_len;
509 554
510 /* internal */ 555 /* internal */
@@ -612,6 +657,11 @@ struct cfg80211_auth_request {
612 * @ssid_len: Length of ssid in octets 657 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets 659 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
615 */ 665 */
616struct cfg80211_assoc_request { 666struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan; 667 struct ieee80211_channel *chan;
@@ -620,6 +670,8 @@ struct cfg80211_assoc_request {
620 size_t ssid_len; 670 size_t ssid_len;
621 const u8 *ie; 671 const u8 *ie;
622 size_t ie_len; 672 size_t ie_len;
673 bool use_mfp;
674 bool control_port;
623}; 675};
624 676
625/** 677/**
@@ -659,6 +711,60 @@ struct cfg80211_disassoc_request {
659}; 711};
660 712
661/** 713/**
714 * struct cfg80211_ibss_params - IBSS parameters
715 *
716 * This structure defines the IBSS parameters for the join_ibss()
717 * method.
718 *
719 * @ssid: The SSID, will always be non-null.
720 * @ssid_len: The length of the SSID, will always be non-zero.
721 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
722 * search for IBSSs with a different BSSID.
723 * @channel: The channel to use if no IBSS can be found to join.
724 * @channel_fixed: The channel should be fixed -- do not search for
725 * IBSSs to join on other channels.
726 * @ie: information element(s) to include in the beacon
727 * @ie_len: length of that
728 * @beacon_interval: beacon interval to use
729 */
730struct cfg80211_ibss_params {
731 u8 *ssid;
732 u8 *bssid;
733 struct ieee80211_channel *channel;
734 u8 *ie;
735 u8 ssid_len, ie_len;
736 u16 beacon_interval;
737 bool channel_fixed;
738};
739
740/**
741 * enum wiphy_params_flags - set_wiphy_params bitfield values
742 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
743 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
744 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
745 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
746 */
747enum wiphy_params_flags {
748 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
749 WIPHY_PARAM_RETRY_LONG = 1 << 1,
750 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
751 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
752};
753
754/**
755 * enum tx_power_setting - TX power adjustment
756 *
757 * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
758 * @TX_POWER_LIMITED: limit TX power by the dbm parameter
759 * @TX_POWER_FIXED: fix TX power to the dbm parameter
760 */
761enum tx_power_setting {
762 TX_POWER_AUTOMATIC,
763 TX_POWER_LIMITED,
764 TX_POWER_FIXED,
765};
766
767/**
662 * struct cfg80211_ops - backend description for wireless configuration 768 * struct cfg80211_ops - backend description for wireless configuration
663 * 769 *
664 * This struct is registered by fullmac card drivers and/or wireless stacks 770 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -688,10 +794,11 @@ struct cfg80211_disassoc_request {
688 * @get_key: get information about the key with the given parameters. 794 * @get_key: get information about the key with the given parameters.
689 * @mac_addr will be %NULL when requesting information for a group 795 * @mac_addr will be %NULL when requesting information for a group
690 * key. All pointers given to the @callback function need not be valid 796 * key. All pointers given to the @callback function need not be valid
691 * after it returns. 797 * after it returns. This function should return an error if it is
798 * not possible to retrieve the key, -ENOENT if it doesn't exist.
692 * 799 *
693 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 800 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
694 * and @key_index 801 * and @key_index, return -ENOENT if the key doesn't exist.
695 * 802 *
696 * @set_default_key: set the default key on an interface 803 * @set_default_key: set the default key on an interface
697 * 804 *
@@ -733,6 +840,23 @@ struct cfg80211_disassoc_request {
733 * @assoc: Request to (re)associate with the specified peer 840 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer 841 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer 842 * @disassoc: Request to disassociate from the specified peer
843 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge.
847 * @leave_ibss: Leave the IBSS.
848 *
849 * @set_wiphy_params: Notify that wiphy parameters have changed;
850 * @changed bitfield (see &enum wiphy_params_flags) describes which values
851 * have changed. The actual parameter values are available in
852 * struct wiphy. If returning an error, no value should be changed.
853 *
854 * @set_tx_power: set the transmit power according to the parameters
855 * @get_tx_power: store the current TX power into the dbm variable;
856 * return 0 if successful
857 *
858 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
859 * functions to adjust rfkill hw state
736 */ 860 */
737struct cfg80211_ops { 861struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy); 862 int (*suspend)(struct wiphy *wiphy);
@@ -747,13 +871,13 @@ struct cfg80211_ops {
747 struct vif_params *params); 871 struct vif_params *params);
748 872
749 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 873 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
750 u8 key_index, u8 *mac_addr, 874 u8 key_index, const u8 *mac_addr,
751 struct key_params *params); 875 struct key_params *params);
752 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 876 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
753 u8 key_index, u8 *mac_addr, void *cookie, 877 u8 key_index, const u8 *mac_addr, void *cookie,
754 void (*callback)(void *cookie, struct key_params*)); 878 void (*callback)(void *cookie, struct key_params*));
755 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 879 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
756 u8 key_index, u8 *mac_addr); 880 u8 key_index, const u8 *mac_addr);
757 int (*set_default_key)(struct wiphy *wiphy, 881 int (*set_default_key)(struct wiphy *wiphy,
758 struct net_device *netdev, 882 struct net_device *netdev,
759 u8 key_index); 883 u8 key_index);
@@ -818,9 +942,473 @@ struct cfg80211_ops {
818 struct cfg80211_deauth_request *req); 942 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 943 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req); 944 struct cfg80211_disassoc_request *req);
945
946 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_ibss_params *params);
948 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
949
950 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
951
952 int (*set_tx_power)(struct wiphy *wiphy,
953 enum tx_power_setting type, int dbm);
954 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
955
956 void (*rfkill_poll)(struct wiphy *wiphy);
821}; 957};
822 958
823/* temporary wext handlers */ 959/*
960 * wireless hardware and networking interfaces structures
961 * and registration/helper functions
962 */
963
964/**
965 * struct wiphy - wireless hardware description
966 * @idx: the wiphy index assigned to this item
967 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
968 * @custom_regulatory: tells us the driver for this device
969 * has its own custom regulatory domain and cannot identify the
970 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
971 * we will disregard the first regulatory hint (when the
972 * initiator is %REGDOM_SET_BY_CORE).
973 * @strict_regulatory: tells us the driver for this device will ignore
974 * regulatory domain settings until it gets its own regulatory domain
975 * via its regulatory_hint(). After its gets its own regulatory domain
976 * it will only allow further regulatory domain settings to further
977 * enhance compliance. For example if channel 13 and 14 are disabled
978 * by this regulatory domain no user regulatory domain can enable these
979 * channels at a later time. This can be used for devices which do not
980 * have calibration information gauranteed for frequencies or settings
981 * outside of its regulatory domain.
982 * @reg_notifier: the driver's regulatory notification callback
983 * @regd: the driver's regulatory domain, if one was requested via
984 * the regulatory_hint() API. This can be used by the driver
985 * on the reg_notifier() if it chooses to ignore future
986 * regulatory domain changes caused by other drivers.
987 * @signal_type: signal type reported in &struct cfg80211_bss.
988 * @cipher_suites: supported cipher suites
989 * @n_cipher_suites: number of supported cipher suites
990 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
991 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
992 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
993 * -1 = fragmentation disabled, only odd values >= 256 used
994 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
995 */
996struct wiphy {
997 /* assign these fields before you register the wiphy */
998
999 /* permanent MAC address */
1000 u8 perm_addr[ETH_ALEN];
1001
1002 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1003 u16 interface_modes;
1004
1005 bool custom_regulatory;
1006 bool strict_regulatory;
1007
1008 enum cfg80211_signal_type signal_type;
1009
1010 int bss_priv_size;
1011 u8 max_scan_ssids;
1012 u16 max_scan_ie_len;
1013
1014 int n_cipher_suites;
1015 const u32 *cipher_suites;
1016
1017 u8 retry_short;
1018 u8 retry_long;
1019 u32 frag_threshold;
1020 u32 rts_threshold;
1021
1022 /* If multiple wiphys are registered and you're handed e.g.
1023 * a regular netdev with assigned ieee80211_ptr, you won't
1024 * know whether it points to a wiphy your driver has registered
1025 * or not. Assign this to something global to your driver to
1026 * help determine whether you own this wiphy or not. */
1027 const void *privid;
1028
1029 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
1030
1031 /* Lets us get back the wiphy on the callback */
1032 int (*reg_notifier)(struct wiphy *wiphy,
1033 struct regulatory_request *request);
1034
1035 /* fields below are read-only, assigned by cfg80211 */
1036
1037 const struct ieee80211_regdomain *regd;
1038
1039 /* the item in /sys/class/ieee80211/ points to this,
1040 * you need use set_wiphy_dev() (see below) */
1041 struct device dev;
1042
1043 /* dir in debugfs: ieee80211/<wiphyname> */
1044 struct dentry *debugfsdir;
1045
1046 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1047};
1048
1049/**
1050 * wiphy_priv - return priv from wiphy
1051 *
1052 * @wiphy: the wiphy whose priv pointer to return
1053 */
1054static inline void *wiphy_priv(struct wiphy *wiphy)
1055{
1056 BUG_ON(!wiphy);
1057 return &wiphy->priv;
1058}
1059
1060/**
1061 * set_wiphy_dev - set device pointer for wiphy
1062 *
1063 * @wiphy: The wiphy whose device to bind
1064 * @dev: The device to parent it to
1065 */
1066static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1067{
1068 wiphy->dev.parent = dev;
1069}
1070
1071/**
1072 * wiphy_dev - get wiphy dev pointer
1073 *
1074 * @wiphy: The wiphy whose device struct to look up
1075 */
1076static inline struct device *wiphy_dev(struct wiphy *wiphy)
1077{
1078 return wiphy->dev.parent;
1079}
1080
1081/**
1082 * wiphy_name - get wiphy name
1083 *
1084 * @wiphy: The wiphy whose name to return
1085 */
1086static inline const char *wiphy_name(struct wiphy *wiphy)
1087{
1088 return dev_name(&wiphy->dev);
1089}
1090
1091/**
1092 * wiphy_new - create a new wiphy for use with cfg80211
1093 *
1094 * @ops: The configuration operations for this device
1095 * @sizeof_priv: The size of the private area to allocate
1096 *
1097 * Create a new wiphy and associate the given operations with it.
1098 * @sizeof_priv bytes are allocated for private use.
1099 *
1100 * The returned pointer must be assigned to each netdev's
1101 * ieee80211_ptr for proper operation.
1102 */
1103struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
1104
1105/**
1106 * wiphy_register - register a wiphy with cfg80211
1107 *
1108 * @wiphy: The wiphy to register.
1109 *
1110 * Returns a non-negative wiphy index or a negative error code.
1111 */
1112extern int wiphy_register(struct wiphy *wiphy);
1113
1114/**
1115 * wiphy_unregister - deregister a wiphy from cfg80211
1116 *
1117 * @wiphy: The wiphy to unregister.
1118 *
1119 * After this call, no more requests can be made with this priv
1120 * pointer, but the call may sleep to wait for an outstanding
1121 * request that is being handled.
1122 */
1123extern void wiphy_unregister(struct wiphy *wiphy);
1124
1125/**
1126 * wiphy_free - free wiphy
1127 *
1128 * @wiphy: The wiphy to free
1129 */
1130extern void wiphy_free(struct wiphy *wiphy);
1131
1132/**
1133 * struct wireless_dev - wireless per-netdev state
1134 *
1135 * This structure must be allocated by the driver/stack
1136 * that uses the ieee80211_ptr field in struct net_device
1137 * (this is intentional so it can be allocated along with
1138 * the netdev.)
1139 *
1140 * @wiphy: pointer to hardware description
1141 * @iftype: interface type
1142 * @list: (private) Used to collect the interfaces
1143 * @netdev: (private) Used to reference back to the netdev
1144 * @current_bss: (private) Used by the internal configuration code
1145 * @bssid: (private) Used by the internal configuration code
1146 * @ssid: (private) Used by the internal configuration code
1147 * @ssid_len: (private) Used by the internal configuration code
1148 * @wext: (private) Used by the internal wireless extensions compat code
1149 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1150 */
1151struct wireless_dev {
1152 struct wiphy *wiphy;
1153 enum nl80211_iftype iftype;
1154
1155 /* private to the generic wireless code */
1156 struct list_head list;
1157 struct net_device *netdev;
1158
1159 /* currently used for IBSS - might be rearranged in the future */
1160 struct cfg80211_bss *current_bss;
1161 u8 bssid[ETH_ALEN];
1162 u8 ssid[IEEE80211_MAX_SSID_LEN];
1163 u8 ssid_len;
1164
1165#ifdef CONFIG_WIRELESS_EXT
1166 /* wext data */
1167 struct {
1168 struct cfg80211_ibss_params ibss;
1169 u8 bssid[ETH_ALEN];
1170 s8 default_key, default_mgmt_key;
1171 } wext;
1172#endif
1173};
1174
1175/**
1176 * wdev_priv - return wiphy priv from wireless_dev
1177 *
1178 * @wdev: The wireless device whose wiphy's priv pointer to return
1179 */
1180static inline void *wdev_priv(struct wireless_dev *wdev)
1181{
1182 BUG_ON(!wdev);
1183 return wiphy_priv(wdev->wiphy);
1184}
1185
1186/*
1187 * Utility functions
1188 */
1189
1190/**
1191 * ieee80211_channel_to_frequency - convert channel number to frequency
1192 */
1193extern int ieee80211_channel_to_frequency(int chan);
1194
1195/**
1196 * ieee80211_frequency_to_channel - convert frequency to channel number
1197 */
1198extern int ieee80211_frequency_to_channel(int freq);
1199
1200/*
1201 * Name indirection necessary because the ieee80211 code also has
1202 * a function named "ieee80211_get_channel", so if you include
1203 * cfg80211's header file you get cfg80211's version, if you try
1204 * to include both header files you'll (rightfully!) get a symbol
1205 * clash.
1206 */
1207extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1208 int freq);
1209/**
1210 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1211 */
1212static inline struct ieee80211_channel *
1213ieee80211_get_channel(struct wiphy *wiphy, int freq)
1214{
1215 return __ieee80211_get_channel(wiphy, freq);
1216}
1217
1218/**
1219 * ieee80211_get_response_rate - get basic rate for a given rate
1220 *
1221 * @sband: the band to look for rates in
1222 * @basic_rates: bitmap of basic rates
1223 * @bitrate: the bitrate for which to find the basic rate
1224 *
1225 * This function returns the basic rate corresponding to a given
1226 * bitrate, that is the next lower bitrate contained in the basic
1227 * rate map, which is, for this function, given as a bitmap of
1228 * indices of rates in the band's bitrate table.
1229 */
1230struct ieee80211_rate *
1231ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1232 u32 basic_rates, int bitrate);
1233
1234/*
1235 * Radiotap parsing functions -- for controlled injection support
1236 *
1237 * Implemented in net/wireless/radiotap.c
1238 * Documentation in Documentation/networking/radiotap-headers.txt
1239 */
1240
1241/**
1242 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1243 * @rtheader: pointer to the radiotap header we are walking through
1244 * @max_length: length of radiotap header in cpu byte ordering
1245 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
1246 * @this_arg: pointer to current radiotap arg
1247 * @arg_index: internal next argument index
1248 * @arg: internal next argument pointer
1249 * @next_bitmap: internal pointer to next present u32
1250 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1251 */
1252
1253struct ieee80211_radiotap_iterator {
1254 struct ieee80211_radiotap_header *rtheader;
1255 int max_length;
1256 int this_arg_index;
1257 u8 *this_arg;
1258
1259 int arg_index;
1260 u8 *arg;
1261 __le32 *next_bitmap;
1262 u32 bitmap_shifter;
1263};
1264
1265extern int ieee80211_radiotap_iterator_init(
1266 struct ieee80211_radiotap_iterator *iterator,
1267 struct ieee80211_radiotap_header *radiotap_header,
1268 int max_length);
1269
1270extern int ieee80211_radiotap_iterator_next(
1271 struct ieee80211_radiotap_iterator *iterator);
1272
1273extern const unsigned char rfc1042_header[6];
1274extern const unsigned char bridge_tunnel_header[6];
1275
1276/**
1277 * ieee80211_get_hdrlen_from_skb - get header length from data
1278 *
1279 * Given an skb with a raw 802.11 header at the data pointer this function
1280 * returns the 802.11 header length in bytes (not including encryption
1281 * headers). If the data in the sk_buff is too short to contain a valid 802.11
1282 * header the function returns 0.
1283 *
1284 * @skb: the frame
1285 */
1286unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1287
1288/**
1289 * ieee80211_hdrlen - get header length in bytes from frame control
1290 * @fc: frame control field in little-endian format
1291 */
1292unsigned int ieee80211_hdrlen(__le16 fc);
1293
1294/**
1295 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
1296 * @skb: the 802.11 data frame
1297 * @addr: the device MAC address
1298 * @iftype: the virtual interface type
1299 */
1300int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
1301 enum nl80211_iftype iftype);
1302
1303/**
1304 * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
1305 * @skb: the 802.3 frame
1306 * @addr: the device MAC address
1307 * @iftype: the virtual interface type
1308 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
1309 * @qos: build 802.11 QoS data frame
1310 */
1311int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr,
1312 enum nl80211_iftype iftype, u8 *bssid, bool qos);
1313
1314/**
1315 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
1316 * @skb: the data frame
1317 */
1318unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1319
1320/*
1321 * Regulatory helper functions for wiphys
1322 */
1323
1324/**
1325 * regulatory_hint - driver hint to the wireless core a regulatory domain
1326 * @wiphy: the wireless device giving the hint (used only for reporting
1327 * conflicts)
1328 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
1329 * should be in. If @rd is set this should be NULL. Note that if you
1330 * set this to NULL you should still set rd->alpha2 to some accepted
1331 * alpha2.
1332 *
1333 * Wireless drivers can use this function to hint to the wireless core
1334 * what it believes should be the current regulatory domain by
1335 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
1336 * domain should be in or by providing a completely build regulatory domain.
1337 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
1338 * for a regulatory domain structure for the respective country.
1339 *
1340 * The wiphy must have been registered to cfg80211 prior to this call.
1341 * For cfg80211 drivers this means you must first use wiphy_register(),
1342 * for mac80211 drivers you must first use ieee80211_register_hw().
1343 *
1344 * Drivers should check the return value, its possible you can get
1345 * an -ENOMEM.
1346 */
1347extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1348
1349/**
1350 * regulatory_hint_11d - hints a country IE as a regulatory domain
1351 * @wiphy: the wireless device giving the hint (used only for reporting
1352 * conflicts)
1353 * @country_ie: pointer to the country IE
1354 * @country_ie_len: length of the country IE
1355 *
1356 * We will intersect the rd with the what CRDA tells us should apply
1357 * for the alpha2 this country IE belongs to, this prevents APs from
1358 * sending us incorrect or outdated information against a country.
1359 */
1360extern void regulatory_hint_11d(struct wiphy *wiphy,
1361 u8 *country_ie,
1362 u8 country_ie_len);
1363/**
1364 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1365 * @wiphy: the wireless device we want to process the regulatory domain on
1366 * @regd: the custom regulatory domain to use for this wiphy
1367 *
1368 * Drivers can sometimes have custom regulatory domains which do not apply
1369 * to a specific country. Drivers can use this to apply such custom regulatory
1370 * domains. This routine must be called prior to wiphy registration. The
1371 * custom regulatory domain will be trusted completely and as such previous
1372 * default channel settings will be disregarded. If no rule is found for a
1373 * channel on the regulatory domain the channel will be disabled.
1374 */
1375extern void wiphy_apply_custom_regulatory(
1376 struct wiphy *wiphy,
1377 const struct ieee80211_regdomain *regd);
1378
1379/**
1380 * freq_reg_info - get regulatory information for the given frequency
1381 * @wiphy: the wiphy for which we want to process this rule for
1382 * @center_freq: Frequency in KHz for which we want regulatory information for
1383 * @desired_bw_khz: the desired max bandwidth you want to use per
1384 * channel. Note that this is still 20 MHz if you want to use HT40
1385 * as HT40 makes use of two channels for its 40 MHz width bandwidth.
1386 * If set to 0 we'll assume you want the standard 20 MHz.
1387 * @reg_rule: the regulatory rule which we have for this frequency
1388 *
1389 * Use this function to get the regulatory rule for a specific frequency on
1390 * a given wireless device. If the device has a specific regulatory domain
1391 * it wants to follow we respect that unless a country IE has been received
1392 * and processed already.
1393 *
1394 * Returns 0 if it was able to find a valid regulatory rule which does
1395 * apply to the given center_freq otherwise it returns non-zero. It will
1396 * also return -ERANGE if we determine the given center_freq does not even have
1397 * a regulatory rule for a frequency range in the center_freq's band. See
1398 * freq_in_rule_band() for our current definition of a band -- this is purely
1399 * subjective and right now its 802.11 specific.
1400 */
1401extern int freq_reg_info(struct wiphy *wiphy,
1402 u32 center_freq,
1403 u32 desired_bw_khz,
1404 const struct ieee80211_reg_rule **reg_rule);
1405
1406/*
1407 * Temporary wext handlers & helper functions
1408 *
1409 * In the future cfg80211 will simply assign the entire wext handler
1410 * structure to netdevs it manages, but we're not there yet.
1411 */
824int cfg80211_wext_giwname(struct net_device *dev, 1412int cfg80211_wext_giwname(struct net_device *dev,
825 struct iw_request_info *info, 1413 struct iw_request_info *info,
826 char *name, char *extra); 1414 char *name, char *extra);
@@ -834,9 +1422,72 @@ int cfg80211_wext_siwscan(struct net_device *dev,
834int cfg80211_wext_giwscan(struct net_device *dev, 1422int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info, 1423 struct iw_request_info *info,
836 struct iw_point *data, char *extra); 1424 struct iw_point *data, char *extra);
1425int cfg80211_wext_siwmlme(struct net_device *dev,
1426 struct iw_request_info *info,
1427 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev, 1428int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info, 1429 struct iw_request_info *info,
839 struct iw_point *data, char *extra); 1430 struct iw_point *data, char *extra);
1431int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
1432 struct iw_request_info *info,
1433 struct iw_freq *freq, char *extra);
1434int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
1435 struct iw_request_info *info,
1436 struct iw_freq *freq, char *extra);
1437int cfg80211_ibss_wext_siwessid(struct net_device *dev,
1438 struct iw_request_info *info,
1439 struct iw_point *data, char *ssid);
1440int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1441 struct iw_request_info *info,
1442 struct iw_point *data, char *ssid);
1443int cfg80211_ibss_wext_siwap(struct net_device *dev,
1444 struct iw_request_info *info,
1445 struct sockaddr *ap_addr, char *extra);
1446int cfg80211_ibss_wext_giwap(struct net_device *dev,
1447 struct iw_request_info *info,
1448 struct sockaddr *ap_addr, char *extra);
1449
1450struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
1451 struct iw_freq *freq);
1452
1453int cfg80211_wext_siwrts(struct net_device *dev,
1454 struct iw_request_info *info,
1455 struct iw_param *rts, char *extra);
1456int cfg80211_wext_giwrts(struct net_device *dev,
1457 struct iw_request_info *info,
1458 struct iw_param *rts, char *extra);
1459int cfg80211_wext_siwfrag(struct net_device *dev,
1460 struct iw_request_info *info,
1461 struct iw_param *frag, char *extra);
1462int cfg80211_wext_giwfrag(struct net_device *dev,
1463 struct iw_request_info *info,
1464 struct iw_param *frag, char *extra);
1465int cfg80211_wext_siwretry(struct net_device *dev,
1466 struct iw_request_info *info,
1467 struct iw_param *retry, char *extra);
1468int cfg80211_wext_giwretry(struct net_device *dev,
1469 struct iw_request_info *info,
1470 struct iw_param *retry, char *extra);
1471int cfg80211_wext_siwencodeext(struct net_device *dev,
1472 struct iw_request_info *info,
1473 struct iw_point *erq, char *extra);
1474int cfg80211_wext_siwencode(struct net_device *dev,
1475 struct iw_request_info *info,
1476 struct iw_point *erq, char *keybuf);
1477int cfg80211_wext_giwencode(struct net_device *dev,
1478 struct iw_request_info *info,
1479 struct iw_point *erq, char *keybuf);
1480int cfg80211_wext_siwtxpower(struct net_device *dev,
1481 struct iw_request_info *info,
1482 union iwreq_data *data, char *keybuf);
1483int cfg80211_wext_giwtxpower(struct net_device *dev,
1484 struct iw_request_info *info,
1485 union iwreq_data *data, char *keybuf);
1486
1487/*
1488 * callbacks for asynchronous cfg80211 methods, notification
1489 * functions and BSS handling helpers
1490 */
840 1491
841/** 1492/**
842 * cfg80211_scan_done - notify that scan finished 1493 * cfg80211_scan_done - notify that scan finished
@@ -864,6 +1515,14 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
864 struct ieee80211_mgmt *mgmt, size_t len, 1515 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp); 1516 s32 signal, gfp_t gfp);
866 1517
1518struct cfg80211_bss*
1519cfg80211_inform_bss(struct wiphy *wiphy,
1520 struct ieee80211_channel *channel,
1521 const u8 *bssid,
1522 u64 timestamp, u16 capability, u16 beacon_interval,
1523 const u8 *ie, size_t ielen,
1524 s32 signal, gfp_t gfp);
1525
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 1526struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel, 1527 struct ieee80211_channel *channel,
869 const u8 *bssid, 1528 const u8 *bssid,
@@ -883,6 +1542,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
883 const u8 *meshid, size_t meshidlen, 1542 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg); 1543 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss); 1544void cfg80211_put_bss(struct cfg80211_bss *bss);
1545
886/** 1546/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures 1547 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy 1548 * @wiphy: the wiphy
@@ -902,44 +1562,62 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
902 * @len: length of the frame data 1562 * @len: length of the frame data
903 * 1563 *
904 * This function is called whenever an authentication has been processed in 1564 * This function is called whenever an authentication has been processed in
905 * station mode. 1565 * station mode. The driver is required to call either this function or
1566 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1567 * call.
906 */ 1568 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1569void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908 1570
909/** 1571/**
1572 * cfg80211_send_auth_timeout - notification of timed out authentication
1573 * @dev: network device
1574 * @addr: The MAC address of the device with which the authentication timed out
1575 */
1576void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1577
1578/**
910 * cfg80211_send_rx_assoc - notification of processed association 1579 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device 1580 * @dev: network device
912 * @buf: (re)association response frame (header + body) 1581 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data 1582 * @len: length of the frame data
914 * 1583 *
915 * This function is called whenever a (re)association response has been 1584 * This function is called whenever a (re)association response has been
916 * processed in station mode. 1585 * processed in station mode. The driver is required to call either this
1586 * function or cfg80211_send_assoc_timeout() to indicate the result of
1587 * cfg80211_ops::assoc() call.
917 */ 1588 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1589void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919 1590
920/** 1591/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication 1592 * cfg80211_send_assoc_timeout - notification of timed out association
1593 * @dev: network device
1594 * @addr: The MAC address of the device with which the association timed out
1595 */
1596void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1597
1598/**
1599 * cfg80211_send_deauth - notification of processed deauthentication
922 * @dev: network device 1600 * @dev: network device
923 * @buf: deauthentication frame (header + body) 1601 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data 1602 * @len: length of the frame data
925 * 1603 *
926 * This function is called whenever deauthentication has been processed in 1604 * This function is called whenever deauthentication has been processed in
927 * station mode. 1605 * station mode. This includes both received deauthentication frames and
1606 * locally generated ones.
928 */ 1607 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf, 1608void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
930 size_t len);
931 1609
932/** 1610/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation 1611 * cfg80211_send_disassoc - notification of processed disassociation
934 * @dev: network device 1612 * @dev: network device
935 * @buf: disassociation response frame (header + body) 1613 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data 1614 * @len: length of the frame data
937 * 1615 *
938 * This function is called whenever disassociation has been processed in 1616 * This function is called whenever disassociation has been processed in
939 * station mode. 1617 * station mode. This includes both received disassociation frames and locally
1618 * generated ones.
940 */ 1619 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf, 1620void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
942 size_t len);
943 1621
944/** 1622/**
945 * cfg80211_hold_bss - exclude bss from expiration 1623 * cfg80211_hold_bss - exclude bss from expiration
@@ -958,4 +1636,55 @@ void cfg80211_hold_bss(struct cfg80211_bss *bss);
958 */ 1636 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1637void cfg80211_unhold_bss(struct cfg80211_bss *bss);
960 1638
1639/**
1640 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
1641 * @dev: network device
1642 * @addr: The source MAC address of the frame
1643 * @key_type: The key type that the received frame used
1644 * @key_id: Key identifier (0..3)
1645 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1646 *
1647 * This function is called whenever the local MAC detects a MIC failure in a
1648 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
1649 * primitive.
1650 */
1651void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1652 enum nl80211_key_type key_type, int key_id,
1653 const u8 *tsc);
1654
1655/**
1656 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
1657 *
1658 * @dev: network device
1659 * @bssid: the BSSID of the IBSS joined
1660 * @gfp: allocation flags
1661 *
1662 * This function notifies cfg80211 that the device joined an IBSS or
1663 * switched to a different BSSID. Before this function can be called,
1664 * either a beacon has to have been received from the IBSS, or one of
1665 * the cfg80211_inform_bss{,_frame} functions must have been called
1666 * with the locally generated beacon -- this guarantees that there is
1667 * always a scan result for this IBSS. cfg80211 will handle the rest.
1668 */
1669void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
1670
1671/**
1672 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
1673 * @wiphy: the wiphy
1674 * @blocked: block status
1675 */
1676void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
1677
1678/**
1679 * wiphy_rfkill_start_polling - start polling rfkill
1680 * @wiphy: the wiphy
1681 */
1682void wiphy_rfkill_start_polling(struct wiphy *wiphy);
1683
1684/**
1685 * wiphy_rfkill_stop_polling - stop polling rfkill
1686 * @wiphy: the wiphy
1687 */
1688void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
1689
961#endif /* __NET_CFG80211_H */ 1690#endif /* __NET_CFG80211_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 6be3b082a070..7fc409c19b37 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -195,6 +195,12 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
195} 195}
196 196
197extern void dst_release(struct dst_entry *dst); 197extern void dst_release(struct dst_entry *dst);
198static inline void skb_dst_drop(struct sk_buff *skb)
199{
200 if (skb->_skb_dst)
201 dst_release(skb_dst(skb));
202 skb->_skb_dst = 0UL;
203}
198 204
199/* Children define the path of the packet through the 205/* Children define the path of the packet through the
200 * Linux networking. Thus, destinations are stackable. 206 * Linux networking. Thus, destinations are stackable.
@@ -246,7 +252,7 @@ static inline void dst_negative_advice(struct dst_entry **dst_p)
246 252
247static inline void dst_link_failure(struct sk_buff *skb) 253static inline void dst_link_failure(struct sk_buff *skb)
248{ 254{
249 struct dst_entry * dst = skb->dst; 255 struct dst_entry *dst = skb_dst(skb);
250 if (dst && dst->ops && dst->ops->link_failure) 256 if (dst && dst->ops && dst->ops->link_failure)
251 dst->ops->link_failure(skb); 257 dst->ops->link_failure(skb);
252} 258}
@@ -265,13 +271,13 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
265/* Output packet to network from transport. */ 271/* Output packet to network from transport. */
266static inline int dst_output(struct sk_buff *skb) 272static inline int dst_output(struct sk_buff *skb)
267{ 273{
268 return skb->dst->output(skb); 274 return skb_dst(skb)->output(skb);
269} 275}
270 276
271/* Input packet from network to transport. */ 277/* Input packet from network to transport. */
272static inline int dst_input(struct sk_buff *skb) 278static inline int dst_input(struct sk_buff *skb)
273{ 279{
274 return skb->dst->input(skb); 280 return skb_dst(skb)->input(skb);
275} 281}
276 282
277static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) 283static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c2bb5cae6515..ca4b2e840078 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -48,14 +48,12 @@ struct fib_rules_ops
48 struct flowi *, int); 48 struct flowi *, int);
49 int (*configure)(struct fib_rule *, 49 int (*configure)(struct fib_rule *,
50 struct sk_buff *, 50 struct sk_buff *,
51 struct nlmsghdr *,
52 struct fib_rule_hdr *, 51 struct fib_rule_hdr *,
53 struct nlattr **); 52 struct nlattr **);
54 int (*compare)(struct fib_rule *, 53 int (*compare)(struct fib_rule *,
55 struct fib_rule_hdr *, 54 struct fib_rule_hdr *,
56 struct nlattr **); 55 struct nlattr **);
57 int (*fill)(struct fib_rule *, struct sk_buff *, 56 int (*fill)(struct fib_rule *, struct sk_buff *,
58 struct nlmsghdr *,
59 struct fib_rule_hdr *); 57 struct fib_rule_hdr *);
60 u32 (*default_pref)(struct fib_rules_ops *ops); 58 u32 (*default_pref)(struct fib_rules_ops *ops);
61 size_t (*nlmsg_payload)(struct fib_rule *); 59 size_t (*nlmsg_payload)(struct fib_rule *);
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 747c255d1df0..1b0e3ee4ddd8 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -88,6 +88,8 @@ struct genl_ops
88}; 88};
89 89
90extern int genl_register_family(struct genl_family *family); 90extern int genl_register_family(struct genl_family *family);
91extern int genl_register_family_with_ops(struct genl_family *family,
92 struct genl_ops *ops, size_t n_ops);
91extern int genl_unregister_family(struct genl_family *family); 93extern int genl_unregister_family(struct genl_family *family);
92extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 94extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
93extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 95extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/ieee802154/af_ieee802154.h
new file mode 100644
index 000000000000..0d78605fb1a6
--- /dev/null
+++ b/include/net/ieee802154/af_ieee802154.h
@@ -0,0 +1,60 @@
1/*
2 * IEEE 802.15.4 inteface for userspace
3 *
4 * Copyright 2007, 2008 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Sergey Lapin <slapin@ossfans.org>
21 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
22 */
23
24#ifndef _AF_IEEE802154_H
25#define _AF_IEEE802154_H
26
27#include <linux/socket.h> /* for sa_family_t */
28
29enum {
30 IEEE802154_ADDR_NONE = 0x0,
31 /* RESERVED = 0x01, */
32 IEEE802154_ADDR_SHORT = 0x2, /* 16-bit address + PANid */
33 IEEE802154_ADDR_LONG = 0x3, /* 64-bit address + PANid */
34};
35
36/* address length, octets */
37#define IEEE802154_ADDR_LEN 8
38
39struct ieee802154_addr {
40 int addr_type;
41 u16 pan_id;
42 union {
43 u8 hwaddr[IEEE802154_ADDR_LEN];
44 u16 short_addr;
45 };
46};
47
48#define IEEE802154_PANID_BROADCAST 0xffff
49#define IEEE802154_ADDR_BROADCAST 0xffff
50#define IEEE802154_ADDR_UNDEF 0xfffe
51
52struct sockaddr_ieee802154 {
53 sa_family_t family; /* AF_IEEE802154 */
54 struct ieee802154_addr addr;
55};
56
57/* master device */
58#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0)
59
60#endif
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154/mac_def.h
new file mode 100644
index 000000000000..8cb684635650
--- /dev/null
+++ b/include/net/ieee802154/mac_def.h
@@ -0,0 +1,160 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007, 2008 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */
25
26#ifndef IEEE802154_MAC_DEF_H
27#define IEEE802154_MAC_DEF_H
28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
31#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
32#define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */
33
34#define IEEE802154_FC_TYPE_SHIFT 0
35#define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1)
36#define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT)
37#define IEEE802154_FC_SET_TYPE(v, x) do { \
38 v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \
39 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
40 } while (0)
41
42#define IEEE802154_FC_SECEN (1 << 3)
43#define IEEE802154_FC_FRPEND (1 << 4)
44#define IEEE802154_FC_ACK_REQ (1 << 5)
45#define IEEE802154_FC_INTRA_PAN (1 << 6)
46
47#define IEEE802154_FC_SAMODE_SHIFT 14
48#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
49#define IEEE802154_FC_DAMODE_SHIFT 10
50#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
51
52#define IEEE802154_FC_SAMODE(x) \
53 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
54
55#define IEEE802154_FC_DAMODE(x) \
56 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
57
58
59/* MAC's Command Frames Identifiers */
60#define IEEE802154_CMD_ASSOCIATION_REQ 0x01
61#define IEEE802154_CMD_ASSOCIATION_RESP 0x02
62#define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03
63#define IEEE802154_CMD_DATA_REQ 0x04
64#define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05
65#define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
66#define IEEE802154_CMD_BEACON_REQ 0x07
67#define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08
68#define IEEE802154_CMD_GTS_REQ 0x09
69
70/*
71 * The return values of MAC operations
72 */
73enum {
74 /*
75 * The requested operation was completed successfully.
76 * For a transmission request, this value indicates
77 * a successful transmission.
78 */
79 IEEE802154_SUCCESS = 0x0,
80
81 /* The beacon was lost following a synchronization request. */
82 IEEE802154_BEACON_LOSS = 0xe0,
83 /*
84 * A transmission could not take place due to activity on the
85 * channel, i.e., the CSMA-CA mechanism has failed.
86 */
87 IEEE802154_CHNL_ACCESS_FAIL = 0xe1,
88 /* The GTS request has been denied by the PAN coordinator. */
89 IEEE802154_DENINED = 0xe2,
90 /* The attempt to disable the transceiver has failed. */
91 IEEE802154_DISABLE_TRX_FAIL = 0xe3,
92 /*
93 * The received frame induces a failed security check according to
94 * the security suite.
95 */
96 IEEE802154_FAILED_SECURITY_CHECK = 0xe4,
97 /*
98 * The frame resulting from secure processing has a length that is
99 * greater than aMACMaxFrameSize.
100 */
101 IEEE802154_FRAME_TOO_LONG = 0xe5,
102 /*
103 * The requested GTS transmission failed because the specified GTS
104 * either did not have a transmit GTS direction or was not defined.
105 */
106 IEEE802154_INVALID_GTS = 0xe6,
107 /*
108 * A request to purge an MSDU from the transaction queue was made using
109 * an MSDU handle that was not found in the transaction table.
110 */
111 IEEE802154_INVALID_HANDLE = 0xe7,
112 /* A parameter in the primitive is out of the valid range.*/
113 IEEE802154_INVALID_PARAMETER = 0xe8,
114 /* No acknowledgment was received after aMaxFrameRetries. */
115 IEEE802154_NO_ACK = 0xe9,
116 /* A scan operation failed to find any network beacons.*/
117 IEEE802154_NO_BEACON = 0xea,
118 /* No response data were available following a request. */
119 IEEE802154_NO_DATA = 0xeb,
120 /* The operation failed because a short address was not allocated. */
121 IEEE802154_NO_SHORT_ADDRESS = 0xec,
122 /*
123 * A receiver enable request was unsuccessful because it could not be
124 * completed within the CAP.
125 */
126 IEEE802154_OUT_OF_CAP = 0xed,
127 /*
128 * A PAN identifier conflict has been detected and communicated to the
129 * PAN coordinator.
130 */
131 IEEE802154_PANID_CONFLICT = 0xee,
132 /* A coordinator realignment command has been received. */
133 IEEE802154_REALIGMENT = 0xef,
134 /* The transaction has expired and its information discarded. */
135 IEEE802154_TRANSACTION_EXPIRED = 0xf0,
136 /* There is no capacity to store the transaction. */
137 IEEE802154_TRANSACTION_OVERFLOW = 0xf1,
138 /*
139 * The transceiver was in the transmitter enabled state when the
140 * receiver was requested to be enabled.
141 */
142 IEEE802154_TX_ACTIVE = 0xf2,
143 /* The appropriate key is not available in the ACL. */
144 IEEE802154_UNAVAILABLE_KEY = 0xf3,
145 /*
146 * A SET/GET request was issued with the identifier of a PIB attribute
147 * that is not supported.
148 */
149 IEEE802154_UNSUPPORTED_ATTR = 0xf4,
150 /*
151 * A request to perform a scan operation failed because the MLME was
152 * in the process of performing a previously initiated scan operation.
153 */
154 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
155};
156
157
158#endif
159
160
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154/netdevice.h
new file mode 100644
index 000000000000..e2506af3e7c8
--- /dev/null
+++ b/include/net/ieee802154/netdevice.h
@@ -0,0 +1,115 @@
1/*
2 * An interface between IEEE802.15.4 device and rest of the kernel.
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */
25
26#ifndef IEEE802154_NETDEVICE_H
27#define IEEE802154_NETDEVICE_H
28
29/*
30 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts.
32 */
33struct ieee802154_mac_cb {
34 u8 lqi;
35 struct ieee802154_addr sa;
36 struct ieee802154_addr da;
37 u8 flags;
38 u8 seq;
39};
40
41static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
42{
43 return (struct ieee802154_mac_cb *)skb->cb;
44}
45
46#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1)
47
48#define MAC_CB_FLAG_ACKREQ (1 << 3)
49#define MAC_CB_FLAG_SECEN (1 << 4)
50#define MAC_CB_FLAG_INTRAPAN (1 << 5)
51
52static inline int mac_cb_is_ackreq(struct sk_buff *skb)
53{
54 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
55}
56
57static inline int mac_cb_is_secen(struct sk_buff *skb)
58{
59 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
60}
61
62static inline int mac_cb_is_intrapan(struct sk_buff *skb)
63{
64 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
65}
66
67static inline int mac_cb_type(struct sk_buff *skb)
68{
69 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
70}
71
72#define IEEE802154_MAC_SCAN_ED 0
73#define IEEE802154_MAC_SCAN_ACTIVE 1
74#define IEEE802154_MAC_SCAN_PASSIVE 2
75#define IEEE802154_MAC_SCAN_ORPHAN 3
76
77/*
78 * This should be located at net_device->ml_priv
79 */
80struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev,
82 struct ieee802154_addr *addr,
83 u8 channel, u8 cap);
84 int (*assoc_resp)(struct net_device *dev,
85 struct ieee802154_addr *addr,
86 u16 short_addr, u8 status);
87 int (*disassoc_req)(struct net_device *dev,
88 struct ieee802154_addr *addr,
89 u8 reason);
90 int (*start_req)(struct net_device *dev,
91 struct ieee802154_addr *addr,
92 u8 channel, u8 bcn_ord, u8 sf_ord,
93 u8 pan_coord, u8 blx, u8 coord_realign);
94 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 duration);
96
97 /*
98 * FIXME: these should become the part of PIB/MIB interface.
99 * However we still don't have IB interface of any kind
100 */
101 u16 (*get_pan_id)(struct net_device *dev);
102 u16 (*get_short_addr)(struct net_device *dev);
103 u8 (*get_dsn)(struct net_device *dev);
104 u8 (*get_bsn)(struct net_device *dev);
105};
106
107static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops(
108 struct net_device *dev)
109{
110 return dev->ml_priv;
111}
112
113#endif
114
115
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
new file mode 100644
index 000000000000..78efcdf52b59
--- /dev/null
+++ b/include/net/ieee802154/nl802154.h
@@ -0,0 +1,41 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index f74665d7bea8..22c73a77cd99 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -100,7 +100,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
100 100
101 if (unlikely(sk = skb_steal_sock(skb))) 101 if (unlikely(sk = skb_steal_sock(skb)))
102 return sk; 102 return sk;
103 else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, 103 else return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
104 &ipv6_hdr(skb)->saddr, sport, 104 &ipv6_hdr(skb)->saddr, sport,
105 &ipv6_hdr(skb)->daddr, ntohs(dport), 105 &ipv6_hdr(skb)->daddr, ntohs(dport),
106 inet6_iif(skb)); 106 inet6_iif(skb));
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index a44e2248b2ef..d522dcf3031a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -385,7 +385,7 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
385 if (unlikely(sk = skb_steal_sock(skb))) 385 if (unlikely(sk = skb_steal_sock(skb)))
386 return sk; 386 return sk;
387 else 387 else
388 return __inet_lookup(dev_net(skb->dst->dev), hashinfo, 388 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
389 iph->saddr, sport, 389 iph->saddr, sport,
390 iph->daddr, dport, inet_iif(skb)); 390 iph->daddr, dport, inet_iif(skb));
391} 391}
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index de0ecc71cf03..47004f35cc7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -17,6 +17,7 @@
17#define _INET_SOCK_H 17#define _INET_SOCK_H
18 18
19 19
20#include <linux/kmemcheck.h>
20#include <linux/string.h> 21#include <linux/string.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/jhash.h> 23#include <linux/jhash.h>
@@ -66,14 +67,16 @@ struct inet_request_sock {
66 __be32 loc_addr; 67 __be32 loc_addr;
67 __be32 rmt_addr; 68 __be32 rmt_addr;
68 __be16 rmt_port; 69 __be16 rmt_port;
69 u16 snd_wscale : 4, 70 kmemcheck_bitfield_begin(flags);
70 rcv_wscale : 4, 71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
71 tstamp_ok : 1, 73 tstamp_ok : 1,
72 sack_ok : 1, 74 sack_ok : 1,
73 wscale_ok : 1, 75 wscale_ok : 1,
74 ecn_ok : 1, 76 ecn_ok : 1,
75 acked : 1, 77 acked : 1,
76 no_srccheck: 1; 78 no_srccheck: 1;
79 kmemcheck_bitfield_end(flags);
77 struct ip_options *opt; 80 struct ip_options *opt;
78}; 81};
79 82
@@ -130,7 +133,8 @@ struct inet_sock {
130 freebind:1, 133 freebind:1,
131 hdrincl:1, 134 hdrincl:1,
132 mc_loop:1, 135 mc_loop:1,
133 transparent:1; 136 transparent:1,
137 mc_all:1;
134 int mc_index; 138 int mc_index;
135 __be32 mc_addr; 139 __be32 mc_addr;
136 struct ip_mc_socklist *mc_list; 140 struct ip_mc_socklist *mc_list;
@@ -198,9 +202,12 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
198static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 202static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
199{ 203{
200 struct request_sock *req = reqsk_alloc(ops); 204 struct request_sock *req = reqsk_alloc(ops);
205 struct inet_request_sock *ireq = inet_rsk(req);
201 206
202 if (req != NULL) 207 if (req != NULL) {
203 inet_rsk(req)->opt = NULL; 208 kmemcheck_annotate_bitfield(ireq, flags);
209 ireq->opt = NULL;
210 }
204 211
205 return req; 212 return req;
206} 213}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 4b8ece22b8e9..b63b80fac567 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -16,6 +16,7 @@
16#define _INET_TIMEWAIT_SOCK_ 16#define _INET_TIMEWAIT_SOCK_
17 17
18 18
19#include <linux/kmemcheck.h>
19#include <linux/list.h> 20#include <linux/list.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/timer.h> 22#include <linux/timer.h>
@@ -127,10 +128,12 @@ struct inet_timewait_sock {
127 __be32 tw_rcv_saddr; 128 __be32 tw_rcv_saddr;
128 __be16 tw_dport; 129 __be16 tw_dport;
129 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags);
130 /* And these are ours. */ 132 /* And these are ours. */
131 __u8 tw_ipv6only:1, 133 __u8 tw_ipv6only:1,
132 tw_transparent:1; 134 tw_transparent:1;
133 /* 15 bits hole, try to pack */ 135 /* 14 bits hole, try to pack */
136 kmemcheck_bitfield_end(flags);
134 __u16 tw_ipv6_offset; 137 __u16 tw_ipv6_offset;
135 unsigned long tw_ttd; 138 unsigned long tw_ttd;
136 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
diff --git a/include/net/ip.h b/include/net/ip.h
index 4ac7577f98d0..72c36926c26d 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -168,7 +168,10 @@ struct ipv4_config
168extern struct ipv4_config ipv4_config; 168extern struct ipv4_config ipv4_config;
169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) 169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field)
170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) 170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field)
171#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val)
171#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) 172#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val)
173#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val)
174#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val)
172#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 175#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
173#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 176#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
174#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 177#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5f53db7e4e57..0e1b8aebaff8 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -142,7 +142,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
142 142
143static inline int ipv6_unicast_destination(struct sk_buff *skb) 143static inline int ipv6_unicast_destination(struct sk_buff *skb)
144{ 144{
145 struct rt6_info *rt = (struct rt6_info *) skb->dst; 145 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
146 146
147 return rt->rt6i_flags & RTF_LOCAL; 147 return rt->rt6i_flags & RTF_LOCAL;
148} 148}
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 8b12667f7a2b..ef91fe924ba4 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -124,14 +124,12 @@ struct fib_result_nl {
124#ifdef CONFIG_IP_ROUTE_MULTIPATH 124#ifdef CONFIG_IP_ROUTE_MULTIPATH
125 125
126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) 126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
127#define FIB_RES_RESET(res) ((res).nh_sel = 0)
128 127
129#define FIB_TABLE_HASHSZ 2 128#define FIB_TABLE_HASHSZ 2
130 129
131#else /* CONFIG_IP_ROUTE_MULTIPATH */ 130#else /* CONFIG_IP_ROUTE_MULTIPATH */
132 131
133#define FIB_RES_NH(res) ((res).fi->fib_nh[0]) 132#define FIB_RES_NH(res) ((res).fi->fib_nh[0])
134#define FIB_RES_RESET(res)
135 133
136#define FIB_TABLE_HASHSZ 256 134#define FIB_TABLE_HASHSZ 256
137 135
@@ -145,7 +143,6 @@ struct fib_result_nl {
145struct fib_table { 143struct fib_table {
146 struct hlist_node tb_hlist; 144 struct hlist_node tb_hlist;
147 u32 tb_id; 145 u32 tb_id;
148 unsigned tb_stamp;
149 int tb_default; 146 int tb_default;
150 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); 147 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
151 int (*tb_insert)(struct fib_table *, struct fib_config *); 148 int (*tb_insert)(struct fib_table *, struct fib_config *);
diff --git a/include/net/ipip.h b/include/net/ipip.h
index fdf9bd743705..5d3036fa1511 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -28,11 +28,18 @@ struct ip_tunnel
28 unsigned int prl_count; /* # of entries in PRL */ 28 unsigned int prl_count; /* # of entries in PRL */
29}; 29};
30 30
31/* ISATAP: default interval between RS in secondy */
32#define IPTUNNEL_RS_DEFAULT_DELAY (900)
33
31struct ip_tunnel_prl_entry 34struct ip_tunnel_prl_entry
32{ 35{
33 struct ip_tunnel_prl_entry *next; 36 struct ip_tunnel_prl_entry *next;
34 __be32 addr; 37 __be32 addr;
35 u16 flags; 38 u16 flags;
39 unsigned long rs_delay;
40 struct timer_list rs_timer;
41 struct ip_tunnel *tunnel;
42 spinlock_t lock;
36}; 43};
37 44
38#define IPTUNNEL_XMIT() do { \ 45#define IPTUNNEL_XMIT() do { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c1f16fc49ade..f27fd83d67d8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -126,15 +126,28 @@ extern struct ctl_path net_ipv6_ctl_path[];
126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ 126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
127}) 127})
128 128
129#define _DEVUPD(net, statname, modifier, idev, field, val) \
130({ \
131 struct inet6_dev *_idev = (idev); \
132 if (likely(_idev != NULL)) \
133 SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \
134 SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\
135})
136
129/* MIBs */ 137/* MIBs */
130 138
131#define IP6_INC_STATS(net, idev,field) \ 139#define IP6_INC_STATS(net, idev,field) \
132 _DEVINC(net, ipv6, , idev, field) 140 _DEVINC(net, ipv6, , idev, field)
133#define IP6_INC_STATS_BH(net, idev,field) \ 141#define IP6_INC_STATS_BH(net, idev,field) \
134 _DEVINC(net, ipv6, _BH, idev, field) 142 _DEVINC(net, ipv6, _BH, idev, field)
143#define IP6_ADD_STATS(net, idev,field,val) \
144 _DEVADD(net, ipv6, , idev, field, val)
135#define IP6_ADD_STATS_BH(net, idev,field,val) \ 145#define IP6_ADD_STATS_BH(net, idev,field,val) \
136 _DEVADD(net, ipv6, _BH, idev, field, val) 146 _DEVADD(net, ipv6, _BH, idev, field, val)
137 147#define IP6_UPD_PO_STATS(net, idev,field,val) \
148 _DEVUPD(net, ipv6, , idev, field, val)
149#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
150 _DEVUPD(net, ipv6, _BH, idev, field, val)
138#define ICMP6_INC_STATS(net, idev, field) \ 151#define ICMP6_INC_STATS(net, idev, field) \
139 _DEVINC(net, icmpv6, , idev, field) 152 _DEVINC(net, icmpv6, , idev, field)
140#define ICMP6_INC_STATS_BH(net, idev, field) \ 153#define ICMP6_INC_STATS_BH(net, idev, field) \
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 85f80eadfa35..21ee49ffcbaf 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -73,8 +73,17 @@ struct iucv_sock {
73 struct sk_buff_head backlog_skb_q; 73 struct sk_buff_head backlog_skb_q;
74 struct sock_msg_q message_q; 74 struct sock_msg_q message_q;
75 unsigned int send_tag; 75 unsigned int send_tag;
76 u8 flags;
77 u16 msglimit;
76}; 78};
77 79
80/* iucv socket options (SOL_IUCV) */
81#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
82#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
83
84/* iucv related control messages (scm) */
85#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
86
78struct iucv_sock_list { 87struct iucv_sock_list {
79 struct hlist_head head; 88 struct hlist_head head;
80 rwlock_t lock; 89 rwlock_t lock;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3b83a80e3fe0..c06104476973 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -19,7 +19,6 @@
19#include <linux/wireless.h> 19#include <linux/wireless.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/ieee80211.h> 21#include <linux/ieee80211.h>
22#include <net/wireless.h>
23#include <net/cfg80211.h> 22#include <net/cfg80211.h>
24 23
25/** 24/**
@@ -74,22 +73,6 @@
74 */ 73 */
75 74
76/** 75/**
77 * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
78 *
79 * This structure describes most essential parameters needed
80 * to describe 802.11n HT characteristics in a BSS.
81 *
82 * @primary_channel: channel number of primery channel
83 * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width)
84 * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection)
85 */
86struct ieee80211_ht_bss_info {
87 u8 primary_channel;
88 u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */
89 u8 bss_op_mode; /* use IEEE80211_HT_IE_ */
90};
91
92/**
93 * enum ieee80211_max_queues - maximum number of queues 76 * enum ieee80211_max_queues - maximum number of queues
94 * 77 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -150,6 +133,13 @@ struct ieee80211_low_level_stats {
150 * @BSS_CHANGED_ERP_SLOT: slot timing changed 133 * @BSS_CHANGED_ERP_SLOT: slot timing changed
151 * @BSS_CHANGED_HT: 802.11n parameters changed 134 * @BSS_CHANGED_HT: 802.11n parameters changed
152 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed 135 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
136 * @BSS_CHANGED_BEACON_INT: Beacon interval changed
137 * @BSS_CHANGED_BSSID: BSSID changed, for whatever
138 * reason (IBSS and managed mode)
139 * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
140 * new beacon (beaconing modes)
141 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
142 * enabled/disabled (beaconing modes)
153 */ 143 */
154enum ieee80211_bss_change { 144enum ieee80211_bss_change {
155 BSS_CHANGED_ASSOC = 1<<0, 145 BSS_CHANGED_ASSOC = 1<<0,
@@ -158,14 +148,10 @@ enum ieee80211_bss_change {
158 BSS_CHANGED_ERP_SLOT = 1<<3, 148 BSS_CHANGED_ERP_SLOT = 1<<3,
159 BSS_CHANGED_HT = 1<<4, 149 BSS_CHANGED_HT = 1<<4,
160 BSS_CHANGED_BASIC_RATES = 1<<5, 150 BSS_CHANGED_BASIC_RATES = 1<<5,
161}; 151 BSS_CHANGED_BEACON_INT = 1<<6,
162 152 BSS_CHANGED_BSSID = 1<<7,
163/** 153 BSS_CHANGED_BEACON = 1<<8,
164 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration 154 BSS_CHANGED_BEACON_ENABLED = 1<<9,
165 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
166 */
167struct ieee80211_bss_ht_conf {
168 u16 operation_mode;
169}; 155};
170 156
171/** 157/**
@@ -187,12 +173,16 @@ struct ieee80211_bss_ht_conf {
187 * @timestamp: beacon timestamp 173 * @timestamp: beacon timestamp
188 * @beacon_int: beacon interval 174 * @beacon_int: beacon interval
189 * @assoc_capability: capabilities taken from assoc resp 175 * @assoc_capability: capabilities taken from assoc resp
190 * @ht: BSS's HT configuration
191 * @basic_rates: bitmap of basic rates, each bit stands for an 176 * @basic_rates: bitmap of basic rates, each bit stands for an
192 * index into the rate table configured by the driver in 177 * index into the rate table configured by the driver in
193 * the current band. 178 * the current band.
179 * @bssid: The BSSID for this BSS
180 * @enable_beacon: whether beaconing should be enabled or not
181 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
182 * This field is only valid when the channel type is one of the HT types.
194 */ 183 */
195struct ieee80211_bss_conf { 184struct ieee80211_bss_conf {
185 const u8 *bssid;
196 /* association related data */ 186 /* association related data */
197 bool assoc; 187 bool assoc;
198 u16 aid; 188 u16 aid;
@@ -200,12 +190,13 @@ struct ieee80211_bss_conf {
200 bool use_cts_prot; 190 bool use_cts_prot;
201 bool use_short_preamble; 191 bool use_short_preamble;
202 bool use_short_slot; 192 bool use_short_slot;
193 bool enable_beacon;
203 u8 dtim_period; 194 u8 dtim_period;
204 u16 beacon_int; 195 u16 beacon_int;
205 u16 assoc_capability; 196 u16 assoc_capability;
206 u64 timestamp; 197 u64 timestamp;
207 u32 basic_rates; 198 u32 basic_rates;
208 struct ieee80211_bss_ht_conf ht; 199 u16 ht_operation_mode;
209}; 200};
210 201
211/** 202/**
@@ -248,6 +239,8 @@ struct ieee80211_bss_conf {
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 239 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before 240 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out. 241 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS
251 */ 244 */
252enum mac80211_tx_control_flags { 245enum mac80211_tx_control_flags {
253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -265,6 +258,7 @@ enum mac80211_tx_control_flags {
265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 258 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13), 259 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15),
268}; 262};
269 263
270/** 264/**
@@ -518,52 +512,76 @@ struct ieee80211_rx_status {
518 * Flags to define PHY configuration options 512 * Flags to define PHY configuration options
519 * 513 *
520 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 514 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
521 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 515 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
516 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
517 * the driver should be prepared to handle configuration requests but
518 * may turn the device off as much as possible. Typically, this flag will
519 * be set when an interface is set UP but not associated or scanning, but
520 * it can also be unset in that case when monitor interfaces are active.
522 */ 521 */
523enum ieee80211_conf_flags { 522enum ieee80211_conf_flags {
524 IEEE80211_CONF_RADIOTAP = (1<<0), 523 IEEE80211_CONF_RADIOTAP = (1<<0),
525 IEEE80211_CONF_PS = (1<<1), 524 IEEE80211_CONF_PS = (1<<1),
525 IEEE80211_CONF_IDLE = (1<<2),
526}; 526};
527 527
528 528
529/** 529/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 531 *
532 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed 532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 536 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 537 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 538 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
541 */ 540 */
542enum ieee80211_conf_changed { 541enum ieee80211_conf_changed {
543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
544 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
547 IEEE80211_CONF_CHANGE_PS = BIT(4), 545 IEEE80211_CONF_CHANGE_PS = BIT(4),
548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5), 546 IEEE80211_CONF_CHANGE_POWER = BIT(5),
549 IEEE80211_CONF_CHANGE_POWER = BIT(6), 547 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7), 548 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8), 549 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
552}; 550};
553 551
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
554/** 560/**
555 * struct ieee80211_conf - configuration of the device 561 * struct ieee80211_conf - configuration of the device
556 * 562 *
557 * This struct indicates how the driver shall configure the hardware. 563 * This struct indicates how the driver shall configure the hardware.
558 * 564 *
565 * @flags: configuration flags defined above
566 *
559 * @radio_enabled: when zero, driver is required to switch off the radio. 567 * @radio_enabled: when zero, driver is required to switch off the radio.
560 * @beacon_int: beacon interval (TODO make interface config) 568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
561 * @listen_interval: listen interval in units of beacon interval 570 * @listen_interval: listen interval in units of beacon interval
562 * @flags: configuration flags defined above 571 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this
573 * value will be only achievable between DTIM frames, the hardware
574 * needs to check for the multicast traffic bit in DTIM beacons.
575 * This variable is valid only when the CONF_PS flag is set.
576 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
577 * powersave documentation below. This variable is valid only when
578 * the CONF_PS flag is set.
579 *
563 * @power_level: requested transmit power (in dBm) 580 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms) 581 *
565 * @channel: the channel to tune to 582 * @channel: the channel to tune to
566 * @channel_type: the channel (HT) type 583 * @channel_type: the channel (HT) type
584 *
567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 585 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 586 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
569 * but actually means the number of transmissions not the number of retries 587 * but actually means the number of transmissions not the number of retries
@@ -572,12 +590,13 @@ enum ieee80211_conf_changed {
572 * number of transmissions not the number of retries 590 * number of transmissions not the number of retries
573 */ 591 */
574struct ieee80211_conf { 592struct ieee80211_conf {
575 int beacon_int; 593 int __deprecated beacon_int;
576 u32 flags; 594 u32 flags;
577 int power_level, dynamic_ps_timeout; 595 int power_level, dynamic_ps_timeout;
596 int max_sleep_period;
578 597
579 u16 listen_interval; 598 u16 listen_interval;
580 bool radio_enabled; 599 bool __deprecated radio_enabled;
581 600
582 u8 long_frame_max_tx_count, short_frame_max_tx_count; 601 u8 long_frame_max_tx_count, short_frame_max_tx_count;
583 602
@@ -640,37 +659,6 @@ struct ieee80211_if_init_conf {
640}; 659};
641 660
642/** 661/**
643 * enum ieee80211_if_conf_change - interface config change flags
644 *
645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
649 */
650enum ieee80211_if_conf_change {
651 IEEE80211_IFCC_BSSID = BIT(0),
652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
654};
655
656/**
657 * struct ieee80211_if_conf - configuration of an interface
658 *
659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
663 *
664 * This structure is passed to the config_interface() callback of
665 * &struct ieee80211_hw.
666 */
667struct ieee80211_if_conf {
668 u32 changed;
669 const u8 *bssid;
670 bool enable_beacon;
671};
672
673/**
674 * enum ieee80211_key_alg - key algorithm 662 * enum ieee80211_key_alg - key algorithm
675 * @ALG_WEP: WEP40 or WEP104 663 * @ALG_WEP: WEP40 or WEP104
676 * @ALG_TKIP: TKIP 664 * @ALG_TKIP: TKIP
@@ -685,16 +673,6 @@ enum ieee80211_key_alg {
685}; 673};
686 674
687/** 675/**
688 * enum ieee80211_key_len - key length
689 * @LEN_WEP40: WEP 5-byte long key
690 * @LEN_WEP104: WEP 13-byte long key
691 */
692enum ieee80211_key_len {
693 LEN_WEP40 = 5,
694 LEN_WEP104 = 13,
695};
696
697/**
698 * enum ieee80211_key_flags - key flags 676 * enum ieee80211_key_flags - key flags
699 * 677 *
700 * These flags are used for communication about keys between the driver 678 * These flags are used for communication about keys between the driver
@@ -1109,11 +1087,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1109 * need software support for parsing the TIM bitmap. This is also supported 1087 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and 1088 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1089 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will 1090 * required to pass up beacons. The hardware is still required to handle
1113 * wake up the hardware when multicast traffic is announced in the beacon. 1091 * waking up for multicast traffic; if it cannot the driver must handle that
1114 * 1092 * as best as it can, mac80211 is too slow.
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 * 1093 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which 1094 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending 1095 * the hardware stays awake for a user-specified period of time after sending
@@ -1134,11 +1110,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1134 * way the host will only receive beacons where some relevant information 1110 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed. 1111 * (for example ERP protection or WMM settings) have changed.
1136 * 1112 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag. 1113 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER
1138 * The driver needs to enable beacon filter support whenever power save is 1114 * hardware capability. The driver needs to enable beacon filter support
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled, 1115 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1140 * the stack will not check for beacon miss at all and the driver needs to 1116 * power save is enabled, the stack will not check for beacon loss and the
1141 * notify about complete loss of beacons with ieee80211_beacon_loss(). 1117 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
1118 *
1119 * The time (or number of beacons missed) until the firmware notifies the
1120 * driver of a beacon loss event (which in turn causes the driver to call
1121 * ieee80211_beacon_loss()) should be configurable and will be controlled
1122 * by mac80211 and the roaming algorithm in the future.
1123 *
1124 * Since there may be constantly changing information elements that nothing
1125 * in the software stack cares about, we will, in the future, have mac80211
1126 * tell the driver which information elements are interesting in the sense
1127 * that we want to see changes in them. This will include
1128 * - a list of information element IDs
1129 * - a list of OUIs for the vendor information element
1130 *
1131 * Ideally, the hardware would filter out any beacons without changes in the
1132 * requested elements, but if it cannot support that it may, at the expense
1133 * of some efficiency, filter out only a subset. For example, if the device
1134 * doesn't support checking for OUIs it should pass up all changes in all
1135 * vendor information elements.
1136 *
1137 * Note that change, for the sake of simplification, also includes information
1138 * elements appearing or disappearing from the beacon.
1139 *
1140 * Some hardware supports an "ignore list" instead, just make sure nothing
1141 * that was requested is on the ignore list, and include commonly changing
1142 * information element IDs in the ignore list, for example 11 (BSS load) and
1143 * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
1144 * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
1145 * it could also include some currently unused IDs.
1146 *
1147 *
1148 * In addition to these capabilities, hardware should support notifying the
1149 * host of changes in the beacon RSSI. This is relevant to implement roaming
1150 * when no traffic is flowing (when traffic is flowing we see the RSSI of
1151 * the received data packets). This can consist in notifying the host when
1152 * the RSSI changes significantly or when it drops below or rises above
1153 * configurable thresholds. In the future these thresholds will also be
1154 * configured by mac80211 (which gets them from userspace) to implement
1155 * them as the roaming algorithm requires.
1156 *
1157 * If the hardware cannot implement this, the driver should ask it to
1158 * periodically pass beacon frames to the host so that software can do the
1159 * signal strength threshold checking.
1142 */ 1160 */
1143 1161
1144/** 1162/**
@@ -1298,10 +1316,6 @@ enum ieee80211_ampdu_mlme_action {
1298 * This function should never fail but returns a negative error code 1316 * This function should never fail but returns a negative error code
1299 * if it does. 1317 * if it does.
1300 * 1318 *
1301 * @config_interface: Handler for configuration requests related to interfaces
1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1304 *
1305 * @bss_info_changed: Handler for configuration requests related to BSS 1319 * @bss_info_changed: Handler for configuration requests related to BSS
1306 * parameters that may vary during BSS's lifespan, and may affect low 1320 * parameters that may vary during BSS's lifespan, and may affect low
1307 * level driver (e.g. assoc/disassoc status, erp parameters). 1321 * level driver (e.g. assoc/disassoc status, erp parameters).
@@ -1330,11 +1344,14 @@ enum ieee80211_ampdu_mlme_action {
1330 * the scan state machine in stack. The scan must honour the channel 1344 * the scan state machine in stack. The scan must honour the channel
1331 * configuration done by the regulatory agent in the wiphy's 1345 * configuration done by the regulatory agent in the wiphy's
1332 * registered bands. The hardware (or the driver) needs to make sure 1346 * registered bands. The hardware (or the driver) needs to make sure
1333 * that power save is disabled. When the scan finishes, 1347 * that power save is disabled.
1334 * ieee80211_scan_completed() must be called; note that it also must 1348 * The @req ie/ie_len members are rewritten by mac80211 to contain the
1335 * be called when the scan cannot finish because the hardware is 1349 * entire IEs after the SSID, so that drivers need not look at these
1336 * turned off! Anything else is a bug! Returns a negative error code 1350 * at all but just send them after the SSID -- mac80211 includes the
1337 * which will be seen in userspace. 1351 * (extended) supported rates and HT information (where applicable).
1352 * When the scan finishes, ieee80211_scan_completed() must be called;
1353 * note that it also must be called when the scan cannot finish due to
1354 * any error unless this callback returned a negative error code.
1338 * 1355 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan 1356 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification. 1357 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -1390,6 +1407,10 @@ enum ieee80211_ampdu_mlme_action {
1390 * is the first frame we expect to perform the action on. Notice 1407 * is the first frame we expect to perform the action on. Notice
1391 * that TX/RX_STOP can pass NULL for this parameter. 1408 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure. 1409 * Returns a negative error code on failure.
1410 *
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1393 */ 1414 */
1394struct ieee80211_ops { 1415struct ieee80211_ops {
1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1400,9 +1421,6 @@ struct ieee80211_ops {
1400 void (*remove_interface)(struct ieee80211_hw *hw, 1421 void (*remove_interface)(struct ieee80211_hw *hw,
1401 struct ieee80211_if_init_conf *conf); 1422 struct ieee80211_if_init_conf *conf);
1402 int (*config)(struct ieee80211_hw *hw, u32 changed); 1423 int (*config)(struct ieee80211_hw *hw, u32 changed);
1403 int (*config_interface)(struct ieee80211_hw *hw,
1404 struct ieee80211_vif *vif,
1405 struct ieee80211_if_conf *conf);
1406 void (*bss_info_changed)(struct ieee80211_hw *hw, 1424 void (*bss_info_changed)(struct ieee80211_hw *hw,
1407 struct ieee80211_vif *vif, 1425 struct ieee80211_vif *vif,
1408 struct ieee80211_bss_conf *info, 1426 struct ieee80211_bss_conf *info,
@@ -1441,6 +1459,8 @@ struct ieee80211_ops {
1441 int (*ampdu_action)(struct ieee80211_hw *hw, 1459 int (*ampdu_action)(struct ieee80211_hw *hw,
1442 enum ieee80211_ampdu_mlme_action action, 1460 enum ieee80211_ampdu_mlme_action action,
1443 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462
1463 void (*rfkill_poll)(struct ieee80211_hw *hw);
1444}; 1464};
1445 1465
1446/** 1466/**
@@ -1572,6 +1592,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw);
1572 */ 1592 */
1573void ieee80211_free_hw(struct ieee80211_hw *hw); 1593void ieee80211_free_hw(struct ieee80211_hw *hw);
1574 1594
1595/**
1596 * ieee80211_restart_hw - restart hardware completely
1597 *
1598 * Call this function when the hardware was restarted for some reason
1599 * (hardware error, ...) and the driver is unable to restore its state
1600 * by itself. mac80211 assumes that at this point the driver/hardware
1601 * is completely uninitialised and stopped, it starts the process by
1602 * calling the ->start() operation. The driver will need to reset all
1603 * internal state that it has prior to calling this function.
1604 *
1605 * @hw: the hardware to restart
1606 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608
1575/* trick to avoid symbol clashes with the ieee80211 subsystem */ 1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1576void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1577 struct ieee80211_rx_status *status); 1611 struct ieee80211_rx_status *status);
@@ -1775,24 +1809,6 @@ struct sk_buff *
1775ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 1809ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1776 1810
1777/** 1811/**
1778 * ieee80211_get_hdrlen_from_skb - get header length from data
1779 *
1780 * Given an skb with a raw 802.11 header at the data pointer this function
1781 * returns the 802.11 header length in bytes (not including encryption
1782 * headers). If the data in the sk_buff is too short to contain a valid 802.11
1783 * header the function returns 0.
1784 *
1785 * @skb: the frame
1786 */
1787unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1788
1789/**
1790 * ieee80211_hdrlen - get header length in bytes from frame control
1791 * @fc: frame control field in little-endian format
1792 */
1793unsigned int ieee80211_hdrlen(__le16 fc);
1794
1795/**
1796 * ieee80211_get_tkip_key - get a TKIP rc4 for skb 1812 * ieee80211_get_tkip_key - get a TKIP rc4 for skb
1797 * 1813 *
1798 * This function computes a TKIP rc4 key for an skb. It computes 1814 * This function computes a TKIP rc4 key for an skb. It computes
diff --git a/include/net/netfilter/ipv4/nf_conntrack_icmp.h b/include/net/netfilter/ipv4/nf_conntrack_icmp.h
deleted file mode 100644
index 3dd22cff23ec..000000000000
--- a/include/net/netfilter/ipv4/nf_conntrack_icmp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _NF_CONNTRACK_ICMP_H
2#define _NF_CONNTRACK_ICMP_H
3/* ICMP tracking. */
4#include <asm/atomic.h>
5
6struct ip_ct_icmp
7{
8 /* Optimization: when number in == number out, forget immediately. */
9 atomic_t count;
10};
11#endif /* _NF_CONNTRACK_ICMP_H */
diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
index 86591afda29c..67edd50a398a 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
@@ -9,7 +9,6 @@
9 9
10#ifndef _NF_CONNTRACK_ICMPV6_H 10#ifndef _NF_CONNTRACK_ICMPV6_H
11#define _NF_CONNTRACK_ICMPV6_H 11#define _NF_CONNTRACK_ICMPV6_H
12#include <asm/atomic.h>
13 12
14#ifndef ICMPV6_NI_QUERY 13#ifndef ICMPV6_NI_QUERY
15#define ICMPV6_NI_QUERY 139 14#define ICMPV6_NI_QUERY 139
@@ -18,10 +17,4 @@
18#define ICMPV6_NI_REPLY 140 17#define ICMPV6_NI_REPLY 140
19#endif 18#endif
20 19
21struct nf_ct_icmpv6
22{
23 /* Optimization: when number in == number out, forget immediately. */
24 atomic_t count;
25};
26
27#endif /* _NF_CONNTRACK_ICMPV6_H */ 20#endif /* _NF_CONNTRACK_ICMPV6_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6c3f964de9e1..a632689b61b4 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -23,7 +23,6 @@
23#include <linux/netfilter/nf_conntrack_dccp.h> 23#include <linux/netfilter/nf_conntrack_dccp.h>
24#include <linux/netfilter/nf_conntrack_sctp.h> 24#include <linux/netfilter/nf_conntrack_sctp.h>
25#include <linux/netfilter/nf_conntrack_proto_gre.h> 25#include <linux/netfilter/nf_conntrack_proto_gre.h>
26#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
27#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> 26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
28 27
29#include <net/netfilter/nf_conntrack_tuple.h> 28#include <net/netfilter/nf_conntrack_tuple.h>
@@ -34,8 +33,6 @@ union nf_conntrack_proto {
34 struct nf_ct_dccp dccp; 33 struct nf_ct_dccp dccp;
35 struct ip_ct_sctp sctp; 34 struct ip_ct_sctp sctp;
36 struct ip_ct_tcp tcp; 35 struct ip_ct_tcp tcp;
37 struct ip_ct_icmp icmp;
38 struct nf_ct_icmpv6 icmpv6;
39 struct nf_ct_gre gre; 36 struct nf_ct_gre gre;
40}; 37};
41 38
@@ -96,6 +93,8 @@ struct nf_conn {
96 plus 1 for any connection(s) we are `master' for */ 93 plus 1 for any connection(s) we are `master' for */
97 struct nf_conntrack ct_general; 94 struct nf_conntrack ct_general;
98 95
96 spinlock_t lock;
97
99 /* XXX should I move this to the tail ? - Y.K */ 98 /* XXX should I move this to the tail ? - Y.K */
100 /* These are my tuples; original and reply */ 99 /* These are my tuples; original and reply */
101 struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; 100 struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
@@ -144,6 +143,8 @@ static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct)
144 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; 143 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
145} 144}
146 145
146#define nf_ct_tuple(ct, dir) (&(ct)->tuplehash[dir].tuple)
147
147/* get master conntrack via master expectation */ 148/* get master conntrack via master expectation */
148#define master_ct(conntr) (conntr->master) 149#define master_ct(conntr) (conntr->master)
149 150
@@ -200,8 +201,10 @@ extern struct nf_conntrack_tuple_hash *
200__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 201__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
201 202
202extern void nf_conntrack_hash_insert(struct nf_conn *ct); 203extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204extern void nf_ct_delete_from_lists(struct nf_conn *ct);
205extern void nf_ct_insert_dying_list(struct nf_conn *ct);
203 206
204extern void nf_conntrack_flush(struct net *net, u32 pid, int report); 207extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report);
205 208
206extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 209extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
207 unsigned int nhoff, u_int16_t l3num, 210 unsigned int nhoff, u_int16_t l3num,
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 0ff0dc69ca4a..4f20d58e2ab7 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -6,17 +6,54 @@
6#define _NF_CONNTRACK_ECACHE_H 6#define _NF_CONNTRACK_ECACHE_H
7#include <net/netfilter/nf_conntrack.h> 7#include <net/netfilter/nf_conntrack.h>
8 8
9#include <linux/notifier.h>
10#include <linux/interrupt.h>
11#include <net/net_namespace.h> 9#include <net/net_namespace.h>
12#include <net/netfilter/nf_conntrack_expect.h> 10#include <net/netfilter/nf_conntrack_expect.h>
11#include <linux/netfilter/nf_conntrack_common.h>
12#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack_extend.h>
14
15/* Connection tracking event types */
16enum ip_conntrack_events
17{
18 IPCT_NEW = 0, /* new conntrack */
19 IPCT_RELATED = 1, /* related conntrack */
20 IPCT_DESTROY = 2, /* destroyed conntrack */
21 IPCT_STATUS = 3, /* status has changed */
22 IPCT_PROTOINFO = 4, /* protocol information has changed */
23 IPCT_HELPER = 5, /* new helper has been set */
24 IPCT_MARK = 6, /* new mark has been set */
25 IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */
26 IPCT_SECMARK = 8, /* new security mark has been set */
27};
28
29enum ip_conntrack_expect_events {
30 IPEXP_NEW = 0, /* new expectation */
31};
13 32
14#ifdef CONFIG_NF_CONNTRACK_EVENTS
15struct nf_conntrack_ecache { 33struct nf_conntrack_ecache {
16 struct nf_conn *ct; 34 unsigned long cache; /* bitops want long */
17 unsigned int events; 35 unsigned long missed; /* missed events */
36 u32 pid; /* netlink pid of destroyer */
37};
38
39static inline struct nf_conntrack_ecache *
40nf_ct_ecache_find(const struct nf_conn *ct)
41{
42 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
43}
44
45static inline struct nf_conntrack_ecache *
46nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp)
47{
48 struct net *net = nf_ct_net(ct);
49
50 if (!net->ct.sysctl_events)
51 return NULL;
52
53 return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp);
18}; 54};
19 55
56#ifdef CONFIG_NF_CONNTRACK_EVENTS
20/* This structure is passed to event handler */ 57/* This structure is passed to event handler */
21struct nf_ct_event { 58struct nf_ct_event {
22 struct nf_conn *ct; 59 struct nf_conn *ct;
@@ -24,47 +61,96 @@ struct nf_ct_event {
24 int report; 61 int report;
25}; 62};
26 63
27extern struct atomic_notifier_head nf_conntrack_chain; 64struct nf_ct_event_notifier {
28extern int nf_conntrack_register_notifier(struct notifier_block *nb); 65 int (*fcn)(unsigned int events, struct nf_ct_event *item);
29extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); 66};
67
68extern struct nf_ct_event_notifier *nf_conntrack_event_cb;
69extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb);
70extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb);
30 71
31extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 72extern void nf_ct_deliver_cached_events(struct nf_conn *ct);
32extern void __nf_ct_event_cache_init(struct nf_conn *ct);
33extern void nf_ct_event_cache_flush(struct net *net);
34 73
35static inline void 74static inline void
36nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 75nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
37{ 76{
77 struct nf_conntrack_ecache *e;
78
79 if (nf_conntrack_event_cb == NULL)
80 return;
81
82 e = nf_ct_ecache_find(ct);
83 if (e == NULL)
84 return;
85
86 set_bit(event, &e->cache);
87}
88
89static inline int
90nf_conntrack_eventmask_report(unsigned int eventmask,
91 struct nf_conn *ct,
92 u32 pid,
93 int report)
94{
95 int ret = 0;
38 struct net *net = nf_ct_net(ct); 96 struct net *net = nf_ct_net(ct);
39 struct nf_conntrack_ecache *ecache; 97 struct nf_ct_event_notifier *notify;
40 98 struct nf_conntrack_ecache *e;
41 local_bh_disable(); 99
42 ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id()); 100 rcu_read_lock();
43 if (ct != ecache->ct) 101 notify = rcu_dereference(nf_conntrack_event_cb);
44 __nf_ct_event_cache_init(ct); 102 if (notify == NULL)
45 ecache->events |= event; 103 goto out_unlock;
46 local_bh_enable(); 104
105 if (!net->ct.sysctl_events)
106 goto out_unlock;
107
108 e = nf_ct_ecache_find(ct);
109 if (e == NULL)
110 goto out_unlock;
111
112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
113 struct nf_ct_event item = {
114 .ct = ct,
115 .pid = e->pid ? e->pid : pid,
116 .report = report
117 };
118 /* This is a resent of a destroy event? If so, skip missed */
119 unsigned long missed = e->pid ? 0 : e->missed;
120
121 ret = notify->fcn(eventmask | missed, &item);
122 if (unlikely(ret < 0 || missed)) {
123 spin_lock_bh(&ct->lock);
124 if (ret < 0) {
125 /* This is a destroy event that has been
126 * triggered by a process, we store the PID
127 * to include it in the retransmission. */
128 if (eventmask & (1 << IPCT_DESTROY) &&
129 e->pid == 0 && pid != 0)
130 e->pid = pid;
131 else
132 e->missed |= eventmask;
133 } else
134 e->missed &= ~missed;
135 spin_unlock_bh(&ct->lock);
136 }
137 }
138out_unlock:
139 rcu_read_unlock();
140 return ret;
47} 141}
48 142
49static inline void 143static inline int
50nf_conntrack_event_report(enum ip_conntrack_events event, 144nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
51 struct nf_conn *ct, 145 u32 pid, int report)
52 u32 pid,
53 int report)
54{ 146{
55 struct nf_ct_event item = { 147 return nf_conntrack_eventmask_report(1 << event, ct, pid, report);
56 .ct = ct,
57 .pid = pid,
58 .report = report
59 };
60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
62} 148}
63 149
64static inline void 150static inline int
65nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) 151nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
66{ 152{
67 nf_conntrack_event_report(event, ct, 0, 0); 153 return nf_conntrack_eventmask_report(1 << event, ct, 0, 0);
68} 154}
69 155
70struct nf_exp_event { 156struct nf_exp_event {
@@ -73,9 +159,13 @@ struct nf_exp_event {
73 int report; 159 int report;
74}; 160};
75 161
76extern struct atomic_notifier_head nf_ct_expect_chain; 162struct nf_exp_event_notifier {
77extern int nf_ct_expect_register_notifier(struct notifier_block *nb); 163 int (*fcn)(unsigned int events, struct nf_exp_event *item);
78extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); 164};
165
166extern struct nf_exp_event_notifier *nf_expect_event_cb;
167extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb);
168extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb);
79 169
80static inline void 170static inline void
81nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 171nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -83,12 +173,27 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
83 u32 pid, 173 u32 pid,
84 int report) 174 int report)
85{ 175{
86 struct nf_exp_event item = { 176 struct net *net = nf_ct_exp_net(exp);
87 .exp = exp, 177 struct nf_exp_event_notifier *notify;
88 .pid = pid, 178
89 .report = report 179 rcu_read_lock();
90 }; 180 notify = rcu_dereference(nf_expect_event_cb);
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item); 181 if (notify == NULL)
182 goto out_unlock;
183
184 if (!net->ct.sysctl_events)
185 goto out_unlock;
186
187 {
188 struct nf_exp_event item = {
189 .exp = exp,
190 .pid = pid,
191 .report = report
192 };
193 notify->fcn(1 << event, &item);
194 }
195out_unlock:
196 rcu_read_unlock();
92} 197}
93 198
94static inline void 199static inline void
@@ -105,12 +210,16 @@ extern void nf_conntrack_ecache_fini(struct net *net);
105 210
106static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 211static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
107 struct nf_conn *ct) {} 212 struct nf_conn *ct) {}
108static inline void nf_conntrack_event(enum ip_conntrack_events event, 213static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
109 struct nf_conn *ct) {} 214 struct nf_conn *ct,
110static inline void nf_conntrack_event_report(enum ip_conntrack_events event, 215 u32 pid,
111 struct nf_conn *ct, 216 int report) { return 0; }
112 u32 pid, 217static inline int nf_conntrack_event(enum ip_conntrack_events event,
113 int report) {} 218 struct nf_conn *ct) { return 0; }
219static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
220 struct nf_conn *ct,
221 u32 pid,
222 int report) { return 0; }
114static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 223static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
115static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 224static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
116 struct nf_conntrack_expect *exp) {} 225 struct nf_conntrack_expect *exp) {}
@@ -118,7 +227,6 @@ static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp, 227 struct nf_conntrack_expect *exp,
119 u32 pid, 228 u32 pid,
120 int report) {} 229 int report) {}
121static inline void nf_ct_event_cache_flush(struct net *net) {}
122 230
123static inline int nf_conntrack_ecache_init(struct net *net) 231static inline int nf_conntrack_ecache_init(struct net *net)
124{ 232{
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index da8ee52613a5..7f8fc5d123c5 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -8,12 +8,14 @@ enum nf_ct_ext_id
8 NF_CT_EXT_HELPER, 8 NF_CT_EXT_HELPER,
9 NF_CT_EXT_NAT, 9 NF_CT_EXT_NAT,
10 NF_CT_EXT_ACCT, 10 NF_CT_EXT_ACCT,
11 NF_CT_EXT_ECACHE,
11 NF_CT_EXT_NUM, 12 NF_CT_EXT_NUM,
12}; 13};
13 14
14#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 15#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
15#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 16#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
16#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 17#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
18#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
17 19
18/* Extensions: optional stuff which isn't permanently in struct. */ 20/* Extensions: optional stuff which isn't permanently in struct. */
19struct nf_ct_ext { 21struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index ee2a4b369a04..1b7068000927 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -50,6 +50,8 @@ extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
50 50
51extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); 51extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
52 52
53extern void nf_ct_helper_destroy(struct nf_conn *ct);
54
53static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 55static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
54{ 56{
55 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 57 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 ba32ed7bdabe..3767fb41e541 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -59,11 +59,11 @@ struct nf_conntrack_l4proto
59 const struct nf_conntrack_tuple *); 59 const struct nf_conntrack_tuple *);
60 60
61 /* Print out the private part of the conntrack. */ 61 /* Print out the private part of the conntrack. */
62 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); 62 int (*print_conntrack)(struct seq_file *s, struct nf_conn *);
63 63
64 /* convert protoinfo to nfnetink attributes */ 64 /* convert protoinfo to nfnetink attributes */
65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
66 const struct nf_conn *ct); 66 struct nf_conn *ct);
67 /* Calculate protoinfo nlattr size */ 67 /* Calculate protoinfo nlattr size */
68 int (*nlattr_size)(void); 68 int (*nlattr_size)(void);
69 69
diff --git a/include/net/netlink.h b/include/net/netlink.h
index eddb50289d6d..007bdb07dabb 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -940,6 +940,15 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
940} 940}
941 941
942/** 942/**
943 * nla_get_be64 - return payload of __be64 attribute
944 * @nla: __be64 netlink attribute
945 */
946static inline __be64 nla_get_be64(const struct nlattr *nla)
947{
948 return *(__be64 *) nla_data(nla);
949}
950
951/**
943 * nla_get_flag - return payload of flag attribute 952 * nla_get_flag - return payload of flag attribute
944 * @nla: flag netlink attribute 953 * @nla: flag netlink attribute
945 */ 954 */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 9dc58402bc09..ba1ba0c5efd1 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -14,16 +14,17 @@ struct netns_ct {
14 struct hlist_nulls_head *hash; 14 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 15 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 16 struct hlist_nulls_head unconfirmed;
17 struct hlist_nulls_head dying;
17 struct ip_conntrack_stat *stat; 18 struct ip_conntrack_stat *stat;
18#ifdef CONFIG_NF_CONNTRACK_EVENTS 19 int sysctl_events;
19 struct nf_conntrack_ecache *ecache; 20 unsigned int sysctl_events_retry_timeout;
20#endif
21 int sysctl_acct; 21 int sysctl_acct;
22 int sysctl_checksum; 22 int sysctl_checksum;
23 unsigned int sysctl_log_invalid; /* Log invalid packets */ 23 unsigned int sysctl_log_invalid; /* Log invalid packets */
24#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
25 struct ctl_table_header *sysctl_header; 25 struct ctl_table_header *sysctl_header;
26 struct ctl_table_header *acct_sysctl_header; 26 struct ctl_table_header *acct_sysctl_header;
27 struct ctl_table_header *event_sysctl_header;
27#endif 28#endif
28 int hash_vmalloc; 29 int hash_vmalloc;
29 int expect_vmalloc; 30 int expect_vmalloc;
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index e37fe3129c17..82a3191375f5 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -41,16 +41,17 @@ static inline void *qdisc_priv(struct Qdisc *q)
41typedef u64 psched_time_t; 41typedef u64 psched_time_t;
42typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
43 43
44/* Avoid doing 64 bit divide by 1000 */ 44/* Avoid doing 64 bit divide */
45#define PSCHED_US2NS(x) ((s64)(x) << 10) 45#define PSCHED_SHIFT 6
46#define PSCHED_NS2US(x) ((x) >> 10) 46#define PSCHED_TICKS2NS(x) ((s64)(x) << PSCHED_SHIFT)
47#define PSCHED_NS2TICKS(x) ((x) >> PSCHED_SHIFT)
47 48
48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) 49#define PSCHED_TICKS_PER_SEC PSCHED_NS2TICKS(NSEC_PER_SEC)
49#define PSCHED_PASTPERFECT 0 50#define PSCHED_PASTPERFECT 0
50 51
51static inline psched_time_t psched_get_time(void) 52static inline psched_time_t psched_get_time(void)
52{ 53{
53 return PSCHED_NS2US(ktime_to_ns(ktime_get())); 54 return PSCHED_NS2TICKS(ktime_to_ns(ktime_get()));
54} 55}
55 56
56static inline psched_tdiff_t 57static inline psched_tdiff_t
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
new file mode 100644
index 000000000000..47995b81c5d7
--- /dev/null
+++ b/include/net/regulatory.h
@@ -0,0 +1,101 @@
1#ifndef __NET_REGULATORY_H
2#define __NET_REGULATORY_H
3/*
4 * regulatory support structures
5 *
6 * Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14/**
15 * enum environment_cap - Environment parsed from country IE
16 * @ENVIRON_ANY: indicates country IE applies to both indoor and
17 * outdoor operation.
18 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
19 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
20 */
21enum environment_cap {
22 ENVIRON_ANY,
23 ENVIRON_INDOOR,
24 ENVIRON_OUTDOOR,
25};
26
27/**
28 * struct regulatory_request - used to keep track of regulatory requests
29 *
30 * @wiphy_idx: this is set if this request's initiator is
31 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
32 * can be used by the wireless core to deal with conflicts
33 * and potentially inform users of which devices specifically
34 * cased the conflicts.
35 * @initiator: indicates who sent this request, could be any of
36 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
37 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
38 * regulatory domain. We have a few special codes:
39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains
42 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory
44 * domain.
45 * @country_ie_checksum: checksum of the last processed and accepted
46 * country IE
47 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
48 * indoor, or if it doesn't matter
49 * @list: used to insert into the reg_requests_list linked list
50 */
51struct regulatory_request {
52 int wiphy_idx;
53 enum nl80211_reg_initiator initiator;
54 char alpha2[2];
55 bool intersect;
56 u32 country_ie_checksum;
57 enum environment_cap country_ie_env;
58 struct list_head list;
59};
60
61struct ieee80211_freq_range {
62 u32 start_freq_khz;
63 u32 end_freq_khz;
64 u32 max_bandwidth_khz;
65};
66
67struct ieee80211_power_rule {
68 u32 max_antenna_gain;
69 u32 max_eirp;
70};
71
72struct ieee80211_reg_rule {
73 struct ieee80211_freq_range freq_range;
74 struct ieee80211_power_rule power_rule;
75 u32 flags;
76};
77
78struct ieee80211_regdomain {
79 u32 n_reg_rules;
80 char alpha2[2];
81 struct ieee80211_reg_rule reg_rules[];
82};
83
84#define MHZ_TO_KHZ(freq) ((freq) * 1000)
85#define KHZ_TO_MHZ(freq) ((freq) / 1000)
86#define DBI_TO_MBI(gain) ((gain) * 100)
87#define MBI_TO_DBI(gain) ((gain) / 100)
88#define DBM_TO_MBM(gain) ((gain) * 100)
89#define MBM_TO_DBM(gain) ((gain) / 100)
90
91#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
92{ \
93 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
94 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
95 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
96 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
97 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
98 .flags = reg_flags, \
99}
100
101#endif
diff --git a/include/net/route.h b/include/net/route.h
index 4e8cae0e5841..40f6346ef496 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -210,7 +210,7 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
210 210
211static inline int inet_iif(const struct sk_buff *skb) 211static inline int inet_iif(const struct sk_buff *skb)
212{ 212{
213 return skb->rtable->rt_iif; 213 return skb_rtable(skb)->rt_iif;
214} 214}
215 215
216#endif /* _ROUTE_H */ 216#endif /* _ROUTE_H */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 23f08fe1d50a..edfcacf3250e 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1939,10 +1939,8 @@ void sctp_association_free(struct sctp_association *);
1939void sctp_association_put(struct sctp_association *); 1939void sctp_association_put(struct sctp_association *);
1940void sctp_association_hold(struct sctp_association *); 1940void sctp_association_hold(struct sctp_association *);
1941 1941
1942struct sctp_transport *sctp_assoc_choose_init_transport( 1942struct sctp_transport *sctp_assoc_choose_alter_transport(
1943 struct sctp_association *); 1943 struct sctp_association *, struct sctp_transport *);
1944struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1945 struct sctp_association *);
1946void sctp_assoc_update_retran_path(struct sctp_association *); 1944void sctp_assoc_update_retran_path(struct sctp_association *);
1947struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *, 1945struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *,
1948 const union sctp_addr *); 1946 const union sctp_addr *);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index b259fc5798fb..1580c04f68bc 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -147,6 +147,8 @@ enum sctp_optname {
147#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 147#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
148 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ 148 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
149#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX 149#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
150 SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */
151#define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3
150}; 152};
151 153
152/* 154/*
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 57c93628695f..8c842e06bec8 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -153,6 +153,11 @@ struct linux_xfrm_mib {
153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ 153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \
154 put_cpu(); \ 154 put_cpu(); \
155 } while (0) 155 } while (0)
156#define SNMP_ADD_STATS(mib, field, addend) \
157 do { \
158 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \
159 put_cpu(); \
160 } while (0)
156#define SNMP_ADD_STATS_BH(mib, field, addend) \ 161#define SNMP_ADD_STATS_BH(mib, field, addend) \
157 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) 162 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
158#define SNMP_ADD_STATS_USER(mib, field, addend) \ 163#define SNMP_ADD_STATS_USER(mib, field, addend) \
@@ -160,5 +165,17 @@ struct linux_xfrm_mib {
160 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ 165 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \
161 put_cpu(); \ 166 put_cpu(); \
162 } while (0) 167 } while (0)
163 168#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
169 do { \
170 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\
171 ptr->mibs[basefield##PKTS]++; \
172 ptr->mibs[basefield##OCTETS] += addend;\
173 put_cpu(); \
174 } while (0)
175#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
176 do { \
177 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\
178 ptr->mibs[basefield##PKTS]++; \
179 ptr->mibs[basefield##OCTETS] += addend;\
180 } while (0)
164#endif 181#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 4bb1ff9fd15b..95bd3fd75f94 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -218,9 +218,11 @@ struct sock {
218#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
219#define sk_prot __sk_common.skc_prot 219#define sk_prot __sk_common.skc_prot
220#define sk_net __sk_common.skc_net 220#define sk_net __sk_common.skc_net
221 kmemcheck_bitfield_begin(flags);
221 unsigned char sk_shutdown : 2, 222 unsigned char sk_shutdown : 2,
222 sk_no_check : 2, 223 sk_no_check : 2,
223 sk_userlocks : 4; 224 sk_userlocks : 4;
225 kmemcheck_bitfield_end(flags);
224 unsigned char sk_protocol; 226 unsigned char sk_protocol;
225 unsigned short sk_type; 227 unsigned short sk_type;
226 int sk_rcvbuf; 228 int sk_rcvbuf;
@@ -1217,9 +1219,13 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1217 1219
1218static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) 1220static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
1219{ 1221{
1220 sock_hold(sk);
1221 skb->sk = sk; 1222 skb->sk = sk;
1222 skb->destructor = sock_wfree; 1223 skb->destructor = sock_wfree;
1224 /*
1225 * We used to take a refcount on sk, but following operation
1226 * is enough to guarantee sk_free() wont free this sock until
1227 * all in-flight packets are completed
1228 */
1223 atomic_add(skb->truesize, &sk->sk_wmem_alloc); 1229 atomic_add(skb->truesize, &sk->sk_wmem_alloc);
1224} 1230}
1225 1231
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 646dbe3962ea..19f4150f4d4d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -266,6 +266,19 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num)
266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); 266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
267} 267}
268 268
269/* syncookies: remember time of last synqueue overflow */
270static inline void tcp_synq_overflow(struct sock *sk)
271{
272 tcp_sk(sk)->rx_opt.ts_recent_stamp = jiffies;
273}
274
275/* syncookies: no recent synqueue overflow on this listening socket? */
276static inline int tcp_synq_no_recent_overflow(const struct sock *sk)
277{
278 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
279 return time_after(jiffies, last_overflow + TCP_TIMEOUT_INIT);
280}
281
269extern struct proto tcp_prot; 282extern struct proto tcp_prot;
270 283
271#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) 284#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field)
@@ -889,30 +902,32 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
889{ 902{
890 struct tcp_sock *tp = tcp_sk(sk); 903 struct tcp_sock *tp = tcp_sk(sk);
891 904
892 if (!sysctl_tcp_low_latency && tp->ucopy.task) { 905 if (sysctl_tcp_low_latency || !tp->ucopy.task)
893 __skb_queue_tail(&tp->ucopy.prequeue, skb); 906 return 0;
894 tp->ucopy.memory += skb->truesize; 907
895 if (tp->ucopy.memory > sk->sk_rcvbuf) { 908 __skb_queue_tail(&tp->ucopy.prequeue, skb);
896 struct sk_buff *skb1; 909 tp->ucopy.memory += skb->truesize;
897 910 if (tp->ucopy.memory > sk->sk_rcvbuf) {
898 BUG_ON(sock_owned_by_user(sk)); 911 struct sk_buff *skb1;
899 912
900 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 913 BUG_ON(sock_owned_by_user(sk));
901 sk_backlog_rcv(sk, skb1); 914
902 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); 915 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
903 } 916 sk_backlog_rcv(sk, skb1);
904 917 NET_INC_STATS_BH(sock_net(sk),
905 tp->ucopy.memory = 0; 918 LINUX_MIB_TCPPREQUEUEDROPPED);
906 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
907 wake_up_interruptible(sk->sk_sleep);
908 if (!inet_csk_ack_scheduled(sk))
909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
910 (3 * tcp_rto_min(sk)) / 4,
911 TCP_RTO_MAX);
912 } 919 }
913 return 1; 920
921 tp->ucopy.memory = 0;
922 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
923 wake_up_interruptible_poll(sk->sk_sleep,
924 POLLIN | POLLRDNORM | POLLRDBAND);
925 if (!inet_csk_ack_scheduled(sk))
926 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
927 (3 * tcp_rto_min(sk)) / 4,
928 TCP_RTO_MAX);
914 } 929 }
915 return 0; 930 return 1;
916} 931}
917 932
918 933
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 6b3824edb39e..2af7bf839f23 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -253,7 +253,6 @@
253struct net_device; 253struct net_device;
254struct genl_info; 254struct genl_info;
255struct wimax_dev; 255struct wimax_dev;
256struct input_dev;
257 256
258/** 257/**
259 * struct wimax_dev - Generic WiMAX device 258 * struct wimax_dev - Generic WiMAX device
@@ -293,8 +292,8 @@ struct input_dev;
293 * See wimax_reset()'s documentation. 292 * See wimax_reset()'s documentation.
294 * 293 *
295 * @name: [fill] A way to identify this device. We need to register a 294 * @name: [fill] A way to identify this device. We need to register a
296 * name with many subsystems (input for RFKILL, workqueue 295 * name with many subsystems (rfkill, workqueue creation, etc).
297 * creation, etc). We can't use the network device name as that 296 * We can't use the network device name as that
298 * might change and in some instances we don't know it yet (until 297 * might change and in some instances we don't know it yet (until
299 * we don't call register_netdev()). So we generate an unique one 298 * we don't call register_netdev()). So we generate an unique one
300 * using the driver name and device bus id, place it here and use 299 * using the driver name and device bus id, place it here and use
@@ -316,9 +315,6 @@ struct input_dev;
316 * 315 *
317 * @rfkill: [private] integration into the RF-Kill infrastructure. 316 * @rfkill: [private] integration into the RF-Kill infrastructure.
318 * 317 *
319 * @rfkill_input: [private] virtual input device to process the
320 * hardware RF Kill switches.
321 *
322 * @rf_sw: [private] State of the software radio switch (OFF/ON) 318 * @rf_sw: [private] State of the software radio switch (OFF/ON)
323 * 319 *
324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON) 320 * @rf_hw: [private] State of the hardware radio switch (OFF/ON)
diff --git a/include/net/wireless.h b/include/net/wireless.h
deleted file mode 100644
index 64a76208580c..000000000000
--- a/include/net/wireless.h
+++ /dev/null
@@ -1,472 +0,0 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <linux/ieee80211.h>
14#include <net/cfg80211.h>
15
16/**
17 * enum ieee80211_band - supported frequency bands
18 *
19 * The bands are assigned this way because the supported
20 * bitrates differ in these bands.
21 *
22 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
23 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
24 */
25enum ieee80211_band {
26 IEEE80211_BAND_2GHZ,
27 IEEE80211_BAND_5GHZ,
28
29 /* keep last */
30 IEEE80211_NUM_BANDS
31};
32
33/**
34 * enum ieee80211_channel_flags - channel flags
35 *
36 * Channel flags set by the regulatory control code.
37 *
38 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
39 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
40 * on this channel.
41 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
42 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
43 * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
44 * is not permitted.
45 * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
46 * is not permitted.
47 */
48enum ieee80211_channel_flags {
49 IEEE80211_CHAN_DISABLED = 1<<0,
50 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
51 IEEE80211_CHAN_NO_IBSS = 1<<2,
52 IEEE80211_CHAN_RADAR = 1<<3,
53 IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
54 IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
55};
56
57/**
58 * struct ieee80211_channel - channel definition
59 *
60 * This structure describes a single channel for use
61 * with cfg80211.
62 *
63 * @center_freq: center frequency in MHz
64 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
65 * @hw_value: hardware-specific value for the channel
66 * @flags: channel flags from &enum ieee80211_channel_flags.
67 * @orig_flags: channel flags at registration time, used by regulatory
68 * code to support devices with additional restrictions
69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi
71 * @max_power: maximum transmission power (in dBm)
72 * @beacon_found: helper to regulatory code to indicate when a beacon
73 * has been found on this channel. Use regulatory_hint_found_beacon()
74 * to enable this, this is is useful only on 5 GHz band.
75 * @orig_mag: internal use
76 * @orig_mpwr: internal use
77 */
78struct ieee80211_channel {
79 enum ieee80211_band band;
80 u16 center_freq;
81 u8 max_bandwidth;
82 u16 hw_value;
83 u32 flags;
84 int max_antenna_gain;
85 int max_power;
86 bool beacon_found;
87 u32 orig_flags;
88 int orig_mag, orig_mpwr;
89};
90
91/**
92 * enum ieee80211_rate_flags - rate flags
93 *
94 * Hardware/specification flags for rates. These are structured
95 * in a way that allows using the same bitrate structure for
96 * different bands/PHY modes.
97 *
98 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
99 * preamble on this bitrate; only relevant in 2.4GHz band and
100 * with CCK rates.
101 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
102 * when used with 802.11a (on the 5 GHz band); filled by the
103 * core code when registering the wiphy.
104 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
105 * when used with 802.11b (on the 2.4 GHz band); filled by the
106 * core code when registering the wiphy.
107 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
108 * when used with 802.11g (on the 2.4 GHz band); filled by the
109 * core code when registering the wiphy.
110 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
111 */
112enum ieee80211_rate_flags {
113 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
114 IEEE80211_RATE_MANDATORY_A = 1<<1,
115 IEEE80211_RATE_MANDATORY_B = 1<<2,
116 IEEE80211_RATE_MANDATORY_G = 1<<3,
117 IEEE80211_RATE_ERP_G = 1<<4,
118};
119
120/**
121 * struct ieee80211_rate - bitrate definition
122 *
123 * This structure describes a bitrate that an 802.11 PHY can
124 * operate with. The two values @hw_value and @hw_value_short
125 * are only for driver use when pointers to this structure are
126 * passed around.
127 *
128 * @flags: rate-specific flags
129 * @bitrate: bitrate in units of 100 Kbps
130 * @hw_value: driver/hardware value for this rate
131 * @hw_value_short: driver/hardware value for this rate when
132 * short preamble is used
133 */
134struct ieee80211_rate {
135 u32 flags;
136 u16 bitrate;
137 u16 hw_value, hw_value_short;
138};
139
140/**
141 * struct ieee80211_sta_ht_cap - STA's HT capabilities
142 *
143 * This structure describes most essential parameters needed
144 * to describe 802.11n HT capabilities for an STA.
145 *
146 * @ht_supported: is HT supported by the STA
147 * @cap: HT capabilities map as described in 802.11n spec
148 * @ampdu_factor: Maximum A-MPDU length factor
149 * @ampdu_density: Minimum A-MPDU spacing
150 * @mcs: Supported MCS rates
151 */
152struct ieee80211_sta_ht_cap {
153 u16 cap; /* use IEEE80211_HT_CAP_ */
154 bool ht_supported;
155 u8 ampdu_factor;
156 u8 ampdu_density;
157 struct ieee80211_mcs_info mcs;
158};
159
160/**
161 * struct ieee80211_supported_band - frequency band definition
162 *
163 * This structure describes a frequency band a wiphy
164 * is able to operate in.
165 *
166 * @channels: Array of channels the hardware can operate in
167 * in this band.
168 * @band: the band this structure represents
169 * @n_channels: Number of channels in @channels
170 * @bitrates: Array of bitrates the hardware can operate with
171 * in this band. Must be sorted to give a valid "supported
172 * rates" IE, i.e. CCK rates first, then OFDM.
173 * @n_bitrates: Number of bitrates in @bitrates
174 */
175struct ieee80211_supported_band {
176 struct ieee80211_channel *channels;
177 struct ieee80211_rate *bitrates;
178 enum ieee80211_band band;
179 int n_channels;
180 int n_bitrates;
181 struct ieee80211_sta_ht_cap ht_cap;
182};
183
184/**
185 * struct wiphy - wireless hardware description
186 * @idx: the wiphy index assigned to this item
187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
188 * @custom_regulatory: tells us the driver for this device
189 * has its own custom regulatory domain and cannot identify the
190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
191 * we will disregard the first regulatory hint (when the
192 * initiator is %REGDOM_SET_BY_CORE).
193 * @strict_regulatory: tells us the driver for this device will ignore
194 * regulatory domain settings until it gets its own regulatory domain
195 * via its regulatory_hint(). After its gets its own regulatory domain
196 * it will only allow further regulatory domain settings to further
197 * enhance compliance. For example if channel 13 and 14 are disabled
198 * by this regulatory domain no user regulatory domain can enable these
199 * channels at a later time. This can be used for devices which do not
200 * have calibration information gauranteed for frequencies or settings
201 * outside of its regulatory domain.
202 * @reg_notifier: the driver's regulatory notification callback
203 * @regd: the driver's regulatory domain, if one was requested via
204 * the regulatory_hint() API. This can be used by the driver
205 * on the reg_notifier() if it chooses to ignore future
206 * regulatory domain changes caused by other drivers.
207 * @signal_type: signal type reported in &struct cfg80211_bss.
208 */
209struct wiphy {
210 /* assign these fields before you register the wiphy */
211
212 /* permanent MAC address */
213 u8 perm_addr[ETH_ALEN];
214
215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
216 u16 interface_modes;
217
218 bool custom_regulatory;
219 bool strict_regulatory;
220
221 enum cfg80211_signal_type signal_type;
222
223 int bss_priv_size;
224 u8 max_scan_ssids;
225
226 /* If multiple wiphys are registered and you're handed e.g.
227 * a regular netdev with assigned ieee80211_ptr, you won't
228 * know whether it points to a wiphy your driver has registered
229 * or not. Assign this to something global to your driver to
230 * help determine whether you own this wiphy or not. */
231 void *privid;
232
233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
234
235 /* Lets us get back the wiphy on the callback */
236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
238
239 /* fields below are read-only, assigned by cfg80211 */
240
241 const struct ieee80211_regdomain *regd;
242
243 /* the item in /sys/class/ieee80211/ points to this,
244 * you need use set_wiphy_dev() (see below) */
245 struct device dev;
246
247 /* dir in debugfs: ieee80211/<wiphyname> */
248 struct dentry *debugfsdir;
249
250 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
251};
252
253/** struct wireless_dev - wireless per-netdev state
254 *
255 * This structure must be allocated by the driver/stack
256 * that uses the ieee80211_ptr field in struct net_device
257 * (this is intentional so it can be allocated along with
258 * the netdev.)
259 *
260 * @wiphy: pointer to hardware description
261 * @iftype: interface type
262 */
263struct wireless_dev {
264 struct wiphy *wiphy;
265 enum nl80211_iftype iftype;
266
267 /* private to the generic wireless code */
268 struct list_head list;
269 struct net_device *netdev;
270};
271
272/**
273 * wiphy_priv - return priv from wiphy
274 */
275static inline void *wiphy_priv(struct wiphy *wiphy)
276{
277 BUG_ON(!wiphy);
278 return &wiphy->priv;
279}
280
281/**
282 * set_wiphy_dev - set device pointer for wiphy
283 */
284static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
285{
286 wiphy->dev.parent = dev;
287}
288
289/**
290 * wiphy_dev - get wiphy dev pointer
291 */
292static inline struct device *wiphy_dev(struct wiphy *wiphy)
293{
294 return wiphy->dev.parent;
295}
296
297/**
298 * wiphy_name - get wiphy name
299 */
300static inline const char *wiphy_name(struct wiphy *wiphy)
301{
302 return dev_name(&wiphy->dev);
303}
304
305/**
306 * wdev_priv - return wiphy priv from wireless_dev
307 */
308static inline void *wdev_priv(struct wireless_dev *wdev)
309{
310 BUG_ON(!wdev);
311 return wiphy_priv(wdev->wiphy);
312}
313
314/**
315 * wiphy_new - create a new wiphy for use with cfg80211
316 *
317 * create a new wiphy and associate the given operations with it.
318 * @sizeof_priv bytes are allocated for private use.
319 *
320 * the returned pointer must be assigned to each netdev's
321 * ieee80211_ptr for proper operation.
322 */
323struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
324
325/**
326 * wiphy_register - register a wiphy with cfg80211
327 *
328 * register the given wiphy
329 *
330 * Returns a non-negative wiphy index or a negative error code.
331 */
332extern int wiphy_register(struct wiphy *wiphy);
333
334/**
335 * wiphy_unregister - deregister a wiphy from cfg80211
336 *
337 * unregister a device with the given priv pointer.
338 * After this call, no more requests can be made with this priv
339 * pointer, but the call may sleep to wait for an outstanding
340 * request that is being handled.
341 */
342extern void wiphy_unregister(struct wiphy *wiphy);
343
344/**
345 * wiphy_free - free wiphy
346 */
347extern void wiphy_free(struct wiphy *wiphy);
348
349/**
350 * ieee80211_channel_to_frequency - convert channel number to frequency
351 */
352extern int ieee80211_channel_to_frequency(int chan);
353
354/**
355 * ieee80211_frequency_to_channel - convert frequency to channel number
356 */
357extern int ieee80211_frequency_to_channel(int freq);
358
359/*
360 * Name indirection necessary because the ieee80211 code also has
361 * a function named "ieee80211_get_channel", so if you include
362 * cfg80211's header file you get cfg80211's version, if you try
363 * to include both header files you'll (rightfully!) get a symbol
364 * clash.
365 */
366extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
367 int freq);
368/**
369 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
370 */
371static inline struct ieee80211_channel *
372ieee80211_get_channel(struct wiphy *wiphy, int freq)
373{
374 return __ieee80211_get_channel(wiphy, freq);
375}
376
377/**
378 * ieee80211_get_response_rate - get basic rate for a given rate
379 *
380 * @sband: the band to look for rates in
381 * @basic_rates: bitmap of basic rates
382 * @bitrate: the bitrate for which to find the basic rate
383 *
384 * This function returns the basic rate corresponding to a given
385 * bitrate, that is the next lower bitrate contained in the basic
386 * rate map, which is, for this function, given as a bitmap of
387 * indices of rates in the band's bitrate table.
388 */
389struct ieee80211_rate *
390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
391 u32 basic_rates, int bitrate);
392
393/**
394 * regulatory_hint - driver hint to the wireless core a regulatory domain
395 * @wiphy: the wireless device giving the hint (used only for reporting
396 * conflicts)
397 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
398 * should be in. If @rd is set this should be NULL. Note that if you
399 * set this to NULL you should still set rd->alpha2 to some accepted
400 * alpha2.
401 *
402 * Wireless drivers can use this function to hint to the wireless core
403 * what it believes should be the current regulatory domain by
404 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
405 * domain should be in or by providing a completely build regulatory domain.
406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
407 * for a regulatory domain structure for the respective country.
408 *
409 * The wiphy must have been registered to cfg80211 prior to this call.
410 * For cfg80211 drivers this means you must first use wiphy_register(),
411 * for mac80211 drivers you must first use ieee80211_register_hw().
412 *
413 * Drivers should check the return value, its possible you can get
414 * an -ENOMEM.
415 */
416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
417
418/**
419 * regulatory_hint_11d - hints a country IE as a regulatory domain
420 * @wiphy: the wireless device giving the hint (used only for reporting
421 * conflicts)
422 * @country_ie: pointer to the country IE
423 * @country_ie_len: length of the country IE
424 *
425 * We will intersect the rd with the what CRDA tells us should apply
426 * for the alpha2 this country IE belongs to, this prevents APs from
427 * sending us incorrect or outdated information against a country.
428 */
429extern void regulatory_hint_11d(struct wiphy *wiphy,
430 u8 *country_ie,
431 u8 country_ie_len);
432/**
433 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
434 * @wiphy: the wireless device we want to process the regulatory domain on
435 * @regd: the custom regulatory domain to use for this wiphy
436 *
437 * Drivers can sometimes have custom regulatory domains which do not apply
438 * to a specific country. Drivers can use this to apply such custom regulatory
439 * domains. This routine must be called prior to wiphy registration. The
440 * custom regulatory domain will be trusted completely and as such previous
441 * default channel settings will be disregarded. If no rule is found for a
442 * channel on the regulatory domain the channel will be disabled.
443 */
444extern void wiphy_apply_custom_regulatory(
445 struct wiphy *wiphy,
446 const struct ieee80211_regdomain *regd);
447
448/**
449 * freq_reg_info - get regulatory information for the given frequency
450 * @wiphy: the wiphy for which we want to process this rule for
451 * @center_freq: Frequency in KHz for which we want regulatory information for
452 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
453 * you can set this to 0. If this frequency is allowed we then set
454 * this value to the maximum allowed bandwidth.
455 * @reg_rule: the regulatory rule which we have for this frequency
456 *
457 * Use this function to get the regulatory rule for a specific frequency on
458 * a given wireless device. If the device has a specific regulatory domain
459 * it wants to follow we respect that unless a country IE has been received
460 * and processed already.
461 *
462 * Returns 0 if it was able to find a valid regulatory rule which does
463 * apply to the given center_freq otherwise it returns non-zero. It will
464 * also return -ERANGE if we determine the given center_freq does not even have
465 * a regulatory rule for a frequency range in the center_freq's band. See
466 * freq_in_rule_band() for our current definition of a band -- this is purely
467 * subjective and right now its 802.11 specific.
468 */
469extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
470 const struct ieee80211_reg_rule **reg_rule);
471
472#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 2e9f5c0018ae..736bca450886 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -994,7 +994,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,
994 return __xfrm_policy_check(sk, ndir, skb, family); 994 return __xfrm_policy_check(sk, ndir, skb, family);
995 995
996 return (!net->xfrm.policy_count[dir] && !skb->sp) || 996 return (!net->xfrm.policy_count[dir] && !skb->sp) ||
997 (skb->dst->flags & DST_NOPOLICY) || 997 (skb_dst(skb)->flags & DST_NOPOLICY) ||
998 __xfrm_policy_check(sk, ndir, skb, family); 998 __xfrm_policy_check(sk, ndir, skb, family);
999} 999}
1000 1000
@@ -1048,7 +1048,7 @@ static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1048 struct net *net = dev_net(skb->dev); 1048 struct net *net = dev_net(skb->dev);
1049 1049
1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] || 1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
1051 (skb->dst->flags & DST_NOXFRM) || 1051 (skb_dst(skb)->flags & DST_NOXFRM) ||
1052 __xfrm_route_forward(skb, family); 1052 __xfrm_route_forward(skb, family);
1053} 1053}
1054 1054
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 666cc131732e..b2410605b740 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -73,6 +73,7 @@ enum fip_state {
73 * @link: current link status for libfc. 73 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc. 74 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses. 75 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @spma: supports SPMA server-provided MACs mode
76 * @dest_addr: MAC address of the selected FC forwarder. 77 * @dest_addr: MAC address of the selected FC forwarder.
77 * @ctl_src_addr: the native MAC address of our local port. 78 * @ctl_src_addr: the native MAC address of our local port.
78 * @data_src_addr: the assigned MAC address for the local port after FLOGI. 79 * @data_src_addr: the assigned MAC address for the local port after FLOGI.
@@ -104,6 +105,7 @@ struct fcoe_ctlr {
104 u8 link; 105 u8 link;
105 u8 last_link; 106 u8 last_link;
106 u8 map_dest; 107 u8 map_dest;
108 u8 spma;
107 u8 dest_addr[ETH_ALEN]; 109 u8 dest_addr[ETH_ALEN];
108 u8 ctl_src_addr[ETH_ALEN]; 110 u8 ctl_src_addr[ETH_ALEN];
109 u8 data_src_addr[ETH_ALEN]; 111 u8 data_src_addr[ETH_ALEN];
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h
new file mode 100644
index 000000000000..a8989c4547e7
--- /dev/null
+++ b/include/trace/events/napi.h
@@ -0,0 +1,11 @@
1#ifndef _TRACE_NAPI_H_
2#define _TRACE_NAPI_H_
3
4#include <linux/netdevice.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(napi_poll,
8 TP_PROTO(struct napi_struct *napi),
9 TP_ARGS(napi));
10
11#endif
diff --git a/include/video/pxa168fb.h b/include/video/pxa168fb.h
new file mode 100644
index 000000000000..b5cc72fe0461
--- /dev/null
+++ b/include/video/pxa168fb.h
@@ -0,0 +1,127 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/pxa168fb.h
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_MACH_PXA168FB_H
12#define __ASM_MACH_PXA168FB_H
13
14#include <linux/fb.h>
15#include <linux/interrupt.h>
16
17/* Dumb interface */
18#define PIN_MODE_DUMB_24 0
19#define PIN_MODE_DUMB_18_SPI 1
20#define PIN_MODE_DUMB_18_GPIO 2
21#define PIN_MODE_DUMB_16_SPI 3
22#define PIN_MODE_DUMB_16_GPIO 4
23#define PIN_MODE_DUMB_12_SPI_GPIO 5
24#define PIN_MODE_SMART_18_SPI 6
25#define PIN_MODE_SMART_16_SPI 7
26#define PIN_MODE_SMART_8_SPI_GPIO 8
27
28/* Dumb interface pin allocation */
29#define DUMB_MODE_RGB565 0
30#define DUMB_MODE_RGB565_UPPER 1
31#define DUMB_MODE_RGB666 2
32#define DUMB_MODE_RGB666_UPPER 3
33#define DUMB_MODE_RGB444 4
34#define DUMB_MODE_RGB444_UPPER 5
35#define DUMB_MODE_RGB888 6
36
37/* default fb buffer size WVGA-32bits */
38#define DEFAULT_FB_SIZE (800 * 480 * 4)
39
40/*
41 * Buffer pixel format
42 * bit0 is for rb swap.
43 * bit12 is for Y UorV swap
44 */
45#define PIX_FMT_RGB565 0
46#define PIX_FMT_BGR565 1
47#define PIX_FMT_RGB1555 2
48#define PIX_FMT_BGR1555 3
49#define PIX_FMT_RGB888PACK 4
50#define PIX_FMT_BGR888PACK 5
51#define PIX_FMT_RGB888UNPACK 6
52#define PIX_FMT_BGR888UNPACK 7
53#define PIX_FMT_RGBA888 8
54#define PIX_FMT_BGRA888 9
55#define PIX_FMT_YUV422PACK 10
56#define PIX_FMT_YVU422PACK 11
57#define PIX_FMT_YUV422PLANAR 12
58#define PIX_FMT_YVU422PLANAR 13
59#define PIX_FMT_YUV420PLANAR 14
60#define PIX_FMT_YVU420PLANAR 15
61#define PIX_FMT_PSEUDOCOLOR 20
62#define PIX_FMT_UYVY422PACK (0x1000|PIX_FMT_YUV422PACK)
63
64/*
65 * PXA LCD controller private state.
66 */
67struct pxa168fb_info {
68 struct device *dev;
69 struct clk *clk;
70 struct fb_info *info;
71
72 void __iomem *reg_base;
73 dma_addr_t fb_start_dma;
74 u32 pseudo_palette[16];
75
76 int pix_fmt;
77 unsigned is_blanked:1;
78 unsigned panel_rbswap:1;
79 unsigned active:1;
80};
81
82/*
83 * PXA fb machine information
84 */
85struct pxa168fb_mach_info {
86 char id[16];
87
88 int num_modes;
89 struct fb_videomode *modes;
90
91 /*
92 * Pix_fmt
93 */
94 unsigned pix_fmt;
95
96 /*
97 * I/O pin allocation.
98 */
99 unsigned io_pin_allocation_mode:4;
100
101 /*
102 * Dumb panel -- assignment of R/G/B component info to the 24
103 * available external data lanes.
104 */
105 unsigned dumb_mode:4;
106 unsigned panel_rgb_reverse_lanes:1;
107
108 /*
109 * Dumb panel -- GPIO output data.
110 */
111 unsigned gpio_output_mask:8;
112 unsigned gpio_output_data:8;
113
114 /*
115 * Dumb panel -- configurable output signal polarity.
116 */
117 unsigned invert_composite_blank:1;
118 unsigned invert_pix_val_ena:1;
119 unsigned invert_pixclock:1;
120 unsigned invert_vsync:1;
121 unsigned invert_hsync:1;
122 unsigned panel_rbswap:1;
123 unsigned active:1;
124 unsigned enable_lcd:1;
125};
126
127#endif /* __ASM_MACH_PXA168FB_H */
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index c3b2a2aa7140..f0736cff2ca3 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -136,6 +136,15 @@
136#define S1DREG_DELAYOFF 0xFFFE 136#define S1DREG_DELAYOFF 0xFFFE
137#define S1DREG_DELAYON 0xFFFF 137#define S1DREG_DELAYON 0xFFFF
138 138
139#define BBLT_FIFO_EMPTY 0x00
140#define BBLT_FIFO_NOT_EMPTY 0x40
141#define BBLT_FIFO_NOT_FULL 0x30
142#define BBLT_FIFO_HALF_FULL 0x20
143#define BBLT_FIFO_FULL 0x10
144
145#define BBLT_SOLID_FILL 0x0c
146
147
139/* Note: all above defines should go in separate header files 148/* Note: all above defines should go in separate header files
140 when implementing other S1D13xxx chip support. */ 149 when implementing other S1D13xxx chip support. */
141 150